1. JavaScript / Говнокод #13515

    +163

    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
    var sound = 0;
    		
    		function chooseSound(x) {
    			if(x == 0)	sound = 0;
    			else if(x == 1) sound = 1;
    			else if(x == 2) sound = 2;
    			else if(x == 3) sound = 3;
    			else if(x == 4) sound = 4;
    			else if(x == 5) sound = 5;
    			else if(x == 6) sound = 6;
    			else if(x == 7) sound = 7;
    			else if(x == 8) sound = 8;
    			else if(x == 9) sound = 9;
    			else if(x == 10) sound = 10;
    			else if(x == 11) sound = 11;
    			else if(x == 12) sound = 12;
    			else if(x == 13) sound = 13;
    			else if(x == 14) sound = 14;
    			else sound = 15;
    		}

    отакота

    padonak, 31 Июля 2013

    Комментарии (34)
  2. C++ / Говнокод #13514

    +4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    case WM_SIZE:
    			for(i=0;i<6;i++)
    			{
    				if(RegNotifyChangeKeyValue(hTopKeys[i],TRUE,REG_NOTIFY_CHANGE_NAME|REG_NOTIFY_CHANGE_ATTRIBUTES|
    					REG_NOTIFY_CHANGE_LAST_SET|REG_NOTIFY_CHANGE_SECURITY,NULL,FALSE)==ERROR_SUCCESS)
    				{
    					MessageBox(NULL,"1","1",MB_OK);
    				}
    			}

    http://forum.shelek.ru/index.php/topic,14613.0.html

    Обратите внимание, товарищи, что у лица, создавшего сей шедевр, статус - "Опытный". Вот так и живем.

    Stertor, 30 Июля 2013

    Комментарии (23)
  3. C++ / Говнокод #13513

    +19

    1. 1
    }while(1  <--  index);

    LispGovno, 30 Июля 2013

    Комментарии (7)
  4. Си / Говнокод #13512

    +130

    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
    #include <stdio.h>
    
    int main()
    {
        int a = 5, b = 6;
        void* go;
        go = ( a > b )? &&true1: &&false1;
        goto *go;
    
          true1:
          {
            printf("%i > %i\n", a, b);
            goto next1;
          }
    
          false1:
          {
            printf("%i <= %i\n", a, b);
          }
    
        next1:
    
    
        a = 7;
        go = ( a > b )? &&true2: &&false2;
        goto *go;
        
          true2:
          {
            printf("%i > %i\n", a, b);
            goto next2;
          }
    
          false2:
          {
            printf("%i <= %i\n", a, b);
          }
    
        next2:
        return 0;
    }

    В GCC есть такой экстеншен http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
    Можно в goto передавать переменную и можно работать с адресами меток. В сочетании с тернарной условной операцией, этим можно заменить if

    j123123, 30 Июля 2013

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

    +109

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    static void Main(string[] args)
            {
     
                Console.WriteLine("Как желаете заполнить?");
                Console.WriteLine("Цифра 1  = в столбик, цифра 2 = в строчку");
                int valMethod = Convert.ToInt32(Console.ReadLine());
     
                Console.Clear();
     
     
                Console.SetCursorPosition(1, 0);
                for (int index = 1; index != 22; index++)
                {
                    Console.CursorLeft = 1;
                    Console.WriteLine('&#9553;');
                    if (index < 21)
                    {
                        Console.CursorLeft = 19;
                        Console.Write('&#9553;');
                    }
                }
     
     
     
     
                Console.SetCursorPosition(1, 0);
                for (int index = 1; index != 62; index++)
                    Console.Write('&#9552;');
     
                Console.SetCursorPosition(35, 1);
     
                int valueRow = 0;
                for (int i = 0; i < 4; i++)
                {
                    for (int index = 1; index != 20; index++)
                    {
                        Console.SetCursorPosition(28 + valueRow, 1 + index);
                        Console.WriteLine('&#9553;');
                    }
                    valueRow += 8;
     
                }
     
                for (int index = 1; index != 20; index++)
                {
                    Console.SetCursorPosition(29 + valueRow, 0 + index);
                    Console.WriteLine('&#9553;');
                }
     
     
     
                Console.SetCursorPosition(20, 2);
                for (int index = 1; index != 43; index++)
                    Console.Write('&#9552;');
     
                int value = 4;
                for (int i = 0; i < 9; i++)
                {
                    Console.SetCursorPosition(1, value);
                    for (int index = 1; index != 62; index++)
                        Console.Write('&#9552;');
                    value += 2;
                }
     
                Console.SetCursorPosition(6, 2);
                Console.WriteLine("Спортсмен");
     
                Console.SetCursorPosition(25, 1);
                Console.WriteLine("Вид спорта");
     
     
                int value1 = 5;
                for (int i = 1; i < 9; i++)
                {
                    Console.SetCursorPosition(6, value1);
                    Console.WriteLine("{0}", i);
                    value1 += 2;
                }
     
                int value2 = 2;
                for (int i = 1; i < 6; i++)
                {
                    Console.SetCursorPosition(22 + value2, 3);
                    Console.Write("{0}", i);
                    value2 += 8;
                }
     
                Console.SetCursorPosition(1, 0);
                Console.Write("&#9556;");
     
                Console.SetCursorPosition(61, 0);
                Console.Write("&#9559;");
     
                Console.SetCursorPosition(1, 20);
                Console.Write("&#9562;");
                 
                Console.SetCursorPosition(61, 20);
                Console.Write("&#9565;");
    
    ...

    Мы так любим магические числа...

    Psilon, 29 Июля 2013

    Комментарии (13)
  6. Си / Говнокод #13508

    +123

    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
    strncpy (szString, GetPropChar(ParentPicture,"Faceplate instance1","IN0_text_ON") , sizeof(szString));
    if (strlen(szString)!=0)	
        { SetPropBOOL(lpszPictureName, "Input Bit 0" , "Visible", 1);
         SetPropBOOL(lpszPictureName, "I_b0" , "Visible", 1);
       }
    else
        { SetPropBOOL(lpszPictureName, "Input Bit 0" , "Visible", 0); 
          SetPropBOOL(lpszPictureName, "I_b0" , "Visible", 0);
        }
    
    strncpy (szString, GetPropChar(ParentPicture,"Faceplate instance1","IN1_text_ON") , sizeof(szString));
    if (strlen(szString)!=0)	
        { SetPropBOOL(lpszPictureName, "Input Bit 1" , "Visible", 1);
         SetPropBOOL(lpszPictureName, "I_b1" , "Visible", 1);
       }
    else
        { SetPropBOOL(lpszPictureName, "Input Bit 1" , "Visible", 0); 
          SetPropBOOL(lpszPictureName, "I_b1" , "Visible", 0);
        }

    Скрипт для WinCC. И так 8 раз подряд.
    Написал начальник отдела разработчиков (Си— не его специализация), как часть большого концептуального объекта, с которым мне и надо работать. А я не могу с этим работать, ощущая вот такие говенные внутренности.

    MereNonsense, 29 Июля 2013

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

    +141

    1. 1
    2. 2
    3. 3
    //index.php
    
    die('+php works');

    вся суть PHP в одной строчке

    problem, 29 Июля 2013

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

    +147

    1. 1
    2. 2
    3. 3
    $(".rating").each(function() { 
    $(this).find('input').hide(); 
    });

    Самое интересное, что в блоке .rating никогда нет и не было input

    yamaha252, 29 Июля 2013

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

    +164

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    //見積画面からの再セット
    function forminput2(part_no,qty,index) {
       if ( index == "1" ) {
            document.forms[0].PRTNO_1.value = part_no;
            document.forms[0].QTY_1.value = qty;
        } else if ( index == "2" ) {
            document.forms[0].PRTNO_2.value = part_no;
            document.forms[0].QTY_2.value = qty;
        } else if ( index == "3" ) {
            document.forms[0].PRTNO_3.value = part_no;
            document.forms[0].QTY_3.value = qty;
        } else if ( index == "4" ) {
            document.forms[0].PRTNO_4.value = part_no;
            document.forms[0].QTY_4.value = qty;
        } else if ( index == "5" ) {
            document.forms[0].PRTNO_5.value = part_no;
            document.forms[0].QTY_5.value = qty;
        } else if ( index == "6" ) {
            document.forms[0].PRTNO_6.value = part_no;
            document.forms[0].QTY_6.value = qty;
        } else if ( index == "7" ) {
            document.forms[0].PRTNO_7.value = part_no;
            document.forms[0].QTY_7.value = qty;
        } else if ( index == "8" ) {
            document.forms[0].PRTNO_8.value = part_no;
            document.forms[0].QTY_8.value = qty;
        } else if ( index == "9" ) {
            document.forms[0].PRTNO_9.value = part_no;
            document.forms[0].QTY_9.value = qty;
        } else if ( index == "10" ) {
            document.forms[0].PRTNO_10.value = part_no;
            document.forms[0].QTY_10.value = qty;
        } else if ( index == "11" ) {
            document.forms[0].PRTNO_11.value = part_no;
            document.forms[0].QTY_11.value = qty;
        } else if ( index == "12" ) {
            document.forms[0].PRTNO_12.value = part_no;
            document.forms[0].QTY_12.value = qty;
        } else if ( index == "13" ) {
            document.forms[0].PRTNO_13.value = part_no;
            document.forms[0].QTY_13.value = qty;
        } else if ( index == "14" ) {
            document.forms[0].PRTNO_14.value = part_no;
            document.forms[0].QTY_14.value = qty;
        } else if ( index == "15" ) {
            document.forms[0].PRTNO_15.value = part_no;
            document.forms[0].QTY_15.value = qty;
        } else if ( index == "16" ) {
            document.forms[0].PRTNO_16.value = part_no;
            document.forms[0].QTY_16.value = qty;
        } else if ( index == "17" ) {
            document.forms[0].PRTNO_17.value = part_no;
            document.forms[0].QTY_17.value = qty;
        } else if ( index == "18" ) {
            document.forms[0].PRTNO_18.value = part_no;
            document.forms[0].QTY_18.value = qty;
        } else if ( index == "19" ) {
            document.forms[0].PRTNO_19.value = part_no;
            document.forms[0].QTY_19.value = qty;
        } else if ( index == "20" ) {
            document.forms[0].PRTNO_20.value = part_no;
            document.forms[0].QTY_20.value = qty;
        } else if ( index == "21" ) {
            document.forms[0].PRTNO_21.value = part_no;
            document.forms[0].QTY_21.value = qty;
        } else if ( index == "22" ) {
            document.forms[0].PRTNO_22.value = part_no;
            document.forms[0].QTY_22.value = qty;
        } else if ( index == "23" ) {
            document.forms[0].PRTNO_23.value = part_no;
            document.forms[0].QTY_23.value = qty;
        } else if ( index == "24" ) {
            document.forms[0].PRTNO_24.value = part_no;
            document.forms[0].QTY_24.value = qty;
        } else if ( index == "25" ) {
            document.forms[0].PRTNO_25.value = part_no;
            document.forms[0].QTY_25.value = qty;
        } else if ( index == "26" ) {
            document.forms[0].PRTNO_26.value = part_no;
            document.forms[0].QTY_26.value = qty;
        } else if ( index == "27" ) {
            document.forms[0].PRTNO_27.value = part_no;
            document.forms[0].QTY_27.value = qty;
        } else if ( index == "28" ) {
            document.forms[0].PRTNO_28.value = part_no;
            document.forms[0].QTY_28.value = qty;
        } else if ( index == "29" ) {
            document.forms[0].PRTNO_29.value = part_no;
            document.forms[0].QTY_29.value = qty;
        } else if ( index == "30" ) {
            document.forms[0].PRTNO_30.value = part_no;
            document.forms[0].QTY_30.value = qty;
        } else if ( index == "31" ) {
            document.forms[0].PRTNO_31.value = part_no;
            document.forms[0].QTY_31.value = qty;
        } else if ( index == "32" ) {
            document.forms[0].PRTNO_32.value = part_no;
            document.forms[0].QTY_32.value = qty;
        } else if ( index == "33" ) {
            document.forms[0].PRTNO_33.value = part_no;

    Каталог на сайте http://www.kawasaki-motors.com
    Из одного фрейма передаются массив номеров запчастей в другой фрейм, в котором заполняется форма и отправляется.
    Таких функций там несколько.

    Вроде серьёзная фирма.

    MaXL, 29 Июля 2013

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

    +21

    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
    if (Utility::compareVersions(myVersionStr, latestVersionStr) < 0)
    {
        // New version is available. Download and install the new version.
        performUpdate();
    }		
    else
    {
        bool isUpdateRunning = Utility::isUpdateRunning();
    				
        if (!isUpdateRunning)
        {
            performUpdate();
        }
    }

    Нашел в коде после того как у тестера версия 1.0.0.401 обновилась на 1.0.0.395

    letheriem, 29 Июля 2013

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