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
SingleLine: | |
A | |
B | |
C | |
ManyLines: | |
C | |
B | |
A |
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
# After reading this comment | |
# http://avdi.org/devblog/2010/08/02/using-and-and-or-in-ruby/#comment-1098 , | |
# | |
# I became aware of a cool idiom for Ruby. | |
# | |
# I've seen this in a lot of cases: | |
if (variable = expression_or_method(options)) | |
variable.calculate_something | |
do_other_stuff(variable) |
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
mv /etc/yum.conf /etc/yum.conf.5.4 | |
sed s/release=5.4/release=5.5/ /etc/yum.conf.5.4 > /etc/yum.conf | |
yum -y remove ruby | |
yum -y install gcc gcc-c++ kernel-devel zlib-devel openssl-devel readline readline-devel bison gettext-devel expat-devel curl-devel | |
COMPILE_PATH=/tmp/install | |
mkdir -p $COMPILE_PATH | |
cd $COMPILE_PATH |
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
namespace :vlad do | |
desc "installs Bundler if it is not already installed" | |
remote_task :install_bundler do | |
run "sh -c 'if [ -z `which bundle` ]; then echo Installing Bundler; sudo gem install bundler --pre; fi'" | |
end | |
desc "run 'bundle install' to install Bundler's packaged gems for the current deploy and cache the config and lock files for the next releases" | |
remote_task :bundle_install do | |
run "cd #{latest_release} && bundle install #{shared_path}/bundle --without development test" |
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 Pumphouse::Model | |
extend ActiveModel::Naming | |
def self.connection=(*args) | |
@connection = Cassandra.new(*args) | |
end | |
def self.connection | |
@connection | |
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
/subscriber/xxx/messages | |
/subscriber/xxx/messages/received | |
/subscriber/xxx/messages/sent | |
/subscriber/xxx/messages/tagged/ttt | |
/subscriber/xxx/messages/received/tagged/ttt | |
/subscriber/xxx/messages/sent/tagged/ttt | |
/subscriber/xxx/messages/between/yyy |
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
# Edit this Gemfile to bundle your application's dependencies. | |
source 'http://rubygems.org' | |
git 'git://github.com/rails/rails.git', :glob => "{*/,}*.gemspec" | |
gem 'rails', '3.0.0.beta1' |
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 Message | |
extend ActiveModel::Naming | |
include ActiveModel::Serializers::Xml | |
include ActiveModel::Serializers::JSON | |
def self.for_subscriber(subscriber_id) | |
# nasty! | |
5.times.collect { Message.new } | |
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
module ColumnReader | |
def column_reader(column_name, options = {}) | |
name = options.delete(:as) || column_name.to_s.pluralize | |
column = columns_hash[column_name.to_s] | |
self.module_eval %{ | |
def self.#{name} | |
query = scoped.arel.project(arel_table[:#{column_name}]) | |
connection.select_all(query.to_sql).collect do |value| |
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
jermey.davis | |
birdie.zboncak | |
duane.bradtke | |
mona.mcclure | |
angela.rath | |
raquel.marvin | |
gustave.maggio | |
viva.yost | |
abner.koelpin | |
jeff.welch |