Return to Snippet

Revision: 80595
at March 21, 2020 23:02 by chrisaiv


Updated URL
https://www.chrisjmendez.com/2017/10/15/ruby-web-2-0-name-generator/

Updated Code
https://www.chrisjmendez.com/2017/10/15/ruby-web-2-0-name-generator/

Updated Description
https://www.chrisjmendez.com/2017/10/15/ruby-web-2-0-name-generator/

Revision: 3995
at October 15, 2007 01:54 by chrisaiv


Updated Code
#Web 2.0 Generator
5.times do

letters = { ?v => 'aeiou', ?c => 'bcdfghjklmnpqrstvwxyz'}
#p letters
word = ""
i = 0
'cvcvc'.each_byte do |x|
  #puts x
  source = letters[x]
  #<< concatenates or appends
  word << source[rand(source.length)].chr
end

puts word + '.com'

require 'open-uri'
open("http://whois.net/whois_new.cgi?d=" + word + "&tld=com") {|f|
  @req = f.read
  #puts @req
  #Return the 1st position where the string is matched
  @txt = @req.index("No match")
  #puts @txt
  if @txt.nil?
    puts "Domain is available"
  else
    puts "Sorry - Domain is taken"
  end
    
  }
end

Revision: 3994
at October 15, 2007 01:25 by chrisaiv


Initial Code
#Web 2.0 Generator
10.times do
  letters = { ?v => 'aeiou', ?c => 'bcdfghjklmnpqrstvwxyz'}

  word = ""
  'cvcvc'.each_byte do |x|
    source = letters[x]
    #<< concatenates or appends
    word << source[rand(source.length)].chr
  end

  puts word + '.com'
end

Initial URL

                                

Initial Description

                                

Initial Title
Ruby: Web 2.0 Generator

Initial Tags
ruby

Initial Language
Ruby