Skip to content

Instantly share code, notes, and snippets.

;; -*- lexical-binding: t -*-
;; This is my Emacs config
;; it is my own, there is none like it
;; How do I navigate through CamelCase words?
;; I use the built-in `winner-mode` to remember the window history
;; Setup melpa
(require 'package)
defmodule PasswordValidator.Mixfile do
use Mix.Project
@source_url "https://github.com/axelson/password-validator"
@version "0.5.0"
def project do
[
app: :password_validator,
name: "Password Validator",
defmodule MyApp.ObanUtils do
@doc """
Wait for our Phoenix Endpoint to come online
Without waiting for the Phoenix Endpoint to start up we have a race condition
where a job may execute that broadcasts a message (which requires the Endpoint
to be running). And additionally our Phoenix controller's depend on Oban to be
running so that `Oban.insert/3` can be used (which gives us guarantees about
uniqueness).
defmodule MyApp.ObanUtils do
@doc """
Wait for our Phoenix Endpoint to come online
Without waiting for the Phoenix Endpoint to start up we have a race condition
where a job may execute that broadcasts a message (which requires the Endpoint
to be running). And additionally our Phoenix controller's depend on Oban to be
running so that `Oban.insert/3` can be used (which gives us guarantees about
uniqueness).
children = [
MyApp.Repo,
MyAppWeb.Telemetry,
{Phoenix.PubSub, name: MyApp.PubSub},
MyAppWeb.Endpoint,
MyApp.PresenceDrainer # <-- NEW!
]
defmodule MyApp.PresenceDrainer do
use GenServer
require Logger
def start_link(opts \\\\ []) do
GenServer.start_link(__MODULE__, opts, name: __MODULE__)
end
@impl GenServer
def init(_init_arg) do
defmodule MyApp.GracefulShutdownHandler do
use GenServer
require Logger
def start_link(opts \\\\ []) do
GenServer.start_link(__MODULE__, opts, name: __MODULE__)
end
@impl GenServer
def init(_init_arg) do
# We need to trap exits so that we receive the `terminate/2` callback during
# a graceful shutdown
@axelson
axelson / README.md
Last active August 14, 2022 20:14
Run `git save-branch` to save the current branch so you don't lose work

Run git config --global alias.save-branch '!~/scripts/git-save-branch.sh (customize the path to match where you save the script to)

Now you can run git save-branch to run the script

(setq gist-view-gist t)
(defun jax-aw-maximize-window (window)
"Select buffer in WINDOW."
(aw-switch-to-window window)
(doom/window-maximize-buffer))

But it is Live! You can see the messages coming in in real-time.

Architecture: