Skip to content

Instantly share code, notes, and snippets.

@givensuman
givensuman / box.fish
Created December 4, 2025 20:58
fish shell wrapper for distrobox on ublue systems
##? We can create a wrapper function for Distrobox that makes our lives much easier.
##?
##? For one, it adds an is-inside subcommand for checking whether you're in a container.
##? It also modifies the enter subcommand to remember the last container we were in, which turns out to be super useful.
##? Most importantly, though, it changes our create command to add packages layered to our immutable system, and mount the
##? install location of ublue-brew (e.g. Linuxbrew)
##?
function box
set -l cmd $argv[1]
@givensuman
givensuman / main.go
Last active October 14, 2025 16:21
Implementation of the Observer design pattern
package main
import "fmt"
// UpdateLogger is a concrete type which can observe
// Observable and log their updates
type UpdateLogger struct {
message string
}
@givensuman
givensuman / App.tsx
Created December 17, 2024 05:01
Type-safe useCanvas hook for React canvas animations
import React from "react";
import useCanvas from "./useCanvas";
import { useWindowSize } from "@uidotdev/usehooks";
const App = () => {
const { width, height } = useWindowSize();
const canvasRef = useCanvas(
(ctx, frame) => {
ctx.fillRect(100, 100 + frame, 100, 100);
},