Skip to content

Instantly share code, notes, and snippets.

Avatar

Wayne E. Seguin wayneeseguin

  • http://starkandwayne.com/
  • Buffalo, NY
View GitHub Profile
View clear-rails-logs.sh
#!/bin/bash
#
# Find all the rails projects from this directory down and clear their log
# files to save some space.
#
base=`pwd`
for path in `find $base -type f -path '*/config/environment.rb'` ; do
rails_root=`echo $path | xargs dirname | xargs dirname`
View gist:183418
# rvm 'gemdir' function, easily switch between any ruby's gem directory.
function gemdir {
if [ -z "$1" ] ; then
echo "gemdir expects a parameter, which should be a valid rvm ruby selector"
else
rvm use $1
cd `rvm gemdir`
pwd
fi
}
View Rules
#!/usr/bin/env ruby
compile '*' do
filter :erb
layout "default"
end
compile "/assets/stylesheets/*/" do
filter :sass
end
View Rules
#!/usr/bin/env ruby
compile "/assets/css/*" do
filter :sass
end
route "/assets/css/*" do
item.identifier.sub(%r{/assets}, '').chop + '.css'
end
View itworks.rb
# Added small readability tweak
# input/output instead of pull/push
class TwoWayPipe
attr_reader :input, :output
def initialize
@input, @output = IO.pipe
end
end
View top_posting
Greg KH greg (at) kroah (dot) com 16 Nov 2005
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
A: No.
Q: Should I include quotations after my reply?
View .bash_profile
# ~/.bash_profile
# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
View .bash_profile
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
export PATH="$HOME/bin:/usr/share/java/apache-ant/bin:/opt/java/bin:/usr/local/bin:/usr/local/sbin:$PATH"
export JAVA_HOME="/opt/java"
if [[ -s /home/dvyjones/.rvm/scripts/rvm ]] ; then source /home/dvyjones/.rvm/scripts/rvm ; fi
View .bash_profile
# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
View gist:296055
This example shows how to setup an environment running Rails 3 under 1.9.2 with a 'rails3' gem set.
∴ rvm update --head
# ((Open a new shell)) or do 'rvm reload'
# If you do not already have the ruby interpreter installed, install it:
∴ rvm install 1.9.2
# Switch to 1.9.2-head and gemset rails3, create if it doesn't exist.
∴ rvm --create use 1.9.2@rails3