Skip to content

Instantly share code, notes, and snippets.

View blaix's full-sized avatar

Justin Blake blaix

View GitHub Profile
# A logger that isn't lame:
class AuditLogger < Logger
def initialize(path_to_logfile)
log_file = File.open(path_to_logfile, 'a')
log_file.sync = true
super(log_file)
end
def format_message(severity, timestamp, progname, msg)
"#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n"
#!/usr/bin/ruby
#-*-ruby-*-
# A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback.
CTAGS = '/opt/local/bin/ctags'
HOOKS = %w{ post-merge post-commit post-checkout }
HOOKS_DIR = '.git/hooks'
class Array
# True if elements in +array+ are the same as the elements in +self+,
# but not necessarily in the same order.
def equals?(array)
array - self == self - array
end
end
# [1, 2, 3].equals? [3, 2, 1] => true
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>block-style links in a list</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
ul#linklist {
width: 50%;
}
sudo gem install mysql -- --with-mysql-config=/opt/local/bin/mysql_config5
Make sure you have XCode installed. This is so you have the necessary compilers and libraries. You can find it on your OS X install DVD, or download it here: http://developer.apple.com/tools/download/
Install macports. This gives you a FreeBSD-like "port" command for installing open-source software that has been ported to OS X. http://www.macports.org/install.php
You'll need to add the macports executables directories to your $PATH environment varilable. There are several ways to do this. If this your first time editing the $PATH, you can update your own user's $PATH by doing this in the Terminal (/Applications/Utilities/Terminal.app):
echo "export $PATH=/opt/local/bin:/opt/local/sbin:$PATH" >> ~/.bash_profile
Now you need to reload .bash_profile:
export PATH=/var/lib/gems/1.8/bin:$PATH
alias xclip='xclip -selection c'
alias reload='source ~/.bash_profile'
[merge]
tool = opendiff
[color]
ui = auto
[alias]
co = checkout
st = status
ci = commit
br = branch
[apply]
require 'redgreen/autotest'
require 'autotest/growl'
Autotest.add_hook :initialize do |at|
%w{.svn .hg .git}.each {|exception| at.add_exception(exception)}
end
# should always be last
require 'autotest/fsevent'