- 1
- 2
- 3
- 4
- 5
<style type="text/css" media="all">
<!--
@import url("files/style.css");
-->
</style>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+129
<style type="text/css" media="all">
<!--
@import url("files/style.css");
-->
</style>
Я чего-то не понимаю?
+127
IF context.page_name == 'company' or context.page_name == 'accessibility' or context.page_name == 'arbitrage' or context.page_name == 'arbitrage_income' or context.page_name == 'family_income' or context.page_name == 'family_income_acc' or context.page_name == 'family_income_fac' or context.page_name == 'family_income_summary' or context.page_name == 'arbitrage-rf' or context.page_name == 'federal-arbitrage' or context.page_name == 'appelate-arbitrage' or context.page_name == 'citation-index' or context.page_name == 'openness' or context.page_name == 'openness-mo' or context.page_name == 'openness-moscow' or context.page_name == 'openness-spb' or context.page_name == 'openness-lenob' or context.page_name == 'media-moscow' or context.page_name == 'media-mo' or context.page_name == 'media-general-jurisdiction' or context.page_name == 'media-spb' or context.page_name == 'media-lenob' or context.page_name == 'court-site-msk' or context.page_name == 'phone-court-general-jurisdiction' or context.page_name == '
court-site-mo' or context.page_name == 'court-site-spb' or context.page_name == 'court-site-lo' or context.page_name == 'citation-court-general-jurisdiction' or context.page_name == 'phone-openness-msk' or context.page_name == 'phone-openness-mo' or context.page_name == 'phone-openness-spb' or context.page_name == 'phone-openness-lo' or context.page_name == 'court-transparency-msk' or context.page_name == 'court-transparency-mo' or context.page_name == 'court-transparency-spb' or context.page_name == 'court-transparency-lo' or context.page_name == 'court-transparency-general-jurisdiction' or context.page_name == 'court-arbitrage-citation-rf' or context.page_name == 'court-arbitrage-appellate-citation' or context.page_name == 'court-federal-arbitrage-citation' or context.page_name == 'court-arbitrage-citation-summary' or context.page_name == 'phone-openness-sub' or context.page_name == 'phone-openness-aac' or context.page_name == 'phone-openness-fas' or context.page_name == 'phone-openness-svod' or context.
page_name == 'media-court-subjects-rf' or context.page_name == 'media-court-arbitration-appeal' or context.page_name == 'media-court-federal-arbitration-courts-districts' or context.page_name == 'media-all';
context.xslt_name = "casual/raiting_${context.page_name}.xslt";
ELSE;
context.http_status = 404;
END;
Template Toolkit
+126
rename-wiki:
$(shell cd ${WIKIDST} && rename 'i-iterate' 'Iterate' *.wiki)
$(shell find ${WIKIDST} -name "*.wiki" -exec \
sed -i 's/\[i-iterate/\[Iterate/g' '{}' \;)
$(shell find ${WIKIDST} -name "*.wiki" -exec \
sed -i 's/\.html\#/\#/g' '{}' \;)
$(shell find ${WIKIDST} -name "*.wiki" -exec \
sed -i 's/</\</g' '{}' \;)
$(shell find ${WIKIDST} -name "*.wiki" -exec \
sed -i 's/>/\>/g' '{}' \;)
Чтоль порадовать вас чем-нибудь?
+127
val arr = new Array[Int](3)
val arr2 = arr
arr(0) = 100
arr(1) = 200
arr(2) = 300
//arr2 == Array(100, 200, 300)
Не говнокод конечно, хотя как посмотреть.
Это нормально, учитывая, что val предполагает неизменяемость значения, или в данном случае считается, что только присвоить новое значение нельзя, а изменять внутреннюю структуру массива можно как захочешь?
Ведь наже в C++ нельзя изменить значения const std::vector.
+130
perft :: Int -> Position -> Int
perft depth pos
| depth <= 0 = 1
| otherwise = sum . map (perft $ depth - 1) $ legalPositions where
legalPositions = filter isLegalPosition nextpositions
nextpositions = map (\move -> makeMove move pos) $ (moves pos)
+120
<style>
.pitalic {
font-style:italic;
}
</style>
<p class = 'pitalic'>блаблабла</p>
прям новый супергерой...
+124
samples = [(1,14),(2,-66),(3,-414),(4,-1180),(5,-2370),(6,-3726),(7,-4606),(8,-3864),(9,270)]
-- Бесконечная система уравнений для МНК
system s = zip (matrix s) (column s) where
matrix = iterate tail . foldr1 (zipWith (+)) . map (\(x,y) -> iterate (*x) 1)
column = foldr1 (zipWith (+)) . map (\(x,y) -> iterate (*x) y)
-- Сведение бесконечной системы к треугольному виду (первый шаг гаусса)
triangle (eq:eqs) = (eq : triangle (map (sub eq) eqs)) where
sub eq1@(a1:as, ae) eq2@(b1:bs, be) = (zipWith f as bs, f ae be) where
f a b = b - a * b1 / a1
-- Вычисление иксов (второй шаг гаусса)
calcX n = foldr calc [] . take n where
calc (a:as, b) xs = ((b - sum (zipWith (*) as xs)) / a : xs)
-- метод наименьших квадратов
mnk n = reverse . calcX n . triangle . system
Метод наименьших квадратов.
http://ideone.com/CsD0ku
+125
splitOn :: (a -> Bool) -> [a] -> [[a]]
splitOn _ [] = []
splitOn f xs = removeEmpty $ takeWhile (not . f) xs: splitOn f (dropWhile (f) $ dropWhile (not . f) xs) where
removeEmpty [] = []
removeEmpty (x:xs)
| null x = removeEmpty xs
| otherwise = x: removeEmpty xs
words' :: String -> [String]
words' = splitOn (flip elem " \n\r\f\t\v\160")
Еще один words'
+123
val ret = method.invoke(this, args:_*)
Превращаем Array[Any] в жабовый Object[] в Scala.
+128
data Mode = Start | Read | Skip | End
data State = State Mode String String [String]
space c = elem c [' ', '\n', '\r', '\f', '\t', '\v', '\160']
end r = State End "" "" r
skip t r = State Skip t "" r
get t w r = State Read t w r
start t = State Start t "" []
step (State Start at@(t:ts) w r)
| space t = step $ skip at r
| otherwise = step $ get at w r
step (State Read at@(t:ts) w r)
| space t = step $ skip at $ r ++ [w]
| otherwise = step $ get ts (w ++ [t]) r
step (State Skip at@(t:ts) _ r)
| space t = step $ skip ts r
| otherwise = step $ get at "" r
step (State Start "" _ r) = step $ end r
step (State Read "" w r) = step $ end $ r ++ [w]
step (State Skip "" _ r) = step $ end r
step (State End _ _ r) = r
words' text = step $ start text
Решил все-таки выложить этот позор. Если есть предложения по улучшению - с радостью выслушаю.