Skip to content

Instantly share code, notes, and snippets.

@lepoetemaudit
Last active August 29, 2015 14:21
Show Gist options
  • Save lepoetemaudit/d558336f72f982e53d5b to your computer and use it in GitHub Desktop.
Save lepoetemaudit/d558336f72f982e53d5b to your computer and use it in GitHub Desktop.
Tests.md

Sum

sum1(1, 2, 3) == 6

Fizzbuzz

1 1
2 2
3 Fizz
4 4
5 Buzz
6 Fizz
7 Hiss
8 8
9 Fizz
10 Buzz
11 11
12 Fizz
13 13
14 Hiss
15 FizzBuzz
16 16
17 17
18 Fizz
19 19
20 Buzz
21 FizzHiss

Web

GET / => hello
GET /say/{FOO} => You said: $FOO

POST /send_message 
Expected post body should be NAME=$NAME&MESSAGE=$MESSAGE
    [IF $NAME=="BOB"] 
        => {"valid":true, "message": $MESSAGE}
    [ELSE] 
        => {"valid":false, "error": "$NAME is not allowed to post messages"}

Recursion/Generators

class Node():                                       
  def __init__(self, v, children=None):
    self.val = v
    self.children = children

ns = Node(2, [Node(1), Node(3, [Node(4), Node(5)])])
flatten(ns)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment