SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
Ruby en OSX



Thursday, September 22, 11
Para que sirve Ruby


                    • Rails



Thursday, September 22, 11
Fin


                    • Gracias!
                    • Espero que os haya gustado


Thursday, September 22, 11
Ah, pero hay mas?
                    •        Rspec / Cucumber

                    •        Sinatra

                    •        Capistrano

                    •        Capybara ( webtesting )

                    •        EventMachine

                    •        FFI

                    •        nokogiri (HTML Parsing)

                    •        mocha (Mocking)

                    •        guard (FileSystem watching DSL)

                    •        .... y muchos mas!!




Thursday, September 22, 11
¿Qué es Ruby?
                    • Lenguaje interpretado
                    • Creado por Yukihiro Matsumoto - Matz
                    • Dinamico
                    • “Reflexivo”
                    • Orientado a objetos
                    • Inspirado en Perl con un toque de Smalltalk
Thursday, September 22, 11
¿Qué es Ruby?
                    •        El lenguaje no es estandar, se guia por
                             especificaciones y por la implementación “guia”

                             • MRI
                             • JRuby
                             • Rubinius
                             • IronRuby
                             • MacRuby

Thursday, September 22, 11
¿Qué mola de Ruby?
                    • Bloques
             a = [1,2,3,4,5,6,7,8,9,10]

             evens = a.select do |x|
               x % 2 == 0
             end
                  [2,4,6,8,10]
             doubles = a.map { |x| x + x }
                 [2,4,6,8,10,12,14,16,18,20]



Thursday, September 22, 11
¿Qué mola de Ruby?
                    • Todo es un objeto
             4.class
             >> Fixnum
             nil.class
             >> NilClass
             Fixnum.class
             >> Class




Thursday, September 22, 11
¿Qué mola de Ruby?
                    • Reapertura de clases
             class Fixnum
               def is_even?
                 self % 2 == 0
               end
             end

             4.is_even?
             >> true


Thursday, September 22, 11
¿Qué mola de Ruby?
                    • Envio de mensajes, respond_to?
             4.respond_to? :is_even?
             >> true

             4.send :is_even?
             >> true

             dynamic_method = “is_even?”
             4.send dynamic_method
             >> true

Thursday, September 22, 11
¿Qué mola de Ruby?
                    • Method missing
             class WeirdString < String
               def method_missing m, *args, &block
                 self.send m.to_s.reverse
               end
             end

             t = WeirdString.new “PrUebA”
             t.esacnwod
             >> “prueba”

Thursday, September 22, 11
¿Qué mola de Ruby?

                    • procs / lambdas
                    • eval
                    • DSL
                    • mixins
                    • regexps

Thursday, September 22, 11
Ruby en OSX
                    • Preinstalado desde Leopard
                     • Version 1.8
                    • Scripting Bridge
                    • RubyCocoa => MacRuby
                    • Lenguaje soportado en applicaciones
                             del MacAppStore

Thursday, September 22, 11
Ruby en OSX

                    •        MacRuby es la evolucion de RubyCocoa

                    •        Gracias a RubyCocoa / MacRuby

                             •   TOTAL INTEROPERABILIDAD CON OBJC

                             •   Todo lo de la diapositiva 4, es interoperable con
                                 nuestras clases Objective-C

                    •        Sustituto de AppleScript gracias al Scripting Bridge



Thursday, September 22, 11
MacRuby vs RubyCocoa

                    •        MacRuby es el futuro pero,

                             •   RubyCocoa viene instalado en OSX por defecto

                             •   MacRuby tiene que ser embebido en la
                                 aplicación

                    •        RubyCocoa -> 1.8

                    •        MacRuby -> 1.9

                             •   Mejoras velocidad, Threads, GC


