This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
CouchDB 0.11.0: | |
[error] [<0.95.0>] attempted upload of invalid JSON undefined | |
[info] [<0.95.0>] 127.0.0.1 - - 'PUT' /honks/cmoore? 400 | |
CouchDB Trunk as of 5/28 - 10:26 PST: | |
[info] [<0.95.0>] 127.0.0.1 - - 'PUT' /honks? 201 | |
[debug] [<0.114.0>] 'PUT' /honks/cmoore? {1,1} | |
Headers: [{'Connection',"keep-alive"}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright (c)2011, Clint Moore | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
width: 960px; | |
margin-left: auto; | |
margin-right: auto; | |
} | |
.oxymoron { | |
display:table; | |
width: 100%; | |
border-collapse:collapse; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Web.Mongrel2 | |
import Control.Monad (forever) | |
import Text.Groom (groom) | |
import Data.Default (def) | |
main :: IO () | |
main = do | |
let b = def { m2_publish = "tcp://127.0.0.1:9996" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
migrate = runQ $ runMigration migrateAll | |
runQ :: MonadControlIO m => SqlPersist m a -> m a | |
runQ a = | |
withPostgresqlConn "host=localhost password=fart user=postgres dbname=fart" $ | |
runSqlConn $ do a | |
share [mkPersist, mkMigrate "migrateAll"] [persist| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
roundp :: (RealFrac a1, Integral a, Floating a1) => a1 -> a -> a1 | |
roundp n s = fromIntegral (round (n * factor)) / factor | |
where | |
shift = s - (floor (logBase 10 n) + 1) | |
factor = 10 ** fromIntegral shift |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data LoginF = LoginF String String | |
login :: Application () | |
login = do | |
fx <- eitherSnapForm login_form "login-form" | |
case fx of | |
Left s -> heistLocal (bindSplices s) $ render "login" | |
Right (LoginF email passw) -> do | |
us <- account_by_email $ B.pack email | |
maybe e404 ((huser $ B.pack passw) . snd) us | |
where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Solution where | |
import List | |
solution :: String -> IO () | |
solution a = | |
case reduce a of | |
[] -> putStrLn "No repeating characters!" | |
(x:_) -> putStrLn $ "Solution: " ++ x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have two interviews coming up with the real-deal companies where 'real-deal' | |
means that I'm fairly confident that I have to have my shit together to make | |
an impression on them and thus get offered a job. This is my boning-up | |
scratchpad. | |
Note that this is a brain-dump and not a carefully edited how-to, tutorial, or | |
otherwise. | |
> module Merge where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BST where | |
import Data.Time | |
import Control.Concurrent.STM | |
data Account = Account { aemail :: String | |
, apass :: String | |
, auid :: String } | |
deriving (Show) | |