( Source: the mongoid cheatsheet )
class User
include Mongoid::Document
( Source: the mongoid cheatsheet )
class User
include Mongoid::Document
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 |
# 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: |
resources :tlists do | |
member do | |
get 'complete' | |
get 'activate' | |
get 'draft' | |
end | |
end | |
resources :tdrafts, :controller => :tlists, :type => "Tdraft" do | |
member do |
# 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 | |
[:peanut, :butter, :and, :jelly][4,0] #=> [] | |
[:peanut, :butter, :and, :jelly][5,0] #=> nil |
given i have | |
1 | |
2 | |
3 | |
4 | |
i need to get | |
4 |
{ | |
"root": [ | |
{ | |
"title": "Новости", | |
"collection": [ | |
{ | |
"url": "news/2015/02/02/sotrudnikov-inion-na-vremya...", | |
"title": "Сотрудников ИНИОН на время реконструкции....", | |
"authors": [ ], | |
"document_type": "news", |
defmodule Themost.RateWorker do | |
use GenServer | |
def start_link do | |
:gen_server.start_link({ :local, :NAME }, __MODULE__, ARG, []) | |
end | |
def init do | |
IO.puts "Init" | |
:timer.send_interval(:crowl, 15000) |
ololo |