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 / color-vortex.cljs
Created Dec 6, 2014
Faux rotating torus testing alpha channels with HSV->RGB color conversion in https://github.com/rm-hull/inkspot. Click the canvas area to toggle between solid color and wireframe. Inspiration: Jerome Herr's http://openprocessing.org/sketch/160303
View color-vortex.cljs
(ns enchilada.color-vortex
(:require
[jayq.core :refer [show css]]
[enchilada :refer [ctx canvas canvas-size]]
[inkspot.color :refer [coerce red green blue]]
[inkspot.converter :refer [hsv->rgb]]
[big-bang.core :refer [big-bang]]
[big-bang.events.browser :refer [offset-coords]]
[monet.canvas :refer [stroke-style stroke fill-style fill fill-rect
ellipse save restore translate]]))
@rm-hull
rm-hull / slinky.cljs
Created Dec 5, 2014
A slinky - move the cursor over the grey area and the slinky will follow. Based on _Jean-no_'s http://openprocessing.org/sketch/173277
View slinky.cljs
(ns enchilada.slinky
(:require
[jayq.core :refer [show css]]
[enchilada :refer [ctx canvas canvas-size]]
[big-bang.core :refer [big-bang]]
[big-bang.events.browser :refer [offset-coords]]
[monet.canvas :refer [stroke-style stroke fill-style fill fill-rect arc begin-path close-path]]))
(def screen-area
(let [[w h] (canvas-size)]
@rm-hull
rm-hull / REACTION-DIFFUSION-MORPHOGENESIS.md
Last active Aug 29, 2015
In 1952, Alan Turing wrote a paper proposing a reaction–diffusion model as the basis of the development of patterns such as the spots and stripes seen in animal skin. Mathematically, reaction–diffusion systems take the form of semi-linear parabolic partial differential equations. By iteration 300, it should be clear how the two elements have sep…
@rm-hull
rm-hull / BOYS-SURFACE.md
Last active Aug 29, 2015
In 1901, Werner Boy (under direction from David Hilbert) discovered a non-orienting surface which is a self-intersecting immersion of the real projective plane in 3-dimensional space. The surface is obtained by sewing a Möbius strip to the edge of a disk, given by the parametric equations below.
View BOYS-SURFACE.md

$\mathbb{R}^3$ Parametric equations

$x = {\sqrt 2 \cos^2 v \cos (2u) + \cos u \sin (2v) \over 2 - \alpha \sqrt 2 \sin (3u) \sin (2v)}$

$y = {\sqrt 2 \cos^2 v \sin (2u) - \sin u \sin (2v) \over 2 - \alpha \sqrt 2 \sin (3u) \sin (2v)}$

$z = {3 \cos^2 \over 2 - \alpha \sqrt 2 \sin (3u) \sin (2v)}$

for $u \in [-\pi /2, \pi/2]$ and $v \in [0, \pi]$

@rm-hull
rm-hull / INSTRUCTIONS.md
Last active Aug 29, 2015
Experimenting with some basic image dithering, in the style of 10 PRINT (see also http://programming-enchiladas.destructuring-bind.org/rm-hull/4bf4ce47c4f615e9cfe6), the idea was inspired by _bitcraft's_ OpenProcessing version: http://openprocessing.org/sketch/82451.
View INSTRUCTIONS.md
  • Move the mouse horizontally to change threshold point
  • Click the mouse to alter the resolution
  • Press the 'C' key to cycle between [10-Print, Greyscale, Inverse, Solarize]
  • Refresh the page for a different image (chosen at random)
View introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@rm-hull
rm-hull / rotating-spiral.cljs
Last active Aug 29, 2015
A common optical illusion that is a static image, but appears to move as you look at different parts of the image - first popularised by Akiyoshi Kitaoka, Ritsumeikan University (http://www.ritsumei.ac.jp/~akitaoka/index-e.html). This gist based on a processing-js script at http://www.openprocessing.org/sketch/131928.
View rotating-spiral.cljs
(ns enchilada.rotating-spiral
(:require
[jayq.core :refer [show]]
[enchilada :refer [ctx canvas]]
[big-bang.core :refer [big-bang]]
[monet.canvas :refer [fill-style fill ellipse rotate translate save restore fill-rect]]))
(def initial-state {
:angle 0
:radius 600
@rm-hull
rm-hull / _corewar.cljs
Last active Aug 29, 2015
An _in-progress_ implementation of A.K.Dewdney's "Corewar" in ClojureScript. There are many things that don't quite work properly yet, such as handling when a redcode assembly program is terminated. By default four (non-selectable) redcode programs are pitted against each other - at some point these will be loaded at random from a hill. The inst…
View _corewar.cljs
(ns corewar.gui
(:require
[clojure.string :as str]
[jayq.core :refer [show]]
[enchilada :refer [canvas ctx canvas-size]]
[corewar.memory :as mem]
[corewar.assembler :as asm]
[corewar.instruction-set :as instr]
[corewar.virtual-machine :as vm]
[corewar.redcode :as red]
@rm-hull
rm-hull / four-bugs.cljs
Last active Aug 29, 2015
Although this gist is not exactly the four bug problem (where bugs/mice/insects are placed at the corners of a regular polygon, and each bug then begins to move towards its immediate neighbour in an counter-clockwise direction), it started out with that intention. Instead, because the angles are quite shallow and the lines close together, an int…
View four-bugs.cljs
(ns enchilada.four-bugs
(:require
[jayq.core :refer [show]]
[big-bang.core :refer [big-bang]]
[enchilada :refer [canvas ctx value-of]]
[monet.canvas :refer [translate scale rotate
save restore fill-rect
stroke-style stroke fill-style fill
begin-path close-path move-to line-to]]))
@rm-hull
rm-hull / travelling-salesman.cljs
Last active Aug 29, 2015
The TSP ('travelling salesman problem') is a popular demonstration of an NP-hard problem in Computer Science: Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city? This implementation uses an evolutionary _cumulative-selection_ …
View travelling-salesman.cljs
(ns enchilada.travelling-salesman
(:require
[cljs.core.async :as async]
[enchilada :refer [canvas ctx canvas-size]]
[enchilada.travelling-salesman.datasets :as data]
[big-bang.core :refer [big-bang]]
[big-bang.package :refer [make-package]]
[jayq.core :refer [show]]
[monet.canvas :refer [clear-rect fill-style fill fill-rect circle
stroke-style stroke-width stroke-join stroke
You can’t perform that action at this time.