Last active
August 29, 2015 14:27
-
-
Save QuinnStephens/e0d1486c1ba43532c233 to your computer and use it in GitHub Desktop.
Grabs random paragraphs from Edward Butler-Lytton's 1830 novel PAUL CLIFFORD, source of the famous "It was a dark and stormy night." Use it if you're bored of lorem ipsum.
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 'nokogiri' | |
require 'open-uri' | |
require 'clipboard' | |
page = Nokogiri::HTML(open('https://www.gutenberg.org/files/7735/7735-h/7735-h.htm')) | |
count = ARGV[0] ? ARGV[0].to_i : 1 | |
output = '' | |
count.times do |i| | |
output << page.css('p').to_a.sample.text.strip.split.join(' ') << (i < count - 1 ? "\n\n" : "\n") | |
end | |
Clipboard.copy(output) | |
print output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment