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/python | |
# led.py - Sample classes and methods to get you started with LED's the OOP way. | |
def send_val_to_pin(pin, colorval): | |
print "Pin: %s | ColorVal: %s" % (str(pin), str(colorval)) | |
class LED: | |
def __init__(self, pin_r, pin_g, pin_b): | |
self.pin_r = pin_r | |
self.pin_g = pin_g |
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 pickle | |
data1 = {'a': [1, 2.0, 3, 4+6j], | |
'b': ('string', u'Unicode string'), | |
'c': None} | |
selfref_list = [1, 2, 3] | |
selfref_list.append(selfref_list) | |
output = open('data.pkl', 'wb') |
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
from django.http import HttpResponseRedirect | |
def has_perm_or_redirect(permission, redirect): | |
def wrapper(function): | |
def wrapped_function(request, *args, **kwargs): | |
if request.user.has_perm("tpd4.NONE"): | |
print request.user.has_perm("blah") | |
return function(request, *args, **kwargs) | |
else: | |
return HttpResponseRedirect(redirect) |
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
from pyquery import PyQuery as pq | |
import sys | |
import subprocess | |
import os | |
from urllib2 import urlopen, URLError, HTTPError | |
def convert(input_file, output_gif): | |
print "CONVERT", input_file, " => ", output_gif | |
subprocess.call(["mplayer", input_file, "-ao", "null", "-ss", "0:0:0", "-endpos", "6", "-vo", "gif89a:fps=8:output=%s" % output_gif, "-vf", "scale=240:180"]) |
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 os | |
import re | |
from collections import defaultdict | |
# Directories to inspect all .h, .c, .cpp files inside | |
TARGET_DIRECTORIES = ["source", "include"] | |
def getfilepaths(target_directory): | |
all_files = [] |
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
" | |
" | | | |
" . , . . ,---. ,---| | ,---. | |
" \ / | | | | | | | |---' | |
" ' '---' ' ' `---' '--- `--- | |
" | |
" ----------------------------------- | |
" :BundleList - list configured bundles | |
" :BundleInstall(!) - install(update) bundles | |
" :BundleSearch(!) foo - search(or refresh cache first) for foo |
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
Ariel Pink's Haunted Graffiti - Only In My Dreams | |
Beach Fossils - What A Pleasure | |
Belle & Sebastian - Get Me Away From Here, I'm Dying | |
Best Coast - The Only Place | |
Deerhunter - Desire Lines | |
Diiv - Human | |
Dirty Gold - California Sunrise | |
Dom - Rude As Jude | |
Fools Gold - Surprise Hotel | |
Future Islands - Balance |
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
/** @jsx React.DOM */ | |
var React = require('react'); | |
var Store = require('./Store.js'); | |
var actions = require('./actions.js'); | |
var Cell = React.createClass({ | |
getInitialState: function () { | |
console.log("Cell init") | |
return { |
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
function process_image(image_data) { | |
} | |
function get_imgur_image(params, callback) { | |
$.get("imgur url", params, function(data) { | |
if(data === not what you're looking for) { | |
get_imgur_image(updated_params, callback); | |
} | |
else { | |
callback(data) |
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
var seen_images = [...] | |
var process_image = function() { /* render */ }; | |
var find_image = function(page_num, callback) { | |
$.get('url', {page: page_num}, function(image_list) { | |
var new_image_found = false; | |
for(var i = 0; i < image_list.length; ++i) { | |
if(seen_images.indexOf(image_list[i]) == -1) { |
OlderNewer