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

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

    +163.8

    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
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    function translit($valstr){
        for($i=0;$i<strlen($valstr); $i++){
          switch(ord($valstr[$i])){
            case 192: { $newstr.=chr(97); break; }
            case 193: { $newstr.=chr(98); break; }
            case 194: { $newstr.=chr(118); break; }
            case 195: { $newstr.=chr(103); break; }
            case 196: { $newstr.=chr(100); break; }
            case 197: { $newstr.=chr(101); break; }
            case 198: { $newstr.=chr(122).chr(104); break; }
            case 199: { $newstr.=chr(122); break; }
            case 200: { $newstr.=chr(105); break; }
            case 201: { $newstr.=chr(106); break; }
            case 202: { $newstr.=chr(107); break; }
            case 203: { $newstr.=chr(108); break; }
            case 204: { $newstr.=chr(109); break; }
            case 205: { $newstr.=chr(110); break; }
            case 206: { $newstr.=chr(111); break; }
            case 207: { $newstr.=chr(112); break; }
            case 208: { $newstr.=chr(114); break; }
            case 209: { $newstr.=chr(115); break; }
            case 210: { $newstr.=chr(116); break; }
            case 211: { $newstr.=chr(117); break; }
            case 212: { $newstr.=chr(102); break; }
            case 213: { $newstr.=chr(120); break; }
            case 214: { $newstr.=chr(99); break; }
            case 215: { $newstr.=chr(99).chr(104); break; }
            case 216: { $newstr.=chr(115).chr(104); break; }
            case 217: { $newstr.=chr(119); break; }
            case 218: { break; }
            case 219: { $newstr.=chr(121); break; }
            case 220: { break; }
            case 221: { $newstr.=chr(106).chr(101); break; }
            case 222: { $newstr.=chr(106).chr(117); break; }
            case 223: { $newstr.=chr(121).chr(97); break; }
            case 224: { $newstr.=chr(97); break; }
            case 225: { $newstr.=chr(98); break; }
            case 226: { $newstr.=chr(118); break; }
            case 227: { $newstr.=chr(103); break; }
            case 228: { $newstr.=chr(100); break; }
            case 229: { $newstr.=chr(101); break; }
            case 230: { $newstr.=chr(122).chr(104); break; }
            case 231: { $newstr.=chr(122); break; }
            case 232: { $newstr.=chr(105); break; }
            case 233: { $newstr.=chr(106); break; }
            case 234: { $newstr.=chr(107); break; }
            case 235: { $newstr.=chr(108); break; }
            case 236: { $newstr.=chr(109); break; }
            case 237: { $newstr.=chr(110); break; }
            case 238: { $newstr.=chr(111); break; }
            case 239: { $newstr.=chr(112); break; }
            case 240: { $newstr.=chr(114); break; }
            case 241: { $newstr.=chr(115); break; }
            case 242: { $newstr.=chr(116); break; }
            case 243: { $newstr.=chr(117); break; }
            case 244: { $newstr.=chr(102); break; }
            case 245: { $newstr.=chr(120); break; }
            case 246: { $newstr.=chr(99); break; }
            case 247: { $newstr.=chr(99).chr(104); break; }
            case 248: { $newstr.=chr(115).chr(104); break; }
            case 249: { $newstr.=chr(119); break; }
            case 250: { break; }
            case 251: { $newstr.=chr(121); break; }
            case 252: { break; }
            case 253: { $newstr.=chr(106).chr(101); break; }
            case 254: { $newstr.=chr(106).chr(117); break; }
            case 255:  { $newstr.=chr(121).chr(97); break; }
            default: { $newstr.=$valstr[$i]; break; }
          }
        }
        return $newstr;
      }

    stepushyn, 18 Апреля 2010

    Комментарии (27)
  3. PHP / Говнокод #3037

    +164.6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <?php
    if (isset ($_POST['logform'])) {$logform = $_POST['logform'];} else {$logform = $_POST['logform'];}
    echo $logform;
    
    if (isset ($_POST['pasform'])) {$pasform = $_POST['pasform'];} else {$pasform = $_POST['pasform'];}
    echo $pasform;
    
    ?>

    Контрольный в голову

    MoLe-X, 18 Апреля 2010

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

    +144.8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <?php
    if(!@isset($_POST[submit]))
    {
    ...
    ?>

    DmitryDick, 09 Апреля 2010

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

    +144.8

    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
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    /**
     * Helper classes for computing window query on rectangles
     */
    
    class VerticalSegmentIntersect : public std::unary_function < PRGlyph, ptrdiff_t > {
      ptrdiff_t m_Lhs;
      ptrdiff_t m_Rhs;
    public:
      VerticalSegmentIntersect ( ptrdiff_t top, ptrdiff_t bottom ) throw() : m_Lhs(top+top), m_Rhs(bottom+bottom) {}
      ptrdiff_t operator() ( PRGlyph inpGlyph ) const throw() { 
        QRect const* area = inpGlyph->GetGlyphArea();
        ptrdiff_t x = area->bottom() + area->top(), y = area->bottom() - area->top();
        
        if (y < x - m_Rhs ) return 0;
        if (y < m_Lhs - x ) return 0;
        
        return 1;
      }
    };
    
    class HorisontalSegmentIntersect : public std::unary_function < PRGlyph, ptrdiff_t > {
      ptrdiff_t m_Lhs;
      ptrdiff_t m_Rhs;
    public:
      HorisontalSegmentIntersect ( ptrdiff_t left, ptrdiff_t right ) throw() : m_Lhs(left+left), m_Rhs(right+right) {}
      ptrdiff_t operator() ( PRGlyph inpGlyph ) const throw() { 
        QRect const* area = inpGlyph->GetGlyphArea();
        ptrdiff_t x = area->right() + area->left(), y = area->right() - area->left();
        
        if (y < x - m_Rhs ) return 0;
        if (y < m_Lhs - x ) return 0;
        return 1;
      }
    };
    
    /**
     * Helper classes for computing containment query on rectangles
     */ 
    
    class VerticalSegmentContains : public std::unary_function < PRGlyph, ptrdiff_t > {
      ptrdiff_t m_Lhs;
      ptrdiff_t m_Rhs;
    public:
      VerticalSegmentContains ( ptrdiff_t top, ptrdiff_t bottom ) throw() : m_Lhs(top+top), m_Rhs(bottom+bottom) {}
      ptrdiff_t operator() ( PRGlyph inpGlyph ) const throw() {
        QRect const* area = inpGlyph->GetGlyphArea();    
        ptrdiff_t x = area->bottom() + area->top(), y = area->bottom() - area->top();
        
        if ( y > x - m_Lhs ) return 0;
        if ( y > m_Rhs - x ) return 0;
        return 1;
      }
    };
    
    class HorisontalSegmentContains : public std::unary_function < PRGlyph, ptrdiff_t > {
      ptrdiff_t m_Lhs;
      ptrdiff_t m_Rhs;
    public:
      HorisontalSegmentContains ( ptrdiff_t left, ptrdiff_t right ) throw() : m_Lhs(left+left), m_Rhs(right+right) {}
      ptrdiff_t operator() ( PRGlyph inpGlyph ) const throw() {
        QRect const* area = inpGlyph->GetGlyphArea();    
        ptrdiff_t x = area->right() + area->left(), y = area->right() - area->left();
        
        if ( y > x - m_Lhs ) return 0;
        if ( y > m_Rhs - x ) return 0;
        return 1;
      }
    };
    
    // compute the window query on m_GlyphData rectangles
      QVector<PRGlyph> :: iterator windowq = m_Selection.isValid() ?
                                            std::partition ( m_GlyphData.begin(),
                                                             std::partition ( m_GlyphData.begin(), m_GlyphData.end(), VerticalSegmentIntersect ( m_Selection.top(), m_Selection.bottom() ) ),
                                                             HorisontalSegmentIntersect ( m_Selection.left(), m_Selection.right() )
                                                           ) : m_GlyphData.begin();
      // compute the containment query on window query rectangles (the containment query resuls is always subset of window query )
      QVector<PRGlyph> :: iterator containq = std::partition ( m_GlyphData.begin(),
                                                               std::partition ( m_GlyphData.begin(), windowq, VerticalSegmentContains ( m_Selection.top(), m_Selection.bottom() ) ),
                                                               HorisontalSegmentContains ( m_Selection.left(), m_Selection.right() )
                                                             );

    Способ быстренько находить прямоугольники, пересекающиеся с входным и содержимые им же. Применимо для прямоугольных параллелепипедов любой размерности.

    ngry, 01 Апреля 2010

    Комментарии (27)
  6. PHP / Говнокод #2275

    +167.8

    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
    function returnDate($stamp){
    global $settings;
    $day = strftime("%d",$stamp+($settings['timeoffset']*3600));
    $month = strftime("%m",$stamp+($settings['timeoffset']*3600));
    $year = strftime("%Y",$stamp+($settings['timeoffset']*3600));
    switch ($month){
    case 01 : $month = "01"; break;
    case 02 : $month = "02"; break;
    case 03 : $month = "03"; break;
    case 04 : $month = "04"; break;
    case 05 : $month = "05"; break;
    case 06 : $month = "06"; break;
    case 07 : $month = "07"; break;
    case 08 : $month = "08"; break;
    case 09 : $month = "09"; break;
    case 10 : $month = "10"; break;
    case 11 : $month = "11"; break;
    case 12 : $month = "12"; break;
    }
    return "$day.$month.$year";
    }

    Взято из чешского шаблона под одну цмску. Автору, наверно, платят как Маяковскому - за каждую строчку :-)

    |)3F, 13 Декабря 2009

    Комментарии (27)
  7. Куча / Говнокод #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)
  8. JavaScript / Говнокод #2141

    +167.7

    1. 1
    $('div[id="myid"]')

    fuckyounoob, 14 Ноября 2009

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

    +150

    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
    var currentDate = new Date();
    var currentDay = currentDate.getDay();
    var currentMonth = currentDate.getMonth();
    var currentYear = currentDate.getYear();
    var currentHour = currentDate.getHours();
    var currentMinute = currentDate.getMinutes();
    var currentSecond = currentDate.getSeconds();
    if (currentMonth < 10) {
    	currentMonth = '0' + currentMonth;
    }
    if (currentDay < 10) {
    	currentDay = '0' + currentDay;
    }
    if (currentHour < 10) {
    	currentHour = '0' + currentHour;
    }
    if (currentMinute < 10) {
    	currentMinute = '0' + currentMinute;
    }
    if (currentSecond < 10) {
    	currentSecond = '0' + currentSecond;
    }

    говно

    Sadie, 25 Сентября 2009

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

    +53.4

    1. 1
    void (* signal(int __sig, void (* __func)(int))) (int)

    Объявление типа, представляющего собой указатель на функцию, возращающей указатель на функцию (может я не так понял?) из хедера signal.h.

    Говногость, 24 Сентября 2009

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

    +136

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    procedure Button1Click(Sender:TObject)
      begin
      if (TreeView1.Selected<>Nil) then
        if (TreeView1.Selected.ImageIndex = 5) then
          begin
          {выбран лист дерева - обрабатываем}
          ........
          end;
      end;

    Написано мною на втором курсе. Тип узла в дереве определялся по ImageIndex - узел каждого типа имел свою картинку.

    guest, 04 Мая 2009

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