- 1
- 2
$WeightF=floor($Weight);
if ($WeightF<$Weight) {$WeightF=$WeightF+1;}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+156
$WeightF=floor($Weight);
if ($WeightF<$Weight) {$WeightF=$WeightF+1;}
ненуачо, ceil же для слабаков
+161
function shwt($pid,$dir) {
global $tree,$ITEM,$counts,$hasprods;
if(!isset($tree[$pid])) return array("",0);
$list="";
$sum=0;
foreach($tree[$pid] as $k=>$v) {
$v["hasprods"]=(isset($hasprods[$k])? "1":"");
$v["dir"]=$dir.$v["dir"]."/";
$x=shwt($k,$v["dir"]);
if(isset($counts[$k])) $v["cnt"]=$counts[$k];else $v["cnt"]=0;
$v["cnt"]+=$x[1];
$sum+=$v["cnt"];
$v["sub"]=$x[0];
$v["open"]=(strpos(" ".$_SERVER["REQUEST_URI"],$v["dir"])==1? 1:"");
$list.=sendAr2blk($v,$ITEM);
}
return array($list,$sum);
}
ф-я построения каталога меню в самописной CMS
−148
Begin Brahman
О чем молчат брахманы
Брехем.
−128
// Abstract Class for an HTTP Request
package com.somecompany
{
public class HTTPServiceBase
{
private static const ERROR:String = "ERROR";
private static const COMPLETE:String = "COMPLETE";
public function HTTPServiceBase()
{
}
private function load():void
{
// placeholder
}
}
}
// Implementation Class for a specific HTTP Request
package com.somecompany
{
public class SpecificHTTPService extends HTTPServiceBase
{
public function SpecificHTTPService()
{
}
}
}
Ищем сейчас флекс программиста. Даем им сделать тест, на дому, одной из задач было.
Сделать запрос на сервер, это должно было быть реализованно след образом.
+ Абстрактный класс который реализует функциональность простого http get запроса (можно было использовать и URLLoader и HTTPService и HTTPMultiService)
+ Класс наследник абстрактного, формирующий конкретный запрос.
Довольно просто, впринципе. Был тут недавно один товарисчь.
Как написанно в резюме: Adobe FLEX, FLASH, Action Script 2.0/3.0
И то что получили через пару дней.
+157
<style>
div.adsPayments a {
border: 0px none;
text-decoration: none;
}
div.adsPayments a img {
border: 0px none;
margin: 1px;
}
</style>
<?
echo '<style>';
echo 'table td { padding: 3px 10px 3px 20px; }';
echo 'html, body {font-family: helvetica; font-size: 12px;}';
echo 'a, a:hover {text-decoration: none;cursor: pointer;}';
echo 'td, td b { font-size: 12px; }';
echo '</style>';
?>
<div class="adsPayments">...
Видимо css внутри php гораздо более внушительно смотрится..
−99
# Work fine only on call with has_many association
def self.new_from_params options
new_rule = Rule.new
return nil if new_rule.project_id.nil?
rule = Rule.find_by_id options[:rule_id]
if rule.nil? or (new_rule.project.id != rule.project.id)
rule = Rule.new
end
new_rule.rule_id = options[:rule_id]
new_rule.users = (rule.users.to_a + options[:users].to_a).uniq
new_rule.statuses = (rule.statuses.to_a + options[:statuses].to_a).uniq
new_rule.tags = (rule.tags.to_a + options[:tags].to_a).uniq
new_rule.grouped_by = options[:grouped_by].presence || rule.grouped_by.presence
new_rule.sorted_by = options[:sorted_by].presence || rule.sorted_by.presence
new_rule.search = options[:search].presence || rule.search.presence
new_rule.period_start = options[:period_start].presence || rule.period_start.presence
new_rule.period_end = options[:period_end].presence || rule.period_end.presence
new_rule
end
−115
SELECT product.entity_id as pid,
vTitle.value as title, vLength.value as length, vWidth.value as width, vHeight.value as height, vWeight.value as weight, vCapacity.value as capacity, vImg.value as img,
tShort.value as short, tText.value as text,
dPrice.value as price,
cParent.category_id as parent
FROM catalog_product_entity as product
LEFT JOIN catalog_product_entity_varchar as vTitle ON vTitle.entity_id=product.entity_id AND vTitle.attribute_id=60
LEFT JOIN catalog_product_entity_varchar as vLength ON vLength.entity_id=product.entity_id AND vLength.attribute_id=122
LEFT JOIN catalog_product_entity_varchar as vWidth ON vWidth.entity_id=product.entity_id AND vWidth.attribute_id=123
LEFT JOIN catalog_product_entity_varchar as vHeight ON vHeight.entity_id=product.entity_id AND vHeight.attribute_id=124
LEFT JOIN catalog_product_entity_varchar as vWeight ON vWeight.entity_id=product.entity_id AND vWeight.attribute_id=69
LEFT JOIN catalog_product_entity_varchar as vCapacity ON vCapacity.entity_id=product.entity_id AND vCapacity.attribute_id=125
LEFT JOIN catalog_product_entity_varchar as vImg ON vImg.entity_id=product.entity_id AND vImg.attribute_id=74
LEFT JOIN catalog_product_entity_text as tShort ON tShort.entity_id=product.entity_id AND tShort.attribute_id=62
LEFT JOIN catalog_product_entity_text as tText ON tText.entity_id=product.entity_id AND tText.attribute_id=61
LEFT JOIN catalog_product_entity_decimal as dPrice ON dPrice.entity_id=product.entity_id AND dPrice.attribute_id=64
LEFT JOIN (SELECT c.category_id, c.product_id FROM catalog_category_product as c ORDER BY c.category_id DESC) as cParent ON cParent.product_id=product.entity_id
GROUP BY cParent.product_id ORDER BY cParent.product_id
Мой говнокод-неговнокод по экспорту товара из Magento в нашу CMS
−147
{if $oUserProfile->getProfileIcq()}
<strong>{$aLang.profile_social_contacts}</strong>
<ul>
{if $oUserProfile->getProfileIcq()}
<li class="icq"><a href="http://www.icq.com/people/about_me.php?uin={$oUserProfile->getProfileIcq()|escape:'html'}" target="_blank">{$oUserProfile->getProfileIcq()}</a></li>
{/if}
</ul>
{/if}
Smarty-шаблон. ActionProfile/sidebar.tpl (17-я строчка в скине "new") из LiveStreet.
Озадачивают 1-я и 4-я строки. Типа: "А вдруг?!"
−110
UPDATE ...
SET ...
WHERE ...
AND NVL(fndr_constraint,'ABC')=NVL('','ABC')
...
Oracle 10.2 продакшн код.
Это прям какое-то нездоровое влечение к NVL...
−117
/*Ахтунг! Содержит бубен*/
public function ToDown():void
{
while (!downCollisionTest(figure))
{
figure.position.y++;
}
RedrawFigure();
setTimeout(function():void{Down();}, 5);
}