- 1
mExpanded = onExpandClick ? !mExpanded : mExpanded;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1009
mExpanded = onExpandClick ? !mExpanded : mExpanded;
−147
спВидТорговли.ДобавитьЗначение(Перечисление.ВидыТорговли.Нал,Строка(Перечисление.ВидыТорговли.Нал));
Типовая торговля для Украины.
Подозреваю , ШО текст датируется концом 90-х.
+146
*((Point *)((Node *) result->data)->data) = *p;
Вот это Point *, которая в void * хранится, в списке, в котором другой список хранится, в доме, который построил Джек.
+77
public static <T> T createInstance(String className, Object ... ctorParams)
{
Class<T> type;
try {
type = (Class <T>) Class.forName(className);
}
catch (ClassNotFoundException e) { throw new RuntimeException(e); }
Class <?> [] paramTypes = new Class [ctorParams.length];
for(int i = 0; i < ctorParams.length; i ++)
paramTypes[i] = (Class <?>) ctorParams[i].getClass();
Constructor<T> ctor;
try {
ctor = type.getConstructor(paramTypes);
}
catch (SecurityException e) { throw new RuntimeException(e); }
catch (NoSuchMethodException e){ throw new RuntimeException(e); }
T instance;
try {
instance = ctor.newInstance(ctorParams);
}
catch (IllegalArgumentException e) { throw new RuntimeException(e); }
catch (InstantiationException e) { throw new RuntimeException(e); }
catch (IllegalAccessException e) { throw new RuntimeException(e); }
catch (InvocationTargetException e) { throw new RuntimeException(e); }
return instance;
}
Тут само Java вынуждает говнокодить. О святая простота!
+159
void AClass::registerApplication( int pCaller )
{
if ( mRegistry == NULL )
{
// we will be the first application in registry
mRegistry = createRegistryElement( pCaller );
}
else
{
// there are other applications already registered
// first create registry entry
Application *lApplication = NULL;
lApplication = createRegistryElement( pCaller );
// put entry in front
lApplication->mNext = mRegistry;
mRegistry = lApplication;
}
}
добавляем новый элемент в односвязный список. mRegister голова списка. кто не видит говна - идти читать матчасть.
+147
For i := 1 to Length(Val)-1 do
Begin
If (Ord(Val[i]) >= 48) and (Ord(Val[i]) <= 57) and
(not ((Ord(Val[i+1]) >= 48) and (Ord(Val[i+1]) <= 57))) then Result := true;
End;
ОТЦЕНИТИ КОД!!!1
+147
Мой скромный говнокод для любителей фильтрации и xss
При записи в базу
$msg = stripslashes(htmlspecialchars(trim($_POST['msg']))); // Очищаем от мусора
Вывод из базы
function post($text, $html=true, $nl2br = true, $smiles = true, $bbcode = true)
{
if ($html)
{
$text=html_entity_decode($text, ENT_QUOTES, 'UTF-8'); // в базе в htmllenties обратная перекодировка
}
if($smiles)
{
$text = smiles($text);
}
if($bbcode)
{
$text = bbcode($text);
}
if($nl2br)
{
$text = nl2br($text);
}
return $text;
}
Недавно нашел в своем скрипте блога )
+157
if($_POST["gaap_month"])
{
$d_f = mktime(0,0,0,1,1,$_POST['f_year']);
$w_start = intval(date("W", $d_f));
$w_day = (intval(date("w", $d_f)) == 0) ? 6 : intval(date("w", $d_f)) - 1;
$d_f = ($w_start == 1) ? $d_f - $w_day*24*60*60 : $d_f + (7-$w_day)*24*60*60;
$d_f += (4*($_POST['gaap_month']-1) + intval(($_POST['gaap_month']-1)/3)) * 7*24*60*60;
$d_t = ($_POST['gaap_month'] % 3 == 0) ? $d_f + 5*7*24*60*60 : $d_f + 4*7*24*60*60;
$_POST["df"] = date("d.m.Y", $d_f);
$_POST["dt"] = date("d.m.Y", $d_t);
}
$date_from = mktime(0,0,0,substr($_POST["df"],3,2),substr($_POST["df"],0,2),substr($_POST["df"],6,4));
$date_to = mktime(23,59,59,substr($_POST["dt"],3,2),substr($_POST["dt"],0,2),substr($_POST["dt"],6,4));
// if time period more than 20 days
if ($date_to-$date_from > 61*24*60*60)
$_POST["df"] = date("d.m.Y", $date_to - 61*24*60*60);
if ($_GET['office'] && ($USER->isAdmin() || in_array("15", $USER->GetUserGroupArray())))
$_POST['t_office'] = $_GET['office'];
вопрос - что употребляет автор ?
+66.4
int str_length(const char *str)
{
return (int)strlen(str);
}
Опенсорс, если чо.
−7
let x = 0.1;
let y = 0.2;
let z = x + y
чему равно?