SlideShare une entreprise Scribd logo
1  sur  32
Ruby!?
  Yep.
The Plan

• Language Intro & Features
• Environment Install
• Hello World Sinatra App on Heroku
C++

• Statically Typed Compiled Language
• int x = 2;
• x = “a”;
• uh oh...
Ruby

• Dynamically Typed Interpreted Scripting
  Language
• x=2
• x = “a”
• Mmhhmm
Ruby Features
•   http://ruby-lang.org/en/about
•   REPL
•   Rubygems
•   Everything is an object
•   Monkey patching
•   Easy closures
•   Mixins
REPL
It’s How You Learn
What it is, yo?!

• REPL = Read Eval Print Loop
• Err...
• It’s a command line tool to write ruby
• IRB & Pry
• Pry :: http://vimeo.com/26391171
In C++

• A C++ REPL?
• I guess...
• http://www.artificialworlds.net/wiki/IGCC/
  IGCC
Rubygems
Package Management Made Easy
There’s a Gem for That
•   Wait, there isn’t?
•   Write your own and publish
•   > gem install rails
    > rails new my_sweet_app
    > cd my_sweet_app
    > rails s
    > open http://0.0.0.0:3000/
•   You now have the beginnings of a web application
•   http://rubygems.org/
Everything Is An Object
Literally...

• 5.class => Fixnum
• “What?!”.length => 6
• “What?!”.length.class => Fixnum
I Don’t Believe It

•   42.class => Fixnum
• 42.class.superclass => Integer
•   42.class.superclass.superclass => Numeric
•   42.class.superclass.superclass.superclass => Integer

•   42.class.superclass.superclass.superclass.superclass => Object
Monkey Patching
Too Silly To Be Real
•   Just kidding
•   Crazy language flexibility
•   class Fixnum
       def to_kittens
          return to_s << “ kitten” if abs == 1
          to_s << “ kittens”
       end
    end
•   5.to_kittens => “5 kittens”
•   -1.to_kittens => “-1 kitten”
Easy Closures
Actually...
•   In ruby, they’re called blocks
•   Enumerators (Loops)
•   42.times do
       p “What is the meaning of life?”
    end
•   [ 1 , 2 , 3 ].each do |i|
       p i.to_kittens
    end
Mixins...
...Use Them
•   Composition vs. (Multiple?) Inheritance
•   Keep your code fresh and clean
•   module Kittens
      def to_kittens
        return to_s << “ kitten” if abs == 1
        to_s << “ kittens”
      end
    end
•   Fixnum.include Kittens
•   5.to_kittens => “5 kittens”
Let’s Get Setup
      RTFM
Command Line
• Mac: Terminal.app
• Mac: iTerm 2 alpha - http://iterm2.com
• Windows: cmd.exe
• Windows: Cygwin - http://cygwin.com
• MSys Git - http://code.google.com/p/
  msysgit/
Package Installer


• Mac: homebrew - https://github.com/mxcl/
  homebrew
• Windows: Uhhh...
Ruby


• Mac:
  > brew install ruby
• Windows: http://rubyinstaller.org/
Ruby Version Managers

• Why do we need these?
• Mac: rvm - https://
  rvm.beginrescueend.com/
• Windows: pik - https://github.com/
  vertiginous/pik
Git


• Mac: http://git-scm.com/download
• Windows: Cygwin packages/preferences
A Nice Little Web App
Sinatra


• Your first web app
• http://www.sinatrarb.com/
Heroku

• We’ll need to setup a few more things
• Gemfile
• Procfile
• Git repo
Gemfile
•   Tells heroku which gems we’ll need
•   > gem install bundler
•   Add a file called Gemfile (capital G is important)
    with the following contents...

    source :rubygems
    gem “sinatra”
    gem “heroku”, :group => :development
•   > bundle
Procfile

• Tells heroku how to boot our web app
• Add a file called Procfile (capital P is
  important) with the following contents...

  web: ruby -rubygems hi.rb -p $PORT
Git Repo

• Run the following in your terminal
• > git init
  > git add .
  > git commit -m “my first git commit!”
Heroku Again
• Sign Up - http://heroku.com
• > heroku apps:create --stack=cedar
  > git push heroku master
  > heroku open
• If your heroku commands aren’t working,
  try prepending them with “bundle exec” e.g.

  > bundle exec heroku open

Contenu connexe

Tendances

Happy Programming with CoffeeScript
Happy Programming with CoffeeScriptHappy Programming with CoffeeScript
Happy Programming with CoffeeScriptEddie Kao
 
How to use App::FatPacker effectively
How to use App::FatPacker effectivelyHow to use App::FatPacker effectively
How to use App::FatPacker effectivelyShoichi Kaji
 
