Skip to content

Instantly share code, notes, and snippets.

View liguang2080's full-sized avatar

liguang2080 liguang2080

View GitHub Profile
require "rubygems"
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:database => "test",
:username => "root",
:password => "123",
:host => "localhost"
)
@liguang2080
liguang2080 / youtube test
Created April 7, 2009 14:09
youtub test
require "rubygems"
require 'youtube_g'
client = YouTubeG::Client.new
client.videos_by(:user => 'liz')
require "rubygems"
require 'action_mailer'
ActionMailer::Base.delivery_method= :smtp
ActionMailer::Base.smtp_settings={
:address => "smtp.gmail.com",
:port => "587",
:domain => "localhost.localdomain",
:authentication => :plain,
:user_name => "lg2046"
require "rubygems"
require "mechanize"
a = WWW::Mechanize.new do |agent|
agent.follow_meta_refresh = true
end
a.get("http://caibangzi.com") do |page|
my_page = page.form_with(:action => "/account/login") do |f|
f["account[login]"] = "sina2008"