Skip to content

Instantly share code, notes, and snippets.

View patmaddox's full-sized avatar
🤔
Trying to figure out how to look up comments I've left

Pat Maddox patmaddox

🤔
Trying to figure out how to look up comments I've left
View GitHub Profile
[1] pry(main)> hash = {a: 1, b: 2, c: 3}
=> {:a=>1, :b=>2, :c=>3}
[2] pry(main)> class Hash
[2] pry(main)* def retrieve_keys(*keys)
[2] pry(main)* self.reduce({}) { |h, (k, v)|
[2] pry(main)* keys.include?(k) ? h.merge!({k => v}) : h
[2] pry(main)* }
[2] pry(main)* end
[2] pry(main)* end
=> nil
@patmaddox
patmaddox / setup.md
Created May 9, 2012 21:59 — forked from karlstolley/setup.md
Computer Prep Instructions for End-to-End Agile Web Application Development from Basically Nothing

The workshop will require a number of technologies, which time will not permit us to set up on site. So, find your operating system below (Windows or Mac; if you're on Linux, let me know), and follow the steps to get your computer set up ahead of time. If you have any problems, email karl.stolley@gmail.com

At the request of some participants, I've also provided links to some reading material at the very bottom of this page. Look through that stuff if you have the time or interest.

You can find more detailed installation instructions at http://installfest.railsbridge.org/installfest/installfest and a curriculum for building and deploying a rails application from the ground up at http://curriculum.railsbridge.org/curriculum/curriculum

Windows

First, you'll want to have a good editor on hand for the workshop. You can't do much better than Notepad++; just download and unzip this file: http://download.tuxfamily.org/notepadplus/6.1.2/npp.6.1.2.bin.zip Unzip the file; there will be

# done
# -- Matthew Peychich
Factory.define :venue do |v|
v.name 'Foo Place'
v.url {Factory.next(:url_slug)}
v.address_hint 'MyString'
v.phone '(805) 555-1212'
v.capacity 'MyString'
v.website 'example.com'
v.image 'MyString'
class RestfulReader
def get(things)
# GET funky restafarian
end
alias_method :fetch, :get
end
class SqlReader
def select(things)
# I hate SQL
# When I run the specs above, the following error occurs:
$ script/spec -c spec/controllers/strange_name_error.rb
./spec/controllers/strange_name_error.rb:15: undefined local variable or method `properties_url' for #<Class:0x22b918c> (NameError)
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:68:in `module_eval'
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:68:in `create_nested_example_group'
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/extensions/class.rb:14:in `instance_eval'
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/extensions/class.rb:14:in `subclass'
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:66:in `create_nested_example_group'
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:53:in `describe'