Skip to content

Instantly share code, notes, and snippets.

View anzdaddy's full-sized avatar

Marcelo Cantos anzdaddy

View GitHub Profile
@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 {