Skip to content

Instantly share code, notes, and snippets.

View ericnormand's full-sized avatar

Eric Normand ericnormand

View GitHub Profile
require "thread"
class Delay
def initialize(&thunk)
@semaphore = Mutex.new
@thunk = thunk
@evaluated = false
end
def value
@candera
candera / example.sh
Last active January 26, 2020 00:43
Package ClojureScript in a Native EXE
# Update: This micro-blog is now also a guide on clojurescript.org:
# http://clojurescript.org/guides/native-executables
# Hello! This is a micro-post about how to produce native executables
# from ClojureScript source. The basic idea is to produce a
# JavaScript file using the ClojureScript compiler, and then use a
# Node.js tool called nexe (https://github.com/jaredallard/nexe) to
# compile that into an executable. The resulting file can be run
# without requiring a node install on the target machine, which can
# be handy.
@lynaghk
lynaghk / gist:1141054
Created August 11, 2011 23:21
Clojure sequentials & maps into JavaScript arrays and objects
(defn jsArr
"Recursively converts a sequential object into a JavaScript array"
[seq]
(.array (vec (map #(if (sequential? %) (jsArr %) %)
seq))))
(defn jsObj
"Convert a clojure map into a JavaScript object"
[obj]
(.strobj (into {} (map (fn [[k v]]