This file contains 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 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 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:[email protected]:50021/hello" | |
Just 50021 | |
>>> uriToFTPPort <$> parseURI "ftp://foo:[email protected]/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 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 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 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 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 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() |
This file contains 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
In [3]: def foo(): yield 1; yield 2; return | |
In [4]: def foo(): yield 1; yield 2; return 3 | |
File "<ipython-input-4-e56b14727cad>", line 1 | |
def foo(): yield 1; yield 2; return 3 | |
SyntaxError: 'return' with argument inside generator |
This file contains 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
/* build recursive category */ | |
create table category ( | |
id uuid primary key default uuid_generate_v4(), | |
name text not null, | |
parent uuid, | |
foreign key (parent) references category(id) | |
); | |
insert into category values (default, 'food', null); | |
insert into category values (default, 'snacks', (select id from category where name = 'food')); |