Skip to content

Instantly share code, notes, and snippets.

import media
def sum_red(pic):
total = 0
for p in pic:
r = media.get_red(p)
total = r + total
return total
def ReturnExample():
return 5
x = ReturnExample()
print x # Prints 5
import media
COLOUR_MAX = 255
COLOUR_MIN = 0
def get_picture():
'''Solicit user input to select a file and load it as a Picture.
Return the Picture.
'''
filename= media.choose_file()
import media
COLOUR_MAX = 255
COLOUR_MIN = 0
def get_picture():
'''Solicit user input to select a file and load it as a Picture.
Return the Picture.
'''
filename= media.choose_file()
@jamesnvc
jamesnvc / jamesnvc-quix.txt
Created March 26, 2010 23:36
My quix commands
> James Cash's Custom Quix Commands
@James Cash's Custom Quix Commands
src view-source:%r View source natively
insta javascript:function%20iprl5(){var%20d=document,z=d.createElement('scr'+'ipt'),b=d.body,l=d.location;try{if(!b)throw(0);d.title='(Saving...)%20'+d.title;z.setAttribute('src',l.protocol+'//www.instapaper.com/j/pL8VMUDiGTio?u='+encodeURIComponent(l.href)+'&t='+(new%20Date().getTime()));b.appendChild(z);}catch(e){alert('Please%20wait%20until%20the%20page%20has%20loaded.');}}iprl5();void(0) Add to Instapaper
def replace_template(map, template):
trie = Trie(map)
iter = template.__iter__
for c in iter:
if c != '$': print c
else:
s = iter.next()
trie.lookup(iter)
if replacement:
print replacement