This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require '4store-ruby' | |
require 'rdf/redland' | |
store = FourStore::Store.new 'https://server11.incubator.bbc.co.uk/sparql/', { | |
'certificate' => 'cert.ca', | |
'key' => 'cert.pem', | |
'soft-limit' => "-1" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'rqommend' | |
DEFAULT_OPTIONS = { | |
'certificate' => 'cert.ca', | |
'key' => 'cert.pem' | |
} | |
DEFAULT_ENDPOINT = 'https://server11.incubator.bbc.co.uk/sparql/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name /music recs | |
// @namespace http://moustaki.org/music-recs/ | |
// @description Injects recommendations within /music | |
// @include http://www.bbc.co.uk/music/artists/* | |
// ==/UserScript== | |
var url = window.location.href; | |
artist_guid = url.split("artists\/")[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name /music recs | |
// @namespace http://moustaki.org/music-recs/ | |
// @description Injects recommendations within /music | |
// @include http://www.bbc.co.uk/music/artists/* | |
// ==/UserScript== | |
var url = window.location.href; | |
artist_guid = url.split("artists\/")[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from pyechonest import artist, config | |
from ircbot import SingleServerIRCBot | |
from irclib import nm_to_n, nm_to_h, irc_lower, ip_numstr_to_quad, ip_quad_to_numstr | |
from random import * | |
import urllib2 | |
import socket | |
import twitter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RDFMapper | |
class << self | |
def to_rdf(obj) | |
mapping = obj.rdf_mapping | |
uri = obj.uri | |
data = "<#{uri}>\n" unless mapping.empty? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RDFMapper | |
class << self | |
def to_rdf(obj) | |
mapping = obj.rdf_mapping | |
uri = obj.uri | |
data = "<#{uri}>\n" unless mapping.empty? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require '4store-ruby' | |
query = ARGV[0] | |
class Array; def sum; inject( nil ) { |sum,x| sum ? sum+x : x }; end; end | |
class Array; def mean; sum / size; end; end | |
store = FourStore::Store.new 'http://kakapo.dcs.qmul.ac.uk/bbc/programmes/sparql/' | |
results = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- use_module(library('http/http_open')). | |
prove((A, B)) :- | |
A, B. | |
prove((A; B)) :- | |
A; B. | |
prove(H) :- | |
clause(H, B), !, | |
prove(B). | |
prove(Head) :- load(Head), Head. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When /^I am on (.+)$/ do |page_name| | |
begin | |
visit path_to(page_name) | |
rescue Mechanize::ResponseCodeError => e | |
$stderr.puts "ERROR: " + e.page.root.xpath('//pre[@id="message"]/text()').to_s | |
raise Mechanize::ResponseCodeError.new e.page | |
end | |
end |
OlderNewer