Skip to content

Instantly share code, notes, and snippets.

# Exclude this URL from redirect
RewriteCond %{REQUEST_URI} !^/foo\.html$ [NC]
# Redirect everything else here
RewriteRule .* http://domain.com/$1 [NC,L]
@leeky
leeky / gist:61922
Created February 11, 2009 08:47 — forked from rails/gist:58761
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {
@leeky
leeky / ghkey.rb
Created May 12, 2009 10:07 — forked from fcoury/ghkey.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'octopi'
require 'choice'
include Octopi
Choice.options do
header ''
git init
git status
touch log/.gitignore tmp/.gitignore vendor/.gitignore
git add .
git commit -a
.gitignore
==========
.DS_Store
config/database.yml
#!/usr/bin/env ruby
def output_config
puts <<-END
graph_category App
graph_title passenger status
graph_vlabel count
sessions.label sessions
max.label max processes
@leeky
leeky / RVM - Snow Leopard
Created April 18, 2010 23:40
RVM with Snow Leopard
# From: http://afreshcup.com/home/2009/9/2/migrating-to-snow-leopard-for-rails-development-a-definitive.html
sudo gem install rvm
rvm-install
rvm install 1.8.6 -C --enable-shared,--with-readline-dir=/usr/local
rvm install 1.8.7 -C --enable-shared,--with-readline-dir=/usr/local
rvm install 1.9.1 -C --enable-shared,--with-readline-dir=/usr/local
rvm install 1.9.2 -C --enable-shared,--with-readline-dir=/usr/local
rvm 1.8.7 --default
1) Make sure .ssh directory exists on remote server
2) Generate SSH key using ssh-keygen -t rsa
3) Copy public key onto remote server and append to ~/.ssh/authorised_keys2
4) Test password-less SSH onto remote server, might need to edit ~/.ssh/config
Host shortname
HostName ipaddr
Port blah (if port not 22)
User blah (if user not the same as local user)
@leeky
leeky / clearing.css
Created January 19, 2011 15:05
Self Clearing Floats
.group:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
overflow: hidden;
}
* html .group {
@leeky
leeky / gist:1212750
Created September 12, 2011 23:23 — forked from kevinprince/gist:1212725
badges in ruby
# Requires the following gems: prawn, barby and rqrcode
require "prawn"
require "prawn/measurement_extensions"
require "barby"
require "barby/barcode/code_128"
require "barby/outputter/prawn_outputter"
barcode = Barby::Code128.new('12345','A')
badge = Prawn::Document.new(:page_size => "A5", :page_layout => :landscape, :margin => 0) do |pdf|
@leeky
leeky / chef_solo_bootstrap.sh
Created May 23, 2012 13:54 — forked from ryanb/chef_solo_bootstrap.sh
Bootstrap Chef Solo - Ubuntu 12.04 LTS
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure --prefix=/usr/local
make
make install