Skip to content

Instantly share code, notes, and snippets.

View lbradstreet's full-sized avatar

Lucas Bradstreet lbradstreet

View GitHub Profile
@bridgethillyer
bridgethillyer / Onyx-code-walkthrough
Last active March 28, 2016 18:46
Walkthrough of onyx code
Onyx code walkthrough 2/14/2016
with Michael, Gardner, Bridget
* onyx.peer.min-peers-test
- most basic test
- every test needs onyx.api last - loads all defmethods
- min-peers need = # tasks
- put channels in atoms
- so fresh channels every time you reload
- onyx-id - us UUID so there are not collisions in tests
@timsgardner
timsgardner / set_with.clj
Last active August 29, 2015 14:08
set-with!
;; funny little macro to make interop bit less painful
(set! *warn-on-reflection* true)
(defmacro set-with! [obj [sym prop] & body]
`(let [obj# ~obj
~sym (. obj# ~prop)]
(set! (. obj# ~prop) (do ~@body))))
;; use: ----------------------------------------
@timsgardner
timsgardner / quaternion_exploration.clj
Last active July 13, 2016 01:21
Playing around with quaternions in Arcadia
(ns quaternion-exploration
(:import [UnityEngine Quaternion Vector3])
(:use arcadia.core
arcadia.hydrate
clojure.repl
clojure.pprint))
;; like emacs. kind of.
(defn kill! [x]
(let [spec (dehydrate x)]
@bmabey
bmabey / sublist.clj
Last active August 29, 2015 14:06
sublist generator for clojure test.check... which has better shrinking properites?
;; my first version taking advantage of the new shuffle generator introduced in 0.6...
(defn sublist1
[coll]
(-> (gen/tuple (gen/shuffle coll) (gen/choose 0 (count coll)))
(gen/bind (fn [[coll* how-many]]
(gen/return (take how-many coll*))))))
;; version inspired by http://roberto-aloi.com/erlang/notes-on-erlang-quickcheck/
;; sublist(L0) ->
;; ?LET(L, [{E, eqc_gen:bool()} || E <- L0], [X || {X, true} <- L]).
@mrb
mrb / chords.clj
Last active August 29, 2015 14:05
core.logic db chords exercise
(ns chords.core
(:refer-clojure :exclude [==])
(:require [clojure.core.logic :refer :all]
[clojure.core.logic.fd :as fd]
[clojure.core.logic.pldb :as pldb]
[fipp.edn :refer (pprint) :rename {pprint fipp}]))
(pldb/db-rel note-name ^:index p)
(pldb/db-rel octave ^:index p)
(pldb/db-rel note ^:index p1 ^:index p2)
@frenchy64
frenchy64 / diagnose.clj
Last active August 29, 2015 13:56
Handy tools.trace
; [org.clojure/tools.trace "0.7.5"]
(require '[clojure.tools.trace :as trace]
'[clojure.repl :as repl])
(defmacro spit-to
"Dump diagnostics to a file"
[f & body]
`(spit ~f
anonymous
anonymous / ux.cljs
Created January 21, 2014 19:06
;;; TODO - drag-enter and -exit events : Right now, a component doesn't receive events for other components
;;; If a component responds to drag-over, it won't "revert" state until the drag ends.
;; NOTE - compiles with om 0.1.7. Needs updating to 0.2+
(ns omdnd.ux
(:require-macros
[cljs.core.async.macros :refer [go alt!]]
)
@ul
ul / canvas.cljs
Last active January 3, 2016 08:29
Om drag & snap
(ns runes24.components.canvas
(:require [clojure.string :as str]
[cljs.core.async :as async]
[om.core :as om :include-macros true]
[sablono.core :as html :refer [html] :include-macros true]
[shodan.console :as console]
[runes24.components.meaning-rune :refer [meaning-rune]]
[runes24.utils :as utils]
))