Skip to content

Instantly share code, notes, and snippets.

View WTFox's full-sized avatar

A. Fox WTFox

View GitHub Profile

Overview

Brief description of what this PR does, and why it is needed.

Fixes #XXX

Demo

Optional. Screenshots, curl examples, etc.

@WTFox
WTFox / apistar-hotdog.py
Created May 22, 2017 11:13
apistar-example
from apistar import App, Include, Route, schema
from apistar.docs import docs_routes
from apistar.http import Response
from apistar.statics import static_routes
_hotdogs = ['hotdog', 'hotdogs']
class Hotdog(schema.String):
@WTFox
WTFox / health.yaml
Created February 17, 2017 17:05
sample tmuxinator config ~/.tmuxinator/health.yml
# ~/.tmuxinator/health.yml
name: health
root: ~/code/health/
# Optional tmux socket
# socket_name: foo
# Runs before everything. Use it to start daemons etc.
pre:
@WTFox
WTFox / safeget.py
Created October 22, 2015 15:29
Perfect for handling nested dictionaries where values might not exist.
def safeget(dct, *keys):
dct = dict(dct)
for key in keys:
try:
dct = dct[key]
except (KeyError, AttributeError, TypeError) as e:
return None
return dct