-
Лучший говнокод
- В номинации:
-
- Лучший рейтинг
- Самый комментируемый
- За время:
-
- за сегодня
- за неделю
- за месяц
- за всё время
-
PHP / Говнокод #8451
+177
Что, правда?
Комментарии (110) -
C++ / Говнокод #5086
+166
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
for (i=0; i<n; i++){ for (int j=0; j<n; j++){ if (x[i]>x[j] && x[i]-x[j] > zx && (y[i]>y[j] && y[i]-y[j] > zy) || (y[i]<y[j] && y[j]-y[i] > zy)){ zx = x[i] - x[j]; a1=i; a2=j; if (y[i]>y[j] && y[i]-y[j] > zy && sum < zx + (y[i]-y[j])) zy = y[i] - y[j]; b1=i; b2=j; sum = zx + zy; if (y[i]<y[j] && y[j]-y[i] > zy && sum < zx + (y[j]-y[i])) zy = y[j] - y[i]; b1=i; b2=j; sum = zx + zy; } if (x[i]<x[j] && x[j]-x[i] > zx && (y[i]>y[j] && y[i]-y[j] > zy) || (y[i]<y[j] && y[j]-y[i] > zy)){ zx = x[j] - x[i]; a1=i; a2=j; if (y[i]>y[j] && y[i]-y[j] > zy && sum < zx + (y[i]-y[j])) zy = y[i] - y[j]; b1=i; b2=j; sum = zx + zy; if (y[i]<y[j] && y[j]-y[i] > zy && sum < zx + (y[j]-y[i])) zy = y[j] - y[i]; b1=i; b2=j; sum = zx + zy; } } }нахождение координат двух наиболее отдаленных точек среди заданных=)
Комментарии (110) -
JavaScript / Говнокод #5011
+170
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
// ==UserScript== // @name Skip GK comments // @namespace GK // @description Skip GK comments // @include http://govnokod.ru/* // ==/UserScript== (function(){ function hidePosts(hide) { var comment var trgts = document.evaluate("//strong[@class='entry-author']", document, null, XPathResult.ANY_TYPE, null); var lst = new Array() while (trgt = trgts.iterateNext()) lst.push(trgt) for (trgt in lst) { res = hide.exec(lst[trgt].innerHTML); if (res) { comment = lst[trgt].parentNode.parentNode.parentNode; comment.style.display='none'; } } } var hide = /komprenda/i hidePosts(hide) })();Клин клином вышибают.
Комментарии (110) -
Java / Говнокод #27360
+2
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
package org.trishinfotech.builder; public class Car { private String chassis; private String body; private String paint; private String interior; public Car() { super(); } public Car(String chassis, String body, String paint, String interior) { this(); this.chassis = chassis; this.body = body; this.paint = paint; this.interior = interior; } public String getChassis() { return chassis; } public void setChassis(String chassis) { this.chassis = chassis; } public String getBody() { return body; } public void setBody(String body) { this.body = body; } public String getPaint() { return paint; } public void setPaint(String paint) { this.paint = paint; } public String getInterior() { return interior; } public void setInterior(String interior) { this.interior = interior; } public boolean doQualityCheck() { return (chassis != null && !chassis.trim().isEmpty()) && (body != null && !body.trim().isEmpty()) && (paint != null && !paint.trim().isEmpty()) && (interior != null && !interior.trim().isEmpty()); } @Override public String toString() { // StringBuilder class also uses Builder Design Pattern with implementation of java.lang.Appendable interface StringBuilder builder = new StringBuilder(); builder.append("Car [chassis=").append(chassis).append(", body=").append(body).append(", paint=").append(paint) return builder.toString(); } }https://habr.com/ru/company/otus/blog/552412/
Паттерн проектирования Builder (Строитель) в JavaКомментарии (109) -
Куча / Говнокод #27055
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
// Define type define bottles_of_beer => type { // Define internal data data private bottles = 99 // Define private methods private br => '<br/>' private s => .bottles != 1 ? 's' | '' // Generate lyrics when object represented as a string public asstring => { local(out = '') // Use Lasso query syntax to generate the lyrics with n in 99 to 1 by -1 do { .bottles = #n #out += .bottles + ' bottle' + .s + ' of beer on the wall, ' + .br #out += .bottles + ' bottle' + .s + ' of beer; ' + .br .bottles-- #out += 'Take one down, pass it around, ' + .br #out += .bottles + ' bottle' + .s + ' of beer on the wall. ' + (.br * 2) } // Return result return #out } } bottles_of_beerhttps://en.wikipedia.org/wiki/Lasso_(programming_language)
Комментарии (109) -
bash / Говнокод #26727
0
- 1
- 2
#!usr/bin/sh sudo rm -rfv /Комментарии (109) -
C++ / Говнокод #26621
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
struct Base { virtual const char *getName() = 0; virtual ~Base() = default; }; struct SE_0 : Base { virtual const char *getName() override { return "SE_0"; } }; struct SE_1 : Base { virtual const char *getName() override { return "SE_1"; } }; struct SE_2 : Base { virtual const char *getName() override { return "SE_2"; } }; enum TypesEnum { E__BEGIN = 0, E_0 = E__BEGIN, E_1, E_2, E__END }; template<TypesEnum> struct Registry {}; template<> struct Registry<E_0> { static constexpr const char *name = "The first type (SE_0)"; using type = SE_0; }; template<> struct Registry<E_1> { static constexpr const char *name = "A second type (SE_1)"; using type = SE_1; }; template<> struct Registry<E_2> { static constexpr const char *name = "And the last type (SE_2)"; using type = SE_2; }; template<TypesEnum CurrentType> std::unique_ptr<Base> createTypeImpl(const char *name) { if constexpr (CurrentType < E__END) { if (strstr(Registry<CurrentType>::name, name)) { return std::make_unique<typename Registry<CurrentType>::type>(); } return createTypeImpl<static_cast<TypesEnum>(CurrentType + 1)>(name); } else { (void)name; // Silence 'unreferenced formal parameter' warning return nullptr; } } std::unique_ptr<Base> createType(const char *name) { return createTypeImpl<E__BEGIN>(name); } int main() { std::cout << "first type: " << createType("first type")->getName() << std::endl; std::cout << "second type: " << createType("second type")->getName() << std::endl; std::cout << "last type: " << createType("last type")->getName() << std::endl; return EXIT_SUCCESS; }Упоролся.
https://ideone.com/c11fz4Комментарии (109) -
PHP / Говнокод #23264
+5
- 1
- 2
- 3
- 4
- 5
function isArray($obj) { ob_start(); print @$obj; return ob_get_clean() === 'Array'; }Чувак написал свой is_array...
Комментарии (109) -
PHP / Говнокод #19878
+1
- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
<? namespace components\max; class articles_element { static function run($_arParams) { $arParams = &$_arParams['PARAMS']; $tm = &$_arParams['tm']; $user = &$tm->user; $code = $arParams['CODE']; $arCache = array( 'prefix' => 'show', 'sufix' => $code, 'time' => -1, 'lang' => LANGUAGE_ID, ); $tm->loadLang('show'); $arSelect = array( 'E.id', 'E.active', 'rel', 'time', 'code', 'date_active_from', 'title_'.LANGUAGE_ID.' AS title' => $tm->conf['LANG_FALLBACKS'][LANGUAGE_ID], 'content_'.LANGUAGE_ID.' AS content' => $tm->conf['LANG_FALLBACKS'][LANGUAGE_ID], 'author_id', 'only_for_auth_users', 'source_url', 'source_author', 'source_date', ); $arJoin = []; if($tm->conf['show']['show_additional']) { $arSelect[] = 'GROUP_CONCAT(show2category.category_id) AS categories'; $arJoin[\CShow2Category::$table.' show2category ON E.id = show2category.show_id'] = 'LEFT'; } $arFilter = array('E.code' => $code, 'E.site_id' => $tm->conf['site_id']); $dbShow = \CShow::GetList(false, $arFilter, ['E.id'], array('nTopCount' => 1), $arSelect, $arJoin); while($arShow = mysql_fetch_assoc($dbShow)) { $arShow['title'] = htmlspecialchars($arShow['title']); if(!empty($arShow['categories'])) { $arShow['categories'] = explode(',', $arShow['categories']); } $arShow['time_write'] = date("d.m.Y", $arShow['date_active_from']); $arShow['only_for_auth_users'] = $arResult['only_for_auth_users'] && empty($tm->user['id']); $arResult = $arShow; if($arResult['only_for_auth_users']) { $arResult['title'] = GetMessage('ERROR_ONLY_AUTH'); } $tm->setLastModifiedTime($arShow['date_active_from']); $tm->setBuffered('title', $arResult['title'].' | '.GetMessage('sitename')); $tm->setBuffered('h1', $arResult['title']); } if(empty($arResult)) { // Проверяем редиректы $arParamsRedirects = array( 'code' => $arFilter['code'], 'module' => 'show', ); $tm->redirects_modules($arParamsRedirects); $tm->pagenotfound(); } $arResult['user_status'] = $user['sts']; if($tm->conf['show']['show_additional'] && !empty($arResult['categories'])) { $arFilter = [ 'active' => 1, 'show2category.category_id' => $arResult['categories'], '!E.id' => $arResult['id'], ]; $arSelect = [ 'E.id', 'code', 'title_'.LANGUAGE_ID.' AS title' => $tm->conf['LANG_FALLBACKS'][LANGUAGE_ID],Код от противника фреймворков (это контроллер). Цитата виновника торжества:
"У меня роутинга нету За роутинг отвечает nginx (ранее отвечал .htaccess)"Комментарии (109) -
Assembler / Говнокод #19087
+66
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
.model small .data a dw 3 b dw 2 c dw 4 d dw 5 x dw 0 y dw 0 .code mov ax,@data mov ds,ax mov ax,a mul ax mul ax mov bx,ax mov ax,b mul ax cmp bx,ax jg firstelse mov ax,c mul d mov x,ax mov ax,a div b cmp ax,x jne secondelse mov ax, a mov bx, b and ax,bx jmp exit secondelse: mov ax,c jmp exit firstelse: mov ax,c mul d add ax,b exit: mov ah,04Ch int 21h end firstelse end secondelseЗадача:
Если a ^ 3 > b ^ 2 то
Если c * d = a / b то
Результат = a AND b
Иначе
Результат = с
Иначе
Результат = с * d + b
Ответ поместить в AX
Пишу в Tasm 1.4
Подскажите в чем проблема, в ассемблере нуб, но сделать надоКомментарии (109)
Follow us!