Bits and bytes of code

Bytes is my collection of short-form posts, tips, and things I learn as I build software.

Managing z-indexing can be a real pain at times. Dealing with many different elements, all of which have to specify different z-index values to ensure the correct stacking context. Thankfully, the CSS isolation property can help remove some of the hassle.

GBrowse on main branch

The :GBrowse command from vim-fugitive is a great way to open a file or range in the configured upstream provider (e.g. GitHub). However, it's usually a pain since it opens in the current branch, which is often not pushed.

Vim Scratch Buffers

I use scratch (unnamed) buffers in Vim a fair bit when working with text manipulation for content not saved to a file such as editing some JSON, or building some commands to run from a list of ids. Knowing how to easily create scratch buffers is a must have when using Vim.

Using localStorage is great for storing simple user preferences such as the expanded/collapsed state of a sidebar, or the light/dark theme preference for the site. An often overlooked but useful feature of localStorage is the ability to sync changes between open tabs.

Vim Jump to Column

In Vim, sometimes I want to jump to a specific column. For example, jumping to column 80 (the print width of the file), to do some reformatting. Thankfully, this is pretty easy using the | command.

I frequently switch between Git branches inside of Neovim using Telescope, but it's also handy to be able to switch branches using fuzzy find when outside of Neovim.

I've started to use git worktrees more lately but one of the pain points I had was that they don't copied ignored files such as .env files. I found I was able to improve this workflow by adding a post-checkout hook.

I use shell aliases quite heavily to simplify common CLI commands. However, one of my biggest pain points when using them is they didn't work as well in certain complex commands.

I recently came across a Raycast extension that allows you to play/pause music from YouTube music while it's running in your browser. After exploring how it worked internally given I was a bit astonished it is even possible, I found that it's all just using AppleScript.

I was writing a script the other day that I needed to accept some optional arguments. I found that I could use the getopt command, but turns out the simple approach was cleaner in the end.

Previous page