- 1
write_ext = ".pgm\0.ppm\0.ppm\0.pam" + colors*5-5;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+147
write_ext = ".pgm\0.ppm\0.ppm\0.pam" + colors*5-5;
из dcraw.c - кладезь вот таких перлов. то ли говнокодер писал - то ли гений. настолько лаконичного кода давно уже не видел.
http://www.cybercom.net/~dcoffin/dcraw/
+165
$iDateStamp = mktime(0,0,0);
$sDateStr = strftime("%y%m%d");
do {
$iRand = rand(1,999);
$s = "select * from slZakaz where iDateStamp='$iDateStamp' and iUnique='$iRand' ";
$iRes = mysql_query($s);
if ($iRes){
if (mysql_num_rows($iRes)==0){
@mysql_query("insert into slZakaz (iDateStamp, iUnique) values ('$iDateStamp', '$iRand')");
break;
}
}
} while (true);
$iRandStr = sprintf('%03d', $iRand);
$sOrderStr = $sDateStr.'.'.$iRandStr;
Мне одному страшно?
−155
Девушкой, которую я любил
Оказался педофил
Он на 1С все показал
И научил
Теперь я здесь настраиваю все
Прямо как во сне
Александр Сергеевич Пушкин-Блок
+106
procedure Tform1.mix;
begin
randomize;
a[1]:=random(16)+1;
btn[1].Caption:=inttostr(a[1]);
begin
repeat
a[2]:=random(16)+1
until
a[2]<>a[1];
btn[2].Caption:=inttostr(a[2]);
begin
repeat
a[3]:=random(16)+1
until
(a[3]<>a[2]) and (a[3]<>a[1]);
btn[3].Caption:=inttostr(a[3]);
begin
repeat
a[4]:=random(16)+1
until
(a[4]<>a[2]) and (a[4]<>a[1]) and (a[4]<>a[3]);
btn[4].Caption:=inttostr(a[4]);
begin
repeat
a[5]:=random(16)+1
until
(a[5]<>a[2]) and (a[5]<>a[1]) and (a[5]<>a[3]) and (a[5]<>a[4]);
btn[5].Caption:=inttostr(a[5]);
begin
repeat
a[6]:=random(16)+1
until
(a[6]<>a[1]) and (a[6]<>a[2]) and (a[6]<>a[3]) and (a[6]<>a[4])
and (a[6]<>a[5]);
btn[6].Caption:=inttostr(a[6]);
begin
repeat
a[7]:=random(16)+1
until
(a[7]<>a[1]) and (a[7]<>a[2]) and (a[7]<>a[3]) and
(a[7]<>a[4]) and (a[7]<>a[5]) and (a[7]<>a[6]);
btn[7].Caption:=inttostr(a[7]);
begin
repeat
a[8]:=random(16)+1
until
(a[8]<>a[1]) and (a[8]<>a[2]) and (a[8]<>a[3]) and
(a[8]<>a[4]) and (a[8]<>a[5]) and (a[8]<>a[6]) and (a[8]<>a[7]);
btn[8].Caption:=inttostr(a[8]);
begin
repeat
a[9]:=random(16)+1
until
(a[9]<>a[1]) and (a[9]<>a[2]) and (a[9]<>a[3]) and (a[9]<>a[4]) and
(a[9]<>a[5]) and (a[9]<>a[6]) and (a[9]<>a[7]) and (a[9]<>a[8]);
btn[9].Caption:=inttostr(a[9]);
...
...
...
begin
repeat
a[14]:=random(16)+1
until
(a[14]<>a[1]) and (a[14]<>a[2]) and (a[14]<>a[3])
and (a[14]<>a[4]) and (a[14]<>a[6]) and
(a[14]<>a[7]) and (a[14]<>a[5]) and (a[14]<>a[9])
and (a[14]<>a[8]) and (a[14]<>a[10]) and
(a[14]<>a[11]) and (a[14]<>a[12]) and (a[14]<>a[13]);
btn[14].Caption:=inttostr(a[14]);
begin
repeat
a[15]:=random(16)+1
until
(a[15]<>a[1]) and (a[15]<>a[2]) and (a[15]<>a[3]) and
(a[15]<>a[4]) and (a[15]<>a[6]) and (a[15]<>a[7]) and
(a[15]<>a[5]) and (a[15]<>a[9]) and (a[15]<>a[8]) and
(a[15]<>a[10]) and (a[15]<>a[11]) and (a[15]<>a[12])
and (a[15]<>a[13]) and (a[15]<>a[14]);
btn[15].Caption:=inttostr(a[15]);
begin
repeat
a[16]:=random(16)+1
until
(a[16]<>a[1]) and (a[16]<>a[2]) and (a[16]<>a[3]) and
(a[16]<>a[4]) and (a[16]<>a[6]) and (a[16]<>a[7]) and
(a[16]<>a[5]) and (a[16]<>a[9]) and (a[16]<>a[8]) and
(a[16]<>a[10]) and (a[16]<>a[11]) and (a[16]<>a[12])
and (a[16]<>a[13]) and (a[16]<>a[14]) and (a[16]<>a[15]);
btn[16].Caption:=inttostr(a[16]);
timer3.Enabled:=true;
end; end; end; end; end; end; end; end; end;
end; end; end; end; end; end; end;
Это у меня однокурсник писал пятнашки(данная процедура заполняет массив неповторяющимися числами от одного пятнадцати), и не лень же ему было...
−94
def format_price price, delimeter = ' '
s, i = price.to_s.reverse, 0
Array.new(s.size) do |n|
c = n.zero? ? '' : ((i += 1) % 3).zero? ? delimeter.to_s : ''
c + s[n, 1]
end.join.reverse
end
10000 -> "10 000"
Как такое вообще принято делать между ровными пацанами?
+162
<tbody>
<script type="application/json">
{
"remoteURL" : "/index.php?module=User&controller=Ajax_Group",
"saveState" : true,
"browseable":
{
"entriesTotal": {$amountGroups},
"entriesPage": {$itemsPerPage},
"activePage": {$activePage}
},
"columns":
{
"title":
{
"dataType": "string"
},
"description":
{
"dataType": "string"
}
},
"searchable":
{
"searchCols": [ "title", "description" ],
"activeSearch": "{addcslashes( $searchTerm, '"' )}",
"minSearchLength" : {$searchMinWordLength}
},
"sortable":
{
"sortCols": [ "title", "description" ],
"activeCol":
{
"column": "{$sortColumn}",
"sortDir" : "{$sortDirection}"
}
},
"clickable":
{
"defaultAction": [ "{Common_Image_Icon_Ajax::EDIT}" ]
}
}
</script>
{foreach $Groups as $Group}
{$group_id = $Group->getGroup_Id()}
<tr>
{if $rightToExport}
<td class="selector"><input type="checkbox" name="checkedGroups[]" value="{$group_id}"></td>
{/if}
<td>{$Group->escapeTitle()}</td>
<td>{$Group->escapeDescription()}</td>
{if $rightEdit || $rightDelete || $rightMail}
<td class="actions">
{Common_Image_Icon_Overlay::fetchIcon(Common_Image_Icon::EDIT, _( 'Edit' ), Common_Http_Query::fetch( ['module' => 'User', 'controller' => 'Overlay_Group', 'action' => 'edit', 'id' => $Group->getGroup_Id()] ))}
{if $rightDelete}
{$sql = "SELECT assessment_id FROM cobit_assessments WHERE usergroup_id = {$Group->getGroup_Id()} LIMIT 0,1"}
{$MySqlI = DatabaseConnector::getConnector()}
{$Result = $MySqlI->query( $sql )}
{if !( is_object( $Result ) and $Result->getNumRows() > 0 )}
{Common_Image_Icon_Ajax::fetchDelete( _( 'Delete' ), _( 'Do you really want to delete this Group?' ), Common_Http_Query::fetch( ['module' => 'User', 'controller' => 'Ajax_Group', 'action' => 'delete', 'id' => $Group->getGroup_Id()] ), $Group->getGroup_Id() )}
{else}
{Common_Image_Icon::fetchIcon(Common_Image_Icon::INFO, _("User Group is not deletable, because it is in use."))}
{/if}
{/if}
{if $rightMail}
{$sJavaScriptAction = Common_Event_Trigger_Overlay::fetch( Common_Event_Trigger_Overlay::OPEN, [ 'url' => "/index.php?module=User&controller=Overlay_Group&action=sendGroupMail&id={$Group->getGroup_Id()}"] )}
{Common_Image_Icon_Ajax::fetchIcon( Common_Image_Icon_Ajax::EMAIL, _('Send mail'), $sJavaScriptAction)}
{/if}
</td>
{/if}
</tr>
{/foreach}
</tbody>
Smarty Ajax SQL Table
Как все таки вставить SQL в Smarty.
−119
...
IF i.TYPE IS NOT NULL AND i.TYPE IS NOT NULL THEN
INSERT INTO R_ACTIVITY_PARAMETER( ACTIVE_FLAG,PROPERTY,PARAMETER_DOMAIN,SOURCE,DESCRIPTION,CODE)
VALUES('1',i.TYPE,i.R_ACTIVITY_1_INS_180,i.SOURCE_TYPE,i.DESCRIPTION,i.TYPE);
...
Oracle 10.2
Может быть это какой-то "нездоровый" кодогенератор...
−110
UPDATE ...
SET ...
WHERE ...
AND NVL(fndr_constraint,'ABC')=NVL('','ABC')
...
Oracle 10.2 продакшн код.
Это прям какое-то нездоровое влечение к NVL...
+159
# Выполнение действий в транзакции
$this->Sql->UseTransaction = true;
$this->Sql->Transaction( "START" );
# Удаление хэша для востановления пароля
$this->Sql->SQLUpdate( "int[user]", array( "jRecovery" => "" ), array( "jRecovery" => $_GET['uniq'] ) );
# Обновление пароля
$this->Sql->SQLUpdate( "int[user]", array( "password" => self::PWD_HASH( $jNewpass ) ), array( "jRecovery" => $_GET['uniq'] ) );
# Запись данных в СУБД
$this->Sql->Transaction( "COMMIT" );
# Уведомление пользователя по средствам электронной почты
self::SEND_MESS_END_REG( $jRowset['mail'], $jRowset['username'], $jNewpass );
Часть кода... Вчера сонный, жутко уставший, сидел вырубался, и около часа не мог понять, как так почему письмо приходит, а в нём не верный пароль О_о, я мол не мог ошибку допустить, «психнул», и забил на это дело, а сегодня «отдахнувши», вчитался, и такая нелепая ошибка)))
Так, что если, что-то не работает, то идите и отдыхайте)))
+136
<div id="steklo">
<div class="sloy1">
<?php include ("modul/header_modul/header_modul.html") ?>
</div>
<?php include ("modul/rasdelitel/rasdelitel.html") ?>
<div class="sloy1">
<table id="absolut-content">
<tr>
<td>
<?php include ("modul/content_modul/content_modul.html") ?>
<div id="futer">футер</div>
</td>
</tr>
</table>
</div>
</div>
Обнаружил в проекте знакомого. Впечатлило. Теперь чувствую себя уютненько ^^ "Хорошо, хорошо... хорошо что у меня такого нету"