Skip to content

Instantly share code, notes, and snippets.

-- https://gist.github.com/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)
@anzdaddy
anzdaddy / client.go
Last active July 14, 2024 01:25
Go wasm test code
package main
import (
"fmt"
"log"
"os"
"github.com/anzx/envelope-compose-go/internal/rpc/wasm/client/gowasmer"
)
@anzdaddy
anzdaddy / README.md
Last active June 19, 2024 00:59
Run a command against a clean working tree

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() {
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]*;
@anzdaddy
anzdaddy / README.md
Last active June 5, 2024 23:28
Injected middleware idea

Injected Middleware

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 {