SublimeCodeIntel in Sublime Text 3

Update: Forget about SublimeCodeIntel and use the new CodeComplice package instead.

There is now a Sublime Text 3 compatible version of SublimeCodeIntel, thanks to the hard work of Germán M. Bravo (aka Kronuz). I had a job getting it to correctly index my project files though. I’m posting here what I did, in the hopes it’ll help someone else out.

Continue reading “SublimeCodeIntel in Sublime Text 3”

WordPress Contributors on a World Map

As a fun data visualisation experiment – and as a way to practice my new found interest in Node.js – I decided to plot on a map of the world all the people who contributed to the recent release of WordPress 3.6. The map can be seen further down, but first a brief description of how I went about it.

I decided to generate a GeoJSON file of the contributor’s locations so it can be displayed wherever and however the open GeoJSON format is supported, not least on GitHub which recently added support for automatic rendering of GeoJSON files.

Continue reading “WordPress Contributors on a World Map”

A History of WordPress Contributors

I thought I’d run some stats on WordPress contributors over the years. The only contributor stats I have are the ones published in each release announcement on wordpress.org, so I’ve put these stats together myself from those lists.

Unfortunately the release announcements have only listed the contributors since version 2.9 (June 2009). If anyone wants to get me the list of contributors for earlier versions I’ll happily update this post. It’d be interesting to see the numbers over the years.

Continue reading “A History of WordPress Contributors”

WordPress Plugin: Pocket Read It Later Links

Latest version: 1.0– Released 15/06/2012:

  • Initial release.

Description

This plugin allows you to display Pocket ‘Read It Later’ links next to each post on your blog. You can see an example on the Pocket blog. You can automatically insert the links adjacent to your blog posts or you can use the template tag to insert the links wherever you like.

Continue reading “WordPress Plugin: Pocket Read It Later Links”

Saving Post Meta Field Revisions in WordPress

If your plugin or theme uses custom post meta fields then you may want to store revisions to these fields when a post revision is saved. It’s easy to do.

For each of our meta fields, we’ll need to do three things:

  1. Store a revision of the meta field when a post is saved
  2. Revert to the correct revision of the meta field when a post is reverted
  3. Optionally, display the meta field on the revisions screen

Continue reading “Saving Post Meta Field Revisions in WordPress”

Access Your Desktop Development Environment from Your Mobile Device

It’s really easy to get an iPhone, iPad, or Android device to access a local web server running on your development machine. All you need is an HTTP proxy such as Charles Proxy running on your development machine. Once that’s running:

Make sure your device is connected to the same network as your development machine. Go into the Settings -> Wi-Fi menu and find the HTTP proxy settings. On Android, this means a long-press on your Wi-Fi network (Modify Settings, then Show advanced settings). On iOS this means pressing the (i) icon next to your Wi-Fi network.

Switch your proxy over to ‘Manual’ and enter your development environment machine’s network IP address (eg. 192.168.0.4) as the server, and 8888 as the port (Charles’ default port unless you’ve changed it).

Voila. All your HTTP traffic from your device will now route through your host machine (Charles will prompt you to allow access first) and you’ll have access to your local development server. Awesome!

Pro Tip: Are you still editing your hosts file in order to manage the host name mapping for sites on your development environment? Stop it. Just use the Tools -> DNS Spoofing menu in Charles and make life easier for yourself.

Basic Authentication with the WordPress HTTP API

Basic Authentication (or BasicAuth) is not natively handled with the WordPress HTTP API. This means when you’re using functions such as wp_remote_get() and wp_remote_post() there’s no immediately obvious way to send Basic Authentication headers with your request. It would be great to pass username and password parameters to these functions, but it’s not there.

Fear not though, it’s really easy. Here’s how:

$args = array(
  'headers' => array(
    'Authorization' => 'Basic ' . base64_encode( YOUR_USERNAME . ':' . YOUR_PASSWORD )
  )
);
wp_remote_request( $url, $args );

That’s it. The correct authentication headers will then be sent with your request (after you’ve replaced YOUR_USERNAME and YOUR_PASSWORD with the obvious).

I’d like to give a quick shout out to my favourite HTTP monitor Charles Proxy. I use Charles almost daily when dealing with server-side HTTP requests and AJAX requests and it makes life much easier. I love it.

WordPress Plugin: Feed Thumbnails

Latest version: 1.2– Released 04/07/2010
  • Bugfix for the Get The Image plugin integration.

Description

This plugin simply adds your post thumbnails to your feed as RSS enclosures. Nothing else to it. If you don’t use thumbnails or you don’t know what enclosures are or why you might want them, then this probably isn’t for you.

The plugin supports the Post Thumbnail feature built into WordPress and the Get The Image plugin by Justin Tadlock.

Installation

  1. Unzip the ZIP file and drop the folder straight into your wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. View your feed (you might need to do a hard refresh – ctrl+reload) and any posts that have a thumbnail defined will have an enclosure containing a link to the thumbnail.

Download

This plugin requires WordPress version 2.9 or later.

Version 1.2 ZIP file from downloads.wordpress.org

Any comments, questions, queries, suggestions, complaints, etc, please leave a comment!

Twitter Bookmarklet: View the Whole Conversation

Update: For those who aren’t aware, when Twitter was originally launched it had no concept of replies, threading, or viewing conversations. The functionality below was written in this era and now, of course, it’s redundant and no longer works.

Do you ever view a Twitter update (or a “tweet”) which is part of a conversation and wish there was an easy way to view the entire conversation?

It’s not easy to do. (We’re talking about the web interface here, it’s undoubtedly easy for those who use Twitter clients.) This is why I’ve written the Twitter Conversation Bookmarklet.

Installation

Drag the following link to your browser’s Bookmarks Toolbar:

[twitter conversation]

Usage

Simply press the bookmarklet whenever you’re on a Twitter status page that is part of a conversation, and the entire conversation will be magically loaded onto the page.

Example

The best way to see an example is just to install the bookmarklet and then hit it on a status page. An example status where it works well is this recent tweet by Damien Mulley which is part of a conversation.

Results of the Twitter conversation bookmarklet

Known Issues

  • Currently, the bookmarklet won’t return a conversation if you use it on the first tweet that is part of a conversation. It must be used on a tweet that is replying to another. This appears to be a limitation of the Twitter API but I am looking into ways to work around this.

Comments and bug reports appreciated.