- 1
Wct Editor forever
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+121
Wct Editor forever
Ахаххахаха))
+80
function thttp.Get(URI: string): string;
var
newlocation:string;
redirect:integer;
contenttype:string;
i:integer;
contentencoding:string;
test:string;
host:string;
begin
redirect:=0;
headers.clear;
document.clear;
uri:=stringreplace(uri,'\','/',[rfreplaceall]);
// building the host///
if request.host <> '' then
headers.Add(format('Host:%s',[request.host]))
else
begin
i:=pos('://',uri);
if i>0 then
begin
host:=copy(uri,i+3,maxint);
i:=pos('/',host);
if i>0 then
host:=copy(host,1,i-1);
request.host:=host;
end
else
begin
i:=pos('/',uri);
if i>0 then host:=copy(uri,1,i-1)
else
host:=uri;
request.host:=host;
end;
end;
if request.referer <> '' then
headers.Add(format('Referer:%s',[request.referer]));
if request.useragent <> '' then
headers.Add(format('User-Agent:%s',[request.useragent]));
if request.AcceptEncoding <> '' then
headers.Add(format('Accept-Encoding:%s',[request.AcceptEncoding]));
if request.contenttype <> '' then
headers.Add('Content-Type:'+request.contenttype);
if request.connection <> '' then
headers.add('Connection:'+request.connection);
HTTPMethod('GET',uri);
if allowredirects=true then
begin
while (resultcode>=300) and (resultcode<400) do
begin
if (maxredirects <> -1) and (redirect > self.MaxRedirects) then break;
document.clear;
newlocation:=trim(Headers.Values['Location']);
if newlocation='' then break;
if (rightstr(request.host,1) <> '/') and (copy(newlocation,1,1) <> '/') then
newlocation:='/'+newlocation;
headers.clear;
document.clear;
HTTPMethod('GET',host+newlocation);
host:=trim(headers.Values['host']);
if host <> '' then
request.host:=host;
inc(redirect);
end;
end;
contenttype:=Headers.Values['Content-Type'];
contentencoding:=Headers.Values['Content-Encoding'];
request.contentencoding:=contentencoding;
request.contenttype:=contenttype;
if pos('gzip',ansilowercase(contentencoding))>0 then
begin
mstream.clear;
try
GZDecompressStream(Document, MStream);
document.Clear;
document.LoadFromStream(mstream);
document.Position:=0;
except
end;
end;
result:=memorystreamtostring(Document);
if pos('charset=utf-8',ansilowercase(contenttype))>0 then
test:=utf8toansi(result);
if test <> '' then
result:=test;
end;
У Булгакова есть цикл рассказов "Записки на манжетах".
Мой цикл называется "Записки на туалетной бумаге салфетках".
Итак, "Записки на салфетках. Как я обертывал Synapse".
+123
drwsr
+117
bormand сосёт анус своему отцу, размазывая говно по лицу.
+130
<input id="resetbutton" class="btn btn-info" type="reset" value="Reset" name="reset"></input>
Джун порадовал. Не хватает комментария "Шоб наверняка!"
+140
Лошади снова здесь.
+78
DynArray = [1..2] of real;
var
A : ^DinArray;
n, i : word;
BEGIN
write('Укажите размер массива:');
readln(n);
GetMem(A,n*6);
. . .
{$R-}
for i:=1 to n do
A[i]:=random;
. . . {любые действия с элементами масссива}
{$R+}
FreeMem(A,n*6)
END.
Просто феерический говнокод на "Pascal".
http://logi.cc/dinamicheskaya-pamyat-primer-23/
+131
Set-Cookie pingadmin_ya_ne_robot=1; expires=Thu, 27 Mar 2014 06:39:49 GMT; path=/; domain=.ping-admin.ru;
Ya_ne_robot_infa_sotka
−336
- (BOOL)isTabBarHidden
{
return (self.tabBar.alpha < 0.01);
}
Встретил такое в своем проекте...
+153
if($(".column.fixed").size() && !pageStyle.tablet && !pageStyle.touch) {
var maxOffset = $("div[class='column3']").height() + $("div[class='column3']").offset().top;
var columnFixed = $(".column.fixed");
var column3Offset = columnFixed.offset().top;
// debug
if(false) {
$("body").append("<div id='walla'></div>");
var div = $("#walla");
div.css({
width: "100%",
height: "10px",
background: "green",
position: "absolute",
top: maxOffset
});
}
console.log(maxOffset);
wnd.scroll(function() {
var top = wnd.scrollTop();
var position = (top - column3Offset + 85) > 0 ? "fixed" : "static";
var marginTop = 0;
if(position == "fixed") {
marginTop = (-1) * column3Offset + 85;
// debug
//console.log(top);
// console.log(maxOffset);
if(top + columnFixed.height() + 150 > maxOffset) {
marginTop = marginTop - (top + columnFixed.height() + 150 - maxOffset);
// console.log('sdfsdf');
}
}
columnFixed.css({
marginTop: marginTop,
position: position
});
});
}
Прилипающий блок при скролле (без учета увеличения контента).... особенно мне нравится if(false)