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
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 ; |
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
// 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); |
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 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'] |
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
(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 [] |
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
(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 [] |
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
(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 [] |
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
(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 [] |
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
(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)))) |
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
(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))) |
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
(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)))) |
OlderNewer