Skip to content

Instantly share code, notes, and snippets.

View aaronjensen's full-sized avatar

Aaron Jensen aaronjensen

View GitHub Profile
(deftheme monokai "The Monokai colour theme")
(defgroup monokai nil
"Monokai theme options.
The theme has to be reloaded after changing anything in this group."
:group 'faces)
(defcustom monokai-distinct-fringe-background nil
"Make the fringe background different from the normal background color.
Also affects 'linum-mode' background."
defp format_status("authorization_expired"), do: :authorization_expired
defp format_status("authorized"), do: :authorized
defp format_status("authorizing"), do: :authorizing
defp format_status("settlement_pending"), do: :settlement_pending
defp format_status("settlement_declined"), do: :settlement_declined
defp format_status("settlement_confirmed"), do: :settlement_confirmed
defp format_status("failed"), do: :failed
defp format_status("gateway_rejected"), do: :gateway_rejected
defp format_status("processor_declined"), do: :processor_declined
defp format_status("settled"), do: :settled
@aaronjensen
aaronjensen / drain_stop.ex
Last active November 28, 2022 06:59
Phoenix Drain Stop
# 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.
-*- mode: compilation; default-directory: "~/Source/myapp/booking/web/booking/search/" -*-
Compilation started at Thu Jun 2 09:14:06
elixir -e IEx.Helpers.cd\(\"\~/Source/myapp/booking/\"\) -S mix dialyzer
/Users/aaronjensen/Source/myapp/booking
web/booking/search/location_searcher.ex:85: warning: clauses for the same def should be grouped together, def handle_info/2 was previously defined (web/booking/search/location_searcher.ex:72)
web/booking/search/location_searcher.ex:96: warning: clauses for the same def should be grouped together, def handle_info/2 was previously defined (web/booking/search/location_searcher.ex:72)
web/booking/search/location_searcher.ex:63: warning: variable location is unused
web/booking/search/location_searcher.ex:63: warning: variable radius is unused
web/booking/search/location_searcher.ex:67: warning: variable location is unused
nextstep/templates/Info.plist.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/nextstep/templates/Info.plist.in b/nextstep/templates/Info.plist.in
index dcd2fe3..6f56939 100644
--- a/nextstep/templates/Info.plist.in
+++ b/nextstep/templates/Info.plist.in
@@ -675,5 +675,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
</array>
<key>NSAppleScriptEnabled</key>
- command-execute 625 46%
- call-interactively 625 46%
- self-insert-command 578 42%
- sp--post-self-insert-hook-handler 451 33%
- condition-case 451 33%
- if 451 33%
- progn 450 33%
- let 450 33%
- cond 450 33%
- if 450 33%
defprotocol Enumerable do
require Stream.Reducers, as: R
defmacrop skip(acc) do
acc
end
defmacrop next(_, entry, acc) do
quote do: [unquote(entry) | unquote(acc)]
end
defmodule Bottles do
def song, do: verses(99, 0)
def verses(first, last) do
Enum.map_join first..last, "\n", &verse/1
end
def verse(0) do
"""
No more bottles of beer on the wall, no more bottles of beer.
defmodule Bottles do
def song, do: verses(99, 0)
def verses(first, last) do
Enum.map_join first..last, "\n", &verse/1
end
def verse(number) do
"#{String.capitalize(quantity(number))} #{container(number)} of beer on the wall, " <>
"#{quantity(number)} #{container(number)} of beer.\n" <>
defmodule Bottles do
def song, do: verses(99, 0)
def verses(first, last) do
Enum.map_join first..last, "\n", &verse/1
end
def verse(number) do
"#{String.capitalize(containers(number))} of beer on the wall, " <>
"#{containers(number)} of beer.\n" <>