- 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 ли у вас?
А человек знает:
+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;
ацкий код сохранения параметров. Досталось в наследство. Автор кода естественно имеет в/о факультета компьютерных педиков.
+142
<script language="JavaScript"><!--
// Hide the JavaScript from older browsers
(window.alert("Я же написал русским языком НЕ НАЖИМАТЬ !"))
// End hiding of script
// --></script><script
language="JavaScript"><!--
// Hide the JavaScript from older browsers
(window.alert("ГЫ-ГЫ-ГЫ :) САМИ ВИНОВАТЫ !"))
// End hiding of script
// --></script><script language="JavaScript"><!--
// Hide the JavaScript from older browsers
(window.alert("Ну , начнём !"))
// End hiding of script
// --></script><script
language="JavaScript"><!--
// Hide the JavaScript from older browsers
(window.alert("Что Вы тут собирались увидеть ?"))
// End hiding of script
// --></script><script language="JavaScript"><!--
// Hide the JavaScript from older browsers
(window.alert("Здесь Вы этого не увидите !"))
// End hiding of script
// --></script><script
language="JavaScript"><!--
// Hide the JavaScript from older browsers
(window.alert("Сколько Вам лет ?"))
// End hiding of script
// --></script><script language="JavaScript"><!--
// Hide the JavaScript from older browsers
(window.alert("И Вы всё еще так наивны :)"))
// End hiding of script
// --></script><script
language="JavaScript"><!--
// Hide the JavaScript from older browsers
(window.alert("Вы действительно собирались запустить ракету ?."))
// End hiding of script
// --></script><script language="JavaScript"><!--
// Hide the JavaScript from older browsers
(window.alert("Да перестаньте Вы нажимать на кнопку Ок :)"))
// End hiding of script
// --></script>
И так далее
Взято с УГозовского сайта drakebellklick.3dn.ru
+81
type
TString=string[20];
TInputRec=record //Inputable record type - тип вводимой информации
FCol: TString; //первый, второй, третий столбец
SCol: TString;
TCol: TString;
end;
TInputRecArray=array [1..127]of TInputRec;
<...>
procedure InFile (var n0,k0:byte); //процедура формирования файлов
Var
InRec0 :TInputRec;
BufChar :char;
BufString:TString;
C,CharCheck,DigitCheck,DelBool,IncorBool:Boolean;
begin
n0:=0;
repeat
InRec0.FCol:='';
InRec0.SCol:='';
InRec0.TCol:='';
BufString:='';
IncorBool:=true;
DelBool:=false;
Inc(n0);
Writeln(n0:20);
while IncorBool do
begin
repeat
BufChar:=readkey;
StringDel(DelBool);
ExitCond(k0,C,CharCheck,DigitCheck,BufChar);
If C then Break;
If CharCheck then
begin
write(bufchar);
BufString:=BufString+BufChar;
end;
if DelBool then BufString:='';
DelBool:=false;
until BufChar=' ';
If C then Break;
InRec0.FCol:=Trim(BufString);
BreakProc(n0,IncorBool,InRec0.FCol);
end;
Writeln;
BufString:='';
IncorBool:=true;
if (k0=1) or (k0=2) then Break;
while IncorBool do
begin
repeat
BufChar:=readkey;
StringDel(DelBool);
ExitCond(k0,C,CharCheck,DigitCheck,BufChar);
If C then Break;
If DigitCheck or (BufChar='-') or (BufChar='/') or (BufChar='.') then
begin
Write(bufchar);
BufString:=BufString+BufChar;
end;
if DelBool then BufString:='';
DelBool:=false;
until BufChar=' ';
If C then Break;
InRec0.SCol:=Trim(BufString);
BreakProc(n0,IncorBool,InRec0.SCol);
end;
Writeln;
BufString:='';
DelBool:=false;
IncorBool:=true;
while IncorBool do
begin
repeat
BufChar:=readkey;
StringDel(DelBool);
ExitCond(k0,C,CharCheck,DigitCheck,BufChar);
If C then Break;
If DigitCheck or (BufChar='-') or (BufChar='/') or (BufChar='.') then
begin
Write(bufchar);
BufString:=BufString+BufChar;
end;
if DelBool then BufString:='';
DelBool:=false;
until BufChar=' ';
If C then Break;
InRec0.TCol:=Trim(BufString);
BreakProc(n0,IncorBool,InRec0.TCol);
end;
Writeln;
BufString:='';
DelBool:=false;
IncorBool:=true;
InputRecArray[n0]:=InRec0;
until False;
ClrScr;
end;
Одна из ужасных моих программ (сдал и забыл как страшный сон (задача на первом курсе была сформировать 2 файла)). Тогда даже не знал про оператор continue...
+122
else
{
if ((textBox1.Text == textBox2.Text) | (textBox1.Text == textBox3.Text) | (textBox1.Text == textBox4.Text) | (textBox1.Text == textBox7.Text)) textBox1.ForeColor = Color.Red; else textBox1.ForeColor = Color.Black;
if ((textBox2.Text == textBox1.Text) | (textBox2.Text == textBox3.Text) | (textBox2.Text == textBox5.Text) | (textBox2.Text == textBox8.Text)) textBox2.ForeColor = Color.Red; else textBox2.ForeColor = Color.Black;
if ((textBox3.Text == textBox1.Text) | (textBox3.Text == textBox2.Text) | (textBox3.Text == textBox6.Text) | (textBox3.Text == textBox9.Text)) textBox3.ForeColor = Color.Red; else textBox3.ForeColor = Color.Black;
if ((textBox4.Text == textBox5.Text) | (textBox4.Text == textBox6.Text) | (textBox4.Text == textBox1.Text) | (textBox4.Text == textBox7.Text)) textBox4.ForeColor = Color.Red; else textBox4.ForeColor = Color.Black;
if ((textBox5.Text == textBox4.Text) | (textBox5.Text == textBox6.Text) | (textBox5.Text == textBox2.Text) | (textBox5.Text == textBox8.Text)) textBox5.ForeColor = Color.Red; else textBox5.ForeColor = Color.Black;
if ((textBox6.Text == textBox4.Text) | (textBox6.Text == textBox5.Text) | (textBox6.Text == textBox3.Text) | (textBox6.Text == textBox9.Text)) textBox6.ForeColor = Color.Red; else textBox6.ForeColor = Color.Black;
if ((textBox7.Text == textBox8.Text) | (textBox7.Text == textBox9.Text) | (textBox7.Text == textBox1.Text) | (textBox7.Text == textBox4.Text)) textBox7.ForeColor = Color.Red; else textBox7.ForeColor = Color.Black;
if ((textBox8.Text == textBox7.Text) | (textBox8.Text == textBox9.Text) | (textBox8.Text == textBox2.Text) | (textBox8.Text == textBox5.Text)) textBox8.ForeColor = Color.Red; else textBox8.ForeColor = Color.Black;
if ((textBox9.Text == textBox7.Text) | (textBox9.Text == textBox8.Text) | (textBox9.Text == textBox3.Text) | (textBox9.Text == textBox6.Text)) textBox9.ForeColor = Color.Red; else textBox9.ForeColor = Color.Black;
if ((textBox1.Text == textBox2.Text) | (textBox1.Text == textBox3.Text) | (textBox1.Text == textBox4.Text) | (textBox1.Text == textBox7.Text) |
(textBox2.Text == textBox1.Text) | (textBox2.Text == textBox3.Text) | (textBox2.Text == textBox5.Text) | (textBox2.Text == textBox8.Text) |
(textBox3.Text == textBox1.Text) | (textBox3.Text == textBox2.Text) | (textBox3.Text == textBox6.Text) | (textBox3.Text == textBox9.Text) |
(textBox4.Text == textBox5.Text) | (textBox4.Text == textBox6.Text) | (textBox4.Text == textBox1.Text) | (textBox4.Text == textBox7.Text) |
(textBox5.Text == textBox4.Text) | (textBox5.Text == textBox6.Text) | (textBox5.Text == textBox2.Text) | (textBox5.Text == textBox8.Text) |
(textBox6.Text == textBox4.Text) | (textBox6.Text == textBox5.Text) | (textBox6.Text == textBox3.Text) | (textBox6.Text == textBox9.Text) |
(textBox7.Text == textBox8.Text) | (textBox7.Text == textBox9.Text) | (textBox7.Text == textBox1.Text) | (textBox7.Text == textBox4.Text) |
(textBox8.Text == textBox7.Text) | (textBox8.Text == textBox9.Text) | (textBox8.Text == textBox2.Text) | (textBox8.Text == textBox5.Text) |
(textBox9.Text == textBox7.Text) | (textBox9.Text == textBox8.Text) | (textBox9.Text == textBox3.Text) | (textBox9.Text == textBox6.Text)) ;
else
{
label1.Visible = true;
label2.Visible = true;
}
Удивлению нет границ! Полная версия: http://pastebin.com/S2getyHn
+158
function return_report($new,$do) {
$dosec = $do - $new;
$days = floor($dosec / 86400);
$hour = floor(($dosec - ($days*86400))/3600);
$min = floor(($dosec - ($days*86400) - ($hour*3600))/60);
$sec = floor(($dosec - ($days*86400) - ($hour*3600) - ($min*60)));
switch(substr($days, -2)) { // какое выводить слово
case 1: case 21: $ost = 'остался '; break;
default: $ost = 'осталось '; break;
}
switch(substr($days, -2)) { // вывод дней
case 1: case 21: case 31: case 41: $d=' день '; break;
case 2: case 3: case 4: case 22: case 23: case 24: case 32: case 33: case 34: case 42: case 43: case 44: $d=' дня '; break;
default: $d=' дней ';
}
switch(substr($hour, -2)) { // вывод часов
case 1: case 21: $h=' час '; break;
case 2: case 3: case 4: case 22: case 23: case 24: $h=' часа '; break;
default: $h=' часов ';
}
switch(substr($min, -2)) { // вывод минут
case 1: case 21: case 31: case 41: case 51: $m=' минута '; break;
case 2: case 3: case 4: case 22: case 23: case 24: case 32: case 33: case 34: case 42: case 43: case 44: case 52: case 53: case 54: $m=' минуты '; break;
default:$m=' минут ';
}
switch(substr($sec, -2)) { // вывод секунд
case 1: case 21: case 31: case 41: case 51: $s=' секунда'; break;
case 2: case 3: case 4: case 22: case 23: case 24: case 32: case 33: case 34: case 42: case 43: case 44: case 52: case 53: case 54: $s=' секунды'; break;
default:$s=' секунд';
}
if ($dosec > 0) {
$period = $ost;
if ($days > 0) $period .= '<b>'.$days.'</b>'
.$d;
if ($hour > 0) $period .= '<b>'.$hour.'</b>'
.$h;
if ($min > 0) $period .= '<b>'.$min.'</b>'.
$m;
if ($sec > 0) $period .= '<b>'.$sec.'</b>'.
$s;
return $period;
}
return false;
}
Человек пытался сделать вывод времени, прошедшего с определенного момента *FACEPALM*
+158
<?php
class User
{
protected $_user_id;
protected $_user_email;
protected $_user_password;
public function __construct($user_id)
{
$user_record = self::_getUserRecord($user_id);
$this->_user_id = $user_record['id'];
$this->_user_email = $user_record['email'];
$this->_user_password = $user_record['password'];
}
public function __get($value) {}
public function __set($name, $value) {}
private static function _getUserRecord($user_id)
{
$user_record = array();
switch($user_id) {
case 1:
$user_record['id'] = 1;
$user_record['email'] = '[email protected]';
$user_record['password'] = 'i like croissants';
break;
case 2:
$user_record['id'] = 2;
$user_record['email'] = '[email protected]';
$user_record['password'] = 'me too!';
break;
case 'error':
throw new Exception('Ошибка библиотеки SQL!');
break;
}
return $user_record;
}
}
?>
PHP исключения...
+150
<?php
if ($_GET['type']) $link = 'type='.$_GET['type'];
if ($_GET['cat']) $link = 'cat='.$_GET['cat'];
if ($_GET['param']) $link = 'param='.$_GET['param'];
−112
public static function isDynamicObject(obj:Object):Boolean
{
try
{
// this test for checking whether an object is dynamic or not is
// pretty hacky, but it assumes that no-one actually has a
// property defined called "wootHackwoot"
obj["wootHackwoot"];
}
catch (e:Error)
{
// our object isn't from a dynamic class
return false;
}
return true;
}
http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/ObjectUtil.as
−126
Процедура ОбработкаПроведения(Отказ, РежимПроведения)
Для Каждого Строка Из тчПутевыеЛисты Цикл
Если Строка.ПринятКУчету = Истина Тогда
ПутЛист = Строка.ПутевойЛист.ПолучитьОбъект();
ПутЛист.ПринятКУчету = Истина;
ПутЛист.ДатаПринятияКУчету = Дата;
ПутЛист.Записать(РежимЗаписиДокумента.Проведение, РежимПроведенияДокумента.Неоперативный);
КонецЕсли;
КонецЦикла;
Форма = ЭтотОбъект.ПолучитьФорму("ФормаДокумента");
Форма.ЭлементыФормы.тчПутевыеЛисты.Доступность = Ложь;
Форма.ЭлементыФормы.тчРаспределениеЗатрат.Доступность = Ложь;
Форма.ЭлементыФормы.КоманднаяПанель2.Кнопки.СформироватьДокумент.Доступность = Ложь;
Форма.ЭлементыФормы.КоманднаяПанель2.Кнопки.Заполнить.Доступность = Ложь;
Форма.ЭлементыФормы.КоманднаяПанель1.Кнопки.ЗаполнитьПоДаннымПоставщика.Доступность = Ложь;
Форма.ЭлементыФормы.КоманднаяПанель1.Кнопки.Заполнить.Доступность = Ложь;
КонецПроцедуры
ШЕДЕВР!
Конечно, база данных ведь запоминает, что мы элементы формы сделали недоступными...