- 1
- 2
- 3
- 4
- 5
ret = (func(a, b) == SpecNumber) ? true : false;
if (! ret)
{
ShowError ("Some message", a, b));
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+83.5
ret = (func(a, b) == SpecNumber) ? true : false;
if (! ret)
{
ShowError ("Some message", a, b));
}
Обратить внимание на хитрость получения значения ret, а потом как его используют :)
+140
<table width="100%" border="0" cellspacing="0" cellpadding="1" id="gmtbl2" class="gmtbl">
<tbody>
<tr>
<td colspan="3" width="100%">
<table width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td colspan="3" width="100%" height="20" id="gmtdttl" class="gmtdttl"><B><A href="http://www.gismeteo.RU/towns/27760.htm" id="tgmtdttl" class="gmtdttl" target="_blank">Саранск</A></B></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td width="40%" id="gmtdtext0" class="gmtdtext" align="left">Пн, ночь</td>
<td width="40%" id="tgmtdtext0" class="gmtdtext" align="center">0..-2 °C
<td width="20%" align="center"><IMG src="http://informer.gismeteo.ru/html/images/sm/1n.gif" width="26" height="26" alt="Малооблачно" title="Малооблачно"></td><tr><td width="40%" id="gmtdtext1" class="gmtdtext" align="left"> Пн, утро</td><td width="40%" id="tgmtdtext1" class="gmtdtext" align="center">+4..+6 °C<td width="20%" align="center"><IMG src="http://informer.gismeteo.ru/html/images/sm/2.gif" width="26" height="26" alt="Облачно" title="Облачно"></td><tr><td width="40%" id="gmtdtext2" class="gmtdtext" align="left"> Пн, день</td><td width="40%" id="tgmtdtext2" class="gmtdtext" align="center">+10..+12 °C<td width="20%" align="center"><IMG src="http://informer.gismeteo.ru/html/images/sm/3.gif" width="26" height="26" alt="Пасмурно" title="Пасмурно"></td><tr><td width="40%" id="gmtdtext3" class="gmtdtext" align="left"> Пн, вечер</td><td width="40%" id="tgmtdtext3" class="gmtdtext" align="center">+4..+6 °C<td width="20%" align="center"><IMG src="http://informer.gismeteo.ru/html/images/sm/3n.gif" width="26" height="26" alt="Пасмурно" title="Пасмурно"></td>
<tr>
<td colspan="3" align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td align="right" height="20"><IMG src="http://informer.gismeteo.ru/html/images/logo.gif" width="13" height="20" alt="/"></td>
<td align="left"><A href="http://www.gismeteo.RU" id="lgmtdtext" class="gmtdtext" target="_blank">GISMETEO.RU</A></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td heigth="5" colspan="3"></td>
</tr>
</tbody>
</table>
html информера, который возвращает js, генерируемый на сайте gismeteo.ru.
+145.6
function getCategories($id, $prefix, &$dl, $extra = '', $sc = '')
{
$dbextra = (!empty($extra)) ? " AND Id = '$extra'" : "";
// $query = $GLOBALS['db']->Query("SELECT * FROM " . PREFIX . "_modul_shop_kategorie WHERE Elter = '$id'$dbextra ORDER BY Rang ASC");
// if (!$query->numrows()) return;
//
// $num = $query->numrows();
if (isset($_SESSION['Shop']['Categories'][$id]) && $_SESSION['Shop']['Categories'][$id] === false) {
return;
}
if (isset($_SESSION['Shop']['Categories'][$id]) && $_SESSION['Shop']['Categories'][$id] != '') {
} else {
$sql = $GLOBALS['db']->Query("SELECT * FROM " . PREFIX . "_modul_shop_kategorie WHERE Elter = '$id' ORDER BY Rang ASC");
if (!$sql->numrows()) {
$_SESSION['Shop']['Categories'][$id] = false;
$sql->close();
return;
}
while ($row = $sql->FetchRow()) {
$_SESSION['Shop']['Categories'][$id][$row->Id] = $row;
}
$sql->close();
}
if (!empty($extra)) {
@$Items = $_SESSION['Shop']['Categories'][$id][$extra];
} else {
@$Items = $_SESSION['Shop']['Categories'][$id];
}
// if (!is_array($Items)) return;
// while ($item = $query->fetchrow()) {
foreach ($Items as $item) {
$item->ntr = "";
$item->visible_title = $prefix . '' . $item->KatName;
$item->sub = ($item->Elter == 0) ? 0 : 1;
$item->dyn_link = "index.php?module=shop&categ=$item->Id&parent=$item->Elter&navop=" . (($item->sub==0) ? $item->Id : getParentShopcateg($item->Elter));
$item->dyn_link = $this->shopRewrite($item->dyn_link);
if($item->Elter == 0) $item->ntr = 1;
$mdl = array();
////////////////////////////////////////Рекурсия////////////////////
$this->getCategories($item->Id, $prefix, $mdl, $extra, $sc);
$item->sub = $mdl;
array_push($dl, $item);
}
return $dl;
}
Часть модуля магазина в AVE CMS бывшей CP Engine
вся соль заключается в грусном использовании сессии не поназначению с целью уменьшить количество запросов к базе данныз
+148
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
JasperReports - говёная тулза для геренации отчётов в Java.
Основное достоинство - бесплатность и открытость исходного кода.
Главный минус - XML-шаблоны для отчётов.
+140
<?
echo "Заебись!";
?>
сделать заебись
+148
<title>Under Construction</title>
<html>
<td align=center>
<img src="Under-Construction.gif"
style="
display: block;
width: 550;
margin-left: auto;
margin-right: auto
" />
</td>
</html>
HTML 5.0 + CSS 3.0
+151
# Безлимит со статических адресов
### здесь с адресов 192.168.0.0/24 пускает только в сеть 10.x.x.x, но не в интернет.
### при задании четко route add x.x.x.x gw 10.254.254.254, то на этот x.x.x.x ходит нормально, а дальше нини...
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth2 -j SNAT --to-source 10.x.x.x
# Лимит с адресов полученных при подключении к pptpd
### здесь вообще все нормально, все кто подключаются к pptpd ходят в интернет по правильному ипу.
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth1 -j SNAT --to-source 212.x.x.x
# результат route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.50 * 255.255.255.255 UH 0 0 0 ppp0
### здесь все клиента pptpd...
212.x.x.x * 255.255.255.224 U 0 0 0 eth1
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
10.0.0.0 * 255.0.0.0 U 0 0 0 eth2
default 212.x.x.x 0.0.0.0 UG 0 0 0 eth1
default 10.x.x.x 0.0.0.0 UG 1 0 0 eth2
iptables
+156.4
include ("/home/powerbo1/public_html/_templates-new/_page.php?userid=" . $_POST["userid"] . "&page=" . $_POST["page"] . "&url=" . $_POST["url"] . "&home=" . $_POST["home"] . "&location=" . $_POST["location"] . "&domain=" . $_POST["domain"] . "");?>
+154
<?
class events {
private $table = array();
private $events = array();
function setTable($type, $array) {
$this->table[$type] = $array;
}
function set($type, $num, $point = 'global') {
$this->events[$point][$type] = $num;
}
function get($point = 'global') {
if (is_array($this->events[$point])) {
foreach ($this->events[$point] as $k => $v) {
$this->parse($k, $this->table[$k][$v]);
}
}
}
function parse($type, $string) {
echo '<div class="' . $type . '">' . $string . '</div>';
}
function check($point = 'global', $type = null) {
if ($type == null) {
if (count($this->events[$point][$type]) > 0) {
return true;
}
} else {
if (count($this->events[$point]) > 0) {
return true;
}
}
return false;
}
}
$events = new events();
$events->setTable('error',
array(1 => 'Опасносте'));
$events->set('error', 1);
$events->get();
Обработка ошибке
+148
if ((x0+a[i,1]{-1}) in [1..8])or((y0+a[i,2]) in [1..8]{2}){and(brd[(x0+a[i,1]),(y0+a[i,2])]=0) } then begin
reit[i]:=stepsreit(brd,x0+a[i,1],y0+a[i,2]);
end;
А почему оно не работает?