( Source: the mongoid cheatsheet )
class User
include Mongoid::Document
| #!/usr/bin/env ruby | |
| # | |
| # README: Start server with em-stream-tail.rb tail-filename | |
| # Connect to server with curl http://localhost:8083 | |
| # Observe log events on curl. | |
| # | |
| require 'rubygems' | |
| require 'eventmachine' | |
| if ARGV.empty? |
( Source: the mongoid cheatsheet )
class User
include Mongoid::Document
| class TaxCode | |
| GENERATORS = { | |
| :us => lambda { |id| "US-#{id}" }, | |
| :br => lambda { |id| "#{id + 9}-BRA" }, | |
| } | |
| def self.generate(code, id) | |
| gen = GENERATORS[code] || raise ArgumentError, "No generator for country #{code}" | |
| gen.call(id) | |
| end |
| # Application Generator Template | |
| # Modifies a Rails app to use Devise with RSpec and Cucumber | |
| # Usage: rails new APP_NAME -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-devise-rspec-cucumber-template.rb -T | |
| # Information and a tutorial: | |
| # https://github.com/RailsApps/rails3-devise-rspec-cucumber | |
| # Generated using the rails_apps_composer gem: | |
| # https://github.com/RailsApps/rails_apps_composer/ |
| # Nginx+Unicorn best-practices congifuration guide. Now with SPDY! | |
| # We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies. | |
| # Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module | |
| # | |
| # Deployment structure | |
| # | |
| # SERVER: | |
| # /etc/init.d/nginx (1. nginx) | |
| # /home/app/public_html/app_production/current (Capistrano directory) | |
| # |
| # Build dependencies for OpenResty. | |
| sudo apt-get install build-essential libpcre3-dev libssl-dev libgeoip-dev | |
| # Install standard Nginx first so that you get the relevant service scripts installed too | |
| sudo apt-get install nginx | |
| # If you want to access Postgres via Nginx | |
| sudo apt-get install libpq-dev |
$ sudo su, although it may not be necessary.$ curl https://raw.github.com/timkay/aws/master/aws -o aws$ perl --install aws$ mv aws /usr/local/bin/ && chmod +x /usr/local/bin/aws