autocmd BufWritePre * :%s/\s\+$//e
(add-hook 'before-save-hook 'delete-trailing-whitespace)
["do", "dont do"].include? "try" | |
#=> false |
#!/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 |
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'hpricot' | |
require 'icalendar' | |
require 'date' | |
class ATPCalendar | |
def initialize(source) | |
@source = source |
#!/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+)/ |
#!/bin/bash | |
# This little script creates incremental rsync backups from my | |
# external Lightroom Library (but could be anything) to another | |
# external harddrive. Backups are important, you know. | |
# The result looks like this: | |
# | |
# 20120105-1759 | |
# 20120107-1928 |