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

WordPress Filter Early Return Pattern

Last updated on August 31, 2021 by Sal Ferrarello

A common programming pattern when using WordPress filters is the early return pattern (also know as the “short-circuit” pattern). This pattern is useful when you want to allow a filter to override a value that is “expensive” to calculate.

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

Filed Under: Computing, Dev Tips, Draft, Programming Tagged With: WordPress, WordPress Filter

QMK 65% Esc and Backtick

Last updated on August 24, 2021 by Sal Ferrarello

When I downsized to a 65% keyboard I knew I was giving up function keys and a number pad but what caught me off-guard was the loss of my backtick (a.k.a. grave accent(`)) key. Because my keyboard runs QMK firmware, I’ve tried a number of modifications.

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

Filed Under: Computing, Draft, Solution Tagged With: qmk

QMK Drop Alt

Last updated on August 14, 2021 by Sal Ferrarello

I replaced my keyboard of many years with a Drop.com Alt keyboard. This keyboard uses QMK firmware, which allows you to create modified firmware and run it on your keyboard. These are my notes about how I built a copy of the firmware locally and pushed it to my keyboard.

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

Filed Under: Computing, Draft Tagged With: keyboard, qmk

zsh alias with fallback

Last updated on August 12, 2021 by Sal Ferrarello

In my zsh configuration I define a number of aliases. One particular zsh alias maps gl to my custom Git alias “git lg”. Since my zsh configuration is portable, I want to define a fallback if my custom Git alias does not exist on the machine.

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

Filed Under: Dev Tips, Draft, Programming, Solution Tagged With: zsh

Manually Trigger WordPress Heartbeat from Browser

Last updated on August 2, 2021 by Sal Ferrarello

When developing code related to the WordPress heartbeat, it is frustrating to make your code changes and then wait for the next heartbeat to occur. You can trigger the WordPress heartbeat in the browser manually to eliminate this delay.

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

Filed Under: Computing, Dev Tips, Draft, Programming, Solution Tagged With: WordPress, WordPress Heartbeat

What are PHP Namespaces?

Last updated on January 28, 2023 by Sal Ferrarello

When two functions (or classes) have the same name, it triggers a fatal error in PHP. Namespaces are used to avoid these naming collisions.

Filed Under: Computing, Programming Tagged With: namespace

WordPress Hooks and PHP Namespaces

Last updated on July 22, 2021 by Sal Ferrarello

While PHP namespaces allow you to refer to a function in file without using the fully qualified name, there is a catch when adding a WordPress hook or filter. The PHP __NAMESPACE__ magic constant can be helpful in this situation.

Filed Under: Dev Tips, Programming, Recommendations Tagged With: PHP, WordPress, WordPress Filter

Shampoo Bottle Protocol

Last updated on May 15, 2021 by Sal Ferrarello

One day I realized that the last 10% of the shampoo bottle lasted at least as long as the first 90%. I suspected this was because most of the time I was using too much shampoo but as I neared the end of the bottle I used a more appropriate amount. How could I trick my brain to always use the appropriate amount?

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

Filed Under: Draft, Happy, Solution Tagged With: lifehack

Brady Bunch Achievement

Last updated on July 8, 2021 by Sal Ferrarello

The “Brady Bunch Achievement” is when you have exactly nine people on a video call. When this happens, viewing all participants in a grid looks like the intro to the Brady Bunch.

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

Filed Under: Draft, Funny

Remove newline at end of text file

Last updated on February 10, 2022 by Sal Ferrarello

Sometimes when I’m working with files in Git, I find myself with a change in a file that says “No newline at end of file”. This occurs when my editor adds the missing newline at the end of the file. While you should have a newline at the end of the file, you may have a reason for not wanting to add this change. In that case, you can remove the newline from the end of the file.

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

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

  • «Previous Page
  • Go to page 1
  • Interim pages omitted …
  • Go to page 3
  • Go to page 4
  • Go to page 5
  • Go to page 6
  • Go to page 7
  • Interim pages omitted …
  • Go to page 40
  • Next Page»

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