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

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

    +25

    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
    96. 96
    97. 97
    public OnPlayerSpawn(playerid) {
        IsSpawned[playerid]=1;
        if(Team[playerid]==ZOMBIE) { TextDrawSetString(Textdraw9[playerid],"You are a ~r~Zombie~w~. Kill & Infect every Human to complete your mission.");
    	} else if(Team[playerid]==HUMAN) { TextDrawSetString(Textdraw9[playerid],"You are a ~r~Human~w~. Prevent Zombie attacks and survive till the end."); }
        TextDrawHideForAll(Box); TextDrawHideForAll(text_Top5[0]); TextDrawHideForAll(text_Top5[1]);
    	TextDrawShowForPlayer(playerid, Textdraw0);	 TextDrawShowForPlayer(playerid, Textdraw1);
    	TextDrawShowForPlayer(playerid, Textdraw2);	 TextDrawShowForPlayer(playerid, Textdraw3);
    	TextDrawShowForPlayer(playerid, Textdraw4);	 TextDrawShowForPlayer(playerid, Textdraw5);
    	TextDrawShowForPlayer(playerid, Textdraw6);	 TextDrawShowForPlayer(playerid, Textdraw7);
    	TextDrawShowForPlayer(playerid, Textdraw9[playerid]);
    	TextDrawShowForPlayer(playerid, Textdraw15); TextDrawShowForPlayer(playerid, Textdraw16[playerid]);
    	SetTeam(playerid); SetClass(playerid); 
    	if(Infection==1) {
            Infection=0;
            if(Totalplayers>=2) {
    			SetTimer("InfectionLoad",0,0);
    		} else if(Totalplayers>=10) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=10) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=20) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=30) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=45) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=60) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers<=75) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}
    	} return 1; }

    Серьезно?

    d3n4, 08 Декабря 2012

    Комментарии (25)
  3. 1C / Говнокод #12239

    −120

    1. 1
    Мутабелен ли 1С.Овощи.Банан?

    Коллега считает что мутабелен.

    serpinski, 03 Декабря 2012

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

    +56

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    function issets($text)
    	{
    	if (isset($text) && $text != '')
    		return 1;
    		else
    		return 0;
    	}

    По просьбам радиослушателей :) Отрывок из админки неизвестного автора.
    Кусочки http://govnokod.ru/11650 , http://govnokod.ru/11647 , http://govnokod.ru/11646

    kindofbear, 28 Августа 2012

    Комментарии (25)
  5. Java / Говнокод #11596

    +70

    1. 1
    2. 2
    3. 3
    4. 4
    if( (r == g) && (g == b) && (b == 255) )
    {
    // .....
    }

    ...

    Anderson, 15 Августа 2012

    Комментарии (25)
  6. Java / Говнокод #11477

    +76

    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
    /* ------------------------------------------------------------ */
        private boolean isJspServlet ()
        {
            if (_servlet == null)
                return false;
            
            Class c = _servlet.getClass();
            
            boolean result = false;
            while (c != null && !result)
            {
                result = isJspServlet(c.getName());
                c = c.getSuperclass();
            }
            
            return result;
        }
        
        
        /* ------------------------------------------------------------ */
        private boolean isJspServlet (String classname)
        {
            if (classname == null)
                return false;
            return ("org.apache.jasper.servlet.JspServlet".equals(classname));
        }

    Копался в исходниках Jetty

    konsoletyper, 26 Июля 2012

    Комментарии (25)
  7. C++ / Говнокод #11348

    +15

    1. 1
    void* const allocateOrDie(const size_t Size) throw();

    Ультиматум. :)

    HaskellGovno, 03 Июля 2012

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

    +61

    1. 1
    $istmount = mysql_num_rows(mysql_query("SELECT `cid` FROM `usermail` WHERE `date` >='".date('Y-m-d', strtotime('-1 month'))."'"));

    Подсчет количества подписчиков за прошлый месяц. Про count(*) автор, похоже, не в курсе...
    И, чтобы не было вопросов про формат поля даты:
    date - это varchar(11) :)

    domaster, 15 Июня 2012

    Комментарии (25)
  9. PHP / Говнокод #10126

    +71

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    $var1 = "Строка";
    $var2 = true;
    
    var_dump($var1);
    var_dump($var2);
    if($var1 != $var2){
         echo "Не равны";
    }else{
         echo "Равны";
    }

    Недавно заметил странное поведение моего кода и вот что выяснилось.
    Исправил сравнением по типу !==.
    Не думал что такая вот хрень всплывет.

    haker, 01 Мая 2012

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

    +194

    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
    if(!menu_font||!oboima_text||!info||!infoR||!infoD||!infoBR||
          !oblaka1_tex||!fon1_tex||!fon2_tex||!fon3_tex||
          !galka_tex||!galka_menu_tex||!strelka_menu_tex||!strelka_menu_D_tex||
          !znak_myasnik_tex||!znak_strelok_tex||!znak_razrushitel_tex||!znak_tehnik_tex||
          !status_opit_tex||!status_udar_tex||!status_status_tex||!opit_okno_vibora_tex||
          !okno_lvl_progress_tex||!okno_lvl_progress_red_tex||!okno_lvl_progress_green_tex||!okno_lvl_polzunok_tex||
          !snd||!ak_reload1||!ak_reload2||!pm_fire||!pm_reload1||!pm_reload2||
          !pp19_fire||!pp19_reload1||!pp19_reload2||!fn_f2000_fire||!tt_fire||
          !mac_fire||!mac_reload1||!mac_reload2||!webley_fire||!webley_reload1||!webley_reload2||!milkor_fire||
          !fn_five_seven_fire||!winch_fire||!drob_reload1||!drob_pompa||!vzriv_grena1||
          !rocket_fire||!rocket2_fire||!rocket_polet||!rocket2_polet||
          !myaso_upalo1||!myaso_upalo2||!myaso_upalo3||!myaso_upalo4||!myaso_upalo5||!myaso_upalo6||!myaso_upalo7||
          !myaso_upalo8||
          !myaso_razriv_user1||!myaso_razriv_user2||
          !menu_sound||!menu_choose||
          !shot1||!headshot1||!headshot2||!headshot3||!headshot4||!headshot5||!headshot6||!headshot7||!headshot8||
          !ssik1||!ssik2||!ssik3|!ssik4||
          !ptenec_death1||
          !ak||!ak2||!ak_upgraded||!ak2_upgraded||!w_pm_tex||!w_pp19_vityaz_tex||!w_fn_f2000_tex||!w_fn_f2000_upgraded_tex||
          !w_tt_tex||!w_rpk_tex||!w_mac_tex||
          !w_winchester_tex||!w_winchester_anime_tex||!w_rpk47_tex||!w_glok_tex||!w_glok2_tex||!w_rgd5_tex||!w_milkor_tex||
          !w_panzer_tex||!w_panzer_out_tex||!w_webley_tex||!w_fn_five_seven_tex||!w_granata_podstvol_tex||!w_granata_panzer_tex||
          !w_qlz87_pushka_tex||!w_qlz87_trenoga_tex||!katana_udar_sleva_tex||
          !blood1_tex||!blood2_tex||!blood3_tex||!blood_shot1_tex||
          !blood_plyam1_tex||!blood_plyam2_tex||!blood_plyam3_tex||!blood_luzha1_tex||
          !blood_myaso1_tex||!blood_myaso2_tex||!blood_myaso3_tex||!blood_myaso4_tex||!blood_myaso5_tex||
          !blood_zayac_noga1_tex||!blood_zayac_noga2_tex||!blood_zayac_noga3_tex||!blood_zayac_noga4_tex||
          !blood_zayac_rebra1_tex||!blood_zayac_rebra2_tex||
          !blood_vzriv1_a_tex||!blood_vzriv1_b_tex||!blood_vzriv1_c_tex||!blood_vzriv1_d_tex||!blood_vzriv1_e_tex||
          !blood_vzriv1_e2_tex||
          !player1_myasnik_gogranata_ruka1_tex||!player1_myasnik_gogranata_ruka2_tex||
          !player1_strelok_gogranata_ruka1_tex||!player1_strelok_gogranata_ruka2_tex||
          !player1_razrushitel_gogranata_ruka1_tex||!player1_razrushitel_gogranata_ruka2_tex||    
          !player1_tehnik_gogranata_ruka1_tex||!player1_tehnik_gogranata_ruka2_tex||
          !player1_myasnik_tex||!player1_strelok_tex||!player1_razrushitel_tex||!player1_tehnik_tex||
          !player1_myasnik_ruka1_udar_sleva_tex||!player1_strelok_ruka1_udar_sleva_tex||
          !player1_razrushitel_ruka1_udar_sleva_tex||!player1_tehnik_ruka1_udar_sleva_tex||
          !player1_myasnik_ruka1_pistol_tex||!player1_strelok_ruka1_pistol_tex||
          !player1_razrushitel_ruka1_pistol_tex||!player1_tehnik_ruka1_pistol_tex||
          !player1_myasnik_ruka1_vintovka_tex||!player1_strelok_ruka1_vintovka_tex||
          !player1_razrushitel_ruka1_vintovka_tex||!player1_tehnik_ruka1_vintovka_tex||
          !player1_myasnik_ruka1_winch_tex||!player1_strelok_ruka1_winch_tex||
          !player1_razrushitel_ruka1_winch_tex||!player1_tehnik_ruka1_winch_tex||
          !player2_strelok_tex||!player2_gogranata_ruka1_tex||!player2_gogranata_ruka2_tex||
          !player2_strelok_ruka1_udar_sleva_tex||!player2_strelok_ruka1_vintovka_tex||!player2_strelok_ruka1_pistol_tex||
          !zayac_go_tex||!zayac_uhi_k_tex||!zayac_uhi_s_tex||!zayac_uhi_tex||
          !zayac_boshka_tex||!zayac_boshka_bezuh_tex||
          !volk_go_tex||!volk_trup1_a_tex||!volk_trup1_b_tex||!volk_trup1_c_tex||
          !medved_go_tex||!medved_boshka1_tex||

    http://www.gamedev.ru/projects/forum/?id=160897
    ЩИ!!!! ЗАЛЕЙ ВЕСЬ ЭКРАН КРОВЬЮ УВИДЕВ ИСХОДНЫЙ КОД

    TarasB, 09 Апреля 2012

    Комментарии (25)
  11. JavaScript / Говнокод #9880

    +149

    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
    $(function(){
      // ... тут могла быть ваша реклама
      var answers_height = 0;
      $(".game-test .answers li a").each(function(){                              // Array.prototype.sort не для нас (как и underscore.js' max)
        if (answers_height < $(this).height()) answers_height = $(this).height();
      }).click(function(){                                                        // чувак не в курсе, что можно вешать онклик прямо на li
        $(this).parent().addClass("checked").siblings().removeClass("checked");   // ничего jQuery#parent() нас спасёт
        $(this).parent().find("input").click();                                   // замкнуть инпут в переменную не для нас
        alert($(this).parent().parent().find("input:checked").val());             // да и зачем, когда есть jQuery?
        return false;                                                             // Event#preventDefault() не для нас, но ничего, jQuery поймёт и так
      });
      $(".game-test .answers li a").height(answers_height);                       // ах да, совсем забыл...
    });

    давным-давно известно, что верстальщики не умеют кодить, но всё же

    P.S. JQuery говно.

    maker_up, 06 Апреля 2012

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