1. JavaScript / Говнокод #24072

    +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
    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
    return query instanceof RegExp ?
        (function () {
    	fn.each(function (id) {
    	    if (id.match(query)) {
    		seatSet.push(id, this);
    	    }
    	});
    	return seatSet;
        })() :
        (query.length == 1 ?
    	(function (character) {
    	    //user searches just for a particual character
    	    fn.each(function () {
    		if (this.char() == character) {
    		      seatSet.push(this.settings.id, this);
    		}
    	    });
                return seatSet;
    	})(query) :
                (function () {
                    //user runs a more sophisticated query, so let's see if there's a dot
    		    return query.indexOf('.') > -1 ?
    		        (function () {
    		             //there's a dot which separates character and the status
    		                 var parts = query.split('.');
    		
    		                 fn.each(function (seatId) {
    		                     if (this.char() == parts[0] && this.status() == parts[1]) {
    		                         seatSet.push(this.settings.id, this);
    		                     }
    		                 });
    		
    		                 return seatSet;
    		         })() :
    		             (function () {
    		                 fn.each(function () {
    		                     if (this.status() == query) {
    		                         seatSet.push(this.settings.id, this);
    		                     }
    		                 });
    		                return seatSet;
    		         })();
    		     })()
    		 );

    https://github.com/mateuszmarkowski/jQuery-Seat-Charts -- отсюда, заставила нелегкая использовать на одном мелком проекте. в пост запилил самый блистательный и ароматный кусок

    bakahakka, 04 Апреля 2018

    Комментарии (1)
  2. Swift / Говнокод #24071

    0

    1. 1
    2. 2
    3. 3
    4. 4
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
            let count = self.gameResults == nil ? 0 : self.gameResults?.count
            return count!
        }

    nil-coalescing operator? Не не слашали.

    astmus, 04 Апреля 2018

    Комментарии (20)
  3. Swift / Говнокод #24070

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if gameResults != nil && (gameResults?.count)! > 0 {
                
                for gameResult in self.gameResults! {
                    let newLine = "\(gameResult.gameSession!.gameTable!.tableNumber!) / \(gameResult.sessionHand!.endTime!) / \(Utils.getShortGameName(gameName: gameResult.gameSession!.game!.name!)),\(String(describing:gameResult.sessionHandResult!.score!.doubleValue)),\(String(describing:gameResult.sessionHandResult!.profitSum!.doubleValue)),\(String(describing:gameResult.sessionHandResult!.credits!.doubleValue))\n"
                    csvText.append(newLine)
                }
            }

    Как говорится береженого бог бережет... даже если опционал не ниловый

    astmus, 04 Апреля 2018

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

    0

    1. 1
    2. 2
    3. 3
    while($us > 1){
        $us--;
    }

    На одном из сайтов, который мне нужно потдерживать.

    Prorok, 04 Апреля 2018

    Комментарии (6)
  5. Lua / Говнокод #24068

    +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
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    return{
    	[1] = 100500,
    	[2] = 10,
    	x = {
    	[1] = "ss"
    ,
    	[2] = {
    	[1] = {
    	[1] = {
    	[1] = {
    	[1] = {
    }
    ,
    }
    ,
    }
    ,
    }
    ,
    }
    ,
    }
    ,
    }

    Орфография сохранена, это моя старая сериализация. Ничего особенного, но когда сериализуем огромное количество таблиц с 100550 вложений, то внешний вид превращается хлеще брайнфака

    u3yMpyDHblu_xyu, 04 Апреля 2018

    Комментарии (12)
  6. Swift / Говнокод #24066

    0

    1. 1
    2. 2
    3. 3
    if let viewControllers = self.navigationController?.viewControllers {
        self.navigationController?.popToViewController(viewControllers[viewControllers.count - 3], animated: true)
    }

    Попытка вернуться на рут контроллер.

    torip3ng, 03 Апреля 2018

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

    −3

    1. 1
    ЗАЛУПОНЯЛЫ

    PaulDenisevich, 03 Апреля 2018

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    $sPreviewFile = $_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/tmp/templates/__bx_preview/footer.php";
    if($_GET['bx_template_preview_mode'] == 'Y' && $USER->CanDoOperation('edit_other_settings') && file_exists($sPreviewFile))
    	include_once($sPreviewFile);
    else {
            require $GLOBALS["BX_ICON"];
    	eval("?>$content<?");
    }
    ?>

    Где-то в битриксе.

    Prorok, 03 Апреля 2018

    Комментарии (6)
  9. Pascal / Говнокод #24061

    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
    unit Unit1;
    interface
    uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, jpeg, ExtCtrls, ComCtrls;
    
    type
    TForm1 = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    ...
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    GroupBox2: TGroupBox;
    RadioButton5: TRadioButton;
    RadioButton6: TRadioButton;
    RadioButton7: TRadioButton;
    RadioButton8: TRadioButton;
    GroupBox3: TGroupBox;
    RadioButton9: TRadioButton;
    RadioButton10: TRadioButton;
    ...
    GroupBox14: TGroupBox;
    RadioButton52: TRadioButton;
    RadioButton53: TRadioButton;
    RadioButton54: TRadioButton;
    RadioButton55: TRadioButton;
    GroupBox15: TGroupBox;
    RadioButton56: TRadioButton;
    RadioButton57: TRadioButton;
    RadioButton58: TRadioButton;
    RadioButton59: TRadioButton;
    
    ... 
    end;
    
    var 
    Form1: TForm1;
    
    implementation 
    
    {$R *.dfm}
    
    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
    form1.Close;
    end;
    procedure TForm1.Button2Click(Sender: TObject);
    var s: integer;
    begin
    Button3.enabled:=true;
    
    s:=0;
    if Form1.RadioButton2.Checked then s:=s+1;
    if Form1.RadioButton6.Checked then s:=s+1;
    if Form1.RadioButton20.Checked then s:=s+1;
    if Form1.RadioButton15.Checked then s:=s+1;
    if Form1.RadioButton11.Checked then s:=s+1;
    if Form1.RadioButton21.Checked then s:=s+1;
    if Form1.RadioButton24.Checked then s:=s+1;
    if Form1.RadioButton28.Checked then s:=s+1;
    if Form1.RadioButton33.Checked then s:=s+1;
    if Form1.RadioButton39.Checked then s:=s+1;
    if Form1.RadioButton43.Checked then s:=s+1;
    if Form1.RadioButton44.Checked then s:=s+1;
    if Form1.RadioButton50.Checked then s:=s+1;
    if Form1.RadioButton54.Checked then s:=s+1;
    if Form1.RadioButton56.Checked then s:=s+1;
    
    if s=15 then Label3.Caption:=' Молодец, ты ответил на все вопросы!(Твоя оценка 5)';
    if s=14 then Label3.Caption:=' Молодец, ты ответил на четырнадцать вопросов!(Твоя оценка 5)';
    if s=13 then Label3.Caption:=' Молодец, ты ответил на 13 вопросов!(Твоя оценка 5)';
    if s=12 then Label3.Caption:=' Хорошо, ты ответил на 12!(Твоя оценка 4)';
    if s=11 then Label3.Caption:=' Ты ответил на все 11!(Твоя оценка 4)';
    if s=10 then Label3.Caption:='10 парвильных ответов молодец!(Твоя оценка 4)";
    if s=9 then Label3.Caption:='9 ПРАВИЛЬНЫХ ОТВЕТОВ!(Твоя оценка 3)';
    if s=8 then Label3.Caption:='Отлично! Ты ответил на 8 вопрос(Твоя оценка 3)';
    if s=7 then Label3.Caption:='Молодец! Ты ответил на 7 вопрос(Твоя оценка 3)';
    if s=6 then Label3.Caption:='6 Вопросов? Ты не плох!(Твоя оценка 3)';
    if s=5 then Label3.Caption:='5 правильных вопросов! ура!(Твоя оценка 2)';
    if s=4 then Label3.Caption:='Учи предмет лучше! Всего 4 правильных вопроса!(Твоя оценка 2)';
    if s=3 then Label3.Caption:=' Слабо! Всего 3 правильных ответа!(Твоя оценка 2)';
    if s=2 then label3.Caption:=' Всего 2 правильных ответа!( Твоя оценка 2)';
    if s=1 then label3.Caption:=' Тебе не быть программистом! Всего 1 правильный ответ!(Твоя оценка 2)';
    if s=0 then label3.Caption:=' Давай заново!(Твоя оценка 2)';
    
    end;

    Автор пытается сделать тест по информатике. Вроде бы для диплома.

    Alex11223, 03 Апреля 2018

    Комментарии (10)
  10. Pascal / Говнокод #24060

    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
    procedure ustbet;
    begin
    if (200*GCtrl.CurLines>coins.realBalance) then  begin
    if (150*GCtrl.CurLines>coins.realBalance) then  begin
    if (100*GCtrl.CurLines>coins.realBalance) then  begin
    if (50*GCtrl.CurLines>coins.realBalance) then  begin
        if (40*GCtrl.CurLines>coins.realBalance) then  begin
           if (30*GCtrl.CurLines>coins.realBalance) then  begin
             if (20*GCtrl.CurLines>coins.realBalance) then  begin
               if (15*GCtrl.CurLines>coins.realBalance) then  begin
                 if (10*GCtrl.CurLines>coins.realBalance) then  begin
                  if (5*GCtrl.CurLines>coins.realBalance) then  begin
                     if (4*GCtrl.CurLines>coins.realBalance) then  begin
                       if (3*GCtrl.CurLines>coins.realBalance) then  begin
                         if (2*GCtrl.CurLines>coins.realBalance) then  begin
                           if (1*GCtrl.CurLines>coins.realBalance) then  begin
     end else Coins.CurBet:=1
     end else Coins.CurBet:=2;
     end else Coins.CurBet:=3;
     end else Coins.CurBet:=4;
     end else Coins.CurBet:=5;
     end else Coins.CurBet:=10;
     end else Coins.CurBet:=15;
     end else Coins.CurBet:=20;
     end else Coins.CurBet:=30;
     end else Coins.CurBet:=40;
     end else Coins.CurBet:=50;
     end else Coins.CurBet:=100;
     end else Coins.CurBet:=150;
     end else Coins.CurBet:=200;
     coins.AllBet:=Coins.CurBet*gctrl.curlines;
    end;

    Предположительно, установка текущей ставки в слотовой игре. Но это ещё далеко не самый трэш в этом говнопроекте.

    SadButTrue, 03 Апреля 2018

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