Alpine: 3.4 Elixir: 1.3.4 Erlang: R18
linux-headers erlang-snmp
| # Much simplified version based on https://github.com/zhangsoledad/alchemic_avatar | |
| # Avatar.generate/2 returns a Plug.Upload that can be passed directly | |
| # into Ecto.Changeset (as for example fallback image) | |
| defmodule Avatar do | |
| @defaults [ | |
| size: 300, | |
| font_path: Application.app_dir(:my_app, "priv/fonts/Roboto.ttf"), | |
| font_size: 40, | |
| font_weight: 500, |
| @doc """ | |
| Asserts based on pattern matching. | |
| Example: check if collection contains element that matches the pattern | |
| assert_match %{body: "lorem"} in messages | |
| assert_match %{id: ^id} in response["users"] | |
| """ | |
| defmacro assert_match({:in, _, [left, right]} = assertion) do | |
| code = Macro.escape(assertion) |
| @doc """ | |
| Validate each array element with validator | |
| Examples | |
| iex> changeset | |
| ...> |> validate_each(:emails, &validate_email) | |
| ...> |> validate_each(:phones, &validate_format(&1, &2, ~r/\d+/)) | |
| ...> |> validate_each(:phones, &validate_length/3, is: 4) | |
| """ | |
| def validate_each(changeset, field, validator, opts) do |
| (0 to Int.MaxValue) == Range() // empty! | |
| class X extends Actor { | |
| def act { | |
| val a = actor { | |
| loop { | |
| receive { // FAIL, must use 'self.receive' | |
| case ... | |
| } | |
| } |