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 midi-parser.core | |
| (:use clojure.java.data) | |
| #_(:use utils.utils) | |
| #_(:use vendors.debug-repl) | |
| (:import (java.io File) | |
| #_(java.util Arrays) | |
| #_(java.nio ByteBuffer) | |
| (javax.sound.midi MidiSystem Sequence MidiMessage MidiEvent ShortMessage MetaMessage Track))) | |
| ;***************** Utils ******************** |
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 grayscott.core | |
| "ported from toxiclibs by Karsten Schmidt | |
| https://bitbucket.org/postspectacular/toxiclibs/src/44d9932dbc9f9c69a170643e2d459f449562b750/src.sim/toxi/sim/grayscott/GrayScott.java?at=default&fileviewer=file-view-default" | |
| #?(:clj (:require [thi.ng.math.macros :as mm]) | |
| :cljs (:require-macros [thi.ng.math.macros :as mm]))) | |
| (defn clip [min max n] | |
| (cond | |
| (< n min) min | |
| (> n max) max |
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
| (defn rwrap [build deps-map] | |
| (let [this (atom (build)) | |
| deps (keys deps-map) | |
| propagating (atom nil)] | |
| (add-watch this | |
| :build | |
| (fn [_ _ _ n] | |
| (when-not @propagating | |
| (reset! propagating true) | |
| (doseq [[dep upd] deps-map] |
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 rum-slave | |
| (:require-macros [cljs.core.async.macros :refer [go-loop go]]) | |
| (:require [cljs.core.async :as async :refer [chan >! <!]] | |
| [rum.core :as rum])) | |
| ;; helpers --------------------------------------------------------------- | |
| (defn notify [s m] | |
| ((:notify s) m)) |
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 type.exp | |
| (:refer-clojure :exclude [extend-type reify]) | |
| ;; state --------------------- | |
| (def types (atom {::any identity})) | |
| (def facets (atom {})) | |
| ;; helpers ------------------- |
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
| (def state (volatile! {})) | |
| (def c (chan)) | |
| (defn add-bucket! [id {:as opts | |
| :keys [ttl len] | |
| :or {ttl 1000 len 10}}] | |
| (vswap! state | |
| assoc | |
| id | |
| {:ttl ttl |
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
| (defn set-timeout [f millis] | |
| (let [running (atom true)] | |
| (future | |
| (while @running | |
| (f) | |
| (Thread/sleep millis))) | |
| #(reset! running nil))) | |
| ;; start an interval, the stop function is returned and bound to stop-interval var | |
| (def stop-interval (set-interval #(println "yop") 1000)) |
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
| function getQueryVariable(variable) { | |
| var query = window.location.search.substring(1); | |
| var vars = query.split('&'); | |
| for (var i = 0; i < vars.length; i++) { | |
| var pair = vars[i].split('='); | |
| if (decodeURIComponent(pair[0]) == variable) { | |
| return decodeURIComponent(pair[1]); | |
| } | |
| } | |
| console.log('Query variable %s not found', variable); |
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
| (require '[reagent.core :as r]) | |
| (defn i [] | |
| (let [dims (r/atom {}) | |
| this (atom nil) | |
| resized? (atom nil)] | |
| (fn [][:div | |
| [:img {:src "http://www.lispcast.com/img/pre-conj/rich-hickey.jpeg" | |
| :ref (fn [x] (reset! this x)) | |
| :on-load |
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
| ;; Transparent Functions | |
| ;; I was experimenting with transducers and wanted a way to understand how they worked. Transducer | |
| ;; code uses many nested functions in various locations with other nested functions defined as local | |
| ;; variables in scope. Typically after an anonymous Clojure function is defined you have no visibility | |
| ;; into the locals that were in scope when the function was defined, where the function came from, | |
| ;; or the code in the function. I defined a macro, tfn, that creates a transparent function. It's | |
| ;; a normal Clojure function with additional metadata including the function code and local | |
| ;; variable names and values. |
OlderNewer