Skip to content

Instantly share code, notes, and snippets.

View kaisershahid's full-sized avatar

kaiser kaisershahid

  • acmedinotech
  • pittsburgh, pa
View GitHub Profile
@kaisershahid
kaisershahid / fetch_things.rb
Created May 16, 2018 18:52
if you have a webpage you want to grab multiple resources from
#!/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
@kaisershahid
kaisershahid / gist:041624530a107f0787cebc48d205ea0f
Last active December 7, 2017 00:22
Ruby: 42-line barebones unit testing suite
$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)