Subscribe via RSS

Sidebar Helper for CakePHP

Note: This article has been submitted to the Bakery, but it’s been pending approval for a couple of weeks now and I got bored of waiting, so I’m just posting it here. I will update with the Bakery link if/when it goes live!

Despite having written several bits of potentially re-usable code for my Cake apps over the years, this is the one that’s really stuck out with potential to become popular and useful to the masses. It’s been in action for years on Simon’s FFL, and more recently on Covers.FM, but a recent question on Stack Overflow prompted me to polish it up, document it and release it. It also gave me a chance to try out GitHub, which seems to be what the cool kids are using to publish/share/collabrote on code these days.

In a nutshell, the Sidebar helper allows you to insert a sidebar with multiple content blocks into your layouts, similar to Wordpress widgets.

So, without further ado, here’s the GitHub link:

http://github.com/ebotunes/cakephp/blob/a08a2011246a256fa1425bf07c98ff064436d527/helpers/sidebar.php

The code comments contain examples of usage to get you started. Technically speaking this doesn’t need to be used as a Side Bar – it ultimately depends on how you render the layout with CSS.

[I'll hopefully update this post with screenshots and sample CSS at some point when I've got more time. Just wanted to get the main code out there for now]

Flickr archive link for Last.FM events (Greasemonkey)

A quick script I just put together for Last.FM event pages. In the photos section, under the machine tag instructions, this script will add a link to go straight to your Flickr archive for the day of the event.

Last.FM event page

The link URL contains ‘me’ instead of your Flickr username, but Flickr will automatically redirect you if you’re logged in! Even if your not it will take you to the login page and then automatically still take you to the right page.

Flickr Archive Page

Assuming you have several photos from that day, you’ll see a link to ‘Edit this page as a batch’ in Organizr, which will allow you to quickly and easily add the machine tag for the event.

Install now from UserScripts.org

1000 songs

The Guardian newspaper recently published a list of ‘1000 songs everyone must hear’. Imagine my delight when I discovered that they’d also published the raw data as part of their new Data Store service. Naturally my first thought was some kind of Last.FM mashup.

I thought it would be great if you could match up the list with your Last.FM listening history to find out exactly how many of the songs in the list you had and had not listened to. Unfortunately I couldn’t quite get the API to bend that way. Maybe I’ll find a way eventually.

So I settled for just pulling in listener stats for each song (so that you can sort and see what is the most listened to song etc.). And as an extra touch, hooking up to LyricWiki to get the song lyrics, which for the most part, are available.

http://1000songs.ebotunes.com

One thing to keep in mind is that Last.FM users only cover a particular demographic (mostly young, tech-savvy people),  so don’t be offended if the results are skewed in that direction!

Let me know what you think, and leave any suggestions and feedback on the UserVoice page.

Thanks to PHP Last.FM API and the LyricWiki API.

1000 songs on ProgrammableWeb

Flickr Map Monkey (updated)

A quick post to say that the FlickrMapMonkey script (yes that’s what it’s called now) has been updated. Version 0.3 is now available over on the UserScripts page. According to the stats there it’s now been installed 310 times, which is pretty cool. Of course there’s no guarantee that all those people are still using it, but hey.

Upon it’s initial release, the script generated some healthy discussion over on the Flickr Hacks forum. This brought up a couple of issues, which I haven’t had the chance to investigate yet. The main one seems to be an internationalisation issue, which I guess would be tricky for me to test quickly so that’s kinda put me off trying.

Resurrecting TubeMappr

After the success of getting Gig Taggr up and running, I thought I’d dust off another little tool I worked on ages ago. Tube Mappr was a very basic experiment for me to explore the Flickr and Google Maps APIs. It’s not ‘useful’ in the way that Gig Taggr is, nor is it anywhere near as complex, but it was fun at the time.

I came across map data for the London Underground over at Wikimedia Commons one day, and, coupled with the (then) recent full-scale rollout of geotagging support on Flickr, I had the idea for Tube Mappr. It’s a simple script that plots Tube stations on a map, and clicking on a station displays random Flickr photos tagged with the name of the station.

The curious thing which I’m now realising is that Tube Mappr makes absolutely no use of the Flickr geo stuff (neither data nor functionality), but i’m pretty sure it was part of the motive.

http://tubemappr.ebotunes.com