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
import Control.Monad (join) | |
data Match = LiteralChar Char | AnyChar deriving (Eq) | |
data Regex = Step Match Regex | |
| Split Regex Regex | |
| MatchEnd | |
deriving (Eq) | |
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
from datatype.validation import is_valid, failures | |
from datatype import named, reference | |
# note the new | |
datatype = named('child', {'a': 'str', 'optional b': reference('child')}) | |
# valid | |
assert is_valid(datatype, {'a': 'some', 'b': {'a': 'foo'}}) | |
assert is_valid(datatype, | |
{'a': 'foo', 'b': {'a': 'bar', 'b': {'a': 'baz'}}}) |
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
" Display | |
zz " set current line at center of window | |
" Tabs and windows | |
^W T " move the current window to a new tab | |
" Jumping | |
gd " go to local declaration | |
^O " go to one position older in jump list | |
^I " go to one position newer in jump list |
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
import System.IO | |
main :: IO () | |
main = do | |
val <- getLine -- "val" here belongs to main's scope. | |
putStrLn (myfun val) -- pass the val to myfun, since it's out | |
-- of it's scope. | |
myfun :: String -> String | |
myfun a = "My value is " ++ a -- myfun knows nothing of 'val', as it |
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
import inspect | |
from mock import Mock, patch | |
def myfun(a, b, c): | |
print "fire zee missiles!" | |
def test_myfun(): |
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
templates = { | |
"docblock": """ | |
/** | |
* My Docblock | |
*/ | |
class MyClass%s {} | |
""", | |
"nodocblock": """ | |
/*- | |
* My Docblock |
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
import Control.Concurrent | |
import System.IO | |
import Network | |
type NodeId = String | |
type IdSequence = [String] | |
-- Char dividing incrementing-id from node-id | |
idNodeDelim :: Char | |
idNodeDelim = '.' |
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
_virtual_envs() { | |
if [[ -n $words[1] ]]; then | |
compadd `ls -d ~/VirtualEnv/*/ | cut -d/ -f5` | |
fi | |
} | |
compdef _virtual_envs venv |
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
#!/bin/bash | |
gunicorn path.to.app & | |
MASTER_PID=$! | |
trap "kill $MASTER_PID; exit" INT TERM EXIT | |
while true | |
do | |
sleep 1 |
NewerOlder