- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
// создает массив с заданным кол-вом ячеек
function array_from_int($count,$val=true,$start=0)
{
$fcount = $count+$start;
for($i=$start;$i<$fcount;$i++)
{
$arr[$i] = $val;
}
return $arr;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+165
// создает массив с заданным кол-вом ячеек
function array_from_int($count,$val=true,$start=0)
{
$fcount = $count+$start;
for($i=$start;$i<$fcount;$i++)
{
$arr[$i] = $val;
}
return $arr;
}
+159
if ($rightDisplayDelete == 1) {
$images = $model->getData(1);
$this->tmpl['pagination'] = &$model->getPagination(1);
} else {
$images = $model->getData(0);
$this->tmpl['pagination'] = &$model->getPagination(0);
}
И снова модуль Phocagallery для Joomla!
+171
function trim_and_screening(&$item, $key)
{
$item = '`'.$item.'`';
}
+147
function index($name) {
return is_numeric($name)?'_'.$name:(int)substr($name,1);
}
универсальная функция для... угадайте, для чего?
+131
http://molinos.ru/portfolio/a/1/1/
Ждем загрузку, смотрим код. Офигеваем от 300К+ табуляций.
−134
# Fallback static file handler, now with XSendfile support.
if not if(test -f $local_path) {
if(! ~ $#xsendfile 0) {
if(! ~ $#xsendfile_alternate 0)
XSendfileHeader='X-Accel-Redirect'
if not
XSendfileHeader='X-Sendfile'
echo $XSendfileHeader': '`{pwd}^'/'$local_path
}
if not
static_file $local_path
}
if not if(~ $req_path /pub/* && test -f .$req_path) {
if(! ~ $#xsendfile 0) {
if(! ~ $#xsendfile_alternate 0)
XSendfileHeader='X-Accel-Redirect'
if not
XSendfileHeader='X-Sendfile'
echo $XSendfileHeader': '`{pwd}^'/'$req_path
}
if not
static_file .$req_path
}
+160
// There is an error while creating thumbnail in m or in s or in l
if ($creatingSError || $creatingMError || $creatingLError) {
// if all or two errors appear, we only display the last error message
// because the errors in this case is the same
if ($errorMsgS != '') {
$creatingError = $errorMsgS;
}
if ($errorMsgM != '') {
$creatingError = $errorMsgM;
}
if ($errorMsgL != '') {
$creatingError = $errorMsgL;
} // because the errors in this case is the same
$returnFrontMessage = $creatingError;
} else if ($errorMsgS == '' && $errorMsgM == '' && $errorMsgL == '') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == '' && $errorMsgM == '' && $errorMsgL == 'ThumbnailExists') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == '' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == 'ThumbnailExists') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == '' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == '') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == '') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == '' && $errorMsgL == '') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == '' && $errorMsgL == 'ThumbnailExists') {
$returnFrontMessage = 'Success';
}
Модуль phocagallery для joomla. Кусок кода в функции генереции превьюшек 3х разных размеров.
−98
# -*- coding: cp1251 -*-
beer = u"бутылок пива стоят на столе. Одна упала."
botle = 100
for i in range(1, 100):
print (botle-i), beer
print u"Нету больше пива на столе :-("
Пива не будет :-(
+141
[uuid(CAC0EDB3-0F36-4CF2-B133-7DDB02CCD1D2)]
Часть IDL, обратил внимание на букво-цифры в начале :)
Just4Fun...
+147
// ...
// Количество распиленных досок
$spl = 0;
// Количество использованных пакетов
$clpz = 0;
if ($spl === 0) {
for ($ix = 1; $ix <= $cll; $ix++) {
$dsk[$ix] = $dd;
}
}
// ....
Встретился вот такой код. Условие по моему тут лишнее :)