Skip to content

Instantly share code, notes, and snippets.

View davidlee's full-sized avatar

David Lee davidlee

View GitHub Profile
module Spec
module Example
module ExampleGroupMethods
def slow_specs &bl
bl.call() if run_slow_specs?
end
def run_slow_specs?
ENV['SLOW_SPECS']
;;
;; color-theme-sore-eyes.el
;;
;; Made by David Lee
;; Login <dml@thumper.rev.kgpn.10.in-addr.arpa>
;;
;; Started on Mon Jul 21 12:05:27 2008 David Lee
;; Last update Mon Jul 21 12:05:27 2008 David Lee
;;
(eval-when-compile
;;
;; color-theme-dml.el
;;
;; Made by David Lee
;; Login <dml@thumper.rev.kgpn.10.in-addr.arpa>
;;
;; Started on Mon Jul 21 12:05:27 2008 David Lee
;; Last update Mon Jul 21 12:05:27 2008 David Lee
;;
(eval-when-compile
Add "+universal" to /opt/local/etc/macports/variants.conf
Uncomment in /opt/local/etc/macports.conf:
variants_conf /opt/local/etc/macports/variants.conf
sudo port -v install git-core +bash_completion +doc
sudo port -v install ImageMagick \
Xft2 \
antiword \
atk \
@davidlee
davidlee / ubuntu-chef-client-install.sh
Created April 27, 2010 05:31
#CHEF ubuntu 9.10 fresh install to registered client - just change the server address
#!/bin/sh
# set up FQDN
echo "you better have a hostname, or shit won't work!"
echo "and, we expect /etc/chef/validation.pem to exist and match the server"
sleep 1
# install packages
apt-get install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert git-core
How to determine whether to buy a tool for your employee
v = xp + cr
x = total cost of employee (usually approx. double their salary) over
useful lifetime of tool
p = productivity gain provided by tool, expressed as a fraction of x
c = increase in employee retention provided by tool, expressed as a
fraction of 1
r = total cost of hiring and training a replacement to current
module MultiLogger
def also_log_to file, &block
@_original_logger, self.logger = logger, ActiveSupport::BufferedLogger.new(file)
yield
self.logger, @_original_logger = logger, nil
end
end
# in application.rb:
# gem completions
# this is a guess. salt to taste.
export GEM_SEARCH_PATH=`ruby -e 'require "rubygems"; puts Gem.path.first'`/gems
# completion fuction for compdef: just lists the gems folders
_gems() { compadd `cd $GEM_SEARCH_PATH; echo *` }
compdef _gems gemcd ; gemcd() { cd $GEM_SEARCH_PATH/$1 }
compdef _gems gemedit ; gemedit() { mate $GEM_SEARCH_PATH/$1 }
deploy@dvsyd2nxpdev01:/usr/share/emacs/22.2/lisp$ apt-file search zone.elc
emacs-snapshot-common: /usr/share/emacs/23.0.60/lisp/play/zone.elc
emacs-snapshot-common: /usr/share/emacs/23.0.60/lisp/timezone.elc
emacs21-common: /usr/share/emacs/21.4/lisp/play/zone.elc
emacs21-common: /usr/share/emacs/21.4/lisp/timezone.elc
emacs22-common: /usr/share/emacs/22.2/lisp/play/zone.elc
emacs22-common: /usr/share/emacs/22.2/lisp/timezone.elc
xemacs21-basesupport: /usr/share/xemacs21/xemacs-packages/lisp/xemacs-base/timezone.elc
def ensure_argument list
list.each do |value, tests|
[tests].flatten.each do |test|
case test.to_s
when /^is_an?_(.*)$/
value.is_a? $1.classify.constantize
when /^is_(.*)$/
value.respond_to?($1) && value.send($1)
when /^(has|can)_(.*)/
value.respond_to? $2