Skip to content

Instantly share code, notes, and snippets.

@unruthless
unruthless / CSS for <sup> and <sub>
Created May 26, 2010 01:31
CSS for <sub> and <sup>
sub, sup {
/* Specified in % so that the sup/sup is the
right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't
interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position
<!DOCTYPE html>
<html>
<head>
<title>Modest Maps JS</title>
<script type="text/javascript">
/*!
* Modest Maps JS v0.13.2X (fork for gist)
* http://modestmaps.com/
*
@johnhunter
johnhunter / jQuery.reduce.js
Created October 27, 2010 19:48
jQuery.reduce - a jQuery plugin for functional programming
/*
jQuery.reduce - a jQuery plugin for functional programming
@author John Hunter
created 2010-09-17
use: $.reduce(arr, fnReduce, valueInitial);
fnReduce is called with arguments: [valueInitial, value, i, arr]
reduce will never be jQuery core - its not prototype :p (http://dev.jquery.com/ticket/1886)
*/
(function ($) {
@nichtich
nichtich / skosc2csv.pl
Created January 7, 2011 14:54
Create CSV overview of a SKOS classification
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
=head1 NAME
skosc2csv.pl - Create CSV overview of a SKOS classification
@schacon
schacon / gist:942899
Created April 26, 2011 19:19
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@igorw
igorw / composer.json
Created December 12, 2011 10:42 — forked from beberlei/composer.json
A minimal Symfony Components Framework
{
"require": {
"php": ">=5.3.2",
"symfony/http-kernel": "2.1-dev",
"symfony/routing": "2.1-dev"
}
}
@richard-jones
richard-jones / medline2json.py
Created February 17, 2012 11:08
Convert Medline XML to JSON for indexing in Elastic Search
from lxml import etree
import json
outfile = open("kv.json", "w+")
outfile.write("[\n")
tree = etree.parse("medline11n0001.xml")
elem = tree.getroot()
# for every item in the xml file, parse it and create a JSON object of it
@hubgit
hubgit / bbc-radio-latest-episode-xspf.php
Created April 13, 2012 09:47
Redirect to the XSPF for the latest episode of a BBC Radio series
<?php
$series = sprintf('http://www.bbc.co.uk/programmes/%s/episodes/player.json', $_GET['series']);
$data = json_decode(file_get_contents($series));
$episode = sprintf('http://www.bbc.co.uk/programmes/%s/segments.xspf', $data->episodes[0]->programme->pid);
header('Location: ' . $episode);
@hubgit
hubgit / Http.php
Created May 20, 2012 14:49
PHP HTTP Client
<?php
class HTTP {
function curl_init($url) {
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_VERBOSE, DEBUG);
return $curl;
}
@hubgit
hubgit / github-init.sh
Created May 30, 2012 11:50
GitHub repository initialisation, for an existing directory
#! /bin/sh
GITHUB_REPO="oai-html" # edit this
GITHUB_USER="hubgit" # edit this
git init
git remote add origin git@github.com:$GITHUB_USER/$GITHUB_REPO.git
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git pull