- 1
jQuery(jQuery);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+168
jQuery(jQuery);
+168
preg_match('/(.*?)[.,!|]/',ltrim(preg_replace('/[\n\r]+/','|',strip_tags($item[$this->tooltip])),'|'),$regs);
жонглирование регулярками
+168
$mes_for_mail=str_replace("[code]","",$mes_for_mail);
$mes_for_mail=str_replace("[/code]","",$mes_for_mail);
$mes_for_mail=str_replace("[b]","",$mes_for_mail);
$mes_for_mail=str_replace("[/b]","",$mes_for_mail);
$mes_for_mail=str_replace("[i]","",$mes_for_mail);
$mes_for_mail=str_replace("[/i]","",$mes_for_mail);
$mes_for_mail=str_replace("[u]","",$mes_for_mail);
$mes_for_mail=str_replace("[/u]","",$mes_for_mail);
$mes_for_mail=str_replace("[s]","",$mes_for_mail);
$mes_for_mail=str_replace("[/s]","",$mes_for_mail);
$mes_for_mail=str_replace("[tt]","",$mes_for_mail);
$mes_for_mail=str_replace("[/tt]","",$mes_for_mail);
$mes_for_mail=str_replace("[sup]","",$mes_for_mail);
$mes_for_mail=str_replace("[/sup]","",$mes_for_mail);
$mes_for_mail=str_replace("[sub]","",$mes_for_mail);
$mes_for_mail=str_replace("[/sub]","",$mes_for_mail);
$mes_for_mail=str_replace("[code]","",$mes_for_mail);
$mes_for_mail=str_replace("[/code]","",$mes_for_mail);
$mes_for_mail=str_replace("[font color=FF0000]","",$mes_for_mail);
$mes_for_mail=str_replace("[font color=0000FF]","",$mes_for_mail);
$mes_for_mail=str_replace("[font color=008080]","",$mes_for_mail);
$mes_for_mail=str_replace("[/font]","",$mes_for_mail);
я плакол)
+168
case IDC_LED1_ZERO:
if (::IsDlgButtonChecked (hWnd,IDC_LED1_ZERO) )
{
if (::IsDlgButtonChecked (hWnd,IDC_LED2_ANYSPEED) ||
::IsDlgButtonChecked (hWnd,IDC_LED3_ANYSPEED) ||
::IsDlgButtonChecked (hWnd,IDC_LED4_ANYSPEED) )
::CheckDlgButton(hWnd,IDC_LED1_ANYSPEED,0);
if (::IsDlgButtonChecked (hWnd,IDC_LED2_POSITION) ||
::IsDlgButtonChecked (hWnd,IDC_LED3_POSITION) ||
::IsDlgButtonChecked (hWnd,IDC_LED4_POSITION) )
::CheckDlgButton(hWnd,IDC_LED1_POSITION,0);
if (::IsDlgButtonChecked (hWnd,IDC_LED2_DIGITAL_INPUT) ||
::IsDlgButtonChecked (hWnd,IDC_LED3_DIGITAL_INPUT) ||
::IsDlgButtonChecked (hWnd,IDC_LED4_DIGITAL_INPUT) )
::CheckDlgButton(hWnd,IDC_LED1_DIGITAL_INPUT,0);
::CheckDlgButton(hWnd,IDC_LED1_TURN_UNDER,0);
::CheckDlgButton(hWnd,IDC_LED2_ZERO,0);
::CheckDlgButton(hWnd,IDC_LED3_ZERO,0);
::CheckDlgButton(hWnd,IDC_LED4_ZERO,0);
}
break;
case IDC_LED1_ANYSPEED:
if (::IsDlgButtonChecked (hWnd,IDC_LED1_ANYSPEED) )
{
if (::IsDlgButtonChecked (hWnd,IDC_LED2_ZERO) ||
::IsDlgButtonChecked (hWnd,IDC_LED3_ZERO) ||
::IsDlgButtonChecked (hWnd,IDC_LED4_ZERO) )
::CheckDlgButton(hWnd,IDC_LED1_ZERO,0);
if (::IsDlgButtonChecked (hWnd,IDC_LED2_POSITION) ||
::IsDlgButtonChecked (hWnd,IDC_LED3_POSITION) ||
::IsDlgButtonChecked (hWnd,IDC_LED4_POSITION) )
::CheckDlgButton(hWnd,IDC_LED1_POSITION,0);
if (::IsDlgButtonChecked (hWnd,IDC_LED2_DIGITAL_INPUT) ||
::IsDlgButtonChecked (hWnd,IDC_LED3_DIGITAL_INPUT) ||
::IsDlgButtonChecked (hWnd,IDC_LED4_DIGITAL_INPUT) )
::CheckDlgButton(hWnd,IDC_LED1_DIGITAL_INPUT,0);
::CheckDlgButton(hWnd,IDC_LED1_TURN_UNDER,0);
::CheckDlgButton(hWnd,IDC_LED2_ANYSPEED,0);
::CheckDlgButton(hWnd,IDC_LED3_ANYSPEED,0);
::CheckDlgButton(hWnd,IDC_LED4_ANYSPEED,0);
}
break;
case IDC_LED1_POSITION:
if (::IsDlgButtonChecked (hWnd,IDC_LED1_POSITION) )
{
if (::IsDlgButtonChecked (hWnd,IDC_LED2_ZERO) ||
::IsDlgButtonChecked (hWnd,IDC_LED3_ZERO) ||
::IsDlgButtonChecked (hWnd,IDC_LED4_ZERO) )
::CheckDlgButton(hWnd,IDC_LED1_ZERO,0);
if (::IsDlgButtonChecked (hWnd,IDC_LED2_ANYSPEED) ||
::IsDlgButtonChecked (hWnd,IDC_LED3_ANYSPEED) ||
::IsDlgButtonChecked (hWnd,IDC_LED4_ANYSPEED) )
::CheckDlgButton(hWnd,IDC_LED1_ANYSPEED,0);
if (::IsDlgButtonChecked (hWnd,IDC_LED2_DIGITAL_INPUT) ||
::IsDlgButtonChecked (hWnd,IDC_LED3_DIGITAL_INPUT) ||
::IsDlgButtonChecked (hWnd,IDC_LED4_DIGITAL_INPUT) )
::CheckDlgButton(hWnd,IDC_LED1_DIGITAL_INPUT,0);
::CheckDlgButton(hWnd,IDC_LED1_TURN_UNDER,0);
::CheckDlgButton(hWnd,IDC_LED2_POSITION,0);
::CheckDlgButton(hWnd,IDC_LED3_POSITION,0);
::CheckDlgButton(hWnd,IDC_LED4_POSITION,0);
}
break;
case IDC_LED1_TURN_UNDER:
if (::IsDlgButtonChecked (hWnd,IDC_LED1_TURN_UNDER) )
{
if (::IsDlgButtonChecked (hWnd,IDC_LED2_ZERO) ||
::IsDlgButtonChecked (hWnd,IDC_LED3_ZERO) ||
::IsDlgButtonChecked (hWnd,IDC_LED4_ZERO) )
::CheckDlgButton(hWnd,IDC_LED1_ZERO,0);
if (::IsDlgButtonChecked (hWnd,IDC_LED2_ANYSPEED) ||
::IsDlgButtonChecked (hWnd,IDC_LED3_ANYSPEED) ||
::IsDlgButtonChecked (hWnd,IDC_LED4_ANYSPEED) )
::CheckDlgButton(hWnd,IDC_LED1_ANYSPEED,0);
if (::IsDlgButtonChecked (hWnd,IDC_LED2_DIGITAL_INPUT) ||
::IsDlgButtonChecked (hWnd,IDC_LED3_DIGITAL_INPUT) ||
::IsDlgButtonChecked (hWnd,IDC_LED4_DIGITAL_INPUT) )
::CheckDlgButton(hWnd,IDC_LED1_DIGITAL_INPUT,0);
::CheckDlgButton(hWnd,IDC_LED1_POSITION,0);
::CheckDlgButton(hWnd,IDC_LED2_TURN_UNDER,0);
::CheckDlgButton(hWnd,IDC_LED3_TURN_UNDER,0);
::CheckDlgButton(hWnd,IDC_LED4_TURN_UNDER,0);
}
Понадобилось добавить ещё один чек бокс. Зашёл в обработчик - а там такое. И это только начало, всё не поместилось. Чтобы представить масштабы скажу, что чекбоксов 16..., я должен добавить ещё 4.
+168
$_SESSION['lang_code'] = isset($_GET['lang_code']) ? file_exists("languages/lang_".$_GET['lang_code'].".php") ? $_GET['lang_code'] : isset($_SESSION['lang_code']) ? $_SESSION['lang_code'] : 'ru' : 'ru';
+168
http://www.shkodenko.kiev.ua/index.php?lang_id=1&content_id=82
я охуел
+168
QTime time;
QString name = (time.currentTime()).toString();
for (int i = 2; i <= 5; i = i+3)
{
name.remove(i,1);
name.insert(i,".");
}
вот так вот, ребятишки.
+168
void __fastcall TForm1::ShowBits(unsigned char data)
{
if(data&0x1)ImBit0->Canvas->Brush->Color=0x0000FF00;
else ImBit0->Canvas->Brush->Color=clRed;
ImBit0->Canvas->FillRect(TRect(0,0,ImBit0->Width,ImBit0->Height));
if(data&0x2)ImBit1->Canvas->Brush->Color=0x0000FF00;
else ImBit1->Canvas->Brush->Color=clRed;
ImBit1->Canvas->FillRect(TRect(0,0,ImBit1->Width,ImBit1->Height));
if(data&0x4)ImBit2->Canvas->Brush->Color=0x0000FF00;
else ImBit2->Canvas->Brush->Color=clRed;
ImBit2->Canvas->FillRect(TRect(0,0,ImBit2->Width,ImBit2->Height));
if(data&0x8)ImBit3->Canvas->Brush->Color=0x0000FF00;
else ImBit3->Canvas->Brush->Color=clRed;
ImBit3->Canvas->FillRect(TRect(0,0,ImBit3->Width,ImBit3->Height));
if(data&0x10)ImBit4->Canvas->Brush->Color=0x0000FF00;
else ImBit4->Canvas->Brush->Color=clRed;
ImBit4->Canvas->FillRect(TRect(0,0,ImBit4->Width,ImBit4->Height));
if(data&0x20)ImBit5->Canvas->Brush->Color=0x0000FF00;
else ImBit5->Canvas->Brush->Color=clRed;
ImBit5->Canvas->FillRect(TRect(0,0,ImBit5->Width,ImBit5->Height));
if(data&0x40)ImBit6->Canvas->Brush->Color=0x0000FF00;
else ImBit6->Canvas->Brush->Color=clRed;
ImBit6->Canvas->FillRect(TRect(0,0,ImBit6->Width,ImBit6->Height));
if(data&0x80)ImBit7->Canvas->Brush->Color=0x0000FF00;
else ImBit7->Canvas->Brush->Color=clRed;
ImBit7->Canvas->FillRect(TRect(0,0,ImBit7->Width,ImBit7->Height));
}
Отображение состояния битов байта
+168
if (!is_array($arFilter))
$filter_keys = Array();
else
$filter_keys = array_keys($arFilter);
for ($i=0; $i<count($filter_keys); $i++)
{
$key = strtoupper($filter_keys[$i]);
$val = $arFilter[$filter_keys[$i]];
// ....
}
по всей видимости, в битриксе программистам выдают тяжелые наркотики при входе.. до такой реализации foreach я бы никогда не додумался!
+168
<?php
/*
localhost Ltd - ALPHA CMS
Version: 8.0
File name: features_portability.php
Description: This file contains the FEATURES PORT MODEL class.
Coded by George Delaportas (G0D)
localhost Ltd
Copyright (c) 2011
*/
// FEATURES PORT MODEL class
class FEATURES_PORT_MODEL extends ROOT_MODEL
{
}
/* ---------- End ---------- */
?>
ALPHA CMS. Таких вот пустых классов ВРОТКОМПОТ_MODEL сорок шесть штук. Форматирование сохранено.