Posted By

chrisaiv on 10/15/07


Tagged

ruby


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

webstic


Ruby: Web 2.0 Generator


 / Published in: Ruby
 

  1. #Web 2.0 Generator
  2. 5.times do
  3.  
  4. letters = { ?v => 'aeiou', ?c => 'bcdfghjklmnpqrstvwxyz'}
  5. #p letters
  6. word = ""
  7. i = 0
  8. 'cvcvc'.each_byte do |x|
  9. #puts x
  10. source = letters[x]
  11. #<< concatenates or appends
  12. word << source[rand(source.length)].chr
  13. end
  14.  
  15. puts word + '.com'
  16.  
  17. require 'open-uri'
  18. open("http://whois.net/whois_new.cgi?d=" + word + "&tld=com") {|f|
  19. @req = f.read
  20. #puts @req
  21. #Return the 1st position where the string is matched
  22. @txt = @req.index("No match")
  23. #puts @txt
  24. if @txt.nil?
  25. puts "Domain is available"
  26. else
  27. puts "Sorry - Domain is taken"
  28. end
  29.  
  30. }
  31. end

Report this snippet  

You need to login to post a comment.