This document provides an introduction and overview of the Ruby programming language. It discusses Ruby's history and creator Yukihiro Matsumoto. It demonstrates basic Ruby syntax like integers, floats, strings, variables, methods, and flow control. It also covers Ruby classes, objects, and the interactive Ruby shell IRB. The document then introduces common Ruby libraries and frameworks like Sinatra for web development and Nokogiri for parsing HTML/XML. It includes code examples to demonstrate basic usage.
Part of a series of talk to help you write your first Perl 6 program today. So its basic syntax and concepts of its object orientation and a comparison to the widely used P5 OO system Moose which is similar by no accident.
Roles are an excellent object-oriented tool both for allomorphism and for
reuse.
Roles facilitate allomorphism by favoring "does this object do X" versus "is
this object a subclass of X". You often care more about capability than
inheritance. In a sense, roles encode types better than inheritance.
Roles also provide an excellent faculty for reuse. This effectively eliminates
multiple inheritance, which is often the only solution for sharing code between
unrelated classes.
Roles can combine with conflict detection. This eliminates accidental shadowing
of methods that is painful with multiple inheritance and mixins.
Parameterized roles (via MooseX::Role::Parameterized) improve the reusability
of roles by letting each consumer cater the role to its needs. This does
sacrifice some allomorphism, but there are ways to restore it.
PhpSpec is a SpecBDD tool that enables you to use a TDD workflow that can transform the way you write PHP. In this session we will look at the TDD workflow and see how PhpSpec can be used to speed up your development; add regression safety, and improve your object-oriented design.
Part of a series of talk to help you write your first Perl 6 program today. So its basic syntax and concepts of its object orientation and a comparison to the widely used P5 OO system Moose which is similar by no accident.
Roles are an excellent object-oriented tool both for allomorphism and for
reuse.
Roles facilitate allomorphism by favoring "does this object do X" versus "is
this object a subclass of X". You often care more about capability than
inheritance. In a sense, roles encode types better than inheritance.
Roles also provide an excellent faculty for reuse. This effectively eliminates
multiple inheritance, which is often the only solution for sharing code between
unrelated classes.
Roles can combine with conflict detection. This eliminates accidental shadowing
of methods that is painful with multiple inheritance and mixins.
Parameterized roles (via MooseX::Role::Parameterized) improve the reusability
of roles by letting each consumer cater the role to its needs. This does
sacrifice some allomorphism, but there are ways to restore it.
PhpSpec is a SpecBDD tool that enables you to use a TDD workflow that can transform the way you write PHP. In this session we will look at the TDD workflow and see how PhpSpec can be used to speed up your development; add regression safety, and improve your object-oriented design.
Presented at Web Unleashed on September 16-17, 2015 in Toronto, Canada
More info at www.fitc.ca/webu
Why TypeScript?
with Jeff Francis
OVERVIEW
TypeScript is a type-checked superset of JavaScript that benefits medium-sized to complex JavaScript projects. Why would you want to learn a new language, instead of another JavaScript framework? You have all this existing JavaScript code, so how can you adopt something new without throwing the old stuff out?
This session is about the benefits of using TypeScript on top of JavaScript in your projects, and demonstrate step by step ways of migrating an existing JavaScript project to TypeScript. We will dive into code generated by the compiler and look at resources and tools that make working in TypeScript a pleasurable experience.
OBJECTIVE
To understand when it’s a good idea to use TypeScript.
TARGET AUDIENCE
JavaScript developers.
ASSUMED AUDIENCE KNOWLEDGE
Intermediate JavaScript experience.
FIVE THINGS AUDIENCE MEMBERS WILL LEARN
The basics of TypeScript – types, classes, modules, and functions
How TypeScript’s design makes getting started simple and helps projects
What compiled TypeScript looks like and how to debug
What tools can help take advantage of TypeScript’s type information
How to migrate a JavaScript project to TypeScript
Full-day tutorial for the dutch php conference 2011 giving a very quick tour around all the various areas of the ZCE syllabus and some tips on the exam styles
The Perl API for the Mortally Terrified (beta)Mike Friedman
A brief introduction to get you started in working with Perl's internal API. This presentation is a work in progress.
Code samples: http://github.com/friedo/perl-api-terror
PHP 8.1 brings Enums, one of the most requested features in PHP.
Enums, or Enumerations, allow creating strict and type-safe structures for fixed values. An Enum structure can hold a number of values that can also be backed with integer or string values.
In this comprehensive session, we will discover what Enums are, why they are useful, how to apply them on our applications, and things to watch out for when using Enums.
PHP 8.0 is expected to be released by the end of the year, so it’s time to take a first look at the next major version of PHP. Attributes, union types, and a just-in-time compiler are likely the flagship features of this release, but there are many more improvements to be excited about. As PHP 8.0 is a major version, this release also includes backwards-incompatible changes, many of which are centered around stricter error handling and more type safety.
This talk will discuss new features already implemented in PHP 8, backwards-compatibility breaks to watch out for, as well as some features that are still under discussion.
Presented at Web Unleashed on September 16-17, 2015 in Toronto, Canada
More info at www.fitc.ca/webu
Why TypeScript?
with Jeff Francis
OVERVIEW
TypeScript is a type-checked superset of JavaScript that benefits medium-sized to complex JavaScript projects. Why would you want to learn a new language, instead of another JavaScript framework? You have all this existing JavaScript code, so how can you adopt something new without throwing the old stuff out?
This session is about the benefits of using TypeScript on top of JavaScript in your projects, and demonstrate step by step ways of migrating an existing JavaScript project to TypeScript. We will dive into code generated by the compiler and look at resources and tools that make working in TypeScript a pleasurable experience.
OBJECTIVE
To understand when it’s a good idea to use TypeScript.
TARGET AUDIENCE
JavaScript developers.
ASSUMED AUDIENCE KNOWLEDGE
Intermediate JavaScript experience.
FIVE THINGS AUDIENCE MEMBERS WILL LEARN
The basics of TypeScript – types, classes, modules, and functions
How TypeScript’s design makes getting started simple and helps projects
What compiled TypeScript looks like and how to debug
What tools can help take advantage of TypeScript’s type information
How to migrate a JavaScript project to TypeScript
Full-day tutorial for the dutch php conference 2011 giving a very quick tour around all the various areas of the ZCE syllabus and some tips on the exam styles
The Perl API for the Mortally Terrified (beta)Mike Friedman
A brief introduction to get you started in working with Perl's internal API. This presentation is a work in progress.
Code samples: http://github.com/friedo/perl-api-terror
PHP 8.1 brings Enums, one of the most requested features in PHP.
Enums, or Enumerations, allow creating strict and type-safe structures for fixed values. An Enum structure can hold a number of values that can also be backed with integer or string values.
In this comprehensive session, we will discover what Enums are, why they are useful, how to apply them on our applications, and things to watch out for when using Enums.
PHP 8.0 is expected to be released by the end of the year, so it’s time to take a first look at the next major version of PHP. Attributes, union types, and a just-in-time compiler are likely the flagship features of this release, but there are many more improvements to be excited about. As PHP 8.0 is a major version, this release also includes backwards-incompatible changes, many of which are centered around stricter error handling and more type safety.
This talk will discuss new features already implemented in PHP 8, backwards-compatibility breaks to watch out for, as well as some features that are still under discussion.
For a demo to some colleagues, I created a Ruby on Rails demonstration. This presentation is used to show concepts, and illustrate the case. See http://changelos.com/2010/06/08/demoing-ruby-on-rails/ for the full story.
A linguagem de programação Ruby - Robson "Duda" Sejan Soares DornellesTchelinux
Sobre o palestrante: Formado na UFPel no início do ano corrente, trabalhou com desenvolvimento de hardware para TV digital durante a graduação. Entretanto, sempre foi apaixonado por belas linguagens de programação, e destas, Ruby é a que mais se destaca. Atualmente aguarda o mês de junho, quando começa a trabalhar na ThoughtWorks, em Porto Alegre.
A few techniques for everyday Ruby hacking
Touching on the following topics:
DRY Assignment
Ternary operator
Bang bang
Conditional assignment
Parallel assignment
Multiple return
Implied begin
Exception lists
Symbol to Proc
MapReduce
Regex captures
tap
sprintf
case equality
Splat Array
Splat args
blank?
present?
presence
truncate
try
in?
Delegation
delegate
Memoization
memoize
alias_method_chain
class_attribute
HashWithIndifferentAccess
18. GETS
puts 'Hello there, and what's your name?'
name = gets.chomp
puts 'Your name is ' + name + '? What a lovely name!'
puts 'Pleased to meet you, ' + name + '. :)'
29. each method
languages = ['Ruby', 'Javascript', 'Perl']
languages.each do |lang|
puts 'I love ' + lang + '!'
end
# I Love Ruby
# I Love Javascript
# I Love Perl
30. iterator
• while each
(iterator)
• do .... end each
( code block)
31. 3.times do
puts 'Good Job!'
end
# Good Job!
# Good Job!
# Good Job!
32. code block
closure
{ puts "Hello" } # block
do
puts "Blah" # block
puts "Blah"
end
33. code block
#
a = [ "a", "b", "c", "d" ]
b = a.map {|x| x + "!" }
puts b.inspect
# ["a!", "b!", "c!", "d!"]
#
b = [1,2,3].find_all{ |x| x % 2 == 0 }
b.inspect
# [2]
34. code block
file = File.new("testfile", "r")
# ...
file.close
File.open("testfile", "r") do |file|
# ...
end
#
59. require 'rubygems'
require 'nokogiri'
text = "<html>
<ul>
<li>FOOOBARRR</li>
<li>AAAAACCCCC</li>
<ul>
</html>"
doc = Nokogiri::HTML(text)
puts doc.css('li').size # 2
doc.css('li').each do |item|
puts item.content
end
# FOOOBARRR
# AAAAACCCCC
60. sinatra+nokogiri
# myapp.rb
require 'rubygems'
require 'sinatra'
require 'nokogiri'
require 'open-uri'
get '/' do
erb :index
end
post '/query' do
html = open( params[:keyword] ).read
doc = Nokogiri::HTML(html)
@links = doc.css('a')
erb :query
end