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 Main where | |
import Control.Applicative | |
import Data.List | |
import System.Environment | |
data IpAddress = IpAddress String | |
deriving (Show, Eq, Ord) | |
data IpTree = Leaf |
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
"""Python3 Test Server | |
Test server implementation: any get/post request returns all variables | |
and headers or a JSON fixture. Requests for JSON fixtures must include a | |
"json_response" header with file-location value, or a _final_ query parameter | |
of "json_response=file_loc.json". The test-server will attempt to open the | |
file requested and serve that as a json response. If it cannot find the file, | |
it raises an exception. | |
This has been designed so that it is easy to test API-request and processing. |
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/local/bin/python3 | |
from random import choice, randint | |
import sys | |
all_letters = "abcdefghijklmnñopqrstuvwxyz" | |
vowels = "aeiouy" | |
suffix = "bertos" | |
consonants = list(filter(lambda x: x not in vowels, all_letters)) |
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
-- run to find out your taco shop name | |
import System.Random | |
import Control.Monad.State.Lazy | |
all_let :: [Char] | |
all_let = ['a'..'z'] | |
vowels :: [Char] | |
vowels = "aeiouy" |
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 wraps | |
def qfind(json_dict, key): | |
"""Return generator of dicts filtered from `json_dict` that contain `key`. | |
Recursive method for finding nested dictionaries anywhere in a dictionary | |
given a key which may or may not be in the dictionary. | |
This function actually returns the `parent` dictionary that contains a | |
particular key. Consider the following example:: |
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 MultiWayIf #-} | |
module Main where | |
import Control.Monad.IO.Class (liftIO) | |
import Data.Conduit (($$), (=$=), (=$) | |
, Conduit, Sink, Source | |
, await, yield) | |
import qualified Data.Conduit.List as CL | |
import Data.Sequence |
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 Adders ( | |
Binary(..) | |
, halfAdder | |
, adder | |
) where | |
import Data.Monoid | |
data Binary = Zero | |
| One |
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 DataKinds #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
module Api where | |
import Control.Monad.Reader (ReaderT, runReaderT) | |
import Control.Monad.Trans.Either (EitherT) | |
import Data.Int (Int64) | |
import Servant |
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
set -o errexit -o verbose | |
if test -f "$HOME/.local/bin/stack" | |
then | |
echo 'Stack is already installed.' | |
else | |
echo "Installing Stack for $TRAVIS_OS_NAME..." | |
URL="https://www.stackage.org/stack/$TRAVIS_OS_NAME-x86_64" | |
curl --location "$URL" > stack.tar.gz | |
gunzip stack.tar.gz |
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 DataKinds #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
module Api.Post | |
( | |
PostApi |
OlderNewer