First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel
Then ssh with root account, run this in termianl:
$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
require 'fileutils' | |
namespace :db do | |
desc 'pull the production PostgreSQL database into the development SQLite' | |
task :pull do | |
Rake::Task['db:download_pg_dump'].invoke | |
Rake::Task['db:optimze_pg_dump_for_sqlite'].invoke | |
Rake::Task['db:recreate_with_dump'].invoke | |
end |
# key-bindings: | |
left seek -4 | |
right seek 2 | |
up speed_incr 0.01 | |
down speed_incr -0.01 | |
- volume -1 | |
= volume 1 |
require "xmlsimple" | |
def transactions(filename) | |
data = XmlSimple.xml_in(filename) | |
data["LIST_G_CLIENT"][0]['G_CLIENT'][0]['LIST_G_ACC_CURR'][0]['G_ACC_CURR'][0]['LIST_G_TRANS_CARD'][0]['G_TRANS_CARD'][1]['LIST_G_TRANS_DETAILS'][0]['G_TRANS_DETAILS'] | |
end | |
fields = %w(TRANS_DATE_XML TRANS_AMOUNT TRANS_CURR ACC_AMOUNT TRANS_DETAILS ) | |
puts fields.join(", ") |
[core] | |
... | |
[remote "dokku"] | |
url = git@remote:appname | |
fetch = +refs/heads/*:refs/remotes/dokku/* |
class User < ActveRecord::Base | |
def full_name | |
"#{ last_name } #{ first_name }" | |
end | |
end | |
describe User do | |
# in this case a real AR object needless | |
# profit => speed up, more test isolation(test does not fail when database connection is broken) |
namespace :routes do | |
desc "Writes doc/routes.html. Requires Graphviz (dot)" | |
task :visualizer => :environment do | |
File.open(Rails.root.join('doc', 'routes.html'), 'wb') do |f| | |
f.write Rails.application.routes.router.visualizer | |
end | |
end | |
end |
module A | |
def foo | |
'A#foo' | |
end | |
end | |
module B | |
def foo | |
'B#foo' | |
end |
По дефолту для Mongoid он пагинирует Criteria. Если нужно Ruby-Array-массив: | |
Kaminary.paginate_array(...) |
# 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 | |