Tagged with “Elixir”

7 posts found.

Inhji posted

TIL a neat way to try a few different strategies to get some thing:

Enum.reduce_while(
      [
        &maybe_get_favicon_from_hcard/1,
        &maybe_get_favicon_from_head/1
      ],
      nil,
      fn strategy, acc ->
        case strategy.(url) do
          {:error, _} -> {:cont, acc}
          {:ok, favicon} -> {:halt, favicon}
        end
      end
    )

Source: koype by jacky

Inhji posted

TIL you can make development in iex even smoother by adding an .iex.exs file to your home and/or project directory to automatically alias common modules. 🚀