Skip to content

Instantly share code, notes, and snippets.

View jhickner's full-sized avatar

Jason Hickner jhickner

View GitHub Profile
@jhickner
jhickner / build-ghc-arm.sh
Last active August 29, 2015 14:18 — forked from bgamari/build-ghc-arm.sh
updated for rpi 2
#!/bin/bash -e
bindir=`pwd`/bin-tmp
mkdir -p $bindir
export PATH=$bindir:$PATH
function use_ld() {
rm -f $bindir/ld
ln -s $1 $bindir/ld
echo "Using $1 for ld"
}
(ns fj
(:import [java.util.concurrent RecursiveTask
ForkJoinPool]))
(set! *warn-on-reflection* true)
;; -----------------------------------------------
;; Helpers to provide an idiomatic interface to FJ
(defprotocol IFJTask
@jhickner
jhickner / locals.clj
Created March 17, 2012 22:48 — forked from alandipert/locals.clj
locals map
(defmacro locals
"Returns a map of locals, as keywords, to their values."
[]
(let [locals (keys &env)]
`(zipmap ~@(map vec [(map keyword locals) locals]))))
(let [x 10]
(let [y 20
z (+ x y)]
(locals)))
@jhickner
jhickner / gist:1218258
Created September 15, 2011 00:55 — forked from swannodette/gist:1214547
closure_and_proto.clj
/*
Silly example - close over s (say a string) returning an instance
of an anonymous type that acts like a ClojureScript collection
(defn make-conjable [s]
(reify
ICollection
(-conj [_ c] (str s c))))
*/
@jhickner
jhickner / gist:1215454
Created September 13, 2011 23:18 — forked from swannodette/gist:1210048
example.cljs
;; Copyright (c) Rich Hickey. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns repl.test
(:require [clojure.browser.repl :as repl]
@jhickner
jhickner / gist:1199718
Created September 7, 2011 03:49 — forked from lynaghk/gist:1141054
Clojure sequentials & maps into JavaScript arrays and objects
(defn ->js [o]
(cond
(keyword? o) (name o)
(map? o) (let [out (js-obj)]
(doseq [[k v] o]
(aset out (->js k) (->js v)))
out)
(coll? o) (apply array (map ->js o))
:else o))