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

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

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $sql = "SELECT COUNT(`user_id`) FROM `link_empl_tf` WHERE `sched_date` >= " . $DB->
        F(substr($startDate, 6, 4) . "-" . substr($startDate, 3, 2) . "-" . substr($startDate,
                0, 2)) . " AND `sched_date` <= " . $DB->F(substr($endDate, 6, 4) . "-" . substr
            ($endDate, 3, 2) . "-" . substr($endDate, 0, 2)) . " AND `user_id`=" . $DB->F($uParam[0]) .
        ";";

    Date formatting by ©senior shaurma developer

    pahhan, 05 Мая 2016

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

    0

    1. 1
    var routers = new (R(views))();

    Чет по другому не придумал как в роутер view передать

    arny, 04 Мая 2016

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

    +3

    1. 1
    2. 2
    3. 3
    setTimeout(function() {
        $('#kostyl').click().click();
    }, 2000);

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

    deep, 26 Апреля 2016

    Комментарии (2)
  5. JavaScript / Говнокод #19839

    +3

    1. 1
    2. 2
    3. 3
    4. 4
    var pricerawjson = "%7B%22price%22%3A%226973.00%22%2C%22status%22%3A%22active%22%2C%22sell_status%22%3A%22available%22%2C%22old_price%22%3A%227607.0000%22%2C%22price_formatted%22%3A%226%20973%22%2C%22old_price_formatted%22%3A%227%20607%22%7D";
    if (pricerawjson.length == 0) {
          pricerawjson = '%7B%22price%22%3A%226973%22%2C%22price_formatted%22%3A%226%20973%22%2C%22old_price%22%3A7607%2C%22old_price_formatted%22%3A%227%20607%22%2C%22status%22%3A%22active%22%2C%22sell_status%22%3A%22available%22%7D';
    }

    kyzi007, 18 Апреля 2016

    Комментарии (2)
  6. Куча / Говнокод #19800

    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
    .container .additional-item{display: block;width:100%;}
    .container .additional-item thead{display: block;width:100%;}
    .container .additional-item thead tr td{font-weight: bold;}
    .container .additional-item tbody{display: block;width:100%;}
    .container .additional-item tr{display: block;width:100%;padding:10px 0px;}
    .container .additional-item tr td{display: inline-block;text-align: center;}
    .container .additional-item tr td:nth-child(1){width:3%;}
    .container .additional-item tr td:nth-child(2){width:3%;}
    .container .additional-item tr td:nth-child(3){width:3%;}
    .container .additional-item tr td:nth-child(4){width:15%;}
    .container .additional-item tr td:nth-child(5){width:5%;}
    .container .additional-item tr td:nth-child(6){width:5%;overflow: hidden;}
    .container .additional-item tr td:nth-child(7){width:20%;overflow: hidden;}
    .container .additional-item tr td:nth-child(8){width:3%;overflow: hidden;}
    .container .additional-item tr td:nth-child(9){width:3%;overflow: hidden;}
    .container .additional-item tr td:nth-child(10){width:5%;overflow: hidden;}
    
    .container .additional-item tbody tr td:nth-child(11){font-weight: bold;color:rgb(138, 43, 23);}
    .container .additional-item tr td:nth-child(11){width:10%;overflow: hidden;}
    .container .additional-item tr td:nth-child(12){width:7.5%;overflow: hidden;}
    .container .additional-item tr td:nth-child(12) input{width:50%;margin:auto;text-align: center;}
    .container .additional-item tr td:nth-child(13){width:12%;overflow: hidden;}
    .container .additional-item tr td:nth-child(13) a{display: block;width: 95%;margin-left: 5%;height: 30px;line-height: 15px;font-size: 100%;}

    lscin, 12 Апреля 2016

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

    +4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    $(document).ready(function() {
    		setInterval(form_check, 10);
    
    		function form_check() {
    			if ($("#main-order-form input[name='car-name']").attr("value") == "") {
    				$("#main-order-form button").attr('disabled', 'disabled');
    			} else {
    				$("#main-order-form button").removeAttr('disabled');
    			}						
    		}
    	});

    Валидация формы)))

    IKARUS, 08 Апреля 2016

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

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    try {
        $files->load($avatar);
        $this->fail('Fail message');
    } catch (\Exception $ex) {
        //All good
    }

    Это авто тест на метод $files->load
    $this->fail - здесь кидает исключение

    All good - и не важно какое исключение кинет $files->load, а если не кинет, то вызовем fail который наверняка кинет исключение

    Alex89, 07 Апреля 2016

    Комментарии (2)
  9. C# / Говнокод #19761

    +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
    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
    public struct TotalStat
    {
        public int Level { get; set; }
        public int Type { get; set; }
        public string Name { get; set; }
        public string Code { get; set; }
        public int VAL_01_1 { get; set; }
        public int VAL_01_2 { get; set; }
        public int VAL_01_3 { get; set; }
        public int VAL_01_4 { get; set; }
        public int VAL_51_1 { get; set; }
        public int VAL_51_2 { get; set; }
        public int VAL_51_3 { get; set; }
        public int VAL_51_4 { get; set; }
    
        public TotalStat[] Children;
    
    
        public FontWeight FontWeight
        {
            get
            {
                return Type == 2 ? FontWeights.Bold : FontWeights.Normal;
            }
        }
    
        public Thickness Margin
        {
            get
            {
                return new Thickness(this.Level * 10, 0, 0, 0);
            }
        }
    
        public string CNT_01
        {
            get
            {
                var v = VAL_01_1 + VAL_01_2 + VAL_01_3 + VAL_01_4;
                return v.ToString();
            }
        }
        public string CNT_51
        {
            get
            {
                var v = VAL_51_1 + VAL_51_2 + VAL_51_3 + VAL_51_4;
                return v.ToString();
            }
        }
        public string CNT_01_1
        {
            get
            {
                if (Type == 1) return "";
                if (VAL_01_1 == 0) return "-";
                return VAL_01_1.ToString();
            }
        }
        public string CNT_01_2
        {
            get
            {
                if (Type == 1) return "";
                if (VAL_01_2 == 0) return "-";
                return VAL_01_2.ToString();
            }
        }
        public string CNT_01_3
        {
            get
            {
                if (Type == 1) return "";
                if (VAL_01_3 == 0) return "-";
                return VAL_01_3.ToString();
            }
        }
    
    //В том же духе до CNT_51_4
    
        public static TotalStat operator +(TotalStat t, TotalStat c)
        {
            t.VAL_01_1 += c.VAL_01_1;
            t.VAL_01_2 += c.VAL_01_2;
            t.VAL_01_3 += c.VAL_01_3;
            t.VAL_01_4 += c.VAL_01_4;
            t.VAL_51_1 += c.VAL_51_1;
            t.VAL_51_2 += c.VAL_51_2;
            t.VAL_51_3 += c.VAL_51_3;
            t.VAL_51_4 += c.VAL_51_4;
            return t;
        }
    }

    На лабу похоже, да? А вот это не лаба. Сириозный праэкт для суровой организации (продолжение).

    kerman, 06 Апреля 2016

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

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public function extractPublicPlace($item)
    {
        list($a['name'], list($a['lat'], $a['lon'])) = $item;
        return $a;
    }

    просто оставлю

    akanit, 29 Марта 2016

    Комментарии (2)
  11. JavaScript / Говнокод #19699

    +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
    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
    applications_menu_container.find('a').click(function () {
        if ($(this).parent('.disabled').length === 0 || $(this).parent('.active').length === 0) {
            applications_menu_container.find('li').removeClass('active');
            $(this).parent().addClass('active');
    
            switch ($(this).attr('id')) {
                case 'active_applications':
                    applications_history_container.hide();
                    applications_history_pagination_toolbar.hide();
                    application_add_container.hide();
                    active_applications_sub_menu.hide();
                    change_application_sub_container.hide();
                    application_history_sub_container.hide();
                    application_files_sub_container.hide();
                    applications_history_sub_menu.hide();
                    historical_application_history_sub_container.hide();
                    historical_application_files_sub_container.hide();
                    load_active_applications(0, 10);
                    break;
                case 'applications_history':
                    active_applications_container.hide();
                    active_applications_bottom_toolbar.hide();
                    application_add_container.hide();
                    active_applications_sub_menu.hide();
                    change_application_sub_container.hide();
                    application_history_sub_container.hide();
                    application_files_sub_container.hide();
                    applications_history_sub_menu.hide();
                    historical_application_history_sub_container.hide();
                    historical_application_files_sub_container.hide();
                    load_applications_history(0, 10);
                    break;
                case 'new_application':
                default:
                    active_applications_container.hide();
                    active_applications_bottom_toolbar.hide();
                    applications_history_container.hide();
                    applications_history_pagination_toolbar.hide();
                    active_applications_sub_menu.hide();
                    change_application_sub_container.hide();
                    application_history_sub_container.hide();
                    application_files_sub_container.hide();
                    applications_history_sub_menu.hide();
                    historical_application_history_sub_container.hide();
                    historical_application_files_sub_container.hide();
                    show_add_application_form();
                    break;
            }
        }
    
        return false;
    });

    Переключение вкладок.

    Tesstarossa, 25 Марта 2016

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