Skip to content

Instantly share code, notes, and snippets.

View timsgardner's full-sized avatar

Tims Gardner timsgardner

  • Arcadia Technologies
  • Brooklyn, NY
View GitHub Profile
using arcadia.messages;
using clojure.lang;
using System;
using UnityEngine;
using urbanOutfitters.parapoint;
namespace urbanOutfitters.moholy
{
[Serializable]
public class EllipsulonData : MonoBehaviour, IParaPoint, IStart, IOnDrawGizmosSelected, IType
{
using arcadia.messages;
using clojure.lang;
using System;
using UnityEngine;
using urbanOutfitters.parapoint;
namespace urbanOutfitters.moholy
{
[Serializable]
public class EllipsulonData : MonoBehaviour, IAwake, IParaPoint, IStart, IOnDrawGizmosSelected, IType
{
@timsgardner
timsgardner / gist:0c43e23875084f488253
Created February 7, 2015 21:11
cursed cube clump
(defscn cursed-cube-clump
(let [cc (GameObject. "cursed-cube-clump")
n 1000
w 60]
(dotimes [i n]
(let [c (hydrate cubespec)]
(set! (.parent (transform c)) (transform cc))
(set! (.localScale (transform c))
(v3 1 1 (+ (/ i w) (mod i w))))
(set! (.localPosition (transform c))
(defscn cube-clump
(let [cc (GameObject. "cube-clump")
n 1000
w 60]
(dotimes [i n]
(let [c (create-primitive :cube)]
(set! (.parent (transform c)) (transform cc))
(set! (.localScale (transform c))
(v3 1 1 (+ (/ i w) (mod i w))))
(set! (.localPosition (transform c))
@timsgardner
timsgardner / tree_it.clj
Last active August 29, 2015 14:16
tree-it
(use 'arcadia.hydrate 'arcadia.core)
(defmacro vfor [& body]
`(vec (for ~@body)))
(defn tree-it [make-node, branching, depth, spacing, width]
(let [xsfn (fn [lvl, parentx]
(vfor [i (range branching)]
(- parentx
(* 0.5
@timsgardner
timsgardner / graph-seq.clj
Last active August 29, 2015 14:16
graph-seq
(defmacro if-first
([bindings then]
`(when-first ~bindings ~then))
([bindings then else]
(let [[x xs] bindings]
`(if-let [xs# (seq ~xs)]
(let [~x (first xs#)]
~then)
~else))))
;; ============================================================
;; why didn't I think of this earlier
;; strictly speaking this uses eval, so maybe problematic 4 certain
;; export targets, depending on how we handle that; eval only called
;; at compile time tho, so maybe we could excise it in a way that's
;; smart enough to still allow this sort of tomfoolery.
(defmacro meval [& stuff]
(eval (cons 'do stuff)))
@timsgardner
timsgardner / gist:968a260102cc0e747a7f
Created June 18, 2015 21:33
a fun-tastic game u kids
(ns wall-jiggle.wall-jiggle
(:use arcadia.core
arcadia.linear)
(:require [arcadia.updater :as updr])
(:import [UnityEngine Transform]))
(defscn wall
(let [top (GameObject. "wall")]
(dotimes [x 10]
(dotimes [y 10]
@timsgardner
timsgardner / gist:10da9d05c4923ed06efb
Last active August 29, 2015 14:25
mappy late-bound component logic idea
(defcomponent ProtagonistDriver [logic]
(Update [this]
(when-let [f (:update logic)]
(f this)))
(OnCollisionEnter [this that]
(when-let [f (:on-collision-enter logic)]
(f this that))))
@timsgardner
timsgardner / arcadia_demo
Created July 18, 2015 23:01
arcadia cube, vr demo
(let [ns 'clojure-west.demo]
(require ns)
(in-ns ns)
(use
'clojure.pprint
'clojure.repl
'clojure-west.freeze)
(require
;'[clojure-west.mesh :as mesh]
'[clojure-west.materials :as mat]