Skip to content

Instantly share code, notes, and snippets.

View ashmckenzie's full-sized avatar

Ash McKenzie ashmckenzie

View GitHub Profile
@ashmckenzie
ashmckenzie / gist:738504
Created December 13, 2010 00:39
Equilibrium index code
require 'rubygems'
require 'test/unit'
def equi(list)
left = 0
right = list.inject { |x, y| x + y }
equilibrium_indicies = []
list.each_with_index do |val, i|
right -= val
# Used to graph results from autobench
#
# Usage: ruby autobench_grapher.rb result_from_autobench.tsv
#
# This will generate three svg & png graphs
require "rubygems"
require "scruffy"
require 'csv'
require 'yaml'
#!/usr/bin/env ruby
require 'pp'
DEBUG = false
stats = {}
stats['Firefox-3.5'] = { :hits => 0, :percent => 0 }
stats['Firefox-3.0'] = { :hits => 0, :percent => 0 }
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'hpricot'
s = %q{<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><html><body><input type="text" name="test" value="\" /><div id="footer"></div></body></html>}
selector = '#footer'
inner_html = 'testing'