Skip to content

Instantly share code, notes, and snippets.

View keppy's full-sized avatar
🥧
Pie is delicious

James Dominguez keppy

🥧
Pie is delicious
View GitHub Profile
@keppy
keppy / haller
Last active August 29, 2015 13:56
ackpurchase λ cap hall_notify:notify_hall_room
/Users/Luca/.rvm/gems/ruby-2.0.0-p0/gems/highline-1.6.20/lib
/Users/Luca/.rvm/gems/ruby-2.0.0-p0/gems/net-sftp-2.1.2/lib
/Users/Luca/.rvm/gems/ruby-2.0.0-p0/gems/net-scp-1.1.2/lib
/Users/Luca/.rvm/gems/ruby-2.0.0-p0/gems/net-ssh-gateway-1.2.0/lib
/Users/Luca/.rvm/gems/ruby-2.0.0-p0/gems/capistrano-2.15.5/lib
/Users/Luca/.rvm/gems/ruby-2.0.0-p0/gems/net-ssh-2.8.0/lib
/Users/Luca/.rvm/gems/ruby-2.0.0-p0/gems/json-1.8.1/lib
/Users/Luca/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib
/Users/Luca/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0
packpurchase λ cat Gemfile.lock
GIT
remote: git://github.com/smashingboxes/capistrano-haller.git
revision: e4e92394891fd858677f79c2101408c86aca1894
specs:
capistrano-haller (0.0.2)
capistrano (< 3.0)
GIT
remote: git://github.com/smashingboxes/cardboard.git
I, [2014-02-17T17:49:07.694501 #14991] INFO -- : Refreshing Gem list
I, [2014-02-17T17:49:10.763734 #14991] INFO -- : listening on addr=/tmp/unicorn.packpurchase.sock fd=10
I, [2014-02-17T17:49:11.081006 #14991] INFO -- : master process ready
I, [2014-02-17T17:49:11.097897 #14995] INFO -- : worker=0 ready
I, [2014-02-17T17:49:11.102993 #14998] INFO -- : worker=1 ready
I, [2014-02-18T15:29:08.030600 #22657] INFO -- : executing ["/home/deployer/www/packpurchase/shared/bundle/ruby/2.0.0/bin/unicorn", "-D", "-c", "/home/deployer/www/packpurchase/shared/config/unicorn.rb", "-E", "staging", {10=>#<Kgio::UNIXServer:/tmp/unicorn.packpurchase.sock>}] (in /home/deployer/www/packpurchase/releases/20140218152825)
I, [2014-02-18T15:29:08.620449 #22657] INFO -- : inherited addr=/tmp/unicorn.packpurchase.sock fd=10
I, [2014-02-18T15:29:08.645071 #22657] INFO -- : Refreshing Gem list
I, [2014-02-18T15:29:10.537629 #14991] INFO -- : reaped #<Process::Status: pid 14995 exit 0> worker=0
I, [2014-02-18T15:29:10.537860 #
@keppy
keppy / kpoker
Created May 29, 2012 20:34
poker game initialization
def initialize(numhands, n = 5, deck = [r+s for r in '23456789TJQKA' for s in 'SHDC'])
deck.shuffle
i = 0
numhands.times do (n*i).upto(n*(i+1)) {|x|... }
end
end
class PokerGame
include Enumerable
include Comparable
attr_reader :hand
def initialize(hands, cards)
ranks = %w{ 2 3 4 5 6 7 8 9 T J Q K A }
suits = %w{ S H D C }
card_stack = Array.new
h = Array.new
def initialize(hands, cards)
ranks = %w{ 2 3 4 5 6 7 8 9 T J Q K A }
suits = %w{ S H D C }
card_stack = Array.new
h = Array.new
suits.each {|suit|
ranks.size.times {|i|
card_stack << (ranks[i]+suit)
}
}
class PokerGame
include Enumerable
include Comparable
attr_reader :hand
def initialize(hands, cards)
ranks = %w{ 2 3 4 5 6 7 8 9 T J Q K A }
suits = %w{ S H D C }
card_stack = Array.new
num_hands = Array.new
@keppy
keppy / gist:3012287
Created June 28, 2012 16:25
Modeling a debate app
def User
has_many :propositions, :as => :debateable
has_many :oppositions, :as => :debateable
end
def Proposition
belongs_to :debateable, :polymorphic => :true
has_one :opposition, :as => :debateable
end
@keppy
keppy / gist:3042484
Created July 3, 2012 19:50
Method help
require 'spec_helper'
describe Debate do
#let(:prop_user) { FactoryGirl.create(:user) }
#let(:opp_user) { FactoryGirl.create(:user) }
before do
@prop_user = User.new(name: "Prop User", email: "prop@email.com")
@opp_user = User.new(name: "Opp User", email: "opp@email.com")
@debate = Debate.new(title: "Test Debate")
@keppy
keppy / gist:3133180
Created July 18, 2012 00:29
Problem with routes
routes.rb
----------
Debateable::Application.routes.draw do
resources :users do
resources :posts
end
resources :topics do
resources :posts