Skip to content

Instantly share code, notes, and snippets.

@sephraim
sephraim / ALL_configs_v1---config.toml
Last active October 16, 2026 00:32
[Mise config examples]
# File: ~/.config/mise/config.toml
# Example 2: Using "table" format introduced by a table header
#
# With this format, you can group aliases next to their configs
# Devcontainer CLI
[tools.devcontainer-cli]
version = "latest"
@sephraim
sephraim / README.md
Created October 8, 2026 20:13
[Rewrite Git commit history] e.g., replace commit author emails

The preferred tool is git-filter-repo. Do not use git filter-branch; Git’s documentation explicitly recommends alternatives such as git-filter-repo because filter-branch is slow and error-prone.

Rewrite only the author identity

Install:

brew install git-filter-repo
@sephraim
sephraim / README.md
Created September 25, 2026 17:24
[shdoc on MacOS]

shdoc

Documentation generator for shell scripts (bash, sh, zsh). Javadoc for shell scripts.

Install

gawk is required:

brew install gawk
@sephraim
sephraim / .zshrc
Created November 14, 2025 17:19
[Override default Docker Compose file location]
### DOCKER ###
export COMPOSE_FILE=.devcontainer/docker/docker-compose.yml
@sephraim
sephraim / getter_vs_setter.rb
Created September 12, 2025 14:24
[Using getters / setters / class variables in Ruby]
class MyClass
attr_reader :my_var
def initialize
@my_var = "initial value"
end
def demonstrate
# IMPORTANT: `self` is OPTIONAL for getters but MANDATORY for setters
puts "1. Reading with 'my_var': #{my_var}" # Calls the getter
@sephraim
sephraim / force_resolve_dist_conflicts.sh
Last active June 20, 2025 21:27
[Resolve merge conflicts in dist/ directory] Ignore incoming merge conflicts for dist/ files and just use "ours"
# Pull in changes
# NOTE: This is what will cause the merge conflicts
git pull --rebase origin develop
# Force resolve dist/ conflicts by using "ours"
git checkout --ours dist
git add dist
git rebase --continue
# Regenerate dist/ files
@sephraim
sephraim / buy_now.html.erb
Last active April 14, 2025 17:46
[Rails button_to / link_to params] Pass query params using link_to or hidden params using button_to
<!-- Pass hidden params to the button_to -->
<%= button_to "Buy Now", stripe_embedded_checkout_path, params: { price_id: price.id }, method: :get, data: { turbo: false } %>
<!-- Pass query params to the link_to -->
<%= link_to "Buy Now", stripe_embedded_checkout_path(price_id: price.id), method: :get, data: { turbo: false } %>
<!-- both methods allow you to access params[:price_id] in the controller -->
@sephraim
sephraim / run.sh
Last active March 18, 2025 21:07
[Run your app in Docker without docker-compose] ssh into your app's bash terminal
NAME=my-app-name && docker build -t $NAME -f .devcontainer/docker/Dockerfile . && docker run -it --rm $NAME bash
@sephraim
sephraim / dbfg.sh
Created March 12, 2025 22:45
[Kill all running docker containers & reclaim space]
alias dbfg="docker rm -f \$(docker ps -aq); docker system prune -f"
@sephraim
sephraim / sync-branches.sh
Created February 19, 2025 09:56
[Sync master (main) / develop branches in git]
# NOTE: THE FOLLOWING IS FOR *NON-FORKED* REPOS ONLY.
# "origin" WILL REFER TO THE *MAIN* REPO, NOT A FORK.
# AND THERE IS NO "upstream".
# Prep...
git fetch origin
# DEVELOP
git checkout develop
git pull --rebase origin develop # (1.) pull in latest changes from remote "develop"