CPAN Dependency Heaven
CPAN Dependency HeavenCPAN Dependency Heaven
CPAN Dependency HeavenOpusVL
 
Node js quick tour v2
Node js quick tour v2Node js quick tour v2
Node js quick tour v2Wyatt Fang
 
或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -
或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -
或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -Kei Shiratsuchi
 
My Top 5 Favorite Gems
My Top 5 Favorite GemsMy Top 5 Favorite Gems
My Top 5 Favorite GemsJimmy Ngu
 
WP Weekend #2 - Corcel, aneb WordPress přes Laravel
WP Weekend #2 - Corcel, aneb WordPress přes LaravelWP Weekend #2 - Corcel, aneb WordPress přes Laravel
WP Weekend #2 - Corcel, aneb WordPress přes LaravelBrilo Team
 
Woo: Writing a fast web server
Woo: Writing a fast web serverWoo: Writing a fast web server
Woo: Writing a fast web serverfukamachi
 
What's new in Symfony3
What's new in Symfony3What's new in Symfony3
What's new in Symfony3Yuki MAEJIMA
 
Baking in the cloud with packer and puppet
Baking in the cloud with packer and puppetBaking in the cloud with packer and puppet
Baking in the cloud with packer and puppetAlan Parkinson
 
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜 AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜 崇之 清水
 
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...Alexander Lisachenko
 
Developing OpenResty Framework
Developing OpenResty FrameworkDeveloping OpenResty Framework
Developing OpenResty FrameworkAapo Talvensaari
 
Rails Girls: Programming, Web Applications and Ruby on Rails
Rails Girls: Programming, Web Applications and Ruby on RailsRails Girls: Programming, Web Applications and Ruby on Rails
Rails Girls: Programming, Web Applications and Ruby on RailsDonSchado
 

Tendances (18)

Happy Programming with CoffeeScript
Happy Programming with CoffeeScriptHappy Programming with CoffeeScript
Happy Programming with CoffeeScript
 
How to use App::FatPacker effectively
How to use App::FatPacker effectivelyHow to use App::FatPacker effectively
How to use App::FatPacker effectively
 
CPAN Dependency Heaven
CPAN Dependency HeavenCPAN Dependency Heaven
CPAN Dependency Heaven
 
Node js quick tour v2
Node js quick tour v2Node js quick tour v2
Node js quick tour v2
 
或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -
或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -
或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -
 
My Top 5 Favorite Gems
My Top 5 Favorite GemsMy Top 5 Favorite Gems
My Top 5 Favorite Gems
 
Bar Camp Atl3
Bar Camp Atl3Bar Camp Atl3
Bar Camp Atl3
 
Lisp in the Cloud
Lisp in the CloudLisp in the Cloud
Lisp in the Cloud
 
WP Weekend #2 - Corcel, aneb WordPress přes Laravel
WP Weekend #2 - Corcel, aneb WordPress přes LaravelWP Weekend #2 - Corcel, aneb WordPress přes Laravel
WP Weekend #2 - Corcel, aneb WordPress přes Laravel
 
Woo: Writing a fast web server
Woo: Writing a fast web serverWoo: Writing a fast web server
Woo: Writing a fast web server
 
What's new in Symfony3
What's new in Symfony3What's new in Symfony3
What's new in Symfony3
 
C# & AWS Lambda
C# & AWS LambdaC# & AWS Lambda
C# & AWS Lambda
 
Baking in the cloud with packer and puppet
Baking in the cloud with packer and puppetBaking in the cloud with packer and puppet
Baking in the cloud with packer and puppet
 
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜 AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
 
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
 
Developing OpenResty Framework
Developing OpenResty FrameworkDeveloping OpenResty Framework
Developing OpenResty Framework
 
Ender
EnderEnder
Ender
 
Rails Girls: Programming, Web Applications and Ruby on Rails
Rails Girls: Programming, Web Applications and Ruby on RailsRails Girls: Programming, Web Applications and Ruby on Rails
Rails Girls: Programming, Web Applications and Ruby on Rails
 

En vedette

National Youth Program Registration Strategy Powerpoint from June 18th All-St...
National Youth Program Registration Strategy Powerpoint from June 18th All-St...National Youth Program Registration Strategy Powerpoint from June 18th All-St...
National Youth Program Registration Strategy Powerpoint from June 18th All-St...AIUSA_Youth
 
Bruno William Pitzalis - Few, Countless and Selected Words
Bruno William Pitzalis - Few, Countless and Selected WordsBruno William Pitzalis - Few, Countless and Selected Words
Bruno William Pitzalis - Few, Countless and Selected WordsBruno William Pitzalis
 
