Skip to content

Instantly share code, notes, and snippets.

View nfreear's full-sized avatar

Nick Freear nfreear

View GitHub Profile
@nfreear
nfreear / dev8d-utils.js
Created February 9, 2012 09:35
Javascript utility functions, for Dev8D workshop, by Juliette Culver | http://data.dev8d.org/2012/programme/event/CS21
/**
* Javascript create function - safe use of 'new'.
* By Juliette Culver.
*/
function create(parent) {
f = function();
f.prototype = parent;
a = new f();
return a;
}
@nfreear
nfreear / html5shim-els.js.html
Created February 9, 2012 12:05
HTML5 shim - minimal/elements only, by Remy sharp and others | http://code.google.com/p/html5shim/
<!DOCTYPE html> <title>*HTML5 shim - minimal/ elements only</title>
<!--[if lt IE 9]>
<script>
// http://html5shim.googlecode.com/svn/trunk/html5-els.js
// For discussion and comments, see: http://remysharp.com/2009/01/07/html5-enabling-script/ (credit to @jdalton for minif)
/*@cc_on'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary subline time video'
.replace(/\w+/g,function(n){document.createElement(n)});alert('html5shim-els')@*/
</script>
<![endif]-->
@nfreear
nfreear / drupal-common-inc.php
Created February 22, 2012 15:56
Drupal 6.24+ OU proxy fix: drupal_http_request() function, lines 452-644 / nfreear / IET-at-OU
function drupal_http_request($url, $headers = array(), $method = 'GET', $data = NULL, $retry = 3, $timeout = 30.0) {
global $db_prefix;
$result = new stdClass();
// Parse the URL and make sure we can handle the schema.
$uri = parse_url($url);
if ($uri == FALSE) {
$result->error = 'unable to parse URL';
@nfreear
nfreear / drupal-oembedcore.admin.inc.php
Created February 22, 2012 16:19
Fix oEmbed core_provider_save/delete, for Drupal 6(.24) - specify 'cache' table / nfreear/ IET-at-OU.
/**
* Enable a default provider.
*/
function oembedcore_enable_provider($provider) {
if (!is_object($provider)) {
$provider = oembedcore_provider_load($provider);
}
ctools_include('export');
ctools_export_set_status('oembedcore_provider', $provider->name, FALSE);
cache_clear_all('oembedcore:providers', 'cache'); //NDF $table='cache' is mandatory.
@nfreear
nfreear / drupal-theme-template.php
Created February 23, 2012 11:25
Drupal 6.x theme hack: remove the 3rd party oEmbed consumer/client stylesheet (Garland theme) / nfreear / IET-at-OU
/**
* Override or insert PHPTemplate variables into the templates.
*/
function phptemplate_preprocess_page(&$vars) {
$vars['tabs2'] = menu_secondary_local_tasks();
// Hook into color.module
if (module_exists('color')) {
_color_page_alter($vars);
}
@nfreear
nfreear / drupal-content-hack-uptime.php
Created February 24, 2012 09:59
Drupal 6.x content hack - Uptime responder (solutiongrove). Prevent Cron emails.
<?php
// Uptime responder.
/*
Prevent Cron emails, eg.
From: Cron Daemon <***@***st.net>
Subject: Cron <h***@***> wget -O - -q -t 1 http://path/to/cron
http://drupal.org/node/553430
@nfreear
nfreear / ispot-embed.css
Created March 9, 2012 15:02
iSpot: Example styles for iSpot embeds. Copyright 2012 The Open University | http://ispot.org.uk
/*
* Example styles for iSpot embeds.
* Copyright 2012 The Open University.
*/
/* HTML page styles.
*/
body{
font:.8em sans-serif;
background:#fcfcfc;
@nfreear
nfreear / onlineaspect-josh-fraser-postmessage.js
Created March 19, 2012 11:40
Backwards compatible window.postMessage(), by Josh Fraser, 15 January 2010 | http://onlineaspect.com/uploads/postmessage/postmessage.js
/*
* a backwards compatable implementation of postMessage
* by Josh Fraser (joshfraser.com)
* released under the Apache 2.0 license.
*
* this code was adapted from Ben Alman's jQuery postMessage code found at:
* http://benalman.com/projects/jquery-postmessage-plugin/
*
* other inspiration was taken from Luke Shepard's code for Facebook Connect:
* http://github.com/facebook/connect-js/blob/master/src/core/xd.js
@nfreear
nfreear / ispot-map-embed-postmessage.html
Created March 22, 2012 12:13
Example of using HTML5 postMessage: listen for 'map_dialog_open' events from iSpot map embeds, implements an overlay effect.
<!doctype html><meta charset=utf-8/><title>*iSpot map embeds / postMessage / overlay</title>
<!-- Include example style sheet, see #ispot-overlay. -->
<link rel="stylesheet" href="http://ispot-approval.open.ac.uk/sites/all/modules/custom/ispot_oembed/assets/ispot-embed.css" />
<div id="ispot-overlay"></div>
<!-- Add a map embed. -->
@nfreear
nfreear / ouplayer-ouvle-colors.css
Created April 3, 2012 11:01
OU player / OUVLE colours / via LTS-media corporate (public copy)
@charset "UTF-8";
/* CSS Document */
/* Background Colours*/
.default_blue {
background-color: rgb(41,110,143);
}
.orange {