Skip to content

Instantly share code, notes, and snippets.

View selfsame's full-sized avatar

Joseph Parker selfsame

View GitHub Profile
(ns pred.menu
(:require
hard.life
[tween.core :as tween])
(:use
hard.core
hard.dispatch))
(defn tint> [o color] ((tween.core/material-color color 0.5 :pow2) (->go o)))
(declare look)
(def test-item
{:noun "chest" :material "wooden"
:closed false
:container
[{:noun "spoon" :material "tin"}
{:noun "bag" :material "leather"
:closed true
;predicate maker
(defn name-is? [s] (fn [x] (if-let [go (->go x)] (= (.name go) s) false)))
(defn mat-tint [go color]
((tween.core/material-color color 0.2 :pow2) go))
(rule collide-with [a b] {}
(mat-tint a (color 1 1 1)))
(ns warmup.core
(:require arcadia.core)
(:use
hard.core
hard.input
tween.core
hard.edit
hard.dispatch)
(:import [UnityEngine Vector3]))
@selfsame
selfsame / river.rkt
Created July 29, 2015 17:43
boabab syntax scribble
(def-str form "")
(scene river-bank
(title "Your birthplace on the river")
(initial-desc
"Wetness and cold.
The sweet taste of mud fills your nose and coats your teeth.
You are a:")
(link "forbidden hybrid of human and toad"
(set! form "half-toad")
cljs.user=> (require '[fast.core :refer [-o -styles -rules -add]] )
nil
cljs.user=> (require 'css.units)
nil
cljs.user=> (-o 80)
<span.tab>
cljs.user=> (-add (-o 80) "width" "3em")
#<width:3em;>
cljs.user=> (-add (-o 80) "height" "5%")
#<height:5%;>
(ns fast.core
(:require [css.units :as u]))
(def -UID (atom 0))
(defn new-uid [] (swap! -UID inc))
(defonce m-u-m (js/Array.))
(aset js/window "mum" m-u-m)
(defn indexed-iterate [col f]
(1:14:36 PM) seangrove: Anyone know how to acess the js "arguments" keyword in cljs?
(1:15:06 PM) seangrove: I want to do the equivalent of (fn [] (.apply some-fn some-context js-arguments))
(1:19:20 PM) profil: seangrove: js/arguments?
(1:19:36 PM) seangrove: profil: Oh, that looks like it might be it
(1:19:47 PM) seangrove: Yup! Thanks
C("drawsort",
{fn:function(a, b){ return a.position.y - b.position.y; }},
{update:
function(c){
c.owner.transform.children.sort(c.fn);
}
}
(defmacro sandwich [col args & code]
"[col [prev current next] first-form 1-n-forms last-form]"
(let [top# (first code)
meat# (butlast (rest code))
bottom# (last code)]
`(remove nil? (apply concat (map-indexed
(fn [i# v#]
(let [~args [(get ~col (dec i#)) v# (get ~col (inc i#))]]
(cond (= i# 0) [~top# ~@meat#]