Skip to content

Instantly share code, notes, and snippets.

View selfsame's full-sized avatar

Joseph Parker selfsame

View GitHub Profile
(defmacro deftween [sym props getter valuer & setter]
(let [[start duration value target relative ratio uid] props
dot-duration (symbol (str "." duration))
dot-start (symbol (str "." start))
dot-value (symbol (str "." value))
[_ [this] get-more] getter
(html
(<div>
(class (? mousedown "noselect"))
(render-count :bg "pink")
(om/build style-options data {})
(<div.tabs>
(mapf [k]
(<div.label>
(class (when= tab k "active"))
(style {:width tabwidth})
(ns snake.core
(:use
[arcadia.core]
[hard.core]
[hard.input]
[hard.tween]))
(declare get-input)
(arcadia.core/defcomponent Pumper []
(ns flock
(:use hard.core hard.input hard.spatial)
(:import [UnityEngine]))
(declare pump initial make-boid)
(def FLOCKS (atom {}))
(def HASH (bucket-hash 10))
(arcadia.core/defcomponent Boid
(ns fish.core
(:use [arcadia.core] [hard.core] [hard.tween]))
(def ccol (objects-named "colcube"))
(defn cc-tween [go]
(let [[x y z] (->vec (->v3 go))
start (tween (* (+ 12 x) 0.1))
shrink (tween {go {:local-scale [50 50 50]}} 0.1)
grow (tween {go {:local-scale [100 100 100]}} 0.1)
diff --git a/Editor/ClojureConfiguration.cs b/Editor/ClojureConfiguration.cs
index 5a2ec17..2082862 100644
--- a/Editor/ClojureConfiguration.cs
+++ b/Editor/ClojureConfiguration.cs
@@ -1,3 +1,4 @@
+using System.IO;
using System.Linq;
using UnityEngine;
using UnityEditor;
@@ -5,7 +6,7 @@ using clojure.lang;
@selfsame
selfsame / gist:6107a482243e12d077cd
Last active August 29, 2015 14:13
small MUD ideas

Failing Pet Shop Simulator

Players are assigned positinos in a small owner-operated pet shop. Business is bad, and as the game progresses it gets worse. Players do their jobs, opening up, feeding animals, cleaning cages, helping the rare customer, tending the register, and locking up at the end of the day.

As the money runs out, the managment has to start firing employees (which kicks them out of the game).

Eventually the store defaults on its mortgage and the last employee locks up and wanders off into the sunset, ending the game.

Dinosaur Outback Adventure

def GET(col, k, notfound=None):
try: return col[k]
except: return notfound
def KEYFN(k):
def _KEYFN_(col, nf=None): return GET(col, k, nf)
return _KEYFN_
(ns sync.macros)
(defmacro to [chan value]
`(~'put! ~chan ~value))
'(macroexpand '(state ->e [x y] (prn x y)))
@selfsame
selfsame / gist:ae3aff95abe3957b2530
Created December 11, 2014 21:03
async loop macro
(defmacro defstate [name state & inputs]
(let [[sym init] state
pairs (mapv vec (partition 2 inputs))
in (gensym)
dispatch (fn [i [f r]]
(~'or (~'and (~'fn? f)
(f i))
(~'= f i)