Skip to content

Instantly share code, notes, and snippets.

View psychemedia's full-sized avatar

Tony Hirst psychemedia

View GitHub Profile
@psychemedia
psychemedia / wp-openlearn-feeder.php
Created May 10, 2009 17:39
Wordpress Daily Feeds Plugin
<?php
/*
Plugin Name: WP OpenLearnFeeder
Plugin URI: http://www.isotoma.com
Description: Drip feed RSS of static posts by configurable periods.
Version: 1.02
Author: Isotoma
Author URI: http://www.isotoma.com
*/
/* Copyright 2008 Isotoma (www.isotoma.com)
function datagovuk_education(id,typ) {
var ret=""; var args=""
switch (typ) {
case 'name':
/* prefix sch-ont: <http://education.data.gov.uk/def/school/>
SELECT ?name WHERE {
?school a sch-ont:School;
sch-ont:uniqueReferenceNumber 135503;
sch-ont:establishmentName ?name.
} ORDER BY DESC(?date) LIMIT 5
function gds_education_unitable(sheet,uni,typ){
var key="phNtm3LmDZEM6HUHUnVkPaA";
var gid='0';//'Overall Institutional Table';
var category="C"; //(Average) Guardian teaching score
switch (sheet){
case "full":
gid='0';//'Overall Institutional Table';
break;
case "chemEng":
gid='16';//'15 Chem Eng';
@psychemedia
psychemedia / Cross Domain JQuery with Yahoo Pipes Proxy
Created February 27, 2010 12:20
Make cross domain JSON calls in JQuery for JSON feeds that don't support JSONP. Using a Yahoo Pipe as a proxy, pass in the URI for your JSON feed from any domain, and grab the Pipe's JSONP proxy output into your page.
function cross_domain_JSON_call(url){
// url points to a JSON feed
// eg http://openlylocal.com/committees.json?council_id=111
url="http://pipes.yahoo.com/ouseful/jsonproxy?url="+encodeURIComponent(url)+"&_render=json&_callback=?";
$.getJSON(
url,
function(data) { myCallbackFunction(data.value.items[0]); }
)
// Yahoo Pipes documentation project
// Exploring ways of documenting user created Yahoo Pipes
// This bookmarklet is intended to be used in conjunction with a tool such as Firebug
// It renders a description of the pipe to the browser console.
// USAGE: Run the bookmarklet whilst editing a Yahoo Pipe
javascript:(function(){var p=editor.pipe.definition;var d="-----";var c=console.log;c(d+d);var q='';var r;var w;var m=p.modules;c('MODULES');for (var i=0;i < m.length;i++){q=m[i];c(q.id+" ("+q.type+")");c("--PROPERTIES: "+q.conf.toSource())};c("CONNECTIONS");m=p.wires;for (i=0;i<m.length;i++){q=m[i].src;r=m[i].tgt;c("FROM "+q.moduleid+" ("+q.id+") TO "+r.moduleid+" ("+r.id+")")};c(d+d)})()
// A second attempt at a bookmarklet that describes the contents of a Yahoo Pipe
// Run the bookmarklet over a Yahoo Pipe in edit mode
// A description of the pipe will be posted in the browser console
// Works in firefox with Firebug - not tested elsewhere
javascript:(function(){var p=editor.pipe.definition;var d="-----";var c=console.log;c(d+d);var q,r,w,i,m,k,K,ok,oK,x,X;var ins=[];var outs=[];var b=[];var o=[];c("CONNECTIONS");m=p.wires;for (i=0;i<m.length;i++){c(d);q=m[i].src;r=m[i].tgt;K=r.moduleid;k=q.moduleid;if (!(b[K])){b[K]={};b[K].conns=[]};if (!(b[k])){b[k]={};b[k].conns=[]};ok={};oK={};x=b[k].conns.length;X=b[K].conns.length;b[k].conns[x]={};b[k].conns[x].o=q.id;b[k].conns[x].typ="out";b[k].conns[x].t=K;b[k].conns[x].T=r.id;b[K].conns[X]={};b[K].conns[X].typ="in";b[K].conns[X].f=k;b[K].conns[X].F=q.id;b[K].conns[X].i=r.id;c("FROM "+k+" ("+q.id+") TO "+K+" ("+r.id+")");}c(d+d); m=p.modules;c('MODULES');for (i=0;i<m.length;i++){q=m[i];if (!(b[q.id]))b[q.id]=[];b[q.id].n=q.type};for (i=0;i < m.le
digraph vizProcess{
rankdir = LR;
Acquire -> Process;
Process -> Filter;
Filter ->Mine;
Mine->Represent;
Represent->Refine;
Refine->Interact;
graph vizProcess{
Acquire -- Process;
Acquire -- Filter;
Acquire -- Mine;
Acquire -- Represent;
Acquire -- Refine;
Acquire -- Interact;
Process -- Filter;
Process -- Mine;
import simplejson
import csv
import os
f2=open(f2name,"wb+")
csv_file = csv.writer(f2)
csv_file.writerow([ "file",'timestamp','NGPSLatitude','NGPSLongitude', 'NGear','nEngine','rThrottlePedal','pBrakeF','gLat','gLong','sLap','vCar' ])
##data is in files named numerically
for i in range(1268569874,1268574286):
import simplejson
import csv
import os
f2=open(f2name,"wb+")
csv_file = csv.writer(f2)
csv_file.writerow([ "file",'timestamp','NGPSLatitude','NGPSLongitude', 'NGear','nEngine','rThrottlePedal','pBrakeF','gLat','gLong','sLap','vCar' ])
##data is in files named numerically
for i in range(1268569874,1268574286):