This file contains hidden or 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 Standalone.Mixfile do | |
| use Mix.Project | |
| def project do | |
| [ app: :standalone, | |
| version: "0.0.1", | |
| elixir: "~> 0.12.3-dev", | |
| escript_main_module: Standalone.Main, | |
| deps: deps ] | |
| end |
This file contains hidden or 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
| iex(2)> Test.test1 | |
| {1474377, :ok} | |
| iex(3)> Test.test2 | |
| {755840, :ok} |
This file contains hidden or 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 Parser do | |
| @dict HashDict.new([{"foo", "bar"}, {"baz", "buzz"}]) | |
| defrecord :state, [in_match: false, escaping: false, key: ""] | |
| def translate(string) do | |
| translate(string, :state[]) | |
| end | |
| defp translate("", _), do: "" | |
| defp translate(<<"\\", rest:: binary>>, state) do |
This file contains hidden or 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
| defrecord Test, [id: nil, what: nil] | |
| spawn fn -> :etop.start [output: :text] end | |
| case what_to_test do | |
| :json -> Enum.each(1..1000_000, fn _ -> Test[id: 1] |> JSON.encode end) | |
| :inspect -> Enum.each(1..1000_000, fn _ -> inspect Test[id: 1] end) | |
| end |
This file contains hidden or 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
| lc cid inlist([398, 980, 810]) do | |
| def list(unquote(cid)), do: unquote(@providers |> Enum.filter(fn | |
| [id: _, name: _, currency: c_id, pattern: _, placeholder: _] when c_id = cid -> true; | |
| _ -> false; | |
| end)) | |
| end |
This file contains hidden or 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 LAX do | |
| defmodule Transformer do | |
| def exec({ {:., _, [Kernel, :access]} , misc, [subj, [key]]}) do | |
| quote do | |
| LAX.getter(unquote(exec(subj)), unquote(exec(key))) | |
| end | |
| end | |
| def exec(code), do: code | |
| end | |
This file contains hidden or 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 LAXer do | |
| defmodule Transformer do | |
| def exec({ {:., _, [Kernel, :access]} , _, [subj, [key]]}) do | |
| quote do | |
| LAXer.getter(unquote(exec(subj)), unquote(exec(key))) | |
| end | |
| end | |
| def exec({ op, misc, args }) when is_list(args) do | |
| {op, misc, (for arg <- args, do: exec(arg))} | |
| end |
This file contains hidden or 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 PipesX do | |
| defmacro pipe_with(fun, pipes) do | |
| IO.puts "Will reduce over: #{inspect Macro.unpipe(pipes)}" | |
| Enum.reduce Macro.unpipe(pipes), &(reduce_with &1, &2, fun) | |
| end | |
| defp reduce_with( {segment, pos}, acc, outer ) do | |
| IO.puts "reduce_with: Got #{inspect segment} at #{inspect pos}" | |
| quote do | |
| inner = fn(x) -> |
This file contains hidden or 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 Options do | |
| @proto_version "1.0" | |
| def process_options(opts) do | |
| log_opt ++ | |
| Enum.map(opts, fn | |
| {:in, true} -> ["-in"] | |
| {:err, :out} -> ["-err", "out"] | |
| {:err, :err} -> ["-err", "err"] | |
| {:dir, dir} -> ["-dir", dir] |
This file contains hidden or 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
| mvn install -DskipTests=true -Dgpg.skip=true |
OlderNewer