Skip to content

Latest commit

 

History

History

2015-12-munich-rubyshift

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

News Bulletin

My talk at Rubyshift Munich <2015-12-9>

The slides are built with org-isolide. (@kuanyui == the best)

All the mentioned links:

Advent of Code

http://adventofcode.com

Serious Math Flashback Warning

A present with dimensions 2x3x4 requires 2*6 + 2*12 + 2*8 = 52 square feet of wrapping paper plus 6 square feet of slack, for a total of 58 square feet.

A present with dimensions 1x1x10 requires 2*1 + 2*10 + 2*10 = 42 square feet of wrapping paper plus 1 square foot of slack, for a total of 43 square feet.

All numbers in the elves’ list are in feet. How many total square feet of wrapping paper should they order?

24 Pull Requests

24pullrequests.com/languages/ruby

images/24pullrequests.png

Upgrade your Passenger now

If your’re reading this today, you’re late. :D https://blog.phusion.nl/2015/12/07/cve-2015-7519/

  • X_User: Bob, X-Auth-Token: ValidMallory
  • HTTP_X_USER: Bob, HTTP_X_USER: Mallory

ROM 1.0

http://rom-rb.org/blog/2015/11/24/first-beta-of-rom-1-0-0-has-been-released/

1.0.0beta2

Command API

create_command = rom.command.create(user: :users) do |user|
  user.create(:books)
end

create_command.call(
  user: {
    name: "Jane",
    books: [{ title: "Book 1" }, { title: "Book 2" }]
  }
)

result.success?
result.failure?

Relation API: views

class Users < ROM::Relation[:sql]
  view(:listing, [:id, :name, :email]) do |*order_args|
    select(:id, :name, :email).order(*order_args)
  end
end

rom.relation(:users).listing(:name, :id)

Mappers

class MyMapper < ROM::Mapper
  attribute :address, from: [:city, :street, :zipcode] do |city, street, zipcode|
    "#{zipcode}, #{city}, #{street}"
  end
end

Hire Piotr!

images/piotr.png

(solnic.eu)

Minuteman 2.0

class SomethingController < ApplicationController
  def create
    track("something:create", current_user.id) if current_user
  end
  def index
    @current_events = events
  end
  def show
    @group = analytics.month("something:create") - analytics.month("free:users")
  end
end

http://elcuervo.github.io/minuteman/

Ruby 2.3

Christmas Ruby! http://nithinbekal.com/posts/ruby-2-3-features/

New Operator &.

puts "well" if user && user.exists?
puts "this is nice" if user&.exists?

Frozen Strings!

cone = 'chocolate'.freeze
cone << 'icecream!' # can't modify frozen String (RuntimeError)

Transition via frozen_string_literal: true

Fetch values from Enumerable

h = { foo: 1, bar: 2, baz: 3}
h.values_at(:foo, :boom)    #=> [1, nil]
h.fetch_values(:foo, :boom) #=> raise KeyError