1. PHP / Говнокод #18702

    +3

    1. 1
    2. 2
    3. 3
    public function findByEventId($eventId) {
    	return $this->findByEventId($eventId);
    }

    Я просто оставлю это здесь...

    bit0rez, 10 Сентября 2015

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

    −98

    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
    Если (ПустаяСтрока(мВыбФайл) = 1)
    		Или (ФС.СуществуетФайл(мВыбФайл) = 0) Тогда
    	ТекстСообщения = "Внимание, не заполнен путь к файлу Excel с товарами для перемещения. Выполнение обработки прервано.";
    	Сообщить(ТекстСообщения);
    	СтатусВозврата(0);
    	Возврат;
    КонецЕсли;
    	
    Если ФС.СуществуетФайл(мВыбФайл) = 0 Тогда
    	ТекстСообщения = "Внимание, Excel файл с товарами для перемещения не существует. Выполнение обработки прервано.";
    	Сообщить(ТекстСообщения);
    	СтатусВозврата(0);
    	Возврат;
    КонецЕсли;
    	
    Если ПустаяСтрока(мВыбФайл)	= 1 Тогда
    	ТекстСообщения = "Не указан Excel файл для формирования таблицы товаров.";
    	СтатусВозврата(0);
    	Возврат;
    КонецЕсли;

    1С 7.7. Кусок из процедуры по загрузке данных из файла Excel.

    dsfix, 09 Сентября 2015

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

    +5

    1. 1
    2. 2
    3. 3
    img[src=""]{
    	display:none;
    }

    Super-genius

    tutov2013, 09 Сентября 2015

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

    +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
    case 'create': {
    								promisesCount.create++;
    								try {
    									var data = item.data;
    									data.status = 'new';
    
    									data.syncItemType = item.data.itemType;
    								} catch (e) {
    									console.log('create');
    									console.log(e);
    									console.log(e.stack);
    								}
    								return new vow.Promise(function(resolve, reject){
    									//resolve();
    									app.crud.create('items', data, req.user).then(function () {
    										resolve();
    									}, function (error) {
    										reject(error)
    									});
    								});
    							}
    							case 'update': {
    								promisesCount.update++;
    								try{
    									var data = item.actual;
    									data.citiesPrices = item.data.citiesPrices;
    									if (item.actual.type == 'brick') {
    										for(var key in data.citiesPrices) {
    											data.citiesPrices[key] = item.data.citiesPrices.brickAllRegion;
    										}
    									}
    									data.syncItemType = item.data.itemType;
    
    									if (item.actual.type && item.actual.status == 'site') {
    										if (item.actual.type == 'brick') {
    											if (!item.data.convertion || !item.data.convertion.piecesInPalette || !item.data.convertion.piecesPerMeter) {
    												/*console.log(item.actual.type, item.actual.subType, item.actual.axaptaItemId);
    												console.log(indexProducers[item.actual.producer].name, indexCollections[item.actual.collection].name);*/
    												wrongItems.push(item);
    												wrongItemsCount.brick++;
    											} else {
    												rightItemsCount.brick++;
    												data.countInPallet = item.data.convertion.piecesInPalette;
    												data.piecesPerMeter = item.data.convertion.piecesPerMeter;
    											}
    										} else {
    											if (item.data.measure && ['кв.м.', 'шт.'].indexOf(item.data.measure) != -1) {
    												switch(item.data.measure) {
    													case 'кв.м.': {
    														if (!item.data.convertion || !item.data.convertion.metersInPalette || !item.data.convertion.metersInBox || !item.data.convertion.metersInPiece) {
    															/*console.log(item.actual.type, item.actual.subType, item.actual.axaptaItemId);
    															console.log(indexProducers[item.actual.producer].name, indexCollections[item.actual.collection].name);*/
    															wrongItems.push(item);
    															wrongItemsCount.clinkerItems++;
    														} else {
    															rightItemsCount.clinkerItems++;
    															data.countInPallet = parseInt(item.data.convertion.metersInPalette / item.data.convertion.metersInBox);
    															data.countInPack = parseInt(item.data.convertion.metersInBox / item.data.convertion.metersInPiece);
    														}
    														break;
    													}
    													case 'шт.': {
    														if (!item.data.convertion || !item.data.convertion.piecesInBox) {
    															/*console.log(item.actual.type, item.actual.subType, item.actual.axaptaItemId);
    															console.log(indexProducers[item.actual.producer].name, indexCollections[item.actual.collection].name);*/
    															wrongItems.push(item);
    															wrongItemsCount.clinkerMeters++;
    														} else {
    															rightItemsCount.clinkerMeters++;
    															data.countInPack = item.data.convertion.piecesInBox;
    														}
    														break;
    													}
    												}
    											}
    										}
    									}
    								} catch(e) {
    									console.log('update');
    									console.log(e);
    									console.log(e.stack);
    								}

    Хороший, читабельный код от предыдущих разрабов

    jetcock, 09 Сентября 2015

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

    +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
    $tel = Number::clearPhone(trim($info['telephone']));
                $allowed_chars = '1234567890';
                if (!Number::clearPhone($tel)) {
                    $errors['error'] = "Введите телефонный номер";
                    $errors[] = 'telephone';
                }
                for ($i = 0; $i < mb_strlen($tel); $i++) {
                    if (mb_strpos($allowed_chars, mb_strtolower($tel[$i])) === false) {
                        $errors['error'] = "В номере должны быть только числа";
                        $errors[] = 'telephone';
                    }
                }

    ну вот можно же было просто как-то так написать:

    preg_match('^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}$', $tel)

    NotFake, 09 Сентября 2015

    Комментарии (0)
  6. JavaScript / Говнокод #18693

    +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
    var promise = new Promise(function (reject, resolve) {
    			$.ajax({
    				url: url,
    				method: method,
    				contentType: 'application/json',
    				headers: headers,
    				data: JSON.stringify(data),
    				success: function (response) {
    					resolve(response); 
    				},
    				error: function (error) {
    					reject(error);
    				}
    			});
    
    		});

    kon_simeonov, 08 Сентября 2015

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    var getVisualizerCount = function() {
        var count = 0;
        if (visualizerConfig && visualizerConfig.visualizers) {
            for (var i = 0; i < visualizerConfig.visualizers.length; i++) {
                count = count + 1;
            }
        }
        return count;
    };

    Достался проект от индусов. И такого коровьего д****а, хоть ж***й жуй. По мере нахождения запощу еще.

    uusb, 08 Сентября 2015

    Комментарии (14)
  8. Куча / Говнокод #18690

    +4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    header .phone .icons .vk {
            background: url(/images/design/vk.png) rgba(221, 221, 221, 0.22);
    }
    
    header .phone .icons .vk:hover {
    	background-color:rgba(221, 221, 221, 0);
    	display:none;
    }

    Если пользователь нашёл элемент, прячем его

    tutov2013, 08 Сентября 2015

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function blinker() {
        $('.js_blick').fadeOut(900);
        $('.js_blick').fadeIn(900);
    }
    
    setInterval(blinker, 1000); //Runs every second

    maderwin, 08 Сентября 2015

    Комментарии (0)
  10. Куча / Говнокод #18687

    +1

    1. 1
    [\s\S]+?

    3_14dar, 08 Сентября 2015

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