Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Thessaloniki Ruby Meetup & Rubyzino #30

Thessaloniki Ruby Meetup & Rubyzino #30

Rubyzino + Introduction to Ruby on Rails on #thessrb #30. http://git.io/thessrb-30

Petros Amiridis

September 30, 2014
Tweet

More Decks by Petros Amiridis

Other Decks in Programming

Transcript

  1. Thessaloniki Ruby Meetup #30 Rubyzino Introduction to Ruby on Rails

    Questions Networking Halaruby thessrb meetup 30 - Introduction to Ruby on Rails 2
  2. Ruby 2.1.3 Released • Bugfixes • A garbage collection tweak

    that reduces memory consumption thessrb meetup 30 - Introduction to Ruby on Rails 7
  3. Ruby — Sonic Pi A free sound synthesizer for live

    coding designed to support computing and music lessons within schools. Use code to compose and perform in classical and contemporary styles ranging from Canons to Dubstep. Sonic PI Website thessrb meetup 30 - Introduction to Ruby on Rails 8
  4. Ruby — Sonic Pi, Haunted Bells loop do sample :perc_bell,

    rate: (rrand 0.125, 1.5) sleep rrand(0, 2) end thessrb meetup 30 - Introduction to Ruby on Rails 9
  5. Ruby — Sonic Pi, Acid Walk in_thread do use_synth :fm

    sleep 2 loop do 28.times do sample :drum_bass_hard, amp: 0.8 sleep 0.25 play :e2, release: 0.2 sample :elec_cymbal, rate: 12, amp: 0.6 sleep 0.25 end sleep 4 end end use_synth :tb303 with_fx :reverb do |rev| loop do control rev, mix: rrand(0, 0.3) with_fx :slicer, phase: 0.125 do sample :ambi_lunar_land, sustain: 0, release: 8, amp: 2 end control rev, mix: rrand(0, 0.6) r = rrand(0.05, 0.3) 64.times do play chord(:e3, :minor).choose, release: r, cutoff: rrand(50, 90), amp: 0.5 sleep 0.125 end control rev, mix: rrand(0, 0.6) r = rrand(0.1, 0.2) with_synth :prophet do 32.times do sleep 0.125 play chord(:a3, :m7).choose, release: r, cutoff: rrand(40, 130), amp: 0.7 end end control rev, mix: rrand(0, 0.6) r = rrand(0.05, 0.3) 32.times do play chord(:e3, :minor).choose, release: r, cutoff: rrand(110, 130), amp: 0.4 sleep 0.125 end control rev, mix: rrand(0, 0.6) with_fx :echo, phase: 0.25, decay: 8 do 16.times do play chord([:e2, :e3, :e4].choose, :m7).choose, release: 0.05, cutoff: rrand(50, 129), amp: 0.5 sleep 0.125 end end end end thessrb meetup 30 - Introduction to Ruby on Rails 10
  6. Rails 4.2.0 Beta Active Job: Write once in Active Job,

    run on many different queuing systems Adequate Record: Twice as fast Active Record common queries, Go Web Console: IRB console available in the browser by visiting /console, out of Google Summer of Code. thessrb meetup 30 - Introduction to Ruby on Rails 12
  7. Europe Code Week 2014 • thessrb/meetup#27 • Ruby4Kids • KidsRuby

    thessrb meetup 30 - Introduction to Ruby on Rails 14
  8. Jobs — .NET web developer wanted by Atlantis Engineering •

    Thessaloniki based company • Develops web and desktop apps in .NET for the Industry thessrb/meetup#28 thessrb meetup 30 - Introduction to Ruby on Rails 16
  9. Jobs — Experienced frond- end developer wanted by Ordereze •

    US based company with offices in Thessaloniki for software development • Reputation management for restaurants thessrb/meetup#31 thessrb meetup 30 - Introduction to Ruby on Rails 17
  10. RSVP question(s) Are you using Ruby on Rails to develop

    web applications? thessrb meetup 30 - Introduction to Ruby on Rails 19
  11. Ruby on Rails, or simply Rails, is an open source

    web application framework written in Ruby. thessrb meetup 30 - Introduction to Ruby on Rails 21
  12. Created by David H. Hansson or DHH Extracted from Basecamp,

    a project management tool by 37signals. thessrb meetup 30 - Introduction to Ruby on Rails 22
  13. History Part I • Released as open source in July

    2004, with commit rights in Feb 2005 • August 2006 Apple announced it would ship with Mac OS X v10.5 Leopard • The release was done in October 2007 • 2.3 was a major overhaul in March 2009 • Merb was launched in December 2008, and merged with Rails 3.0 thessrb meetup 30 - Introduction to Ruby on Rails 23
  14. History Part II • Rails 3.1 August 2011, CoffeeScript &

    Sass, JQuery default JS lib Rails 4.1 April 2014, Spring, Variants, Enums, Mailer previews, secrets.yml thessrb meetup 30 - Introduction to Ruby on Rails 24
  15. My Story • 2007 • Created a task management application

    for air conditioning service crews • Runs today as we speak on a very old RoR version ! thessrb meetup 30 - Introduction to Ruby on Rails 25
  16. MVC in Ruby on Rails • Model • Controller •

    Views thessrb meetup 30 - Introduction to Ruby on Rails 27
  17. Convention over Configuration Example • database table: orders with the

    primary key called id I know by convention that I will have: • model: order • controller: orders_controller • views: new, edit etc. for each action in the controller thessrb meetup 30 - Introduction to Ruby on Rails 29
  18. Model A model in RoR maps: • to a table

    in a database (mostly) • and a Ruby file thessrb meetup 30 - Introduction to Ruby on Rails 30
  19. A Controller • responds to external requests from the web

    server to the application by determining which view file to render. • queries one or more models directly for info to pass on to the view. • may provide one or more actions. • An action describes how to respond to a request. thessrb meetup 30 - Introduction to Ruby on Rails 31
  20. An Action • will be accessible if a route is

    mapped to it Rails • encourages the usage of RESTful routes, with actions such as: create, new, edit, update, destroy, show, and index. • routes.rb thessrb meetup 30 - Introduction to Ruby on Rails 32
  21. A View • is an erb file, which is compiled

    to HTML at run-time. • Many other templating systems can be used for views thessrb meetup 30 - Introduction to Ruby on Rails 33
  22. View Example <h1>New Article</h1> <%= form_for :article do |f| %>

    <p> <%= f.label :title %><br> <%= f.text_field :title %> </p> <p> <%= f.label :text %><br> <%= f.text_area :text %> </p> <p> <%= f.submit %> </p> <% end %> thessrb meetup 30 - Introduction to Ruby on Rails 34