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
#!/usr/bin/ruby | |
# simple downloader: pass a URL and a pattern of resources to fetch. can also just list resources | |
require 'nokogiri' | |
require 'open-uri' | |
require 'uri' | |
def print_usage | |
puts "Usage: fetch_things.rb [action=...] [pattern=... pattern=...] [save_to=~/Downloads] URL\n" | |
puts "Actions: view, fetch" | |
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
$assertions = 0 | |
$assertions_pass = 0 | |
def assert_true(cond, msg) | |
$assertions += 1 | |
raise Exception.new("asset_true: failed: #{msg}") | |
$assertions_pass += 1 | |
end | |
def assert_equals(exp, act, msg) |