- 1
- 2
- 3
int createStageCycles = 0;
createStageCycles = Integer.parseInt(strCycle);
int nextVal = new Integer(createStageCycles) + 1;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+86
int createStageCycles = 0;
createStageCycles = Integer.parseInt(strCycle);
int nextVal = new Integer(createStageCycles) + 1;
int двойного отжима
−428
url = request.get_full_path()
if 'show_error' in url:
show_param = url.split('?show_error=')
error = show_param[1]
Кусок кода из Django проекта
Взяли индуса на работу. Вот так он достает GET параметры
+111
{$APPTYPE CONSOLE}
{$R *.res}
type
TFTest = class
public
B: string;
function Add(S: string = ''): TFTest;
constructor Create(T: TFTest); overload;
end;
function TFTest.Add(S: string): TFTest;
begin
B := B + S;
Exit(Self);
end;
var
A: TFTest;
constructor TFTest.Create(T: TFTest);
begin
B := T.B;
end;
begin
writeln(TFTest.Create.Add('0')
.Create((TFTest.Create(TFTest.Create(((((((TFTest.Create(TFTest.Create).Add('0')).Add('1').Create.Add('2')
.Add as TObject).Create) as TFTest.ClassParent) as TFTest).Create).Add('3')).Add.Add('4').Create).Add('5')).Add('6')
).Add('7').B);
readln;
end.
Кто правильно обьяснит этот код, получит... ничего получит :)
+115
foreach (var sheet in paper.Decomposed)
{
if (ct > 0 && sheet.Equals(paper.Decomposed[ct]))
{
paper.PaperPrice += paperPrice;
paper.PrintingPrice += printingPrice;
paper.PlatesPrice += platesPrice;
ct++;
continue;
}
ct++;
...
}
+86
if (bindingContext != null && files != null) {
if (files != null && bindingContext != null) {
// bla-bla
}
}
I want to be sure!
+72
const
zn1 = #60; { < }
zn2 = #62; { > }
function EnCrypt(ds: string): string;
var
k,l,m: string;
i,b,g: integer;
t: char;
function Lvs(ds: byte): string;
begin
case ds of
Byte(zn1): Result:= zn1+zn2;
Byte(zn2): Result:= zn2+zn1;
0: if Random(2)=0 then Result:= zn1+zn1
else Result:= zn2+zn2;
else
Result:= Chr(ds);end;
end;
begin
if length(ds)=0 then Exit;
Randomize; k:=''; m:=''; b:=1;
for i:=1 to RandomRange(5,16) do
k:= k+Chr(RandomRange(1,256));
for i:=1 to Length(ds) do begin
g:= Byte(ds[i])xor Byte(k[b]);
l:= Lvs(g); t:= k[b];
if i<= Length(k) then m:= m+t+l else m:=m+l;
Inc(b);
if b>Length(k) then b:= 1;
end;
l:= Chr(Length(k))+m;
for i:=1 to Length(l) do begin
b:= Byte(l[I]) xor i;k:= Lvs(b);
Result:= Result+k;
end;
end;
function DeCrypt(ds: string): string;
var
k,c,l,n: string;
i,b,m: integer;
d: boolean;
function Svl(ds: string; ts: integer): char;
var t: byte;
begin
t:=Byte(ds[1]);
if ds=zn1+zn2 then t:=Byte(zn1);
if ds=zn2+zn1 then t:=Byte(zn2);
if(ds=zn1+zn1) or (ds=zn2+zn2) then t:= 0;
Result:=Chr(Byte(t xor ts));
end;
begin
if length(ds)=0 then Exit;
b:=1; i:=1; n:='';
while i<=Length(ds) do begin c:= ds[i];
if (ds[i]=zn1)or(ds[i]=zn2)then begin
c:=ds[i]+ds[i+1]; Inc(i); end;
Inc(i);
n:= n+Svl(c,b);
Inc(b);
end; c:=''; k:=''; b:=1; i:=1;
d:=false;
m:=Byte(n[1]);
Delete(n,1,1);
while i<=Length(n)do begin
if b<=m*2 then begin if d then begin
l:=n[i];
if (n[i]=zn1) or (n[i]=zn2) then
begin
l:= n[i]+n[i+1]; Inc(i);
end;
c:=c+l;
Inc(b);
d:=false;
end else
begin
k:=k+n[i]; d:=true; Inc(b);
end;
end else begin
l:= n[i];
if (n[i]=zn1) or (n[i]=zn2) then
begin l:= n[i]+n[i+1]; Inc(i); end;
c:=c+l; end;
Inc(i); end;
if length(c)=0 then Exit;
i:=1;b:=1;
while i<=Length(c)do begin
l:=c[i];
if (c[i] = zn1) or (c[i] = zn2) then
begin
l:= c[i] + c[i+1]; Inc(i);
end;
Inc(i);
Result:= Result + Svl(l, Byte(k[b]));
Inc(b);
if b>Length(k)then b:=1;
end;
end;
В очень далёком 99м году была совершена попытка шифровать и дешифровать пароли пользователей простым ХОР-замесом. Тогда такой способ казался идеальным и оригинальным :) Но посмотрите, если руки не оттуда откуда надо растут, как же можно извратиться, чистый говнокод! До сих пор им пользуюсь, немного. Интересно, ктонить догадается, зачем здесь константные знаки используются?
−15
function _taxonomy_image_exists($tid) {
if (db_fetch_object(db_query('SELECT path FROM {term_image} WHERE tid=%d', $tid))) {
return TRUE;
}
return FALSE;
}
+161
function translit ($out='') {
$out = iconv('UTF-8', 'CP1251', $out);
$eval = '
$out = strtr($out,
"абвгдезийклмнопрстуфхцыэАБВГДЕЗИЙКЛМНОПРСТУФХЦЫЭ№",
"abvgdezijklmnoprstufhcieABVGDEZIJKLMNOPRSTUFHCIE#"
);
$out = strtr($out, array(
"ё"=>"yo", "ж"=>"zh", "ч"=>"ch", "ш"=>"sh", "щ"=>"shh", "ъ"=>"``", "ь"=>"`", "ю"=>"yu", "я"=>"ya",
"Ё"=>"Yo", "Ж"=>"Zh", "Ч"=>"Ch", "Ш"=>"Sh", "Щ"=>"Shh", "Ъ"=>"``", "Ь"=>"`", "Ю"=>"Yu", "Я"=>"Ya"
));
';
$eval = iconv('UTF-8', 'CP1251', $eval);
eval ($eval);
return iconv('CP1251', 'UTF-8', $out);
}
+133
#include <stdio.h>
float abs(float a) { return a > 0 ? a : -a; }
int main() {
float x, e, step = 1, summ = step;
int i = 0;
scanf("%f, %f", (printf("x, e: "), &x), &e);
do summ += (abs(step *= x / ++i) > e) ? step : 0; while (abs(step) > e);
printf("summ = %f\n", summ);
return 0;
}
вычисление суммы ряда (1 + x/1! + x^2/2! + ... + x^n/n!), с заданной точностью
+125
if (FileAssociation.IsAssociated(".avi") || !FileAssociation.IsAssociated(".avi"))
{
FileAssociation.Associate(".avi", "Flvplayer", ".avi", a, b);
}
http://www.cyberforum.ru/csharp-beginners/thread304416.html