Thursday, September 22, 11
MacRuby vs RubyCocoa
                    •        Sintaxis
                      objc
                      [[NSWindow alloc] initWithContentRect:styleMask:backing:defer:]
                      RubyCocoa
                      NSWindow.alloc.initWithContentRect_styleMask_backing_defer (...)
                      MacRuby
                      NSWindow.alloc.initWithContentRect( ..., styleMask:..., backing:...,
                      defer...

                    •        Integración de clases en MacRuby

                             •   String, Number,... de Ruby -> NSString, NSNumber, ...

                             •   Elimina la necesidad de proxies

                    •        MacRuby compila contra LLVM -> Posibilidad de generar binarios nativos



Thursday, September 22, 11
MacRuby
                                               Objective-C
                     @interface Book

                     @property (retain, nonatomic) NSString *title

                     - (void) addBookToLibrary:(NSString*) theLibrary
                     - (void) insertPage: (Page*) thePage atPosition: (NSUInteger)
                     position

                     @end


                                                  Ruby
                     b = Book.new
                     b.title = “My new book”
                     b.addBookToLibrary “The Great Library”
                     b.insertPage myPage, :atPosition => 4
                     - OR -
                     b.insertPage myPage, atPosition: 4




Thursday, September 22, 11
MacRuby
       framework 'Cocoa'
                                                          win.title = "Hello NSCoder"
       class AppDelegate                                  win.delegate = delegate
         def windowWillClose n
           exit                                           button = NSButton.alloc.initWithFrame
         end                                              [10,10,80,50]
                                                          button.title = "Hello!"
         def hello sender                                 button.target = delegate
           puts "Hello World!"                            button.action = :hello
         end
       end                                                win.contentView.addSubview button

       delegate = AppDelegate.new                         win.display
       app = NSApplication.sharedApplication              win.orderFrontRegardless
       app.delegate = delegate                            app.run

       win = NSWindow.
                 alloc.
                 initWithContentRect [200,300,100,100],
                 :styleMask => NSTitledWindowMask
                 :backing => NSBackingStoreBuffered,
                 :defer => false




Thursday, September 22, 11
MacRuby
                    • XCode (& InterfaceBuilder) compatible




Thursday, September 22, 11
MacRuby
                    •        Aplicaciones subidas al Mac AppStore

                             •   http://www.thumperapp.com/

                             •   http://luckymac.com/ - Music Streaming

                             •   http://redwoodapp.com/ - Spotlight in the cloud




Thursday, September 22, 11
Scripting Bridge

                    •        Interfaz que puede dar un programa para facilitar la comunicación con él

                    •        Basado en Apple Events

                             •   Antes de SB, esos Apple Events se enviaban, o bien con Apple Script o
                                 con un código en Objective-C no muy sencillo

                             •   Con SB, los Apple Events se pueden enviar como un mensaje mas de
                                 Objective-C (Aparte de seguir usando AppleScript)

                                 •   Y por ello, accesible desde Ruby (RubyCocoa) o PyObjC




Thursday, September 22, 11
SB y Ruby
                    • Copiar la ruta del fichero seleccionado en
                             el Finder al clipboard

                require 'osx/cocoa'
                include OSX
                OSX.require_framework 'ScriptingBridge'

                finder = SBApplication.applicationWithBundleIdentifier_ “com.apple.finder”
                fileURL = NSURL.URLWithString_ finder.selection.get[0].URL
                system "echo #{fileURL.path} | pbcopy”




Thursday, September 22, 11
SB y Ruby
                    • Obtener las canciones de tu iTunes
                require 'osx/cocoa'
                include OSX
                OSX.require_framework 'ScriptingBridge'

                iTunes = SBApplication.applicationWithBundleIdentifier_ "com.apple.iTunes"

                iTunes.sources.each do |source|
                  puts source.name
                  source.playlists.each do |playlist|
                    puts "-- #{playlist.name}"
                    playlist.tracks.each do |track|
                      puts "t-- #{track.name}"
                    end
                  end
                end




Thursday, September 22, 11
Fin

                    • Gracias ;)



                    • Use Ruby

Thursday, September 22, 11

Weitere ähnliche Inhalte

Was ist angesagt?

The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes BackBurke Libbey
 
Invokedynamic in 45 Minutes
Invokedynamic in 45 MinutesInvokedynamic in 45 Minutes
Invokedynamic in 45 MinutesCharles Nutter
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...bobmcwhirter
 
MacRuby: What is it? and why should you care?
MacRuby: What is it? and why should you care?MacRuby: What is it? and why should you care?
MacRuby: What is it? and why should you care?Joshua Ballanco
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxbobmcwhirter
 
TorqueBox for Rubyists
TorqueBox for RubyistsTorqueBox for Rubyists
TorqueBox for Rubyistsbobmcwhirter
 
