As a developer, I spend a lot of time going back and forth between the command line and Jira tickets. I realized that since I always include the Jira ticket identifier (e.g. `sf-123`) in the branch name (in a reliable position), I could write a git alias to open the corresponding URL. This is how I implemented this behavior.
Solution
Add WordPress Posts Column
Code to add a custom column to the WP Admin Posts listing page.
JavaScript get Date in YYYYMMDD Format
Recently, I was working in JavaScript and I need to transform a date into the format YYYYMMDD, this is how I did it.
How to Add a Non-Breaking Space
A non-breaking space has a unicode value of `U+00A0` (a normal space has a unicode value of `U+0020`). This is how I add this character.
Add Gutenberg JavaScript Filter
WordPress PHP filters allow you make a value modifiable from outside of your code. With the WordPress Block Editor (a.k.a. Gutenberg), you can now do the same thing in JavaScript.
Revert to Old Version of WordPress Core
These are the two ways I have used to rollback WordPress to an earlier version. Using either technique, you should make a backup copy of your files and your database first!
Check WP_DEBUG
Recently I was talking to another developer about how to detect ‘WP_DEBUG’ being set on a WordPress installation. Here is the code I use.
Add a Blank line at the Beginning of Command Line Prompt
While there are many ways to customization your command line prompt, one that can help readability is adding a blank line at the beginning of each prompt.
WordPress Gutenberg Functional Component useState
When creating a block for the WordPress block editor (a.k.a. Gutenberg), I find that most of the documentation is for class components. However, with React hooks we can use functional components. When you need to import ‘useState’ from React, you can do it as follows in a WordPress block.
Vim JSON Format
Vim allows you to run all (or some) of your content through an external program. In this case, we want to use Python to format (i.e. pretty print) our JSON with ‘python -m json.tool’. We an also setup a Vim user defined command to reduce typing (and make it easier to remember).