Skip to content

Instantly share code, notes, and snippets.

# ===========================================
# ZSH Hacks - Dreams of Code
# ===========================================
# Add these to your .zshrc file
# ===========================================
# -------------------------------------------
# 1. Edit Command Buffer
# -------------------------------------------
# Open the current command in your $EDITOR (e.g., neovim)
system.activationScripts.applications.text = let
env = pkgs.buildEnv {
name = "system-applications";
paths = config.environment.systemPackages;
pathsToLink = "/Applications";
};
in
pkgs.lib.mkForce ''
# Set up applications.
echo "setting up /Applications..." >&2
@elliottminns
elliottminns / main.go
Created June 6, 2024 13:47
Generic JSON Unmarshaling in Go
package main
import (
"encoding/json"
"log"
)
type Response[T any] struct {
Status string `json:"status"`
Data T `json:"data"`
@elliottminns
elliottminns / main.go
Created June 6, 2024 13:44
Generic Response Handling in Go
package main
import (
"encoding/json"
"log"
)
type Response struct {
Status string `json:"status"`
Data json.RawMessage `json:"data"`