Invokedynamic: Tales from the Trenches
Invokedynamic: Tales from the TrenchesInvokedynamic: Tales from the Trenches
Invokedynamic: Tales from the TrenchesCharles Nutter
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developergicappa
 
Using Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRBUsing Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRBHiro Asari
 
JUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBoxJUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBoxmarekgoldmann
 
Testing Ember Apps
Testing Ember AppsTesting Ember Apps
Testing Ember Appsjo_liss
 
An introduction and future of Ruby coverage library
An introduction and future of Ruby coverage libraryAn introduction and future of Ruby coverage library
An introduction and future of Ruby coverage librarymametter
 
Rake: Not Your Father's Build Tool
Rake: Not Your Father's Build ToolRake: Not Your Father's Build Tool
Rake: Not Your Father's Build Toolfilmprog
 
JRuby in Java Projects
JRuby in Java ProjectsJRuby in Java Projects
JRuby in Java Projectsjazzman1980
 
Type script, for dummies
Type script, for dummiesType script, for dummies
Type script, for dummiessantiagoaguiar
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyNick Sieger
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the worldHiroshi SHIBATA
 
State of the art: server-side javaScript - NantesJS
State of the art: server-side javaScript - NantesJSState of the art: server-side javaScript - NantesJS
State of the art: server-side javaScript - NantesJSAlexandre Morgaut
 

Was ist angesagt? (20)

The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes Back
 
Invokedynamic in 45 Minutes
Invokedynamic in 45 MinutesInvokedynamic in 45 Minutes
Invokedynamic in 45 Minutes
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
MacRuby: What is it? and why should you care?
MacRuby: What is it? and why should you care?MacRuby: What is it? and why should you care?
MacRuby: What is it? and why should you care?
 
Devignition 2011
Devignition 2011Devignition 2011
Devignition 2011
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
 
TorqueBox for Rubyists
TorqueBox for RubyistsTorqueBox for Rubyists
TorqueBox for Rubyists
 
Invokedynamic: Tales from the Trenches
Invokedynamic: Tales from the TrenchesInvokedynamic: Tales from the Trenches
Invokedynamic: Tales from the Trenches
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
 
Using Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRBUsing Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRB
 
JUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBoxJUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBox
 
Testing Ember Apps
Testing Ember AppsTesting Ember Apps
Testing Ember Apps
 
An introduction and future of Ruby coverage library
An introduction and future of Ruby coverage libraryAn introduction and future of Ruby coverage library
An introduction and future of Ruby coverage library
 
Rake: Not Your Father's Build Tool
Rake: Not Your Father's Build ToolRake: Not Your Father's Build Tool
Rake: Not Your Father's Build Tool
 
JRuby in Java Projects
JRuby in Java ProjectsJRuby in Java Projects
JRuby in Java Projects
 
Type script, for dummies
Type script, for dummiesType script, for dummies
Type script, for dummies
 
Vert.x
Vert.xVert.x
Vert.x
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRuby
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the world
 
State of the art: server-side javaScript - NantesJS
State of the art: server-side javaScript - NantesJSState of the art: server-side javaScript - NantesJS
State of the art: server-side javaScript - NantesJS
 

Ähnlich wie Charla ruby nscodermad

Developing Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyDeveloping Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyBrendan Lim
 
JRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyEvgeny Rahman
 
10 Things you should know about Ruby
10 Things you should know about Ruby10 Things you should know about Ruby
10 Things you should know about Rubysikachu
 
Ruby On Rails pizza training
Ruby On Rails pizza trainingRuby On Rails pizza training
Ruby On Rails pizza trainingdavid_alphen
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLBarry Jones
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Nilesh Panchal
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Thomas Lundström
 
Ruby :: Training 1
Ruby :: Training 1Ruby :: Training 1
Ruby :: Training 1Pavel Tyk
 
Adventures of java developer in ruby world
Adventures of java developer in ruby worldAdventures of java developer in ruby world
Adventures of java developer in ruby worldOrest Ivasiv
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Mark Menard
 
RubyConfBD 2013 decouple, bundle and share with ruby gems
RubyConfBD 2013   decouple, bundle and share with ruby gems RubyConfBD 2013   decouple, bundle and share with ruby gems
RubyConfBD 2013 decouple, bundle and share with ruby gems nhm taveer hossain khan
 

Ähnlich wie Charla ruby nscodermad (20)

