Skip to content

Instantly share code, notes, and snippets.

m31271n

Block or report user

Report or block m31271n

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@m31271n
m31271n / Dockerfile
Created Oct 13, 2019
Dockerfile for Phoenix umbrella project
View Dockerfile
# Dockerfile for Phoenix umbrella project.
# > Global args
# https://github.com/moby/moby/issues/37345#issuecomment-400245466
# customizable args
ARG PROJECT_NAME=<%= @project_name %>
ARG RELEASE_NAME=<%= @project_name %>_umbrella
ARG PORT=4000
@m31271n
m31271n / Dockerfile
Last active Oct 14, 2019
Dockerfile for Phoenix project
View Dockerfile
# Dockerfile for Phoenix project.
# > Global args
# https://github.com/moby/moby/issues/37345#issuecomment-400245466
# customizable args
ARG RELEASE_NAME=<%= @project_name %>
ARG PORT=4000
# internal args
@m31271n
m31271n / config.exs
Last active Mar 10, 2019
Source dotenv with pure Elixir code.
View config.exs
# config/config.exs
# ...
use Mix.Config
import_config_exist = fn filename ->
path = Path.join("config", filename)
if File.exists?(path) do
@m31271n
m31271n / phoenix_redirect.ex
Last active Mar 7, 2019
Redirect in Phoenix Framework.
View phoenix_redirect.ex
defmodule LubyWeb.Redirect do
import Phoenix.Controller, only: [redirect: 2]
import Plug.Conn, only: [halt: 1]
def init(opts) do
opts
end
def call(conn, opts) do
conn
@m31271n
m31271n / elixir_decapitalize.exs
Last active Mar 7, 2019
Decapitalize in Elixir style.
View elixir_decapitalize.exs
def decapitalize(string) when is_binary(string) do
{first_char, rest} = String.split_at(string, 1)
String.downcase(first_char) <> rest
end
View dockerenv
#!/usr/bin/env bash
#
# local version of docker-machine env vm
#
# Usage:
# dockerenv <machine> <command>
#
# Example:
# dockerenv node docker ps
#
View fix-yarn-lockfile.sh
#!/usr/bin/env bash
# workaround for https://github.com/yarnpkg/yarn/issues/2566
# run it with just one command: curl -sSL https://bit.ly/fix-yarn-lock | bash
sed \
-i 's|https\?://registry.npm.taobao.org|https://registry.yarnpkg.com|' \
yarn.lock
You can’t perform that action at this time.