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

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

    +110

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    void someMethod(Object obj)
    {
    	if(!obj.Equals(null))
    	{
    		...
    	}
    }

    а это я сам когда-то очень-очень давно наклал :))))
    до их пор с теплотой вспоминаю, как сам потом ржал, когда заметил :)

    Pauchok-Anaynckiy, 22 Ноября 2010

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

    +110

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    <asp:EntityDataSource ID="targert" runat="server" ConnectionString="name=portalEntities1"
                DefaultContainerName="portalEntities1" EnableFlattening="False" 
                CommandText="SELECT first_table.id FROM first_table 
            WHERE ANYELEMENT(select second_table.field_2 from first_table.second_table where second_table.field_2 = @var1).field_2 = @var1
            " EntityTypeFilter="">
                <CommandParameters>
                    <asp:QueryStringParameter Name="var1" QueryStringField="var1" DbType="String" />
                </CommandParameters>
            </asp:EntityDataSource>

    Вот такой странный код с двойной проверкой...
    таблицы second_table и first_table имеют связь многие ко многим...

    test_unit, 26 Октября 2010

    Комментарии (3)
  4. Java / Говнокод #3999

    +110

    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
    // At the maximum, no match found
                    if (j >= cmax)
                        return false;
                    // Okay, must try one more atom
                    if (!atom.match(matcher, i, seq))
                        return false;
                    // If we haven't moved forward then must break out
                    if (i == matcher.last)
                        return false;
    
                if (type == GREEDY)
                    return match0(matcher, i, j, seq);
                else if (type == LAZY)
                    return match1(matcher, i, j, seq);
                else
                    return match2(matcher, i, j, seq);

    to be continued....

    3.14159265, 16 Августа 2010

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

    +110

    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
    void BubbleSort(dynamic arr)
    {
        for (int i = arr.Length - 1; i > 0; i--)
        {
            for (int j = 0; j < i; j++)
            {
                if (arr[j] > arr[j + 1])
                {
                    int t = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = t;
                }
            }
        }
    }

    Обобщенное программирование (:
    Видел на одно форуме в теме operator constraint

    HIMen, 11 Июля 2010

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

    +110

    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
    Function IsBigLet(Let: String): Boolean;
    var r: bool;
    begin
    r:=false;
    if pos('Й',Let)>0 then r:=true;
    if pos('Ц',Let)>0 then r:=true;
    if pos('У',Let)>0 then r:=true;
    if pos('К',Let)>0 then r:=true;
    if pos('Е',Let)>0 then r:=true;
    if pos('Н',Let)>0 then r:=true;
    if pos('Г',Let)>0 then r:=true;
    if pos('Ш',Let)>0 then r:=true;
    if pos('Щ',Let)>0 then r:=true;
    if pos('З',Let)>0 then r:=true;
    if pos('Х',Let)>0 then r:=true;
    if pos('Ф',Let)>0 then r:=true;
    if pos('Ы',Let)>0 then r:=true;
    if pos('В',Let)>0 then r:=true;
    if pos('А',Let)>0 then r:=true;
    if pos('П',Let)>0 then r:=true;
    if pos('Р',Let)>0 then r:=true;
    if pos('О',Let)>0 then r:=true;
    if pos('Л',Let)>0 then r:=true;
    if pos('Д',Let)>0 then r:=true;
    if pos('Ж',Let)>0 then r:=true;
    if pos('Э',Let)>0 then r:=true;
    if pos('Я',Let)>0 then r:=true;
    if pos('Ч',Let)>0 then r:=true;
    if pos('С',Let)>0 then r:=true;
    if pos('М',Let)>0 then r:=true;
    if pos('И',Let)>0 then r:=true;
    if pos('Т',Let)>0 then r:=true;
    if pos('Б',Let)>0 then r:=true;
    if pos('Ю',Let)>0 then r:=true;
    Result:=r;
    end;

    Немножко индусского кода!

    Temnenkov, 09 Апреля 2010

    Комментарии (23)
  7. Pascal / Говнокод #2500

    +109.8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    for i := 1 to X do begin
      tblitem.FindKey([tbltranitemno.text]);
      tblitem.GotoKey;
      button3.Click;
      edit3.Text := floattostr(org-i);
      x := 1-1;
    end;

    (c) India

    хочется взять и уеб...

    dmtr76, 29 Января 2010

    Комментарии (11)
  8. C# / Говнокод #866

    +109.6

    1. 1
    2. 2
    3. 3
    4. 4
    decimal d = DomainObject.AssignedPercent;
    if (d.Equals(0) == false) {
    ...
    }

    guest, 14 Апреля 2009

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

    +109.4

    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
    //Dictionary used to check if eventValues are unique
    Dictionary<string, string> uniqueEventValues = new Dictionary<string, string>();
    
    //... заполняем коллекцию
    
    try {
        uniqueEventValues.Add(eventValue, "X");
    }
    catch (Exception ex) {
        if (ex.Message.Equals("An item with the same key has already been added.")) {
            msgAddEventParams.Text = "EventValues must be unique. " + eventValue + " is duplicate.";
            msgAddEventParams.Visible = true;
            return;
        }
    }

    мы не ищем легких путей!

    Sharp, 09 Февраля 2010

    Комментарии (7)
  10. Куча / Говнокод #2250

    +109.3

    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
    <script type="text/javascript">
    <!--
    if (window.screen)
    {
    if (screen.width < 1024)
    {
    document.write('<td height="35" width="11"><img src="img0800/indx/indx_0_0.png" title="" alt="" style="width: 11px; height: 35px;"></td>\n');
    document.write('<td height="35" width="43"><a href="en/index.html"><img src="img0800/indx/indx_1_0.png" title="" alt="" style="width: 43px; height: 35px;"></a></td>\n');
    document.write('<td height="35" width="76"><img src="img0800/indx/indx_2_0.png" title="" alt="" style="width: 76px; height: 35px;"></td>\n');
    document.write('<td height="35" width="32"><img src="img0800/indx/indx_3_0.png" title="" alt="" style="width: 32px; height: 35px;"></td>\n');
    document.write('<td height="35" width="27"><img src="img0800/indx/indx_4_0.png" title="" alt="" style="width: 27px; height: 35px;"></td>\n');
    document.write('<td height="35" width="39"><img src="img0800/indx/indx_5_0.png" title="" alt="" style="width: 39px; height: 35px;"></td>\n');
    document.write('<td height="35" width="103"><img src="img0800/indx/indx_6_0.png" title="" alt="" style="width: 103px; height: ................
    document.write('<td height="31" width="21"><img src="img1024/indx/indx_15_19.png" title="" alt="" style="width: 21px; height: 31px;"></td>\n');
    }
    else if (screen.width < 1600)
    {
    document.write('<td height="59" width="18"><img src="img1280/indx/indx_0_0.png" title="" alt="" style="width: 18px; height: 59px;"></td>\n');
    document.write('<td height="59" width="72"><a href="en/index.html"><img src="img1280/indx/indx_1_0.png" title="" alt="" style="width: 72px; height: 59px;"></a></td>\n');
    document.write('<td height="59" width="127"><img src="img1280/indx/indx_2_0.png" title="" alt="" style="width: 127px; height: 59px;"></td>\n');
    document.write('<td height="59" width="53"><img src="img1280/indx/indx_3_0.png" title="" alt="" style="width: 53px; height: 59px;"></td>\n');
    document.write('<td height="59" width="46"><img src="img1280/indx/indx_4_0.png" title="" alt="" style="width: 46px; height: 59px;"></td>\n');
    document.write('<td height="59" width="64"><img src="img1280/indx/indx_5_0.png" title="" alt="" style="width: 64px; height: 59px;"></td>\n');
     .......

    Сайт с фоном из таблицы с картинками. Картинки нарезаны на мелкие кусочки и, внимание, сайт подстраивается под разные разрешения мониторов! Есть наборы картинок для ширины 800, 1024, 1280 и 1600. Посмотреть можно на http://old.abvi.redsolution.ru/

    summer.is.gone, 09 Декабря 2009

    Комментарии (27)
  11. Си / Говнокод #17590

    +109

    1. 1
    memcpy (stderr, stdout, sizeof (FILE));

    gpr, 06 Февраля 2015

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