Skip to content

Instantly share code, notes, and snippets.

View fieldinrain's full-sized avatar
🏠
Working from home

fieldinrain

🏠
Working from home
View GitHub Profile
@fieldinrain
fieldinrain / drain_stop.ex
Created October 7, 2019 08:59 — forked from aaronjensen/drain_stop.ex
Phoenix Drain Stop
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.
DrainStop should be installed in your supervision tree *after* the
EndPoint it is going to drain stop.
@fieldinrain
fieldinrain / p101.ex
Last active October 18, 2016 02:11
Elixir 99 problems
defmodule P101 do
def last([]), do: nil
def last([h]), do: h
def last([h|t]), do: last(t)
end
@fieldinrain
fieldinrain / 0_reuse_code.js
Created October 17, 2016 15:41
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console