• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (deprecated)
You are here: Home / Archives for Solution

Solution

Sort Git Tags by Version

Last updated on October 21, 2023 by Sal Ferrarello

By default Git displays tags in alphabetical order, but we can configure Git to sort tags by their version numbers.

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

Git matched multiple remote tracking branches

Last updated on October 24, 2023 by Sal Ferrarello

Sometimes when I run a command like “git checkout chore/fix-typo”, I get an error message like “fatal: ‘chore/fix-typo’ matched multiple (2) remote tracking branches”. We can configure Git to avoid this error by defaulting to the “origin” remote.

Filed Under: Computing, Dev Tips, Solution Tagged With: Git, gitconfig

cd in script without polluting previous directory

Last updated on October 5, 2023 by Sal Ferrarello

I wanted to write a shell alias to get the Git status of a specific directory (~/code/projectx). How could I change directories without polluting the previous directory? (so ‘cd -‘ still works as it did before I ran my alias)

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

Notify When Command Completes

Last updated on October 10, 2023 by Sal Ferrarello

When I kick off a long running process on a project (e.g. “npm install”) and I shift my focus somewhere else, I often get absorbed in my other task and don’t return to the original process as soon as I wanted to. I’ve addressed this in the past by setting a timer to remind me to come back and check. More recently, I’ve started adding a audio notification to tell me when the task is completed.

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

Find dependency in composer.json with jq

Last updated on October 1, 2023 by Sal Ferrarello

Sometimes I need the full Composer dependency name but I only know part of it. For example, I may know Block X-ray Attributes is a Composer dependency but I don’t remember the full package name. While I could open the composer.json file and find the dependency, I can also leverage jq to do the work for me.

Filed Under: Computing, Dev Tips, Solution Tagged With: command line, jq, jq composer, zsh

WordPress Multisite Skip Confirmation Email

Last updated on August 1, 2023 by Sal Ferrarello

When creating a new user on WordPress multisite there is a “Skip Confirmation Email” checkbox that is unchecked by default. This unchecked box results in a user being added to a temporary “signups list” when they are added to the site. The user is not fully added to the site until they complete the confirmation steps in the email they receive. For many sites, it is preferable to check this “Skip Confirmation Email” when adding a user. With some code you can set this checkbox to default to checked.

Filed Under: Programming, Solution Tagged With: WordPress, WordPress Multisite, WordPress Plugin

How to Close and Re-Open WordPress Gutenberg Sidebar

Last updated on June 30, 2023 by Sal Ferrarello

The sidebar gets a lot of use in the WordPress Block Editor, a.k.a. Gutenberg, but I found myself in a situation where I needed to programmatically close the sidebar and then re-open it later. This is how I did it.

Filed Under: Dev Tips, Programming, Solution Tagged With: Gutenberg, JavaScript, WordPress

Get Last Modified Value of a WordPress Post

Last updated on June 19, 2023 by Sal Ferrarello

When reading an article online, I find it helpful to know when the article was last updated. Not all blogs display the last updated value however even when the last updated value is not displayed, the value is accessible via the WordPress REST API. This is how I retrieve the last modified value from the WordPress REST API.

Filed Under: Computing, Dev Tips, Programming, Solution Tagged With: JSON, REST API, web browser, WordPress

Pretty Print JSON URL

Last updated on May 20, 2023 by Sal Ferrarello

I work a lot with JSON endpoints and having a browser extension to pretty print the JSON response is invaluable. However, sometimes I’m using a different machine (or guiding someone on their machine) and rather than asking them to install a browser extension, I use this trick. If the user is on the page displaying the JSON response, running this command in the browser console will pretty print the response await (await fetch(window.location.href)).json().

Filed Under: Dev Tips, Solution Tagged With: JSON, REST API, web browser

Git delete remote branch

Last updated on April 25, 2023 by Sal Ferrarello

This is the command I run when I want to delete a branch named “chore/fix-typo” from the default remote (which is named “origin”): git push origin –delete chore/fix-typo

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

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 16
  • Next Page»

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