Skip to content

Instantly share code, notes, and snippets.

View sammcgrail's full-sized avatar
🎯
Focusing

Sam McGrail sammcgrail

🎯
Focusing
View GitHub Profile
@sammcgrail
sammcgrail / tdo.rb
Last active August 29, 2015 14:26 — forked from sirupsen/tdo.rb
Gist for "What I Wish a Ruby Programmer Had Told Me One Year Ago".
class TodoList < Array
def self.load(file)
# read the file, create a list, create items, add them to the list, return the list
list = TodoList.new
File.read(file).each_line do |line|
list << line.chomp
end
list
end
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')

Enumerable Examples

[Enumerable][enumerable] is a mixin that is used to add additional functionality to collection classes like Array and Hash. This means that you can use the methods defined in Enumerable on both arrays and hashes.

#map

[Enumberable#map][map] is useful when you want to create a new array by iterating over some collection of values, and calculate a new value based on

@sammcgrail
sammcgrail / cli.md
Last active August 29, 2015 14:18 — forked from radavis/cli.md

Using the OSX Command Line

Directory Shortcuts

~ - Home Directory
. - Current Directory
.. - Enclosing Directory
/ - Root Directory