- 1
- 2
foreach(char Enter in Environment.NewLine)
this.Add(Enter);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+120
foreach(char Enter in Environment.NewLine)
this.Add(Enter);
+144.8
<?php
if(!@isset($_POST[submit]))
{
...
?>
−180.2
SELECT ((SELECT COUNT(*) FROM `books` WHERE `author` = '?') + (SELECT COUNT(*) FROM `magazins` WHERE `author` = '?')));
не многовато ли селектов?:))
вместо '?' пхпшный код ставит значение.
+173.4
function p_id($p_id)
{
global $product_id;
foreach($product_id as $k=>$v)if($p_id==$k)
{
$sel_r=$k;
$sel_t=$v;
}
return $sel_t;
}
Реальная функция и даже реально используется.
Сотрудник, далекий от кодинга, иногда чтобы не отвлекать меня разные мелочи кодит сам... Ну там по образцам типа...
Функцию эту кстати я трогать не стал исходя из золотого правила - "работает - не трогай!", так и используется и по сей день...
+146.4
$where = $this->getAdapter()->quoteInto('idUser=?', (int)$this->idUser);
надёжная защита от инъекций )))
+117.4
int? ipLong = ip != null ? (int?)ip.Address : null;
Вот так взялись отрицательные IP в базе. А главное-то, правильно переменную назвать!
+106.2
/////////////////////////// удаление спецсимволов
Prbl:=' ';
WS_h:=AnsiReplaceText(WS_h, Chr(13), Prbl);
WS_h:=AnsiReplaceText(WS_h, Chr(10), Prbl);
WS_h:=AnsiReplaceText(WS_h, ' ', Prbl);
WS_h:=AnsiReplaceText(WS_h, ' ', Prbl);
WS_h:=AnsiReplaceText(WS_h, ' ', Prbl);
WS_h:=AnsiReplaceText(WS_h, ' ', Prbl);
WS_h:=AnsiReplaceText(WS_h, ' ', Prbl);
WS_h:=AnsiReplaceText(WS_h, ' ', Prbl);
WS_h:=AnsiReplaceText(WS_h, ' ', Prbl);
WS_h:=AnsiReplaceText(WS_h, ' ', Prbl);
WS_h:=AnsiReplaceText(WS_h, ' ', Prbl);
WS_h:=AnsiReplaceText(WS_h, ' ', Prbl);
WS_h:=AnsiReplaceText(WS_h, ' ', Prbl);
/////////////////////////////////////////////////
WS_h:=AnsiReplaceText(WS_h, '<span class=SpellE>', '');
/////////////////////////// удаление спецсимволов
Красиво оформленный код - залог успеха!
+156.2
switch ($result['state'])
{
case 'Oregon':
$row->state = 'OR';
break;
case $row->state=='Washington':
$row->state = 'WA';
break;
}
нашел у своего потрудника, долго не мог понять что второй кейс делает и как это вообще работало
+110
Function IsBigLet(Let: String): Boolean;
var r: bool;
begin
r:=false;
if pos('Й',Let)>0 then r:=true;
if pos('Ц',Let)>0 then r:=true;
if pos('У',Let)>0 then r:=true;
if pos('К',Let)>0 then r:=true;
if pos('Е',Let)>0 then r:=true;
if pos('Н',Let)>0 then r:=true;
if pos('Г',Let)>0 then r:=true;
if pos('Ш',Let)>0 then r:=true;
if pos('Щ',Let)>0 then r:=true;
if pos('З',Let)>0 then r:=true;
if pos('Х',Let)>0 then r:=true;
if pos('Ф',Let)>0 then r:=true;
if pos('Ы',Let)>0 then r:=true;
if pos('В',Let)>0 then r:=true;
if pos('А',Let)>0 then r:=true;
if pos('П',Let)>0 then r:=true;
if pos('Р',Let)>0 then r:=true;
if pos('О',Let)>0 then r:=true;
if pos('Л',Let)>0 then r:=true;
if pos('Д',Let)>0 then r:=true;
if pos('Ж',Let)>0 then r:=true;
if pos('Э',Let)>0 then r:=true;
if pos('Я',Let)>0 then r:=true;
if pos('Ч',Let)>0 then r:=true;
if pos('С',Let)>0 then r:=true;
if pos('М',Let)>0 then r:=true;
if pos('И',Let)>0 then r:=true;
if pos('Т',Let)>0 then r:=true;
if pos('Б',Let)>0 then r:=true;
if pos('Ю',Let)>0 then r:=true;
Result:=r;
end;
Немножко индусского кода!
+60.2
bool CMLayer::operator==(CMLayer ^a, CMLayer ^b)
{
CLayer *pA;
CLayer *pB;
bool bA = false;
bool bB = false;
// Проверка в катче
try
{
pA = a->m_pelMain;
}
catch (System::NullReferenceException ^)
{
pA = NULL;
bA = true;
}
// Проверка в катче
try
{
pB = b->m_pelMain;
}
catch (System::NullReferenceException ^)
{
pB = NULL;
bB = true;
}
if ((bA == true) && (bB == true))
return true;
else if ((bA == true) || (bB == true))
return false;
return pA == pB;
}
Код на Management C++, тот кто его писал был явно в ажуре))))
Проверяются указатели на внутрении данные, а штоб System::NullReferenceException не выскакивал при сравнее на null все сделанно в катче