Skip to content

Instantly share code, notes, and snippets.

View czarneckid's full-sized avatar

David Czarnecki czarneckid

View GitHub Profile
fossil:tasty dczarnecki$ rake
(in /Users/dczarnecki/projects/tasty)
(in /Users/dczarnecki/projects/tasty)
/Users/dczarnecki/.rvm/rubies/ruby-1.8.7-p302/bin/ruby -I"lib:lib:test" "/Users/dczarnecki/.rvm/gems/ruby-1.8.7-p302@tasty_gem/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/test_tasty.rb"
Loaded suite /Users/dczarnecki/.rvm/gems/ruby-1.8.7-p302@tasty_gem/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
......
Finished in 0.003357 seconds.
6 tests, 8 assertions, 0 failures, 0 errors
after 'deploy', 'agora:campfire:success_or_failure'
namespace :agora do
namespace :campfire do
task :success_or_failure do
log = fetch(:full_log)
if log.include?('Rolling back')
campfire_room.speak 'http://i.imgur.com/XNCA1.png'
else
campfire_room.speak 'http://i.imgur.com/oYeMx.png'
end
$ cd GitHub-Project
$ git remote add upstream git://github.com/someuser/GitHub-Project.git
$ git fetch upstream
$ git merge upstream/master
Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import com.redis._
import com.redis._
scala> val r = new RedisClient("localhost", 6379)
r: com.redis.RedisClient = localhost:6379
ruby-1.8.7-p302 > map_1_xp_lb = Leaderboard.new('map_1_xp')
=> #<Leaderboard:0x1018d96e8 @leaderboard_name="map_1_xp", @page_size=25, @port=6379, @redis_connection=#<Redis client v2.1.1 connected to redis://localhost:6379/0 (Redis v2.0.3)>, @host="localhost", @redis_options={:host=>"localhost", :port=>6379}>
ruby-1.8.7-p302 > map_2_xp_lb = Leaderboard.new('map_2_xp')
=> #<Leaderboard:0x1018d34f0 @leaderboard_name="map_2_xp", @page_size=25, @port=6379, @redis_connection=#<Redis client v2.1.1 connected to redis://localhost:6379/0 (Redis v2.0.3)>, @host="localhost", @redis_options={:host=>"localhost", :port=>6379}>
ruby-1.8.7-p302 > map_3_xp_lb = Leaderboard.new('map_3_xp')
=> #<Leaderboard:0x1018cd370 @leaderboard_name="map_3_xp", @page_size=25, @port=6379, @redis_connection=#<Redis client v2.1.1 connected to redis://localhost:6379/0 (Redis v2.0.3)>, @host="localhost", @redis_options={:host=>"localhost", :port=>6379}>
ruby-1.8.7-p302 > map_4_xp_lb = Leaderboard.new('map_4_xp')
=> #<Leaderboard:0x1018c71f
ruby-1.8.7-p302 > map_1_xp_lb = Leaderboard.new('map_1_xp')
=> #<Leaderboard:0x1018d96e8 @leaderboard_name="map_1_xp", @page_size=25, @port=6379, @redis_connection=#<Redis client v2.1.1 connected to redis://localhost:6379/0 (Redis v2.0.3)>, @host="localhost", @redis_options={:host=>"localhost", :port=>6379}>
ruby-1.8.7-p302 > map_2_xp_lb = Leaderboard.new('map_2_xp')
=> #<Leaderboard:0x1018d3568 @leaderboard_name="map_2_xp", @page_size=25, @port=6379, @redis_connection=#<Redis client v2.1.1 connected to redis://localhost:6379/0 (Redis v2.0.3)>, @host="localhost", @redis_options={:host=>"localhost", :port=>6379}>
ruby-1.8.7-p302 > map_3_xp_lb = Leaderboard.new('map_3_xp')
=> #<Leaderboard:0x1018cd460 @leaderboard_name="map_3_xp", @page_size=25, @port=6379, @redis_connection=#<Redis client v2.1.1 connected to redis://localhost:6379/0 (Redis v2.0.3)>, @host="localhost", @redis_options={:host=>"localhost", :port=>6379}>
ruby-1.8.7-p302 > map_4_xp_lb = Leaderboard.new('map_4_xp')
=> #<Leaderboard:0x1018c735
@czarneckid
czarneckid / gist:792290
Created January 23, 2011 18:11
Scenario 4
ruby-1.8.7-p302 > total_money_lb.change_score_for('DavidCzarnecki', -8)
=> "7"
ruby-1.8.7-p302 > total_money_lb.change_score_for('ChristianArca', 16)
=> "23"
ruby-1.8.7-p302 > total_money_lb.leaders(1)
=> [{:member=>"ChristianArca", :score=>"23", :rank=>1}, {:member=>"DavidCzarnecki", :score=>"7", :rank=>2}]
ruby-1.8.7-p302 >
@czarneckid
czarneckid / gist:792283
Created January 23, 2011 18:03
Scenario 3
ruby-1.8.7-p302 > total_money_lb = Leaderboard.new('total_money')
=> #<Leaderboard:0x101180680 @leaderboard_name="total_money", @page_size=25, @port=6379, @redis_connection=#<Redis client v2.1.1 connected to redis://localhost:6379/0 (Redis v2.0.4)>, @host="localhost", @redis_options={:host=>"localhost", :port=>6379}>
ruby-1.8.7-p302 > total_money_lb.change_score_for('DavidCzarnecki', 15)
=> "15"
ruby-1.8.7-p302 > total_money_lb.change_score_for('ChristianArca', 7)
=> "7"
ruby-1.8.7-p302 > total_money_lb.leaders(1)
=> [{:member=>"DavidCzarnecki", :score=>"15", :rank=>1}, {:member=>"ChristianArca", :score=>"7", :rank=>2}]
ruby-1.8.7-p302 >
@czarneckid
czarneckid / gist:792244
Created January 23, 2011 17:27
Scenario 2
ruby-1.8.7-p302 > highscore_lb.add_member('DavidCzarnecki', 15)
=> false
ruby-1.8.7-p302 > highscore_lb.page_size = 5
=> 5
ruby-1.8.7-p302 > highscore_lb.around_me('DavidCzarnecki')
=> [{:member=>"DavidCzarnecki", :score=>"15", :rank=>1}, {:member=>"member_10", :score=>"10", :rank=>2}, {:member=>"member_9", :score=>"9", :rank=>3}, {:member=>"member_8", :score=>"8", :rank=>4}, {:member=>"member_7", :score=>"7", :rank=>5}]
ruby-1.8.7-p302 >
@czarneckid
czarneckid / gist:792239
Created January 23, 2011 17:23
Scenario 1
fossil:leaderboard dczarnecki$ irb
ruby-1.8.7-p302 > require 'rubygems'
=> true
ruby-1.8.7-p302 > require 'leaderboard'
=> true
ruby-1.8.7-p302 > highscore_lb = Leaderboard.new('highscores')
=> #<Leaderboard:0x1011b23b0 @leaderboard_name="highscores", @page_size=25, @port=6379, @redis_connection=#<Redis client v2.1.1 connected to redis://localhost:6379/0 (Redis v2.0.4)>, @host="localhost", @redis_options={:host=>"localhost", :port=>6379}>
ruby-1.8.7-p302 > 1.upto(10) do |index|
ruby-1.8.7-p302 > highscore_lb.add_member("member_#{index}", index)
ruby-1.8.7-p302 ?> end