kieranbarnes Independent PHP, WordPress & CubeCart Programmer

Caching TimThumb images in memory

Posted on February 26, 2012

Posted by kieran

TimThumb, properly configured & secured is a very useful tool for image manipulation. Amidst all it's old security flaws, the new version is pretty secure.

Sometimes it can be pretty slow though. By default it only caches images for 24 hours. Probably not long enough if you are just creating static thumbnails of larger images that don't change.

I'd recommend changing it to 31,556,926 seconds - one year.

WordPress Opengraph and Microdata Generation without a plugin

Posted on February 17, 2012

Posted by kieran

Its really useful to have Opengraph (Facebook) and Microdata (Twitter) information in your blog header.

The Facebook Opengraph and Schema.org microdata lets you optimize your blog much more better and helps search engines to index your website better to show rich snippet.

It also lets Facebook and Twitter users to share your blog with proper title, description, url and image.

There are loads of plugins available to do this, but why use a plugin when its only a few lines of code?

[Snippet] Matching hash tags in Twitter content

Posted on February 17, 2012

Posted by kieran

Here's a super simple way of matching hash tag content in a tweet.
Perhaps you want to store hash tags as WordPress tags? Or simply transform how they are displayed?

  1. preg_match_all('/#(\w+)/',$data->text,$hashtag_matches);
  2. print_r($hashtag_matches);

Where $data->text is your tweet string.

Easy.

Tagged as: No Comments

Tipping Point (Arts Council)

Posted on February 16, 2012

Posted by kieran

Date: February 2012 - Current http://www.tippingpoint.org.uk/Team: Developer (Myself), Project manager

  • Full theme WordPress theme build
  • Custom WordPress events management system
Tagged as: No Comments

Four4 (River Film Communication)

Posted on February 16, 2012

Posted by kieran

RiverFC 4Four
Date: December 2011 & February 2012
http://riverfc.com/four4/
Team: Developer (Myself), Designer

  • Website development
  • Custom “vote via Twitter” script.
  • Uses the Twitter Firehose streaming API to aggregate votes for each entry
  • Results dashboard to manage winners

[Snippet] Convert Twitter Date to MySQL Date

Posted on February 16, 2012

Posted by kieran

If you are pulling tweets from Twitter's Firehose streaming API or the search.atom/search.json APIs, you will be getting Twitter's really annoying non-standard date format.

To convert their date format into MySQL's date format for storing in a date column, try this;

  1. date('Y-m-d H:i:s', strtotime($tweet->updated));

Where $tweet->updated is your Twitter date (This example uses the search.atom & SimpleXML).

Or, do you store your dates as Unixtime?

  1. date('U', strtotime($tweet->updated));

You could also use gmdate to return the date & time in GMT. Rule Britannia!

Strictly Auto Tags Plugin & Custom Posts

Posted on February 6, 2012

Posted by kieran

The Strictly Auto Tags plugin for WordPress does a fantastic job at automatically tagging content so your authors don't have to. Most of the time it creates useful and usable tags with no intervention.

It's only downfall is it doesn't work with Custom Post Types.

No problems, its an easy fix hack.

Moving mod_pagespeed’s file-based cache into RAM

Posted on January 27, 2012

Posted by kieran

Google's mod_pagespeed does a great job at optimising web resources such as HTML, JS, CSS and even images.
I use it on a lot of customer production sites as a great partner to APC cache for super fast web sites.

I won't go into details on how it works, if you're  reading this, you already know!

mod_pagespeed caches resources to disk. If you are running on a heavily loaded server or a VPS, disk IO is a premium.
So we should really cache to memory, its faster, cheaper and easy to set up.

Neil Anthony Kitchens

Posted on January 26, 2012

Posted by kieran

Neil Anthony approached me in May of 2010, their brief was simple, create a site that reflected the class and high quality kitchens they designed and installed, make the site clear, crisp, informative, easy to navigate and most importnatly easy to update by the client. Iachieved all of these goals and the staff at NA who weren't particulalry PC literate regularly updat etheir site to reflect new product and special offers.

[Snippet] Setting the timezone for PHP 5.3

Posted on January 25, 2012

Posted by kieran

PHP 5.3 requires a time zone to be set if you do any kind of date processing.

Simply set this in your php.ini

  1. // London, England, Europe
  2. date.timezone = "Europe/London"
  3. date.default_latitude = 51.500181
  4. date.default_longitude = -0.12619
Page 2 of 3512345...102030...Last »