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
# For Python unit testing, an idea for how to use a context manager for | |
# a unittest.TestCase instead of the setUp() and tearDown() methods. | |
# | |
# This is a possible answer to-- | |
# | |
# http://stackoverflow.com/questions/8416208/in-python-is-there-a-good-idiom-for-using-context-managers-in-setup-teardown | |
from contextlib import contextmanager | |
import unittest |
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
# Sample code for: https://github.com/defunkt/pystache/issues/123 | |
class MyClass(object): | |
def __init__(self, data): | |
self.attr = 5 | |
self.data = data | |
def __getitem__(self, key): | |
return self.data[key] |
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
dir_names=`ls tests` | |
for dir_name in $dir_names | |
do | |
git mv "tests/$dir_name/project" "tests/$dir_name/structure" | |
done |
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
# Mac OSX: initialize a new Terminal tab from the Terminal command-line. | |
# | |
# Usage: osascript newtab.scpt TITLE PATH | |
# | |
# Summary: | |
# | |
# (1) opens a new terminal tab in the same window, | |
# (2) sets the title of the tab, and | |
# (3) cds into an initial directory. | |
# |
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 unittest | |
def run_tests(data): | |
extra_tests = create_extra_tests(data) | |
test_program_class = make_test_program_class(extra_tests) | |
# In this constructor call you can include any of the arguments supported | |
# by unittest.main(). | |
test_program_class() # runs tests. |
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 | |
# Set the title of a Mac Terminal. From-- | |
# http://www.devdaily.com/blog/post/mac-os-x/change-title-bar-of-mac-os-x-terminal-window | |
settitle() { | |
echo -n -e "\033]0;${1}\007" | |
} |
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 | |
# coding: utf-8 | |
""" | |
A script to use in conjunction with git-bisect to find the point | |
in pystache's development branch at which issue #53 was fixed: | |
https://github.com/defunkt/pystache/pull/53 | |
Because git-bisect expects the "bad" outcome to come after the "good" |
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
Test | |
==== | |
http://github.com | |
<http://github.com> | |
http://github.com | |
test: http://github.com |
NewerOlder