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 a script with Switches""" | |
from switches import command, commandline | |
@command | |
def spam(eggs): | |
"""This function prints the value of eggs""" | |
print eggs |
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
# https://devcenter.heroku.com/articles/django-assets | |
heroku labs:enable user-env-compile -a [app_name] |
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
{ | |
"color_scheme": "Packages/Tomorrow-Night-Bright.tmTheme", | |
"detect_indentation": false, | |
"ensure_newline_at_eof_on_save": true, | |
"find_selected_text": true, | |
"fold_buttons": false, | |
"folder_exclude_patterns": | |
[ | |
"_build", | |
"__pycache__", |
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 | |
"""Checks for anagrams in stdin. | |
Example: $ curl -sL http://thumb.tk/8Qdr | python anagrams.py | |
""" | |
import itertools | |
import sys |
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
>>> class A: | |
... pass | |
... | |
>>> class B(object): | |
... pass | |
... | |
>>> class C: | |
... def __len__(self): | |
... return 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
__all__ = ('flatten',) | |
from collections import Iterable | |
sentinel = [] | |
def flatten(to_flatten): | |
flat = _flatten(to_flatten, lambda x: x) | |
while iterable(flat) and flat and callable(flat[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
#!/usr/bin/env python | |
import os | |
import re | |
import subprocess | |
import sys | |
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)') | |
CHECKS = [ |
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 sys | |
PY2 = sys.version_info[0] == 2 | |
if PY2: | |
_iteritems = 'iteritems' | |
_iterkeys = 'iterkeys' | |
_itervalues = 'itervalues' | |
exec('def reraise(tp, value, tb=None):\n raise tp, value, tb') |
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 unittest | |
from weakref import WeakKeyDictionary | |
class Skippable(object): | |
def __init__(self, field_name): | |
self.data = WeakKeyDictionary() | |
self.field_name = field_name | |
def __get__(self, instance, owner): |
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 collections import deque | |
import curses | |
from random import randrange, shuffle | |
from time import sleep | |
def display(stdscr, state): | |
stdscr.addstr(0, 0, ' '.join(state)) | |
stdscr.addstr(1, 0, ' ' * (len(state) // 2) + '\u2191') |
OlderNewer