This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module FormTagHelper | |
# see http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-utf8_enforcer_tag | |
def utf8_enforcer_tag | |
''.html_safe | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using instance_eval | |
# Time: 0.267886376 | |
Benchmark.measure do | |
1000000.times { 1.instance_eval { self+1 } } # => 2 | |
end | |
# Using tap+break | |
# Time: 0.304528147 | |
Benchmark.measure do | |
1000000.times { 1.tap { |o| break o+1 } } # => 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.Router.reopen({ | |
location: 'history' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :unicorn_config, -> { current_path.join('config/unicorn.rb') } | |
set :unicorn_pid, -> { shared_path.join('tmp/pids/unicorn.pid') } | |
namespace :unicorn do | |
desc 'Stop Unicorn' | |
task :stop do | |
on roles(:app) do | |
if test("[ -f #{fetch(:unicorn_pid)} ]") | |
execute :kill, capture(:cat, fetch(:unicorn_pid)) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Based on https://github.com/jimeh/git-aware-prompt | |
find_git_branch() { | |
local branch | |
if branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null); then | |
if [[ "$branch" == "HEAD" ]]; then | |
branch='detached*' | |
fi | |
git_branch=" ($branch)" | |
else | |
git_branch="" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'alias "поехали!"="bundle exec cap deploy"' >> ~/.bashrc |
NewerOlder