SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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)
 

Kürzlich hochgeladen

Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 

Kürzlich hochgeladen (20)

Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

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

Hinweis der Redaktion

  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