Rails 3.0 introduced support for routing constrained by subdomains.
A subdomain can be specified explicitly, like this:
match '/' => 'home#index', :constraints => { :subdomain => 'www' }
| namespace :deploy do | |
| desc "Hot-reload God configuration for the Resque worker" | |
| task :reload_god_config do | |
| sudo "god stop resque" | |
| sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}" | |
| sudo "god start resque" | |
| end | |
| end | |
| # append to the bottom: |
| # app/models/ability.rb | |
| # All front end users are authorized using this class | |
| class Ability | |
| include CanCan::Ability | |
| def initialize(user) | |
| user ||= User.new | |
| can :read, :all |
| #!/usr/bin/env ruby | |
| require 'spreadsheet' | |
| # Begin Test | |
| print "Spreadsheet Test\n" | |
| # Create the rows to be inserted | |
| row_1 = ['A1', 'B1'] | |
| row_2 = ['A2', 'B2'] |
| require 'rubygems' | |
| require 'httparty' | |
| require 'benchmark' | |
| require 'thread' | |
| class Google | |
| include HTTParty | |
| base_uri 'http://google.com' | |
| def self.benchmark |
| require "openssl" | |
| require "digest" | |
| def aes128_cbc_encrypt(key, data, iv) | |
| key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize) | |
| iv = Digest::MD5.digest(iv) if(iv.kind_of?(String) && 16 != iv.bytesize) | |
| aes = OpenSSL::Cipher.new('AES-128-CBC') | |
| aes.encrypt | |
| aes.key = key | |
| aes.iv = iv |
| machine github.com | |
| login technoweenie | |
| password SECRET | |
| machine api.github.com | |
| login technoweenie | |
| password SECRET |
| #The steps need to be performed to use resque-web with in your application | |
| #In routes.rb | |
| ApplicationName::Application.routes.draw do | |
| resources :some_controller_name | |
| mount Resque::Server, :at=> "/resque" | |
| end | |
| #That's it now you can access it from within your application i.e |
| # lib/active_admin_views_pages_base.rb | |
| class ActiveAdmin::Views::Pages::Base < Arbre::HTML::Document | |
| private | |
| # Renders the content for the footer | |
| def build_footer | |
| div :id => "footer" do | |
| para "Copyright © #{Date.today.year.to_s} #{link_to('Example.com', 'http://example.com')}. Powered by #{link_to('Active Admin', 'http://www.activeadmin.info')} #{ActiveAdmin::VERSION}".html_safe |
| require 'net/http' | |
| module Net | |
| class HTTP | |
| def self.enable_debug! | |
| raise "You don't want to do this in anything but development mode!" unless Rails.env == 'development' | |
| class << self | |
| alias_method :__new__, :new | |
| def new(*args, &blk) | |
| instance = __new__(*args, &blk) | |
| instance.set_debug_output($stderr) |