This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Test.ErrorView do | |
use Phoenix.View, root: "" | |
def render(path, _) do | |
[code, format] = path |> String.split(".") | |
IO.puts "Rendering #{format}" | |
format | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Socket do | |
use GenServer | |
alias Socket.Worker | |
def start_link do | |
GenServer.start_link __MODULE__, [] | |
end | |
def init(_state) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Consumer do | |
use Coxir | |
use Coxir.Commands | |
@prefix "~" | |
@space :none | |
@channel :any | |
@permit :none | |
command ping do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Testing do | |
@behaviour :gen_statem | |
def test() do | |
{:ok, pid} = start_link() | |
:gen_statem.call(pid, :get_state) |> IO.inspect() | |
to_party(pid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Currying do | |
def function ~> argument when is_function(function) do | |
curry(function, argument) | |
end | |
def curry(function, arguments) when is_function(function) and is_list(arguments) do | |
{:arity, arity} = Function.info(function, :arity) | |
arguments = Enum.reverse(arguments) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ast = | |
{:fn, [], | |
[ | |
{:->, [], | |
[ | |
[ | |
{:a, [counter: 1], nil}, | |
{:a, [counter: 2], nil} | |
], | |
{{:a, [counter: 1], nil}, {:a, [counter: 2], nil}} |