Skip to content

Instantly share code, notes, and snippets.

View timsgardner's full-sized avatar

Tims Gardner timsgardner

  • Brooklyn, NY
View GitHub Profile
@timsgardner
timsgardner / parse.clj
Last active December 13, 2015 17:26
parse
(defn parse-form [down-tok?, up-tok?, [tok & toks]]
(loop [frm [tok], toks toks]
(if-let [[tok2 & toks2] (seq toks)]
(cond
(down-tok? tok2) (let [[res toks3] (parse-form down-tok?, up-tok?, toks)]
(recur (conj frm res) toks3))
(up-tok? tok2) [(conj frm tok2) toks2]
:else (recur (conj frm tok2) toks2))
[frm nil])))
Shader "geronimo" {
Properties {
wobble ("wobble", Vector) = (0, 0, 0, 0)
}
SubShader {
Pass {
GLSLPROGRAM
#ifdef VERTEX
@timsgardner
timsgardner / gamma_luggu.clj
Created August 19, 2015 16:51
some gamma mistakes
(let [ns
;;'gamma.api
;;'arcadia.config
;;'gamma.compiler.core
'gamma-tools.core
]
(require ns)
(in-ns ns)
(use
'clojure.pprint
Shader "geronimo" {
Properties {
wobble ("wobble", Vector) = (0, 0, 0, 0)
}
SubShader {
Pass {
GLSLPROGRAM
#ifdef VERTEX
(dotimes [_ 10]
(time
(dotimes [_ 1e4]
{:this 0
:is 1
:a 2
:small 3
:map 4})))
(dotimes [_ 10]
(time
(dotimes [_ 1e4]
{:this 0
:is 1
:a 2
:small 3
:map 4})))
(dotimes [_ 10]
(time
(dotimes [_ 1e4]
{:this 0
:is 1
:a 2
:small 3
:map 4})))
(dotimes [_ 10]
(time
(dotimes [_ 1e4]
{:this 0
:is 1
:a 2
:small 3
:map 4})))
@timsgardner
timsgardner / gist:929ab154f9335f7c057b
Last active September 3, 2015 18:59
seascape snippet
// from "Seascape" by Alexander Alekseev aka TDM - 2014
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
float heightMapTracing(vec3 ori, vec3 dir, out vec3 p) { ```
float tm = 0.0;
float tx = 1000.0;
float hx = map(ori + dir * tx);
if(hx > 0.0) return tx;
float hm = map(ori + dir * tm);
@timsgardner
timsgardner / gist:4eaff6d9c77b7df2b443
Created September 3, 2015 20:41
fun reify exasmple!
(defprotocol ISack
(whats-in-me [this]))
(defn potato-sack [the-potatos]
(reify ISack
(whats-in-me [_] the-potatos)))