Skip to content

Instantly share code, notes, and snippets.

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
@d0rc
d0rc / high_load_serial_requests.ex
Created March 6, 2014 00:35
steps to reproduce erl_prim_loader @100%
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
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
iex(2)> Test.test1
{1474377, :ok}
iex(3)> Test.test2
{755840, :ok}
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