- 1
return $lines[(rand(0,count($lines)-1)*10)/10]; // ололо, говнокод, но так лучше работает 0_o
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+158
return $lines[(rand(0,count($lines)-1)*10)/10]; // ололо, говнокод, но так лучше работает 0_o
Нашел в своём, относительно недавно, написанном коде. Под чем я это писал?! В упор не помню..
А что самое страшное - я же знаю про array_rand(). Хотя, тут больше доставляет *10/10.
−106
function onClick(e:MouseEvent):void{
window.visible=true;
clos.visible=true;
count=Math.round(Math.random()*5);
trace (count);
for(i; i<6; i++){
trace ("вцикле")
if(i==count){
window.fish.text=arr1[i];
count=0;
}
}
}
Удивительная фантазия - сначала вычисляем рандом, а потом в цикле с ним сравниваем. И если "да, наконец-то это оно", то тогда присваиваем значение.
(с) flasher.ru
+150
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Scouting table</title>
</head>
<?php
$t=floor((time()-1286582400)/86400);
$a=17+floor($t/112);
$b=(($t/112)-(floor($t/112)))*112;
$c=17+floor(($t+1)/112);
$d=((($t+1)/112)-(floor(($t+1)/112)))*112;
$e=$a+1;
$f=$e+1;
{echo
("<table align=\"center\" border=\"1\">
<tr align=\"center\">
<td>Scouting table</td><td colspan=\"3\"> Scout by age</td>
</tr>
<tr align=\"center\">
<td>Position</td><td>WC17 - 17 years 0 days - $a years $b days</td><td>WC16 - $c years $d days - $e years $b days</td><td>WC15 - $f years $d days - 20 years 111 days</td>
</tr>
<tr align=\"center\">
<td>Goalkeepers</td><td>***** <a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td><td>*****<a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td><td>*****<a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td>
</tr>
<tr align=\"center\">
<td>Defenders</td><td>***** <a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td><td>*****<a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td><td>*****<a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td>
</tr>
<tr align=\"center\">
<td>Playmakers</td><td>*****<a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td><td>*****<a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td><td>*****<a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td>
</tr>
<tr align=\"center\">
<td>Wingers</td><td>*****<a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td><td>*****<a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td><td>***** <a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td>
</tr>
<tr align=\"center\">
<td>Forwards</td><td>*****<a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td><td>*****<a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td><td>*****<a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td>
</tr>
</table>
<table align=\"center\">
<tr align=\"center\">
<td>Chief Scout: *****<a href=\"http://www.hattrick.org/Club/?TeamID=*****\">(*****)</a></td>
</tr>
</table>");}
?>
<body>
</body>
</html>
Вместо звездочек строки html) Замазал)
−188
if @WhatShow=0 /* Teachers and Students */
SELECT FieldName, TableName, Action, FieldValue, ComputerName, UserName, DateInput FROM tblLog WHERE RowID=-3456123 OR RowID=-3456124 ORDER BY DateInput DESC
if @WhatShow=1 /* Teachers ONLY */
SELECT FieldName, TableName, Action, FieldValue, ComputerName, UserName, DateInput FROM tblLog WHERE RowID=-3456123 ORDER BY DateInput DESC
if @WhatShow=2 /* Students ONLY */
SELECT FieldName, TableName, Action, FieldValue, ComputerName, UserName, DateInput FROM tblLog WHERE RowID=-3456124 ORDER BY DateInput DESC
Код TSQL процедурки используемой приложением сторонних девелоперов. ID строк с информацией по логинам впечатляют. Эти цифры явно несут на себе какую-либо магическую нагрузку и имеют смысл, который далеко не каждому дано понять.
+159
<?php
session_start();
define('_JEXEC', 1);
$host = $_SERVER['DOCUMENT_ROOT'];
include $host.'/admin/function.php';
include $host.'/data/conf.php';
include $host.'/data/settings.php';
$templates = $system['templates'];
$content = file_get_contents($host.'/design/'.$templates.'/index.tpl');
$result = mysql_query(" SELECT * FROM news WHERE section='index' ");
$myrow = mysql_fetch_array($result);
$result2 = mysql_query(" SELECT * FROM slogan ");
$myrow2 = mysql_fetch_array($result2);
$index_news = $myrow['news'];
$title = $myrow['title'];
$description = $myrow['description'];
$keywords = $myrow['keywords'];
$menu='';
function callback($s) {$GLOBALS['menu'].=$s; }
ob_start('callback');
include $host.'/data/site_content/menu.php';
ob_end_flush();
$menu="$menu";
$content=str_replace('{templates}', $templates, $content);
$content=str_replace('{menu}', $menu, $content);
$content=str_replace('{content}', $index_news, $content);
$content=str_replace('{slogan_name}', $myrow2['slogan_name'], $content);
$content=str_replace('{slogan}',$myrow2['slogan'], $content);
$content=str_replace('{title}', $title, $content);
$content=str_replace('{description}', $description, $content);
$content=str_replace('{keywords}', $keywords, $content);
echo $content;
?>
−178
if <fr_Pipeline1."OPERNAME"> = 'Тупаков Н.В.' then Memo50.Text:='Телефон: 350-24-53';
if <fr_Pipeline1."OPERNAME"> = 'Абрамовна Мария Н.' then Memo50.Text:='Телефон: 531-39-86';
if <fr_Pipeline1."OPERNAME"> = 'Кошкина Р.Ф.' then Memo50.Text:='Телефон: 170-83-28';
if <fr_Pipeline1."OPERNAME"> = 'Шабанов Д.Л.' then Memo50.Text:='Телефон: 981-04-61';
if <fr_Pipeline1."OPERNAME"> = 'Ирискина Рита Н.' then Memo50.Text:='Телефон: 330-58-55';
if <fr_Pipeline1."OPERNAME"> = 'Бъенсе Н.Б.' then Memo50.Text:='Телефон: 761-77-93';
if <fr_Pipeline1."OPERNAME"> = 'Батрудинова О.П.' then Memo50.Text:='Телефон: 580-55-42';
if <fr_Pipeline1."OPERNAME"> = 'Кудина Д.М.' then Memo50.Text:='Телефон: 440-61-62';
Повторение мать учения :))
+166
if (isset($_GET["url"])) {
$nombre_archivo = $_GET["url"];
$consulta = "SELECT * FROM descargas_archivos WHERE nombre_archivo LIKE '".$nombre_archivo."' ";
$resultado = mysql_query($consulta);
if (mysql_num_rows($resultado)>0) {
$actualiza = "UPDATE descargas_archivos SET num_descargas = num_descargas + 1 WHERE nombre_archivo LIKE '".$nombre_archivo."' ";
mysql_query($actualiza);
}
else {
$inserta_nuevo = "INSERT INTO descargas_archivos (nombre_archivo) VALUES ('".$nombre_archivo."')";
mysql_query($inserta_nuevo);
}
}
Классика.
+164
# Обрабатываем встроенные теги
$msg = str_replace("[u]", "<u>", $msg);
$msg = str_replace("[U]", "<u>", $msg);
$msg = str_replace("[i]", "<i>", $msg);
$msg = str_replace("[I]", "<i>", $msg);
$msg = str_replace("[b]", "<b>", $msg);
$msg = str_replace("[B]", "<b>", $msg);
$msg = str_replace("[sub]", "<sub>", $msg);
$msg = str_replace("[SUB]", "<SUB>", $msg);
$msg = str_replace("[sup]", "<sup>", $msg);
$msg = str_replace("[SUP]", "<sup>", $msg);
$msg = str_replace("[/u]", "</u>", $msg);
$msg = str_replace("[/U]", "</u>", $msg);
$msg = str_replace("[/i]", "</i>", $msg);
$msg = str_replace("[/I]", "</i>", $msg);
$msg = str_replace("[/b]", "</b>", $msg);
$msg = str_replace("[/B]", "</b>", $msg);
$msg = str_replace("[/SUB]", "<sub>", $msg);
$msg = str_replace("[/sub]", "</sub>", $msg);
$msg = str_replace("[/SUP]", "</sup>", $msg);
$msg = str_replace("[/sup]", "</sup>", $msg);
Года 4 назад пришлось лазить и исправлять код чужой гостевухи,
вот такое встретилось, и это ещё не хит ;-)
−155
sub write_cookie {
my %params = @_;
if ($params{'-expires'} =~ /\+(\d+)m/) {
my ($sec, $min, $hour, $mday, $mon, $year, $wday) = gmtime($date + $1 * 60);
$year += 1900;
my @mos = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
my @dys = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
$mon = $mos[$mon];
$wday = $dys[$wday];
$params{'-expires'} = sprintf("%s, %02i-%s-%04i %02i:%02i:%02i GMT", $wday, $mday, $mon, $year, $hour, $min, $sec);
}
$params{'-path'} = " path=$params{'-path'};" if $params{'-path'};
$params{'-expires'} = " expires=$params{'-expires'};" if $params{'-expires'};
"$params{'-name'}=$params{'-value'};$params{'-path'}$params{'-expires'}";
}
setcookie() Perl-вариант.
+106
FilterKey = 'Software'+'\'+CompanyName+'\'+ApplName+'\'+ApplVersion+'\'+SettingsKey+'\'+'FilterDD';
OrderKey = 'Software'+'\'+CompanyName+'\'+ApplName+'\'+ApplVersion+'\'+SettingsKey+'\'+'OrderDD';
NotepadKey = 'Software'+'\'+CompanyName+'\'+ApplName+'\'+ApplVersion+'\'+SettingsKey+'\'+'Notepad';
повторение - мать учения