Skip to content

Instantly share code, notes, and snippets.

View therealparmesh's full-sized avatar
🦮

Parmesh Krishen therealparmesh

🦮
  • Austin, Texas
  • 14:39 (UTC -06:00)
View GitHub Profile
@therealparmesh
therealparmesh / config
Last active December 30, 2024 16:40
ghostty configuration
theme = tokyonight
font-family = 0xProto Nerd Font Mono
font-thicken = true
macos-option-as-alt = true
keybind = alt+left=unbind
keybind = alt+right=unbind
@therealparmesh
therealparmesh / index.js
Created December 21, 2024 13:37
HTMX multi-step form
// `bun run index.js`
// localhost:3000
Bun.serve({
fetch(req) {
const url = new URL(req.url);
if (url.pathname === "/step") {
const currentStep = url.searchParams.get("to");
return new Response(
@therealparmesh
therealparmesh / html.ts
Last active December 6, 2024 17:33
html template
export function html(strings: TemplateStringsArray, ...expressions: string[]) {
let result = '';
for (let i = 0; i < strings.length; i++) {
result += strings[i];
if (i < expressions.length) {
result += expressions[i];
}
}
return result;
}
@therealparmesh
therealparmesh / install.sh
Created November 3, 2024 15:29
Bun local install script
#!/usr/bin/env bash
set -euo pipefail
# Check for required arguments
if [[ $# -ne 2 ]]; then
echo "Usage: $0 <bun-version-tag> <install-directory>"
echo "Example: $0 bun-v0.6.9 /path/to/install/dir"
exit 1
fi
@therealparmesh
therealparmesh / zed-vim-mode-cheatsheet.md
Created October 24, 2024 14:38
Zed vim mode cheatsheet

Zed Vim Mode Cheat Sheet

Zed's Vim mode replicates familiar Vim behavior while integrating modern features like semantic navigation and multiple cursors. This cheat sheet summarizes essential shortcuts and settings to help you navigate and edit code efficiently in Zed.


Enabling/Disabling Vim Mode

  • Enable/Disable Vim Mode: Open the command palette and use Toggle Vim Mode.
  • This updates your user settings: "vim_mode": true or false.
@therealparmesh
therealparmesh / init.lua
Created October 7, 2024 22:27
init.lua
return {
{
"ggandor/leap.nvim",
version = "*",
},
{
"mg979/vim-visual-multi",
version = "*",
},
}
@therealparmesh
therealparmesh / languages.toml
Created July 13, 2024 16:28
Helix languages.toml
[[language]]
name = "javascript"
auto-format = true
formatter = { command = "prettier", args = ["--write"] }
[[language]]
name = "typescript"
auto-format = true
formatter = { command = "prettier", args = ["--write"] }
@therealparmesh
therealparmesh / slides.html
Created May 22, 2024 17:16
reveal.js boilerplate
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<title>reveal.js</title>
<link
@therealparmesh
therealparmesh / Makefile
Created March 16, 2024 22:23
Go + Bun + HTMX + Tailwind Makefile
.PHONY: setup dev build
setup:
@echo "Checking for go..."
@command -v go >/dev/null 2>&1 || { echo >&2 "go is not installed. Aborting."; exit 1; }
@echo "Checking for bun..."
@command -v bun >/dev/null 2>&1 || { echo >&2 "bun is not installed. Aborting."; exit 1; }
@echo "Checking for air..."
@command -v air >/dev/null 2>&1 || { echo >&2 "air is not installed. Please install it by running 'go install github.com/cosmtrek/air@latest'. Aborting."; exit 1; }
@echo "Running go mod tidy..."
export async function retryAsync<T>(
asyncFn: () => Promise<T>,
maxRetries: number,
): Promise<T> {
let retries = 0;
while (retries < maxRetries) {
try {
return await asyncFn();
} catch (error) {