Developing Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyDeveloping Cocoa Applications with macRuby
Developing Cocoa Applications with macRuby
 
JRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and Ruby
 
ruby-cocoa
ruby-cocoaruby-cocoa
ruby-cocoa
 
ruby-cocoa
ruby-cocoaruby-cocoa
ruby-cocoa
 
10 Things you should know about Ruby
10 Things you should know about Ruby10 Things you should know about Ruby
10 Things you should know about Ruby
 
Initiation à Ruby on Rails
Initiation à Ruby on RailsInitiation à Ruby on Rails
Initiation à Ruby on Rails
 
Ruby On Rails pizza training
Ruby On Rails pizza trainingRuby On Rails pizza training
Ruby On Rails pizza training
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
Setup ruby
Setup rubySetup ruby
Setup ruby
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
 
RubyConf 2009
RubyConf 2009RubyConf 2009
RubyConf 2009
 
Why ruby
Why rubyWhy ruby
Why ruby
 
Week6
Week6Week6
Week6
 
JRubyConf 2009
JRubyConf 2009JRubyConf 2009
JRubyConf 2009
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)
 
cassandra
cassandracassandra
cassandra
 
Ruby :: Training 1
Ruby :: Training 1Ruby :: Training 1
Ruby :: Training 1
 
Adventures of java developer in ruby world
Adventures of java developer in ruby worldAdventures of java developer in ruby world
Adventures of java developer in ruby world
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
RubyConfBD 2013 decouple, bundle and share with ruby gems
RubyConfBD 2013   decouple, bundle and share with ruby gems RubyConfBD 2013   decouple, bundle and share with ruby gems
RubyConfBD 2013 decouple, bundle and share with ruby gems
 

