⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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
Adding a -rspec flag to rails. Also establishes and | |
rails() { if [[ $1 == "new" && $3 == "-rspec" ]]; then add_rspec $2; else command rails "$@"; fi; } | |
function add_rspec(){ | |
command rails new $1 -d postgresql -T; #delete -d postgresql if you don't want pg | |
command chmod 664 $1/Gemfile; | |
echo -e "\n#Because rspec is better than Test::Unit. Or so I'm told.\ngem 'rspec-rails'" >> $1/Gemfile; | |
command chmod 644 $1/Gemfile; | |
command cd $1; |
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)> Book | |
=> Book(id: integer, title: string, author: string, abstract: text, created_at: datetime, updated_at: datetime) | |
[2] pry(main)> Book.create title: "Who Stole My Cheese?" | |
(0.1ms) begin transaction | |
SQL (5.1ms) INSERT INTO "books" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 08 Oct 2013 23:14:31 UTC +00:00], ["title", "Who Stole My Cheese?"], ["updated_at", Tue, 08 Oct 2013 23:14:31 UTC +00:00]] | |
(14.9ms) commit transaction | |
=> #<Book id: 4, title: "Who Stole My Cheese?", author: nil, abstract: nil, created_at: "2013-10-08 23:14:31", updated_at: "2013-10-08 23:14:31"> | |
[3] pry(main)> Book.find(4) | |
Book Load (0.3ms) SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 4]] | |
=> #<Book id: 4, title: "Who Stole My Cheese?", author: nil, abstract: nil, created_at: "2013-10-08 23:14:31", updated_at: "2013-10-08 23:14:31"> |
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
# This is a basic example how to create an import from csv data. This could | |
# be called in a rake task: | |
namespace :db do | |
namespace :import do | |
desc "Import customer of old shop from csv" | |
task :customer => :environment do | |
csv_file = 'db/customer_data.csv' | |
importer = Import::ImportCustomer.new(IO.read(csv_file)) | |
importer.import |
Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications
like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.
open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html
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
=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') |