Based on good work found at http://goo.gl/bKjJe
If you have Nginx running, you can run Yard as a rack app to serve docs for locally installed Gem.
- Create a directory to host Rack app. Install yard gem
mkdir -p ~/Dropbox/yard/public| #!/bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: generic-prog | |
| # Required-Start: $local_fs $remote_fs $network | |
| # Required-Stop: $local_fs $remote_fs $network | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Generic Program | |
| # Description: Generic Program is a generic program to do generic things with | |
| ### END INIT INFO |
| #!/bin/bash | |
| # Update, upgrade and install development tools: | |
| sudo apt-get update | |
| sudo apt-get -y upgrade | |
| sudo apt-get -y install build-essential git-core curl libssl-dev \ | |
| libreadline5 libreadline5-dev \ | |
| zlib1g zlib1g-dev \ | |
| libmysqlclient-dev \ | |
| libcurl4-openssl-dev \ |
| new-host-2:ltp mike$ brew remove postgresql | |
| Uninstalling /usr/local/Cellar/postgresql/9.1.4... | |
| new-host-2:ltp mike$ brew install postgresql | |
| ==> Downloading http://ftp.postgresql.org/pub/source/v9.1.4/postgresql-9.1.4.tar.bz2 | |
| Already downloaded: /Library/Caches/Homebrew/postgresql-9.1.4.tar.bz2 | |
| ==> Patching | |
| patching file src/pl/plpython/Makefile | |
| patching file contrib/uuid-ossp/uuid-ossp.c | |
| ==> ./configure --disable-debug --prefix=/usr/local/Cellar/postgresql/9.1.4 --datadir=/usr/local/Cellar/postgresql | |
| ==> make install-world |
| package main | |
| import ( | |
| "bytes" | |
| "crypto/rand" | |
| "crypto/rsa" | |
| "crypto/sha1" | |
| "fmt" | |
| ) |
Based on good work found at http://goo.gl/bKjJe
If you have Nginx running, you can run Yard as a rack app to serve docs for locally installed Gem.
mkdir -p ~/Dropbox/yard/public| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| #Model | |
| @user.should have(1).error_on(:username) # Checks whether there is an error in username | |
| @user.errors[:username].should include("can't be blank") # check for the error message | |
| #Rendering | |
| response.should render_template(:index) | |
| #Redirecting | |
| response.should redirect_to(movies_path) |
| require 'yaml' | |
| require 'logger' | |
| require 'active_record' | |
| namespace :db do | |
| def create_database config | |
| options = {:charset => 'utf8', :collation => 'utf8_unicode_ci'} | |
| create_db = lambda do |config| | |
| ActiveRecord::Base.establish_connection config.merge('database' => nil) |
| # RSpec's subject method, both implicitly and explicitly set, is useful for | |
| # declaratively setting up the context of the object under test. If you provide a | |
| # class for your describe block, subject will implicitly be set to a new instance | |
| # of this class (with no arguments passed to the constructor). If you want | |
| # something more complex done, such as setting arguments, you can use the | |
| # explicit subject setter, which takes a block. | |
| describe Person do | |
| context "born 19 years ago" do | |
| subject { Person.new(:birthdate => 19.years.ago } | |
| it { should be_eligible_to_vote } |