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

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

    −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
    class C
    {
    	val: number;
    
    	constructor()
    	{
    		this.val = 2;
    	}
    }
    
    function o(val? : C)
    {
    	print(val?.val);
    }
    
    function main()
    {
    	o(new C());
    	o(null);
    	o();
    }

    Новый говнокод подоспел.... а как тебе такое слабый ужасный С/C++ ... ты так умеешь?

    Результат работы:

    C:\temp>C:\dev\TypeScriptCompiler\__build\tsc\bin\tsc.exe --emit=jit --opt --shared-libs=C:\dev\TypeScriptCompiler\__build\tsc\bin\TypeScriptRuntime.dll C:\temp\1.ts
    2
    0
    0

    ASD_77, 20 Декабря 2021

    Комментарии (60)
  3. Си / Говнокод #27266

    +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
    25. 25
    26. 26
    // https://deadlockempire.github.io/
    // Игра, где надо играть за планировщик чтоб вызвать дедлок
    
    // https://deadlockempire.github.io/#2-flags
    
    // First Army
    
    while (true) {
      while (flag != false) {
        ;
      }
      flag = true;
      critical_section();
      flag = false;
    }
    
    // Second Army
    
    while (true) {
      while (flag != false) {
        ;
      }
      flag = true;
      critical_section();
      flag = false;
    }

    The day finally came. The Deadlock Empire opened its gates and from them surged massive amounts of soldiers, loyal servants of the evil Parallel Wizard. The Wizard has many strengths - his armies are fast, and he can do a lot of stuff that we can't. But now he set out to conquer the world, and we cannot have that.

    You are our best Scheduler, commander! We have fewer troops and simpler ones, so we will need your help. Already two armies of the Deadlock Empire are approaching our border keeps. They are poorly equipped and poorly trained, however. You might be able to desync them and break their morale.

    j123123, 20 Февраля 2021

    Комментарии (60)
  4. C++ / Говнокод #26341

    0

    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
    t = rx + (ry * 100);
    std::vector<std::string> tmap;
    coin = 0;
    rcol = 0;
    roomname = "Untitled room ["+UtilityClass::String(rx) + "," + UtilityClass::String(ry)+"]";
    
    switch(t)
    {
    
    case rn(50,50):
    
        tmap.push_back("283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283");
        tmap.push_back("283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283");
        tmap.push_back("283,283,283,283,283,283,283,283,284,444,444,444,444,444,444,444,444,444,285,283,284,444,444,444,444,444,444,444,444,444,444,444,444,285,283,283,283,283,283,283");
        tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,363,364,365,0,0,0,403,283,405,0,0,0,363,364,365,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,403,283,405,0,0,0,443,444,445,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("444,444,444,444,444,444,285,283,405,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("0,0,0,0,0,0,403,283,405,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("0,0,0,0,0,0,403,283,405,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("0,0,0,0,0,0,403,283,405,0,0,0,403,283,324,364,364,364,364,364,364,364,364,364,325,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("0,0,0,0,0,0,403,283,405,0,0,0,403,283,283,283,283,283,283,283,283,283,283,283,283,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("0,0,0,0,0,0,403,283,405,0,0,0,443,444,444,444,444,444,444,444,444,444,444,444,285,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("364,364,365,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,405,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,405,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,405,0,0,0,403,283,324,364,364,364,364,364,364,364,364,364,364,364,365,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,405,0,0,0,403,283,283,283,283,283,283,283,283,283,283,283,283,283,405,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,405,0,0,0,443,444,444,444,444,444,444,444,444,444,444,444,444,444,445,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,324,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,325,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
        tmap.push_back("283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
    
        obj.createentity(game, 232, 24, 10, 0, 250500);  // (savepoint)
    
        if(game.intimetrial)
        {
            obj.createblock(0, 0, 0, 8, 240);
        }
    
        rcol=1;
        roomname = "Get Ready To Bounce";
        break;

    Именно поэтому я за «std::embed».
    https://github.com/TerryCavanagh/VVVVVV/blob/master/desktop_version/src/Labclass.cpp

    gost, 11 Января 2020

    Комментарии (60)
  5. PHP / Говнокод #25570

    +2

    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
    <?php
        define('_SECUR_GAMES', 1);
        $rootpath = '../';
        require_once '../includes/start.php';
        require_once '../includes/function.php';
        require_once '../includes/header.php';
    if($level >0 AND $fr_id!=0)
    {
    $header='alliance';
    mysql_query("UPDATE `mesto` SET `place` = '".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($header)))))))."' WHERE `uid`=".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($use_id)))))))."");
    }
    $fr=check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($_GET['f'])))))));
    $q = mysql_query("SELECT * FROM `fractions` WHERE `id`='".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($fr)))))))."'");
    $f = mysql_fetch_array($q);
    $ucount = mysql_result(mysql_query("SELECT COUNT(*) FROM `fractions_users` WHERE `uid`='".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($use_id)))))))."' AND `fid`='".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($f['id'])))))))."';"), 0);
    $fadm = mysql_result(mysql_query("SELECT COUNT(*) FROM `fractions_users` WHERE `uid`='".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($use_id)))))))."' AND `fid`='".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($f['id'])))))))."' AND `adm`=1;"), 0);
        if($game==0 OR $level==0 OR $ban==1){
               echo "<title>Доступ закрыт!!!</title>";

    @since 2019

    eskrano, 25 Апреля 2019

    Комментарии (60)
  6. Python / Говнокод #25563

    −1

    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
    def da_pizda(update, context):
        global da_counter, pizda_counter
    
        text = update.message.text.split()
        text = [word.lower() for word in text]
    
        if 'дa' in text or 'da' in text or 'dа' in text:
            text.append('да')
        if 'пиздa' in text or 'pizda' in text or 'pizdа' in text or 'Πизда' in text:
            text.append('пизда')
    
        if 'да' in text:
            bot.send_message(chat_id=update.message.chat_id, text='пизда',
                             reply_to_message_id=update.message.message_id)
            pizda_counter += 1
        if 'пизда' in text:
            bot.send_message(chat_id=update.message.chat_id, text='да',
                             reply_to_message_id=update.message.message_id)
            da_counter += 1
    
        da_counter += update.message.text.split().count('да')
        pizda_counter += update.message.text.split().count('пизда')

    Бот, проверяющий наличие слов "да" и "пизда" в чате телеграма, и отвечающий соответственно.

    Umerenkov21, 23 Апреля 2019

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    checkTableFilters () {
        if (this._activeTableFilter && this._filter.filter._filters.get(this._activeTableFilter)) {
          this._filter.filter._filters.get(this._activeTableFilter).Update();
        }
      }

    "Так вышло" - хороший ответ.
    1. this._filter.filter._filters (фильтры фильтра фильтра?..)
    2. Зачем имитировать приватность полей класса соглашением о наименовании, если её игнорируют как могут?..
    3. ... дополните сами

    webviewer, 30 Января 2019

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

    +2302

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    http://govnokod.ru/20924
    
    Запрашиваемая страница не найдена!
    
    Возможно, её и не было никогда

    http://dump.bitcheese.net/files/pimarut/%D0%93%D0%BE%D0%B2%D0%BD%D0%BE%D0%BA%D0%BE%D0%B4_%2320924_%E2%80%94_C___%E2%80%94_%D0%93%D0%BE%D0%B2%D0%BD%D0%BE%D0%BA%D0%BE%D0%B4.%D1%80%D1%83.html
    но бекап я сделал, так что хуй вам. Я требую продолжения банкета.

    j123123, 24 Августа 2016

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

    +5

    1. 1
    2. 2
    3. 3
    4. 4
    function is_assoc( $array ) {
    
    	return is_array($array) && substr( json_encode($array), 0, 1 ) == '{';
    }

    bot, 26 Июля 2016

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

    +5

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    class Db {
    
        private $where;
        private $select = '*';
        private $limit;
        private $order_by;
        private $query;
        private $set;
    
        private function query_string($table){
            $query = ($this->query) ? $this->query : "SELECT $this->select FROM $table WHERE $this->where $this->order_by $this->limit";
            return $query;
        }
        function query($text){
            $this->query = $text;
            return $this;
        }
        function where_text($text){
            $operator = 'AND';
            if (!$this->where){
                $this->where = $text;
            } else {
                $this->where .= $operator." ".$text;
            }
            return $this;
        }
        function order_by_text($text){
            if (!$this->order_by){
                $this->order_by = ' ORDER BY '.$text;
            } else {
                $this->order_by .= ', '.$text;
            }
        }
        function connect($host,$login_mysql,$password_mysql,$baza_name) {
            $db = @mysql_connect("$host", "$login_mysql", "$password_mysql");
            mysql_set_charset('utf8',$db);
            if (!$db) exit("<p>Sorry, not available MySQL server</p>");
            if (!@mysql_select_db($baza_name,$db)) exit("<p>Unfortunately, the database is not available</p>");
        }
        function select($column){
            $this->select = $column;
            return $this;
        }
        function limit($start,$count){
            $this->limit = ' LIMIT '.$start.','.$count;
            return $this;
        }
        function order_by($key){
            if (is_array($key)){
                foreach ($key as $column => $value){
                    if (!$this->order_by){
                        $this->order_by = ' ORDER BY '.$column.' '.$value;
                    } else {
                        $this->order_by .= ', '.$column.' '.$value;
                    }
                }
            } else {
                if (!$this->order_by){
                    $this->order_by = ' ORDER BY '.$key;
                } else {
                    $this->order_by .= ', '.$key;
                }
            }
            return $this;
        }
        function where($key,$compare = '='){
            $operator = 'AND';
            if (is_array($key)){
                foreach ($key as $column=>$value){
                    if (!$this->where){
                        $this->where = $column.$compare."'".$value."' ";
                    } else {
                        $this->where .= $operator." ".$column.$compare."'".$value."' ";
                    }
                }
            } else {
                $key = explode(',',$key);
                if (!$this->where){
                    $this->where = $key[0].$compare."'".$key[1]."' ";
                } else {
                    $this->where .= $operator." ".$key[0].$compare."'".$key[1]."' ";
                }
            }
            return $this;
        }
        function search($column,$search){
            $operator = 'AND';
            $search = strtr($search,array(" "=>" +"));
            $search = '+'.$search;
            $w = 'MATCH('.$column.") AGAINST('".$search."' IN BOOLEAN MODE)";
            if (!$this->where){
                $this->where = $w;
            } else {
                $this->where .= $operator." ".$w;
            }
            return $this;
        }
        function lines($table,$ext = true){
            $msql_query = mysql_query($this->query_string($table));
            $line = mysql_fetch_assoc($msql_query);

    "Удобный php класс для работы с MySQL"
    https://habrahabr.ru/post/277095

    Lure Of Chaos, 12 Февраля 2016

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

    +175

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    function json2array($json_data)
    {
        $json_array = false;
        $json = substr($json, 1, -1);
        $json = str_replace(array(":", "{", "[", "}", "]"), array("=>", "array(", "array(", ")", ")"), $json_data);
        @eval("\$json_array = array({$json});");
        return $json_array;
    }

    Парсим json

    acer_paser, 01 Июня 2015

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