- 1
- 2
- 3
- 4
function someFunction(t) {
var y="$('#elementID').find('input[type=\"text\"]:eq(", z=")').focus()", x=")').val()==''";
setTimeout("( "+y+"0"+x+" )? ( "+y+"0"+z+" ):( ( "+y+"1"+x+" )? ( "+y+"1"+z+" ):( "+y+"2"+z+" ) );", t);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+160
function someFunction(t) {
var y="$('#elementID').find('input[type=\"text\"]:eq(", z=")').focus()", x=")').val()==''";
setTimeout("( "+y+"0"+x+" )? ( "+y+"0"+z+" ):( ( "+y+"1"+x+" )? ( "+y+"1"+z+" ):( "+y+"2"+z+" ) );", t);
}
это какое-то нечто
+92
function lz_UploadMount:boolean;
var del_l,i,j,k,ng,l,typ:integer;
pt:array[1..3]of integer;
begin
UpDiag:=0;
result:=true;
if I_AM_EMUL {or not I_AM_MAIN }then exit;
if Pult[1].Count+Pult[2].Count=0 then exit;
lg_UploadMount;
// exit;
UpDiag:=1;
result:=false;
__UPLOADING:=true;
try
if not JustC(21,[])then exit;
sleep(1000);
//if (Pult[1].Count>0)and(Pult[2].Count>0)then ng:=3 else ng:=1;
//if not JustC(25,[ng])then exit;;
if not JustC(22,[])then exit;;
{группы}
if (Pult[1].Count>0)and(Pult[2].Count>0)then ng:=2 else ng:=1;
for i:=1 to 2 do
begin
if Pult[i].Count=0 then continue;
k:=0;
for j:=1 to 3 do pt[j]:=MainShow.Params[j];
for j:=0 to Pult[i].Count-1 do
with TMotor(Pult[i][j])do
begin
k:=k+(1 shl (ConvertTP(TP)-1));
for L:=1 to 3 do if pt[L]>GParam(L)then pt[L]:=GParam(L);
end;
//маска
AddI(k);
//скорость
AddSpeed(round(pt[1]*KOREDV));
//ускорение разгона
//ускорение торможения
AddI((pt[2]shl 16)+pt[3]);
//номер джойстика
//функциональная клавиша
{Кнопка} {Джойстик}{повторы} {тип группы}
typ:=2;
AddI((i shl 6)+(i shl 3)+(1 shl 10)+typ);
end;
if not lz_Command(26,4,ng,[ng])then exit;;
CheckMountEffect;
{моторы}
lzData.Clear;
for i:=1 to 2 do
for j:=0 to Pult[i].Count-1 do
with TMotor(Pult[i][j])do
begin
if md_targ<0 then AddI((17 shl 16)+ConvertTP(TP))else AddI((18 shl 16)+ConvertTP(TP));
if md_targ<GetMotorInfo(TP,1)then del_l:=-1 else del_l:=1;
if md_targ<0 then
begin
AddI(-trunc(GParam(5)/KORED*65536));
AddI(-trunc(GParam(4)/KORED*65536));
end
else
begin
AddI(-trunc((md_targ+del_l/2)/KORED*65536));
AddSpeed(round(md_way*KOREDV));
end
end;
if not lz_Command(28,3,Pult[1].Count+Pult[2].Count,[Pult[1].Count+Pult[2].Count])then exit;
UpDiag:=2;
if not JustC(23,[])then exit;
(*EnterCriticalSection(csJoystick);
j_Changed:=true;
{J_Status[1]:=false;
J_Status[2]:=false;}
LastSign[1]:=-1;
LastSign[2]:=-1;
LeaveCriticalSection(csJoystick);*)
{if(Pult[1].Count>0)then if not JustC(36,[1,1])then exit;
if(Pult[2].Count>0)then if not JustC(36,[2,1])then exit;}
UpDiag:=0;
result:=true;
Uploaded:=true;
for i:=1 to 12 do
FirstGr[i]:=0;
finally
__UPLOADING:=false;
if Uploaded then WaitZero;
end;
end;
Случайно открыл свою первую рабочую программу. Забавно, как со временем меняется стиль программирования :)
В той что используется сейчас изменился протокол, так что прямого аналога нет, но примерно ту же функцию выполняет такой кусок:
----------------
procedure TMotion.GetTargetForPLC(M: TMotor; Mo: TNormalMotionData);
var
Conf: TMotorConfig;
ME: TElementMark;
I: Integer;
Ht, SP: Real;
begin
if not Uploaded then
exit;
Conf := PLCConf.Motor(M.MotorNumber);
ME := Mark.ElementByMotor(M.MotorNumber);
SP := Panel.GetValue(Speed);
// Проверка разрешений движения
if (Panel.GetStatus <> psGo) or (not Condition.CheckMotion) or FailedSafe or
(SP = 0) or (not ME.CheckMotion) then
Mo.CommandID := mcStop
else
Mo.CommandID := mcGo;
Mo.Accel := LimitVal(1, Conf.MotorTyp.ProgramToDrive(ktAccel,
Limits.GetParam(TAccelParam).Minimum));
Mo.Deccel := LimitVal(1, Conf.MotorTyp.ProgramToDrive(ktAccel,
Limits.GetParam(TDeccelParam).Minimum));
if SP >= 0 then
Ht := Effect.OutputTarget(M)
else
Ht := ME.GetTargetForPLC(false);
// M.StartPos.Value := 0.5;
if M.PositionType.InheritsFrom(TAngleWithTu rnsParam) then
Ht := M.HackCircleTarget(Ht);
Mo.Target := Conf.MotorTyp.ProgramToDrive(ktTarget, Ht);
Mo.Speed := Conf.MotorTyp.ProgramToDrive(ktSpeed, abs(SP)); { }{ }{ }
Mo.Time := 0;
if SP >= 0 then
Effect.ProcessCommand(M, Mo);
Mo.Mask := M.Children + [M.MotorNumber];
for I in Mo.Mask do
GetMotor(I).RawCommand := Mo;
end;
----------------
−85
[self.navigationItem setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithCustomView:[(TANavigationBar *)self.navigationController.navigationBar backButtonWith:[UIImage imageNamed:@"ActivityNavBackButtonBackground"] highlight:nil leftCapWidth:30.0f]] autorelease]];
Однако, это печально :(
И не индус вроде
+132
// Asynchronously load the DXF.
// While we're doing that, the data can change, so we should guard against it.
new WebappResourceLoader().loadResource(ResourceType.DXF, sDxfName + ".dxf",
new ResourceCallback<List<String>>() {
@Override
public void onSuccess(final List<String> result) {
if (!sDxfName.equals(dxfToLoad)) {
// Too slow, dude.
return;
}
+97
If bd12tc->mes!=num_month
st_mes=num_month
Else
st_mes=bd12tc->mes
EndIf
Clipper
Перевожу на работе старую программку (писалась больше 12 лет назад) в Delphi, нашёл вот такое
+121
procedure TForm1.Timer2Timer(Sender: TObject);
begin
image75.Visible:=false;image76.Visible:=false;
image1.Visible:=true;image2.Visible:=true;image3.Visible:=true;
image4.Visible:=true;image5.Visible:=true;image6.Visible:=true;
image7.Visible:=true;image8.Visible:=true;image9.Visible:=true;
image10.Visible:=true;image11.Visible:=true;image12.Visible:=true;
image13.Visible:=true;image14.Visible:=true;image15.Visible:=true;
image16.Visible:=true;image17.Visible:=true;image18.Visible:=true;
image19.Visible:=true;image20.Visible:=true;image21.Visible:=true;
image22.Visible:=true;image23.Visible:=true;image24.Visible:=true;
image25.Visible:=true;image26.Visible:=true;image27.Visible:=true;
image28.Visible:=true;image29.Visible:=true;image30.Visible:=true;
image31.Visible:=true;image32.Visible:=true;image33.Visible:=true;
image34.Visible:=true;image35.Visible:=true;image36.Visible:=true;
image37.Visible:=true;image38.Visible:=true;image39.Visible:=true;
image40.Visible:=true;image41.Visible:=true;image42.Visible:=true;
image43.Visible:=true;image44.Visible:=true;image45.Visible:=true;
image46.Visible:=true;image47.Visible:=true;image48.Visible:=true;
image49.Visible:=true;image50.Visible:=true;image51.Visible:=true;
image52.Visible:=true;image53.Visible:=true;image54.Visible:=true;
image55.Visible:=true;image56.Visible:=true;image57.Visible:=true;
image58.Visible:=true;image59.Visible:=true;image60.Visible:=true;
image61.Visible:=true;image62.Visible:=true;image63.Visible:=true;
image64.Visible:=true;image65.Visible:=true;image66.Visible:=true;
image67.Visible:=true;image68.Visible:=true;image69.Visible:=true;
image70.Visible:=true;image71.Visible:=true;image72.Visible:=true;
image73.Visible:=true;
if image1.left<360 then begin timer2.Enabled:=false;button2.Visible:=true;
image1.Visible:=false;image2.Visible:=false;image3.Visible:=false;
image4.Visible:=false;image5.Visible:=false;image6.Visible:=false;
image7.Visible:=false;image8.Visible:=false;image9.Visible:=false;
image10.Visible:=false;image11.Visible:=false;image12.Visible:=false;
image13.Visible:=false;image14.Visible:=false;image15.Visible:=false;
image16.Visible:=false;image17.Visible:=false;image18.Visible:=false;
image19.Visible:=false;image20.Visible:=false;image21.Visible:=false;
image22.Visible:=false;image23.Visible:=false;image24.Visible:=false;
image25.Visible:=false;image26.Visible:=false;image27.Visible:=false;
image28.Visible:=false;image29.Visible:=false;image30.Visible:=false;
image31.Visible:=false;image32.Visible:=false;image33.Visible:=false;
image34.Visible:=false;image35.Visible:=false;image36.Visible:=false;
image37.Visible:=false;image38.Visible:=false;image39.Visible:=false;
image40.Visible:=false;image41.Visible:=false;image42.Visible:=false;
image43.Visible:=false;image44.Visible:=false;image45.Visible:=false;
image46.Visible:=false;image47.Visible:=false;image48.Visible:=false;
image49.Visible:=false;image50.Visible:=false;image51.Visible:=false;
image52.Visible:=false;image53.Visible:=false;image54.Visible:=false;
image55.Visible:=false;image56.Visible:=false;image57.Visible:=false;
image58.Visible:=false;image59.Visible:=false;image60.Visible:=false;
image61.Visible:=false;image62.Visible:=false;image63.Visible:=false;
image64.Visible:=false;image65.Visible:=false;image66.Visible:=false;
image67.Visible:=false;image68.Visible:=false;image69.Visible:=false;
image70.Visible:=false;image71.Visible:=false;image72.Visible:=false;
image73.Visible:=false;end
else begin image1.left:=image1.Left-3;image1.top:=image1.top-1;
image2.left:=image2.Left+2;image2.top:=image2.top+2;
image3.left:=image3.Left-1;image3.top:=image3.top-3;
image4.left:=image4.Left-2;image4.top:=image4.top+4;
...
Ещё 65 строк кода!
Анимация взрыва на Delphi 7.
+102
$compareCost = 0;
$countGacha = 0;
for($i=0; $i<10; ++$i):
$compareCost += $this->freeGacha->getCost();
if( $this->player->getSocialPoint() > $compareCost ) continue;
else break;
$countGacha = $i+1;
endfor;
Korean style ;)
+96
public void setWeather(WeatherData[] weather) {
weatherInfo.setWeather(weather[0]);
weatherInfo.setTomorrowWeather(weather[1]);
weatherInfo.setDayAfterTomorrowWeather(weather[2]);
weatherInfo.setDayAfterDayAfterTomorrowWeather(weather[3]);
weatherInfo.setDayAfterDayAfterDayAfterTomorrowWeather(weather[4]);
weatherInfo.setDayAfterDayAfterDayAfterDayAfterTomorrowWeather(weather[5]);
}
Студенты такие студенты....
+100
if ($node->title == 'Главная страница' || $node->title == 'Home')
{print '<img src="sites/all/themes/them/images/stock.png" />';
}
Говнокод по Drupal-овски.
Найден в шаблоне page.tpl.php
−89
MdlСимметричность.Командная(СтИстБи, ФлагСим, КвоРабЧис)
If ФлагСим = True Then ' тут мы сохраним столб истинности линейной функции и количество рабочих чисел
ФлагСим1 = True 'покажем, что хоть одна функция симметрична
СохранимНужнуюФункцию(СчетСим, КвоРабЧисЖмин, КвоРабЧис, СтИстБи, СтИстБиИскомыйСим)
End If
Как, пример, как нельзя называть и обзывать переменные и имена функций. Взято отсюда: http://www.sql.ru/forum/actualthread.aspx?tid=934300