Skip to content

Instantly share code, notes, and snippets.

View josephwilk's full-sized avatar
💭
💻 🎨 🎵

Joseph Wilk josephwilk

💭
💻 🎨 🎵
View GitHub Profile
wget --no-clobber http://www.erlang.org/download/otp_src_R16B01.tar.gz
cd vendor && tar -k -xf ../otp_src_R16B01.tar.gz
cd vendor/otp_src_R16B01 && ./configure --without-termcap --disable-hipe --without-javac && make
wget --no-clobber -q http://dl.dropbox.com/u/4934685/elixir/v${ELIXIR_VERSION}.zip && unzip -o -qq v${ELIXIR_VERSION}.zip -d vendor/elixir
${RUN_MIX} deps.get
import re
import time
import json
import unicodedata
import gevent
from gevent import monkey
from pymindwave import headset
from pymindwave.pyeeg import bin_power
@josephwilk
josephwilk / future.ex
Created July 30, 2013 20:06
Future experiments from Elixir meetup
defmodule Future do
def new(fun) do
fn(x) ->
spawn_link fn ->
value = try do
{ :ok, fun.(x) }
rescue
e -> { :error, e }
end
defmodule Punk do
def hip? do
true
end
def hop? do
hip?
end
end
defmodule Bench do
@sample 100
defp average(time) do
time / @sample
end
defp bench(fun) do
f = fn ->
Enum.each 1..@sample, fn _ -> fun.() end
(defun clojure-in-tests-p ()
(or (string-match-p "test\." (clojure-find-ns))
(string-match-p "/test" (buffer-file-name))))
(defun midje-test-for (namespace)
(let* ((namespace (clojure-underscores-for-hyphens namespace))
(segments (split-string namespace "\\."))
(main-namespace (first segments))
(filename (last segments))
(test-segments (append (list "test" main-namespace "unit") (rest (butlast segments)))))
<testsuite>
<testcase classname="as-documentation.about-privates.how-to-refer-to-privates-in-facts" name="allows direct testing"></testcase>
<testcase classname="as-documentation.about-privates.how-to-refer-to-privates-in-facts" name="works with `provided`"></testcase>
<testcase classname="as-documentation.about-privates.how-to-refer-to-privates-in-facts" name="a private has been exposed"></testcase>
<testcase classname="as-documentation.about-privates.how-to-refer-to-privates-in-facts" name="as_documentation/about_privates/how_to_refer_to_privates_in_facts.clj:35"></testcase>
<testcase classname="as-documentation.about-privates.how-to-refer-to-privates-in-facts" name="as_documentation/about_privates/how_to_refer_to_privates_in_facts.clj:35"></testcase>
<testcase classname="as-documentation.about-privates.how-to-refer-to-privates-in-facts" name="Here is how you must use them"></testcase>
<testcase classname="as-documentation.about-privates.how-to-refer-to-privates-in-facts" name="testable-privates allows dire
* ring (like RACK):
"Clojure web application library"
https://github.com/mmcgrana/ring
https://github.com/weavejester/lein-ring
* cljsbuild:
CloureScript helper
https://github.com/emezeske/lein-cljsbuild
* midje
(clojure.string/replace (str (type "")) "class" ""\)
(defn gen-fn
[n as b]
(let [n (symbol n)
as (vec (map symbol as))
fn-value (eval `(fn ~n ~as ~b))]
(intern *ns* n fn-value)))
(gen-fn "user" [] '(println "I'M BEING CALLED!"))
((resolve (symbol (name :user))))