- 1
Что за мемчик про вореции?
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
Что за мемчик про вореции?
Желательно со ссылками на лурк.
+2
.section-cart .table .th1.th1,
.section-cart .table .th2.th1,
.section-cart .table .th3.th1,
.section-cart .table .th4.th1 {
width: 575px;
}
.section-cart .table .th1.th2,
.section-cart .table .th2.th2,
.section-cart .table .th3.th2,
.section-cart .table .th4.th2 {
width: 285px;
}
.section-cart .table .th1.th3,
.section-cart .table .th2.th3,
.section-cart .table .th3.th3,
.section-cart .table .th4.th3 {
width: 250px;
}
.section-cart .table .th1.th1,
.section-cart .table .th2.th2,
.section-cart .table .th3.th3,
.section-cart .table .th4.th4 {
width: 250px;
}
.section-cart .table .td1,
.section-cart .table .td2,
.section-cart .table .td3,
.section-cart .table .td4,
.section-cart .table .td5,
.section-cart .table .td6 {
display: inline-block;
vertical-align: middle;
height: 215px;
border-bottom: 1px solid #d1d1d1;
}
.section-cart .table .td1.td1,
.section-cart .table .td2.td1,
.section-cart .table .td3.td1,
.section-cart .table .td4.td1,
.section-cart .table .td5.td1,
.section-cart .table .td6.td1 {
width: 245px;
line-height: 215px;
text-align: center;
}
.section-cart .table .td1.td1 img,
.section-cart .table .td2.td1 img,
.section-cart .table .td3.td1 img,
.section-cart .table .td4.td1 img,
.section-cart .table .td5.td1 img, {
.section-cart .table .td5.td1 img {
display: inline-block;
vertical-align: middle;
}
.section-cart .table .td1.td2,
.section-cart .table .td2.td2,
.section-cart .table .td3.td2,
.section-cart .table .td4.td2,
.section-cart .table .td5.td2 {
padding-left: 30px;
line-height: 215px;
padding-right: 25px;
width: 355px;
}
.section-cart .table .td1.td2 > span,
.section-cart .table .td2.td2 > span,
.section-cart .table .td3.td2 > span,
.section-cart .table .td4.td2 > span,
.section-cart .table .td5.td2 > span {
line-height: normal;
display: inline-block;
vertical-align: middle;
}
.section-cart .table .td1.td2 .title,
.section-cart .table .td2.td2 .title,
.section-cart .table .td3.td2 .title,
.section-cart .table .td4.td2 .title,
.section-cart .table .td5.td2 .title {
color: #181415;
font-size: 22px;
padding-bottom: 20px;
}
.section-cart .table .td1.td2 .opts,
.section-cart .table .td2.td2 .opts,
.section-cart .table .td3.td2 .opts,
.section-cart .table .td4.td2 .opts,
.section-cart .table .td5.td2 .opts {
font-size: 16px;
color: #636363;
line-height: 24px;
}
.section-cart .table .td1.td2 .opts b,
.section-cart .table .td2.td2 .opts b,
.section-cart .table .td3.td2 .opts b,
.section-cart .table .td4.td2 .opts b,
.section-cart .table .td5.td2 .opts b {
display: inline-block;
padding-right: 10px;
color: #181415;
}
Вот так вот строим обычную табличку.
+6
http://requests.readthedocs.org/en/master/
Warning: Recreational use of other HTTP libraries may result in dangerous side-effects, including: security vulnerabilities, verbose code, reinventing the wheel, constantly reading documentation, depression, headaches, or even death.
Не говнокод, даже не говнокоммент. Наоборот, хороший, годный комментарий.
+5
.dostali {
font-weight: bold;
}
Достали!!!11
+4
http://cs543107.vk.me/v543107084/f49c/quBsGLPz-lE.jpg
Программирование по-русски глазами американцев...
Сериал: "Агенты Щ.И.Т."; Сезон: 3; Эпизод: 13
+5
https://meduza.io/shapito/2016/03/24/iskusstvennyy-intellekt-ot-microsoft-za-sutki-polyubil-gitlera-i-voznenavidel-feministok
RIP in peace, nazi AI ;_;
−2
// POST /login
exports.login = function login(req, res) {
var email = req.body.email;
var password = req.body.password;
security.rateLimitRequest( 'reset', req, function( err ) {
if ( err )
return res.status( 400 ).send( err );
db.Account.find({email: email, password: password}, function(err, account) {
if ( err )
return res.status( 400 ).send( err );
account.getAccountStatistics(account, function(err, account) {
if ( err )
return res.status( 400 ).send( err );
account.incrementAccountLoginCount(account, function(err) {
if ( err )
return res.status( 400 ).send( err );
res.send(account);
});
});
});
});
});
У меня радость во все поля:
// POST /login
exports.login = function *login() {
var email = req.body.email;
var password = req.body.password;
try
{
// Throws an error if rate limit exceeded
yield security.rateLimitRequest( 'reset', req );
// Query MongoDB for account
var account = yield db.Account.find({email: email, password: password});
account.statistics = yield account.getAccountStatistics(account);
// Increment login count
yield account.incrementAccountLoginCount(account);
this.body = account;
}
catch( err ) {
// Return the error as JSON
return res.status( 400 ).send( err );
}
});
−1
(* basic power axiom
safe_comp_power x y =
case
(x = 0) and (y <> 0) -> 1
(x = 1) -> x
((x <> 0) and (y >= 0)) or ((x = 0) and (y > 0)) -> x * (safe_comp_power x (y - 1))
*)
logic safe_comp_pow : int, int -> int
axiom safe_comp_pow_int_A_1 : forall x : int. (x <> 0) -> safe_comp_pow(x, 0) = 1
axiom safe_comp_pow_int_A_2 : forall x : int. safe_comp_pow(x, 1) = x
axiom safe_comp_pow_int_A_3 : forall x,y : int. ((x <> 0) and (y >= 0)) or ((x = 0) and (y > 0)) -> safe_comp_pow(x, y) = x*(safe_comp_pow(x,y-1))
goal g_1 :
forall a,n : int.
a <> 0 -> n >= 0 ->
safe_comp_pow(a,n+1) = safe_comp_pow(a,n)*a
Язык для SMT солвера alt-ergo https://alt-ergo.ocamlpro.com/try.php . Аксиомы для возведения в степень. Возводить в отрицательную степень нельзя. Ноль в степени ноль - нельзя. Логика первого порядка. Должна быть справедлива для целых. Правда в одной аксиоме я допустил баг. Я его уже нашел. Можете тоже попробовать найти его
+1
https://habrahabr.ru/company/tm/blog/279759/
На Швабре можно постить гоатсе.
+4
{- This code intentionally was made slightly cryptic -}
{-# LANGUAGE GADTs, StandaloneDeriving, UnicodeSyntax, KindSignatures, FlexibleInstances, LambdaCase, CPP, BangPatterns #-}
import System.Exit
import Data.Functor
import Control.Monad.IO.Class
import Control.Monad.Trans.Cont
import System.Random
import System.Posix.Signals
import System.Environment
import Control.Concurrent.MVar
instance Eq (Int → Int) where
_ == _ = True -- It's a hack
infixl 7 :.
data T ∷ * where {J, Â, Â', S, K ∷ T; (:.) ∷ T → T → T; Ψ ∷ {σ ∷ String} → T
;F ∷ (Int → Int) → T; N ∷ Int → T; Ø ∷ String → T}
parse ∷ String → [T] → T
parse ('f':'u':c) t = parse c (J:t)
parse ('b':'a':'r':c) t = parse c (Â:t)
parse ('~':c) (a:b:t) = parse c (b:.a:t)
parse ('~':_) _ = error "Parse error: missing operand(s)"
parse (_:c) t = parse c t
parse [] (h:_) = h :. Ψ []
parse [] [] = error "Parse error: empty program"
s ∷ T → T
s (J :. x) = (x :. S) :. K
s (K :. x :. _) = x
s (S :. x :. y :. z) = (x :. z) :. (y :. z)
s (F f :. N i) = N $ f i
s (F f :. F g) = F $ f . g
s (Â' :. N i :. ψ @ (Ψ {})) = ψ {σ = toEnum i : σ ψ}
s (Â :. n :. ψ @ (Ψ {})) = Â' :. (n :. F (+1) :. N 0) :. ψ
-- Other cases
s (a :. b) = (s a) :. (s b)
s x = x
eval ∷ (T → t) → (T → t) → T → t
eval fp done t | t == t' = done t
| otherwise = fp t'
where t' = s t
ψs a@Ψ{σ=s} = [(a, s)]
ψs (a:.b) = ψs a ++ ψs b
ψs _ = []
r' ∷ T → [(T, String)] -- Very inefficient; should be rewritten
r' a | null t = [(a, s)] where ((_, s):t) = ψs a
r' (a :. b) = r' a ++ r' b
r' _ = []
r ∷ T → IO (Maybe T)
r t = case r' t of
[] → return Nothing
t' → ((t' !!) <$> randomRIO (0, length t' - 1)) >>= \case
(Ψ{}, s) → putStrLn (reverse s) >> return Nothing
(t'', s) → putStrLn (reverse s) >> return (Just t'')
setMVar v = (tryTakeMVar v >>) . putMVar v
loop v f n = callCC $ \done → loop1 done (\fp → f fp done) n
where loop2 interrupt f' n = do
n' ← liftIO (readMVar v) >>= \case
0 → f' interrupt n
_ → callCC $ \fp → f' fp n
liftIO $ modifyMVar_ v $ (\k → return $ k-1)
loop2 interrupt f' n'
loop1 done f' n = do
n' ← callCC $ \int → loop2 int f' n
liftIO $ putStrLn "Measure (m) Abort (a) Continue (c) Run steps (number)"
(liftIO getLine) >>= \case
"a" → f' done n' >> return ()
"c" → liftIO $ setMVar v (-1)
"m" → liftIO (r n') >>= \case
Nothing → liftIO exitSuccess
Just n'' → loop1 done f' n'' >> return ()
a → case readsPrec 0 a of
(n,_):_ → liftIO $ setMVar v n
_ → liftIO $ putStrLn "Not understood."
loop1 done f' n'
main ∷ IO ()
main = do
(file, n) ← getArgs >>= \case
[f] → return (f, -1)
["-s", n, f] → case readsPrec 0 n of
(n',_):_ → return (f, n')
_ → error "Argument of -s should be a number"
_ → error "Insufficient arguments. Expected [-s NUMBER_OF_STEPS] FILE"
cnt ← newMVar n
installHandler keyboardSignal (Catch $ setMVar cnt 0) Nothing
void $ (r =<<) (evalContT $ loop cnt eval =<< (parse <$> readFile file))
больше трясин богу тьюринг-полноты
1) литературное программирование
2) зайчатки REPL
3) чисто функциональное IO без манад и uniq-types
4) "квантовые" вычисления
5) только два комбинатора