1. Лучший говнокод

    В номинации:
    За время:
  2. Куча / Говнокод #24154

    −109

    1. 1
    Админ, забань Ильяса.

    blackray, 19 Апреля 2018

    Комментарии (10)
  3. Pascal / Говнокод #24061

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    unit Unit1;
    interface
    uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, jpeg, ExtCtrls, ComCtrls;
    
    type
    TForm1 = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    ...
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    GroupBox2: TGroupBox;
    RadioButton5: TRadioButton;
    RadioButton6: TRadioButton;
    RadioButton7: TRadioButton;
    RadioButton8: TRadioButton;
    GroupBox3: TGroupBox;
    RadioButton9: TRadioButton;
    RadioButton10: TRadioButton;
    ...
    GroupBox14: TGroupBox;
    RadioButton52: TRadioButton;
    RadioButton53: TRadioButton;
    RadioButton54: TRadioButton;
    RadioButton55: TRadioButton;
    GroupBox15: TGroupBox;
    RadioButton56: TRadioButton;
    RadioButton57: TRadioButton;
    RadioButton58: TRadioButton;
    RadioButton59: TRadioButton;
    
    ... 
    end;
    
    var 
    Form1: TForm1;
    
    implementation 
    
    {$R *.dfm}
    
    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
    form1.Close;
    end;
    procedure TForm1.Button2Click(Sender: TObject);
    var s: integer;
    begin
    Button3.enabled:=true;
    
    s:=0;
    if Form1.RadioButton2.Checked then s:=s+1;
    if Form1.RadioButton6.Checked then s:=s+1;
    if Form1.RadioButton20.Checked then s:=s+1;
    if Form1.RadioButton15.Checked then s:=s+1;
    if Form1.RadioButton11.Checked then s:=s+1;
    if Form1.RadioButton21.Checked then s:=s+1;
    if Form1.RadioButton24.Checked then s:=s+1;
    if Form1.RadioButton28.Checked then s:=s+1;
    if Form1.RadioButton33.Checked then s:=s+1;
    if Form1.RadioButton39.Checked then s:=s+1;
    if Form1.RadioButton43.Checked then s:=s+1;
    if Form1.RadioButton44.Checked then s:=s+1;
    if Form1.RadioButton50.Checked then s:=s+1;
    if Form1.RadioButton54.Checked then s:=s+1;
    if Form1.RadioButton56.Checked then s:=s+1;
    
    if s=15 then Label3.Caption:=' Молодец, ты ответил на все вопросы!(Твоя оценка 5)';
    if s=14 then Label3.Caption:=' Молодец, ты ответил на четырнадцать вопросов!(Твоя оценка 5)';
    if s=13 then Label3.Caption:=' Молодец, ты ответил на 13 вопросов!(Твоя оценка 5)';
    if s=12 then Label3.Caption:=' Хорошо, ты ответил на 12!(Твоя оценка 4)';
    if s=11 then Label3.Caption:=' Ты ответил на все 11!(Твоя оценка 4)';
    if s=10 then Label3.Caption:='10 парвильных ответов молодец!(Твоя оценка 4)";
    if s=9 then Label3.Caption:='9 ПРАВИЛЬНЫХ ОТВЕТОВ!(Твоя оценка 3)';
    if s=8 then Label3.Caption:='Отлично! Ты ответил на 8 вопрос(Твоя оценка 3)';
    if s=7 then Label3.Caption:='Молодец! Ты ответил на 7 вопрос(Твоя оценка 3)';
    if s=6 then Label3.Caption:='6 Вопросов? Ты не плох!(Твоя оценка 3)';
    if s=5 then Label3.Caption:='5 правильных вопросов! ура!(Твоя оценка 2)';
    if s=4 then Label3.Caption:='Учи предмет лучше! Всего 4 правильных вопроса!(Твоя оценка 2)';
    if s=3 then Label3.Caption:=' Слабо! Всего 3 правильных ответа!(Твоя оценка 2)';
    if s=2 then label3.Caption:=' Всего 2 правильных ответа!( Твоя оценка 2)';
    if s=1 then label3.Caption:=' Тебе не быть программистом! Всего 1 правильный ответ!(Твоя оценка 2)';
    if s=0 then label3.Caption:=' Давай заново!(Твоя оценка 2)';
    
    end;

    Автор пытается сделать тест по информатике. Вроде бы для диплома.

    Alex11223, 03 Апреля 2018

    Комментарии (10)
  4. PHP / Говнокод #23942

    −4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if ($memberInfo['member_profile_image'] != ''):
                                                $memberInfo['photoCount'] = $memberInfo['photoCount'] ;
                                            else:
                                            	$memberInfo['photoCount'] = $memberInfo['photoCount'];
                                                
                                            endif;

    6 строчек кода, а этот код не делает ничего. От слова совсем

    gorsash, 16 Марта 2018

    Комментарии (10)
  5. C++ / Говнокод #23938

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    Antony Polukhin
     in 
    pro.cxx
    Кстати, в EWG одобрили constexpr контейнеры http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0784r1.html
    так что есть все шансы к С++20 писать:
    constexpr std::string result = foo();
    t.me/ProCxx
    /184343
    Mar 16 at 10:47

    Library pragmatism

    Current implementations of standard libraries sometimes perform various raw storage operations through interfaces other than the standard allocator and allocator traits. That may make it difficult to make the associated components usable in constexpr components. Based on a cursory examination of current practices, we therefore propose to start only with the requirement that the container templates in the [containers] clause be usable in constexpr evaluation, when instantiated over literal types and the default allocator. In particular, this excludes std::string, std::variant, and various other allocating components. Again, it is our hope we will be able to extend support to more components in the future.

    With regards to the default allocator and allocator traits implementation, the majority of the work is envisioned in the constexpr evaluator: It will recognize those specific components and implement their members directly (without necessarily regarding the library definition).
    We might, however, consider decorating the class members with the constexpr keyword. Also, some implementations provide extra members in these class templates (such as libc++'s allocator_traits<A>::__construct_forward ) that perform non-constexpr-friendly operations (memcpy, in particular). Lifting such members to standard status would help interoperability between library and compiler implementations.

    j123123, 16 Марта 2018

    Комментарии (10)
  6. JavaScript / Говнокод #23725

    0

    1. 1
    2. 2
    3. 3
    4. 4
    bool tokensExistence = !(access_token == null || refresh_token == null || access_token.Value == String.Empty || refresh_token.Value == String.Empty);
    if (!tokensExistence && AuthorizedAccess){
     //...
    }

    ichi404, 12 Февраля 2018

    Комментарии (10)
  7. Java / Говнокод #23699

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    public class App extends Application {
    
        public static Context appContext;
    
        @Override
        public void onCreate() {
            super.onCreate();
            appContext = getApplicationContext();
        }
    }

    Нужно больше контекста...

    ausichenko, 02 Февраля 2018

    Комментарии (10)
  8. PHP / Говнокод #23605

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    function convert_data($data,$fromTo="MQL")
    {
      if($fromTo=='MQL') {
        $P=explode("-",$data);
        return $P[2].".".$P[1].".".$P[0];
      } else {
        $P=explode(".",$data);
        return $P[2]."-".$P[1]."-".$P[0];
      }
    }

    Подготавливаем дату для сохранения в базу

    SeniorShaurman, 21 Декабря 2017

    Комментарии (10)
  9. Java / Говнокод #23558

    −3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    import java.io.*;
    
    class Cat {
        String name;
        int age;
        int weight;
        int length;
    
        void printen(String name, int age, int weight, int length){
            String text1 = "Имя кота: " + name + ", " + "Возраст кота: " + age + ", " + "Вес кота: " + weight + ", " + "Длина кота: " + length;
            System.out.println(text1);
        }
    }
    class CatTestDrive{
        public static void main(String[] args) throws Exception{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    
    
            Cat[] cats = new Cat[5];
            for (int i = 0; i < cats.length; i++){
                cats[i] = new Cat();
                System.out.println("Введите имя " + (i+1) + " кота: ");
                cats[i].name = reader.readLine();
                System.out.println("Введите возраст " + cats[i].name + ": ");
                cats[i].age = Integer.parseInt(reader.readLine());
                System.out.println("Введите вес " + cats[i].name + ": ");
                cats[i].weight = Integer.parseInt(reader.readLine());
                System.out.println("Введите длину " + cats[i].name + ": ");
                cats[i].length = Integer.parseInt(reader.readLine());
            }
            for (int i = 0; i < cats.length; i++){
                cats[i].printen(cats[i].name, cats[i].age, cats[i].weight, cats[i].length);
            }
        }
    
    }

    Программа создает котов и вводит с клавиатуры их характеристики, затем выводит данные на экран в виде строки.
    Как можно улучшить? Критикуйте!

    babushkaAntona, 20 Ноября 2017

    Комментарии (10)
  10. PHP / Говнокод #23549

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    class Yandex{
      require_once _DIR_ . '/vendor/autoload.php';
      class_alias('\Arhitector\Yandex\Disk', 'Yandex');
    
    
      // передать OAuth-токен зарегистрированного приложения.
      $disk = new Yandex('AQAAAAAeTQ-yAARKyGCP7TY2MU0aggYZ7ucZFwI');
    
      /**
       * Получить Объектно Ориентированное представление закрытого ресурса.
       * @var  Arhitector\Yandex\Disk\Resource\Closed $resource
       */
      $resource = $disk->getResource('0000 Техническое задание (2).pdf');
    
      // проверить сущестует такой файл на диске ?
      $resource->has(); // вернет, например, false
    
      // загрузить файл на диск под имененм "новый файл.txt".
      $resource->upload(__DIR__ . '/0000 Техническое задание (1).pdf');
    
      // файл загружен, вывести информацию.
      echo '<pre>';
      var_dump($resource->toArray());
    }

    Нашёл на работе

    slexx1234, 17 Ноября 2017

    Комментарии (10)
  11. Python / Говнокод #23476

    +3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    if cur == 'EUR':
            alldata['total'] = alldata['total'] * Decimal(58)
            alldata['cost'] = alldata['cost'] * Decimal(58)
        elif cur == 'USD':
            alldata['total'] = alldata['total'] * Decimal(62)
            alldata['cost'] = alldata['cost'] * Decimal(62)
        elif cur == 'GBP':
            alldata['total'] = alldata['total'] * Decimal(71)
            alldata['cost'] = alldata['cost'] * Decimal(71)
        elif cur == 'UAH':
            alldata['total'] = alldata['total'] * Decimal(2)
            alldata['cost'] = alldata['cost'] * Decimal(2)

    Простой конвертер валют своими руками!
    💩-💩 и в продакшен!!!

    farmspam, 02 Ноября 2017

    Комментарии (10)