Skip to content

Instantly share code, notes, and snippets.

View rudle's full-sized avatar
🖱️
extremely online

human person rudle

🖱️
extremely online
  • San Francisco
View GitHub Profile
module Kernel
alias_method :_exit, :exit
def exit(*args, &blk)
puts "EXIT CALLED BY #{caller.inspect} #{args.inspect}"
_exit(*args, &blk)
end
end
require 'rubygems'
require 'nokogiri'
require 'httparty'
doc = Nokogiri(HTTParty.get('http://www.gutenberg.org/wiki/Harvard_Classics_(Bookshelf)'))
ids = doc.css('a').select{|a| a.attr('title') =~ /ebook:/ }.map do |a|
a.attr('title') =~ /ebook:(\d+)/
{:title => a.text, :id => $1 }
end.compact.uniq