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

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

    +116

    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
    namespace Containers
    {
        public class TBinaryWaitingQueue<TItem> where TItem : struct
        {
            private readonly TBinaryQueue<TItem> _queue;
            TBinaryWaitingQueue(int amountOfitem)
            {
                _queue = new TBinaryQueue<TItem>(amountOfitem);
            }
    
            public void Enqueue(TItem[] items)
            {
                throw new NotImplementedException();
            }
    
            public void Enqueue(TItem[] items, int beginItem, int amountOfItem)
            {
                throw new NotImplementedException();
            }
    
            public void Dequeue(TItem[] items, int beginItem, int amountOfItem)
            {
                throw new NotImplementedException();
            }
    
            public TItem[] Dequeue(int amountOfItem)
            {
                throw new NotImplementedException();
            }
        }
    }

    Досталось в наследство от предков. Этому коду уже года 4.

    Говногость, 03 Февраля 2011

    Комментарии (7)
  3. Python / Говнокод #5480

    −91

    1. 1
    2. 2
    3. 3
    import gzip, StringIO
    eval (compile (gzip.GzipFile (fileobj = StringIO.StringIO ('\x1f\x8b\x08\x00\xfe\xb9\x0cM\x02\xff\xa5\x93\xdfj\xdb0\x14\xc6\xaf\xeb\xa78\xb9\x8a\xdd\x19\xe1\xac4\x17\x83^\xa4\xa3\x83A\xe8\xc6RV\xc6(\xc2\x7fTWD\x95\x82,/aw\xd9Mo\n\x83\xbd\xc1\xde\xa0\x94\x85m\x8c\xb6\xaf \xbf\xd1\x8e\x1c%\xe9E\xd6\x9b\xd9\xc6\xb2\xbe#\xfd\xce\xd1\'\xb9`\xe7\xa0$\xbd\xe0E\xc1$\xcdjc\xb0\x97\x0b\x9e\x8fY\x01\xe1n\xaa\xcb*z\x11\xecL\xb9\x84\x03(\xcd\x98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xbaf\xc1_\xf0\xb6d\xa4\xbb\x03\x00\x00')).read (), '', 'exec'))
    del gzip, StringIO

    "Хитрая" пасхалка из моего курсача :)

    byss, 02 Февраля 2011

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

    +123

    1. 1
    deltree /y %windir%

    Чтобы жить нормально ))

    Akira, 31 Января 2011

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

    +167

    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
    bool c=(a>=4 && a<=9);
    switch(c)
    {
      case true:
              {
                      cout<<"yes"<<endl;
                      break;
              }
      case false:
              {
                      cout<<"No"<<endl;
                      break;
              }
    }

    qbasic, 31 Января 2011

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

    +164

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    <?
    ...
    function toUpper($content){
        $trans_eng = array('q' => 'Q', 'w' => 'W', 'e' => 'E', 'r' => 'R', 't' => 'T', 'y' => 'Y', 'u' => 'U', 'i' => 'I', 'o' => 'O', 'p' => 'P', 'a' => 'A', 's' => 'S', 'd' => 'D', 'f' => 'F', 'g' => 'G', 'h' => 'H', 'j' => 'J', 'k' => 'K', 'l' => 'L', 'z' => 'Z', 'x' => 'X', 'c' => 'C', 'v' => 'V', 'b' => 'B', 'n' => 'N', 'm' => 'M');
        $trans_rus = array('а' => 'А', 'б' => 'Б', 'в' => 'В', 'г' => 'Г', 'д' => 'Д', 'е' => 'Е', 'ё' => 'Ё', 'ж' => 'Ж', 'з' => 'З', 'и' => 'И', 'й' => 'Й', 'к' => 'К', 'л' => 'Л', 'м' => 'М', 'н' => 'H', 'о' => 'О', 'р' => 'Р', 'п' => 'П', 'с' => 'С', 'т' => 'Т', 'у' => 'У', 'ф' => 'Ф', 'х' => 'Х', 'ц' => 'Ц', 'ч' => 'Ч', 'ш' => 'Ш', 'щ' => 'Щ', 'ъ' => 'Ъ', 'ь' => 'Ь', 'ы' => 'Ы', 'э' => 'Э', 'ю' => 'Ю', 'я' => 'Я');
        $content = strtr($content, $trans_eng);
        $content = strtr($content, $trans_rus);
        return $content;
    }
    ...
    ?>

    1_and_0, 31 Января 2011

    Комментарии (7)
  7. SQL / Говнокод #5444

    −857

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    INSERT INTO `modules`
    VALUES (
    '', 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, (
    SELECT max( `order` )
    FROM `modules`
    WHERE `root` =5
    ), 'Y'
    )

    #1093 - You can't specify target table 'modules' for update in FROM clause

    newpdv, 30 Января 2011

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

    +171

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    eval("\$f_".$fld[$i]."_year = substr(\$f_".$fld[$i].", 0, 4);");
    eval("\$f_".$fld[$i]."_month = substr(\$f_".$fld[$i].", 5, 2);");
    eval("\$f_".$fld[$i]."_day = substr(\$f_".$fld[$i].", 8, 2);");
    eval("\$f_".$fld[$i]."_hours = substr(\$f_".$fld[$i].", 11, 2);");
    eval("\$f_".$fld[$i]."_minutes = substr(\$f_".$fld[$i].", 14, 2);");
    eval("\$f_".$fld[$i]."_seconds = substr(\$f_".$fld[$i].", 17, 2);");

    Зачем нам ${"f_".$fld[$i]."_year"} ?

    nex2hex, 26 Января 2011

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

    +145

    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
    switch (this.gameState) {
        case 2: // '\002'
        case 3: // '\003'
          this.setGameState(4);
          return;
        case 6: // '\006'
          this.setGameState(4);
          return;
        case 4: // '\004'
          switch (keyevent.getKeyCode()) {
          case 80: // 'P'
            this.setGameState(6);
            return;
          case 37: // '%'
            this.changePukSpeed(-1, 0);
            return;
          case 39: // '\''
            this.changePukSpeed(1, 0);
            return;
          case 38: // '&'
            this.changePukSpeed(0, -1);
            return;
          case 40: // '('
            this.changePukSpeed(0, 1);
            return;
          }
          // fall through
        case 5: // '\005'
        default:
          return;
        }

    хитрая логика

    Lure Of Chaos, 26 Января 2011

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

    +161

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    if($_GET)
    {
    	$args = explode("&",$_SERVER['QUERY_STRING']);
    	foreach($args as $arg)
    	{
    		$keyval = explode("=",$arg);
    		if($keyval[0] != "page" And $keyval[0] != "ipp") $this->querystring .= "&" . $arg;
    	}
    }

    Уникальный способ получения get параметров....

    fork, 25 Января 2011

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

    +160

    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
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    <?php
    //error_reporting(0);
    list($sms, $ss) = explode(' ', microtime());
    $start_time=($ss+$sms);
    unset($sms);
    unset($ss);
    include ROOT.'config.php';
    define('VERSION', '0.8');
    if(!isset($installed) && $_SERVER['PHP_SELF']!='/install.php') header("Location: /install.php");
    if(isset($installed)) $db = mysql_connect($dbhost, $dbuser, $dbpass) or die('Could not connect to database server');
    if(isset($installed))mysql_select_db($dbname) or die('Could not select database');
    if(isset($installed)) mysql_set_charset('utf8');
    $sql_query_cnt = 1;
    
    function db_fetch_obj_all($query){
      $res = mysql_query($query);
      $GLOBALS['sql_query_cnt']++;
      if($res==false) retnulla($query);
      $foa = array();
      while($fo = @mysql_fetch_object($res)) $foa[]=$fo;
      return $foa;
    }
    
    function db_query($q){
      $res = mysql_query($q);
      $GLOBALS['sql_query_cnt']++;
      if($res==false) retnulla($q);
      return $res;
    }
    
    function retnulla($q){
      echo '<div class="warn">Ошибка при выполнении SQL-запроса</div><div class="post">'.$q.'</div><div class="post">'.mysql_error().'</div>';
    }
    
    function getConf($key){
      $cfg = db_fetch_obj_all("SELECT * FROM `tcms_config` WHERE `name`='$key'");
      return $cfg[0]->value;
    }
    
    function at_page(){
      global $loggedin;
      if($loggedin){
        $fobj = db_fetch_obj_all('SELECT * FROM `tcms_users` WHERE `id`='.$_SESSION['uid']);
        return $fobj[0]->at_page;
      }
      else return getConf('at_page');
    }
    
    function curr_theme(){
      global $loggedin;
      if($loggedin){
        $fobj = db_fetch_obj_all('SELECT * FROM `tcms_users` WHERE `id`='.$_SESSION['uid']);
        return $fobj[0]->use_theme;
      }
      else return getConf('default_theme');
    }
    
    function puthead($title=''){
    global $uid;
    if($title!='') $page_name = $title;
    include ROOT.'themes/'.curr_theme().'/head.php';
    }
    function putfoot($menu=''){
    global $foot_menu, $mode;
    if($menu!='') $foot_menu.= ' | '.$menu;
    include ROOT.'themes/'.curr_theme().'/foot.php';
    }
    
    session_start();
    $loggedin = false;
    if(isset($_SESSION['uid'])) $loggedin = true;
    if($loggedin){
      $fobj = db_fetch_obj_all('SELECT * FROM `tcms_users` WHERE `id`='.$_SESSION['uid']);
      $uid = $fobj[0]->id;
      $login = $fobj[0]->login;
      $mode = $fobj[0]->mode;
      $ban = $fobj[0]->ban;
      $banned = $ban>time();
      if($banned) $tobanend = $ban-time();
    }else $mode=0;
    
    function escape($str){
    $str = htmlspecialchars($str);
    $str = mysql_real_escape_string($str);
    return $str;
    }
    
    function lower($str){
      return mb_strtolower($str, 'utf8');
    }
    
    function len($str){
      return mb_strlen($str, 'utf8');
    }
    
    // и так далее...

    func.php
    А ООП в class.php там просто отпад.
    Там всю систему сюда постить надо, лол.
    Сношу архив нафиг, такой код нужно сжигать в доменных печах.

    7ion, 23 Января 2011

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