Skip to content

Instantly share code, notes, and snippets.

# ----------------------------------------------------------------------------------
# Java installation
# ----------------------------------------------------------------------------------
package "debconf-utils" do
action :install
end
# Java requires you to accept licenses by hand. We can automate this with the following script
bash "accept_licenses" do
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"/Users/james/Documents/code/paperclip/lib" -I"/Users/james/Documents/code/paperclip/lib" -I"/Users/james/Documents/code/paperclip/profile" "/Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake/rake_test_loader.rb" "test/attachment_test.rb" "test/geometry_test.rb" "test/integration_test.rb" "test/interpolations_test.rb" "test/iostream_test.rb" "test/matchers/have_attached_file_matcher_test.rb" "test/matchers/validate_attachment_content_type_matcher_test.rb" "test/matchers/validate_attachment_presence_matcher_test.rb" "test/matchers/validate_attachment_size_matcher_test.rb" "test/paperclip_test.rb" "test/processor_test.rb" "test/storage_test.rb" "test/thumbnail_test.rb"
(in /Users/james/Documents/code/paperclip)
./test/interpolations_test.rb:10: warning: parenthesize argument(s) for future version
Loaded suite /Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake/rake_test_loader
Started
................................................................
def new_session(as_user_with_nickname)
open_session do |s|
s.extend(Webrat::Matchers)
s.extend(Webrat::Methods)
unless as_user_with_nickname.nil?
s.visit login_url
s.fill_in "Nickname or Email", :with => as_user_with_nickname
s.fill_in "Password", :with => "swordfish"
s.click_button "Login to Fetlife"
class Creditor
observes :message, :invokes => :use_credits, :on => :create
observes :conversation, :invokes => :use_credits, :on => :create
def use_credits(user)
# use credits
end
end
class Conversation < ActiveRecord::Base
Net::SSH::Simple.new do |s|
s.servers "server1"
exit_code = s.run "ls -la" do |cmd|
cmd.on_stdout do |stdout|
end
cmd.on_stderr do |stderr|
end
end
class UsersController < ApplicationController
respond_to :html, :xml
# GET /users
# GET /users.xml
def index
@users = User.all
respond_with(@users)
end
require 'rubygems'
require 'cassandra'
t = Cassandra.new "Twitter"
10000.times do
t.insert :UserRelationships, "5", {"statuses" => {Cassandra::UUID.new => "1234"}}
end
# make sure to ctrl-c out of this before it finishes
t.get :UserRelationships, "5", "statuses", :count => 100
>> t.get :UserRelationships, "5", "statuses", :count => 10000
>> User.find(1).timeline.stories.all(:limit => 1000)
["get_slice",
CassandraThrift::Cassandra::Get_slice_args,
{:keyspace=>"FetLife",
:column_parent=><CassandraThrift::ColumnParent column_family:"Timelines">,
:key=>"1",
:consistency_level=>1,
:predicate=>
<CassandraThrift::SlicePredicate slice_range:<CassandraThrift::SliceRange start:"", finish:"", reversed:false, count:100>>}]
["get_slice",
>> User.find(1).timeline.stories.all(:limit => 20, :reversed => true)
Thrift::TransportException: Broken pipe
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/thrift-0.0.789419/lib/thrift/transport/socket.rb:88:in `write'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/thrift-0.0.789419/lib/thrift/transport/buffered_transport.rb:64:in `flush'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/thrift-0.0.789419/lib/thrift/client.rb:41:in `send_message'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/cassandra-0.5.5/lib/../vendor/gen-rb/cassandra.rb:21:in `send_get_slice'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/cassandra-0.5.5/lib/../vendor/gen-rb/cassandra.rb:16:in `get_slice'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/cassandra-0.5.5/lib/cassandra/safe_client.rb:11:in `send'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/cassandra-0.5.5/lib/cassandra/safe_client.rb:11:in `method_missing'
from /opt/ruby-enterprise/lib/ruby/gems/1.
#4 Cassandra::Columns.sub_columns_to_hash(column_family#String, columns#Array)
at line /home/fetlife/cassandra/lib/cassandra/columns.rb:50
(rdb:1) v l
column_family => "TimelineRelationships"
columns => [<CassandraThrift::ColumnOrSuperColumn column:<CassandraThrift::Column name:"action", value:"\"post_comment_created\"", timestamp:1251748451797163>>, <CassandraThrift::ColumnOrSuperColumn column:<CassandraThrift::Column name:"actor_id", value:"43007", timestamp:1251748451797163>>, <CassandraThrift::ColumnOrSuperColumn column:<CassandraThrift::Column name:"body", value:"\"<blockquote>I'm really sorry, sweetie. <\\/blockquote>\"", timestamp:1251748451797163>>, <CassandraThrift::ColumnOrSuperColumn column:<CassandraThrift::Column name:"created_at", value:"\"2009/07/16 02:31:26 +0000\"", timestamp:1251748451797163>>, <CassandraThrift::ColumnOrSuperColumn column:<CassandraThrift::Column name:"schema_version", value:"0", timestamp:1251748451797163>>, <CassandraThrift::ColumnOrSuperColumn column:<Cassandr