- 1
- 2
<%= @album.playlist.gsub('
','<br />') %>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−99
<%= @album.playlist.gsub('
','<br />') %>
Тогда, видимо, не догадался написать "\n" :)
+138
auto ret;
ulong[] generateMobs() {
ushort counter = 0;
for(ulong id = 0; id < NUMBER_OF_MOBS; ++id) {
Mob bufferMob = get(id);
if ( bufferMob.habitat == hero.hero.heroLocalityType() && ((bufferMob.rating() <= hero.hero.rating())) ) {
suitable ~= id;
counter++;
}
}
ret = suitable;
suitable.length = 0; /// Im
suitable = null; /// FUCKIN'
delete suitable; /// DESTROY YOU!!!
return ret;
}
Вообще это язык Ди(D(digitalmars.com <-- разрабы языка). Зае... Достала всякая НЕ статичная хрень)
Вообще в Ди есть гарбадж коллектор...
+167
<a title="Главная" href="http://<?php echo $_SERVER['HTTP_HOST'].str_replace('\\', '', dirname($_SERVER['PHP_SELF'])); ?>">Главная</a>
нашел в одном проекте, я бы и не смог до такого додуматься
−99
Dim byteOut(64) As Byte
Dim i As Integer
Try
byteOut(0) = Len(outCName) + 5 'number bytes in output message
byteOut(1) = &H0 'should be 0 for NXT
byteOut(2) = &H80 '&H0 = reply expected &H80 = no reply expected
byteOut(3) = &H9 'Send Bluetooth
byteOut(4) = &H0 'Box Number - 1
byteOut(5) = Len(outCName) + 1 'message size with null terminator
For i = 1 To Len(outCName) 'copy bytes into output array
byteOut(i + 5) = Asc(Mid(outCName, i, 1))
Next
byteOut(Len(outCName) + 6) = &H0 'add null terminator
SerialPort1.Write(byteOut, 0, Len(outCName) + 7) 'send message
Catch ex As Exception
MsgBox(ex.ToString)
End Try
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Try
byteOut(0) = Len(outWState) + 5 'number bytes in output message
byteOut(1) = &H0 'should be 0 for NXT
byteOut(2) = &H80 '&H0 = reply expected &H80 = no reply expected
byteOut(3) = &H9 'Send Bluetooth
byteOut(4) = &H1 'Box Number - 1
byteOut(5) = Len(outWState) + 1 'message size with null terminator
For i = 1 To Len(outWState) 'copy bytes into output array
byteOut(i + 5) = Asc(Mid(outWState, i, 1))
Next
byteOut(Len(outWState) + 6) = &H0 'add null terminator
SerialPort1.Write(byteOut, 0, Len(outWState) + 7) 'send message
Catch ex As Exception
MsgBox(ex.ToString)
End Try
<..ещё один раз..>
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Try
byteOut(0) = Len(outWindC) + 5 'number bytes in output message
byteOut(1) = &H0 'should be 0 for NXT
byteOut(2) = &H80 '&H0 = reply expected &H80 = no reply expected
byteOut(3) = &H9 'Send Bluetooth
byteOut(4) = &H3 'Box Number - 1
byteOut(5) = Len(outWindC) + 1 'message size with null terminator
For i = 1 To Len(outWindC) 'copy bytes into output array
byteOut(i + 5) = Asc(Mid(outWindC, i, 1))
Next
byteOut(Len(outWindC) + 6) = &H0 'add null terminator
SerialPort1.Write(byteOut, 0, Len(outWindC) + 7) 'send message
Catch ex As Exception
MsgBox(ex.ToString)
End Try
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Try
byteOut(0) = Len(outHum) + 5 'number bytes in output message
byteOut(1) = &H0 'should be 0 for NXT
byteOut(2) = &H80 '&H0 = reply expected &H80 = no reply expected
byteOut(3) = &H9 'Send Bluetooth
byteOut(4) = &H4 'Box Number - 1
byteOut(5) = Len(outHum) + 1 'message size with null terminator
For i = 1 To Len(outHum) 'copy bytes into output array
byteOut(i + 5) = Asc(Mid(outHum, i, 1))
Next
byteOut(Len(outHum) + 6) = &H0 'add null terminator
SerialPort1.Write(byteOut, 0, Len(outHum) + 7) 'send message
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Говнокод почти трёхлетней давности. Понадобилось мне посмотреть, как я реализовывал "общение" по блютусу с Mindstorms NXT, и напоролся на вот это...
+163
<?php echo '<?xml version="1.0" encoding="utf-8"?>';?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="ru">
<head>
<title>День Победы! 66 лет со дня победы! 9 Мая!</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">body{background:#000;}h1{color:#ff5500;}</style>
</head>
<body>
<div style="text-align:center">
<div style="padding-top:28%"><h1><?php
class Main
{
var $timex;
var $month;
var $day;
var $year;
function win2uni($s)
{
$s = convert_cyr_string($s,'w','i');
for ($result='', $i=0; $i<strlen ($s); $i++) {
$charcode = ord($s[$i]);
$result .= ($charcode>175)?"&#".(1040+($charcode-176)).";":$s[$i];
}
return $result;
}
function Main()
{
if ($this->GetDate())
$this->TimeTo();
return true;
}
function GetDate()
{
$this->month = '05';
$this->day = '09';
$this->year = '2011';
return true;
}
function TimeTo()
{
$m = $this->month;
$d = $this->day;
$y = $this->year;
$mn = date("m");
$dn = date("d");
$yn = date("y");
$hh = date("H");
$mm = date("i");
$ss = date("s");
$diff = mktime(23,59,59,$m,$d,$y)-mktime($hh,$mm,$ss,$mn,$dn,$yn);
$days = $diff/60/60/24;
$hours = $diff/60/60 - intval($days)*24;
$minutes = $diff/60 - intval(intval($days*24)*60);
$seconds = $diff - intval(intval(intval($days*24*60))*60);
$text = "До Дня Победы (9 мая) осталось<br/>\n";
$text.= round($days);
$mins = round($days)."";
if ($mins == "11" or $mins == "12" or $mins == "13" or $mins == "14") $text.= " дней "; else
if (
$mins[strlen($mins)-1] == "2"
or $mins[strlen($mins)-1] == "3"
or $mins[strlen($mins)-1] == "4")
$text.= " дня "; else
if($mins[strlen($mins)-1] == "1")
$text.= " день "; else
$text.= " дней ";
$text.= round($hours);
if (round($hours) == 1 or round($hours == 21)) $text.= " час "; else
if (round($hours) == 2 or round($hours) == 3 or round($hours) == 4 or round($hours) == 22 or round($hours) == 23) $text.= " часа ";
else $text.= " часов ";
$text.= round($minutes);
$mins = round($minutes)."";
if ($mins == "11" or $mins == "12" or $mins == "13" or $mins == "14") $text.= " минут "; else
if (
$mins[strlen($mins)-1] == "2"
or $mins[strlen($mins)-1] == "3"
or $mins[strlen($mins)-1] == "4")
$text.= " минуты "; else
if($mins[strlen($mins)-1] == "1")
$text.= " минута "; else
$text.= " минут ";
$text.= round($seconds);
$mins = round($seconds)."";
if ($mins == "11" or $mins == "12" or $mins == "13" or $mins == "14") $text.= " секунд "; else
if (
$mins[strlen($mins)-1] == "2"
or $mins[strlen($mins)-1] == "3"
or $mins[strlen($mins)-1] == "4")
$text.= " секунды "; else
if($mins[strlen($mins)-1] == "1")
$text.= " секунда "; else
$text.= " секунд ";
echo $text;
return true;
}
}
$X = new Main();
?></h1></div>
Заранее извиняюсь за "опять даты, опять php":)
Отсчет времени до 9 мая
http://dumpz.org/23155/
+144
if (navigator.appName != "Microsoft Internet Explorer") {
document.write(
"<img src=\"blank.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img0\">\n"+
"<img src=\"blank.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img1\">\n"+
"<a href=\"#\" onClick=\"window.move(2);return false\" onMouseOver=\"window.status='';\n"+
"return true\"><img src=\"peg.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img2\"></A>\n"+
"<a href=\"#\" onClick=\"window.move(3);return false\" onMouseOver=\"window.status='';\n"+
"return true\"><img src=\"peg.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img3\"></A>\n"+
"<a href=\"#\" onClick=\"window.move(4);return false\" onMouseOver=\"window.status='';\n"+
"return true\"><img src=\"peg.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img4\"></A>\n"+
"<img src=\"blank.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img5\">\n"+
"<img src=\"blank.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img6\"><BR>\n"+
"
"<a href=\"#\" onClick=\"window.move(26);return false\" onMouseOver=\"window.status='';\n"+
"return true\"><img src=\"peg.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img26\"></A>\n"+
"<a href=\"#\" onClick=\"window.move(27);return false\" onMouseOver=\"window.status='';\n"+
"return true\"><img src=\"peg.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img27\"></A><BR>\n"+
"<a href=\"#\" onClick=\"window.move(28);return false\" onMouseOver=\"window.status='';\n"+
"return true\"><img src=\"peg.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img28\"></A>\n"+
"<a href=\"#\" onClick=\"window.move(29);return false\" onMouseOver=\"window.status='';\n"+
"return true\"><img src=\"peg.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img29\"></A>\n"+
"<a href=\"#\" onClick=\"window.move(30);return false\" onMouseOver=\"window.status='';\n"+
"return true\"><img src=\"peg.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img30\"></A>\n"+
"<a href=\"#\" onClick=\"window.move(31);return false\" onMouseOver=\"window.status='';\n"+
"return true\"><img src=\"peg.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img31\"></A>\n"+
"<a href=\"#\" onClick=\"window.move(32);return false\" onMouseOver=\"window.status='';\n"+
"return true\"><img src=\"peg.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img32\"></A>\n"+
"<a href=\"#\" onClick=\"window.move(33);return false\" onMouseOver=\"window.status='';\n"+
"<img src=\"blank.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img47\">\n"+
"<img src=\"blank.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img48\"><BR>")
... До хуя таких строк
}
else {
document.write(
"<img src=\"blank.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img0\">\n"+
"<img src=\"blank.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img1\">\n"+
"<img src=\"peg.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img2\" \n"+
"onClick=\"window.move(2);return false\">\n"+
"<img src=\"peg.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img3\" \n"+
"onClick=\"window.move(3);return false\">\n"+
"<img src=\"peg.gif\" border=\"0\" width=\"19\" height=\"19\" name=\"img4\" \n"+
"
... аналогично
Из каталога готовых скриптов EsayScript
+147
<?php
$this->phptal->id=$id;
$this->phptal->returnid=$returnid;
if(isset($params['catalogue']))
{
if(isset($params['category']))
{
if(isset($params['news']))
{
$nid=(int)$params['news'];
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventNewsDAO.php'));
$nldao=new EventNewsDAO($this);
$this->phptal->newsline=$nldao->get($nid);
echo $this->ProcessTalTemplate('admin/admin_newsline.tal.tpl');
}
else
{
$cid=(int)$params['catalogue'];
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCatalogueDAO.php'));
$cdao=new EventCatalogueDAO($this);
$this->phptal->catalogue=$cdao->get($cid);
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCategoryDAO.php'));
$ccdao=new EventCategoryDAO($this);
$this->phptal->categories=$ccdao->all($cid);
$ccid=(int)$params['category'];
$this->phptal->category=$ccdao->get($ccid);
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventNewsDAO.php'));
$ndao=new EventNewsDAO($this);
$this->phptal->news=$ndao->all($ccid);
echo $this->ProcessTalTemplate('admin/admin_news.tal.tpl');
}
}
else
{
$cid=(int)$params['catalogue'];
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCatalogueDAO.php'));
$cdao=new EventCatalogueDAO($this);
$this->phptal->catalogue=$cdao->get($cid);
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCategoryDAO.php'));
$ccdao=new EventCategoryDAO($this);
$this->phptal->categories=$ccdao->all($cid);
echo $this->ProcessTalTemplate('admin/admin_categories.tal.tpl');
}
}
else
{
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCatalogueDAO.php'));
$cdao=new EventCatalogueDAO($this);
$this->phptal->catalogues=$cdao->all();
echo $this->ProcessTalTemplate('admin/admin_catalogues.tal.tpl');
}
я молодец. наговнокодил как школьник.
ветвистое ветвление + жуткая копипаста.
буду это рефакторить, когда в целом закончу базовую функциональность.
+157
$opdirbase=opendir(H.'sys/fnc');
while ($filebase=readdir($opdirbase))
{
if (eregi('\.php$',$filebase))
{
include_once(H.'sys/fnc/'.$filebase);
}
}
Вот так вот инклюдится код в одной в вап cms.В дериктории файлы по 200-300кб.
+158
{|if $message=="ok"|}
<div style="text-align: center; padding:10px; margin:10px; color: white; font-weight: bold; background-color: green;">Your message has successfully been added.</div>
{|/if|}
{|if $message=="error"|}
<div style="text-align: center; padding:10px; margin:10px; color: white; font-weight: bold; background-color: red;">Mistake. You filled out the wrong form.</div>
{|/if|}
Красивое использование CSS.
+154
public function assign($a, $b) {
parent::assign($a, $b);
}
Из того же проекта.
И все-таки хорошо, что программеры понимают ООП :-)