Development Blog

SVN Not Working After High Sierra 10.13 Upgrade

Panic Coda 2’s Source Control was blank, and Terminal > svn status returned

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

Via StackExchange

Open Terminal, and run the following:
xcode-select --install

Fixed terminal and made the SVC panel of Coda 2 work again after quitting and relaunching the app.

Microsoft Edge Not Showing CSS Base64 SVG Images

I use encoded SVG images for my icons in web pages. I’ll probably continue to do it until http/2 is mainstream. I thought it was pretty standard, but of course, Microsoft Edge has a problem with them.

I get my icons from flaticon.com, which has a beautiful feature allowing to choose color+size then gives you the CSS for the icon.

Microsoft Edge doesn’t show them. Go figure. Trying to find out why, it turns out Edge doesn’t like utf8;

..url(data:image/svg+xml;utf8;base64,PD94S4...wvnPgo=);

Simply removing that gets the SVG icons working.

Thank you once again Microsoft for making the internet harder.

Create New WordPress Post on Image Upload, Setting as Featured Image

I used to manually do everything for the Images section of my site. Adding an image would involve: save photo after editing, renaming it, uploading, creating new post, setting the title and date, assigning the featured image as the upload, then setting the category to Images so it’s added to the page. So, 8 steps, usually done over-and-over again to a dozen or so images in a batch. We’re talking over 96 steps to get a batch of images online – it took a bit of time, and was slightly demotivating, becoming a chore instead of a hobby.

Able to scratch my own itch – I came up with a way to automate everything. Instead of 96 steps, I now publish an entire batch of images in just 2 simple steps. Yes Two. Too. To. You read correctly, just 2! How’d I do it?

After editing the photos in Lightroom, I use Lightroom’s file-rename feature during bulk export that automatically sets the filename to the images meta timestamp, so YYYYMMDD.jpg.

I then use the following script tapping into the add_attachment hook during bulk upload that does the other 7 steps for each image. Everything in just 1 step, for the entire bulk.

So, all I have to do after exporting from Lightroom, is drag-and-drop upload to the site.

WordPress Dynamically Write Number of Years Since With Shortcode

As the lengthy title says, the follow simple script allows you to use a shortcode to dynamically output the number of years since a specified date. I wrote this for my own bio, which I used to have to update the number of years since the start of my employment once a year. The simple’r solution would be to write, “blah blah blah since 2010” instead of “blah blah blah for 7 years“. But hey, why not.

Simple usage is []years since="2010-07-01"[] would output something like 7.