user@example ~/gitflow-example [master] $ git flow init
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master]
Branch name for "next release" development: [develop]
How to name your supporting branch prefixes?
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 Data.List | |
collatz :: Int -> Int | |
collatz 1 = 0 | |
collatz n | |
| odd n = force $ (collatz $! 3*n+1) + 1 | |
| even n = force $ (collatz $! div n 2) + 1 | |
force x = x `seq` 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
import Data.Maybe | |
import Control.Monad (liftM) | |
import Data.List (isPrefixOf) | |
import qualified Data.Map as M | |
import qualified Data.Foldable as F | |
-- | Trie container data type | |
data Trie a = Trie { value :: Maybe a | |
, children :: M.Map Char (Trie a) } | |
deriving (Show) |
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
# -*- coding: utf-8 -*- | |
# Copied from https://bitbucket.org/woadwarrior/trie/src/0ca6aab259b2/python/tst.py | |
_SENTINEL = () | |
class TST(object) : | |
__slots__ = ('splitchar','l','m','r','v') | |
def __init__( self, ch=None ) : | |
self.splitchar = ch |
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
""" | |
A fast data structure for searching strings with autocomplete support. | |
Copied this from https://github.com/vivekn/autocomplete/blob/master/trie.py | |
so I could embed it as a gist | |
""" | |
class Trie(object): | |
def __init__(self, value=None): | |
self.children = {} | |
self.value = value |
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
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
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
fbshow :: Int -> String | |
fbshow i | i `mod` 15 == 0 = "FizzBuzz" | |
| i `mod` 3 == 0 = "Fizz" | |
| i `mod` 5 == 0 = "Buzz" | |
| otherwise = show i | |
main :: IO () | |
main = mapM_ (putStrLn . fbshow) [1 .. 100] |
I hereby claim:
- I am orclev on github.
- I am orclev (https://keybase.io/orclev) on keybase.
- I have a public key whose fingerprint is 7C7D 9E8A 33E5 AF57 ED0C 701B 53C2 D954 B35B 18BA
To claim this, I am signing this object:
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 Data.Set (fromList, intersection, size) | |
import Data.List (foldl1, map) | |
process :: String -> String | |
process = show . size . foldl1 intersection . map fromList . lines | |
main :: IO () | |
main = interact process |
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 Data.Set as S | |
import Data.List as L | |
process :: String -> String | |
process input = | |
let lines' = lines input | |
sets = L.map S.fromList lines' | |
gemElements = L.foldl1 S.intersection sets | |
in show $ S.size gemElements |
OlderNewer