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
require 'spec_helper' | |
module Codebreaker | |
describe Game do | |
describe '#start' do | |
let(:output) { double('output').as_null_object } | |
let(:game) { Game.new(output) } | |
it 'sends a welcome message' do | |
output.should_receive(:puts).with('Welcome to Codebreaker!') | |
game.start |
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
[42] pry(main)> (1..5).each { |i| puts i.object_id } | |
3 | |
5 | |
7 | |
9 | |
11 | |
=> 1..5 | |
[43] pry(main)> (1..5).each { |i| puts (i.object_id - 1) / 2 } | |
1 | |
2 |
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
[15] pry(main)> a.inspect | |
=> "[1, 2, 3, 4, 5]" | |
[16] pry(main)> p a | |
[1, 2, 3, 4, 5] | |
=> [1, 2, 3, 4, 5] | |
[17] pry(main)> b.inspect | |
=> "{:some=>\"thing\"}" | |
[18] pry(main)> p b | |
{:some=>"thing"} | |
=> {:some=>"thing"} |
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
[1] pry(main)> "".class | |
=> String | |
[2] pry(main)> "".class.superclass | |
=> Object | |
[3] pry(main)> "".class.superclass.superclass | |
=> BasicObject | |
[4] pry(main)> "".class.superclass.superclass.superclass | |
=> nil | |
[5] pry(main)> nil.class | |
=> NilClass |
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
post '/home', to: 'home#index' | |
get '/home', to: 'home#index' | |
match '/home', to: 'home#index', via: :post | |
match '/home', to: 'home#index', via: :all |
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
# Enter console in test environment | |
$ rails console test | |
Loading test environment | |
>> Rails.env | |
=> "test" | |
>> Rails.env.test? | |
=> true | |
# Start the server in test environment | |
$ rails server --environment 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
git push heroku | |
heroku pg:reset DATABASE | |
heroku run rake db:migrate | |
heroku run rake db:populate |
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
heroku pg:psql |
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
Creating Sessions | |
tmux new - new unnamed session | |
tmux new -s session_name - new named session | |
tmux new -s session_name -n window_name - new named session with named window | |
tmux ls - list all running sessions | |
tmux attach -t session_name - reattaches to named session | |
tmux kill-session -t session_name - kills a named session | |
Ctrl+a d - detaches from current session | |
Ctrl+a : - command mode |
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
set = [] | |
array.each do |item| | |
set.push item | |
if item % 4 == 0 | |
puts set.inspect | |
set = [] | |
end | |
end |
OlderNewer