Eventually platforms outgrow the single-source-tree model and become distributed systems. A common pattern in these distributed systems is distributed composition via event buffering. Here we motivate and describe this event buffering pattern.
require 'faye' | |
require 'json' | |
require 'rack' | |
require 'cgi' | |
module Faye | |
class SyncMiddleware | |
include ::Faye::Logging |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>(null)_Other</key> | |
<string>rgba(0.866667,0.031373,0.023529,1.0)</string> | |
<key>(null)_Spaces</key> | |
<string>rgba(0.498039,0.498039,0.498039,1.0)</string> | |
<key>BackgroundColor</key> | |
<string>rgba(0.122179,0.122179,0.122179,1.0)</string> |
""" | |
usage : simple_client.py torrent_file | |
""" | |
#!/usr/bin/env python | |
# Copyright Arvid Norberg 2008. Use, modification and distribution is | |
# subject to the Boost Software License, Version 1.0. (See accompanying | |
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
# with modifications by Fabian Pedregosa <[email protected]> | |
# October 2011 |
// Require libraries | |
var os = require("os"); | |
var fs = require("fs"); | |
var readline = require("readline"); | |
var cluster = require("cluster"); | |
var express = require("express"); | |
var site = express(); | |
// Var up, bro | |
var i, read; |
bootstrap-tooltip.js | |
bootstrap-popover.js | |
bootstrap-alert.js | |
bootstrap-button.js | |
bootstrap-carousel.js | |
bootstrap-collapse.js | |
bootstrap-dropdown.js | |
bootstrap-modal.js | |
bootstrap-scrollspy.js | |
bootstrap-tab.js |
#Here's what I did to get to the point where I'm at: | |
#-Install Ubuntu 11.10 | |
#-Get all available updates | |
#-Add the VirtualBox add-ons and video driver | |
#-Set up SSH (for the SCP at the end) | |
# | |
# I have done nothing else to this virtual machine. | |
# On my iPhone, I set the DNS server to 192.168.2.131 (the IP of the virtual machine) |
# coding: utf-8 | |
require 'sinatra' | |
set server: 'thin', connections: [] | |
get '/' do | |
halt erb(:login) unless params[:user] | |
erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
end | |
get '/stream', provides: 'text/event-stream' do |
(function(d) { | |
var dl = d.createElement('a'); | |
dl.innerText = 'Download MP3'; | |
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1]; | |
dl.download = d.querySelector('em').innerText+".mp3"; | |
d.querySelector('.primary').appendChild(dl); | |
dl.style.marginLeft = '10px'; | |
dl.style.color = 'red'; | |
dl.style.fontWeight = 700; | |
})(document); |
REAL WORLD SCENARIO (blinking lights)
Mr. Tom Dev wants to remote pair program with Mr. Todd Programmer. Tom is in New York, Todd is in San Francisco. They’re working on yet another blog written in Ruby. Tom fires up Rubymine, Todd fires up TextMate.
Todd’s editor quickly alerts him that he is connected with Tom and that their projects are out of sync. The plugin gives them each the option of using Tom’s file versions, Todd’s files, or performing a git pull request. They both do a git pull and are back in sync.
Todd quickly opens the User model in Rubymine with cmd-shift-N and Todd quickly sees that same file opened in Textmate. Todd then highlights a method that has been failing a test and Tom sees that highlight. Todd makes the change to the file, clicks cmd-s, and that file change is synced over to Tom.
Tom thought there was a secondary change needed in the Profile model, so he hits cmd-T, opens the Profile model and Todd sees that file opened in Rubymine. Todd tells Tom that he’s smoking catn