This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; rewritten in Clojurescript from javascript (originally by Piotr Stosur: http://js1k.com/2013-spring/demo/1431) | |
(ns psychedelic-animation.demo | |
(:use [enchilada :only [canvas svg ctx]] | |
[jayq.core :only [show hide]] | |
[monet.core :only [animation-frame]] | |
[monet.canvas :only [fill-style fill-rect draw-image rotate translate]])) | |
(show canvas) | |
(hide svg) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns soundflower-vic20.demo | |
(:use-macros [dommy.macros :only [sel1 node]]) | |
(:use [jayq.core :only [show hide]] | |
[enchilada :only [canvas svg]] | |
[dommy.core :only [insert-after!]] | |
[dommy.template :only [->node-like]])) | |
(hide canvas) | |
(hide svg) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = 640, t = 480, u = Math, v = [ | |
[0, 0, 0], | |
[255, 0, 0], | |
[255, 255, 255] | |
], q = document, k = 'center', x = q.createElement('input'); | |
c.width = s; | |
c.height = t; | |
b.style.textAlign = x.style.textAlign = k; | |
var k, l, w = function (b) { | |
a.fillStyle = '#000'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns world-choropleth.demo | |
(:use-macros [c2.util :only [bind!]]) | |
(:use [jayq.core :only [show hide]] | |
[c2.core :only [unify]] | |
[c2.geo.core :only [geo->svg]] | |
[c2.geo.projection :only [albers]] | |
[dataset.geo.world :only [countries]] | |
[enchilada :only [canvas svg]]) | |
(:require [c2.scale :as scale])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns quadratic-residue.demo.core) | |
(defn follow [lookup-table] | |
(fn [n] | |
(loop [k n | |
edges {}] | |
(let [next-k (lookup-table k)] | |
(if (edges next-k) | |
edges | |
(recur next-k (assoc edges k next-k))))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns mod-test.example) | |
; Something very odd is happening with mod when used with some string values whose content happen to be numbers. | |
; | |
; Clearly it shouldn't be called with a string, but this doesn't appear to affect modulo "1", "3", "9", "11" | |
; | |
; when the rem function is used with string numbers is not affected in the same way, and appears to operate consistently. | |
; | |
; Is this some funky gotcha with javascript, or is it a side-effect of the way clojurescript implements mod? | |
; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns lindenmayer-systems.demo | |
(:use [turtle.core :only [draw!]] | |
[turtle.renderer.vector :only [->svg]] | |
[turtle.renderer.canvas :only [->canvas]] | |
[enchilada :only [ctx canvas svg]] | |
[dommy.core :only [set-html! insert-after! replace! hide! show!]] | |
[jayq.core :only [show]]) | |
(:use-macros [dommy.macros :only [sel1]])) | |
(def L '(:left 36)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns autostereogram.demo | |
(:use [monet.canvas :only [draw-image]] | |
[enchilada :only [canvas ctx proxy-request]] | |
[jayq.core :only [show]] | |
[jayq.util :only [log]])) | |
(def greens | |
(map #(vector 0x30 % 0x30 0xFF) (range 0xCF))) | |
(defn random-data [w h colors] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns n01se.externs-for-cljs | |
(:require [clojure.java.io :as io] | |
[cljs.compiler :as comp] | |
[cljs.analyzer :as ana])) | |
(defn read-file [file] | |
(let [eof (Object.)] | |
(with-open [stream (clojure.lang.LineNumberingPushbackReader. (io/reader file))] | |
(vec (take-while #(not= % eof) | |
(repeatedly #(read stream false eof))))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to access GPIO registers from C-code on the Raspberry-Pi | |
// Example program | |
// 15-January-2012 | |
// Dom and Gert | |
// | |
/* | |
$ wget http://www.open.com.au/mikem/bcm2835/bcm2835-1.8.tar.gz | |
$ tar -zxvf bcm2835-1.8.tar.gz | |
$ cd bcm2835-1.8 |