autocmd BufWritePre * :%s/\s\+$//e
(add-hook 'before-save-hook 'delete-trailing-whitespace)
| #!/bin/sh | |
| ME=your-username | |
| DIR=/Users/$ME/Sites/$1 | |
| if [ ! -d $DIR ] | |
| then | |
| sudo -u $ME mkdir $DIR | |
| sudo -u $ME touch $DIR/index.php | |
| echo "<h1>$1</h1>" >> $DIR/index.php | |
| fi |
| #!/bin/sh | |
| ME=soho | |
| DIR=/Users/$ME/Sites/$1 | |
| if [ ! -d $DIR ] | |
| then | |
| sudo -u $ME mkdir $DIR | |
| sudo -u $ME touch $DIR/index.php | |
| echo "<h1>$1</h1>" >> $DIR/index.php | |
| fi |
| require 'sinatra_app' | |
| require 'test/unit' | |
| require 'rack/test' | |
| set :environment, :test | |
| class SinatraAppTest < Test::Unit::TestCase | |
| include Rack::Test::Methods | |
| # Make all tests transactional. |
| require 'capistrano/version' | |
| load 'deploy' | |
| # Customize the following variables | |
| set :domain, "host.example.com" | |
| set :user, "username" | |
| set :application, "my_wordpress_blog" | |
| set :deploy_to, "/var/www/apps/#{application}" | |
| # These variables probably don't need to change |
| #!/bin/sh | |
| # Git push then pull over ssh | |
| # | |
| # Supposing you have these environments on the same ssh git remote: | |
| # project/origin.git | |
| # project/dev/.git | |
| # project/prod/.git | |
| # | |
| # You can then push the current branch and pull it in dev/ and prod/ by doing: | |
| # $ git deploy dev |
| # for some reason facter takes the raw memorysize and reports it as | |
| # a formatted string, which is useless for calculation | |
| # | |
| Facter.add("memorysize_raw") do | |
| confine :kernel => :linux | |
| setcode do | |
| size = 0 | |
| File.readlines("/proc/meminfo").each do |l| | |
| size = $1.to_f if l =~ /^MemTotal:\s+(\d+)/ |
#Mac OS X
| /** | |
| paste this code into a playground to test it out | |
| */ | |
| import Foundation | |
| /** | |