by Ossi Hanhinen, @ohanhi
with the support of Futurice 💚.
Licensed under CC BY 4.0.
defmodule MyApp do | |
use Application | |
def start(_type, _args) do | |
import Supervisor.Spec, warn: false | |
children = [ | |
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [ | |
dispatch: dispatch | |
]) |
// devDependencies in package.json: | |
"require-reload": "0.2.2", | |
"react-transform-hmr-no-accept": "1.0.1", // not published, get it here: https://github.com/brandonbloom/react-transform-hmr | |
// in babelrc: | |
"env": { | |
"development": { | |
"plugins": [ |
Picking the right architecture = Picking the right battles + Managing trade-offs
Please go here for latest post and feel free to comment
[new post] (https://gist.github.com/idibidiart/49a095b6bc528638f34f)
defmodule Duration do | |
@moduledoc """ | |
This duration module parses and formats strings | |
for a time duration in hours and minutes and | |
optionally seconds (e.g. 01:00 for an hour, | |
00:01:10 for one minute and ten seconds). | |
""" | |
@match ~r/^(?<hour>\d{1,2}):(?<min>\d{1,2}):?(?<sec>\d{0,2})$/ | |
def parse(string) do |
Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.
This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.
There is a companion feature matrix of various tools. Comments are welcome in the same manner.
# ATTENTION: This is now supported in plug_cowboy as of 2.1.0: | |
# https://hexdocs.pm/plug_cowboy/Plug.Cowboy.Drainer.html | |
defmodule DrainStop do | |
@moduledoc """ | |
DrainStop Attempts to gracefully shutdown an endpoint when a normal shutdown | |
occurs. It first shuts down the acceptor, ensuring that no new requests can be | |
made. It then waits for all pending requests to complete. If the timeout | |
expires before this happens, it stops waiting, allowing the supervision tree | |
to continue its shutdown order. |
defmodule StageInspector do | |
alias Experimental.{GenStage} | |
use GenStage | |
def init(type) when type in [:consumer, :producer_consumer] do | |
{type, type} | |
end | |
def handle_events(events, _from, state = :consumer) do | |
Enum.each events, &inspect_event/1 |
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.