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

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

    +162

    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
    // first wtf part:
    if (__captcha.ammount > 0) {
        var captcha = new Array();
        
        for (var i in __captcha.queue) {
            captcha = __captcha.queue[i];
            delete __captcha.queue[i];
            break;
        }
        
        __captcha.ammount--;
        __update();
        
        return captcha;
    }
    // second wtf part:
    __captcha.queue[__captcha.ammount++] = new Array(
    	$("form.__LBH-form #recaptcha_challenge_field").val(),
    	$("form.__LBH-form #recaptcha_response_field").val()
    );

    Нашёл в каком-то кривом юзерскрипте.
    Первое -- это такая хитрая реализация pop. Видимо, простой вызов array.pop() автору чем-то не угодил.
    Второе -- вообще чудо. Вместо array.length автор зачем-то создал свой ammount (заметьте, две "m"!), а вместо array.append() юзает какую-то кривую шнягу.

    popoffka, 07 Мая 2011

    Комментарии (15)
  3. JavaScript / Говнокод #6582

    +153

    1. 1
    $('a ul.switcher').click(function(){

    Писал спросони, минут 5 не мог понять, почему не работает этот код :)

    Jetti, 07 Мая 2011

    Комментарии (15)
  4. Ruby / Говнокод #6567

    −102

    1. 1
    Task.joins(:owners).where(:users => {:id => current_user}).order("tasks.weight DESC").limit(1).first

    intale, 06 Мая 2011

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

    +124

    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
    if (command == "help") ShowHelp();
                else if (command == "") Error(1);
                else
                {
                    string[] pcmd = command.Split(' ');
                    string[] args = { "0,0", "0,0" };
                    string argv = "Black";
                    if (pcmd[0] != "setColor" &&
                        pcmd[0] != "save" &&
                        pcmd[0] != "fill" &&
                        pcmd[0] != "saveCMD" &&
                        pcmd[0] != "close" &&
                        pcmd[0] != "if" &&
                        pcmd[0] != "from" &&
                        pcmd[0] != "setVar" &&
                        pcmd[0] != "getVar" &&
                        pcmd[0] != "setRGB" &&
                        pcmd[0] != "fillFRGB" &&
                        pcmd[0] != "fillRGB" &&
                        pcmd[0] != "setPenSize" &&
                        pcmd[0] != "fillF" &&
                        pcmd[1] != "#?") args = pcmd[1].Split('|');
                    else if (pcmd[0] == "setVar") argv = pcmd[1] + " " + pcmd[3];
                    else if (pcmd[1] == "#?")
                    {
                        Help4command(pcmd[0]);
                        return;
                    }
                    else argv = pcmd[1];
                    switch (pcmd[0])
                    {
                        case "save":
                            try { bmp.Save(argv + "\\" + Name + ".png",ImageFormat.Png); }
                            catch { Error(2); }
                            break;
                        case "line":
                            {
                                string[] xy0 = args[0].Split(',');
                                string[] xy1 = args[1].Split(',');
                                int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
                                if (xy0[0] == "w" || xy0[0] == "W") x0 = W;
                                if (xy0[1] == "h" || xy0[1] == "H") y0 = H;
                                if (xy1[0] == "w" || xy1[0] == "W") x1 = W;
                                if (xy1[1] == "h" || xy1[1] == "H") y1 = H;
                                if (VL.isExistVar(xy0[0])) x0 = int.Parse(VL.Get(xy0[0]));
                                if (VL.isExistVar(xy0[1])) y0 = int.Parse(VL.Get(xy0[1]));
                                if (VL.isExistVar(xy1[0])) x1 = int.Parse(VL.Get(xy1[0]));
                                if (VL.isExistVar(xy1[1])) y1 = int.Parse(VL.Get(xy1[1]));
                                try
                                {
                                    x0 = int.Parse(xy0[0]);
                                    y0 = int.Parse(xy0[1]);
                                    x1 = int.Parse(xy1[0]);
                                    y1 = int.Parse(xy1[1]);
                                }
                                finally { }
                                graph.DrawLine(new Pen(usesCol, penSize), new Point(x0, y0), new Point(x1, y1));
                            }
                            break;
                        case "rect":
                            {
                                if (fiilF == false)
                                {
                                    string[] xy0 = args[0].Split(',');
                                    string[] xy1 = args[1].Split(',');
                                    int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
                                    if (xy0[0] == "w" || xy0[0] == "W") x0 = W;
                                    if (xy0[1] == "h" || xy0[1] == "H") y0 = H;
                                    if (xy1[0] == "w" || xy1[0] == "W") x1 = W;
                                    if (xy1[1] == "h" || xy1[1] == "H") y1 = H;
                                    if (VL.isExistVar(xy0[0])) x0 = int.Parse(VL.Get(xy0[0]));
                                    if (VL.isExistVar(xy0[1])) y0 = int.Parse(VL.Get(xy0[1]));
                                    if (VL.isExistVar(xy1[0])) x1 = int.Parse(VL.Get(xy1[0]));
                                    if (VL.isExistVar(xy1[1])) y1 = int.Parse(VL.Get(xy1[1]));
                                   //еще +100500 строк говнокода

    Только что копался в старых проектах и наткнулся на это. Это была попытка сделать что-то вреде ЯП для рисования, своево рода черепашья графика, но со своими свистелками и сами знаете чем.

    psina-from-ua, 05 Мая 2011

    Комментарии (15)
  6. C# / Говнокод #6547

    +122

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    private bool validDir(DirectoryInfo dir)
    {
    	return dir.Attributes == FileAttributes.Directory &&
    	dir.Attributes != FileAttributes.Hidden &&
    	dir.Attributes != FileAttributes.NotContentIndexed &&
    	dir.Name != "Windows";
    }

    GoodTalkBot, 04 Мая 2011

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

    +147

    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
    /*Windows 8 source code.*/
    /*
    TOP SECRET Microsoft(c) Code
    Project: Cairo(tm)
    Projected release-date: Summer 2012
    */
    
    #include "winnt.h"
    #include "evenmore.h"
    #include "oldstuff.h"
    #include "billrulz.h"
    #define INSTALL_HARD_C
    #define INSTALL_DIR_WINDOWS
    
    char make_prog_look_big[160000000] ;
    
    void main()
    {
        while(!CRASHED)
        {
             display_copyright_message();
             display_bill_rules_message();
             do_nothing_loop();
    
             if (first_time_installation)
             {
                 make_4gb_megabyte_swapfile();
                 do_nothing_loop();
                 display_funny_3d();
                 hang_system();
             }
     
             write_something(anything);
             display_copyright_message();
             do_nothing_loop();
             do_some_stuff();
             if (still_not_crashed)
             {
                 display_copyright_message();
                 do_nothing_loop();
                 basically_run_windows_vista();
                 show3d_in_loop();
                 do_nothing_loop();
                 do_nothing_loop();
             }
         }
     
         if (detect_cache())
             disable_cache();
     
         if (fast_cpu())
         {
             set_wait_states(lots);
             set_mouse(speed, very_slow);
             set_mouse(action, jumpy);
             set_mouse(reaction, sometimes);
         }
        
         if (fast_gpu())
         {
             setitonfire(dx12);
         }
    
         if (lotofmemory()) 
         {  
            //achtung: red alert!
            /* allocateforfutureuse(200mb); */
             allocateforfutureuse(2gb);
    
         }
     
         /* printf("Welcome to Windows Vista"); */
         /* printf("Welcome to Windows 7"); */
         printf("Welcome to Windows 8");
     
         if (system_ok())
             crashex(aero3denalbed());
         else;
         /*    system_memory = open("a:\swp0001.swp", O_CREATE); */
    
     
         while(something)
         {
             allocate_random_memory();
             sleep(5);
             get_user_input();
             sleep(5);
             display_uac_prompt();
             act_on_user_input();
             sleep(5);
         }
         draw_3d_bsod();
         die();
    }

    wwwww, 03 Мая 2011

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

    +164

    1. 1
    <a onclick="javascript:location.href='news_id_42297.html'" href="#block03-1">

    http://www.topnews.ru/ (внизу новости с 11-й по 20-ю)
    А теперь <del>кликните колесиком</del> наведите на это безобразие курсор. Молодцы, теперь отведите.

    ReallyBugMeNot, 29 Апреля 2011

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

    +168

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if ($sum == 30) {
        return 24;
    } else {
        return $sum * 0.8;
    }

    stark, 28 Апреля 2011

    Комментарии (15)
  10. Ruby / Говнокод #6489

    −102

    1. 1
    2. 2
    3. 3
    def route_match? origin, destination
      origin.iata == origin and destination.iata == destination
    end

    В классе конечно определены методы origin и destination

    rakoth3d, 27 Апреля 2011

    Комментарии (15)
  11. Assembler / Говнокод #6463

    +247

    1. 1
    2. 2
    mov eax, eax			;without this crap, it fucks up
      mov ecx, ecx			;don't ask me why...

    нашел в инклудах к opengl

    ragim, 23 Апреля 2011

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