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 json as jsonlib | |
def response_success(response, code=200): | |
if 200 <= code < 300: | |
assert 200 <= response.status_code < 300 | |
assert code == response.status_code | |
def response_error(response, code=400): | |
if 400 <= code < 500: | |
assert 400 <= response.status_code < 500 |
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
define ['jquery', 'underscore', 'backbone'], ($, _, Backbone) -> | |
# The queryset iterator is a helper that builds iterator functions that allow simple string matching such as: | |
# sample_iterator = (model) -> | |
# return model.get(key) == value | |
class QuerysetIterator | |
constructor: (expressions) -> | |
@expressions = expressions | |
iterator: (model) -> | |
for key, value in @expressions |
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
function auto_activate { | |
SEARCHPATH=`pwd` | |
function activate_env { | |
# ZSH outputs errors for the ls * command if you don't disable the nomatch output | |
unsetopt nomatch 2>/dev/null | |
ls $SEARCHPATH/*/bin/activate > /dev/null 2> /dev/null | |
if [ "$?" = '0' ]; then | |
deactivate > /dev/null 2> /dev/null |
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
# This is an implementation using python-oembed with api.embed.ly | |
# python-oembed http://code.google.com/p/python-oembed/ | |
import oembed | |
# Embed.ly Multi Provider API Endpoint | |
OEMBED_ENDPOINT = 'http://api.embed.ly/oembed/api/v1' | |
# URL Schemes Supported --- complete list maintained | |
# http://api.embed.ly/1/services/python |
NewerOlder