- 1
$todayweekday = date("w", mktime(0, 0, 0, date("m"), date("d"), date("Y")));
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+54
$todayweekday = date("w", mktime(0, 0, 0, date("m"), date("d"), date("Y")));
апофеоз
−34
int ConditionsTuple(const bool Condition1, const bool Condition2)
{
return (Condition1<<1) + Condition2;
}
template <bool Condition1, bool Condition2>
struct TConditionsTuple
{
enum {Result = (Condition1<<1) + Condition2};
};
float SignedIf(const bool Condition)
{
return Condition ? -1 : 1;
}
switch (ConditionsTuple(
bExpr1,
bExpr2
))
{
case TConditionsTuple<1, 1>::Result:
return PArc(new TArc(
CouplePointAtPrimitive1,
CouplePointAtPrimitive2,
ArcCoupleCenter,
Abs(arcCoupleRadius)
));
case TConditionsTuple<0, 1>::Result:
throw TPrimitive1HalfLengthExpiredException();
case TConditionsTuple<1, 0>::Result:
throw TPrimitive2HalfLengthExpiredException();
case TConditionsTuple<0, 0>::Result:
throw TAllPrimitivesHalfLengthExpiredException();
}
+96
public bool IsStandart
{
get { return IsStandart; }
set { IsStandart = value; }
}
+155
var nav = document.getElementById('navigation');
var properties = {
'display' : 'block',
'position' : 'fixed',
'top' : '5px',
'backgroundColor' : '#F2F0E3',
'opacity' : '.6',
........
//Много всяких свойств
........
'border' : '2px solid #DDDDDD',
'borderRadius' : '1em',
'padding' : '5px',
'zIndex' : '1'
}
for (var i in properties) {
nav.style[i] = properties[i];
}
Послать бы автора на три буквы: CSS
−40
/*
* This GtkIMHtml has the maximum number of smileys allowed, so don't
* add any more. We do this for performance reasons, because smileys
* are apparently pretty inefficient. Hopefully we can remove this
* restriction when we're using a better HTML widget.
*/
unescaped = purple_unescape_html(smiley);
numsmileys_thismsg = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(imhtml), "gtkimhtml_numsmileys_thismsg"));
if (numsmileys_thismsg >= 30) {
gtk_text_buffer_insert(imhtml->text_buffer, iter, unescaped, -1);
g_free(unescaped);
return;
}
numsmileys_total = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(imhtml), "gtkimhtml_numsmileys_total"));
if (numsmileys_total >= 300) {
gtk_text_buffer_insert(imhtml->text_buffer, iter, unescaped, -1);
g_free(unescaped);
return;
}
Вот такой прикол от Pidgin. Больше 30 смайлов в сообщении и 300 в диалоге - низя. Захардкодили, ибо стыдно, что тормозит. А оно действительно тормозит.
+88
Посоны, Я думал, что то, что вы здесь выкладываете - это выдумки и неправда.
Теперь Я работаю в команде...
+78
/*при всем этом работает как часы*/
...
foreach ($array as $k=>$v) {
$k++
if ($k==300) {
die ('выходим потому что 5');
}
...
маленькая часть большого парсера
+62
if($col == "#eeeeee"){
$col = "#ffffff";
}else{
$col = "#eeeeee";
}
Нашел на просторах интернета скрипт, а в нем вот это. $col нигде не присваивается.
+116
short lPort = atoi(szTemp);
if (lPort <= 0 || lPort > 65535)
lPort = 80;
−24
map<HANDLE,VRwnd*> windows;
LRESULT WndProc(HANDLE h,UINT ui,WPARAM w,LPARAM m)try{
return windows.at(h)->Process(ui,w,l);
}catch(...){ return 0;}
class VRwnd{
HANDLE h;
protected:
map<UINT,function<LPRESULT(WPARAM,LPARAM)> handlers;// заполняется в конструкторе
map<int,VRwnd*> idChilds;
map<HANDLE,VRwnd*> Childs;
public:
virtual ~VRwnd();
LRESULT Process(UINT ui,WPARAM w,LPARAM m)try{
PreProcess(w,l);// сами решайте, давать фильтру на что-то влиять, или нет.
if(ui==WM_NOTIFY) return WmNotify(w,m) ;
if(ui==WM_NOTIFY) return WmCommand(w,m) ;
return handlers.at(ui).second(w,l);
}
catch(...){return 0;}
LPRESULT WmNotify(WPARAM w,LPARAM m){...}
LPRESULT WmCommand(WPARAM w,LPARAM m){...}
virtual LPRESULT PreProcess(WPARAM w,LPARAM m){return 0;}
};