- 1
vTreeNode1.SelectedForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+111
vTreeNode1.SelectedForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
Присвоение чёрного цвета. Hell yeah!
+127
resid := "ANeNaidenVidShortNameNA";
defval := "(Не найден вид '(ShortNameNA)')";
nenay:=@DbLookup("":"NoCache";"":"ResDB.nsf";"(Res)";lng+resid;2);
nenay:=@If(@IsError(nenay);defval;nenay);
key:=@Name([Abbreviate]; @UserName);
serv:=@GetProfileField("CommonDBProfile"; "StructServer"; @ServerName);
db:=@GetProfileField("CommonDBProfile"; "StructDB"; @ServerName);
@If (serv="" | db=""; @Do(
@Prompt([Ok];osh; vstr);
@Return(vstr)
); "");
StructServer1:=@DbLookup("":"NoCache"; serv:db; "(NAShortNamePost)"; key; "StructServer" ) ;
StructDB1:=@DbLookup("":"NoCache"; serv:db; "(NAShortNamePost)"; key; "StructDB" ) ;
@If(StructDB1 = ""; @Do(@Prompt([Ok]; vnim; vstr); @Return("")); @Success);
a := @Trim(@PickList([Custom];StructServer1 :StructDB1; "(ShortNameNA)";sel; sel1; 5));
@If(@IsError(a); @Do(@Prompt([Ok]; osh; nenay); @Return("")); @Success);
@If(a = ""; @Do(@Prompt([Ok]; vnim; vneob); @Return("")); @Success);
FIELD NamesAlias:= @Middle(a; "$"; "#");
FIELD IndDepart := @Explode(@Implode(@Trim(@Left(a;"*"));";");";");
FIELD Depart := @Middle(a; "*"; "$");
FIELD Empl := @Middle(a; "$"; "#");
FIELD EmplNotesAdr:= @Explode(@Implode(@Trim(@Middle(a; "#"; "%"));";");";");
FIELD Replacer := @Trim(@Middle(a; "%"; "?"));
FIELD ReplacerNotesAdr := @Explode(@Implode(@Trim(@Middle(a; "?"; "+"));";");";");
FIELD ServerName:=@Explode(@Implode(@Trim(@Right(a;"+"));";");";");
REM {FIELD CtrlDate:=@Adjust(@Today;0;1;0;0;0;0 )};
FIELD a3:=@Date(@Today);
FIELD a6:=@Middle(a; "$"; "#")+"<< >> " ;
FIELD IndDepart:=IndDepart ;
FIELD Depart:=Depart;
FIELD Replacer :=@Unique(Replacer );
FIELD ReplacerNotesAdr:=@Unique(@Name([Abbreviate]; ReplacerNotesAdr));
FIELD ServerName:=@Unique(@Name([Abbreviate];ServerName));
@Command([RunAgent];"(CheckWall)");
@Command([RefreshFrame];"Document")
документооборот епта
+80
public class SQLExecutor {
..............
private static class Done extends RuntimeException {}
private static class Break extends RuntimeException {}
...............
public boolean init(....) {
Connection conn = null;
try {
..........
} catch (Done d) {
return true;
} catch (Break b) {
return false;
} finally {
cleanup();
}
return true;
}
}
+150
public function getBrandId() {
if (key_exists("id", $_GET)) {
return $_GET['id'];
} else {
return false;
}
}
Писала значимая фигура студии, между прочим.
+165
$nodes = $this->xmlDoc->getElementsByTagName($nodeName);
$count = 0;
for($i = 0; $i< $nodes->length; $i++)
{
$count++;
}
return $count;
И это при обработке 35-метрового xml файла с десятками и сотнями тысяч элементов.
Ять! За ногу и наизнанку, cyk@!
+146
Battle = new Class({
// Options
selected: 1,
onPopupClose: function() {},
// Class initalisation
initialize: function(options) {
Object.append(this, options);
},
// Open popup
initPopup: function(title, selection) {
this.selected = selection;
this.popup = new LightFace.Static({
title: title,
content: 'vote-options'
});
},
// Vote
vote: function(social_network) {
var share = this.selected == 1 ? this.share1 : this.share2;
var pic = this.selected == 1 ? this.pic1 : this.pic2;
var url = '';
if(social_network == 'fb') {
url = 'http://www.facebook.com/sharer.php?s=100';
url += '&p[title]=' + encodeURIComponent(this.text);
url += '&p[summary]=' + encodeURIComponent(share);
url += '&p[url]=' + encodeURIComponent(this.url);
url += '&p[images][0]=' + encodeURIComponent(pic);
} else if(social_network == 'tw') {
url = 'http://twitter.com/share?';
url += 'text=' + encodeURIComponent(this.text);
url += '&url=' + encodeURIComponent(this.url);
url += '&counturl=' + encodeURIComponent(this.url);
} else if(social_network == 'vk') {
url = 'http://vkontakte.ru/share.php?';
url += 'url=' + encodeURIComponent(this.url);
url += '&title=' + encodeURIComponent(this.text);
url += '&description=' + encodeURIComponent(share);
url += '&image=' + encodeURIComponent(pic);
url += '&noparse=true';
} else if(social_network == 'ok') {
url = 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1';
url += '&st.comments=' + encodeURIComponent(share);
url += '&st._surl=' + encodeURIComponent(this.url);
} else if(social_network == 'ml') {
url = 'http://connect.mail.ru/share?';
url += 'url=' + encodeURIComponent(this.url);
url += '&title=' + encodeURIComponent(this.text);
url += '&description=' + encodeURIComponent(share);
url += '&imageurl=' + encodeURIComponent(pic);
}
window.open(url,'','toolbar=0,status=0,width=626,height=436');
return this.vote_ns()
},
// Vote count
vote_ns: function() {
new Request({
url: '/vote/' + this.id + '/' + this.selected
}).send();
this.popup.close();
this.onPopupClose.delay(400);
var vote_count = $('vote-num-'+this.selected);
vote_count.set('text', vote_count.get('text').toInt() + 1);
$('vote-1').destroy();
$('vote-2').destroy();
$('voted_thank_you').show();
return false
},
// Askbook Promo
promoAskbook: function() {
this.promoBox = new LightFace.Static({
width: 500,
draggable: true,
title: 'AskBook.me',
content: 'askbook_promo'
});
}
});
Класс битв на 1001golos.ru
+135
class Program
{
static void Main(String[] args)
{
for (int i = 0; i < 10; i++)
{
Main();
}
}
}
Студент выдал такое в ответ на задание написать код, вызывающий функцию 10 раз. Пол часа бедняга втыкал откуда стэк оверфлоу...
+158
if(strlen(trim($row['article']))!=0)
{
// Some action
}
empty? не, это из будущего.
Суки! Сколько можно это писать!
+95
procedure TEditor.cbReverseClick(Sender: TObject);
begin
T.Reversed := not T.Reversed;
Show;
end;
Вместо
T.Reversed := cbReverse.Checked;
Интересно, может ли это создать баг?
+175
while ($new_width>$maxwidth) { $new_width *= 0.99; $new_height *= 0.99; }
while ($new_height>$maxheight) { $new_width *= 0.99; $new_height *= 0.99; }
Мега код из сайта написанного на InstantCMS
Вот так там уменьшаются картинки под максимальный размер...