Making Flickr badges work with https

Following Eric’s instructions, I switched to https. I then had to get rid of the pesky mixed-content warnings. Most were pretty straightforward — I had a few JavaScript files and images that used absolute URLs and HTTP; I switched them to use HTTPS. However, my flickr badge presented a problem. (It’s bothering some other […]

How to solve Facebook’s error 1366027

Sometimes, Facebook silently fails when you upload a new profile picture. After clicking Upload Picture, message indicating “your changes have been saved” is displayed. However, the new picture does not appear on your profile. Further, the string success=0&errornum=1366027 is appended to the URL. This error means the image you uploaded is too small. You need […]

HOWTO count words in JavaScript

Here is a handy JavaScript function for counting words: String.prototype.countWords = function(value) { // remove html tags var cleanedText = this.replace(/< .[^]*?>/g, ' ') // remove numbers and punctuation .replace(/[–—.(),;:!?%#$‘’“”'"_+=\/\-]*/g, '') // remove/coalesce space chars .replace(/(&nbsp;|&#160;|[ ])+/gi, ' '); // don't split "" into words, as you'll get 1 ([""]) if (cleanedText === "") { […]

HOWTO setup multistage deployment with Capistrano

These instructions are outdated. They were written for Capistrano 2.x. As of March 2016, Capistrano 3.x is current. When I wrote about deploying PHP sites with Capistrano, step 6 was a bit of a throwaway — hey, here's a quick hack for handling multistage deployment. I'd been using variants of that technique for quite some […]

How to display tweets on a WordPress page

There are a lot of ways to display your tweets on your blog. Many are complicated and ugly. Sometimes, you hit Twitter’s API rate limit. Most require the client to perform additional work. I made a very simple WordPress plugin to handle this. All you do is stick [get_latest_tweets username=”me”] where you want the tweets […]