Skip to content

Instantly share code, notes, and snippets.

View css-parser.md
@rm-hull
rm-hull / LISSAJOUS.md
Last active Aug 29, 2015
In mathematics, a Lissajous curve /ˈlɪsəʒuː/, also known as Lissajous figure or Bowditch curve /ˈbaʊdɪtʃ/, is the graph of a system of parametric equations $x=A\sin(at+\delta)$, $y=B\sin(bt)$, which describe complex harmonic motion. This family of curves was investigated by Nathaniel Bowditch in 1815, and later in more detail by Jules Antoine Li…
@rm-hull
rm-hull / cumulative-selection.cljs
Last active Aug 29, 2015
In his 1986 book _The Blind Watchmaker_, Richard Dawkins ponders the infinite monkey problem: The scenario is staged to produce a string of gibberish letters, assuming that the selection of each letter in a sequence of 28 characters will be random. The number of possible combinations in this random sequence is 27^28, or about 10^40, so the proba…
View cumulative-selection.cljs
(ns weasel.cumulative-selection
(:require
[cljs.core.async :as async]
[clojure.string :as str]
[dommy.core :refer [insert-after! set-text! add-class! remove-class!]]
[big-bang.core :refer [big-bang]]
[big-bang.components :refer [slider]]
[weasel.evolution :as evo])
(:require-macros
[dommy.macros :refer [sel1 node]]))
View biomorph-designer.cljs
(ns biomorph.designer
(:require
[cljs.core.async :as async]
[clojure.string :as str]
[dommy.core :refer [insert-after! set-text! add-class! remove-class!]]
[monet.canvas :refer [get-context begin-path close-path
clear-rect quadratic-curve-to
stroke-style stroke-width stroke-cap
line-join move-to line-to stroke]]
[enchilada :refer [canvas-size value-of]]
@rm-hull
rm-hull / illusory-cones.cljs
Last active Aug 29, 2015
An optical illusion in ClojureScript & big-bang, ported from http://djfav.com/2014/01/24/illusory-cones/ - originally written in javascript by Jon Faviell.
View illusory-cones.cljs
(ns big-bang.examples.illusory-cones
(:require
[big-bang.core :refer [big-bang]]
[jayq.core :refer [show]]
[enchilada :refer [ctx canvas canvas-size]]
[monet.canvas :refer [clear-rect circle fill-style fill
save restore translate rotate]]))
(def initial-state
(let [[width height] (canvas-size)]
@rm-hull
rm-hull / plasma.cljs
Last active Aug 29, 2015
Old-skool plasma effect, flogged to death in the early 90's demo scene - the plasma is basically a function on 2D space created by adding together a few sinusoids. By combining different types of sines and adding a time component the illusion of motion is achieved.
View plasma.cljs
(ns big-bang.examples.plasma
(:require
[big-bang.core :refer [big-bang]]
[enchilada :refer [ctx canvas canvas-size]]
[jayq.core :refer [show]]))
(def initial-state
(let [block-size 15
[width height] (map #(quot % block-size) (canvas-size))]
{:t 1 :block-size block-size :w width :h height}))
@rm-hull
rm-hull / newtons-method.cljs
Last active Aug 29, 2015
Newtons method (also know as the Newton-Raphson method) is a textbook example of an iterated method for finding successively better approximations to the roots (or zeroes) of a real-valued function. This program calculates the square root using anonymous recursion by way of the _fixpoint combinator_ (a.k.a. Haskell Curry's paradoxical _Y-combina…
View newtons-method.cljs
(ns fixpoint.newtons-method)
(defn square [x]
(* x x))
(defn average [x y]
(/ (+ x y) 2))
(defn improve [guess x]
(average guess (/ x guess)))
View glass-box.cljs
(ns big-bang.examples.glass-box
(:require-macros
[cljs.core.async.macros :refer [go]]
[dommy.macros :refer [sel1 node]])
(:require
[cljs.core.async :refer [chan <! >!]]
[big-bang.core :refer [big-bang]]
[big-bang.events.browser :refer [prevent-default]]
[dataview.loader :refer [fetch-image]]
[enchilada :refer [webgl proxy-request]]
@rm-hull
rm-hull / lorenz-attractor.cljs
Last active Aug 29, 2015
First studied by Edward Lorenz in 1963, the Lorenz attractor is a system of ordinary differential equations, which for certain parameter values and initial conditions, exhibits chaotic behaviour.
View lorenz-attractor.cljs
(ns big-bang.examples.lorenz-attractor
(:require
[cljs.core.async :as async]
[dommy.core :refer [insert-after!]]
[enchilada :refer [ctx canvas canvas-size value-of]]
[jayq.core :refer [show]]
[monet.canvas :refer [fill-style fill-rect circle translate
stroke-width stroke-cap stroke-style stroke
move-to line-to begin-path]]
[big-bang.core :refer [big-bang]]
@rm-hull
rm-hull / radiant-and-simple.cljs
Last active Aug 29, 2015
A clojurescript implementation of http://www.openprocessing.org/sketch/137835 (originally by Ramiz Midani using _processing.js_). Used to test missing arc and ellipse methods from monet.
View radiant-and-simple.cljs
(ns big-bang.examples.radiant-simple
(:require
[cljs.core.async :as async]
[dommy.core :refer [insert-after!]]
[jayq.core :refer [show]]
[big-bang.core :refer [big-bang]]
[big-bang.components :refer [slider]]
[enchilada :refer [ctx canvas canvas-size value-of]]
[monet.canvas :refer [translate rotate scale save restore
stroke-width stroke-style stroke
You can’t perform that action at this time.