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

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

    +168

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (array_keys($value) !== array_values(array_keys($value))) {
    
    } else {
    
    }

    Встретилось в ядре по работе с БД :)

    firefred, 29 Июля 2010

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

    +115

    1. 1
    s.replaceAll("(\\/\\.\\.\\/)+", "/").replaceFirst("^((\\.)+\\/)+", "");

    вот такие вот суровые паттерны
    как я это увидел - мне сразу вид двух друзей переханных трактором вспомнился

    String s="../../../a./../../files/file1.rar"; // надо убрать строки вида "../"

    3.14159265, 28 Июля 2010

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

    +133

    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
    count=15;
    a=15;
    b=2.5;
    ...
    function addlistbox()
    	i=1;
    	while i<=count do
    		INIFile.SetValue("temp.ini", "temp", i, a);
    		end
    i=1;
    while i<=count do
    ttt=INIFile.GetValue("temp.ini", "temp", i);
    INIFile.SetValue("temp.ini", "temp", i, Math.Pow(ttt, b*i));
    end
    i=1;
    while i<=count do
    	ttt=INIFile.GetValue("temp.ini", "temp", i);
    	ListBox.AddItem("stepeni", i, ttt); 
    	end
    end

    Приятель прислал.
    всю эту прелесть можно написать так:
    function addlistbox(a,b,count)
    for i=1,count do
    ListBox.AddItem("stepeni", i, Math.Pow(a, b*i));
    end
    end

    XyHb, 25 Июля 2010

    Комментарии (10)
  5. Pascal / Говнокод #3764

    +120

    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
    begin
       if not directoryexists('input') then createdir('input');
       if not directoryexists('output') then createdir('output');
       if not directoryexists('temp') then createdir('temp');
       if not directoryexists('temp\temp') then createdir('temp\temp');
       if not directoryexists('temp\temp_') then createdir('temp\temp_');
       if not directoryexists('temp\temp__') then createdir('temp\temp__');
       if not directoryexists('temp\temp___') then createdir('temp\temp___');
       if not directoryexists('temp\temp____') then createdir('temp\temp____');
       if not directoryexists('temp\temp_____') then createdir('temp\temp_____');
       if not directoryexists('temp\temp______') then createdir('temp\temp______');
       if not directoryexists('temp\temp_______') then createdir('temp\temp_______');
       if not directoryexists('temp\temp________') then createdir('temp\temp________');
       if not directoryexists('temp\temp_________') then createdir('temp\temp_________');
       if not directoryexists('temp\temp__________') then createdir('temp\temp__________');
       if not directoryexists('temp\temp___________') then createdir('temp\temp___________');
       if not directoryexists('temp\temp____________') then createdir('temp\temp____________');
       if not directoryexists('temp\temp_____________') then createdir('temp\temp_____________');
       if not directoryexists('temp\temp______________') then createdir('temp\temp______________');
       if not directoryexists('temp\temp_______________') then createdir('temp\temp_______________');
       if not directoryexists('temp\temp________________') then createdir('temp\temp________________');
       print_('Вас приветствует программа для сортировки слвоарей True Sort');
       print_('Если у вас есть какие-то вопросы по её работе - нажмите Help');
       turbo:=false;
    end;

    Кинул знаковый в асю=\

    BlincAttack, 23 Июля 2010

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

    +136

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    recordSize=logicalRecordLength;
    BytesToRead=cnt*recordSize;
    records=cnt;
    while ( ((pos + BytesToRead)>dataSize)&&records )
    {
        BytesToRead = --records * recordSize;
    }

    Не думал, что у нас в коде встречу нечто явно похожее на пример №2 из статьи "Индусский код" на Луркморе.
    Ну и стоит добавить, что реально logicalRecordLength всегда равен 1.

    vovochka, 21 Июля 2010

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

    +172

    1. 1
    <script type="text/javascript" src='/wps/CacheProxyServlet/colorPalette/default/browserVendor/Netscape/browserName/Navigator/browserVersion/unknown/locale/ru/forwardurl/wps/themes/html/pgu/./js.jsp'></script>

    с сайта http://portal.rosreestr.ru

    Serebro, 19 Июля 2010

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

    +66

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    Link link = new Link( element );
    
    		if( !Browser.getBrowser().isElementPresent( link.getLocator() ) )
    		{
    			return false;
    		}
    		else
    		{
    			return true;
    		}

    зачэм так?

    gavrs, 15 Июля 2010

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

    +164

    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
    <?
    
    class с_self_add_form
    {
    var $main="<P>
    <form name=\"add_form\" ENCTYPE=\"multipart/form-data\" method=post
    ....HTML...
    </table></form></P>";
    }
    
    class u_self_add_form
    {
    var $main="<P class=ttext>
    <form name=\"add_form\" ENCTYPE=\"multipart/form-data\" method=post
    ....Другой HTML...
    </table></form></P>";
    }
    
    class d_self_add_form
    {
    var $main="<P class=zag>
    <form name=\"add_form\" ENCTYPE=\"multipart/form-data\" method=post
    ....Третий HTML...
    </table></form></P>";
    }
    
    /* и так далее, и тому подобное */

    самый шикарный формат файла с шаблонами, который я видел.

    Mihard, 02 Июля 2010

    Комментарии (10)
  10. JavaScript / Говнокод #3592

    +165

    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
    once = true;
    $(document).ready(function () {
        $('#Town').change(function () {
            if (once) {
                if ($(this).val() != $("#TownName").val()) {
                    alert("При смене города произойдет потеря всех товаров в корзине");
                    once = false;
                }
    
            }
        }
        })
    );

    вместо
    $('#Town').one('change', function() {})

    nur, 29 Июня 2010

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

    +131

    1. 1
    2. 2
    3. 3
    int newclient(var v, newconn oldconn) {
            [...]
    }

    Ничего особенного, конечно. Просто порадовало "newconn oldconn".

    xaionaro, 14 Июня 2010

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