( Source: the mongoid cheatsheet )
class User
include Mongoid::Document
[:peanut, :butter, :and, :jelly][4,0] #=> [] | |
[:peanut, :butter, :and, :jelly][5,0] #=> nil |
# Capistrano configuration | |
# | |
# require 'new_relic/recipes' - Newrelic notification about deployment | |
# require 'capistrano/ext/multistage' - We use 2 deployment environment: staging and production. | |
# set :deploy_via, :remote_cache - fetch only latest changes during deployment | |
# set :normalize_asset_timestamps - no need to touch (date modification) every assets | |
# "deploy:web:disable" - traditional maintenance page (during DB migrations deployment) | |
# task :restart - Unicorn with preload_app should be reloaded by USR2+QUIT signals, not HUP | |
resources :tlists do | |
member do | |
get 'complete' | |
get 'activate' | |
get 'draft' | |
end | |
end | |
resources :tdrafts, :controller => :tlists, :type => "Tdraft" do | |
member do |
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential | |
apt-get -y install git-core | |
# Install rbenv | |
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
# Add rbenv to the path: |
class ClientPosition | |
constructor: -> | |
@latitude = $("#map_canvas").data('latitude') | |
@longitude = $("#map_canvas").data('longitude') | |
if navigator.geolocation | |
navigator.geolocation.getCurrentPosition ((position) -> | |
@latitude = position.coords.latitude | |
@longitude = position.coords.longitude | |
), (error) -> | |
console.log error |
( Source: the mongoid cheatsheet )
class User
include Mongoid::Document