- 1
((100 - ((coef - 1) * 10)) / 0.5)
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144
((100 - ((coef - 1) * 10)) / 0.5)
Охренительные познания математики 5 класса комплектуются абсолютным отсутствием здравого смысла.
−125
while (<>)
{
chomp;
s/\r$//;
next unless $_;
my ($tag, $value) = split / /, $_, 2;
die "Font is not fixed width\n"
if $tag eq 'SPACING' and not $value =~ /[CM]/i;
$currentchar = $value if $tag eq 'ENCODING';
$minchar = $currentchar if not defined $minchar
or ($currentchar < $minchar && $currentchar >= 0);
$maxchar = $currentchar if not defined $maxchar
or ($currentchar > $maxchar && $currentchar >= 0);
И дальше в том же духе...
Взято из файла bdf2gdfont.pl
−124
# Relocate
if (open(my $reloc, "support/reloc.txt")) {
# ...
print "Relocating...";
my $count = 0;
local $_;
while (<$reloc>) {
chomp;
my($type, $f) = split(' ', $_, 2);
$f = "$prefix/$f";
$f =~ s,/,\\,g;
#print "Relocating $f...\n";
my $read_only;
unless (-w $f) {
$read_only++;
run("\@attrib", "-r", $f);
}
open(my $fh, "+<", $f) || die "Can't open $f: $!";
binmode($fh);
my $content = do { local $/; <$fh> };
if ($type eq "B") {
$content =~ s,\Q$sponge\E([^\0]*),$prefix$1$binary_pad,go;
}
else {
$content =~ s,\Q$sponge\E,$prefix,go;
$content =~ s,\Q$sponge_str\E,$prefix_str,go if $^O eq "MSWin32";
truncate($fh, length($content)) || die "Can't truncate '$f': $!";
}
seek($fh, 0, 0) || die "Can't reset file pos on '$f': $!";
print $fh $content;
close($fh) || die "Can't write back content to '$f': $!";
run("\@attrib", "+r", $f) if $read_only;
$count++;
}
print "done ($count files relocated)\n";
}
установщик перл...
reloc.txt содержит 137 файлов.
−34
#define _ F-->00 || F-OO--;
long F=00,OO=00;
main(){F_OO();printf("%1.3f\n", 4.*-F/OO/OO);}F_OO()
{
_-_-_-_
_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_
_-_-_-_
}
так расчитывается число пи. я не мог этого не запостить.
+173
$z="select team,r1,ochko from gametable order by pos ";$q=mysql_query($z); //присваиваю переменной данные из таблтцы
$i=0;
while($inf=mysql_fetch_array($q,MYSQL_ASSOC)){
$i++;
if($inf['team']=="ManchesterUnited"){$inf['team']="<b>ManchesterUnited</b>";
}
$row=array("class=\"row-2\"","class=\"row-3\"","class=\"row-4\"","class=\"row-5\"","class=\"row-6\"","class=\"row-1\"");//массив из стилей
if ($i==1) {echo "$row[0]";};
elseif($i==2) {echo "$row[1]";}
elseif($i==3) {echo "$row[2]";}
elseif($i==4) {echo "$row[3]";}
elseif($i==5) {echo "$row[3]";}
elseif($i==6) {echo "$row[4]";}
elseif($i==7,12){echo "$row[5]";}
else {$row="class=\"row-2\"";}
echo"
<tr $row>// вставка стиля
<td class=\"column-1\">$i </td>
<td class=\"column-2\">$inf[team]</td>
<td class=\"column-3\">$inf[r1]</td>
<td class=\"column-3\">$inf[ochko]</td>
<td class=\"column-3\"></td>
<td class=\"column-3\"></td>
<td class=\"column-4\"></td>
<td class=\"column-3\"></td>
</tr>";
}
Свежачок!
Я насчитал 9 какашек, а вы?
+105
int run_zero[] = {0xfffffffe,0xfffffffd,0xfffffffb,0xfffffff7,0xffffffef,0xffffffdf,0xffffffbf,0xffffff7f,0xfffffeff,0xfffffdff,0xfffffbff,0xfffff7ff,0xfffefff,0xffffdfff,0xffffbfff,0xffff7fff,0xfffeffff,0xfffdffff,0xfffbffff,0xfff7ffff,0xffeffff,0xffdfffff,0xffbfffff,0xff7fffff,0xfeffffff,0xfdffffff,0xfbffffff,0xf7ffffff,0xefffffff,0xdfffffff,0xbfffffff,0x7fffffff};
int run_one[] = {0x1,0x2,0x4,0x8,0x10,0x20,0x40,0x80,0x100,0x200,0x400,0x800,0x1000,0x2000,0x4000,0x8000,0x10000,0x20000,0x40000,0x80000,0x100000,0x200000,0x400000,0x800000,0x1000000,0x2000000,0x4000000,0x8000000,0x10000000,0x20000000,0x40000000,0x80000000};
int chess_code[] = {0xa5,0x5a};
Первые строки теста регистров некоего контроллера. Хорошо, что регистры не 64-разрядные, а то задолбался бы паренёк. А уж про chess_code вообще молчу. Вот так суровые российские программеры, не боящиеся лишней работы, тестируют авиационное бортовое оборудование.
+145
class Partner extends SqlQuery {
...
Партнер - это тот, кто привел юзера. Т.е. по факту, другой юзер.
+166
echo $tpl->ParseTemplate2('client_pardon', $client_pardon, $CFG['root']['template_basket']);
Самописный интернет-магазин, кусок кода "если обломилось создание заказа".
+161
// Функция отметки входящих сообщений как прочитанных
function CheckReadPM() {
global $user, $site, $db;
$pm_ids = SafeDB($_POST['mod'], 11, int);
$where = '(`id` = '.$pm_ids[0];
$i = 1;
while($i < count($pm_ids)) {
$where .= ' or `id` = '.$pm_ids[$i];
$i++;
}
$where .= ") and `to` = ".$user->Get('u_id')." and `black` = 0";
$db->Update('private', "`read` = 1", $where);
}
+168
<?php
Class Draw
{
// вырисовка графика баланса
function Graph($y1,$y2,$y3,$y4,$y5,$y6,$y7,$firstday) {
header ("Content-type: image/png");
$im = imagecreatefrompng("graph.png");
$text_color = imagecolorallocate($im, 233, 14, 91);
$color = imagecolorallocate($im, 0, 0, 0);
$bg = imagecolorallocate($im, 180, 180, 200);
#--------------------------------------------------------
imagefill ($im, 0, 0, $bg);
#---------------------------------------------------------
imageline($im, 50, 0, 1000, 0, $color);
// в это же духе еще ~10 строк
imageline($im, 50, 900, 1000, 900, $color);
#---------------------------------------------------------
imageline($im, 100, 950, 100, 0, $color);
// аналогично
imageline($im, 700, 950, 700, 0, $color);
#---------------------------------------------------------
imageline($im, 100, 1000-$y1, 200, 1000-$y2, $text_color);
imagefilledellipse ($im, 100, 1000-$y1, 10, 10, $color);
imagestring($im, 3, 115, 1000-$y1, $y1 . " RUB", $text_color);
imagestring($im, 5, 90, 960, $firstday, $text_color);
#-----------------------------------------------------------
imageline($im, 200, 1000-$y2, 300, 1000-$y3, $text_color);
imagefilledellipse ($im, 200, 1000-$y2, 10, 10, $color);
imagestring($im, 3, 215, 1000-$y2, $y2 . " RUB", $text_color);
imagestring($im, 5, 190, 960, $firstday+1, $text_color);
#-------------------------------------------------------------
imageline($im, 300, 1000-$y3, 400, 1000-$y4, $text_color);
imagefilledellipse ($im, 300, 1000-$y3, 10, 10, $color);
imagestring($im, 3, 315, 1000-$y3, $y3 . " RUB", $text_color);
imagestring($im, 5, 290, 960, $firstday+2, $text_color);
#------------------------------------------------------------
imageline($im, 400, 1000-$y4, 500, 1000-$y5, $text_color);
imagefilledellipse ($im, 400, 1000-$y4, 10, 10, $color);
imagestring($im, 3, 415, 1000-$y4, $y4 . " RUB", $text_color);
imagestring($im, 5, 390, 960, $firstday+3, $text_color);
#-----------------------------------------------------------
imageline($im, 500, 1000-$y5, 600, 1000-$y6, $text_color);
imagefilledellipse ($im, 500, 1000-$y5, 10, 10, $color);
imagestring($im, 3, 515, 1000-$y5, $y5 . " RUB", $text_color);
imagestring($im, 5, 490, 960, $firstday+4, $text_color);
#------------------------------------------------------------
imageline($im, 600, 1000-$y6, 700, 1000-$y7, $text_color);
imagefilledellipse ($im, 600, 1000-$y6, 10, 10, $color);
imagestring($im, 3, 615, 1000-$y6, $y6 . " RUB", $text_color);
imagestring($im, 5, 590, 960, $firstday+5, $text_color);
#------------------------------------------------------------
imagefilledellipse ($im, 700, 1000-$y7, 10, 10, $color);
imagestring($im, 3, 715, 1000-$y7, $y7 . " RUB", $text_color);
imagestring($im, 5, 690, 960, $firstday+6, $text_color);
#---------------------------------------------------------
imagestring($im, 5, 0, 900, 100, $text_color);
imagestring($im, 5, 0, 800, 200, $text_color);
imagestring($im, 5, 0, 700, 300, $text_color);
imagestring($im, 5, 0, 600, 400, $text_color);
imagestring($im, 5, 0, 500, 500, $text_color);
imagestring($im, 5, 0, 400, 600, $text_color);
imagestring($im, 5, 0, 300, 700, $text_color);
imagestring($im, 5, 0, 200, 800, $text_color);
imagestring($im, 5, 0, 100, 900, $text_color);
imagestring($im, 5, 0, 0, 1000, $text_color);
#---------------------------------------------------------
imagepng($im);
imagedestroy($im);
}
}
?>
той же 3х летней давности.....комментарии излишни