Skip to content
View foo.exs
defmodule Foo do
@menu [foo: 1, bar: 3, baz: 2]
@filtered_menu @menu |> Enum.filter(...)
def filtered_menu do
View user_drv.diff
diff --git a/lib/kernel/src/user_drv.erl b/lib/kernel/src/user_drv.erl
index 7b4ffb0..745fe46 100644
--- a/lib/kernel/src/user_drv.erl
+++ b/lib/kernel/src/user_drv.erl
@@ -172,17 +172,17 @@ server_loop(Iport, Oport, Curr, User, Gr) ->
{Iport,eof} ->
Curr ! {self(),eof},
server_loop(Iport, Oport, Curr, User, Gr);
- {User,Req} -> % never block from user!
- io_request(Req, Iport, Oport),
View poolboy_mix.exs
defmodule Poolboy.Mixfile do
use Mix.Project
@version!("VERSION") |> String.strip
def project do
[app: :poolboy,
version: @version,
description: "A hunky Erlang worker pool factory",
package: package]
View gist:11173516


A map pattern will match any map that has the given keys and values. For example, %{"hello" => world} will match any map that has the key "hello". An empty map therefore matches all maps.


A map pattern will match any map that has all the keys specified in the pattern. The values for the matching keys must also match. For example, %{"hello" => world} will match any map that has the key "hello" and assign the value to world, while %{"hello" => "world"} will match any map that has the key"hello"with value equals to"world". An empty map pattern (%{}`) will match all maps.

View pdict.diff
diff --git a/lib/task/sup.ex b/lib/task/sup.ex
index 3070aa2..4cc4968 100644
--- a/lib/task/sup.ex
+++ b/lib/task/sup.ex
@@ -66,10 +66,14 @@ defmodule Task.Sup do
@spec async(Supervisor.supervisor, module, atom, [term]) :: Task.t
def async(supervisor, module, fun, args) do
- { :ok, pid } = Supervisor.start_child(supervisor, [self(), { module, fun, args }])
+ lock = make_ref()
View 1_gen_server.ex
defmodule Mix.TasksServer do
@moduledoc false
use GenServer.Behaviour
def start_link() do
:gen_server.start_link({ :local, __MODULE__ }, __MODULE__, :ok, [])
def clear_tasks() do
call :clear_tasks
View gen_event.diff
diff --git a/lib/gen_event.ex b/lib/gen_event.ex
index bc2a34f..07ca53f 100644
--- a/lib/gen_event.ex
+++ b/lib/gen_event.ex
@@ -468,8 +468,12 @@ defimpl Enumerable, for: GenEvent do
send mon_pid, { :UP, mon_ref, self() }
receive do
- { :UP, ^mon_ref, manager_pid } -> { mon_ref, mon_pid, manager_pid }
- { :DOWN, ^mon_ref, _, _, reason } -> exit(reason)
View my_receive.exs
defmodule MyReceive do
defmacro my_receive(do: clauses) do
extra = quote do
other -> IO.puts "got #{inspect other}"
quote do
receive do: unquote(clauses ++ extra)
View seq_interleave.exs
defmodule Interleave do
def interleave(a, b) do
af = Seq.impl_for(a)
bf = Seq.impl_for(b)
do_interleave_1(af, a, bf, b, []) |> :lists.reverse()
defp do_interleave_1(af, a, bf, b, acc) do
case do
{ :next, i, a } ->
View rules.exs
# Elixir v1.0
defmodule Rules do
defmacro __using__(_) do
quote do
import unquote(__MODULE__)
@before_compile unquote(__MODULE__)
@rules []
Something went wrong with that request. Please try again.