Skip to content

Instantly share code, notes, and snippets.

View mrcslws's full-sized avatar

Marcus Lewis mrcslws

View GitHub Profile
@mrcslws
mrcslws / .block
Last active March 17, 2017 23:31
d3-zoom: You must position your rect with "transform"
license: gpl-3.0
@mrcslws
mrcslws / .block
Last active May 7, 2019 15:03 — forked from mbostock/.block
Pan & Zoom Axes
license: gpl-3.0
@mrcslws
mrcslws / om-state-and-ref-cursors
Created February 17, 2015 08:25
Demonstrating how ref-cursors + state can combine to cause double-renders
(ns om.repro.state-and-ref-cursors
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(defonce app-state (atom {:foo {}}))
(defn animating-component [app owner]
(reify
om/IDidUpdate
(did-update [_ _ _]
@mrcslws
mrcslws / om-stale-cursors
Last active August 29, 2015 14:08
Demonstration that Om cursors can quietly dereference to someone else's path. If you quickly move your mouse over this list of names, the assert fails, because you switch up the app-state indices and then cause another event before a render updates the paths.
(ns explore-om.stalecursors
(:require-macros [cljs.core.async.macros :refer [go-loop]])
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[cljs.core.async :refer [put! chan <!]]))
;;;
;;; Sample code from https://github.com/swannodette/om/wiki/Basic-Tutorial
;;;
(def app-state