- 1
- 2
CGSize size = [[CCDirector sharedDirector] winSize];
[[DeviceManager sharedManager] SetIpad:(size.height > 500)];
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−117
CGSize size = [[CCDirector sharedDirector] winSize];
[[DeviceManager sharedManager] SetIpad:(size.height > 500)];
Незнаете как определить iPad ли у вас?
А человек знает:
−89
columns = [col for col in self.load_column_data()['columns']]
Вот так мы копируем списки.
+161
wp_list_categories('orderby=order&hide_empty=0&title_li&echo=0&exclude=13,14,19,20,21,36,37,42,43,44,45,46,47,48,70,126,127,167,75,128,129,130,131,132,133,53,68,69,134,135,136,117,118,119,168,146,120,121,122,67,150,123,142,124,54,125,149,66,104,105,144,106,107,108,55,109,110,111,112,57,113,114,115,116,162,175,95,96,97,98,99,100,59,163,49,101,145,102,103,158,153,157,174,169,160,147,148,151,172,152,161,154,165,173,170,171,177,166,176,155,159,156,164,87,180,181,182,183,184,185,186,191,193,22,194,78,16,82,89,88,28,83,73,85,71,72,30,23,58,86,90,26,25,190,41,34,35,39,40,50,51,52,56,74,62,91,92,93,94,178,187,188,192,18,31,33,63,61,65,60,64,29,32,79,80,81');
Как вы заебали..
−90
def runRidor():
isDirty = 0
#Except (DebugSize <= 14) and (ImageVersion <= 760) and (VirtualSize2 > 992) and (ExportSize <= 80.5) => isDirty = 1 (1702.0/16.0) [855.0/5.0]
if input.DebugSize <= 14 and input.ImageVersion <= 760 and input.VirtualSize2 > 992 and input.ExportSize <= 80.5:
isDirty = 1
#Except (DebugSize <= 14) and (ImageVersion <= 4525) and (ExportSize <= 198.5) and (ResourceSize <= 37532) and (VirtualSize2 <= 6) and (ResourceSize <= 7348) and (ResourceSize > 1773) => isDirty = 1 (106.0/0.0) [48.0/0.0]
elif input.DebugSize <= 14 and input.ImageVersion <= 4525 and input.ExportSize <= 198.5 and input.ResourceSize <= 7348 and input.VirtualSize2 <=6 and input.ResourceSize > 1773:
isDirty = 1
#Except (DebugSize <= 14) and (ImageVersion <= 4950) and (ExportSize <= 192) and (IatRVA > 256) and (VirtualSize2 > 42) and (ExportSize <= 56) and (NumberOfSections > 3.5) => isDirty = 1 (193.0/0.0) [91.0/0.0]
elif input.DebugSize <= 14 and input.ImageVersion <= 4950 and input.ExportSize <= 56 and input.IatRVA > 256 and input.VirtualSize2 > 42 and input.NumberOfSections > 3.5:
isDirty = 1
#Except (DebugSize <= 14) and (ImageVersion <= 4950) and (VirtualSize2 <= 6) and (ResourceSize <= 37532) and (ResourceSize <= 17302) => isDirty = 1 (388.0/0.0) [216.0/7.0]
elif input.DebugSize <= 14 and input.ImageVersion <= 4950 and input.VirtualSize2 <= 6 and input.ResourceSize > 17302:
isDirty = 1
#Except (DebugSize <= 14) and (NumberOfSections > 2.5) and (ResourceSize > 1776) and (IatRVA <= 6144) and (ExportSize <= 219.5) and (VirtualSize2 > 2410) and (VirtualSize2 <= 61224) => isDirty = 1 (238.0/0.0) [116.0/0.0]
elif input.DebugSize <= 14 and input.NumberOfSections >= 2.5 and input.ResourceSize <= 1776 and input.IatRVA <= 6144 and input.ExportSize <= 219.5 and input.VirtualSize2 > 2410 and input.VirtualSize2 <= 61224:
isDirty = 1
Пример того, как не надо писать на питоне, показывает Adobe. Полная версия: http://voxel.dl.sourceforge.net/project/malclassifier.adobe/AdobeMalwareClassifier.py
+94
var
one, two, free, four:string;
begin
one:=sLabel14.Caption+slabel14.caption;
two:=sLabel1.Caption+slabel15.caption;
free:=sLabel10.Caption+slabel16.caption;
four:=sLabel7.Caption+slabel17.caption;
if ((one = two) or (one = free) or (one = four)
or (two = one) or (two = free) or (two = four)
or (free = one) or (free = two) or (free = four)
or (four = one) or (four = two) or (four = free))
then begin
showmessage('Значения должны быть различными');
end
else begin
showmessage('Успешно сохранено');
end;
Ну не лол?
+153
require_once('adodb/adodb.inc.php');
class adoDbConnector
{
private static $instance = null;
public static function getInstance()
{
if (self::$instance == NULL)
{
self::$instance = new adoDbConnector();
}
return self::$instance;
}
private function __construct() { }
public function __clone()
{
trigger_error('No __clone()!', E_USER_ERROR);
}
public function __wakeup()
{
trigger_error('No __wakeup()!', E_USER_ERROR);
}
public function connect($connectionType, $connectionData)
{
switch($connectionType)
{
case 0:
return self::generalConnect($connectionData);
break;
case 1:
return self::dsnConnect($connectionData);
break;
case 2:
return self::xmlConnect($connectionData);
break;
default:
throw new Exception('Wrong type of connection!');
}
}
private static function generalConnect($connectionData)
{
if(is_array($connectionData))
{
$conn = &ADONewConnection($connectionData[0]);
$conn->PConnect($connectionData[1], $connectionData[2],
$connectionData[3], $connectionData[4]);
return $conn;
}
else throw new Exception('Wrong type of connection data, must be an array!');
}
private static function dsnConnect($connectionData)
{
if(is_string($connectionData))
{
$conn = ADONewConnection($connectionData);
return $conn;
}
else throw new Exception('Wrong type of connection data, must be a string!');
}
private static function xmlConnect($connectionData)
{
if(is_string($connectionData) && file_exists($connectionData))
{
$xml = simplexml_load_file($connectionData);
foreach($xml as $x)
{
$connArr[] = trim($x);
}
$conn = &ADONewConnection($connArr[0]);
$conn->PConnect($connArr[1], $connArr[2], $connArr[3], $connArr[4]);
return $conn;
}
else throw new Exception('Wrong file name or connection type!');
}
}
+28
function _spb_similar_similar_video_html(&$item, $key) {
$item = htmlspecialchars($item, ENT_NOQUOTES);
}
+130
int i,j;
char alph[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//Подстановка по таблице 1
int S_there[26][8]={{1,0,0,1,1,0,0,1},{1,0,0,0,1,0,0,0},{1,0,1,0,1,0,1,0},{0,0,1,1,0,0,1,1},{1,1,1,0,0,0,0,1},
{1,0,0,0,0,1,1,1},{1,1,1,1,1,1,1,1},{1,1,0,1,0,0,1,0},{0,1,1,1,1,0,0,0},{1,1,0,0,0,0,1,1},{1,0,1,0,0,1,0,1},{0,1,0,0,1,0,1,1},
{0,0,0,1,1,1,1,0},{0,1,0,1,0,1,0,1},{1,1,0,0,1,1,0,0},{0,0,0,1,0,0,0,1},{1,1,0,1,1,1,0,1},{1,0,1,1,0,1,0,0},{0,0,1,0,1,1,0,1},
{0,0,0,0,0,0,0,0},{0,1,1,0,0,1,1,0},{0,1,0,0,0,1,0,0},{1,1,1,1,0,0,0,0},{0,0,1,1,1,1,0,0},{0,1,1,0,1,0,0,1},{0,0,1,0,0,0,1,0}};
char str[]="THIISATESTFILEFORCHECKINGCYPHERMODULE";
int len=strlen(str);
int num[len];//массив с порядковыми номерами
int vector[len][8];//массив с ОТ, переведённым в двоичные вектора длины 8
for (i=0; i< len; i++)//Присваиваем каждой букве порядковый номер (а=0,b=1 и т.д.)
{
num[i]=((strchr(alph, str[i])-alph)% 26 + 0x01);
num[i]--;
}
for (i=0; i<len; i++)//Меняем букву на двоичный вектор длины 8 согласно порядковому номеру
{
int number=num[i];//счётчик текста
for (j=0; j<8; j++)
{
vector[i][j]=S_there[number][j];
}
}
for (i=0; i<len; i++)//Вывод на экран ОТ
{
for (j=0; j<8; j++)
{
printf("%u",vector[i][j]);
}
printf(" %c\n",str[i]);
}
Нашёл в своей очень старой лабе...Нужно было буквы на входе преобразовать в двоичные вектора (например, а=10011001, b=10001000 и т.д.) ну и дальше ковыряться с этими векторами...почему я категорически не захотел тогда использовать case - хз :)))
+118
Params.Name = GetControl(pnlName) ? edName.Text : "";
Params.DateMeasurement = TOperation.GetDateValue(edDateTime);
Params.HalfYear = pnlHalfYear.Tag != null &&
pnlHalfYear.Tag is bool &&
(bool)pnlHalfYear.Tag &&
edHalfYear.SelectedItem != null &&
edHalfYear.SelectedItem.Value != null &&
edHalfYear.SelectedItem.Value is byte ? (byte)
edHalfYear.SelectedItem.Value : (byte)0;
Params.IdDepSource = GetControl(pnlDepSource) ? TDataList.GetComboRecId(edDepSource) : 0;
Params.IdDepSource2 = pnlDepSource2.Tag != null &&
pnlDepSource2.Tag is bool &&
(bool)pnlDepSource2.Tag ?
TDataList.GetComboRecId(edDepSource2) : 0;
Params.Salt = pnlDepSource2.Tag != null &&
pnlDepSource2.Tag is bool &&
(bool)pnlDepSource2.Tag ?
getSalt() : 0;
Params.Description = edComment.Text;
ацкий код сохранения параметров. Досталось в наследство. Автор кода естественно имеет в/о факультета компьютерных педиков.
+162
class Program implements ProgramProvider {
public static function getInstance() {
return new Program();
}
}
Гениальная реализация singleton!