Skip to content

Instantly share code, notes, and snippets.

View michaeljbishop's full-sized avatar

Michael Bishop michaeljbishop

View GitHub Profile

Running emscripten on OS X

There are a number of additional dependencies required for getting things installed on OS X. Starting with a blank slate OS X machine, this is the process it takes:

# Install Xcode Command Line Tools

# Install Homebrew
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
@michaeljbishop
michaeljbishop / Tiny Promise
Created March 29, 2013 02:49
A one-file implementation of a robust Promise object, slightly finessed from https://github.com/bhuga/promising-future.
##
# A delayed-execution promise. Promises are only executed once.
#
# @example
# x = promise { factorial 20 }
# y = promise { fibonacci 10**6 }
# a = x + 1 # => factorial 20 + 1 after factorial calculates
# result = promise { a += y }
# abort "" # whew, we never needed to calculate y
#
@michaeljbishop
michaeljbishop / task.rb
Created February 21, 2013 21:45
Another fix for the duplicate task-arguments problem.
# Invoke all the prerequisites of a task in parallel.
def invoke_prerequisites_concurrently(task_args, invocation_chain) # :nodoc:
futures = prerequisite_tasks.collect do |p|
prereq_args = task_args.new_scope(p.arg_names)
# application.thread_pool.future(p) do |r|
# r.invoke_with_call_chain(prereq_args, invocation_chain)
# end
application.thread_pool.future do
p.invoke_with_call_chain(prereq_args, invocation_chain)
end