Skip to content

Instantly share code, notes, and snippets.

View pezholio's full-sized avatar

Stuart Harrison pezholio

  • Birmingham / London
View GitHub Profile
VirtualBox VM 5.0.2 r102096 darwin.amd64 (Aug 13 2015 18:38:03) release log
00:00:00.025706 Log opened 2015-08-18T16:00:27.890079000Z
00:00:00.025708 Build Type: release
00:00:00.025724 OS Product: Darwin
00:00:00.025729 OS Release: 14.4.0
00:00:00.025734 OS Version: Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64
00:00:00.025841 DMI Product Name: MacBookPro9,2
00:00:00.025893 DMI Product Version: 1.0
00:00:00.025901 Host RAM: 8192MB total, 2411MB available
00:00:00.025903 Executable: /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless
<?php
function ernest_marples($postcode) {
$postcode = str_replace(" ", "", $postcode);
$url = "http://www.uk-postcodes.com/postcode/". urlencode($postcode) .".csv"; // Build the URL
$file = file_get_contents($url);
if (strpos($file, "html") === FALSE) { // Some error checking - if the file contains html, then we've been redirected to the homepage and something has gone wrong
@pezholio
pezholio / planningalerts_widget.php
Created April 28, 2010 10:56
Planning Alerts Widget - Provides a widget showing the latest planning applications around a given postcode area. Based on Philip John's Opening Times Widget (http://philipjohn.co.uk/category/plugins/opening-times/)
<?php
/*
Plugin Name: Planning Alerts Widget
Plugin URI: http://www.pezholio.co.uk
Description: Provides a widget showing the latest planning applications around a given postcode area. Based on Philip John's Opening Times Widget (http://philipjohn.co.uk/category/plugins/opening-times/)
Author: Stuart Harrison
Version: 0.11b
Author URI: http://www.pezholio.co.uk
*/
/* This program is free software; you can redistribute it and/or modify
@pezholio
pezholio / councillors.php
Created May 24, 2010 15:52
An example project using Lichfield District Council open data to show a user's councillors and ward
<?php
// Two Custom functions to parse XML from external feeds. The first one is used to return an associative array from an XML document, and the second one gets the data via CURL and returns the array. The rest is up to you!!
function xml2array($contents, $get_attributes=1) {
if(!$contents) return array();
if(!function_exists('xml_parser_create')) {
//print "'xml_parser_create()' function not found!";
return array();
@pezholio
pezholio / ga.php
Created August 11, 2010 15:58
A (slightly hacky) script to return the page title, url and number of pageviews from the Google Analytics API as a tab-separated CSV file. No guarantee that it'll work, but worked for me!
<?php
/* A (slightly hacky) script to return the page title, url and number of pageviews from the Google Analytics API as a tab-separated CSV file. No guarantee that it'll work, but worked for me! */
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"analytics.csv\"");
function xml2array($contents, $get_attributes=1) {
if(!$contents) return array();
if(!function_exists('xml_parser_create')) {
@pezholio
pezholio / fatc.html
Created October 19, 2010 12:03 — forked from tomger/fatc.html
<!DOCTYPE html>
<html><head>
<title>Fork-A-Twitter-Client</title>
<!--
Basic OniApollo/StratifiedJS Twitter Client application scaffold.
See http://fatc.onilabs.com/
THIS FILE IS IN THE PUBLIC DOMAIN.
@pezholio
pezholio / TileLayer.Bing.js
Created October 14, 2011 09:18 — forked from pagameba/TileLayer.Bing.js
Leaflet Bing layer
L.TileLayer.Bing = L.TileLayer.extend({
supportedTypes: ['Road', 'Aerial', 'AerialWithLabels'],
attributionTemplate: '<span style="display:inline-block">' +
'<a target="_blank" href="http://www.bing.com/maps/">' +
'<img src="{logo}" /></a><br><span>{copyrights}' +
'<a style="white-space: nowrap" target="_blank" '+
'href="http://www.microsoft.com/maps/product/terms.html">' +
'Terms of Use</a></span></span>',
@pezholio
pezholio / GAAAAAAAH!
Created December 9, 2011 09:21
GAAAAAAAH!
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/Stuart/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectdb() in -lpq... yes
@pezholio
pezholio / gist:1669948
Created January 24, 2012 12:16
RVM / Passenger weirdness
stuart-harrisons-macbook-pro:~ Stuart$ sudo gem install passenger
Password:
Successfully installed passenger-3.0.11
1 gem installed
Installing ri documentation for passenger-3.0.11...
Installing RDoc documentation for passenger-3.0.11...
stuart-harrisons-macbook-pro:~ Stuart$ sudo passenger-install-apache2-module
/Users/Stuart/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find passenger (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
from /Users/Stuart/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /Users/Stuart/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
/Users/Stuart/.rbenv/versions/1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:314:in `bin_path': can't find gem rails ([">= 0"]) with executable rails (Gem::GemNotFoundException)
from /usr/bin/rails:19:in `<main>'