Skip to content

Instantly share code, notes, and snippets.

View nfreear's full-sized avatar

Nick Freear nfreear

View GitHub Profile
@reservationlive
reservationlive / Ruby script to convert CSV to YAML
Created February 25, 2009 15:23
Textmate/Ruby script to convert CSV to YAML
#!/usr/bin/env ruby
#
# Originally written by http://redartisan.com/tags/csv
# Added and minor changes by Gavin Laking
# Remove ::Reader and it shall work in Ruby 1.9.x
#
# "id","name","mime_type","extensions","icon_url"
# "1","unknown","unknown/unknown","||","/images/icon/file_unknown.gif"
# "2","image/tiff","image/tiff","|tiff|tif|","/images/icon/blank.png"
#

yUML Test On GitHub

yUML is a simple tool for embedding UML diagrams in wikis and blogs without needing any UML or diagramming tools.

Here's an idea of how it could be used in your repository readme.markdown or wiki.

View the RAW source to see how images are made.

Example

@nithinbekal
nithinbekal / wc10.html
Created February 9, 2010 17:11
JavaScript Countdown timer
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>World Cup 2010 Countdown Timer</title>
</head>
<body>
<div id="worldcup_countdown_time"> </div>
<script src="wc10.js" type="text/javascript" charset="utf-8"></script>
@remy
remy / gist:350433
Created March 31, 2010 14:58
Storage polyfill
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
// ==UserScript==
// @name YoutubeProtectionRemover
// @include http://www.youtube.com/*
// @description Removes lame protection on YouTube
// @copyright 2010, Snap
// ==/UserScript==
window.opera.addEventListener(
'BeforeScript',
function (ev){
@remy
remy / details.js
Created April 18, 2010 22:28
Add <details> support - includes stylesheet
/**
* Note that this script is intended to be included at the *end* of the document, before </body>
*/
(function (window, document) {
if ('open' in document.createElement('details')) return;
// made global by myself to be reused elsewhere
var addEvent = (function () {
if (document.addEventListener) {
return function (el, type, fn) {
details, summary {display: block;}
details:not([open]) > :not(summary) {display: none;}
import urllib2
import json
import re
response = urllib2.urlopen('http://api.embed.ly/v1/api/services/python')
services = json.loads(response.read())
url = 'http://soundcloud.com/dociler/dociler-futuricity'
for service in services:
for regex in service['regex']:
if re.match(regex, url):
print "Matched %s to %s" % (url, service['displayname'])
(function($) {
$.fn.oembed = function(url, options, callback) {
options = $.extend(true, $.fn.oembed.defaults, options);
return this.each(function() {
var container = $(this),
resourceURL = (url != null) ? url : container.attr("href"),
provider;
@scribu
scribu / gist:636827
Created October 20, 2010 17:02
WP_Query Debug
<?php
function wp_query_debug() {
global $wp, $wp_query;
echo '<pre>';
var_dump($wp->matched_rule);
print_r($wp_query);
echo '</pre>';
}