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

    В номинации:
    За время:
  2. Куча / Говнокод #16966

    +134

    1. 1
    2. 2
    3. 3
    4. 4
    {GENDER, select,
        male {He}
      female {She}
       other {They}

    https://github.com/SlexAxton/messageformat.js

    someone, 29 Октября 2014

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

    +135

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    typedef struct tagКАКАЯТОНЕЕБИЧЕСКИДЛИННАЯХУЙНЯ {
        тыц;
        тыц;
        и еще пару раз тыц;
    } КАКАЯТОНЕЕБИЧЕСКИДЛИННАЯХУЙНЯ, *PКАКАЯТОНЕЕБИЧЕСКИДЛИННАЯХУЙНЯ, *LPКАКАЯТОНЕЕБИЧЕСКИДЛИННАЯХУЙНЯ;

    Винстайл такой няшный ^_^

    Pythoner, 21 Сентября 2014

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

    +127

    1. 1
    https://www.marshut.net/knqkut/dijkstra-s-methodology-for-secure-systems-development.html

    Учитесь троллить! (Я подписался на рассылку запостить пару багов, а тут...)

    wvxvw, 20 Сентября 2014

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

    +143

    1. 1
    2. 2
    3. 3
    if (typeof window.$lab === 'undefined') {
        document.write('<script type="text/javascript">var $lab = jQuery.noConflict(true);\x3C/script>');
    }

    потому что eval - зло
    P.s. \x3C/script> - такая запись ибо впилено тегом скрипт в head

    RedMonkey, 18 Сентября 2014

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if (form.find('input[name*=payout_max]').val() > 0 || form.find('input[name*=payout_max]').val() > 0) {
        form.find('input[name*=payout_max]').closest('div.form-group').show();
        form.find('input[name*=payout_max]').closest('div.form-group').show();
    } else {
        form.find('input[name*=payout_max]').closest('div.form-group').hide();
        form.find('input[name*=payout_max]').closest('div.form-group').hide();
    }

    код лида. видимо, два раза для пущей убедительности

    tagrim, 08 Сентября 2014

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

    +118

    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
    if (operator instanceof TUOperatorStacker) {
    	dump.put("operator_type", "TUOperatorStacker");
    } else if (operator instanceof TUOperatorDestacker) {
    	dump.put("operator_type", "TUOperatorDestacker");
    } else if (operator instanceof TUOperatorTargetedStacker) {
    	dump.put("operator_type", "TUOperatorTargetedStacker");
    } else if (operator instanceof TUOperatorTargetedDestacker) {
    	dump.put("operator_type", "TUOperatorTargetedDestacker");
    }
    
    
    
    <...>
    
    
    
    String typeString = (String) dump.get("operator_type");
    TUOperator operator = null;
    
    if (typeString.equals("TUOperatorStacker")) {
    	operator = new TUOperatorStacker(simElement);
    } else if (typeString.equals("TUOperatorDestacker")) {
    	operator = new TUOperatorDestacker(simElement);
    } else if (typeString.equals("TUOperatorTargetedStacker")) {
    	operator = new TUOperatorTargetedStacker(simElement);
    } else if (typeString.equals("TUOperatorTargetedDestacker")) {
    	operator = new TUOperatorTargetedDestacker(simElement);
    }

    someone, 18 Августа 2014

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

    +74

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    public static void sleep(long millis, int nanos)  throws InterruptedException {
            // ...
            if (nanos >= 500000 || (nanos != 0 && millis == 0)) {
                millis++;
            }
            sleep(millis);
        }

    Системе пофиг сколько конкретно ты указал наносекунд . Всё равно никак не проверишь:)
    Java Oracle, Thread::sleep(long,long)

    SSSandman, 08 Августа 2014

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

    +134

    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
    public virtual bool IsShown
        {
            get
            {
                if (obj && show && usePosition)
                {
                    return obj.transform.localPosition == show.localPosition;
                }
                if (obj && show && useScale)
                {
                    return obj.transform.localScale == show.localScale;
                }
    
                if (obj && show && useRotation)
                {
                    return obj.transform.localRotation == show.localRotation;
                }
    
                return false;
            }
        }
    
        public virtual bool IsHided
        {
            get
            {
                if (obj && hide && usePosition)
                {
                    return obj.transform.localPosition == hide.localPosition;
                }
                if (obj && hide && useScale)
                {
                    return obj.transform.localScale == hide.localScale;
                }
    
                if (obj && hide && useRotation)
                {
                    return obj.transform.localRotation == hide.localRotation;
                }
    
                return false;
            }

    Чувак с соседнего проекта много интересного рассказывал про хорошие практики кода. А потом он уволился, и коллеги стали изучать его творчество.

    golergka, 07 Августа 2014

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

    +51

    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
    void __fastcall TForm3::Button1Click(TObject *Sender)
    {
    AnsiString a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3,a4,b4,c4,d4,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10;
    a1=Edit1->Text;
    b1=Edit5->Text;
    if (a1==b1) a1>>r1;
    else "n">>r1;
    a2=Edit2->Text;
    b2=Edit6->Text;
    if (a2==b2) a2>>r2;
    else "n">>r2;
    a3=Edit3->Text;
    b3=Edit7->Text;
    if (a3==b3) a3>>r3;
    else "n">>r3;
    a4=Edit4->Text;
    b4=Edit8->Text;
    if (a4==b4) a4>>r4;
    else "n">>r4;
    c1=Edit9->Text;
    d1=Edit13->Text;
    if (c1==d1) c1>>r5;
    else "n">>r5;
    c2=Edit10->Text;
    d2=Edit14->Text;
    if (c2==d2) c2>>r6;
    else "n">>r6;
    c3=Edit11->Text;
    d3=Edit15->Text;
    if (c3==d3) c3>>r7;
    else "n">>r7;
    c4=Edit12->Text;
    d4=Edit15->Text;
    if (c4==d4) c4>>r8;
    else "n">>r8;
     }
    //---------------------------------------------------------------------------
     
    void __fastcall TForm3::Label6Click(TObject *Sender)
    {
    int r1,r2,r3,r4,r5,r6,r7,r8;
    Label6->Caption=r1;
    Label7->Caption=r2;
    Label8->Caption=r3;
    Label9->Caption=r4;
    Label10->Caption=r5;
    Label11->Caption=r6;
    Label12->Caption=r7;
    Label13->Caption=r8;
     }

    По словам "очевидца", код сравнивает посимвольно две строки и пропускает не совпавшие символы

    aNNiMON, 03 Августа 2014

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

    −125

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    Dim dLoadCurrent As Double
    Dim strReading As String = String.Empty
    Dim strTempReading As String
    
    strReading = Space(20)
    
    strReading = считали напряжение из устройства
    strTempReading = CStr(InStr(1, strReading, vbLf, CompareMethod.Binary))
    dLoadCurrent = CDbl(Left(strReading, CShort(strTempReading)))

    Супер каст.

    kempendyi, 29 Июля 2014

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