This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveResource | |
class Base | |
def to_xml_with_methods(options) | |
methods = Array(options.delete(:methods)) | |
methods.each do |m| | |
attributes[m] = send(m) | |
end | |
to_xml_without_methods(options) | |
end | |
alias_method_chain :to_xml, :methods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kamal@ubuntu:/etc/apt$ sudo apt-get install rubygems ohai chef chef-server | |
Reading package lists... Done | |
Building dependency tree | |
Reading state information... Done | |
rubygems is already the newest version. | |
ohai is already the newest version. | |
chef is already the newest version. | |
Some packages could not be installed. This may mean that you have | |
requested an impossible situation or if you are using the unstable | |
distribution that some required packages have not yet been created |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: hosts | |
# Recipe:: default | |
# | |
# Copyright 2009, Bitfluent | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Auto-generated by chef for <%= @node[:fqdn] %> | |
# | |
127.0.0.1 localhost <%= @localhost["fqdn"] %> <%= (@localhost["dns_aliases"] || []).sort.join(" ") %> | |
<% @hosts.keys.sort.each do |ip| %> | |
<%= ip %> <%= @hosts[ip]["fqdn"] %> <%= (@hosts[ip]["dns_aliases"] || []).sort.join(" ") %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Create a custom chef index for deb packages on the system | |
require "rubygems" | |
require "chef" | |
require "chef/rest" | |
require "open4" | |
require "ohai" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "Copying opscode.list to /etc/apt/sources.list.d" | |
sudo cp install/opscode.list /etc/apt/sources.list.d/opscode.list | |
echo "Adding opscode GPG key" | |
curl http://apt.opscode.com/[email protected] | sudo apt-key add - | |
echo "Installing chef client" | |
sudo apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rack/openid" | |
require "warden" | |
use Rack::OpenID | |
use Warden::Manager do |manager| | |
Warden::Strategies.add(:openid) do | |
def authenticate! | |
if resp = env["rack.openid.response"] | |
case resp.status | |
when :success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Article < ActiveRecord::Base | |
belongs_to :author | |
searchable do | |
text :title, :boost => 2.0 | |
text :body | |
text :author_name do | |
author.name | |
end | |
time :updated_at # for sorting by recent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/environment.rb | |
config.gem "bitfluent-activemerchant", :lib => "activemerchant" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources :channels do | |
shallow do | |
resources :posts do | |
member do | |
put :disable | |
put :toggle_stickiness | |
put :add_channel | |
end | |
resources :replies, :only => [:index, :new, :create, :show] | |
end |