Skip to content

Instantly share code, notes, and snippets.

Richard Hull rm-hull

Block or report user

Report or block rm-hull

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rm-hull
rm-hull / BIG-BANG-RPS.md
Last active Aug 29, 2015
A Rock-Paper-Scissors game in ClojureScript, using core.async and big-bang.
View BIG-BANG-RPS.md

Rock Paper Scissors

A familiar game implemented using Big-Bang, a ClojureScript library inspired by Racket's big-bang. It abstracts the GUI event-loop into a component based system, allowing self-contained big-bang 'worlds' to communicate over core.async channels, in a reactive CSP style.

In this example, the main file builds some DOM elements and fetches various SVG assets for inclusion on the page. Then, three big-bang components are initialized:

@rm-hull
rm-hull / PARAMETRIC-EQUATIONS.md
Last active Aug 29, 2015
An animated render of a parametric equation in ClojureScript with big-bang. A curve is swept out where the trajectory of a point is usually represented by a parametric equation with the time as parameter.
View PARAMETRIC-EQUATIONS.md

Parametric Equations

Using:

x

y

Where t increases monotonically, and k can be varied with the slider below, the (x,y) co-ordinates sweep out the curve of a distressed Cardioid. When k = 0.5 the curve sweeps out a perfect Cardioid.

@rm-hull
rm-hull / chess.cljs
Last active Aug 29, 2015
OM version of Garry Kasparov - Veselin Topalov ; Hoogovens A Tournament Wijk aan Zee NED 1999.01.20 - adapted from https://raw2.github.com/danieroux/rubyfuza2014/master/src/rubyfuza/core.cljs
View chess.cljs
; Adapted from https://raw2.github.com/danieroux/rubyfuza2014/master/src/rubyfuza/core.cljs
(ns rubyfuza.core
(:require-macros
[cljs.core.async.macros :refer [go]])
(:require
[clojure.string :as str]
[om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[cljs.core.async :as async :refer [put! chan <! >! timeout]]))
@rm-hull
rm-hull / polyhedra.cljs
Last active Aug 29, 2015
Explore a variety of polyhedric solids: ClojureScript demo using big-bang for orchestration between GUI components, and the wireframes library for 3D rendering. The polygon data files are derived from http://www.netlib.org/polyhedra/, and read using abstractions over XmlHttpRequests and core.async. NOTE: Some of the shape files do not have prope…
View polyhedra.cljs
(ns polyhedra.examples.demo
(:refer-clojure :exclude [identity])
(:require-macros
[cljs.core.async.macros :refer [go]]
[dommy.macros :refer [sel1 node]])
(:require
[clojure.string :refer [split-lines]]
[cljs.core.async :refer [chan <! >!]]
[dommy.core :refer [insert-after!]]
[enchilada :refer [ctx canvas canvas-size proxy-request]]
@rm-hull
rm-hull / PHOTOSPHERE.md
Last active Aug 29, 2015
Mapping panoramic photos (taken with a Nexus 4) onto the inside of a sphere, using PhiloGL and mouse gestures orchestrated (badly) with ClojureScript - the rotation in the Y plane is currently not working as it should...
View PHOTOSPHERE.md

WebGL & Clojurescript

Ensure that you have a WebGL-capable browser to view this gist

@rm-hull
rm-hull / solar-system.cljs
Last active Aug 29, 2015
An example in orbiting bodies in ClojureScript with big-bang, inspired by a 'Translation and Rotation in 2D and 3D' tutorial by David Meredith, Aalborg University
View solar-system.cljs
(ns big-bang.examples.solar-system
(:require
[big-bang.core :refer [big-bang]]
[big-bang.components :refer [dropdown slider color-picker]]
[enchilada :refer [ctx canvas canvas-size proxy-request]]
[monet.canvas :refer [circle fill fill-style stroke-style stroke
clear-rect save restore translate rotate]]
[jayq.core :refer [show]]))
(def width (first (canvas-size)))
@rm-hull
rm-hull / mandelbrot.cljs
Last active Aug 29, 2015
Mandlebrot & Julia fractal generator, based on clojure code originally described in http://webrot.destructuring-bind.org/mandlebrot. Click the left mouse button to zoom in, and the right button to zoom out. _Recently updated to progressively render the image for better initial performance._ TODO - make use of web-workers to improve render perfor…
View mandelbrot.cljs
(ns webrot.fractal
(:require-macros
[cljs.core.async.macros :refer [go]]
[dommy.macros :refer [sel1 node]])
(:require
[clojure.string :as str]
[cljs.core.async :refer [chan <! >!]]
[dommy.core :refer [insert-after!]]
[jayq.core :refer [$ hide show]]
[big-bang.core :refer [big-bang]]
@rm-hull
rm-hull / barnsley-fern.cljs
Last active Aug 29, 2015
The Barnsley Fern is a fractal named after the British mathematician Michael Barnsley who first described it in his book _Fractals Everywhere_. The fern is one of the basic examples of self-similar sets, i.e. it is a mathematically generated pattern that can be reproducible at any magnification or reduction. Like the Sierpinski triangle, the Bar…
View barnsley-fern.cljs
(ns big-bang.examples.barnsley-fern
(:require
[jayq.core :refer [show]]
[big-bang.core :refer [big-bang]]
[enchilada :refer [ctx canvas canvas-size]]
[monet.canvas :refer [fill-rect fill-style]]))
(def width (first (canvas-size)))
(def height (second (canvas-size)))
(def scale (/ height 10))
@rm-hull
rm-hull / cellular-automata.cljs
Last active Aug 29, 2015
Cellular automata - randomly picks one of: Conways Life, Semi-vote, Vichniac vote (stable & unstable) or Fredkin. Renders using _big-bang_ onto a canvas element, but could probably be written more efficiently using _core.async_ more intelligently.
View cellular-automata.cljs
(ns cellular-automata.core
(:require-macros
[cljs.core.async.macros :refer [go]]
[dommy.macros :refer [sel1 node]])
(:require
[cljs.core.async :refer [chan <! >!]]
[dommy.core :refer [insert-after!]]
[jayq.core :refer [$ hide show]]
[big-bang.core :refer [big-bang]]
[big-bang.components :refer [dropdown slider]]
@rm-hull
rm-hull / recursive-trees.cljs
Last active Aug 29, 2015
A recursively generated tree is simply _a branch with a tree on the end of it_.
View recursive-trees.cljs
(ns big-bang.demo.recursive-trees
(:require-macros
[cljs.core.async.macros :refer [go]]
[dommy.macros :refer [sel1 node]])
(:require
[cljs.core.async :refer [chan <! >!]]
[dommy.core :refer [insert-after!]]
[jayq.core :refer [$ hide show]]
[big-bang.core :refer [big-bang]]
[big-bang.components :refer [dropdown slider]]
You can’t perform that action at this time.