Skip to content

Instantly share code, notes, and snippets.

## Rails 3.0 Template
# Usage: rails app_name -m http://gist.github.com/373297.txt
# Remove normal files we don't want
%w(README public/index.html public/favicon.ico public/robots.txt).each do |f|
remove_file f
end
# Copy database.yml to sample
inside "config" do
require 'rubygems'
require 'open-uri'
require 'hpricot'
doc = Hpricot(open('http://www.haitisurf.com/dictionary.shtml'))
text_array = (doc/'font').
collect {|elem| elem.to_plain_text }.
delete_if { |txt| txt == '' }.
select {|txt| txt =~ /.+\-.+/ }
gem uninstall im_a_gem --install-dir ~/.gem/ruby/1.8
@jonathannelson
jonathannelson / mysql gem 2.7
Created March 30, 2009 21:54
mysql 2.7 gem (Intel Mac only)
sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
@jonathannelson
jonathannelson / .htaccess
Created March 21, 2009 19:47
.htaccess for mod_rails
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.mysite.com
RewriteRule (.*) http://mysite.com/ [R=301,L]
</IfModule>
@jonathannelson
jonathannelson / RailsAllowModRewrite
Created March 21, 2009 18:36
RailsAllowModRewrite
## RailsAllowModRewrite
RailsAllowModRewrite On
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.mysite.com
RewriteRule (.*) http://mysite.com/ [R=301,L]
#!/bin/sh
### BEGIN INIT INFO
# Provides: god
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: God
In Textmate, go to Preferences -> Advanced -> Folder References. Then find the following File Pattern:
(?!htaccess)
replace with:
(?!(htaccess|git*))
Restarting Textmate project will now display all files that are called ‘.htaccess’ or start with ‘.git’.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="\w\$(parse_git_branch) $ "
# Step 1
curl -O http://topfunky.net/svn/shovel/memcached/install-memcached.sh
# Step 2
mv install-memcached.sh ~/src/memcached
# Step 3
cd ~/src/memcached
# Step 4
sudo sh memcached.sh