- 1
- 2
Не поленись, пройди по анкетам и поставь всем минусы.
минуисуя участников, ты помогаешш обществу.
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+133
Не поленись, пройди по анкетам и поставь всем минусы.
минуисуя участников, ты помогаешш обществу.
+161
</if>
</if>
</ul>
</if>
</td>
</if>
</tr>
</if>
</foreach>
</table>
</div>
</div>
<br />
</div>
</if>
</foreach>
</if>
</div>
facepalm
−110
// last parameter is the setter code if value allowed to be set
#define SET_USING_CONFIG(cellSwitch,configKey,...)\
cell.cellSwitch = [(EExhibitorsListConfigItem*)[self.configInfo configItemAtIndex:0] configKey];\
if (cell.cellSwitch) {\
__VA_ARGS__;\
}
SET_USING_CONFIG(isLikesCountOn, showLikes,
cell.likesCount = exhibitor.Rating;
cell.likedByMe = exhibitor.IsRated; );
SET_USING_CONFIG(isInFavoritesOn, showFavoritesIndicator,
__weak EExhibitorCell *weakCell = cell;
cell.didChangeFavouritesStateBlock = ^(BOOL newFavState) {
[EExhibitorsListViewController updateFavoriteState:newFavState
ofExhibitor:exhibitor
inCell:weakCell];
};
);
Define master!
+136
function NameBro() {
var userAgent = navigator.userAgent.toLowerCase();
// Определим Internet Explorer
if (userAgent.indexOf("msie") != -1 && userAgent.indexOf("opera") == -1 && userAgent.indexOf("webtv") == -1) {
return "msie";
}
// Opera
if (userAgent.indexOf("opera") != -1) {
return "opera";
}
// Gecko = Mozilla + Firefox + Netscape
if (userAgent.indexOf("gecko") != -1) {
return "gecko";
}
// Safari, используется в MAC OS
if (userAgent.indexOf("safari") != -1) {
return "safari";
}
// Konqueror, используется в UNIX-системах
if (userAgent.indexOf("konqueror") != -1) {
return "konqueror";
}
return "unknown";
}
var bro = NameBro();
$(function() {
if(bro == "msie") {
$("body").html("Пшел нах с маего супир сайта бамжара ибаная. И где ты только комп взял украл или на памойки нашел? Харашо нынчи бамжы жывут сук пздц((");
window.location.hash = "Сматри бомж тибя дажы в адресной страке затралли азазазаз.";
}
})
+154
list($V_id, $V_image, $V_title, $V_text, $V_url, $V_link_to, $V_status) = array('','','','','','','');
множественное присваивание?! не, не слыщал
+139
#define InlineIsEqualGUID(rguid1, rguid2) \
(((unsigned long *) rguid1)[0] == ((unsigned long *) rguid2)[0] && \
((unsigned long *) rguid1)[1] == ((unsigned long *) rguid2)[1] && \
((unsigned long *) rguid1)[2] == ((unsigned long *) rguid2)[2] && \
((unsigned long *) rguid1)[3] == ((unsigned long *) rguid2)[3])
Windows SDK, guiddef.h
ret = InlineIsEqualGUID(&g_guid, guid_array + i); /* ??? */
+139
// ==UserScript==
// @name GK parent comment
// @namespace GK
// @description Adds links to parent commentary to GK comments, and sets parent commentary text as link tooltip.
// @include http://govnokod.ru/*
// @include http://www.govnokod.ru/*
// @version 1.0.0
// @updateURL http://userscripts.org/scripts/source/172756.meta.js
// @downloadURL http://userscripts.org/scripts/source/172756.user.js
// ==/UserScript==
(function(){
//hack for Chrome, as it doesn't support unsafeWindow.
if (typeof unsafeWindow == 'undefined')
{
unsafeWindow = (function()
{
var el = document.createElement('p');
el.setAttribute('onclick', 'return window;');
return el.onclick();
}())
};
$ = unsafeWindow.jQuery;
//dirty, DIRTY hack to wait for certain element to appear. -_-
//But I have no idea how to do it right.
function waitForSelector(selector, context, mustexist, callback) {
var l = $(selector, context).length;
if ((l>0) != mustexist)
{
setTimeout(function(){waitForSelector(selector, context, mustexist, callback)}, 50);
return false;
};
callback();
}
//short function for adding custom CSS rules. Why use Greasemonkey specific GM_setStyle() just for that?
function addCSS(rule) {
var styleElement = document.createElement("style");
styleElement.type = "text/css";
if (typeof styleElement.styleSheet !== 'undefined')
styleElement.styleSheet.cssText = rule;
else
styleElement.appendChild(document.createTextNode(rule));
document.getElementsByTagName("head")[0].appendChild(styleElement);
}
addCSS([
'.comment-parent-link {margin-left:10px;font-size:10pt}',
].join('/n'));
var PARENT = '<a class="comment-link comment-parent-link" href="">↑</a>';
var oldLoadComments = unsafeWindow.comments['load'];
function newLoadComments(aElemTrigger) {
var $parent = $(aElemTrigger).closest('.entry-comments');
oldLoadComments.call(this,aElemTrigger);
waitForSelector('.hcomment', $parent, true, function(){
setParentLinks($parent);
});
}
unsafeWindow.comments['load'] = newLoadComments;
function setParentLinks($context) {
$context.find('.hcomment').each(function(i,e){
var $this = $(this);
var $parent = $this.parents('.hcomment:eq(0)');
if ($parent.length) {
var $parentlink = $(PARENT);
$parentlink.attr('href', $parent.find('a.comment-link:eq(0)').attr('href'));
$parentlink.attr('title', $parent.find('.comment-text:eq(0)').text());
$this.find('a.comment-link:eq(0)').after($parentlink);
}
});
}
setParentLinks($('body'));
})();
http://userscripts.org/scripts/show/172756
По просьбам трудящихся, скрипт для поиска родительского комментария. Добавляет ссылку на родителя, и ставит его текст как тултип.
Учитывая подключение либы с самого сайта и метод поиска динамически подгруженных комментариев, вполне себе говнокод. А потому: тов. Страйкер, вынесите уже отдельно функцию comments.loadSuccessful()! А то адский гемморой любую постобработку комментариев делать.
+125
<Target Inputs="@(DeployLabel)" Name="GenericDeploy" Outputs="%(Identity).Dummy">
<PropertyGroup>
<TargetFilter>%(DeployLabel.Dir)</TargetFilter>
<TargetFilterReplaced>$(TargetFilter.Replace('\', ''))</TargetFilterReplaced>
</PropertyGroup>
<WriteLinesToFile
File="$(ProjectDir)tsfiles.txt"
Condition="$([System.Text.RegularExpressions.Regex]::IsMatch(%(Filter),
'$(TargetFilterReplaced)'))"
Lines="@(TypeScriptCompile ->'"%(fullpath)"', ' ')"
Overwrite="false" />
<PropertyGroup>
<TSFilesFiltered>$([System.IO.File]::ReadAllText($(ProjectDir)tsfiles.txt))</TSFilesFiltered>
<TSFilesOneLine>$([System.Text.RegularExpressions.Regex]::Replace(
$(TSFilesFiltered), "[\n\r]+", " "))</TSFilesOneLine>
</PropertyGroup>
<Exec Command="tsc --target ES3 -c -d --out $(Deployroot)\foo.js $(TSFilesOneLine)" />
<Delete Files="$(ProjectDir)tsfiles.txt"/>
</Target>
Кто не был, тот будет, кто был, тот не забудет.
MSBuild: задача отфильтровать массив из строк. Я за два дня ничего лучшего не придумал.
+140
procedure TForm1.CloseChecker1Click(Sender: TObject);
begin
Halt;
end;
procedure TForm1.CoolTrayIcon1DblClick(Sender: TObject);
begin
Form1.Show;
CoolTrayIcon1.IconVisible:=false;
end;
end.
Продолжение. Начало на http://govnokod.ru/13317, http://govnokod.ru/13318
+139
procedure TMyTr.Execute;
var
s,resp,ip,port:string;
cw,i:integer;
begin
http:=TIdHTTP.Create(nil);
cw:=getnumberproxy;
while cw<form1.Memo1.Lines.Count do
begin
s:=form1.Memo1.Lines[cw];
i := Pos(':',s);
IP := Copy(s,1,i-1);
PORT := Copy(s,i+1,Length(s));
try
http.ProxyParams.ProxyServer:=ip;
http.ProxyParams.ProxyPort:=StrToInt(port);
http.ReadTimeout:=Form1.SpinEdit2.Value*1000;
resp:=http.Get('http://ya.ru/');
if pos('ya.ru',resp)<>0 then
form1.Memo2.Lines.Add(ip+':'+port);
except
end;
cw:=getnumberproxy;
checked:=checked+1;
end;
http.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
ind:=-1;
label6.caption:=inttostr(Memo1.Lines.count);
for i:=1 to spinedit1.Value do
begin
thr[i]:=TMyTr.Create;
thr[i].Pause(1);
thr[i].Resume;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
form1.label4.caption:=IntToStr(Form1.Memo2.Lines.Count);
Form1.Label6.Caption:=IntToStr(form1.Memo1.Lines.Count);
Form1.Label3.Caption:=IntToStr(checked);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Form1.Memo1.Clear;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Form1.Memo2.Clear;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
if SaveDialog1.Execute=true then
Form1.Memo2.Lines.SaveToFile(Form1.SaveDialog1.FileName);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if Form1.OpenDialog1.Execute=True
then
Form1.Memo1.lines.LoadFromFile(Form1.OpenDialog1.FileName);
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
Form1.CoolTrayIcon1.IconVisible:=True;
Form1.Hide;
end;
procedure TForm1.Show1Click(Sender: TObject);
begin
Form1.Show;
Form1.CoolTrayIcon1.IconVisible:=false;
end;
procedure TForm1.SaveGood1Click(Sender: TObject);
begin
if SaveDialog1.Execute=true then
Form1.Memo2.Lines.SaveToFile(Form1.SaveDialog1.FileName);
end;
procedure TForm1.ClearGood1Click(Sender: TObject);
begin
Form1.Memo2.Clear;
end;
Продолжение. Начало на http://govnokod.ru/13317