productivity


Nov. 29, 2025

ブックマークレットで URL パラメータを削除する

What I Learned URL を他人と共有する際、クエリパラメータやフラグメントが含まれていると URL が長くなり、余計な情報が含まれてしまう。いつもは手動で削除していたが、ブックマークレットと Chrome の検索エンジン機能を組み合わせることで、キーボードショートカットだけで URL をクリーンにできるようになった。 Details 背景 Web 閲覧中、URL に ?utm_source=... や #section などのパラメータが付いていることがよくある。これらを削除してシンプルな URL にしたい場面は多いが、手動で削除するのは手間である。ブックマークレットを Chrome の検索エンジン機能に登録することで、キーボード操作だけで瞬時にクリーンな URL に変換できる。 1. ブックマークレットコード 以下の JavaScript コードを使用する: 1javascript:void(location.href=location.href.split('?')[0].split('#')[0]); このコードは現在の URL から ? と # 以降を削除し、ページをリロードする。 2. Chrome での設定手順 2-1. 検索エンジン設定画面を開く Chrome のアドレスバーに以下を入力: chrome://settings/searchEngines 2-2. カスタム検索エンジンを追加 「サイト内検索」セクションの横にある「追加」ボタンをクリック 以下の通りに入力: 検索エンジン: URLクリーン(任意の名前でOK) ショートカット: c(z や del など打ちやすい文字でOK) URL: 上記のブックマークレットコードを貼り付け 「追加」をクリック 3. 使い方 Web 閲覧中に URL のパラメータを削除したい場合: Cmd + L(Mac)/ Ctrl + L(Windows)でアドレスバーを選択 設定したショートカットキー(例:c)を入力 Enter キーを押す ページがリロードされ、URL がクリーンな状態になる。

Nov. 5, 2025

Git Rebase Interactive

What I Learned Git’s interactive rebase (git rebase -i) is a powerful tool for cleaning up commit history before pushing changes. It allows you to reorder, squash, edit, or remove commits. Details Interactive rebase opens an editor with a list of commits and commands: 1git rebase -i HEAD~3 Available commands: pick - use commit as-is reword - change commit message edit - stop for amending squash - combine with previous commit fixup - like squash but discard commit message drop - remove commit Example workflow: