Chris Doyle arches

View abstract.markdown

Working on a Rails app without using the console is like flying a 747 without instruments. You can see where you're going if it's nice out but hit some bad weather and you're lost in the dark. In this talk I'll teach you the battle-tested console commands and techniques I use on a daily basis. We'll be spiking features, databasing, patching production apps, automating grunt work - the sky's the limit. You will leave with a firm command of the console and its role in your workflow.

View gist:9256285
1 2 3 4 5 6 7 8 9 10
require 'rubygems'
require 'aws/s3'
 
local_file = ARGV[0]
guid = ARGV[1]
bucket = ARGV[2]
mime_type = ARGV[3]
 
AWS::S3::Base.establish_connection!(
:access_key_id => 'AKJAFLWEAJFLAKJ',
View instance_block.rb
1 2 3 4 5 6 7 8 9 10
# before - each object in the enumerable is passed to the block
posts.select { |post| post.comments.any? }
 
class Array
def select(&blk)
if blk.arity == 0
super { |obj| obj.instance_exec &blk }
else
super
end
View bob.rb
1 2 3 4 5 6 7 8 9 10
require 'forwardable'
 
class Bob
def hey(message)
message = Message.new(message)
 
case
when message.shouting?
"Woah, chill out!"
when message.question?
View cart.rb
1 2 3 4 5 6 7 8 9 10
require 'active_support/hash_with_indifferent_access'
 
class Cart
include Enumerable
 
attr_writer :storage
 
def each(&blk)
deal_ids.each(&blk)
end
View example.rb
1 2 3 4 5 6 7 8 9 10
> my_array = [{server: "localhost", ip: "192.168.0.1"}, {server: "google dns", ip: "8.8.8.8"}]
> tp my_array
SERVER | IP
-----------|------------
localhost | 192.168.0.1
google dns | 8.8.8.8
 
 
# or with objects
> class ServerInfo
View kaboom.rb
1 2 3 4 5 6 7 8 9 10
def foobar(&blk)
yield "bar" if blk
"foo"
end
 
> foobar
=> "foo"
> foobar {|x| puts x}
bar
=> "foo"
View 1 resources
1 2 3 4 5 6 7 8 9 10
I have found these resources particularly helpful in preparing this posting:
 
Hiring Engineers, a Process
http://hueniverse.com/2013/02/hiring-engineers-a-process/
 
Join the Lift Team
http://blog.lift.do/post/24988178079/join-the-lift-team
 
How Etsy Increased Diversity in Its Engineering Department: An Interview with Marc Hedlund
https://www.youtube.com/watch?v=0D66GVc7ztA
View Procfile
1
monitor: bundle exec ruby monitor.rb
View bob.rb
1 2 3 4 5 6 7 8 9 10
class Bob
def hey(message)
message ||= ""
 
message = Message.new(message)
 
case
when message.shouting?
"Woah, chill out!"
when message.question?
Something went wrong with that request. Please try again.