Skip to content

Instantly share code, notes, and snippets.

View aeriksson's full-sized avatar

André Eriksson aeriksson

View GitHub Profile
@aeriksson
aeriksson / cube-canvas-vis.html
Created April 27, 2018 12:07
JS 3D in 2D Canvas
<head>
</head>
<body style="background:black">
<div style="display:block; color:white; position:absolute; padding: 5px">FPS: <span id=fps></span><br>latency (p50, p90, p99, max): <span id=latency></span><br></div>
<canvas id=canvas></canvas>
<script>
var ctx = canvas.getContext("2d");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var fps_elem = document.getElementById("fps");
@aeriksson
aeriksson / cursor.clj
Created March 3, 2016 15:24
Basic Clojure implementation of cursors (pointers into atoms)
(ns cursor
(:import [clojure.lang IAtom IDeref]))
(defn cursor [the-atom path]
(reify
IAtom
(swap [this f]
(swap! the-atom update-in path f))
(swap [this f arg]
(swap! the-atom update-in path f arg))