Skip to content

Instantly share code, notes, and snippets.

@rogerallen
rogerallen / README.md
Last active August 29, 2015 14:15 — forked from mbostock/.block

This examples demonstrates how to use D3's brush component to implement focus + context zooming. Click and drag in the small chart below to pan or zoom.

Modified from Mbostock's original to use SVG transform/scale instead of re-deriving the area chart. Seems to be much faster in larger datasets.

@rogerallen
rogerallen / fiddle.js
Last active August 29, 2015 14:15
three.js fiddle playing with plane geometry
var camera, scene, renderer, geometry, material, mesh;
var geometry2, material2, mesh2;
var frame;
init();
animate();
function init() {
frame = 0;
scene = new THREE.Scene();
@rogerallen
rogerallen / 000_tweemeegee.txt
Last active August 29, 2015 14:22
twee gee mee archive (alpha)
Archive the code for https://twitter.com/tweegeemee.
@rogerallen
rogerallen / 0_tweegeemee.txt
Last active August 29, 2015 14:22
twee gee mee archive
Archive of the code for images posted to https://twitter.com/tweegeemee
Learn more at https://github.com/rogerallen/tweegeemee
@rogerallen
rogerallen / 0_tweegeemee.txt
Last active August 30, 2015 19:59
twee gee mee archive
Archive of the code for images posted to https://twitter.com/tweegeemee
Learn more at https://github.com/rogerallen/tweegeemee
@rogerallen
rogerallen / utils.R
Created January 24, 2012 15:53
Roger's Utility Functions for R
# Roger's Utility Functions for R
#
# source("Documents/Devel/R/utils.R")
#
isMac <- function()
{
x <- Sys.info()[1]=="Darwin"
x
}
@rogerallen
rogerallen / test.clj
Created May 17, 2012 00:53
ClojureProgramming Issue 7 problem with Maze/Ariadne's Zip
;; providing this for https://github.com/clojurebook/ClojureProgramming/issues/7
;; I just copy-pasted the relevant code from
;; https://github.com/clojurebook/ClojureProgramming/blob/master/ch03-collections-repl-interactions.clj
;; there were a couple changes. see comments below...
(defn maze
"Returns a random maze carved out of walls; walls is a set of
2-item sets #{a b} where a and b are locations.
@rogerallen
rogerallen / insulter.clj
Created July 28, 2012 04:38
Shakespeare Insulter in Clojure
;;
;; http://www.pangloss.com/seidel/shake_rule.html
;; Shakespeare Insult Kit
;;
;; Combine one word from each of the three columns below, prefaced with "Thou":
;;
(defn split [s]
(.split s "[ \t\r\n]+"))
@rogerallen
rogerallen / diffeq.clj
Created July 30, 2012 16:18
Testing Tempo via Direct & Numerical Integration
(ns explore_overtone.diffeq)
;; we start with a differential equation:
;;
;; tempo = f(beat) or dx/dt = bps-fn(x)
;;
;; Solving the diff eq via separable eq. gives: (thanks to Tony Grabowski for his help)
;;
;; dt = dx/bps-fn(x) so t = Integrate 1/bps-fn(x) dt or Integrate spb-fn(x) dt
;; t = log(b + mx) / m - log(b) (since we set t = 0 at x = 0)
@rogerallen
rogerallen / everysong.clj
Created October 30, 2012 00:15
one chord progression
;; one chord progression to rule them all
;; The I - V - vi - IV (or C - G - Am - F)
;; iii?
;; Am F C G
;; C G Am F
;; G D Em C
;; D A Bm G
;; A E F#m D
;; E B C#m A
(ctl g :pre-amp 4.0 :distort 0.2