When making a HubSpot API call to update a date picker field, I’m getting a response with “response code 400”, “error INVALID_DATE”, and the message includes “not midnight!”. This is why I’m getting this error and how I fixed this call.
Dev Tips
WordPress Database Prefix
By default all of the WordPress database tables will start with the prefix “wp_” (e.g. wp_users, wp_posts, etc.). Because this is the default value, you’ll often hear the tables referred to (and written about) using the “wp_” prefix. Let’s look at how and why this prefix is modified.
Conditionally Add Bootstrap Table Responsive Class
While working on another post, I had some very large tables and I wanted to use Bootstrap Responsive Tables by adding the .table-responsive class but only in the situation where the table is too wide. This is the code I used.
grep without exclude-dir
How to use grep to search for a word in a file while excluding certain directories is easy with the “–exclude-directory” option, but even when this option is not available we can still get the same results with some command line magic.
How to Set Older WordPress Posts to Draft with WP CLI
In one of the slack channels I follow, the question came up on how to set WordPress posts older than a certain date to “draft” status using with WP CLI. I was surprised by how difficult I found this task and wanted to document my solution.
Composer fail required PHP version
You can tell composer to install dependencies as if you’re using a specific version of PHP. This can be helpful if you’re running composer outside of your virtual machine (and your virtual machine has the correct PHP version but your host machine does not).
PSR-2 EditorConfig
The editorconfig project allows you to standardize general coding standards on a project.
I was working on a project where I needed to follow the PHP PSR-2 standard. This is the .editorconfig file I used.
Git Previous Branch
When working with Git on the command line, I spend a lot of time switching back and forth between two branches. Even with Git tab completion, it is a lot of typing. However Git has a shortcut for the previous branch, a single dash (-).
WordPress JavaScript async defer
When loading JavaScript on a webpage with the “script” tag, there are additional attributes you can add to tell the browser how and when to load the JavaScript (‘async’ and ‘defer’). In WordPress, there is not a native way to add these attributes but this code snippet does the trick.
Get a File from Another Git Branch
I was working on one Git branch and I wanted a file from another branch. Using git checkout, we can do this.