- 1
- 2
- 3
function isEmptyStr(val) {
return val == null || val === "";
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+154
function isEmptyStr(val) {
return val == null || val === "";
}
+154
function reNumberAreas(parent)
{
for (i=0;i<parent.childNodes.length;i++)
{
try
{
parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.id = cutNumber(parent.childNodes[0].firstChild.firstChild.firstChild.firstChild.id) + i;
parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.id = parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.id + "_text";
parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.src = parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.src.replace(/index=\d+/g,"index=" + i);
}
catch (e)
{
}
}
}
Форматирование кода сохранено для придания драматичности.
+154
checkParent: function () {
var p = this.el.parent().length > 0 ? this.el.parent()[0] : this.el.parent(),
tp = this.parent && this.parent.length > 0 ? this.parent[0] : this.parent;
return p !== tp;
}
wtf?
+154
this.ie = (name=="ie" && this.v>=4)
this.activeX = ( this.ie ) ? true : false;
Кусочек шедевра
https://github.com/miketaylr/Snort/blob/master/snort.yml
+154
$fld_insurance_estimate_sales = $proformadetail[0]['fld_insurance_estimate_sales'];
$fld_insurance_estimate_cost = $proformadetail[0]['fld_insurance_estimate_cost'];
$fld_oceanfright_sales = $proformadetail[0]['fld_oceanfright_sales'];
$fld_oceanfright_cost = $proformadetail[0]['fld_oceanfright_cost'];
$fld_adjustment_oceanfright_sales = $proformadetail[0]['fld_adjustment_oceanfright_sales'];
$fld_adjustment_oceanfright_cost = $proformadetail[0]['fld_adjustment_oceanfright_cost'];
Не, ну extract($proformadetail[0]) просто никак нельзя сделать :)
+154
escape = function(string) {
return (''+string).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/');
};
Ваше мнение?
+154
$explodeSize = explode( '-', str_replace( "\x20", '', trim( $sizes[0] ) ) );
Не, ну надо было додуматься еще и str_replace туда запихать)
+154
#include "stdafx.h"
#include "expression.h"
#include <vector>
int _tmain(int argc, _TCHAR* argv[]) {
//Инициализация
std::vector<expression> arrayOfExpressions;
std::string inputString;
//Ввод количества выражений
printf( "Enter expressions count: " );
int countOfExpressions = 0;
scanf( "%d", &countOfExpressions );
//Ввод самих выражений
for ( int i = 1; i <= countOfExpressions; i++ ) {
printf( "Enter expression: " );
scanf( "%s", inputString );
arrayOfExpressions.push_back( expression( inputString ) );
}
//Подсчёт операторов
int total = 0;
for (int i = 0; i < arrayOfExpressions.size(); i++)
total += arrayOfExpressions.at(i).operatorsCount();
printf( "Total operators = %d", total );
//Освобождение памяти
arrayOfExpressions.erase(arrayOfExpressions.begin(),arrayOfExpressions.end());
return 0;
}
Один из уже известных вам студентов написал вот это. Вроде получше.
+154
#include <iostream>
#include <stdio.h>
void foo(const long) { std::cout << "long" << std::endl; }
template<typename _type_>
void omg()
{
short i = 0;
foo(i);
}
void foo(const short) { std::cout << "short" << std::endl; }
int main(int, char*[])
{
omg<int>();
getchar();
return 0;
}
код для гцц -> http://ideone.com/mifTV
вопрос, что выдаст говностудия?
связанно с тем, что говностудия не ищет независимые типы использованные в шаблоне на этапе определения. она их ищет только в точке конкретизации шаблона. гцц связывает независимые типы в шаблоне на этапе определения шаблона
З.Ы. ответ на http://govnokod.ru/9885#comment134160
+154
if (!empty($params[$fieldName.'_need_group']) ? true : false) $errors[$fieldName] = 2;
Просто очень тщательная проверка, если true то true, а если false то false....