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

Building Do on Heroku

Building Do on Heroku

Gopal Patel (@nixme) presents "Building Do on Heroku"

Austin Bales

March 15, 2012
Tweet

More Decks by Austin Bales

Other Decks in Programming

Transcript

  1. ↑ ↓ RUBY Heroku Postgres, New Relic, Logplex… ADD-ONS iOS

    Android Desktop Widgets CoffeeScript + Backbone.js WEB APPS NATIVE CLIENTS CUSTOM UI FRAMEWORK
  2. class Note include SoftDelete def initialize(title = 'Untitled') @id =

    Sequence.next_id @title = title @body = 'Enter your note...' end def print puts "#{@id}: #{@title} - #{@body}" end end
  3. $('.name').bind('change', function(event) { $.ajax({ type: "PUT", url: "/names/" + $(event.target).attr('context_id'),

    data: { value: $(event.target).attr('data-value') }, success: function(response) { statusIcon = $('.name + .status'); statusIcon.show(); setTimeout(function() { statusIcon.hide(); }, 5000); }, error: function(response) { console.log(response); $('.name').attr('disabled', true); } }); }); $('.name_delete').click(function(event) { event.preventDefault(); id = $(event.target).attr('context_id'); if (confirm('Are you sure?')) { $.ajax({ type: "DELETE", url: "/names/" + id, success: function(response) { $(".row-" + id).remove(); $(".row-" + (id + 1)).focus(); },
  4. Backbone.Events binds and triggers Backbone.Router front-end routing, pushState Backbone.View controllers

    for your UI Backbone.Model domain objects Backbone.Collection model sets
  5. var object = {}; _.extend(object, Backbone.Events); object.on("alert", function(msg) { alert("Triggered

    " + msg); }); object.trigger("alert", "an event"); Backbone.Events
  6. var Note = Backbone.Model.extend({ initialize: function() {…}, coordinates: function() {…},

    }); var note = new Note({ title: "Today's Dinner", body: … }); note.on("error", function(model, error) {…}); note.save(); Backbone.Model
  7. var DocumentRow = Backbone.View.extend({ tagName: "li", className: "document-row", events: {

    "click .icon": "open", "click .button.edit": "openEditDialog", "click .button.delete": "destroy" }, render: function() {…} }); Backbone.View
  8. number = 42 flag = true greeting = 'world' var

    flag, greeting, number; number = 42; flag = true; greeting = 'world';
  9. square = (x) -> x * x cube = (x)

    -> x * square x @customer = new Customer $('.cart').on 'click', (event) => @customer.buy event.target var cube, square, _this = this; square = function(x) { return x * x; }; cube = function(x) { return x * square(x); }; this.customer = new Customer; $('.cart').on('click', function(event) { return _this.customer.buy(event.target); });
  10. kids = brother: name: "Max" age: 11 sister: name: "Ida"

    age: 9 var kids; kids = { brother: { name: "Max", age: 11 }, sister: { name: "Ida", age: 9 } };
  11. for own view, element of views $(element).remove() view.removed = true

    var element, view, __hasProp = Object.prototype.hasOwnProperty; for (view in views) { if (!__hasProp.call(views, view)) continue; element = views[view]; $(element).remove(); view.removed = true; }
  12. web: unicorn -p $PORT -c ./config/unicorn.rb worker: rake resque:work QUEUE=notifications,...

    workerprovisioning: rake resque:work QUEUE=provisioning,... scheduler: rake resque:scheduler VERBOSE=true Procfile
  13. Design HOW WE DO User Experience is #1 Engineering +

    Design = Like Design is a process / conversation
  14. Design HOW WE DO User Experience is #1 Engineering +

    Design = Like Design is a process / conversation We work together. Everyone commits.
  15. WHAT WAS THIS TALK ABOUT? API First Expressive Languages Modern

    Browsers Continuous Deployment Loosely-coupled Code Tightly-coupled Team
  16. THE PANEL Manav Monga Product Guy. @xmanav Bing Yang Product

    Guy. @bsbox David Yung Developer. @azethoth Austin Bales Designer. @arbales http://pris.ma/9M