Skip to content

Instantly share code, notes, and snippets.

View quephird's full-sized avatar

danielle quephird

View GitHub Profile
@quephird
quephird / 01_functional_vs_OO.js
Created March 9, 2012 17:04
Exercise 1 for JavaScript Masters class
function logCar(car) {
console.log("I'm a " + car.color + " " + car.make) ;
}
// Example call for functional version:
logCar({ color: 'blue', make: 'BMW' });
function Car(make, color) {
this.make = make ;
this.color = color ;
@quephird
quephird / 08_inheritance.js
Created March 9, 2012 18:33
Exercise 8 for JavaScript Masters class
// 1. Write a class to support the following code:
var Person = function(name) {
this.name = name;
}
var thomas = new Person('Thomas');
var amy = new Person('Amy');
console.log(thomas.name);
@quephird
quephird / hello_aop.py
Created March 23, 2012 01:52
AOP in Python using logilab library
from logilab.aspects.core import AbstractAspect
from logilab.aspects.weaver import weaver
class MyAspect(AbstractAspect):
def before(self, wobj, context, *args, **kwargs):
print "Before", context['method_name']
def after(self, wobj, context, *args, **kwargs):
print "After", context['method_name']
@quephird
quephird / green-circles.clj
Created May 9, 2012 18:06
green-circles with quil
(ns green-circles
(:use quil.core))
(def *screen-x* 1920)
(def *screen-y* 1080)
(def *circle-d* 64)
(def *rows* (+ 3 (quot *screen-x* *circle-d*)))
(def *cols* (inc (quot *screen-y* *circle-d*)))
(defn- random-rgb []
@quephird
quephird / red-circles.clj
Created May 9, 2012 18:09
red circles with quil
(ns red-circles
(:use quil.core))
(def *screen-x* 1920)
(def *screen-y* 1080)
(def *circle-d* 64)
(def *rows* (+ 3 (quot *screen-x* *circle-d*)))
(def *cols* (inc (quot *screen-y* *circle-d*)))
(defn- random-rgb []
@quephird
quephird / purple-circles.clj
Created May 9, 2012 18:14
purple circles with quil
(ns purple-circles
(:use quil.core))
(def *screen-x* 1920)
(def *screen-y* 1080)
(def *circle-d* 64)
(def *rows* (+ 3 (quot *screen-x* *circle-d*)))
(def *cols* (inc (quot *screen-y* *circle-d*)))
(defn- random-rgb []
@quephird
quephird / concentric-squares.clj
Created May 10, 2012 13:00
concentric squares
(ns concentric-squares
(:use quil.core))
(def *screen-x* 1920)
(def *screen-y* 1080)
(def *square-w* 64)
(def *rows* (inc (quot *screen-x* *square-w*)))
(def *cols* (inc (quot *screen-y* *square-w*)))
(defn- random-rgb []
(ns color-walk
(:use quil.core))
(def screen-w 1920)
(def screen-h 1080)
(def current-color (atom []))
(defn- init-current-color []
(doseq [i (range 3)]
(swap! current-color assoc i (random 255))))
@quephird
quephird / circular-color-walk.clj
Created May 15, 2012 22:41
circular-color-walk
(ns circular-color-walk
(:use quil.core))
(def screen-w 1920)
(def screen-h 1080)
(def current-color (atom []))
(def center-point (atom []))
(defn- init-center-point []
(swap! center-point assoc 0 (random screen-w) 1 (random screen-h)))
(ns sine-wave
(:use quil.core))
(def screen-w 1920)
(def screen-h 1080)
(def current-color (atom []))
(defn- init-current-color []
(doseq [i (range 3)]
(swap! current-color assoc i (random 255))))