Skip to content

Instantly share code, notes, and snippets.

View selfsame's full-sized avatar

Joseph Parker selfsame

View GitHub Profile
@selfsame
selfsame / Bumps.cs
Created April 5, 2015 15:49
Arcadia Collision message hack
using UnityEngine;
using System.Collections;
public class Bumps : MonoBehaviour {
void OnCollisionEnter(Collision collision) {
SendMessage("OnBumpEnter", collision, SendMessageOptions.DontRequireReceiver);
}
void OnCollisionEnter2D(Collision2D collision) {
SendMessage("OnBumpEnter2D", collision, SendMessageOptions.DontRequireReceiver);
}
(ns farm.platformer
(:use hard.core hard.input hard.physics hard.edit)
(:require [tween.core :as tween])
(:import [UnityEngine]))
(def player (atom nil))
(def grounded (atom false))
(def mouse (atom [0 0 0]))
(def >die (tween/scale (->v3 0 0 0) 0.01 #(destroy! %)))
(ns story.core
(import [UnityEngine Vector3 Vector2 Color]))
(def __R (atom {}))
(defn- arity-match [given pattern]
(every? true?
(map #(or (nil? %1) (= %1 %2))
pattern given)))
@selfsame
selfsame / gist:1811ce46247e8fd9adc0
Created May 10, 2015 01:36
cljs iterater benching
(defn stuff [e] true)
(do (def tv (vec (range 2000000))) nil)
(do (def ta (to-array (vec (range 2000000)))) nil)
(defn vrange [n]
(mapv (fn [e] (+ 1 1) true) (range n)))
(defn vrange2 [col]
(.every col stuff))
@selfsame
selfsame / gist:2b6bda72c533aeedeb10
Last active August 29, 2015 14:21
facets-con thoughts

thoughts after facets-con

Never been to a conference, this was very fun.

People using tech as creative medium - these are my people! It was nice to feel like I belonged.

Here's some notes and thoughts-

hacker spaces

(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#]
C("drawsort",
{fn:function(a, b){ return a.position.y - b.position.y; }},
{update:
function(c){
c.owner.transform.children.sort(c.fn);
}
}
(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
(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]
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%;>