22/07/2017

The archive contains older posts which may no longer reflect my current views.

# In reply to: 21/07/2017, 22:52...

Periods are now excluded from hashtags but double quotes are being particularly stubborn.

I hate preg_replace patterns.

4 comments: click to read or leave your own Comments

# When talking about making things idiot proof a common response is "never underestimate the ingenuity of idiots."

Once again, I feel like a bit of an idiot.

It suddenly dawned on me why my preg_replace function was ignoring double quotes: WordPress uses curly or 'smart' quotes whereas I was checking for straight quotes.

🤦‍♂️

It may not be typographically correct or as aesthetically pleasing but I have, for the time being, told WordPress to only display straight quotes by using the following:

remove_filter('the_content', 'wptexturize');

Hashtags are now working as expected.

#

Liked: Dismantling – nahumck.me...

Tim makes an interesting point about using native iOS functionality instead of third party apps.

I'd never considered using subscriptions in Safari instead of an RSS reader. As I post likes by running a workflow from within Safari this makes a good degree of sense, especially with my talk of an integrated solution.

#

Liked: 2017-07-22 18:12:03 – micro.blog updates...

Jonathan has changed his blog to use relative times/dates so posts say something like "An hour ago" instead of the post time.

This intrigued me and I wondered if I could do it for the last update time on the Today page.

A quick search revealed the human_time_diff() function which compares two times supplied in Unix format and displays the difference in an human readable format, hence the name of the function.

Only the first time is required as the function will use the current time as the comparator by default.

I already get the time of the most recent post in Unix format using strtotime() so it's a simple switch.

Now, the only question is: do I pull the trigger on the change?

# The Costa lawyers are going to have a field day!

# It's not exactly A/B testing but I've stuck in a rand() function so that the Today page randomly shows either the actual time of last update or the (approximate) time since last update.

I'm not sure which I prefer.