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.
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.
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.
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.
When two functions (or classes) have the same name, it triggers a fatal error in PHP. Namespaces are used to avoid these naming collisions.
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.
Semantic versioning (SemVer) is a standard for defining the version numbers. A version number consists of three numbers separated by periods (X.Y.Z). The type of change being introduced (e.g. a new feature or a change that breaks backwards compatibility) determines which numbers are incremented.
A Git commit, represented by a single building block in my Git mental model, is a frozen moment in time for your project (sometimes referred to as a snapshot). Along with this snapshot Git stores metadata about the commit (e.g. the author of the commit). Each commit has a unique identifier called the commit hash (a.k.a. SHA), a 40 character long alphanumeric string that is often abbreviated to just the first seven characters (e.g. “2b3a38b”).
These are the rules I follow when writing Git commit messages. I’ve found these serve me well and are compatible with most projects I work on (if a project has a specific set of rules for writing Git commit messages, those would override any rules I’ve outlined here).
When visualizing Git branches, I find it easier to think of them as stacks of building blocks rather than the traditional Directed Acyclic Graph (DAG) visualizations.