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

    В номинации:
    За время:
  2. Python / Говнокод #6709

    −98

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    # -*- coding: cp1251 -*- 
    beer = u"бутылок пива стоят на столе. Одна упала."
    botle = 100
    for i in range(1, 100):
        print (botle-i), beer
    print u"Нету больше пива на столе :-("

    Пива не будет :-(

    Govnocoder#0xFF, 19 Мая 2011

    Комментарии (56)
  3. Куча / Говнокод #6193

    +140

    1. 1
    <!-- Скрипт иерархичесского аккардиона -->

    Не говнокод, но говноречь - 3 ошибки в 2 словах.
    "Девелоперы" научились подключать jQuery, а вот русский язык пока что не осилили.
    Эти грамотеи работают на "Первом канале", см. http://www.1tv.ru/videoarchiver/.

    ZX_Spectrum, 02 Апреля 2011

    Комментарии (56)
  4. C++ / Говнокод #4884

    +159

    1. 1
    int** ppi = new int*;

    bot225, 09 Декабря 2010

    Комментарии (56)
  5. PHP / Говнокод #3426

    +149

    1. 1
    2. 2
    3. 3
    4. 4
    <?php
          @require_once('something-that-doesnot-exists.php');
          echo 'My etogo uzhe ne prochitaem((';
    ?>

    Баг ПХП. 4 часа искал методом научного echo. Ошибки не выдает, завершает выполнение как будто вызвали exit() or die(). Растолкуйте в чем суть?
    Но всё-таки виновати разработчики CodeIgniter. Они нарушили принцип KISS (keep it simple). Я например, никогда не использую @ (даже незнаю к чему этот отросток).

    increazon, 08 Июня 2010

    Комментарии (56)
  6. PHP / Говнокод #3316

    +164

    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
    // set admin mode
    switch (true) {
      case $nc_core->inside_admin:
        $nc_core->admin_mode = true;
      break;
      case !$passed_thru_404 && isset($posting): // add (edit) action
        $nc_core->admin_mode = $admin_mode;
      break;
      case !$passed_thru_404: //front-office
        $nc_core->admin_mode = true;
      break;
      case $passed_thru_404:
        $nc_core->admin_mode = false;
      break;
      default:
        $nc_core->admin_mode = false;
    }

    /netcat/require/index.php
    Что они там курят, что у них настолько извилины выпрямляются?!

    telnet, 26 Мая 2010

    Комментарии (56)
  7. Pascal / Говнокод #3124

    +101

    1. 1
    2. 2
    3. 3
    if IntToStr(n) = '2' then begin
      ///  Еще куча говнокода
    end;

    Устроился я тут работать в одну компанию... Начинаю серию публикаций... Название компании пока не буду озвучивать - еще уволят нах...
    Начнём с чего-нибудь простенького :)

    goodron, 28 Апреля 2010

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

    +160.4

    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
    <?php
     $form = new Validator;
     $form
         ->newString(Request::get('nickname'));
         ->addRules(
             new FW\Rules\NotEmpty(),
             new FW\Rules\Length(4, 16),
             new FW\Rules\RegExp('/^[a-z]+$/i')
         );
         ->newString(Request::get('password'))
         ->addRules(
             new FW\Rules\NotEmpty(),
             new FW\Rules\MinLength(3),
             new App\Rules\PasswordStrength(40)
         );
         ->newString(Request::get('confirm'))
         ->addRules(
             new FW\Rules\NotEmpty(),
             new FW\Rules\Equals(Request::get('password'))
         )
         ->newString(Request::get('email'))
         ->addRules(
             new FW\Rules\NotEmpty(),
             new FW\Rules\ValidEmail(Request::get('email'))
         );
     if ($form->isValid()) {
         reg_user(Request::get('nickname'), Request::get('password'), Request::get('email'));
     } else {
         print_r($form->getErrors());
     }

    Народ ёбнулся на ООП

    Mitusbka, 04 Ноября 2009

    Комментарии (56)
  9. JavaScript / Говнокод #28785

    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
    if (this.$arg0 == 'inc')    this.$ret = this.$math = args[0] + 1;
            if (this.$arg0 == 'dec')    this.$ret = this.$math = args[0] - 1;
            if (this.$arg0 == 'div')    this.$ret = this.$math = args[0] / args[1];
            if (this.$arg0 == 'ceil')   this.$ret = this.$math = Math.ceil(args[0]);
            if (this.$arg0 == 'floor')  this.$ret = this.$math = Math.floor(args[0]);
            if (this.$arg0 == 'sqrt')   this.$ret = this.$math = Math.sqrt(args[0]);
            if (this.$arg0 == 'exp')    this.$ret = this.$math = Math.exp(args[0]);
            if (this.$arg0 == 'log')    this.$ret = this.$math = Math.log(args[0]);
            if (this.$arg0 == 'sin')    this.$ret = this.$math = Math.sign(args[0]);
            if (this.$arg0 == 'log10')  this.$ret = this.$math = Math.log10(args[0]);
            if (this.$arg0 == 'cos')    this.$ret = this.$math = Math.cos(args[0]);
            if (this.$arg0 == 'tan')    this.$ret = this.$math = Math.tan(args[0]);
            if (this.$arg0 == 'acos')   this.$ret = this.$math = Math.acos(args[0]);
            if (this.$arg0 == 'atan')   this.$ret = this.$math = Math.atan(args[0]);
            if (this.$arg0 == 'round')  this.$ret = this.$math = Math.round(args[0]);
            if (this.$arg0 == 'atan2')  this.$ret = this.$math = Math.atan2(args[0]);

    Исходный код интерпретатора компилятора (!) Языка Программирования «AsmX».
    https://github.com/langprogramming-AsmX/AsmX/blob/main/compiler.js#L215

    ISO, 19 Мая 2023

    Комментарии (55)
  10. Си / Говнокод #28309

    +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
    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
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    #include <stdio.h>
    #include <string.h>
    #include <inttypes.h>
    
    void swap(uint8_t *x, uint8_t *y)
    {
        uint8_t tmp;
        tmp = *x;
        *x = *y;
        *y = tmp;
    }
    
    // эту хуйню тоже можно нагенерировать
    uint64_t cmp_bits(uint8_t a[restrict 9])
    {
      return 
      ((uint64_t)(a[0] < a[1]) << 0) |
      ((uint64_t)(a[0] < a[2]) << 1) |
      ((uint64_t)(a[0] < a[3]) << 2) |
      ((uint64_t)(a[0] < a[4]) << 3) |
      ((uint64_t)(a[0] < a[5]) << 4) |
      ((uint64_t)(a[0] < a[6]) << 5) |
      ((uint64_t)(a[0] < a[7]) << 6) |
      ((uint64_t)(a[0] < a[8]) << 7) |
    
      ((uint64_t)(a[1] < a[2]) << 8)  |
      ((uint64_t)(a[1] < a[3]) << 9)  |
      ((uint64_t)(a[1] < a[4]) << 10) |
      ((uint64_t)(a[1] < a[5]) << 11) |
      ((uint64_t)(a[1] < a[6]) << 12) |
      ((uint64_t)(a[1] < a[7]) << 13) |
      ((uint64_t)(a[1] < a[8]) << 14) |
    
      ((uint64_t)(a[2] < a[3]) << 15) |
      ((uint64_t)(a[2] < a[4]) << 16) |
      ((uint64_t)(a[2] < a[5]) << 17) |
      ((uint64_t)(a[2] < a[6]) << 18) |
      ((uint64_t)(a[2] < a[7]) << 19) |
      ((uint64_t)(a[2] < a[8]) << 20) |
    
      ((uint64_t)(a[3] < a[4]) << 21) |
      ((uint64_t)(a[3] < a[5]) << 22) |
      ((uint64_t)(a[3] < a[6]) << 23) |
      ((uint64_t)(a[3] < a[7]) << 24) |
      ((uint64_t)(a[3] < a[8]) << 25) |
    
      ((uint64_t)(a[4] < a[5]) << 26) |
      ((uint64_t)(a[4] < a[6]) << 27) |
      ((uint64_t)(a[4] < a[7]) << 28) |
      ((uint64_t)(a[4] < a[8]) << 29) |
    
      ((uint64_t)(a[5] < a[6]) << 30) |
      ((uint64_t)(a[5] < a[7]) << 31) |
      ((uint64_t)(a[5] < a[8]) << 32) |
    
      ((uint64_t)(a[6] < a[7]) << 33) |
      ((uint64_t)(a[6] < a[8]) << 34) |
    
      ((uint64_t)(a[7] < a[8]) << 35);
    }
    
    void printshit(uint8_t a[restrict 9])
    {
      size_t i = 0;
      while(*a != 4)
      {
        a++;
        i++;
      }
      printf("arr[%" PRIu64 "] = %zu\n", cmp_bits(a), i);
    }
    
    void permute(char *a, size_t l, size_t r)
    {
      size_t i;
      if (l == r)
        printshit(a);
      else
      {
        for (i = l; i <= r; i++)
        {
          swap((a+l), (a+i));
          permute(a, l+1, r);
          swap((a+l), (a+i));
        }
      }
    }
    
    int main()
    {
        uint8_t a[] = {0,1,2,3,4,5,6,7,8};
        size_t n = 9;
        permute(a, 0, n-1);
        return 0;
    }

    https://govnokod.ru/24496#comment782476

    Построение таблицы поиска для быстрого нахождения медианы. Там эту хуйню конечно можно улучшить, например запаковывать число от 0 до 8 в хуйни по 4 бита

    j123123, 31 Июля 2022

    Комментарии (55)
  11. Куча / Говнокод #27507

    +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
    import std.stdio;
    
    template GenMix()
    {
      const char[] GenMix = 
        "template GenMix2()" ~
        "{" ~
        "  const char[] GenMix2 = \"writeln(\\\"Hello, Wandbox!\\\");\";" ~
        "};";
    }
    
    template MixMix(string Name)
    {
      const char[] MixMix = "mixin(" ~ Name ~ "!());";
    }
    
    mixin(GenMix!());
    
    
    void main()
    {
      mixin(GenMix2!());
      mixin(MixMix!("GenMix2"));
    }

    https://wandbox.org/permlink/1HpjfgrgVLyBSrXG

    ГОМОИКОННОСТЬ в D

    j123123, 10 Июля 2021

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