Kürzlich hochgeladen

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Kürzlich hochgeladen (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Charla ruby nscodermad

  • 1. Ruby en OSX Thursday, September 22, 11
  • 2. Para que sirve Ruby • Rails Thursday, September 22, 11
  • 3. Fin • Gracias! • Espero que os haya gustado Thursday, September 22, 11
  • 4. Ah, pero hay mas? • Rspec / Cucumber • Sinatra • Capistrano • Capybara ( webtesting ) • EventMachine • FFI • nokogiri (HTML Parsing) • mocha (Mocking) • guard (FileSystem watching DSL) • .... y muchos mas!! Thursday, September 22, 11
  • 5. ¿Qué es Ruby? • Lenguaje interpretado • Creado por Yukihiro Matsumoto - Matz • Dinamico • “Reflexivo” • Orientado a objetos • Inspirado en Perl con un toque de Smalltalk Thursday, September 22, 11
  • 6. ¿Qué es Ruby? • El lenguaje no es estandar, se guia por especificaciones y por la implementación “guia” • MRI • JRuby • Rubinius • IronRuby • MacRuby Thursday, September 22, 11
  • 7. ¿Qué mola de Ruby? • Bloques a = [1,2,3,4,5,6,7,8,9,10] evens = a.select do |x| x % 2 == 0 end [2,4,6,8,10] doubles = a.map { |x| x + x } [2,4,6,8,10,12,14,16,18,20] Thursday, September 22, 11
  • 8. ¿Qué mola de Ruby? • Todo es un objeto 4.class >> Fixnum nil.class >> NilClass Fixnum.class >> Class Thursday, September 22, 11
  • 9. ¿Qué mola de Ruby? • Reapertura de clases class Fixnum def is_even? self % 2 == 0 end end 4.is_even? >> true Thursday, September 22, 11
  • 10. ¿Qué mola de Ruby? • Envio de mensajes, respond_to? 4.respond_to? :is_even? >> true 4.send :is_even? >> true dynamic_method = “is_even?” 4.send dynamic_method >> true Thursday, September 22, 11
  • 11. ¿Qué mola de Ruby? • Method missing class WeirdString < String def method_missing m, *args, &block self.send m.to_s.reverse end end t = WeirdString.new “PrUebA” t.esacnwod >> “prueba” Thursday, September 22, 11
  • 12. ¿Qué mola de Ruby? • procs / lambdas • eval • DSL • mixins • regexps Thursday, September 22, 11
  • 13. Ruby en OSX • Preinstalado desde Leopard • Version 1.8 • Scripting Bridge • RubyCocoa => MacRuby • Lenguaje soportado en applicaciones del MacAppStore Thursday, September 22, 11
  • 14. Ruby en OSX • MacRuby es la evolucion de RubyCocoa • Gracias a RubyCocoa / MacRuby • TOTAL INTEROPERABILIDAD CON OBJC • Todo lo de la diapositiva 4, es interoperable con nuestras clases Objective-C • Sustituto de AppleScript gracias al Scripting Bridge Thursday, September 22, 11
  • 15. MacRuby vs RubyCocoa • MacRuby es el futuro pero, • RubyCocoa viene instalado en OSX por defecto • MacRuby tiene que ser embebido en la aplicación • RubyCocoa -> 1.8 • MacRuby -> 1.9 • Mejoras velocidad, Threads, GC Thursday, September 22, 11
  • 16. MacRuby vs RubyCocoa • Sintaxis objc [[NSWindow alloc] initWithContentRect:styleMask:backing:defer:] RubyCocoa NSWindow.alloc.initWithContentRect_styleMask_backing_defer (...) MacRuby NSWindow.alloc.initWithContentRect( ..., styleMask:..., backing:..., defer... • Integración de clases en MacRuby • String, Number,... de Ruby -> NSString, NSNumber, ... • Elimina la necesidad de proxies • MacRuby compila contra LLVM -> Posibilidad de generar binarios nativos Thursday, September 22, 11
  • 17. MacRuby Objective-C @interface Book @property (retain, nonatomic) NSString *title - (void) addBookToLibrary:(NSString*) theLibrary - (void) insertPage: (Page*) thePage atPosition: (NSUInteger) position @end Ruby b = Book.new b.title = “My new book” b.addBookToLibrary “The Great Library” b.insertPage myPage, :atPosition => 4 - OR - b.insertPage myPage, atPosition: 4 Thursday, September 22, 11
  • 18. MacRuby framework 'Cocoa' win.title = "Hello NSCoder" class AppDelegate win.delegate = delegate def windowWillClose n exit button = NSButton.alloc.initWithFrame end [10,10,80,50] button.title = "Hello!" def hello sender button.target = delegate puts "Hello World!" button.action = :hello end end win.contentView.addSubview button delegate = AppDelegate.new win.display app = NSApplication.sharedApplication win.orderFrontRegardless app.delegate = delegate app.run win = NSWindow. alloc. initWithContentRect [200,300,100,100], :styleMask => NSTitledWindowMask :backing => NSBackingStoreBuffered, :defer => false Thursday, September 22, 11
  • 19. MacRuby • XCode (& InterfaceBuilder) compatible Thursday, September 22, 11
  • 20. MacRuby • Aplicaciones subidas al Mac AppStore • http://www.thumperapp.com/ • http://luckymac.com/ - Music Streaming • http://redwoodapp.com/ - Spotlight in the cloud Thursday, September 22, 11
  • 21. Scripting Bridge • Interfaz que puede dar un programa para facilitar la comunicación con él • Basado en Apple Events • Antes de SB, esos Apple Events se enviaban, o bien con Apple Script o con un código en Objective-C no muy sencillo • Con SB, los Apple Events se pueden enviar como un mensaje mas de Objective-C (Aparte de seguir usando AppleScript) • Y por ello, accesible desde Ruby (RubyCocoa) o PyObjC Thursday, September 22, 11
  • 22. SB y Ruby • Copiar la ruta del fichero seleccionado en el Finder al clipboard require 'osx/cocoa' include OSX OSX.require_framework 'ScriptingBridge' finder = SBApplication.applicationWithBundleIdentifier_ “com.apple.finder” fileURL = NSURL.URLWithString_ finder.selection.get[0].URL system "echo #{fileURL.path} | pbcopy” Thursday, September 22, 11
  • 23. SB y Ruby • Obtener las canciones de tu iTunes require 'osx/cocoa' include OSX OSX.require_framework 'ScriptingBridge' iTunes = SBApplication.applicationWithBundleIdentifier_ "com.apple.iTunes" iTunes.sources.each do |source| puts source.name source.playlists.each do |playlist| puts "-- #{playlist.name}" playlist.tracks.each do |track| puts "t-- #{track.name}" end end end Thursday, September 22, 11
  • 24. Fin • Gracias ;) • Use Ruby Thursday, September 22, 11