Skip to content

Instantly share code, notes, and snippets.

View schinsue's full-sized avatar

Sergio Chin-Sue schinsue

View GitHub Profile
@schinsue
schinsue / git lola
Created October 31, 2017 16:57 — forked from BibMartin/git lola
git config --global alias.lola "log --graph --decorate --pretty=oneline --abbrev-commit --all"
@schinsue
schinsue / map_difference.ex
Created September 27, 2017 08:23 — forked from boydm/map_difference.ex
Elixir meyers_difference for Maps
defmodule Boydm.Utilities.Map do
#============================================================================
# similar to List.meyers_difference, the below code compares two maps
# and generates a list of actions that can be applied to the first map
# to transform it into the second map.
#--------------------------------------------------------
def difference(map_1, map_2) when is_map(map_1) and is_map(map_2) do
# remove any keys from map_1 that are simply not present (at all) in map_2
@schinsue
schinsue / app.js
Created September 21, 2017 11:36 — forked from taiansu/app.js
Phoenix brunch config which just make sense
import "phoenix_html"
import "bootstrap"
import "jquery"
import "toastr"
// ...
@schinsue
schinsue / remove_git_tag
Created August 18, 2017 10:51 — forked from dearaujoj/remove_git_tag
git remove tag locally and remote
git tag -d TagName && git push origin :refs/tags/TagName

Deploying Elixir and Phoenix applications using Docker and Exrm

Goal

By the end of this quick guide, you will know how to compile a Phoenix app release using Exrm and run it inside a Docker container. I've found only a couple of articles that discuss getting an Elixir app up and running inside a Docker container, and even those only touched on some parts of the process. The idea is that this guide will give you a full end-to-end example of how to get all the pieces and parts working together so that you are able to deploy your Phoenix application inside a Docker container.

Assumptions

  1. You already have a working Elixir environment with the Phoenix Framework installed
  2. You have at least basic working knowledge of Docker, and have installed the Docker tools onto your local environment
@schinsue
schinsue / sliding_session_timeout.ex
Created July 13, 2017 09:03 — forked from qertoip/sliding_session_timeout.ex
Elixir / Phoenix Sliding Session Timeout Plug
# How to use it:
#
# Plug it at the end of your :browser pipeline in your Phoenix app router.ex
# Make sure it is plugged before your session-based authentication and authorization Plugs.
#
# pipeline :browser do
# plug :accepts, ["html"]
# plug :fetch_session
# plug :fetch_flash
# plug :put_secure_browser_headers
# app deps
sudo yum install git
# erlang deps
sudo yum groupinstall "Development Tools"
sudo yum install ncurses-devel
# erlang
wget http://www.erlang.org/download/otp_src_18.1.tar.gz
tar -zxvf otp_src_18.1.tar.gz