Skip to content

Instantly share code, notes, and snippets.

%% -*- erlang -*-
% file: deps/dep-1/rebar.config
{deps, [
{'dep-2', ".*", {git, "git@github.com:org/dep-1.git", {tag, "0.1.0"}}},
]}.
@ericmoritz
ericmoritz / example
Last active December 19, 2015 07:39
#!/usr/bin/env bash
function say_hello {
echo "Hello"
}
function say_goodbye {
echo "Goodbye"
}
#!/usr/bin/env bash
if [ x"$VIRTUAL_ENV" = "x" ]; then
echo "Not in a virtualenv, bouncing"
exit 1
fi
rm -rf "$VIRTUAL_ENV"/lib/python2.7/site-packages/
virtualenv "$VIRTUAL_ENV"
@ericmoritz
ericmoritz / .gitignore
Last active December 18, 2015 09:28
Explaining monads without using the work monad.
*.pyc
mkdir ~/Projects
virtualenv ~/Projects/usat-web
mkdir ~/Projects/usat-web/src
. ~/Projects/usat-web/bin/activate
cd ~/Projects/usat-web/src
git clone git@github.com:GannettDigital/usat-web.git
cd usat-web
make deps
main =
fmap reverse getLine >>=
\line1 -> fmap reverse getLine >>=
\line2 -> putStrLn $ "You said " ++ line1 ++ " and " ++ line2 ++ " backwards!"
-module(error_m).
-export([return/1, fail/1, bind/2]).
return(V) -> {ok, V}.
fail(V) -> {error, V}.
bind({ok, V}, F) -> F(V);
bind(Err={error, _}, _F) -> Err.
@ericmoritz
ericmoritz / erlmonad.erl
Last active December 18, 2015 05:39
I think I finally understand monads!
-module(erlmonad).
-compile(export_all).
half(X) when X rem 2 =/= 0 ->
nothing;
half(X) ->
X div 2.
$ erlc test.erl
test.erl:4: Warning: variable 'A' is unused
@ericmoritz
ericmoritz / gist:5685336
Created May 31, 2013 14:26
dialyzer error
Checking whether the PLT .config_service.plt is up-to-date... yes
Proceeding with analysis...beam.smp(61206,0xb022b000) malloc: *** mmap(size=374341632) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
beam.smp(61206,0xb022b000) malloc: *** mmap(size=374341632) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
beam.smp(61206,0xb022b000) malloc: *** mmap(size=373665792) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug