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
| print_grid( | |
| columns=('Function', 'Occurences', 'Sender'), | |
| values=[(x['function'], 1337, x['sender']) for x in messages if 'function' in 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 re | |
| import sys | |
| import json | |
| import itertools | |
| from collections import Counter | |
| from collections import defaultdict | |
| SPLIT_MESSAGES = re.compile(r'\n.?\w{3} \w+ +\d+ \d+:\d+:\d+ \d+[\r\s]*\n') | |
| MATCH_SIGNAL = re.compile(r'signal sender=(?P<sender>.*) -> dest=(?P<dest>.*) serial=(?P<serial>.*) path=(?P<path>.*) interface=(?P<interface>.*) member=(?P<member>.*)\n\s+string (?P<function>.*)\n\s+string (?P<params>.*)') | |
| MATCH_METHOD_CALL = re.compile(r'method call sender=(?P<sender>.*) -> dest=(?P<dest>.*) serial=(?P<serial>.*) path=(?P<path>.*) interface=(?P<interface>.*) member=(?P<member>.*)\n\s+string (?P<function>.*)\n\s+string (?P<params>.*)') |
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
| webpack_config.entry.unshift( | |
| 'webpack-dev-server/client?' + argv.root_url, | |
| 'webpack/hot/dev-server' | |
| ); | |
| webpack_config.plugins.unshift( | |
| new webpack.HotModuleReplacementPlugin() | |
| ); | |
| webpack_config.devtool = '#source-map'; | |
| webpack_config.pathInfo = true; |
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
| var config = require('./config'); |
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
| {-| | |
| >>> uriToFTPPort <$> parseURI "ftp://foo:bar@192.168.1.11:50021/hello" | |
| Just 50021 | |
| >>> uriToFTPPort <$> parseURI "ftp://foo:bar@192.168.1.11/hello" | |
| Just 21 | |
| >>> uriToFTPPort <$> parseURI "ftp://192.168.1.11/hello" | |
| Just 21 | |
| -} | |
| uriToFTPPort :: Num a => URI -> a | |
| uriToFTPPort uri = port maybePort |
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
| -- | | |
| -- >>> runNetworkOverTCP testNetwork | |
| -- "hello" | |
| -- >>> runNetworkOverHTTP testNetwork | |
| -- "hello" | |
| -- >>> runNetworkInMemory testNetwork | |
| -- "hello" | |
| testNetwork = do | |
| userA <- createConnection | |
| userB <- createConnection |
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 FlexibleInstances #-} | |
| {-# LANGUAGE FunctionalDependencies #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE UndecidableInstances #-} | |
| {-# LANGUAGE GADTs #-} | |
| module Main where | |
| import Control.Concurrent | |
| import Control.Concurrent.STM |
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
| #!/usr/bin/env python | |
| from logentries import LogentriesHandler | |
| import logging | |
| import time | |
| handler = LogentriesHandler(LOGENTRIES_TOKEN) | |
| log = logging.getLogger('logentries') | |
| log.addHandler(handler) |
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 MyState where | |
| import Control.Monad.State.Lazy | |
| data MyState s a = MyState { state :: s, carry :: a } deriving Show | |
| data MyMonadState s a = MyMonadState (s -> (MyState s a)) | |
| myGet :: MyMonadState s s | |
| myGet = MyMonadState (\s -> (MyState s s)) |
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
| @property | |
| @memoize | |
| def db_connection(): | |
| return DBConnection() |