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

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    if(dOper1p->Caption == "-0")
       dOper1p->Caption = "+0";
     if(dOper2p->Caption == "-0")
       dOper2p->Caption = "+0";
    
     if(dOper1m->Caption == "-0.0")
       dOper1m->Caption = "+0.0";
     if(dOper2m->Caption == "-0.0")
       dOper2m->Caption = "+0.0";

    yasosiska, 27 Июня 2011

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

    +152

    1. 1
    2. 2
    3. 3
    4. 4
    if ('yes'!= 'yes') {
    	checkCaptcha();
    	return true;
    }

    yasosiska, 27 Июня 2011

    Комментарии (8)
  4. PHP / Говнокод #6986

    +158

    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
    <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
    <?php echo $this->getChildHtml('form_before') ?>
    <form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
    <fieldset>
    <table id="shopping-cart-table" class="data-table cart-table">
        <col width="1" />
        <col />
        <col width="1" />
    <?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
        <col width="1" />
    <?php endif ?>
    <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
        <col width="1" />
    <?php endif; ?>
    <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
        <col width="1" />
    <?php endif; ?>
        <col width="1" />
    <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
        <col width="1" />
    <?php endif; ?>
    <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
        <col width="1" />
    <?php endif; ?>
        <col width="1" />
    
    <?php $mergedCells = ($this->helper('tax')->displayCartBothPrices() ? 2 : 1); ?>

    Ну так, для уверенности, можно и 4 раза. Искал в этом смысл - смысла не найдено. Copyright (c) 2011 Magento Inc.

    message, 17 Июня 2011

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

    +128

    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
    if (body.ToLower().Contains("pr") || 
                    subject.Contains("PM") ||
                    subject.Contains("pm") ||
                    subject.Contains("Pm") ||
                    subject.Contains("pM") ||
                    subject.Contains("PMR") ||
                    subject.Contains("prs") || 
                    subject.ToLower().Contains("prt") ||
                    subject.ToLower().Contains("prm") ||
                    subject.ToLower().Contains("pmt") ||
                    subject.ToLower().Contains("pmk") ||
                    subject.ToLower().Contains("pml") ||
                    subject.ToLower().Contains("pal"))
                {
                    result = true;
                }

    Пишут друзья из Норвегии

    jenik15, 15 Июня 2011

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

    +127

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    private string CalculateDecadeOrYear(string year)
    		{
    			string decade = year.Remove(3) + "0";
    			string currentYear = DateTime.Now.Year.ToString();
    			string currentDecade = currentYear.Remove(3) + "0";
    			string prevDecade = ((Convert.ToInt32(currentYear.Remove(3)) - 1)).ToString() + "0";
    			if (!(decade == currentDecade) && !(decade == prevDecade))
    			{
    				return decade;
    			}
    			return year;
    		}

    stringly typed вычисление декады. нашел в исходниках индусов

    overberk, 14 Июня 2011

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    function strlen2($str)
    {
    $rus=array('й','ц','у','к','е','н','г','ш','щ','з','х','ъ','ф','ы','в','а','п','р','о','л','д','ж','э','я','ч','с','м','и','т','ь','б','ю','Й','Ц','У','К','Е','Н','Г','Ш','Щ','З','Х','Ъ','Ф','Ы','В','А','П','Р','О','Л','Д','Ж','Э','Я','Ч','С','М','И','Т','Ь','Б','Ю');
    return strlen(str_replace($rus, '0', $str));
    }

    jQuery, 11 Июня 2011

    Комментарии (8)
  8. PHP / Говнокод #6920

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    $count = count($xml_array["TITLE"])-1; //считаем число проходов цикла.     
    for ($i=0; $i < $count; $i++) {
            echo $element[$xml_array["TITLE"][$i+1]]["value"];     //выводим название книги
            echo $element[$xml_array["AUTHOR"][$i+1]]["value"];  //выводим автора книги
            echo $element[$xml_array["YEAR"][$i+1]]["value"];     //выводим год
    }

    http://www.3mind.ru/programming/53-xml-i-php-parsing-dlya-chaynikov.html
    Из примера про парсинг XML... я один вижу индусский код ?

    Arris, 10 Июня 2011

    Комментарии (8)
  9. Куча / Говнокод #6911

    +136

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    <html>
          <head><meta http-equiv="Content-type" content="text/html; charset=UTF-8"></head>
          <script type="text/javascript" encoding="UTF-8">
            top.location.href = 'http://rghost.ru/10160511';
          </script>
    </html>

    Вот так на ргхосте юзера перекидывают к загруженному файлу.
    ЖС отключен? Заголовок Location? Не, не знаем.

    7ion, 09 Июня 2011

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

    +73

    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
    elem = request.getParameter("max_price");
        if ((elem != null) && (elem.trim().length() != 0)) {
          filter.setMax_price_id(elem);
          switch (Integer.parseInt(elem))
          {
          case 1:
            filter.setMax_price("price <= 10000");
            break;
          case 2:
            filter.setMax_price("price > 10000 and price <= 20000");
            break;
          case 3:
            filter.setMax_price("price > 20000 and price <= 30000");
            break;
          case 4:
            filter.setMax_price("price > 30000 and price <= 40000");
            break;
          case 5:
            filter.setMax_price("price > 50000");
          }
        }

    получение диапазона цен

    kakon, 07 Июня 2011

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

    −94

    1. 1
    for smth in filter(None, [something]): do(smth)

    лопата

    wiz, 31 Мая 2011

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