Perquisites:
brew install jpeg
pip install --upgrade --no-install PIL
Edit setup.py:
vi $VIRTUAL_ENV/build/PIL/setup.py
Change:
import base64 | |
import os | |
from binascii import b2a_base64 | |
from math import ceil | |
from tempfile import TemporaryFile, NamedTemporaryFile | |
from timeit import timeit | |
def original_chunked_encode(input, input_size, output, read_size=1024): | |
""" |
""" | |
Split a logfile by days | |
""" | |
import sys, os, re | |
filename = sys.argv[1] | |
out_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logs') |
""" | |
Hawk (https://github.com/hueniverse/hawk) Python example | |
The client attempts to access a protected resource without authentication, | |
sending the following HTTP request to the resource server: | |
GET /resource/1?b=1&a=2 HTTP/1.1 | |
Host: api.example.com:443 | |
The resource server returns an authentication challenge. |
from pingspot.dal.users import UserService | |
import uuid | |
def test_foursquare_auth_token(dal, uniqueuser): | |
user = uniqueuser() | |
auth_token = str(uuid.uuid4()) | |
# No need to return anything, an error will be raised if something went wrong | |
dal.users.set_foursquare_auth_token(user, auth_token) | |
### | |
Creates a function that will delay the execution of `func` until after | |
`wait` milliseconds have elapsed since the last time it was invoked. Pass | |
`true` for `start` to cause debounce to invoke `func` on the leading edge | |
of the `wait` timeout. Subsequent calls to the debounced function will | |
return the result of the last `func` call. | |
### | |
debounce = (opt, func) -> | |
if typeof opt is 'number' | |
opt = {wait: opt} |
// Some versions to test [v1, v2, expected result] | |
var versions = [ | |
['1.2.0', '1.2', 0], | |
['1.4', '1.7.2', 1], | |
['1.2pre', '1.2', 1], | |
['1.7', '1.1.1', -1], | |
['1.7.9RC1', '1.7.9RC2', 1], | |
['1.7.9RC1', '1.7.9RC', -1], | |
['1.7.9RC1', '1.7.9', 1], | |
['0.4beta', '0.4', 1], |
[alias] | |
# Start a feature branch (git start myfeature) | |
start = !"git flow feature start $1" | |
# Finish current git flow branch (git finish) | |
finish = !"git flow $(BRANCH=$(git for-each-ref --format='%(refname:short)' `git symbolic-ref HEAD`); echo ${BRANCH%/*} finish ${BRANCH##*/})" |
// Dependency resolution, adapted from https://gist.github.com/1232505/f16308bc14966c8d003c2686b1c258ec41303c1f | |
function resolve(graph) { | |
var sorted = [], // sorted list of IDs ( returned value ) | |
visited = {}; // hash: id of already visited node => true | |
// 2. topological sort | |
Object.keys(graph).forEach(function visit(name, ancestors) { | |
if (!Array.isArray(ancestors)) ancestors = []; | |
ancestors.push(name); | |
visited[name] = true; |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/> | |
<style> | |
body { | |
margin: 0; |
Perquisites:
brew install jpeg
pip install --upgrade --no-install PIL
Edit setup.py:
vi $VIRTUAL_ENV/build/PIL/setup.py
Change: