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
| vagrant@precise:/tmp/tests ⚡ | |
| > ll | |
| total 12K | |
| -rw-r--r-- 1 vagrant vagrant 25 Apr 11 13:04 test_a.py | |
| -rw-r--r-- 1 vagrant vagrant 25 Apr 11 13:04 test_b.py | |
| -rw-r--r-- 1 vagrant vagrant 25 Apr 11 13:04 test_c.py | |
| vagrant@precise:/tmp/tests ⚡ | |
| > cd -1 | |
| ~/.virtualenvs |
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 repr(obj): | |
| mod = obj.__class__.__module__ | |
| cls = obj.__class__.__name__ | |
| mem = '0x' + hex(id(obj))[2:] | |
| return '<{0}.{1} instance at {2}>'.format(mod, cls, mem) |
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
| import collections | |
| def vivify(): | |
| return collections.defaultdict(vivify) |
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
| #!/usr/bin/env python | |
| ''' | |
| ISC style license | |
| http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/share/misc/license.template?rev=HEAD | |
| --- | |
| Copyright (c) 2011, 2012 Curve <justin@curvehq.com> | |
| Permission to use, copy, modify, and distribute this software for any | |
| purpose with or without fee is hereby granted, provided that the above | |
| copyright notice and this permission notice appear in all copies. |
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/sh | |
| set_project_vars() { | |
| if [ "$1" == 'on' ] | |
| then | |
| export SOMA_BUILD_DIR=~/Projects/al/soma_git_dump | |
| export AWS_CREDENTIAL_FILE=~/Projects/al/creds/boto | |
| echo SOMA_BUILD_DIR=$SOMA_BUILD_DIR | |
| echo AWS_CREDENTIAL_FILE=$AWS_CREDENTIAL_FILE |
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
| date --iso-8601=minutes | sed 's/://' | cut -d"+" -f1 |
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
| module AuthenticationHelpers | |
| # Example usage: login mock_user(Editor) | |
| def login(user) | |
| request.env['warden'] = mock(Warden, | |
| :authenticate => user, | |
| :authenticate! => user) | |
| end | |
| def mock_user(type, stubs={}) | |
| mock_model(type, stubs).as_null_object |
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
| > cat ~/.bin/git-vary | |
| #!/bin/sh | |
| ( | |
| set -e | |
| target=$1 | |
| git log --oneline --graph --decorate $(git merge-base $target HEAD)^.. $target HEAD | |
| ) | |
| > git checkout some_branch && git vary master |
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 templates(): | |
| results = ['I am html', 'I am text', 'I am subject'] | |
| def side_effect(*args): | |
| return results.pop(0) | |
| return side_effect | |
| render_to_string = Mock(side_effect=templates()) |
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
| from .settings import * | |
| LOGGING['formatters']['logsna'] = {'()': 'logsna.Formatter'} | |
| db_handler = {'level': 'INFO', | |
| 'class': 'logging.handlers.RotatingFileHandler', | |
| 'filename': here('logs', 'db.log'), | |
| 'maxBytes': 4194304, | |
| 'formatter': 'logsna', |