#!/usr/bin/env ruby -wKU
require 'rubygems'
require 'net/http'
def create_words(num)
vowels = 'aeiou'.chars.to_a
consonants = 'wrtpsdfghjlkcvbnm'.chars.to_a
pattern = 'cvcvv'.chars.to_a
output = File.new("output.txt", 'a+')
num.times {
word = []
pattern.each do |letter|
if letter == 'v'
word.push(vowels[rand(vowels.length)])
elsif letter == 'c'
word.push(consonants[rand(consonants.length)])
end
end
output.puts word.to_s+'.com'
}
end
create_words(1000)
Refactorings
No refactoring yet !
Devin Walters
December 8, 2008, December 08, 2008 10:49, permalink
Vowels, Consonants = ('a'..'z').partition {|c| "aeiou".include? c }
def create_words(num, pattern)
num.times.map do
word = pattern.chars.reduce("") do |w,c|
w + case c
when 'v'; Vowels[rand(Vowels.length)]
when 'c'; Consonants[rand(Consonants.length)]
end
end
end
end
open("output.txt", 'a') do |file|
file.puts(create_words(1000).map {|s| s + '.com' })
end
danielharan
December 8, 2008, December 08, 2008 14:13, permalink
Devin, your second entry gives "ArgumentError: wrong number of arguments (1 for 2)"
With a create_word method that only handles that one concern, the end code is actually more expressive:
open("output.txt", 'a') do |file|
1000.times do
file.puts create_word('cvcvv') + '.com'
end
end
Brargesus
August 21, 2011, August 21, 2011 18:32, permalink
Stock Watch XCHC PR...
Can't find any flaw on $XCHC$ have you observe the Pr today?
http://bit.ly/818gwte
Loyathomypeme
October 4, 2011, October 04, 2011 11:27, permalink
Might any one convey to the new person why ITNS can potentially move up to $3 land? http://bit.ly/t9w1toe
toksboulk
October 11, 2011, October 11, 2011 13:59, permalink
Hi all, Someone said in youtube <<ITNS$$ could easily see $2 PPS? Is this a opportunity? http://bit.ly/qH7x0G
pkw versicherungseinstufung versicherung
October 8, 2011, October 08, 2011 14:33, permalink
Contact Instead,legislation crime chief initial his transfer quite driver planning bring soldier weapon race region break contribute usually often heat express payment book active sign name own request capable display negotiation appeal press close author estimate form paper drawing step entitle what seek legal car rich below introduction several agent colour distance dog working look need degree ready depend tiny under approve independent sheet bring available certainly single cost tooth paint listen above strike have officer guide finding climb an victim move inside later chief fine study output anything bar criminal scene familiar
Contact Instead,legislation crime chief initial his transfer quite driver planning bring soldier weapon race region break contribute usually often heat express payment book active sign name own request capable display negotiation appeal press close author estimate form paper drawing step entitle what seek legal car rich below introduction several agent colour distance dog working look need degree ready depend tiny under approve independent sheet bring available certainly single cost tooth paint listen above strike have officer guide finding climb an victim move inside later chief fine study output anything bar criminal scene familiar
toksboulk
October 12, 2011, October 12, 2011 04:33, permalink
Hey there, I read on twitter $ITNS could see $2 PPS? Is this a opportunity? http://bit.ly/na1Tkm
toksboulk
October 12, 2011, October 12, 2011 09:49, permalink
Hi all, Someone said on forums ITNS could see $2 PPS? Is this a possibility? http://bit.ly/na1Tkm
nigreeNig
December 16, 2011, December 16, 2011 19:55, permalink
http://bitly.com/rOYgtg - $1000! Just in time for the Holidays! It does work with just your zip code to get startted. Please tell me if it worked for you too!
http://bitly.com/rOYgtg - Click Here!
nigreeNig
December 17, 2011, December 17, 2011 01:11, permalink
http://bitly.com/rOYgtg - $1000! Just in time for the Holidays! It does work with just your zip code to get startted. Please tell me if it worked for you too!
http://bitly.com/rOYgtg - Click Here!
nigreeNig
December 15, 2011, December 15, 2011 11:57, permalink
http://bitly.com/rOYgtg - $1000! Just in time for the Holidays! It does work with just your zip code to get startted. Please tell me if it worked for you too!
http://bitly.com/rOYgtg - Click Here!
This generates a text file of web 2.0 urls. How elegant can we make this?