Skip to content

Instantly share code, notes, and snippets.

sdfsadf
@mdeiters
mdeiters / gist:12106
Created September 22, 2008 19:20 — forked from anonymous/gist:12101
map.resources :divisions do |division|
division.resources :wss_configs
division.resources :websites
division.resources :urls
division.resources :announcements
division.resources :attachments
division.resources :scenes
end
map.resources :articles, :has_many => [:comments], do |article|
@mdeiters
mdeiters / gist:12124
Created September 22, 2008 19:43 — forked from anonymous/gist:12123
class Show
has_many :scenes
end
class Scene
has_one :scenable :as => :scenable
end
class Announcement
belongs_to :scenable, :polymorphic => true
require 'rubygems'
require 'open-uri'
require 'hpricot'
doc = Hpricot(open("http://en.oreilly.com/rails2009/public/schedule/topic/General"))
doc.search('.url').each do |session|
session_link = "http://en.oreilly.com#{session[:href]}"
session_page = Hpricot(open(session_link))
begin
title = session_page.at('.summary').inner_html
rating = session_page.at('.en_grade_average_detail').inner_html
#TO RUN
# Install ruby
# from command line type gem install sinatra haml
# create this file and call it app.rb
# from command line type ruby app.rb
# open up browser to http://localhost:4567/haml
require 'rubygems'
require 'sinatra'
require 'haml'
require 'rubygems'
require 'active_record'
require 'spec'
ActiveRecord::Base.establish_connection( {
:adapter => 'mysql',
:host => 'localhost',
:database => 'testbed',
:username => 'root',
:password => ''
india:mymckinsey mdeiters$ rake deadweight
(in /Users/mdeiters/development/mckinsey/mymckinsey)
/stylesheets/application.css
/stylesheets/facebox.css
/stylesheets/IE6.css
/stylesheets/IE7.css
/
/networks
/profiles/14714-sean-brown
/profiles/14714-sean-brown/friendships
india:mymckinsey mdeiters$ rake deadweight
(in /Users/mdeiters/development/mckinsey/mymckinsey)
/stylesheets/application.css
/stylesheets/facebox.css
/stylesheets/IE6.css
/stylesheets/IE7.css
/
/networks
/profiles/14714-sean-brown
/profiles/14714-sean-brown/friendships
map.resource :people
module Capistrano
class SSH
class << self
alias :original_connect :connect
def connect(server, options={}, &block)
special_server_settings = options[:server_authentication] ? options[:server_authentication][server.to_s] : nil
if special_server_settings.nil?
return original_connect(server, options, &block)
else
methods = [ %w(publickey hostbased), %w(password keyboard-interactive) ]