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
"""SQLAlchemy Metadata and Session object""" | |
import datetime | |
import json | |
import time | |
from sqlalchemy import MetaData | |
from sqlalchemy.orm import scoped_session, sessionmaker | |
__all__ = ['Session', 'metadata', 'Model', 'SchemaEncoder'] |
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
# ... | |
LOGGING = { | |
# ... | |
'handlers': { | |
'console': { | |
'level': 'DEBUG', | |
'class': 'logging.StreamHandler', | |
}, | |
# ... | |
}, |
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
#!/bin/bash | |
# Backup all the things, and delete old backups. (Perfect for a nightly cron job.) | |
# How many old backups should we keep? | |
NUM_OLD_BACKUPS=5 | |
# Which databases should we worry about? | |
DATABASE_PREFIX="foo" | |
## |
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
startup_message off | |
hardstatus alwayslastline | |
hardstatus string "%= %{r} Quit by hitting: qq" | |
escape q; | |
bind q quit | |
screen -t "Serve HTTP" 1 make serve | |
screen -t "Serve CSS" 2 make css_watch |
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
#!/bin/bash | |
# post-receive hook to push-deploy multiple branches using a git repo. | |
# | |
# Deploy by pushing $DEPLOY_BRANCH | |
# Rollback by force-pushing a new reference to $OVERRIDE_TAG | |
# | |
# 1. Setup your git repo: | |
# | |
# git init --bare | |
# |
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
(function() { | |
// This is a new closure. If things that happen here don't have side-effects on outside scope, | |
// then whatever happens here will not be visible outside of it. | |
(function() { | |
// You can make closures inside of closure (inside of closures). Wee. | |
})(); | |
})(); | |
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
def brandon_rhodes(): | |
"""Complete the foo of the 1st argument. | |
Completing the foo is always difficult, you know? | |
But this function does it, else raises ValueError. | |
""" | |
pass | |
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
REQUIREMENTS_FILE=requirements.txt | |
REQUIREMENTS_OUT=requirements.txt.log | |
SETUP_OUT=*.egg-info | |
all: setup requirements | |
requirements: $(REQUIREMENTS_OUT) | |
$(REQUIREMENTS_OUT): $(REQUIREMENTS_FILE) | |
pip install -r $(REQUIREMENTS_FILE) | tee $(REQUIREMENTS_OUT) |
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
requirements: requirements.txt.out | |
requirements.txt.out: requirements.txt | |
pip install -r requirements.txt | tee requirements.txt.out |
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
class TestUtil(TestCase): | |
def test_split_first(self): | |
test_cases = [ | |
( | |
('abcd', ['b']), | |
('a', 'cd') | |
), | |
( | |
('abcd', ['c', 'b']), | |
('a', 'cd')), |