- 1
- 2
- 3
- 4
- 5
my @idx = map{ (split(/\|/, $_))[0] || () }
map{ io($_)->chomp->slurp }
io($boardsdir)->filter(sub{ my $f = fileparse($_->name, qr/.txt/i);
$_->name =~ /\.txt$/i and grep{$_ eq $f} @board;
})->all_files;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−305.9
my @idx = map{ (split(/\|/, $_))[0] || () }
map{ io($_)->chomp->slurp }
io($boardsdir)->filter(sub{ my $f = fileparse($_->name, qr/.txt/i);
$_->name =~ /\.txt$/i and grep{$_ eq $f} @board;
})->all_files;
Так бывает, когда хочется одним предложением сказать все.
+152
<?php
mysql_connect ($server, $username, $password);
//Данные на базу
$lnk = mysql_connect('localhost', 'mysql_user', 'mysql_password')
or die ('Not connected : ' . mysql_error());
mysql_select_db('primecms_db', $lnk) or die ('Can\'t primecms_db foo : ' . mysql_error());
class insert{
var $pid, $alias, $text, $position, $status, $create_time, $modify_time;
}
function con_in($pid, $alias, $text_en, $text_ru, $text_descr, $position, $status, $create_time, $modify_time){
$res = new insert;
$res->pid=$pid;
$res->alias=addslashes($alias);
$res->text='<p>'.addslashes($text_en).'</p>\r\n<p>'.addslashes($text_ru).'</p>\r\n<p>'.addslashes($text_descr).'</p>';
$res->position=$position;
$res->status=$status;
$res->create_time=$create_time;
$res->modify_time=$modify_time;
return $res;
}
if ($_POST['send']){
$con = con_in($_POST['pid'],$_POST['alias'],$_POST['text_en'],$_POST['text_ru'],$_POST['text_descr'],$_POST['position'],$_POST['status'],$_POST['create_time'],$_POST['modify_time']);
mysql_query("INSERT INTO e118_glossary_items (`id`, `pid`, `alias`, `text`, `position`, `status`, `create_time`, `modify_time`) VALUES (".$con->pid.",".$con->alias.",".$con->text.",".$con->position.",".$con->status.",".$con->create_time.",".$con->modify_time.")");
}
?>
<form name="" action="" method="post">
Pid<input name="pid" size=30 type="text" value=""><br />
Allias<input name="allias" size=30 type="text" value=""><br />
text_en<input name="text_en" size=30 type="text" value=""><br />
text_ru<input name="text_ru" size=30 type="text" value=""><br />
text decr<textarea name="text_descr" rows=7 cols=50 wrap="off"></textarea><br />
position<input name="position" size=30 type="text" value=""><br />
status<input name="status" size=30 type="text" value=""> <br />
create_time<input name="create_time" size=30 type="text" value=""><br />
modify_time<input name="modify_time" size=30 type="text" value=""><br />
<input type="submit" value="Send" name="send"><br />
</form>
для инсёрта
назови insert.php
подправь //Данные на базу
+137.7
foreach ($_pp as $k => $v){
if ($v['qty'] == $_pp[$i*count($groups)]['qty']){
$qtys[$i][]=$v;
}
За такое надо кромсать
+138.7
<?
// ....
$POST_MAX_SIZE = ini_get('post_max_size');
$mul = substr($POST_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
// ....
?>
я ещё такой глубины условий не встречал в такой форме
+134
<?
for($i=0;$i<100;$i++){
header("Location: govnokod");
}
?>
xek
+147
$Domain="asdasasdsad.ru";
$Lookup = "nslookup $Domain";
$Results = shell_exec(EscapeShellCmd($Lookup));
if (preg_match("/$Domain/",$Results)) {
echo $Results;
echo "Домен Существует!";
} else {
echo "Домен не существует!";
}
php
+145.2
// тип System.Int32[]
int[] d = new int[0] { };
// тип System.Int32[,]
int[,] d = new int[3,0] { {}, {}, {} }
// тип System.Int32[,]
int[,] d = new int[1,0] { {} };
// тип System.Int32[, ,]
int[, ,] d = new int[2, 1, 0] { { { } }, { { } } };
// тип System.Int32[, , , , ,] и т.д.
int[, , , , ,] d = new int[1, 1, 1, 1, 1, 0] { { { { { { } } } } } };
// System.Int32[][][][][][][][][][][][][][][][][][][][][][][][][]
// (jagged array)
int[][][][][][][][][][][][][][][][][][][][][][][][][] d =
new int[5][][][][][][][][][][][][][][][][][][][][][][][][];
главное все работает
теперь осталось найти применение.. :)
+158.9
if(this.o)
{
if((cur=='1')||(cur=='2'))cur='2';
if((cur=='3')||(cur=='4'))cur='4';
if((cur=='5')||(cur=='6'))cur='6';
if((cur=='7')||(cur=='8'))cur='8';
};
/*
Ну а чувакам пИсавшим эту функциию, посвящается:
*/
if(cur & 1)
++cur;
Фрагмент кода из CMS Bitrix 7
+170.5
float F(){
return F0() - mu() + Fs() + Fa()+3;
}//
Говнокод "по-студенчески": Ответ не сходился на тройку... :)
Мультикасса.
+108
return ((int)(Counter / 2) != Counter / 2.00 && Counter != 0);
Не садил, так не ломай - у нас сегодня первомай :D
Оставили в продакшене, чисто для музейной ценности :D