Skip to content

Instantly share code, notes, and snippets.

@dhh
dhh / pagination_controller.js
Last active May 11, 2025 15:07
HEY's Stimulus Pagination Controller
/*
ERB template chunk from The Feed's display of emails:
<section class="postings postings--feed-style" id="postings"
data-controller="pagination" data-pagination-root-margin-value="40px">
<%= render partial: "postings/snippet", collection: @page.records, as: :posting, cached: true %>
<%= link_to(spinner_tag, url_for(page: @page.next_param),
class: "pagination-link", data: { pagination_target: "nextPageLink", preload: @page.first? }) unless @page.last? %>
</section>
@dhh
dhh / linux-setup.sh
Last active July 5, 2025 08:52
linux-setup.sh
# THIS LINUX SETUP SCRIPT HAS MORPHED INTO A WHOLE PROJECT: HTTPS://OMAKUB.ORG
# PLEASE CHECKOUT THAT PROJECT INSTEAD OF THIS OUTDATED SETUP SCRIPT.
#
#
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)

Vim Manipulation Cheat Sheet

Action

Key Result
v select
y copy (yank)
c change
d delete
@dhh
dhh / gist:a4b7de450276e336e3badec34fec0a75
Created June 28, 2025 16:32
ghostty-config-for-tokyo-nights
# Font configuration
font-family = CaskaydiaMono Nerd Font
font-size = 9
# Window settings
window-padding-x = 14
window-padding-y = 14
window-decoration = false
background-opacity = 0.98