start new:
tmux
start new with session name:
tmux new -s myname
# This method is heavily adapted from the Rails method of determining the subdomain. | |
require 'rubygems' | |
require 'sinatra' | |
require 'rack/request' | |
# We re-open the request class to add the subdomains method | |
module Rack | |
class Request | |
def subdomains(tld_len=1) # we set tld_len to 1, use 2 for co.uk or similar |
# RSpec matcher to spec delegations. | |
# | |
# Usage: | |
# | |
# describe Post do | |
# it { should delegate(:name).to(:author).with_prefix } # post.author_name | |
# it { should delegate(:month).to(:created_at) } | |
# it { should delegate(:year).to(:created_at) } | |
# end |
Name : Sam | |
Serial : eJzzzU/OLi0odswsqglOzK0xsjQzNzI2NjA1q3GuMQQAnJAJjw== |
chmod +x git-hooks/pending_migrations_check.rb | |
cd .git/hooks | |
ln -is ../../git-hooks/pending_migrations_check.rb post-merge | |
ln -is ../../git-hooks/pending_migrations_check.rb post-checkout |
class ActionDispatch::Routing::Mapper | |
def draw(routes_name) | |
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb"))) | |
end | |
end | |
BCX::Application.routes.draw do | |
draw :api | |
draw :account | |
draw :session |
Most instructions for using Capistrano tell you how to make it restart Phusion Passenger by 'touch'ing the restart.txt
file, but this doesn't immediately restart the app - instead the first person to try to use the application will cause it to be restarted, so they will see a delay of at least a few seconds.
This shows how to add a post-deploy task to 'ping' the server, to cause it to restart immediately.
Then add a deploy:ping
task to config/deploy.rb
and set it to run automatically after deploy:restart
. Alternatively you could put it into the deploy:restart
task directly.
TODO: Test the response HTTP header of the ping, that it is a 200, and not some other error response (404/500).
You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.
/** | |
* @example | |
* <span ng-html='foo.bar'></span> | |
*/ | |
app.directive('ngHtml', function() { | |
return function(scope, element, attrs) { | |
scope.$watch(attrs.ngHtml, function(value) { | |
element[0].innerHTML = value; | |
}); | |
} |