Spain’s Finalists

Spain 1 - 0 Germany 2008
Spain 1 - 0aet Netherlands 2010
Spain 4 - 0 Italy 2012
Casillas (F F F)
Sergio Ramos (F F F)
Xavi (F F F)
Iniesta (F F* t87)
Alonso (f63 t87 F)
Farbregas (t63 f87 t75)
Torres (t78* f105 f75*)
Capdevila (F F _)
Puyol (F F _)
Busquets (_ F F)
Silva (t56 S t59*)
Fabregas (_ f87 t75)
Pedrito (_ t60 f59)
Arbeloa (S S F)
Marchena (F S _)
Senna (F _ _)
Pique (_ _ F)
Alba (_ _ F*)
Jesus Navas (_ f60 S)
Santi Cazorla (f66 _ S)
Mata (_ S f87*)
Villa (S t105 _)
Guiza (f78 _ _)
Reina (S S S)
Albiol (S S S)
Llorente (_ S S)
Javi Martinez (_ S S)
Juanfran (_ _ S)
Negredo (_ _ S)
Palop (S _ _)
Fernando Navarro (S _ _)
Sergio Garcia (S _ _)
Juanito (S _ _)
De la Red (S _ _)
Valdes (_ S _)

F = full match played, t = subbed off, f = subbed on, S = unused substitute, _ = not present, * = goal.

Using Mustache with FuelPHP

  • Add ‘parser’ to the ‘packages’ array in config.php
  • Name your views ‘foo.mustache’ not ‘foo.php’
  • Call your views with View::forge(‘bar/foo.mustache’) not View::forge(‘bar/foo’)
  • Still call your ViewModels with ViewModel::forge(‘bar/foo’) but add a public $_view = ‘bar/foo.mustache’ variable to your ViewModel

Twitter Bootstrap

I’m a little late to the party on this one I think but I have to give a shout out to Twitter Bootstrap.

Multiverse Screenshot

A project at work used it and it looked nice so I had a play for a side project I am working on. It was really easy to get the side project looking good and feeling usable with my so-so design skills thanks to the framework. Great stuff.

strip_tags is just awful

strip_tags is possibly the worst of all the builtin PHP functions. It doesn’t even remotely do what it says. It is absolutely useless on user input because it strips everything from the first “<” it sees to the next “>” so if your input is

"<p>I <3 Monkeys</p>

its output is


!!! And what else are you stripping tags from apart from user input? Avoid.

badmatch CRASH REPORT couch_file:init/1

I got this Couch DB crash running a view:

Error: EXIT


This is caused by “language”: “JavaScript” in the view. It must be “javascript” (case sensitive) or omitted for javascript queries. Not sure where I copied that from.

Loading Dependencies in PhantomJS without using a Webserver

We run our javascript QUnit unit tests “headless” using the amazing PhantomJS. Originally our dependency loading code was overridden as a no-op within the tests. But that began to cause problems and require tests to run in a certain order and other Bad Things.

Within the WebPage environment in PhantomJS it is possible to form <script> tags and load code from a webserver, but not so easy to keep things running entirely from the commandline. Especially when you also want to run the same tests in the browser in QA (not everything that passes in WebKit passes in IE8, as if you didn’t know that).

To make this work I overrode the dependency loading code so that it just stores strings of dependencies in a variable xq.required. Then:


// Load the tests.
for (var i = 0; i < sources.length; i++) {[i]);

// Now that we've loaded some tests we will have registered some
// dependencies (with require calls in the page).  Load the
// dependencies, recursively if they themselves have dependencies.


// Loop over the known dependencies and load them.  Also load any of their
// dependencies and so on, turtles all the way down.
_.loadDependencies = function(page) {
    var loaded = [];
    while (true) {
        // Ask the page what dependencies it has
        toLoad = page.evaluate(function () {
            return window.xq.required; // executes inside page, not phantom

        // Diff toLoad with loaded to get stuff that hasn't been loaded yet
        toLoad = toLoad.filter(function(i) { return (loaded.indexOf(i) < 0); });
        if (toLoad.length === 0) {

        // Load the stuff that hasn't been loaded yet
        for (var i = 0; i < toLoad.length; i++) {
            _.loadByNamespace(page, toLoad[i]);
        // Add what we just loaded to the list of stuff we've already loaded
        loaded = loaded.concat(toLoad);

Where loadByNamespace converts its second argument to a file path and loads it into the first argument with page.injectJs.

Now all the dependencies are loaded we can run the tests and report the results.

Google Street View Image API

One of the many cool APIs available through Google Maps is the Street View Image API. This gives you full access to the images taken by the Google vans that photograph streets.

The API is dead simple in the basic form, just a URL:

(The required “sensor” param tells Google if you are getting the location from a GPS device or similar – probably a privacy thing.)

The images are not necessarily spectacular brochure shots:,+London&sensor=false

Unspectacular Street View of Parliament Square, London

but it is a useful API for any app that is displaying places that a user might not have been to before. It can both give them an idea of it’s the kind of place they are looking for and help them find it. Here’s an example, a local keycutters:,+Victoria+Station,+London&sensor=false

Street View of Timpson key cutters at Victoria Station, London

CoffeeScript Web App Framework

I’ve been working on a CoffeeScript web app in RailwayJS which is a rails-alike framework for nodejs built on top of Express.

One cool thing about RailwayJS is that you can write most of your code (not views?) in CoffeeScript instead of JavaScript. The generators, etc. will do the right thing if you give them the --coffee switch.

RailwayJS also has ORM with MongoDB and localization baked in.

#!/usr/bin/env coffee

app = module.exports = require('railway').createServer()

if not module.parent
  port = process.env.PORT or 3000
  app.listen port
  console.log "Railway server listening on port %d within %s environment", port, app.settings.env

App Screen Shot