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
| def modify_cache(cache, key, timeout, callback): | |
| """ | |
| A abstraction from the common, cache.get, if None, cache.set pattern. | |
| Test an uncached value: | |
| >>> cache = __mock_cache(None) | |
| >>> modify_cache(cache, 'foo', 1000, lambda: 1) | |
| 1 | |
| >>> cache.get.assert_called_with('foo') | |
| >>> cache.set.assert_called_with('foo', 1, 1000) |
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
| function arraySum(i) { | |
| return i.reduce(function(sum, x) { | |
| if(x.reduce) { | |
| return sum + arraySum(x); | |
| } else if (typeof x === "number") { | |
| return sum + x; | |
| } else { | |
| return sum; | |
| } | |
| }, 0); |
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
| *.pyc | |
| *~ | |
| .env/ | |
| static/ | |
| data/ | |
| *_pb2.py |
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
| {-# LANGUAGE TemplateHaskell #-} | |
| module MMURL (encodeURL, decodeURL, setActions, actions) where | |
| import Text.Parsec.Prim | |
| import Text.Parsec.Error | |
| import Text.ParserCombinators.Parsec.Char | |
| import Text.ParserCombinators.Parsec.Combinator | |
| import Data.HMAC | |
| import Data.Char (ord) | |
| import Codec.Utils (Octet) |
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
| function maybe(x) { | |
| return { | |
| bind: function(f) { | |
| if(x == null) { | |
| return null; | |
| } else { | |
| return f(x); | |
| } | |
| }, | |
| getDefault: function(y) { |
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
| *.hi | |
| *.o | |
| bin/ | |
| *~ |
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 functools import partial | |
| class Monad(object): | |
| @classmethod | |
| def liftM(cls, f): | |
| def arrow(x): | |
| return cls.ret(f(x)) | |
| def lifted(m): | |
| return cls.bind(m, arrow) |
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
| *.pyc |
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
| simpleParse :: ParseState -> (a, ParseState) | |
| simpleParse = undefined | |
| betterParse :: ParseState -> Either String (a, ParseState) | |
| betterParse = undefined | |
| newtype Parse a = Parse { | |
| runParse :: ParseState -> Either String (a, ParseState) | |
| } |
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 Config (Config, config, dir, enqueue) where | |
| import Data.Sequence (Seq, empty, (|>)) | |
| import qualified Data.Foldable as F | |
| data Config = Config { | |
| dir :: String | |
| , seq :: Seq String | |
| } deriving (Show) |