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
<!-- A stab at how the first pie chart on http://teethgrinder.co.uk/open-flash-chart/gallery-pie.php could be created from a table --> | |
<table summary="Microsoft's Internet Explorer appears to be dying, with the Wii taking 20% of market"> | |
<caption>Pie Chart</caption> | |
<tr> | |
<td>Wii</td> | |
<td>15%</td> | |
</tr> | |
<tr> | |
<td>Opera</td> | |
<td>12%</td> |
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
const MICROBLOG_STATUS_MAXLEN = 140; | |
CmdUtils.CreateCommand({ | |
name: "dent", | |
takes: {status: noun_arb_text}, | |
author: {name: "Daniel Haran, barely modifying work by Blair McBride as seen in the Ubiquity tutorial", homepage: "http://danielharan.com/"}, | |
license: "MPL", | |
preview: function(previewBlock, statusText) { |
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 'mechanize' | |
postal_codes = File.open("postal_codes.txt").read.split("\n") | |
# randomize to make the pattern slightly harder to see in logs | |
postal_codes = postal_codes.sort_by {|e| rand(10_000)} | |
@agent = WWW::Mechanize.new do |a| | |
a.user_agent_alias = 'Mac Safari' | |
a.max_history = 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 'mechanize' | |
postal_codes = File.open("postal_codes.txt").read.split("\n") | |
# randomize to make the pattern slightly harder to see in logs | |
postal_codes = postal_codes.sort_by {|e| rand(10_000)} | |
@agent = WWW::Mechanize.new do |a| | |
a.user_agent_alias = 'Mac Safari' | |
a.max_history = 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 'mechanize' | |
postal_codes = File.open("postal_codes.txt").read.split("\n") | |
# randomize to make the pattern slightly harder to see in logs | |
postal_codes = postal_codes.sort_by {|e| rand(10_000)} | |
def filename(postcode) | |
postcode.sub(' ', '') | |
end |
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
Dir.glob("*").each do |pc| | |
File.open(pc).read =~ /aug08cpocRidingProfileTitle>([^<]*)</ | |
puts "#{pc},#{$1}" | |
end |
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
class Hash | |
def +(other) | |
(self.keys + other.keys).uniq.each do |key| | |
if [self[key], other[key]].all? | |
if self[key].is_a?(Hash) | |
self[key] += other[key] | |
elsif self[key].respond_to?(:+) | |
self[key] += other[key] | |
else | |
raise "values for #{key} were neither hashes or summable" |
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
class String | |
def starts_with?(str) | |
self =~ /#{str}/ | |
end | |
end | |
names_to_edid = File.open(File.dirname(__FILE__) + '/edid_names').read.split("\n"). | |
collect {|line| edid, pruid, edname = line.split("|"); [edname.strip, edid.strip]}. | |
inject({}) {|hash,e| hash[e.first] = e.last; hash } | |
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
class KeyValuePairs | |
# Take a file like: | |
# G6C=24034 | |
# H9E=24049 | |
# and create the hash you'd expect | |
# if instead you have something like: | |
# G6C=24034,24036 | |
# H9E=24049 | |
# then use a block to do the specify the value | |
def self.hash(file_name, separator='=', &block) |
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 'mechanize' | |
postal_codes = File.open("postal_codes.txt").read.split("\n") | |
# randomize to make the pattern slightly harder to see in logs | |
postal_codes = postal_codes.sort_by {|e| rand(10_000)} | |
def filename(postcode) | |
postcode.sub(' ', '') | |
end |
OlderNewer