- 1
http://s9.postimage.org/7t1dai0en/born_to_program.png
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+142
http://s9.postimage.org/7t1dai0en/born_to_program.png
Born to program :(
+56
<?php
/*
@package Widgetkit
* @author YOOtheme http://www.yootheme.com
*/
$sets = array_chunk($widget->items, $settings['items_per_set']);
foreach(array_keys($sets) as $s) {
$nav[] = '<li><span></span></li>';
}
?>
<?php foreach ($sets as $set => $items) : ?>
<ul class="set">
<?php foreach ($items as $item) : ?>
<li>
<div><?php echo $item['navigation']; ?></div>
</li>
<?php endforeach; ?>
</ul>
<?php endforeach; ?>
<?php
?>
И так в 230 файлах.
Садо-мазо, блин!
+136
<!--[if lte IE 6]>
Ваш браузер говно. Качайте новый...
<![endif]-->
Верстальщику респект...
+122
data IdPState a r = IdPEnd r | IdPNeedInput | IdPHaveInput a
{-# INLINE_STREAM idP #-}
idP :: (Monad m) => Stream l a a r m r
idP = Stream next IdPNeedInput where
{-# INLINE_INNER next #-}
next (IdPEnd r) = Done r
next IdPNeedInput = NeedInput IdPHaveInput IdPEnd
next (IdPHaveInput a) = HaveOutput IdPNeedInput (return ()) a
{-# INLINE_STREAM pipe #-}
pipe :: Monad m => Stream l a b r0 m r1 -> Stream Void b c r1 m r2 -> Stream l a c r0 m r2
pipe (Stream nextL sL) (Stream nextR sR) = Stream next (Right (return (), sL, Right sR)) where
{-# INLINE_INNER next #-}
next (Left r) = Done r
next (Right (final, sL, Right sR)) = case nextR sR of
Skip sR' -> Skip (Right (final, sL, Right sR'))
HaveOutput sR' c o -> HaveOutput (Right (final, sL, Right sR')) (c >> final) o
NeedInput p c -> Skip (Right (final, sL, Left (p, c)))
Done r -> PipeM (final >> return (Left r))
PipeM ms -> PipeM (liftM (Right . (final, sL,) . Right) ms)
Leftover _ i -> absurd i
next (Right (final, sL, Left (p, c))) = case nextL sL of
Skip sL' -> Skip (Right (final, sL', Left (p, c)))
HaveOutput sL' final' o -> Skip (Right (final', sL', Right (p o)))
NeedInput pL cL -> NeedInput (Right . (final,, Left (p, c)) . pL) (Right . (final,, Left (p, c)) . cL)
Done r -> Skip (Right (return (), sL, Right (c r)))
PipeM ms -> PipeM (liftM (Right . (final,, Left (p, c))) ms)
Leftover sL' i -> Leftover (Right (final, sL', Left (p, c))) i
{-# INLINE_STREAM purePipe #-}
purePipe :: (forall m . Monad m => Stream l a b r0 m r1) -> (forall m . Monad m => Stream Void b c r1 m r2) -> (forall m . Monad m => Stream l a c r0 m r2)
purePipe (Stream nextL sL) (Stream nextR sR) = Stream next (sL, Right sR) where
{-# INLINE_INNER next #-}
next (sL, Right sR) = case nextR sR of
Skip sR' -> Skip (sL, Right sR')
HaveOutput sR' _ o -> HaveOutput (sL, Right sR') (return ()) o
NeedInput p c -> Skip (sL, Left (p, c))
Done r -> Done r
PipeM ms -> Skip (sL, Right (runIdentity ms))
Leftover _ i -> absurd i
next (sL, Left (p, c)) = case nextL sL of
Skip sL' -> Skip (sL', Left (p, c))
HaveOutput sL' _ o -> Skip (sL', Right (p o))
NeedInput pL cL -> NeedInput ((, Left (p, c)) . pL) ((, Left (p, c)) . cL)
Done r -> Skip (sL, Right (c r))
PipeM ms -> Skip (runIdentity ms, Left (p, c))
Leftover sL' i -> Leftover (sL', Left (p, c)) i
−116
ExternalInterface.call('setTimeout', exec, 60, 'reattachWeapon');
Пришлось такую конструкцию использовать... Функция вызывает функцию, которая вызывает функцию.
Объясню, есть библиотека для AS3 Deval, выполняющая ту же функцию, что и JS'овский eval, только в AS.
Но в этой библиотеке есть свои минусы и из-за некоторых ограничений setTimeout там можно использовать только для заранее написанных функций.
В общем пришлось JS'овский setTimeout использовать, который через время определенное вызовет JS функцию, а JS функция вызовет функцию из списка функций текстовых.
+26
// ...
c=getchar();
if(c==*" ") cout << "space";
+48
function ruslat ($string) # Задаём функцию перекодировки кириллицы в транслит.
{
$string = ereg_replace("ж","zh",$string);
$string = ereg_replace("ё","yo",$string);
$string = ereg_replace("й","i",$string);
$string = ereg_replace("ю","yu",$string);
$string = ereg_replace("ь","",$string);
$string = ereg_replace("ч","ch",$string);
$string = ereg_replace("щ","sh",$string);
$string = ereg_replace("ц","c",$string);
$string = ereg_replace("у","u",$string);
$string = ereg_replace("к","k",$string);
$string = ereg_replace("е","e",$string);
$string = ereg_replace("н","n",$string);
$string = ereg_replace("г","g",$string);
$string = ereg_replace("ш","sh",$string);
$string = ereg_replace("з","z",$string);
$string = ereg_replace("х","h",$string);
$string = ereg_replace("ъ","",$string);
$string = ereg_replace("ф","f",$string);
$string = ereg_replace("ы","y",$string);
$string = ereg_replace("в","v",$string);
$string = ereg_replace("а","a",$string);
$string = ereg_replace("п","p",$string);
$string = ereg_replace("р","r",$string);
$string = ereg_replace("о","o",$string);
$string = ereg_replace("л","l",$string);
$string = ereg_replace("д","d",$string);
$string = ereg_replace("э","ye",$string);
$string = ereg_replace("я","ya",$string);
$string = ereg_replace("с","s",$string);
$string = ereg_replace("м","m",$string);
$string = ereg_replace("и","i",$string);
$string = ereg_replace("т","t",$string);
$string = ereg_replace("б","b",$string);
$string = ereg_replace("Ё","yo",$string);
$string = ereg_replace("Й","I",$string);
$string = ereg_replace("Ю","YU",$string);
$string = ereg_replace("Ч","CH",$string);
$string = ereg_replace("Ь","",$string);
$string = ereg_replace("Щ","SH'",$string);
$string = ereg_replace("Ц","C",$string);
$string = ereg_replace("У","U",$string);
$string = ereg_replace("К","K",$string);
$string = ereg_replace("Е","E",$string);
$string = ereg_replace("Н","N",$string);
$string = ereg_replace("Г","G",$string);
$string = ereg_replace("Ш","SH",$string);
$string = ereg_replace("З","Z",$string);
$string = ereg_replace("Х","H",$string);
$string = ereg_replace("Ъ","",$string);
$string = ereg_replace("Ф","F",$string);
$string = ereg_replace("Ы","Y",$string);
$string = ereg_replace("В","V",$string);
$string = ereg_replace("А","A",$string);
$string = ereg_replace("П","P",$string);
$string = ereg_replace("Р","R",$string);
$string = ereg_replace("О","O",$string);
$string = ereg_replace("Л","L",$string);
$string = ereg_replace("Д","D",$string);
$string = ereg_replace("Ж","Zh",$string);
$string = ereg_replace("Э","Ye",$string);
$string = ereg_replace("Я","Ya",$string);
$string = ereg_replace("С","S",$string);
$string = ereg_replace("М","M",$string);
$string = ereg_replace("И","I",$string);
$string = ereg_replace("Т","T",$string);
$string = ereg_replace("Б","B",$string);
return $string;
}
function latrus ($string) # Теперь задаём функцию перекодировки транслита в кириллицу.
{
$string = ereg_replace("zh","ж",$string);
$string = ereg_replace("Zh","Ж",$string);
$string = ereg_replace("yo","ё",$string);
$string = ereg_replace("Yu","Ю",$string);
$string = ereg_replace("Ju","Ю",$string);
$string = ereg_replace("ju","ю",$string);
$string = ereg_replace("yu","ю",$string);
$string = ereg_replace("sh","ш",$string);
$string = ereg_replace("yе","э",$string);
$string = ereg_replace("jа","я",$string);
$string = ereg_replace("yа","я",$string);
$string = ereg_replace("Sh","Ш",$string);
$string = ereg_replace("Ch","Ч",$string);
$string = ereg_replace("ch","ч",$string);
$string = ereg_replace("Yo","Ё",$string);
$string = ereg_replace("Ya","Я",$string);
$string = ereg_replace("Ja","Я",$string);
$string = ereg_replace("Ye","Э",$string);
$string = ereg_replace("i","и",$string);
$string = ereg_replace("'","ь",$string);
$string = ereg_replace("c","ц",$string);
$string = ereg_replace("u","у",$string);
$string = ereg_replace("k","к",$string);
$string = ereg_replace("e","е",$string);
$string = ereg_replace("n","н",$string);
$string = ereg_replace("g","г",$string);
...... OVER9000
Кто писал - не знаю. Это финал, господа. Задача на три строчки:
function translit($string, $back = 0) {
$converter = array('а'=>'a','б'=>'b','в'=>'v','г'=>'g ','д'=>'d','е'=>'e','ё'=>'e','ж'=>'zh',' з'=>'z','и'=>'i','й'=>'y','к'=>'k','л'=> 'l','м'=>'m','н'=>'n','о'=>'o','п'=>'p', 'р'=>'r','с'=>'s','т'=>'t','у'=>'u','ф'= >'f','х'=>'h','ц'=>'c','ч'=>'ch','ш'=>'s h','щ'=>'sch','ь'=>'\'','ы'=>'y','ъ'=>'\ '','э'=>'e','ю'=>'yu','я'=>'ya','А'=>'A' ,'Б'=>'B','В'=>'V','Г'=>'G','Д'=>'D','Е' =>'E','Ё'=>'E','Ж'=>'Zh','З'=>'Z','И'=>' I','Й'=>'Y','К'=>'K','Л'=>'L','М'=>'M',' Н'=>'N','О'=>'O','П'=>'P','Р'=>'R','С'=> 'S','Т'=>'T','У'=>'U','Ф'=>'F','Х'=>'H', 'Ц'=>'C','Ч'=>'Ch','Ш'=>'Sh','Щ'=>'Sch', 'Ь'=>'\'','Ы'=>'Y','Ъ'=>'\'','Э'=>'E','Ю '=>'Yu','Я'=>'Ya',);
if ($back == 1) $converter = array_flip($converter);
return strtr($string, $converter);
}
+160
jQuery('#text div.catalog_light div.num input[type="text"]').spinner({max: 999, min: 1});
jQuery('#text div.catalog_light div.num .ui-spinner-up').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog_light div.num .ui-spinner-down').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog_item_right div.line div.spinner input[type="text"]').spinner({max: 999, min: 1});
jQuery('#text div.catalog_item_right div.line div.spinner .ui-spinner-up').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog_item_right div.line div.spinner .ui-spinner-down').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog_item_additional div.double table div.spinner input[type="text"]').spinner({max: 999, min: 1});
jQuery('#text div.catalog_item_additional div.double table div.spinner .ui-spinner-up').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog_item_additional div.double table div.spinner .ui-spinner-down').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog div.content div.text div.spinner input[type="text"]').spinner({max: 999, min: 1});
jQuery('#text div.catalog div.content div.text div.spinner .ui-spinner-up').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog div.content div.text div.spinner .ui-spinner-down').html('').css({'width' : '22px'}).css({'height' : '22px'});
−117
Чудеса от Oracle.
--------- работает:
select to_number(null) from dual union all
select to_char(null) from dual
------------- меняем строчки местами - не работает
select to_char(null) from dual union all
select to_number(null) from dual
Null - это чудо расчудесное, что на дереве растет. Кто его увидит, тот от ужаса замрёт.
+100
<form action="/cgi-bin/repare.mpl" method="post" enctype="multipart/form-data" class="frm">
<input type="hidden" name="sql" value="UPDATE parcels p, parcels_doc d SET p.state = 'transporter_store' WHERE d.doctype = 'confirm.L' AND d.docid IN ($SORD) AND p.good IN ($ter) AND d.docitem = p.good AND p.state <> 'transporter_store' AND d.parcel = p.id">
<input type="submit" class="butt" name="main_ok" value="Исправить">
</form>
Нашли тут в боевом проекте шедевральную SQL Injection "by design".