Skip to content

Instantly share code, notes, and snippets.

View cjheath's full-sized avatar

Clifford Heath cjheath

View GitHub Profile
grammar PivotalStories
rule stories
story*
end
rule story
story_label:one_line "\n" feature*
end
rule feature
#! /usr/bin/env ruby
require 'rubygems'
require 'hpricot'
require 'open-uri'
site = "http://www.tomwaits.com"
download_to = "/Users/gus/tmp/"
index = open(site + "/songs/") { |f| Hpricot(f) }
@cjheath
cjheath / draginthebox.html
Created July 16, 2011 01:23 — forked from dusadrian/draginthebox.html
Shows how to restrict Raphael's dragging to a specified region, in this case, the canvas
<html>
<head>
<script src="https://github.com/DmitryBaranovskiy/raphael/raw/master/raphael-min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
</head>
<body>
<div id="container" style="position:absolute;left:25%;right:25%;top:25%;bottom:25%;background-color:#DDD">
</div>
<script type='text/javascript'>
var container = $('#container');
@cjheath
cjheath / svg2raphael.rb
Created May 10, 2012 23:27
THE WORLD'S FINEST AND MOST ACCURATE SVG TO RAPHAËL CONVERTER
#!/usr/bin/env ruby
#
# 1304046900 CONVERTS SVG TO RAPHAËL
require "nokogiri"
file = "world.svg"
tree = Nokogiri::XML(File.open(file))
str =
s = 's';
def s.foo; 'foo'; end
eigen = (class << s; self; end)
def eigen.foo; 'bar'; end # This is unused
def String.foo; 'baz'; end
module Frob
def foo