Skip to content

Instantly share code, notes, and snippets.

View joyrexus's full-sized avatar

J. Voigt joyrexus

View GitHub Profile
@joyrexus
joyrexus / index.html
Last active December 22, 2015 22:59 — forked from tmcw/index.html
Mapping migratory bird species
<!DOCTYPE html>
<meta charset=utf-8 />
<script src='http://api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:relative; width:960px;height:500px; }
</style>
<body>
<div id='map'></div>
@joyrexus
joyrexus / index.html
Last active December 29, 2016 12:01
NYT border graphic
<!DOCTYPE html>
<meta charset="utf-8">
<script src="http://joyrexus.github.io/sandbox/border/lib.js"></script>
<style>
@import url(http://fonts.googleapis.com/css?family=Roboto:700,300);
body {
font-family: 'Roboto', sans-serif;
font-size: 14px;
line-height: 1.5em;
}
@joyrexus
joyrexus / y.coffee
Created September 21, 2013 04:38
Y-combinator
# http://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combinator
#
# λf . (λx . x x)(λy . f (λv . ((y y) v)))
Y = (f) -> ((x) -> x x)((y) -> f ((v) -> (y y) v))
# or ...
Y = (f) ->
p = (h) ->
(x) -> f(h(h))(x)
@joyrexus
joyrexus / index.html
Last active December 23, 2015 20:09 — forked from tmcw/index.html
Unit Trig Circle
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
margin: 0;
padding: 0;
}
@joyrexus
joyrexus / README.md
Created September 26, 2013 16:39
Team Oracle path to victory

Oracle Team USA won its eighth consecutive race to overtake Emirates Team New Zealand and retain the America’s Cup. A look at how the final race unfolded, with Oracle winning by 44 seconds.

A NYT interactive graphic by MIKE BOSTOCK and SHAN CARTER

@joyrexus
joyrexus / index.html
Last active December 24, 2015 13:28
Cursor extension for svg.js
<!DOCTYPE html>
<meta charset="utf-8">
<script src="https://s3-eu-west-1.amazonaws.com/svgjs/svg.js"></script>
<script src="http://jashkenas.github.io/coffee-script/extras/coffee-script.js"></script>
<script src="svg.cursor.js"></script>
<style>
rect {
fill: none;
stroke: #999;
stroke-width: 2;
@joyrexus
joyrexus / README.md
Last active May 12, 2021 04:16
Unit circle extension for svg.js

Simple demonstration of how to extend svg.js. Our little extension, svg.unit.js, enables one to create a unit circle and move around to various points on it based on a specified angle.


Note: moving around a unit circle as our demo use case was largely inspired by Tom MacWright's Math for Pictures post.


For example, we can create a unit circle centered at 150, 150 with radius 100 and use degrees as our angle unit of measure:

@joyrexus
joyrexus / index.html
Created October 3, 2013 18:27
Bug extension for svg.js
<!DOCTYPE html>
<meta charset="utf-8">
<script src="http://jashkenas.github.io/coffee-script/extras/coffee-script.js"></script>
<script src="https://s3-eu-west-1.amazonaws.com/svgjs/svg.js"></script>
<script src="svg.bug.js"></script>
<style>
rect {
fill: none;
stroke: #999;
stroke-width: 2;
@joyrexus
joyrexus / README.md
Last active December 24, 2015 14:39
Move bug from point to point

Demo of the bug.movesTo method in our little svg.bug.js extension for svg.js.

The movesTo method allows one to specify a series of points for the bug to move to. For example, starting from point A we can move to point B, then to C, then back to A:

A = new Point 40, 20
B = new Point 200, 300
C = new Point 300, 150

bug = draw.bug(A.x, A.y)

@joyrexus
joyrexus / README.md
Created October 5, 2013 04:31
Infer angle based on mouse position

Animation trigged by mousemove event where we infer angular measure (relative to a center point) based on mouse position.

Another follow-up experiment inspired by Math for Pictures.