Skip to content

Instantly share code, notes, and snippets.


Philip Sampaio philss

View GitHub Profile
philss / mix.exs
Created Dec 24, 2019
Mix project with a flexible config for the Elixir artifacts
View mix.exs
defmodule MyApp.MixProject do
use Mix.Project
def project do
app: :my_app,
version: "0.1.0",
elixir: "~> 1.5",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
philss / docker-compose.yml
Created Dec 24, 2019
Docker compose config with Elixir artifacts not being shared with host
View docker-compose.yml
version: "3.3"
image: postgres:11.1-alpine
- "5432:5432"
env_file: .env
context: .

Keybase proof

I hereby claim:

To claim this, I am signing this object:

philss / oban-output.txt
Created Jun 7, 2019
Oban output after crashing without finding the table
View oban-output.txt
22:27:17.495 [error] GenServer Oban.Pruner terminating
** (Postgrex.Error) ERROR 42P01 (undefined_table) relation "oban_jobs" does not exist
query: DELETE FROM "oban_jobs" AS o0 USING (SELECT o0."id" AS "id", o0."state" AS "state", o0."queue" AS "queue", o0."worker" AS "worker", o0."args" AS "args", o0."errors" AS "errors", o0."attempt" AS "attempt", o0."max_attempts" AS "max_attempts", o0."attempted_at" AS "attempted_at", o0."completed_at" AS "completed_at", o0."inserted_at" AS "inserted_at", o0."scheduled_at" AS "scheduled_at" FROM "oban_jobs" AS o0 WHERE (o0."state" IN ('completed','discarded')) ORDER BY o0."id" DESC OFFSET $1) AS s1 WHERE (o0."id" = s1."id")
(ecto_sql) lib/ecto/adapters/sql.ex:618: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto_sql) lib/ecto/adapters/sql.ex:551: Ecto.Adapters.SQL.execute/5
(oban) lib/oban/pruner.ex:44: Oban.Pruner.handle_info/2
(stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
(stdlib) gen_server.erl:388: :gen_server.loop/7
(stdlib) proc_lib.erl:249: :proc_lib.init
philss / Dockerfile
Created Feb 20, 2018
Example of Dockerfile for a Phoenix App
View Dockerfile
FROM elixir:1.6.0-alpine
RUN mix local.hex --force \
&& mix local.rebar --force \
&& apk --no-cache --update add postgresql-client bash \
&& rm -rf /var/cache/apk/* \
&& mkdir /app
COPY . /app
philss / docker-compose.yml
Created Feb 20, 2018
Example of docker compose for a Phoenix App
View docker-compose.yml
version: "3.3"
image: postgres
- "5432"
context: .
dockerfile: Dockerfile

SML Module System

There is a way to define a namespace in SML: define an "structure" that creates a module.


structure MyMath =
val pi = 3.141529

Mutual recursion

Every finete state machine that does not need to hold state can be represented by a mutual recursive pair (or more) of functions.

ML specific

You can implement mutual recursion using the built-in and keyword between functions. It is also possible to implement it using a higher order function (a function that receives another function).

philss /
Last active Aug 12, 2018
Some details about my installation of Ternjs with Neovim and Deoplete

Ternjs with Neovim

  • upgrade nvim (in my case, I have the master version):
$ brew tap neovim/neovim
$ brew reinstall --HEAD neovim
  • check Python 2 and 3, if are installed:
$ which python2
philss / zshrc
Created Jun 30, 2015
Zsh git functions
View zshrc
# Put those functions on your ~/.zshrc or something similar.
# Cleans all merged branches (relative to the branch you are). Recommended to run from master.
function git_clean_branches()
# Fetch all merged branches that are not the master branch, and not the current branch
echo 'Deleting all merged branches...'
for branch in `git branch --merged | awk -F ' * ' '{print $2}' | grep -v -e 'master' | grep -v -e '*'`
echo "Removing .. $branch"
You can’t perform that action at this time.