Skip to content

Instantly share code, notes, and snippets.

View malclocke's full-sized avatar

Malcolm Locke malclocke

  • Christchurch, New Zealand
View GitHub Profile
@malclocke
malclocke / stopfinder.rb
Created December 6, 2010 21:06
Get info on ChurChur Metro buses within a lat/long boundary
require 'rubygems'
require 'net/http'
require 'json'
require 'nokogiri'
require 'open-uri'
# Lat long boundaries
#
# Around the casino
#xmin=172.6299226284027
@malclocke
malclocke / adminpass.drush.inc
Created August 18, 2010 01:07
A drush command to reset a Drupal site admin password, either permanently or temporarily
<?php
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#include <sys/inotify.h>
#include <stdio.h>
#include <errno.h>
/* size of the event structure, not counting name */
#define EVENT_SIZE (sizeof (struct inotify_event))
/* reasonable guess as to size of 1024 events */
#define BUF_LEN (1024 * (EVENT_SIZE + 16))
<?php
/**
* Create your custom stylesheets based on the taxonomy tid in
* $theme_dir/css/taxonomy/$tid.css
*/
function THEME_preprocess_node(&$vars, $hook) {
if ($terms = taxonomy_node_get_terms($vars->['node'])) {
foreach ($terms as $term) {
$stylesheet = '/css/taxonomy/'. $term->tid .'.css';
if (file_exists(dirname(__FILE__) . $stylesheet)) {