+-------------------+-------+------+ | Character | Lives | Dies | +===================+=======+======+ | Walter White | X | | +-------------------+-------+------+ | Skyler White | X | | +-------------------+-------+------+ | Jesse Pinkman | | X | + +-------+------+ | | Uncle Jack |
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
from flask import Flask, render_template | |
from flask.ext.admin import Admin, AdminIndexView, expose | |
class MyHomeView(AdminIndexView): | |
pass | |
app = Flask(__name__) | |
admin = Admin(app, index_view=MyHomeView(name='My Home')) |
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
\set QUIET 1 | |
-- NULL normally displays as an empty string. Make it obvious when a field is | |
-- NULL rather than an actual empty string. | |
\pset null [null] | |
-- Always autocomplete keywords using uppercase. | |
\set COMP_KEYWORD_CASE upper | |
-- Store a database-specific history. |
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
import os | |
import requests | |
resp = requests.get('http://api.meetup.com/2/rsvps', params={ | |
'event_id': 147421542, | |
'rsvp': 'yes', | |
'format': 'json', | |
'offset': 0, | |
'page': 200, | |
'key': os.environ.get('MEETUP_API_KEY'), | |
}) |
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
slate.configAll({ | |
'defaultToCurrentScreen': true, | |
'secondsBetweenRepeat': 0.1, | |
'checkDefaultsOnLoad': true, | |
'focusCheckWidthMax': 3000, | |
'orderScreensLeftToRight': true, | |
}); | |
// screen references | |
var leftScreen = '0'; |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "precise64" | |
config.vm.box_url = "http://files.vagrantup.com/precise64.box" | |
config.vm.provision :shell, :path => "bootstrap.sh" |
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
from kombu import Connection, Exchange, Queue | |
from kombu.mixins import ConsumerMixin | |
queue = Queue('hello', exchange=Exchange('hello', type='direct'), | |
routing_key='hello') | |
class Worker(ConsumerMixin): | |
def __init__(self, connection): |
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
def balanced(s): | |
unmatched = 0 | |
for c in s: | |
if c == ')': | |
if not unmatched: | |
return False | |
unmatched -= 1 | |
elif c == '(': | |
unmatched += 1 | |
return unmatched == 0 |
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
def is_pandigital(*args, n=9): | |
values = set(''.join(map(str, args))) | |
return '0' not in values and len(values) == n |
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
from itertools import chain, islice | |
s1 = '4K Media' | |
s2 = '53 W. 23rd St.' | |
s3 = ''.join(chain(islice(filter(str.isalnum, s1), 4), | |
islice(filter(str.isalnum, s2), 8))) | |
assert s3 == '4KMe53W23rdS' |