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

Belfast Ruby - Interesting things from the GitHub codebase

Coby Chapple
November 12, 2014

Belfast Ruby - Interesting things from the GitHub codebase

As part of Break (http://breakconf.org), I gave a talk at the Belfast Ruby (http://belfastruby.com/) meetup talking about a few interesting things from the GitHub codebase.

Coby Chapple

November 12, 2014
Tweet

More Decks by Coby Chapple

Other Decks in Programming

Transcript

  1. A selection of interesting* things I’ve learnt doing design at

    GitHub. *Actual levels of interestingness may vary.
  2. • Responsive is better than fast. • It’s not fully

    shipped until it’s fast. • Anything added dilutes everything else. • Practicality beats purity. • Approachable is better than simple. • Mind your words, they are important. • Speak like a human. • Half measures are as bad as nothing at all. • Encourage flow. • Non-blocking is better than blocking. • Favor focus over features. • Avoid administrative distraction. • Design for failure. • Keep it logically awesome.
  3. GitHub isn’t a Rails shop. It’s not even a Ruby

    shop. It’s a Unix shop. — @rtomayko “
  4. <% if current_repository.pushable_by?(current_user) %> <% if pull_request && pull_request.head_ref_deletable_by?(current_user) &&

    branch != current_repository.default_branch %> <%= link_to "Delete branch", … %> <% end %> <% end %> <% if view.can_delete_branch? %> <%= link_to "Delete branch", … %> <% end %>
  5. require "dat/science" class YourApp::Widget def allows?(user) experiment = Dat::Science::Experiment.new "widget-permissions"

    do |e| e.control { model.check_user(user).valid? } e.candidate { user.can? :read, model } end experiment.run end end
  6. require "dat/science" class YourApp::Widget include Dat::Science def allows?(user) science "widget-permissions"

    do |e| e.control { model.check_user(user).valid? } e.candidate { user.can? :read, model } end end end
  7. --- # Areas of Responsibility in the github/github codebase 2fa:

    name: "Two-Factor Authentication" teams: - "@github/2fa" abilities: name: "Abilities" teams: - "@github/abilities" - "@github/abilibuddies" api: name: "API / OAuth" teams: - "@github/api" - "@github/oauth-of-tomorrow"