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

Ruby at GitHub

Ruby at GitHub

Brandon Keepers

April 05, 2013
Tweet

More Decks by Brandon Keepers

Other Decks in Programming

Transcript


  1. RUBY at
    frequently asked questions about
    Brandon Keepers • @bkeepers

    View full-size slide

  2. Hello, I am @bkeepers.

    View full-size slide

  3. Contrary to popular belief,
    I do not keep bees.

    View full-size slide

  4. Speaker Deck

    View full-size slide

  5. Frequently Asked Questions:
     Which languages are used at GitHub?
     Where is Ruby not used?
     Why Ruby?
     Which libraries do you use?
     How do you handle updates?

    View full-size slide

  6.  Which languages are used at GitHub?

    View full-size slide

  7.  602 github.com/github
     228 inactive
     42 forks
     7 ignored
     342
    * 602 - 228 - 42 - 7 = 325
    some repos met multiple conditions

    View full-size slide

  8. Excluding:
    github.com/libgit2
    github.com/boxen
    github.com/play
    github.com/[staff]

    View full-size slide

  9. 58% Ruby
    JavaScript
    11%
    Objective-C 8%
    Shell 5%
    CoffeeScript
    5%
    Other 6%
    C
    4%
    C#
    3%
    Internal GitHub Projects
    by primary language
    342
    repositories

    View full-size slide

  10. 33%
    Ruby
    JavaScript
    15%
    Objective-C
    13%
    Puppet
    3%
    CoffeeScript 7%
    Other 6%
    15%
    C
    C#
    6%
    Java
    2%
    342
    repositories
    Internal GitHub Projects
    by total bytes

    View full-size slide

  11. – @rtomayko
    “GitHub isn’t a Rails shop,
    it’s not even a Ruby shop.
    It’s a Unix shop.”

    View full-size slide

  12.  Where is Ruby not used?

    View full-size slide

  13.    

    View full-size slide

  14. written in Objective-C

    View full-size slide

  15. written in C#

    View full-size slide

  16. written in Java

    View full-size slide

  17.  Numerous iOS apps
    written in Objective-C

    View full-size slide

  18. HUBOT
    written in CoffeeScript

    View full-size slide

  19.  unix utilities
    written mostly in C

    View full-size slide

  20. …but what about Phone Gap?
    SL4A?
    Py4A?
    py2app?

    View full-size slide

  21. In France, you can
    speak English,
    but it will be obvious that you are
    not French.

    View full-size slide

  22. …but what about Ruby Motion?

    View full-size slide

  23. The hardest part of learning iOS Development
    3.53% Objective-C syntax
    iOS APIs 96.47%*
    *These precise numbers may not be accurate.

    View full-size slide

  24.  Why Ruby?

    View full-size slide

  25.  “no parents”

    View full-size slide

  26. Why do you drive a Toyota?

    View full-size slide

  27. practicality

    View full-size slide

  28. Ruby is not a

    View full-size slide

  29. Ruby is not a

    View full-size slide

  30. Ruby is not a

    View full-size slide

  31.  What libraries do you use?

    View full-size slide

  32. 153  Gemfile

    View full-size slide

  33. Sinatra or Rails?

    View full-size slide

  34. Sinatra
    51 projects
    Rails
    30 projects
    9 projects
    both

    View full-size slide

  35. 8 MB
    both
    Rails
    12.1 MB
    Sinatra
    10.75MB

    View full-size slide

  36. test/unit, rspec or minitest?

    View full-size slide

  37. Internal GitHub Projects
    test frameworks
    45% test/unit
    rspec
    43%
    minitest
    13%

    View full-size slide

  38.  How do you handle updates?

    View full-size slide

  39.  feature flags

    View full-size slide

  40. module FeatureFlags
    def preview_features?
    staff?
    end
    def time_travel_enabled?
    preview_features?
    end
    end
    app/concerns/feature_flags.rb

    View full-size slide

  41. class User < ActiveRecord::Base
    include FeatureFlags
    end
    app/models/user.rb
    module FeatureFlags
    def preview_features?
    staff?
    end
    def time_travel_enabled?
    preview_features?
    end
    end
    app/concerns/feature_flags.rb

    View full-size slide

  42. class User < ActiveRecord::Base
    include FeatureFlags
    end
    app/models/user.rb
    module FeatureFlags
    def preview_features?
    staff?
    end
    def time_travel_enabled?
    preview_features?
    end
    end
    app/concerns/feature_flags.rb
    class ApplicationController
    flags = FeatureFlags.public_instance_methods
    delegate *flags, :to => :current_user, :allow_nil => true
    helper_method *flags
    end
    app/controllers/application_controller.rb

    View full-size slide

  43. <%- if time_travel_enabled? -%>
    <%= link_to 'Time Travel', time_travel_path %>
    <%- end -%>
    app/views/home/index.html.erb

    View full-size slide

  44. <%- if time_travel_enabled? -%>
    <%= link_to 'Time Travel', time_travel_path %>
    <%- end -%>
    app/views/home/index.html.erb
    class TimeTravelController < ApplicationController
    before_filter :ensure_time_travel_enabled
    def ensure_time_travel_enabled
    not_found unless time_travel_enabled?
    end
    end
    app/controllers/time_travel_controller.rb

    View full-size slide

  45. module FeatureFlags
    def preview_features?
    staff?
    end
    def time_travel_enabled?
    preview_features?
    true
    end
    end
    app/concerns/feature_flags.rb
    Launch Day

    View full-size slide

  46.  github.com/jnunemaker/flipper
     github.com/jamesgolick/rollout

    View full-size slide

  47.  Ruby 1.9 2.0

    View full-size slide

  48. The path to 1.9

    View full-size slide

  49. 1. Run CI against 1.8 & 1.9
    The path to 1.9

    View full-size slide

  50. 1. Run CI against 1.8 & 1.9
    2.?
    3.Profit
    The path to 1.9

    View full-size slide

  51. The path to 1.9
    1. Run CI against 1.8 & 1.9
    2.@tmm1
    3.Profit

    View full-size slide

  52. 1. Run CI against 1.8, 1.9 & 2.0
    2.@tmm1
    3.Profit
    The path to 2.0

    View full-size slide

  53. – @tmm1
    “Compared to REE, average cpu
    response time for browser requests
    last week was reduced by over
    25ms. The 99th percentile cpu
    response time for browser requests
    was reduced by over 125ms!”

    View full-size slide

  54.  github.com/github/rails

    View full-size slide

  55.  backport in progress

    View full-size slide

  56.  Other Questions?
    @bkeepers
    https://speakerdeck.com/bkeepers/ruby-at-github

    View full-size slide