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

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

    +144.9

    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
    //も行ってみよう!
               define('真',true);
               echo 真;
         
         
                //適応少し
                define('の',true);
                define('を返します',false);
         
              $外側 = "暖かい";
              $温度計を示しています = の;
              $何 = "まだ何もない";
              if ($温度計を示しています && $外側 == "暖かい" ) {
              $何 = "行くことができます";
              } else {
              $何 = "ホームステイ";
              }
         
              echo "本日 " . $外側. ", 従って " . $何;
         
         
              $_COOKIES['練乳'] = "1кг";
              $_COOKIES['チョコレート'] = "2кг";
              $_COOKIES['クラッカー'] = "3кг";
              $_クッキー = $_COOKIES;
         
              //та-акс.. Проверим печеньки
              echo "<pre>";
              print_r($_クッキー);
              echo "</pre>";
         
              //так работает
              function ロック機能(){
                $変数2 = "это мегакруто :)";
                return $変数2;
              }
         
         
              function ロック機能2($変数){
                 $変数2 = "<br>Да, это ". $変数 . ", хотя и бесполезно";
                 return $変数2;
              }
         
              $変数 = "Кириллица в названиях переменных<br>";
              echo $変数;
              echo $変数2 = ロック機能();
              echo ロック機能2($変数2);

    переведите с японского на русский (с)хабра

    ChakuZa, 27 Января 2010

    Комментарии (12)
  3. Си / Говнокод #2489

    +144.9

    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
    node_t* read_record(FILE *file) {
        int success = 0;
        node_t *record = 0;
        do {
            int nsz, dsz;
            record = (node_t*)malloc(sizeof(node_t));
            if (!record) {
                break;
            }
            record->data = 0;
            record->next = 0;
    
            if (fread(&nsz, sizeof(int), 1, file) != 1 || feof(file)) {
                break;
            }
    
            if (fread(record->name, 1, nsz, file) != nsz || feof(file)) {
                break;
            }
    
            /* ... */
    
            record->nsz = nsz;
            record->dsz = dsz;
            success = 1;
        } while (0);
    
        if (record && !success) {
            free_list(record);
            record = 0;
        }
    
        return record;
    }
    
    
    void write_record(FILE *file, node_t *record) {
        int dsz = record->dsz;
        int nsz = record->nsz;
    
        if ((fwrite(&nsz, sizeof(int), 1, file) != 1) ||
            (fwrite(record->name, 1, nsz, file) != nsz) ||
            (fwrite(&csz, sizeof(int), 1, file) != 1) ||
            (fwrite(record->data, 1, dsz, file) != dsz) ||
            ferror(file)) {
            fputs("Error: write_record", stderr);
        }
    }

    govnopetya, 26 Января 2010

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

    +144.9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    /*
      Func get_top($msg_number,$lines)
      Access: Public
    */
    function get_top( $msg_number , $lines = "0" )
    {
     // ....
    }

    Очень ценный комментарий к функции, о одном классе.. Более того, там все каменты в этом стиле. Кэп снова с нами!

    mE, 16 Января 2010

    Комментарии (3)
  5. Си / Говнокод #2421

    +144.9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    char str[n]="Programmirivanie eto horoshiy predmet";
         for(i=0; i<n; i++)
         {
              printf("%c", str[i]);
         }
         printf("\n");

    Без комментариев ))

    Grockles, 15 Января 2010

    Комментарии (18)
  6. Pascal / Говнокод #2412

    +144.9

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    function ... : Integer;
    var
      i:integer;
    begin
      Result := 0;
      for i := 1 to ... do
        if bla-bla then
          inc(Result);
      Result := Result;
    end;

    popa, 14 Января 2010

    Комментарии (17)
  7. PHP / Говнокод #2352

    +144.9

    1. 1
    2. 2
    3. 3
    foreach ($quote as $quote_key => $quote_value) {
    $tpl[$key] = $value;
    }

    $quote = $tpl; как бы слишком коротко..

    Deromanok, 29 Декабря 2009

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

    +144.9

    1. 1
    <a href="javascript:void(0)" onclick="this.parentNode.submit(); return false;">Добавить</a>

    в ответ на http://govnokod.ru/1994 и длинный флуд в коментах.
    говнокод или нормально?

    tinimi, 20 Октября 2009

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

    +144.9

    1. 1
    /a-z{3,}/.test(str);

    Проверка содержит ли функция 3 символа алфавита или больше.
    Правильно так: /[a-z]{3,}/

    Oleg_quadro, 11 Августа 2009

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

    +144.9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $data=funny_parser($data);
    //модуль недобавления слов вконец
    
    $andtr=array('Андатра','Выпь','Пеликан','Пучеглаз','Хвостозуб','Декроль','Устрица','Челюстёлог','Рукоед','Йыждивение','Оторопь','Осётр','Кингура','Большой лось','Пученоска','Вомбат','Плоскогубка','');
    $data=$data.' <span style="color:#93FF4A;font-size:15px">'.$andtr[rand(0,count($andtr)-1) ].'</span>';

    кусок кода из upyachka.ru =)
    этим всё сказано

    pusher, 11 Августа 2009

    Комментарии (3)
  11. PHP / Говнокод #1070

    +144.9

    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
    function custom_print ($custom_category, $custom_template, $aviable, $custom_from, $custom_limit, $custom_cache, $do){
      global $db, $is_logged, $member_id, $xf_inited, $cat_info, $config, $user_group, $category_id, $_TIME, $lang;
    
    
      $do = $do ? $do : "main";
      $aviable = explode ('|', $aviable);
    
      if(!(in_array($do, $aviable)) AND ($aviable[0] != "global")) return "";
    
      $custom_category  = $db->safesql(str_replace(',', '|', $custom_category));
      $custom_from = intval($custom_from);
      $custom_limit = intval($custom_limit);
      $thisdate = date ("Y-m-d H:i:s", (time()+ $config['date_adjust']*60));
    
      if (intval($config['no_date'])) $where_date = " AND date < '".$thisdate."'"; else $where_date = "";
    
      $tpl = new dle_template;
      $tpl->dir = TEMPLATE_DIR;
    
      //if ($custom_cache == "yes") $config['allow_cache'] = "yes"; else $config['allow_cache'] = false;
      if ($is_logged AND ($user_group[$member_id['user_group']]['allow_edit'] AND !$user_group[$member_id['user_group']]['allow_all_edit'])) $config['allow_cache'] = false;
    
      $content = dle_cache("custom", "cat_".$custom_category."template_".$custom_template."from_".$custom_from."limit_".$custom_limit, true);
    
      if ($content) { return $content; }
      else {
    
      $allow_list = explode (',', $user_group[$member_id['user_group']]['allow_cats']);
    
      if ($allow_list[0] != "all") {
    
        if ($config['allow_multi_category']) {
    
          $stop_list = "category regexp '[[:<:]](".implode ('|', $allow_list).")[[:>:]]' AND ";
    
        } else {
    
          $stop_list = "category IN ('".implode ("','", $allow_list)."') AND ";
    
        }
    
      } else $stop_list = "";
    
      if ($user_group[$member_id['user_group']]['allow_short']) $stop_list = "";
    
      if ($cat_info[$custom_category]['news_sort'] != "") $config['news_sort'] = $cat_info[$custom_category]['news_sort'];
      if ($cat_info[$custom_category]['news_msort'] != "") $config['news_msort'] = $cat_info[$custom_category]['news_msort'];
    
        if ($config['allow_multi_category']) {
    
          $where_category = "category regexp '[[:<:]](".$custom_category.")[[:>:]]'";
    
        } else {
    
          $custom_category = str_replace ("|", "','", $custom_category);
          $where_category = "category IN ('".$custom_category."')";
    
        }
    
        $sql_select = "SELECT " . PREFIX . "_post.id, gallery, autor, date," . PREFIX . "_post.image," . PREFIX . "_post.imgtype, short_story, full_story, " . PREFIX . "_post.xfields, title, category, alt_name, " . PREFIX . "_post.comm_num, " . PREFIX . "_post.allow_comm, allow_rate, " . PREFIX . "_post.rating, " . PREFIX . "_post.vote_num, news_read, " . PREFIX . "_post.flag, " . PREFIX . "_users.fullname FROM " . PREFIX . "_post , " . PREFIX . "_users WHERE " . PREFIX . "_post.autor=" . PREFIX . "_users.name and ".$stop_list.$where_category." AND approve = '1'".$where_date." ORDER BY ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$custom_from.",".$custom_limit;
    //echo $sql_select;
      include (ENGINE_DIR.'/modules/show.custom.php');
    
        if ($config['files_allow'] == "yes")
          if ( strpos( $tpl->result['content'], "[attachment=" ) !== false)
          {
            $tpl->result['content'] = show_attach($tpl->result['content'], $attachments);
          }
    
        create_cache("custom", $tpl->result['content'], "cat_".$custom_category."template_".$custom_template."from_".$custom_from."limit_".$custom_limit, true);
    
      }
      return $tpl->result['content'];
    }

    Проект, который поддерживаю по работе просто пестрит такими вещими. Время убивает просто жуть. :((

    Мораль: Не экономьте на программистах. Не давайте студентам и дешевым фрилансерам писать проекты. Поддержка говна обойдется втридорого.

    guest, 20 Мая 2009

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