• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (deprecated)

Add Element to Array if It Does Not Already Exist with jq

Last updated on March 24, 2026 by Sal Ferrarello

This is how I use jq to conditionally add an element to an array only if it doesn’t exist there already. In other words, add an element to an array only if it doesn’t create a duplicate in the array. This is particularly helpful when I’m scripting a JSON transformation and want to make it idempotent.

Filed Under: Computing, Dev Tips, Programming, Solution Tagged With: jq

Show Git Commit Message without Indentation

Last updated on January 27, 2026 by Sal Ferrarello

Sometimes I want a Git commit message without the leading indentation added by “git show” (for example, if I want to copy it and paste it somewhere else). This command gives me this output.

Filed Under: Dev Tips, Solution Tagged With: Git, git alias, gitconfig

Write Slack Posts in Markdown

Last updated on January 14, 2026 by Sal Ferrarello

By default, Slack provides you with a Formatting toolbar and a WYSIWYG editor. I’m a big fan of writing in Markdown rather than WYSIWYG and use it everywhere I can. Fortunately, I can configure Slack to write in Markdown (or more accurately Slack’s subset of Markdown).

Filed Under: Computing, Recommendations Tagged With: slack

Filter Meta in WordPress Gutenberg Block Editor

Last updated on January 10, 2026 by Sal Ferrarello

I work with WordPress sites that have lots of meta fields exposed through the REST API. Within Gutenberg, I’m often checking those values by querying the “meta” attribute in the data. Sometimes the larger number of meta fields makes it difficult to find the specific fields I’m interested in. To make my life easier, I’ve put together a code snippet that filters the keys in the meta object that is returned.

Filed Under: Computing, Dev Tips, Solution Tagged With: Gutenberg, WordPress

Vim Increment Number With Dash

Last updated on November 4, 2025 by Sal Ferrarello

In Neovim, I’m a big fan of CTRL-a to increment a number (and CTRL-x to decrement a number), however when I have dash before the number (e.g. “sprint-23”), this is interpreted as a negative number so incrementing the value
goes to 22 (because -22 is one greater than -23). We can fix this.

Filed Under: Computing, Solution Tagged With: neovim, vim

Turn Off a Specific Linter in Neovim Ale

Last updated on October 28, 2025 by Sal Ferrarello

I recently needed to disable one of the built-in linters in the ALE (Asynchronous Lint Engine) Vim plugin in my Neovim configuration. This is the line that disables the PHP linter “phpstan” in Neovim.

Filed Under: Solution Tagged With: neovim, vimplugin

xargs: warning: options –max-args and –replace/-I/-i are mutually exclusive, ignoring previous –max-args value

Last updated on August 1, 2025 by Sal Ferrarello

This threw me for a loop so I’m writing this down to help others (and likely me in the future). I swear I’ve used “xargs” with both “-I” and “–max-args” in the past but now I’m getting this warning and things are behaving improperly. It turns out there are two version of xargs, (FreeBSD xargs and GNU xargs). FreeBSD xargs is installed on BSD systems (including MacOS) and GNU xargs is found on on Linux systems. This warning (and the incorrect result you also get) indicate you’re running GNU xargs.

Filed Under: Computing, Dev Tips, Solution Tagged With: command line, xargs

Git Editor Roulette

Last updated on July 4, 2025 by Sal Ferrarello

A question came up about setting the Git editor to a bash function, which I could not figure out. I was, however, able to set the Git editor to a bash script. As a proof of concept, here is a bash script to randomly choose an editor (nano or vim) when using Git.

Filed Under: Computing, Dev Tips, Solution Tagged With: command line, Git, git log

Git Squash Back To

Last updated on July 31, 2025 by Sal Ferrarello

Often in my work, I’ll create a number of commits before I craft my correct solution. Having these missteps in separate commits doesn’t provide any real value and adds noise so I’ll often squash these commits into a single commit. Historically, I’ve used a Git interactive rebase to do this but as I was reminded on Mastodon, it seems like there should be a quicker way, so I’ve created a Git alias, “git squashbackto”, to do this.

Filed Under: Computing, Dev Tips, Solution Tagged With: command line, Git, git alias, rebase, vim

Mac Maximize Window with Alfred

Last updated on June 22, 2025 by Sal Ferrarello

One of the things that frustrates me about Apple Macs (macOS) is clicking the green sizing button in the upper-left hand corner makes a window full screen. I almost never want to go full screen. What I typically want is to maximize the window (fill up the entire area while leaving the toolbar visible). This can be done by holding down “Option” while you click the green button (but I find I mess that up often enough that I wanted another solution).

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Computing, Dev Tips, Draft, Solution Tagged With: Alfred

  • Page 1
  • Page 2
  • Page 3
  • Interim pages omitted …
  • Page 45
  • Next Page»

Copyright © 2026 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in