gem install rails --pre
rails new my_app -T
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed. | |
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies. | |
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module | |
# | |
# Deployment structure | |
# | |
# SERVER: | |
# /etc/init.d/nginx (1. nginx) | |
# /home/app/public_html/app_production/current (Capistrano directory) | |
# |
# Put this at the bottom of your config/deploy.rb | |
# Requires config file ~/.campfire.yml with your API token from | |
# your Campfire "My Info" page: | |
# | |
# token: lkjsadfsaduoi1u31oui3eh1kj2h | |
# roomid: 123456 | |
# subdomain: acmeco | |
class Room | |
attr_accessor :config |
- unless Rails.env.development? | |
/ Require jQuery | |
= javascript_include_tag 'http://yandex.st/jquery/1.7.1/jquery.min.js' | |
/ Require Google's jQuery if Yandex is down | |
:javascript | |
window.jQuery || document.write('<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">\x3C/script>') | |
/ Require local jQuery if Google is down / is development env | |
:javascript | |
window.jQuery || document.write('<script src="#{asset_path('jquery.js')}">\x3C/script>') |
#!/usr/bin/env ruby | |
if __FILE__ == $0 | |
bundle_name = ARGV[0] if (ARGV[0]) | |
bundle_name = `pwd`.split('/').last.chomp if bundle_name.nil? | |
bundle_name += ".git.bundle" | |
puts "Backing up to bundle #{bundle_name}" | |
`git bundle create ~/Dropbox/backup/git-repos/#{bundle_name} --all` | |
end |
def bash_escape(argument) | |
"$'" + argument.gsub("\\'", '\\\\\&').gsub("'", "\\\\'") + "'" | |
end | |
ruby_code = "puts 'something'" | |
command = "ruby -e #{bash_escape ruby_code}" | |
puts "ssh server #{bash_escape command}" # => ssh server $'ruby -e $\'puts \\\'something\\\'\'' |