We have a client who needs to review a very complex form created in Gravity Forms. The form has many fields, and to make things worse the labels displayed to the user and the labels displayed to the administrator when someone submits the form are different. Because Gravity Forms has an XML export, it occurred to me that I should be able to create some transformational XSL to turn that XML export file into a human readable description of the form. Continue reading
I’ve recently switched to development in two Vagrant virtual machines (VMs), one VM running Nginx and one running Apache. This means that are two locations I might need to open files from, with two sets of directories representing the document roots of my various development sites. Eventually I got bored of using the terminal to “subl ~/Vagrants/nginx/www/wordpress-whatever/” and decided to write an Alfred Workflow. Now I just trigger Alfred, hit “v client“, and Alfred shows me all my projects in directories with “client” in the name. Continue reading
Whenever I dump a database out to a file, I always like to have it named sensibly: example-20130718-1523.mysqldump. Having a consistent name for the database dumps helps keep them in order, and helps me to clear up unneeded files at the end of jobs. Continue reading
pbcopy terminal command, which adds “stuff” to the clipboard to be pasted later, is really useful. For example, to download some webpage and put the HTML source in the clipboard:
curl -s http://example.com/ | pbcopy
Here’s a WordPress example; want to get some fresh API salts and keys for a
wp-config.php? Try this:
curl -s https://api.wordpress.org/secret-key/1.1/salt/ | pbcopy
Want to be notified when the download and copy are complete? Add the
say command, like this:
curl -s https://api.wordpress.org/secret-key/1.1/salt/ | pbcopy; say 'Ready to paste';
I use DTerm, which is an excellent little “popup terminal” which inherits the current context, and these commands are super handy here.
A project at work needed me to write a UI to find and delete duplicate attachments on a single post, from a client’s WordPress website. Creating a couple of queries where I could look over each post in turn, and check a hash for each file attached, then spot the duplicate hashes wasn’t too hard. Where I was struggling was making the rows with the duplicates stand out visually, file hashes, e.g.
bc38d8d8993b5e9f4617576d2adeb875, are just not that easy to distinguish from other hashes, e.g.
dbe0256fe35b88ebd4e4e433604b7487… see the problem?
What I wanted was some way of mapping a file hash to a colour, or something strongly visual. Which is when it occurred to me; Gravatar could do this! Continue reading
I’m currently running Apple Mail with the unified inbox option, so I can connect to my old company email address as well as my Code for the People address and see everything in one place. There’s settings in Mail to allow you to set the default sending address, and when you reply to a mail it should pick the correct account. Trouble was, I kept noticing that my mail was going out under the new account when I was sure I’d specified the new account to be the sending address. Infuriating and embarrassing.
The alarm in question looks like this:
The red light indicates a fault, which is why I’ve finally confronted my inability to remove it (hopefully your smoke alarm fault-free).
This approach was primarily devised for use with WP Engine staging sites, but will work in any situation where you have no access to Apache’s config and need to use a single .htaccess file for multiple domains (e.g. a multisite setup).
We’ve recently had a couple of projects hosted on WPEngine where we need to have a staging site protected by Basic Authentication so only authorised users can access it. Normally I would configure Basic Authentication in the Apache VirtualHost, but on WP Engine (for example) they handle all the server configuration for us, meaning we don’t have access to the Apache configuration. WPEngine also provide a Git push to deploy facility, which we tend to take advantage of because Version Control Rools, OK? Because all the web files are within Git version control, we are using the same .htaccess file for the developer, staging and live sites. (We could Git ignore the .htacess file, but I prefer to version control more, rather than less.)