View upgrade_postgres.txt
# Orignal instructions here:
1. Stop postgresql
$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
2. Install postgresql 9.5
$ brew update && brew upgrade postgresql
3. Make a new 9.5 database
$ initdb /usr/local/var/postgres9.5 -E utf8
View gist:f284901960c55313e306
sudo apt-get install python-software-properties ; add-apt-repository command
sudo add-apt-repository ppa:cassou/emacs
sudo apt-get update
sudo apt-get install emacs24
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
View savings_account.rb
class Account
attr_reader :account_id, :initial_balance
initialize(account_id, initial_balance)
@account_id = account_id
@initial_balance = initial_balance
class SavingsAccount < Account
View gist:8320251
export LANGUAGE="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
sudo su postgres
update pg_database set datistemplate=false where datname='template1';
drop database Template1;
View migration.rb
jruby 1.7.4
rails (4.0.0)
jdbc-postgres (9.2.1002.1)
activerecord-jdbc-adapter (
activerecord-jdbcpostgresql-adapter (1.2.9)
undefined method `enable_extension' for #<CreatePosts:0x30186092>org/jruby/
View routes.rb
resources :sellers, only: [ :index, :show ] do
resources :contracts, shallow: true
View gist:5084073
Using rake (10.0.3)
Installing i18n (0.6.4)
Installing minitest (4.6.2)
Installing multi_json (1.6.1)
Installing atomic (1.0.1)
Installing thread_safe (0.1.0)
Installing tzinfo (0.3.36)
Installing activesupport (4.0.0.beta1)
Installing builder (3.1.4)
Installing erubis (2.7.0)
View chat.rb
# 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/, '') }
get '/stream', provides: 'text/event-stream' do


Ruby powered robots.


  1. Download and install the Arduio IDE for your OS
  2. Download and unzip Firmata 2.2
  3. Plug in your Arduino via USB
  4. Open the Arduino IDE, select: File > Open > [Path from step 2] > examples > StandardFirmata
View observable_example.rb
# We only care about Tick and Alarm events.
# The Alarm event should only be handled once.
# All other events should be ignored.
require 'observer'
class Clock
include Observable
def tick