> 6.+( 7 ) # Method with argument
=> 13
> 6.5.+ 7 # You can add integer to float. And skip par.
=> 13.5
> 6 + 7 # This is the same as 6.+( 7 )
=> 13
This presentation: slid.es/gudj/rails-intro-short/fullscreen
Installation: stockholmruby.com/install
The tutorial: Railsbridge
Us: stockholmruby, meetup, @sthlmrb, #sthlmrb
Sponsor: Thoughtbot
WiFi: SUP46-Guest-WiFi-By-MTGx
Password: unfors33N
$git --version
git version 1.8.3.4 (Apple Git-47)
https://code.google.com/p/git-osx-installer/
git-1.8.3.2-intel-universal-snow-leopard.dmg
$ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.5.0]
$irb
2.0.0-p247 :002 > 2+2 => 4
2.0.0-p247 :005 > require 'active_support/all' => true 2.0.0-p247 :006 > 1.day.ago => 2013-10-16 17:49:11 +0200
$sqlite3
SQLite version 3.7.12 2012-04-03 19:43:07
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .quit
$heroku version heroku-toolbelt/3.0.0 (x86_64-darwin10.8.0) ruby/1.9.3
$heroku login Enter your Heroku credentials. Email: your_email@gmail.com Password (typing will be hidden): Authentication successful.
> 6
=> 6 > 6.5 => 6.5
> Bob
NameError: uninitialized constant Bob
from (irb):45
from /Users/gdj/.rvm/rubies/ruby-2.0.0-p247/bin/irb:16:in `'
> "Bob"
=> "Bob"
> :Bob
=> :Bob
> 6.even? # Ruby ignores anything after '#'
=> true > 6.5.even? # Ruby understands first dot is decimal
NoMethodError: undefined method `even?' for 6.5:Float from (irb):50 from /Users/gdj/.rvm/rubies/ruby-2.0.0-p247/bin/irb:16:in
> 6.+( 7 ) # Method with argument => 13 > 6.5.+ 7 # You can add integer to float. And skip par. => 13.5 > 6 + 7 # This is the same as 6.+( 7 ) => 13
> x NameError: undefined local variable or method `x' for main:Object from (irb):31 from /Users/gdj/.rvm/rubies/ruby-2.0.0-p247/bin/irb:16:in
> x = 6 => 6 > x => 6 > x = 7 # x is changed to a different value (x is a variable) => 7 > x + 6 => 13 > recipient = "Bob" => "Bob" > recipient + "@gmail.com" => "Bob@gmail.com"
> ingredients = ["milk", "eggs", "flour", "oil" , "salt"]
=> ["milk", "eggs", "flour", "oil", "salt"]
> ingredients.first
=> "milk"
> ingredients[4] # This is just a method call. Looks funny.
=> "salt"
> recipe = {:milk => "2dl", :eggs => 2, :flour => "1hg"}
=> {:milk=>"2dl", :eggs=>2, :flour=>"1hg"}
> recipe.size
=> 3
> recipe[:eggs] # This is also a method call
=> 2
'> 6.class
=> Fixnum
> 6.5.class
=> Float
'> "Bob".class => String > :Bob.class
=> Symbol
'> ingredients.class
=> Array
> recipe.class
=> Hash
> recipient => "Bob" > recipient.concat "@example.com" => "Bob@example.com" > recipient => "Bob@example.com"
> recipe[:salt] = "1pinch" => "1pinch" > recipe => {:milk=>"2dl", :eggs=>2, :flour=>"1hg", :salt=>"1pinch"}
> fahr = 90
=> 90
> celsius = (5.0/9.0) * (fahr - 32)
=> 32.22222222222222
> fahr = 80
=> 80
> celsius = (5.0/9.0) * (fahr - 32)
=> 26.666666666666668
> def fahr_to_celsius( fahr ) > (5.0/9.0) * (fahr - 32) > end => nil > fahr_to_celsius 80 => 26.666666666666668 > fahr_to_celsius 70
=> 21.11111111111111
scheme://domain:port/path?query_string#fragment_id
pwd (print working directory)
ls (list files)
cd <directory name> (change directory - .. (two dots) to move up)
mkdir <directory name> (make/create directory)
$ls -al ~