Skip to content

Instantly share code, notes, and snippets.

View herminiotorres's full-sized avatar
🍇
Grapes Vibes

Herminio Torres herminiotorres

🍇
Grapes Vibes
View GitHub Profile
defmodule Parser do
def numero() do
fn
<<c::utf8>> <> rest ->
case c do
c when c in ?0..?9 -> {:ok, c - ?0, rest}
_ -> {:error, {:numero, :no_parse, c}, <<c::utf8>> <> rest}
end
end
end
@mcrumm
mcrumm / page_live_test.exs
Created February 8, 2021 22:10
LiveView artifacts
defmodule MyAppWeb.PageLiveTest do
use MyAppWeb.ConnCase
import Phoenix.LiveViewTest
@tag :tmp_dir
test "disconnected and connected render", %{conn: conn, tmp_dir: tmp_dir} do
{:ok, page_live, disconnected_html} = live(conn, "/")
assert disconnected_html =~ "Welcome to Phoenix!"
@dealloc
dealloc / Dockerfile
Last active October 7, 2020 18:45
Elixir Docker makefile
FROM elixir:alpine
WORKDIR /app
ARG USER_UID
ARG UNAME
EXPOSE 4000
RUN apk add --no-cache curl bash
RUN curl --url https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh --output /wait-for-it.sh
COPY ./docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh