Skip to content

Instantly share code, notes, and snippets.

@coderberry
Created January 12, 2010 21:40
Show Gist options
  • Select an option

  • Save coderberry/275642 to your computer and use it in GitHub Desktop.

Select an option

Save coderberry/275642 to your computer and use it in GitHub Desktop.
RAILS RUNNER APPLICATION IN 10 STEPS !!!
1.- rails runner -d mysql
2.- cd runner
3.- Edit config/database.yml
4.- rake db:create
5.- ./script/generate scaffold Md5 password:string md5hash:string
6.- rake db:migrate
7.- irb DEMO
puts "Hello World"
8.- ruby ./script/console development;
Md5.find(:all)
i=Md5.new({:password=>"from_console1",:md5hash=>"console_hash1"})
i.save
Md5.create({:password=>"from_console2",:md5hash=>"console_hash2"})
9.- ruby ./script/runner -e development 'Md5.create({:password=>"from_runner",:md5hash=>"runner_hash"})'
10.- Lets play with Ruby Code:
a)
require 'digest/md5'
md5_test = Digest::MD5.hexdigest("abc")
puts md5_test
b)
abcd=("a".."z").to_a
num=(0..9).to_a
@abc=abcd+num
@abc.each do |a|
puts a
end
c)
require 'digest/md5'
abcd=("a".."z").to_a
num=(0..9).to_a
@abc=abcd+num
@abc.each do |a|
md5_a = Digest::MD5.hexdigest("#{a}")
my_runner = "ruby ./script/runner -e development 'Md5.create({:password=>\"#{a}\",:md5hash=>\"#{md5_a}\"})'"
puts my_runner
%x(#{my_runner})
end
d)
abcd=("a".."z").to_a
num=(0..9).to_a
@abc=abcd+num
@abc.each do |a|
@abc.each do |b|
@abc.each do |c|
my_extension = "com"
my_domain = "www.#{a}#{b}#{c}.#{my_extension}"
my_command = "dig +short #{my_domain}"
puts my_command
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment