A Gosper space-filling curve drawn with an implementation of an L-system renderer.
The drawing of the line is animated using Mike Bostock's stroke dash interpolation.
(def history (Html5History.)) | |
(.setUseFragment history false) | |
(.setPathPrefix history "") | |
(.setEnabled history true) | |
(let [navigation (listen history EventType/NAVIGATE)] | |
(go | |
(while true | |
(let [token (.-token (<! navigation))] | |
(secretary/dispatch! token))))) |
(defn exchange! | |
"Atomically set the value of `atom` to `(apply f @atom args)`, | |
and return the value of `@atom` just before the assignment. | |
(See also: `clojure.core/swap!`)" | |
[atom f & args] | |
{:pre [(instance? clojure.lang.Atom atom)]} | |
(loop [oldval @atom] | |
(if (compare-and-set! atom oldval (apply f oldval args)) | |
oldval | |
(recur @atom)))) |
<div id="canvas"> | |
<h1>Click and drag boxes</h1> | |
<ul> | |
<li class="box"></li> | |
<li class="box"></li> | |
<li class="box"></li> | |
</ul> | |
</div> |
# features/step_definitions/api_steps.rb | |
# These steps are very deeply inspired in the Anthony Eden (@aeden) API steps. | |
# See http://vimeo.com/30586709 | |
# Given | |
Given /^I send and accept JSON$/ do | |
header 'Accept', 'application/json' |
A Gosper space-filling curve drawn with an implementation of an L-system renderer.
The drawing of the line is animated using Mike Bostock's stroke dash interpolation.
#!/bin/bash | |
# | |
# yoga-auto-rotate -- ghetto-style tablet mode, with keyboard and all. | |
# | |
# Simple little script that will detect an orientation change for a | |
# Lenovo Yoga 13 (very hackily) and adjust the active display's | |
# orientation and disable/enable the touchpad as necessary. | |
# | |
# The Yoga 13 will emit keycode `e03e` at one second intervals | |
# when the screen is flipped into tablet mode. Since this keycode |
(ns blog.errors.core | |
(:require-macros | |
[cljs.core.async.macros :refer [go]] | |
[blog.utils.macros :refer [<?]]) | |
(:require | |
[cljs.core.async :refer [>! <! chan close!]])) | |
;; convert Node.js async function into a something | |
;; that returns a value or error on a channel | |
(defn run-task [f & args] |
(ns identicon.core | |
(:require [digest]) | |
(:require [clojure.string :as str]) | |
(import java.io.File) | |
(import java.awt.Color) | |
(import java.awt.image.BufferedImage) | |
(import javax.imageio.ImageIO)) | |
(def tiles-per-side 6) | |
(def total-tiles |
(ns blue-ball | |
(:use [seesaw core font graphics]) | |
(:require [clojure-leap.core :as leap] | |
[clojure-leap.screen :as l-screen])) | |
;; these atoms contain the current x/y state from the Leap | |
(def x (atom 10)) | |
(def y (atom 10)) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Build the window/canvas |
(ns xn.test | |
(:require-macros [cljs.core.async.macros :refer [go alts!]] | |
(:require [xn.core :as xn] | |
[xn.util :as u] | |
[cljs.core.async :refer [<! take!]] | |
[xn.xhr :refer [request-body request-records chain-req]])) | |
(def sample-app | |
(reify | |
xn/Application |