- 1
print implode('-', array_reverse(explode('-', trim(substr($project->start_date, 0, count($project->start_date) - 9)))));
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+153
print implode('-', array_reverse(explode('-', trim(substr($project->start_date, 0, count($project->start_date) - 9)))));
Форматирует дату с Y-m-d в d-m-Y. Альтернатива для
date_format(new DateTime($project->start_date), 'd-m-Y');
+70
{
final int p = page;
final boolean current = p == 1;
this.pagercell(writer, current, 1, "<<");
}
for (int p = page - this.size; p < page; p++) {
if (p >= 1) {
final boolean current = p == 1;
this.pagercell(writer, current, p);
}
}
{
final int p = page;
final boolean current = (p - this.size) < 1;
this.pagercell(writer, current, p - this.size, "<");
}
{
final int p = page;
final boolean current = p == page;
this.pagercell(writer, current, p);
}
{
final int p = page;
final boolean current = (p + this.size) > pages;
this.pagercell(writer, current, p + this.size, ">");
}
for (int p = page + 1; p <= (page + this.size); p++) {
if (p <= pages) {
final boolean current = p == pages;
this.pagercell(writer, current, p);
}
}
{
final int p = page;
final boolean current = p == pages;
this.pagercell(writer, current, pages, ">>");
}
веселый вывод постраничной навигации (кусок метода)
+64
short someShort = (short) (someBoolean ? 15 : 42);
такая удобная Java
+157
setcookie('password', $passHash , time() + $this::TIME_COOKIE * 1000 + $remember ? $this::TIME_COOKIE_REMEMBER : 0 * 1000 );
И я то думал, почему кука не появляется...
+143
+++++[>++>+++[>+++>+++<<-]>+<<<-]+++[>>>-.<[>>.>+<<+.<-]<.>>+.>>+[<.<-.<+>>>-]<<+<+<.<-]
Brainfuck, задача - вывести
1
2-1
1-2-3
4-3-2-1
1-2-3-4-5
6-5-4-3-2-1
Из этой ветки: http://habrahabr.ru/post/116842/#comment_3794462
+141
...
else if ( (!BG_InSpecialJump( legsAnim )//not in a special jump anim
||BG_InReboundJump( legsAnim )//we're already in a rebound
||BG_InBackFlip( legsAnim ) )//a backflip (needed so you can jump off a wall behind you)
//&& pm->ps->velocity[2] <= 0
&& pm->ps->velocity[2] > -1200 //not falling down very fast
&& !(pm->ps->pm_flags&PMF_JUMP_HELD)//have to have released jump since last press
&& (pm->cmd.forwardmove||pm->cmd.rightmove)//pushing in a direction
//&& pm->ps->forceRageRecoveryTime < pm->cmd.serverTime //not in a force Rage recovery period
&& pm->ps->fd.forcePowerLevel[FP_LEVITATION] > FORCE_LEVEL_2//level 3 jump or better
//&& WP_ForcePowerAvailable( pm->gent, FP_LEVITATION, 10 )//have enough force power to do another one
&& BG_CanUseFPNow(pm->gametype, pm->ps, pm->cmd.serverTime, FP_LEVITATION)
&& (pm->ps->origin[2]-pm->ps->fd.forceJumpZStart) < (forceJumpHeightMax[FORCE_LEVEL_3]-(BG_ForceWallJumpStrength()/2.0f)) //can fit at least one more wall jump in (yes, using "magic numbers"... for now)
//&& (pm->ps->legsAnim == BOTH_JUMP1 || pm->ps->legsAnim == BOTH_INAIR1 ) )//not in a flip or spin or anything
)
{//see if we're pushing at a wall and jump off it if so
if ( allowWallGrabs )
{
//FIXME: make sure we have enough force power
//FIXME: check to see if we can go any higher
//FIXME: limit to a certain number of these in a row?
//FIXME: maybe don't require a ucmd direction, just check all 4?
//FIXME: should stick to the wall for a second, then push off...
...
Больше условий богу условий!
Jedi Academy source, 2003
+148
var attr_class = document.createAttribute("class");
attr_class.nodeValue="th_tr";
th.setAttributeNode(attr_class);
И нет, attr_class больше нигде не используется. Кто-то из наших сотрудников экспериментировал, похоже.
+13
Официальный тред для каклосрача
срать тут ↓
+81
procedure SetCurrentThreadName(const AName: String);
type
TThreadNameInfo = record
RecType: LongWord;
Name: PChar;
ThreadID: LongWord;
Flags: LongWord;
end;
var
LThreadNameInfo: TThreadNameInfo;
begin
with LThreadNameInfo do
begin
RecType := $1000;
Name := PChar(AName);
ThreadID := $FFFFFFFF; // -1 - текущий поток; также сюда можно вставить ID другого потока
Flags := 0;
end;
try
RaiseException($406D1388, 0, SizeOf(LThreadNameInfo) div SizeOf(LongWord),
PDWord(@LThreadNameInfo));
except
end;
end;
Попытка создать именованный поток.
Не хак. (http://msdn.microsoft.com/en-us/library/xcb2z8hs%28VS.71%29.aspx)
+140
@echo brutushafens, если ты есть вконтакте, добавь меня в друзья, поговорим. vk.com/cageo
@echo если тебя нет вконтакте, напиши мне на [email protected].
@pause
Послание для brutushafens :)