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
#!/usr/bin/env python | |
# | |
# Script to convert png files to RGBA color space | |
# Requires Pillow (pip install Pillow) | |
# | |
import os | |
import fnmatch | |
from PIL import Image | |
for root, dirnames, filenames in os.walk('sprites'): |
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
// Usage: require(['twitter'], function (twitter) { twitter.load() }) | |
define(function() { | |
var twitter = { | |
load: executeWhenReady('load') | |
} | |
// Return wrapped function that will | |
// be executed only when twttr is ready | |
function executeWhenReady (funcName) { |
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
var AwesomeObject = function() { | |
this.init() | |
}; | |
AwesomeObject.prototype = { | |
init: function() { | |
_.bindAll(this, 'onSuccess', 'onError', 'onComplete') | |
// or | |
this.onSuccess = $.proxy(this.onSuccess, this) |
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
d = web.input(page_id=None, sizes=[]) | |
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 330, in input | |
out = rawinput(_method) | |
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 303, in rawinput | |
a = cgi.FieldStorage(fp=fp, environ=e, keep_blank_values=1) | |
File "/usr/local/lib/python2.7/cgi.py", line 508, in __init__ | |
self.read_multi(environ, keep_blank_values, strict_parsing) | |
File "/usr/local/lib/python2.7/cgi.py", line 637, in read_multi | |
environ, keep_blank_values, strict_parsing) | |
File "/usr/local/lib/python2.7/cgi.py", line 510, in __init__ |
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 web | |
import json | |
from restful_controller import RESTfulController | |
urls = ( | |
r'/resources(?:/(?P<resource_id>[0-9]+))?', | |
'ResourceController', | |
) | |
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
from web.db import DB, SQLQuery, register_database | |
class SphinxDB(DB): | |
def __init__(self, **keywords): | |
import MySQLdb as db | |
if 'pw' in keywords: | |
keywords['passwd'] = keywords['pw'] | |
del keywords['pw'] | |
if 'charset' not in keywords: |
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
class Form(web.form.Form, object): | |
def __init__(self, name, *inputs, **kw): | |
super(Form, self).__init__(*inputs, **kw) | |
self.name = name | |
def save_state(self): | |
session.forms[self.name] = dict( | |
notes = dict((i.name, i.note) for i in self.inputs if i.note ), | |
values = dict((i.name, i.get_value()) for i in self.inputs ), |
NewerOlder