Skip to content

Instantly share code, notes, and snippets.

View mudphone's full-sized avatar

Kyle Oba mudphone

View GitHub Profile
defmodule Demo.Mixfile do
use Mix.Project
def project do
[app: :demo,
version: "0.0.1",
elixir: "~> 1.3",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
@mudphone
mudphone / figwheel.clj
Last active November 28, 2015 22:00
Om-Tutorial with Figwheel in Emacs with CIDER
;; In script/figwheel.clj
;; Can be run from project root:
;; $ rlwrap lein run -m clojure.main script/figwheel.clj
;;
;; Or, from a CLJS file buffer:
;; M-x cider-jack-in
;; then eval these forms:
;; M-x cider-eval-buffer
(require
'[figwheel-sidecar.repl :as r]
@mudphone
mudphone / logic.hy
Last active November 14, 2015 22:01
(import [user-mu [*]])
(require user-mu)
;; Mostly translated from Scheme examples in "The Reasoned Schemer,"
;; by Daniel P. Friedman, William E. Byrd, and Oleg Kiselyov.
(defn caro [p a]
(fresh [d]
(== (cons a d) p)))
;;=> (var 0)
;;Traceback (most recent call last):
;; File "<input>", line 1, in <module>
;; File "<input>", line 4, in __init__
;;TypeError: object.__init__() takes no parameters
(defclass var [PSet]
[]
(defn --init-- [self c]
(.--init-- (super) self [c]))
@mudphone
mudphone / piperighterror.ex
Created September 9, 2015 11:11
Error when I use |>> instead of ~>>
== Compilation error on file lib/common_macros.ex ==
** (SyntaxError) lib/common_macros.ex:3: syntax error before: '>'
(elixir) lib/kernel/parallel_compiler.ex:95: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/8
** (exit) shutdown: 1
(elixir) lib/kernel/parallel_compiler.ex:199: Kernel.ParallelCompiler.handle_failure/5
(elixir) lib/kernel/parallel_compiler.ex:182: Kernel.ParallelCompiler.wait_for_messages/8
(elixir) lib/kernel/parallel_compiler.ex:55: Kernel.ParallelCompiler.spawn_compilers/3
(iex) lib/iex/helpers.ex:94: IEx.Helpers.c/2
@mudphone
mudphone / CommonMacros.ex
Last active September 9, 2015 07:45
Pipe Right (Thread Right `->>` from Clojure) - Pipes left-hand expression into the left-most parameter or the next function call.
defmodule CommonMacros do
defmacro left ~>> right do
[{h, _}|t] = Macro.unpipe({:|>, [], [left, right]})
:lists.foldl fn
{{_, _, args} = x, _pos}, acc ->
pos = Enum.count(args)
Macro.pipe(acc, x, pos)
{x, pos}, acc ->
Macro.pipe(acc, x, pos)
@mudphone
mudphone / curry.exs
Last active August 29, 2015 14:20
Elixir Curry... is delicious
defmodule Math do
def add(x, y) do
x + y
end
def add(x, y, z) do
x + y + z
end
@mudphone
mudphone / Tasks.el
Last active August 29, 2015 14:19
Elm Tasks Compile Error
Sorry if this is a dup. I thought I had posted this last night.
I have a new build of GHC 7.8.4 and Elm 0.15 on Mac OS X, and I'm getting an error trying to compile the Tasks tutorial code (from the blog post, http://elm-lang.org/learn/Tasks.elm).
I installed Elm via the install script (runhaskell BuildFromSource.hs 0.15).
The error I'm getting when trying to compile is:
````elm
$ elm make hello.elm
@mudphone
mudphone / .Xresources
Last active August 29, 2015 14:06 — forked from vreon/.Xresources
! Molokai theme
*xterm*background: #101010
*xterm*foreground: #d0d0d0
*xterm*cursorColor: #d0d0d0
*xterm*color0: #101010
*xterm*color1: #960050
*xterm*color2: #66aa11
*xterm*color3: #c47f2c
*xterm*color4: #30309b
*xterm*color5: #7e40a5
@mudphone
mudphone / TimeDisplacement.pde
Created August 30, 2014 02:38
Time Displacement, Processing Demo, by David Muth
/**
* Time Displacement
* by David Muth
*
* Keeps a buffer of video frames in memory and displays pixel rows
* taken from consecutive frames distributed over the y-axis
*/
import processing.video.*;