Thursday, May 26, 2011

Sent email using gmail smtp in ruby


require 'pony'
Pony.mail(:to => 'real_mail@yahoo.com', :via => :smtp, :via_options => {
   
:address => 'smtp.gmail.com',
   
:port => '587',
   
:enable_starttls_auto => true,
   
:user_name => 'id_gmail',
   
:password => 'parola_gmail',
   
:authentication => :plain,
   
:domain => "HELO",
},
:subject => 'Test email', :body => 'Test for Pony email through gmail SMTP server.')

Using Redis as a Key-Value Store

Lists and Sets in Redis

Redis hash usage

User signup and login using redis

file utility methods for copying, moving, removing, etc in ruby

Creates a directory and all its parent directories ruby

require 'fileutils'


Creates a directory and all its parent directories. For example,
FileUtils.mkdir_p '/usr/local/lib/ruby'
causes to make following directories, if it does not exist.
* /usr
* /usr/local
* /usr/local/lib
* /usr/local/lib/ruby
You can pass several directories at a time in a list.