Skip to content

Instantly share code, notes, and snippets.

@mightybyte
mightybyte / first.hs
Created October 1, 2012 14:11 — forked from adinapoli/first.hs
First attempt
loginUser
:: ByteString
-- ^ Username field
-> ByteString
-- ^ Password field
-> Maybe ByteString
-- ^ Remember field; Nothing if you want no remember function.
-> (AuthFailure -> Handler b (AuthManager b) ())
-- ^ Upon failure
-> Handler b (AuthManager b) ()
createUser :: Text -- ^ Username
-> ByteString -- ^ Password
-> Handler b (AuthManager b) (Either String AuthUser)
createUser "" _ = return $ Left "Username cannot be empty"
createUser unm pwd = withBackend $ \r -> do
u <- liftIO $ buildAuthUser r unm pwd
return $ Right u
FLASK:
#!/usr/bin/env python
# A github post-receive hook handler, runs some shell command on each HTTP POST to PORT.
# github-listener.py PORT 'SOME SHELL COMMAND'
import sys
from subprocess import *
from flask import Flask