Women and LGBT Rights Webinar
Women and LGBT Rights WebinarWomen and LGBT Rights Webinar
Women and LGBT Rights WebinarAIUSA_Youth
 
The hague conference background document 2-
The hague conference   background document  2-The hague conference   background document  2-
The hague conference background document 2-Ivan Ivanov
 

En vedette (6)

Few Countless And Collected Words 11
Few Countless And Collected Words 11Few Countless And Collected Words 11
Few Countless And Collected Words 11
 
National Youth Program Registration Strategy Powerpoint from June 18th All-St...
National Youth Program Registration Strategy Powerpoint from June 18th All-St...National Youth Program Registration Strategy Powerpoint from June 18th All-St...
National Youth Program Registration Strategy Powerpoint from June 18th All-St...
 
Bruno William Pitzalis - Few, Countless and Selected Words
Bruno William Pitzalis - Few, Countless and Selected WordsBruno William Pitzalis - Few, Countless and Selected Words
Bruno William Pitzalis - Few, Countless and Selected Words
 
Women and LGBT Rights Webinar
Women and LGBT Rights WebinarWomen and LGBT Rights Webinar
Women and LGBT Rights Webinar
 
The hague conference background document 2-
The hague conference   background document  2-The hague conference   background document  2-
The hague conference background document 2-
 
AI Basics
AI BasicsAI Basics
AI Basics
 

Similaire à Ruby v cpp_preso

Packaging perl (LPW2010)
Packaging perl (LPW2010)Packaging perl (LPW2010)
Packaging perl (LPW2010)p3castro
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet
 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflowTomas Doran
 
CPAN 模組二三事
CPAN 模組二三事CPAN 模組二三事
CPAN 模組二三事Lin Yo-An
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Mandi Walls
 
perlbrew yapcasia 2010
perlbrew yapcasia 2010perlbrew yapcasia 2010
perlbrew yapcasia 2010Kang-min Liu
 
Taking Spinnaker for a spin @ London DevOps Meetup 36
Taking Spinnaker for a spin @ London DevOps Meetup 36Taking Spinnaker for a spin @ London DevOps Meetup 36
Taking Spinnaker for a spin @ London DevOps Meetup 36aleonhardt
 
Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015ice799
 
Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009pratiknaik
 
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)goccy
 
The New Frontend Toolchain
The New Frontend ToolchainThe New Frontend Toolchain
The New Frontend ToolchainBruno Abrantes
 
Ship It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails EcosystemShip It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails EcosystemYi-Ting Cheng
 
Great Tools Heavily Used In Japan, You Don't Know.
Great Tools Heavily Used In Japan, You Don't Know.Great Tools Heavily Used In Japan, You Don't Know.
Great Tools Heavily Used In Japan, You Don't Know.Junichi Ishida
 
Puppet Development Workflow
Puppet Development WorkflowPuppet Development Workflow
Puppet Development WorkflowJeffery Smith
 
Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"Fwdays
 
Ruby performance - The low hanging fruit
Ruby performance - The low hanging fruitRuby performance - The low hanging fruit
Ruby performance - The low hanging fruitBruce Werdschinski
 
Puppet Camp LA 2015: Package Managers and Puppet (Beginner)
Puppet Camp LA 2015: Package Managers and Puppet (Beginner)Puppet Camp LA 2015: Package Managers and Puppet (Beginner)
Puppet Camp LA 2015: Package Managers and Puppet (Beginner)Puppet
 
Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015ice799
 
Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)DECK36
 

Similaire à Ruby v cpp_preso (20)

Packaging perl (LPW2010)
Packaging perl (LPW2010)Packaging perl (LPW2010)
Packaging perl (LPW2010)
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflow
 
CPAN 模組二三事
CPAN 模組二三事CPAN 模組二三事
CPAN 模組二三事
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014
 
perlbrew yapcasia 2010
perlbrew yapcasia 2010perlbrew yapcasia 2010
perlbrew yapcasia 2010
 
Taking Spinnaker for a spin @ London DevOps Meetup 36
Taking Spinnaker for a spin @ London DevOps Meetup 36Taking Spinnaker for a spin @ London DevOps Meetup 36
Taking Spinnaker for a spin @ London DevOps Meetup 36
 
Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015
 
Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009
 
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
 
The New Frontend Toolchain
The New Frontend ToolchainThe New Frontend Toolchain
The New Frontend Toolchain
 
Ship It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails EcosystemShip It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails Ecosystem
 
Great Tools Heavily Used In Japan, You Don't Know.
Great Tools Heavily Used In Japan, You Don't Know.Great Tools Heavily Used In Japan, You Don't Know.
Great Tools Heavily Used In Japan, You Don't Know.
 
