Skip to content

Instantly share code, notes, and snippets.

rm-hull / simple-demo.cljs
Last active Dec 15, 2015
Demo clojurescript gist for programming enchiladas
View simple-demo.cljs
(ns example)
;; Print output goes to the output buffer
(doseq [a (range 10)
b (range a)]
(println a "x" b "=" (* a b)))
(js/alert "ClojureScript says 'Boo!'")
rm-hull / turtle-demo.cljs
Last active Dec 15, 2015
Demo clojurescript gist to test out -- draws a simple pentagon and other geometric stars using turtle graphics
View turtle-demo.cljs
;; Draws a simple pentagon and other geometric stars using turtle graphics
;; Scale it to fit in a bounding-box of 750x550 px
(ns turtle.demo
(:use [turtle.core :only [draw!]]
[turtle.renderer.canvas :only [->canvas]]
[jayq.core :only [show]]
[enchilada :only [ctx canvas]]))
rm-hull / champernowne.cljs
Last active Dec 15, 2015
Experiments in colourizing digits of transcendental numbers like √2, π and Champernowne's constant - numbers which are not the root of any polynomial with integer coeffients. Whilst an Cambridge undergraduate in 1933, David Champernowne concatenated the positive integers, 1, 2, 3, 4, ..., and lead with a decimal point to yield 0.1234567891011121…
View champernowne.cljs
(ns transcendental-numbers.champernownes-constant
(:use [transcendental-numbers.utils :only [digits integers]]))
(def digit-seq
(mapcat digits integers))
rm-hull / flower-of-life.cljs
Last active Dec 10, 2017
Flower of Life, in ClojureScript ... originally in JavaScript by Tristan Brehaut []: "Randomly generated spiraling energetic patterns depicting the flower of life in 5 dimensions, or something :) Refresh window for a new flower."
View flower-of-life.cljs
;; Adapted from javascript version by Tristan Brehaut at
(ns flower-of-life.demo
(:use [monet.canvas :only [save restore begin-path end-path translate rotate
stroke stroke-style fill-style fill-rect move-to
bezier-curve-to composition-operation]]
[monet.core :only [animation-frame]]
[jayq.core :only [show]]
[enchilada :only [ctx canvas]]))
rm-hull / turmites.cljs
Last active Dec 15, 2015
A turmite is a Turing machine which has an orientation as well as a current state and a "tape" that consists of an infinite two-dimensional grid of cells. Adapted from:
View turmites.cljs
;; Turmites
;; --------
;; A simple N-state two-color Turing machine which operates on a wrapped
;; grid of black and white cells, and follows custom rules on every tick of
;; a clock.
;; Predef rules derived from
;; Copyright (c) Richard Hull 2012
View error.cljs
(ns error.demo)
(+ 3 6
rm-hull / chroma-spirals.cljs
Last active Dec 15, 2015
Rewrote python code [from Peter Derlien], in ClojureScript - see "The Pi-Cubed Programming Challenge : Golden Angle, Sunflowers and Chromospirals"
View chroma-spirals.cljs
; chroma-spirals.cljs
; loosely based on some python code written by Peter Derlien, University of Sheffield, March 2013
; Draws spiralling patterns of circles using the Golden Angle.
(ns chroma-spirals.demo
(:use [monet.canvas :only [fill-style fill-rect circle rotate translate composition-operation]]
[monet.core :only [animation-frame]]
[enchilada :only [ctx canvas]]
[chroma-spirals.color-chart :only [color-seq]]
[jayq.core :only [show]]
rm-hull / heighways-dragon.cljs
Last active Dec 15, 2015
The Heighway dragon (also known as the Harter–Heighway dragon or the Jurassic Park dragon) was first investigated by NASA physicists John Heighway, Bruce Banks, and William Harter. It was described by Martin Gardner in his Scientific American column Mathematical Games in 1967. It is a self-similar fractal curve, which can be approximated by recu…
View heighways-dragon.cljs
(ns lindenmayer-systems.demo
(:use [turtle.core :only [draw!]]
[turtle.renderer.canvas :only [->canvas]]
[enchilada :only [ctx canvas]]
[jayq.core :only [show]]))
(def dragon-seq
"Unfolding the dragon"
(letfn [(seq0 [x y]
(lazy-seq (cons (flatten x) (seq0 [x :right 90 y :fwd 20] [:fwd 20 x :left 90 y]))))]
rm-hull / arnolds-cat-map.cljs
Last active Dec 16, 2015
Arnold's cat map is named after the mathematician Vladimir Arnold, who in the 1960s demonstrated the effect of repeatedly applying a linear transformation to an image of a cat (hence the name). Each animation frame transforms the pixels according to the pisano period of the largest dimension (width or height). Eventually the image will restore b…
View arnolds-cat-map.cljs
(ns arnolds-cat-map.demo
(:use [monet.canvas :only [draw-image get-pixel composition-operation]]
[monet.core :only [animation-frame]]
[enchilada :only [ctx canvas proxy-request]]
[jayq.core :only [show]]
[jayq.util :only [wait]])
(:use-macros [dommy.macros :only [sel1 node]]))
(def cat-resources
rm-hull / us-choropleth.cljs
Last active Dec 16, 2015
Example choropleth from demonstrating C2 integration. C2 is a Clojure and ClojureScript data visualization library that lets you declaratively create HTML and SVG markup based on data.
View us-choropleth.cljs
(ns us-choropleth.demo
(:use-macros [c2.util :only [bind!]])
(:use [jayq.core :only [show hide]]
[c2.core :only [unify]]
[c2.maths :only [extent floor]]
[c2.geo.core :only [geo->svg]]
[c2.geo.projection :only [albers-usa]]
[ :only [states]]
[enchilada :only [canvas svg]])
(:require [c2.scale :as scale]
You can’t perform that action at this time.