Skip to content

Instantly share code, notes, and snippets.

View kamal's full-sized avatar

Kamal Fariz Mahyuddin kamal

View GitHub Profile
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
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
#!/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
#!/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"
# 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 %>
#
# 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
#
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
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
1> [error] [<0.1259.0>] Uncaught error in HTTP request: {error,
                                {case_clause,
                                 {{nocatch,
                                   {compilation_error,
                                    <<"expression does not eval to a function. (undefined)">>}},
                                  [{couch_os_process,prompt,2},
                                   {couch_query_servers,
                                    '-start_doc_map/2-fun-0-',2},
                                   {lists,foreach,2},
                                   {couch_query_servers,start_doc_map,2},
MBP:~ kamal$ rvm -v
rvm 0.0.18 (2009.08.25) [http://github.com/wayneeseguin/rvm]
MBP:~ kamal$ rvm use 1.9 --debug
+ case "$action" in
+ rvm-use ruby 1.9
+ implementation=ruby
+ case "$implementation" in
+ '[' 1.9 = 1.8.7 ']'
+ '[' 1.9 = 1.8.6 -o 1.9 = 1.8 ']'
+ '[' 1.9 = 1.9.2 ']'