Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Update 7 Oct 2010: | |
| # - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
| # the WebSocket protocol implementation in the cramp gem does not work | |
| # well with Chrome's (newer) WebSocket implementation. | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
| ### | |
| Module dependencies | |
| ### | |
| require.paths.unshift "#{__dirname}/lib/support/express-csrf/" | |
| require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/" | |
| express = require 'express' | |
| app = module.exports = express.createServer() | |
| RedisStore = require 'connect-redis' |
| # In general, there are many places in the file where you can leave off the parens in function calls, if you like. | |
| unless typeof exports is "undefined" # `unless ... else` reads poorly in English. Better to stick to `if ... else`. | |
| Spine = exports | |
| else | |
| Spine = @Spine = {} | |
| Spine.version = "0.0.4" | |
| $ = Spine.$ = @jQuery || @Zepto || -> arguments[0] # In Coffee, `or` is preferred over `||`. |
| class Avatar < ActiveRecord::Base | |
| attr_accessor :content_type, :original_filename, :image_data | |
| before_save :decode_base64_image | |
| has_attached_file :image, | |
| PAPERCLIP_CONFIG.merge( | |
| :styles => { | |
| :thumb => '32x32#', | |
| :medium => '64x64#', |
| # 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 |
| wget "ftp://ftp.cwru.edu/pub/bash/readline-6.2.tar.gz" | |
| tar xf readline-6.2.tar.gz | |
| cd readline-6.2 | |
| ./configure --prefix=$HOME/.rbenv/versions/1.9.3-p125 | |
| make -j 2 | |
| make install | |
| cd .. | |
| wget "http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz" | |
| tar xf yaml-0.1.4.tar.gz |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| ENV["RAILS_ENV"] = "test" | |
| require File.expand_path('../../config/environment', __FILE__) | |
| require 'rubygems' | |
| gem 'minitest' | |
| require 'minitest/autorun' | |
| require 'action_controller/test_case' | |
| require 'miniskirt' | |
| require 'capybara/rails' |
| // Example 1 | |
| mediator.name = 'Doug'; | |
| mediator.subscribe('nameChange', function(arg){ | |
| console.log(this.name); | |
| this.name = arg; | |
| console.log(this.name); | |
| }); | |
| mediator.publish('nameChange', 'Jorn'); |
As configured in my dotfiles.
start new:
tmux
start new with session name: