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

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

    −102

    1. 1
    SELECT MAX(len) from huis

    bormandyan, 03 Апреля 2019

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

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    if (userSettingsErrorType != null && userSettingsErrorType.getError() != null &&
    				userSettingsErrorType.getError().getMessage() != null && userSettingsErrorType.getError().getMessage().getName() != null &&
    				userSettingsErrorType.getError().getMessage().getName().length != 0) {
    			try {
    				getView().ifPresent(v -> v.setFieldErrorMessage(SettingsField.NAME,
    				                                                userSettingsErrorType.getError().getMessage().getName()[0]));
    			} catch (Exception e) {
    				Crashlytics.logException(e);
    			}
    }

    наткнулся на сие чудо во время рефакторинга.

    copatel, 28 Марта 2019

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

    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
    if (memory[i] == CRG && memory[i + 1] == STDI) {
    	fprintf(code, "%d %d ", CRG, STDI);
    	i++;
    }
    else if (memory[i] == CRC && memory[i + 1] == STDI) {
    	fprintf(code, "%d %d ", CRC, STDI);
    	i++;
    }
    else if (memory[i] == PRG && memory[i + 1] == STDI) {
    	fprintf(code, "%d %d ", PRG, STDI);
    	i++;
    }
    else if (memory[i] == PRC && memory[i + 1] == STDI) {
    	fprintf(code, "%d %d ", PRC, STDI);
    	i++;
    }

    h: post/442988 / https://github.com/Centrix14/TVM/blob/master/TVM/ngl.c
    На статье стоит меточка «Tutorial».

    gost, 09 Марта 2019

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

    +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
    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
    <?php
    
    namespace AppHttpControllers;
    
    use AppModelsCardUserModel;
    use IlluminateHttpRequest;
    use AppModelsUserModel;
    use AppModelsArenaBattleModel;
    use AppModelsArenaCardsModel;
    use Auth;
    use Services;
    
    class ArenaController extends Controller
    {
        public function index()
        {
            $issetBattle = ArenaBattleModel::where('user1', Auth::user()->id)->orWhere('user2', Auth::user()->id)->count();
            if($issetBattle == 0)
            {
                $result = 'Начать подбор противника!<br>
                <a href="/arena/find" class="btn btn-games2 btn-block">Искать</a>';
            }
            else
            {
                $battle = ArenaBattleModel::where('user1', Auth::user()->id)->orWhere('user2', Auth::user()->id)->first();
                if($battle->status == 'card1_pick') return redirect('/arena/pick/1');
                if($battle->status == 'card2_pick') return redirect('/arena/pick/2');
                if($battle->status == 'battle') return redirect('/arena/battle');
                if($battle->status == 'result') return redirect('/arena/result');
                if($battle->user1 == Auth::user()->id) $opponent = $battle->user2;
                else $opponent = $battle->user1;
                if($opponent == 0) $result = 'Идёт поиск противника!<br>
                <a href="/arena/cancel" class="btn btn-games2 btn-block">Отменить поиск</a>';
                else
                {
                    if($battle->start_time < time())
                    {
                        $battle->status = 'card1_pick';
                        $battle->save();
                        return redirect('/arena/pick/1');
                    }
                    $result = 'Противник найден!<br>
                    '.($battle->start_time-time() > 0 ? 'До начала боя: '.Services::timer($battle->start_time-time()).'<br>' : 'Бой начался!<br>').'
                    <a href="/arena/cancel" class="btn btn-games2 btn-block">Отменить поиск</a>';
                }
            }
            return view('game.battles.arena.index', ['result' => $result]);
        }
    
        public function find()
        {
            $issetBattle = ArenaBattleModel::where('user1', Auth::user()->id)->orWhere('user2', Auth::user()->id)->count();
            if($issetBattle > 0) return back()->with('error', 'Подбор уже начат!');
            $battles = ArenaBattleModel::where('status', 'prepare')->where('user2', 0)->inRandomOrder();
            $myMaxCardLevel = Services::getMaxCardLevel(Auth::user()->id);
            if($battles->count() == 0)
            {
                ArenaBattleModel::create([
                    'user1' => Auth::user()->id,
                    'card_level' => $myMaxCardLevel+1
                ]);
                return back()->with('ok', 'Поиск противника начат!');
            }
            else
            {
                $battles = $battles->first();
                if($battles->card_level-1 > $myMaxCardLevel) $battles->card_level = $myMaxCardLevel+1;
                $battles->user2 = Auth::user()->id;
                $battles->start_time = time()+30;
                $battles->save();
                return back()->with('ok', 'Противник найден!');
            }
        }
    
        public function cancelFind()
        {
            $issetBattle = ArenaBattleModel::where('user1', Auth::user()->id)->orWhere('user2', Auth::user()->id);
            if($issetBattle->count() == 0) return back()->with('error', 'Подбор ещё не начат!');
            $foundBattle = $issetBattle->first();
            if($foundBattle->user1 == Auth::user()->id) $foundBattle->delete();
            else
            {
                $opponentMaxCardLevel = Services::getMaxCardLevel($foundBattle->user1);
                if($opponentMaxCardLevel != $foundBattle->card_level) $foundBattle->card_level = $opponentMaxCardLevel+1;
                $foundBattle->user2 = 0;
                $foundBattle->save();
            }
            return back();
        }
    }
    // и еще 10кб кода

    код игры на Laravel . Вкусняшка

    eskrano, 27 Февраля 2019

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

    +4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    struct Data { /* ... */ };
    
    class Items {
      void insert(Data&& data) {
        _storage.emplace_back(std::forward<Data>(data));
      }
    private:
      std::vector<Data> _storage;
    };

    Dumb luck. Nuff said.

    Elvenfighter, 08 Февраля 2019

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

    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
    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
    fn do_get_summary(req: &HttpRequest<AppState>) -> SummaryFuture {
        let token = req.token().expect("ISE: token not verified during AuthMiddleware stage");
    
        let datetime = req.match_info()
            .get("timestamp")
            .and_then(|s| i64::from_str(s).ok())
            .map(|ts| NaiveDateTime::from_timestamp(ts, 0));
    
        let datetime = match datetime {
            Some(dt) => dt,
            None => return Box::new(future::result(Err(ServiceError::InvalidSetting {
                key: "timestamp".into(),
                hint: "local time in seconds since Unix Epoch".into()
            }.into())))
        };
    
        let db = req.state().db.clone();
    
        let settings = req.state().db
            .send(db::GetSettings(token.clone()))
            .map_err(failure::Error::from)
            // flatten error
            .and_then(|res| match res {
                Ok(settings) => Ok(settings),
                Err(err) => Err(err)
            });
    
        let fitbit = req.state().db
            .send(db::GetSettingsFitbit(token))
            .map_err(failure::Error::from)
            // Check if there is token and flatten error
            .and_then(|res| match res {
                Ok(fitbit) => {
                    if fitbit.client_token.is_none() {
                        Err(ServiceError::TokenExpired.into())
                    } else {
                        Ok(fitbit)
                    }
                },
                Err(err) => Err(err)
            });
    
        let headmaster = req.state().headmaster.clone();
    
        let summary_and_token = settings.join(fitbit)
            .and_then(move |(settings, fitbit)| -> Box<dyn Future<Item = (Summary, FitbitToken), Error = failure::Error>> {
                // Deserialize token
                let token = fitbit.client_token.expect("ISE: token option is not cleared");
                let fitbit_token = match FitbitToken::from_json(&token) {
                    Ok(token) => token,
                    Err(err) => return Box::new(future::err(ServiceError::TokenExpired.into()))
                };
    
                let headmaster_config = master::HeadmasterConfig {
                    minimum_active_time: settings.hourly_activity_goal,
                    max_accounted_active_minutes: settings.hourly_activity_limit.unwrap_or(settings.hourly_activity_goal * 3),
                    debt_limit: settings.hourly_debt_limit.unwrap_or(settings.hourly_activity_goal * 3),
                    day_begins_at: settings.day_starts_at,
                    day_ends_at: settings.day_ends_at,
                    day_length: settings.day_length.unwrap_or((settings.day_ends_at.hour() - settings.day_starts_at.hour()) as i32),
                    user_date_time: datetime,
                };
    
                let auth_data = FitbitAuthData {
                    id: fitbit.client_id,
                    secret: fitbit.client_secret,
                    token: fitbit_token,
                };
    
                let future = headmaster.send(master::GetSummary::<FitbitActivityGrabber>::new(headmaster_config, auth_data))
                    .map_err(failure::Error::from)
                    // flatten error
                    .and_then(|res| res);
    
                Box::new(future)
            });
    
        let summary = summary_and_token
            .and_then(move |(summary, fitbit_token)| {
                db.send(db::UpdateSettingsFitbit::new(
                    token, db::models::UpdateFitbitCredentials {
                        client_token: Some(Some(fitbit_token.to_json())),
                        ..Default::default()
                    }))
                    .map_err(failure::Error::from)
                    .and_then(|_| Ok(summary))
            });
    
        Box::new(summary)
    }

    Фьючи в Rust до рефакторинга -- тот еще говнокод

    mersinvald, 12 Января 2019

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

    +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
    ...
    removed: function(row) {
    
        if ($(row).find('textarea')[0].style.backgroundColor === "red") {
            $(row).find('textarea')[0].style.backgroundColor = "white";
            --disabled_elements_count;
        }
    
        if (disabled_elements_count === 0) {
            $("input[type='submit']").prop('disabled', false);
        }
    }, ...

    eternalfame, 11 Января 2019

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

    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
    cript src='https://www.google.com/recaptcha/api.js?onload=captchaOn&render=explicit' async defer></script>
                                        </span>
        <span  id="noCaptchaBlock" style="display: none">
                                    <a onclick="cl=true" href="#" class="vam" style="z-index: 1;position: relative;text-decoration: none;border-radius: 2px;background: #4C8EFA;color: #fff;padding: 7px 20px;font-size: 20px;text-decoration: none !important;margin: 7px 10px;"  id="rbs">Пропустить рекламу</a>
                                    <span id="load" class="vam" style="z-index: 1;position: relative;margin: 6px 10px;display: none;font-size: 1.125em"><span id="statusload">Загрузка рекламы</span><span id="point">...</span></span></span>
        </span>
        <div class="progress" style="height: 100%;background: #bbbbbb;opacity: 0.2;z-index: 0;"><dt></dt><dd></dd></div>
    </div>
    <div class="bl_all_rek" style="position: relative;overflow: hidden;z-index: 1;">
        <div class="progress_bg"><div class="progress"><dt></dt><dd></dd></div></div>
        <div class="toggle" style="position: absolute;width: 4px;height: 100%;background-color: #EFC439;z-index: 3;left: 0;top: 10px;/* box-shadow: -3px 0px 7px 0px #000; */"></div>
        <div class="toggle" style="position: absolute;width: 4px;height: 100%;background-color: #EFC439;z-index: 3;right: 0;top: 10px;/* box-shadow: 3px 0px 7px 0px #000; */"></div>
        <div class="toggle" style="margin: 0px;background-color: #EFC439;padding:8px 15px;font-weight:bold;font-size: 14px;line-height: 100%;word-wrap: break-word;color:#FFF; font-family: Arial, sans-serif;text-align: center;box-shadow: 0px 0px 7px -1px #000, inset 0px 2px 8px -5px #000;position: relative;z-index: 2;">Реклама        <a class="a_site_top" style="margin: 0; font-size: 12px;top:auto;font-weight:normal;" target="_blank"
               title="http://yandex.ru" href="/away4.php?a=aHR0cDovL3lhbmRleC5ydQ=="
            >Открыть полностью</a>
        </div>

    Куча гавна с хардкодом с сайта catcut! Ну блять пиздец, так делать сайты нельзя.
    И прикол в том что сайт глючит, ПИЗДЕЦ!!!! ЕБАЛ В РОТ

    fuckercoder, 13 Декабря 2018

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

    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
    def is_regular_pay(self, order):
            return order.account is None
    
    
        def is_card_binding(self, order):
            return order.account != None
    
    
    ...
    
    if self.is_regular_pay(order):
                   ...
                    return HttpResponse("OK", status=200)
    
                elif self.is_card_binding(order):
                    ...
                    start_cancel_request(order)
    
                else:
                    get_logger().warn("Unknown successefull operation")
                order.save()

    PashaWNN, 09 Декабря 2018

    Комментарии (3)
  11. Куча / Говнокод #25159

    −4

    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
    <p>Example using a mathematical CAPTCHA.</p>
    <form method="post" action="/try-securimage/">
        <img style="float: left; padding-right: 5px" id="captcha_two" src="/securimage/securimage_show_math.php?namespace=mathcaptcha&amp;amp;731f6b2ff6753462b557785b09107a0a" alt="CAPTCHA Image" /></p>
    <div id="captcha_two_audio_div"><audio id="captcha_two_audio" preload="none" style="display: none"><source id="captcha_two_source_mp3" src="/securimage/securimage_play.php?namespace=mathcaptcha&amp;id=5c0860efe364f&amp;format=mp3" type="audio/mpeg"><source id="captcha_two_source_wav" src="/securimage/securimage_play.php?namespace=mathcaptcha&amp;id=5c0860efe368a" type="audio/wav"><object type="application/x-shockwave-flash" data="/securimage/securimage_play.swf?bgcol=%23ffffff&amp;icon_file=%2Fsecurimage%2Fimages%2Faudio_icon.png&amp;audio_file=%2Fsecurimage%2Fsecurimage_play.php%3Fnamespace%3Dmathcaptcha%26" height="32" width="32"><param name="movie" value="/securimage/securimage_play.swf?bgcol=%23ffffff&amp;icon_file=%2Fsecurimage%2Fimages%2Faudio_icon.png&amp;audio_file=%2Fsecurimage%2Fsecurimage_play.php%3Fnamespace%3Dmathcaptcha%26"></object><br /></audio></div>
    <div id="captcha_two_audio_controls"><a tabindex="-1" class="captcha_play_button" href="/securimage/securimage_play.php?namespace=mathcaptcha&amp;id=5c0860efe36cf" onclick="return false"><img class="captcha_play_image" height="32" width="32" src="/securimage/images/audio_icon.png" alt="Play CAPTCHA Audio" style="border: 0px"><img class="captcha_loading_image rotating" height="32" width="32" src="/securimage/images/loading.png" alt="Loading audio" style="display: none"></a><noscript>Enable Javascript for audio controls</noscript></div>
    <p><script type="text/javascript">captcha_two_audioObj = new SecurimageAudio({ audioElement: 'captcha_two_audio', controlsElement: 'captcha_two_audio_controls' });</script><a tabindex="-1" style="border: 0" href="#" title="Refresh Image" onclick="if (typeof window.captcha_two_audioObj !== 'undefined') captcha_two_audioObj.refresh(); document.getElementById('captcha_two').src = '/securimage/securimage_show_math.php?namespace=mathcaptcha&amp;' + Math.random(); this.blur(); return false"><img height="32" width="32" src="/securimage/images/refresh.png" alt="Refresh Image" onclick="this.blur()" style="border: 0px; vertical-align: bottom"></a></p>
    <div style="clear: both"></div>
    <p><label for="captcha_code">Solve the problem: </label> <input type="text" name="ct_captcha1" id="captcha_code" autocomplete="off" >    </p>
    <div><input type="submit" value="Submit Form" /></div>
    <p>&nbsp;</p>
    <p>Example using a two-word CAPTCHA.</p>
    <form method="post" action="/try-securimage/">
        <img style="float: left; padding-right: 5px" id="captcha_three" src="/securimage/securimage_show_words.php?namespace=wordcaptcha&amp;amp;cc3139fa82d61239cadcaaeddebb0d16" alt="CAPTCHA Image" /><a tabindex="-1" style="border: 0" href="#" title="Refresh Image" onclick="if (typeof window.captcha_three_audioObj !== 'undefined') captcha_three_audioObj.refresh(); document.getElementById('captcha_three').src = '/securimage/securimage_show_words.php?namespace=wordcaptcha&amp;' + Math.random(); this.blur(); return false"><img height="32" width="32" src="/securimage/images/refresh.png" alt="Refresh Image" onclick="this.blur()" style="border: 0px; vertical-align: bottom"></a></p>
    <div style="clear: both"></div>
    <p><label for="captcha_code">Type the text:</label> <input type="text" name="ct_captcha2" id="captcha_code" autocomplete="off" >    </p>
    <div><input type="submit" value="Submit Form" /></div>
    </form>
    
    				<div class="clearfix"></div>
    
    				
    			</div>
    
    		</div>
    
    		<!-- AdSense -->
    
    	    
    		<!-- /AdSense -->
    
    	
    
    
    <!-- You can start editing here. -->
    
    
    
    <div id="comments">
    
    
    
    
    
    
    	
    		<!-- If comments are closed. -->
    
    		<p class="nocomments"></p>
    
    
    
    	
    
    
    
    
    
    </div> <!-- end #comments_wrap -->
    
    
    
    
    
    
    
    		
    	
      
    
    
    
    		  </div><!--/content-->
    
    		</div><!--/main grid_x-->
    
    	
    	<!--right sidebar-->
    
    	<div class="grid_7">
    
    	  <div id="sidebar" class="r">
    
    	    <div class="module"><div><div><div class="tl">

    Блять эти пидарасы ебанные! На популярном сайте допускают ошибки, всю работу через жопу выполняют пиндосы ниче не лучше русских блядь пидоры, сжечь нахуй сайт удалить нахуй ЗАБАНИТЬ НАХУЙ СУКА

    fuckercoder, 06 Декабря 2018

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