brew uninstall --ignore-dependencies node icu4c
brew install node
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "os" | |
| "os/signal" | |
| "strconv" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package main | |
| import ( | |
| "context" | |
| "flag" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "os" | |
| "os/signal" | 
This is an example of how I combine interaction/service classes with Wisper event broadcasting in Rails.
In this example, I show a UsersController#create API, a corresponding service object, and all the test code/listeners to make it all happen.
The outcome is:
- Concepts in your system ("Signing up a user", "Creating an order") have a single entry point in your codebase, vs. making raw ActiveRecord calls to object.savein dozens of places.
- Since your concept has one entry point (the service class), you can easily grepfor usage of it.
- Stupid easy to attach listeners to the service class
- All event listeners are very small and easily unit tested
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** @jsx React.DOM */ | |
| var Comment = React.createClass({ | |
| render: function () { | |
| return ( | |
| <div className="comment"> | |
| <h2 className="commentAuthor"> | |
| {this.props.author} | |
| </h2> | |
| {this.props.comment} | |
| </div> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * An AngularJS directive for Dropzone.js, http://www.dropzonejs.com/ | |
| * | |
| * Usage: | |
| * | |
| * <div ng-app="app" ng-controller="SomeCtrl"> | |
| * <button dropzone="dropzoneConfig"> | |
| * Drag and drop files here or click to upload | |
| * </button> | |
| * </div> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function testGA() { | |
| doTrack_('UA-NNNNNN-1', 'YORR_KEY', 'YOUR_SERVICE', 'YOUR_ID'); | |
| } | |
| function doTrack_(utmac, key, service, user) { | |
| var path = '/' + key + '/' + service + '/' + user; | |
| try { | |
| var host = 'YOUR_HOST'; | |
| var utmGifLocation = "http://www.google-analytics.com/__utm.gif"; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | set :stage, 'production' | |
| set :shared_children, shared_children << 'tmp/sockets' | |
| puma_sock = "unix://#{shared_path}/sockets/puma.sock" | |
| puma_control = "unix://#{shared_path}/sockets/pumactl.sock" | |
| puma_state = "#{shared_path}/sockets/puma.state" | |
| puma_log = "#{shared_path}/log/puma-#{stage}.log" | |
| namespace :deploy do | |
| desc "Start the application" | 
Because loading gems can take longer than you think
Now available as a gem - get it here
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | require 'rubygems' | |
| require 'pg' | |
| require 'yaml' | |
| class DB | |
| def initialize(debug = true) | |
| @conn = PG::Connection.open() | |
| @debug = debug | |
| end | 
NewerOlder