Puppet Development Workflow
Puppet Development WorkflowPuppet Development Workflow
Puppet Development Workflow
 
Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"
 
Ruby performance - The low hanging fruit
Ruby performance - The low hanging fruitRuby performance - The low hanging fruit
Ruby performance - The low hanging fruit
 
Continuous feature-development
Continuous feature-developmentContinuous feature-development
Continuous feature-development
 
Puppet Camp LA 2015: Package Managers and Puppet (Beginner)
Puppet Camp LA 2015: Package Managers and Puppet (Beginner)Puppet Camp LA 2015: Package Managers and Puppet (Beginner)
Puppet Camp LA 2015: Package Managers and Puppet (Beginner)
 
Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015
 
Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)
 

Dernier

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Dernier (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Ruby v cpp_preso

  • 2. The Plan • Language Intro & Features • Environment Install • Hello World Sinatra App on Heroku
  • 3. C++ • Statically Typed Compiled Language • int x = 2; • x = “a”; • uh oh...
  • 4. Ruby • Dynamically Typed Interpreted Scripting Language • x=2 • x = “a” • Mmhhmm
  • 5. Ruby Features • http://ruby-lang.org/en/about • REPL • Rubygems • Everything is an object • Monkey patching • Easy closures • Mixins
  • 7. What it is, yo?! • REPL = Read Eval Print Loop • Err... • It’s a command line tool to write ruby • IRB & Pry • Pry :: http://vimeo.com/26391171
  • 8. In C++ • A C++ REPL? • I guess... • http://www.artificialworlds.net/wiki/IGCC/ IGCC
  • 10. There’s a Gem for That • Wait, there isn’t? • Write your own and publish • > gem install rails > rails new my_sweet_app > cd my_sweet_app > rails s > open http://0.0.0.0:3000/ • You now have the beginnings of a web application • http://rubygems.org/
  • 12. Literally... • 5.class => Fixnum • “What?!”.length => 6 • “What?!”.length.class => Fixnum
  • 13. I Don’t Believe It • 42.class => Fixnum • 42.class.superclass => Integer • 42.class.superclass.superclass => Numeric • 42.class.superclass.superclass.superclass => Integer • 42.class.superclass.superclass.superclass.superclass => Object
  • 15. Too Silly To Be Real • Just kidding • Crazy language flexibility • class Fixnum def to_kittens return to_s << “ kitten” if abs == 1 to_s << “ kittens” end end • 5.to_kittens => “5 kittens” • -1.to_kittens => “-1 kitten”
  • 17. Actually... • In ruby, they’re called blocks • Enumerators (Loops) • 42.times do p “What is the meaning of life?” end • [ 1 , 2 , 3 ].each do |i| p i.to_kittens end
  • 19. ...Use Them • Composition vs. (Multiple?) Inheritance • Keep your code fresh and clean • module Kittens def to_kittens return to_s << “ kitten” if abs == 1 to_s << “ kittens” end end • Fixnum.include Kittens • 5.to_kittens => “5 kittens”
  • 21. Command Line • Mac: Terminal.app • Mac: iTerm 2 alpha - http://iterm2.com • Windows: cmd.exe • Windows: Cygwin - http://cygwin.com • MSys Git - http://code.google.com/p/ msysgit/
  • 22. Package Installer • Mac: homebrew - https://github.com/mxcl/ homebrew • Windows: Uhhh...
  • 23. Ruby • Mac: > brew install ruby • Windows: http://rubyinstaller.org/
  • 24. Ruby Version Managers • Why do we need these? • Mac: rvm - https:// rvm.beginrescueend.com/ • Windows: pik - https://github.com/ vertiginous/pik
  • 25. Git • Mac: http://git-scm.com/download • Windows: Cygwin packages/preferences
  • 26. A Nice Little Web App
  • 27. Sinatra • Your first web app • http://www.sinatrarb.com/
  • 28. Heroku • We’ll need to setup a few more things • Gemfile • Procfile • Git repo
  • 29. Gemfile • Tells heroku which gems we’ll need • > gem install bundler • Add a file called Gemfile (capital G is important) with the following contents... source :rubygems gem “sinatra” gem “heroku”, :group => :development • > bundle
  • 30. Procfile • Tells heroku how to boot our web app • Add a file called Procfile (capital P is important) with the following contents... web: ruby -rubygems hi.rb -p $PORT
  • 31. Git Repo • Run the following in your terminal • > git init > git add . > git commit -m “my first git commit!”
  • 32. Heroku Again • Sign Up - http://heroku.com • > heroku apps:create --stack=cedar > git push heroku master > heroku open • If your heroku commands aren’t working, try prepending them with “bundle exec” e.g. > bundle exec heroku open

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n