Skip to content

Instantly share code, notes, and snippets.

@namiwang
Created June 23, 2013 02:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save namiwang/5843518 to your computer and use it in GitHub Desktop.
Save namiwang/5843518 to your computer and use it in GitHub Desktop.
get random words from matrix67's idea generator
require 'nokogiri'
require 'open-uri'
50.times do
page = Nokogiri::HTML(open("http://www.matrix67.com/ideagen/"))
word = page.css('body .main p').children[0].to_s.gsub("\r",'').gsub("\n",'').gsub("\t",'').split('的')[1]
File.open('words','a'){ |file| file.write(word+"\n") }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment