Skip to content

Instantly share code, notes, and snippets.

namespace :git do
task :tag_release do
match = release_path.match( %r{ releases/(\d+) }xm )
release_tag = "releases/#{match[1]}"
run_locally "git tag #{release_tag}"
run_locally "git push --tags"
end
end
after 'deploy:update', 'git:tag_release'
class ActionController::TestCase
## It's useful to use Webrat::Matchers like assert_have_selector in functional tests
include Webrat::Matchers;
def response_body; @response.body; end
end
@rdj
rdj / install_mysql_gem
Created February 28, 2011 23:38
Installing mysql gem on Snow Leopard
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib
ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=`which mysql_config`
@rdj
rdj / gist:963260
Created May 9, 2011 19:56
CMake Error: Parse error in cache file /tmp/homebrew-cmake-2.8.4-XP3b/cmake-2.8.4/CMakeCache.txt
$ brew install -v cmake
==> Downloading http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
File already downloaded and cached to /Users/ryan/Library/Caches/Homebrew
/usr/bin/tar xf /Users/ryan/Library/Caches/Homebrew/cmake-2.8.4.tar.gz
==> ./bootstrap --prefix=/usr/local/Cellar/cmake/2.8.4 --system-libs --no-system-libarchive --datadir=/share/cmake --docdir=/share/doc/cmake --mandir=/share/man
./bootstrap --prefix=/usr/local/Cellar/cmake/2.8.4 --system-libs --no-system-libarchive --datadir=/share/cmake --docdir=/share/doc/cmake --mandir=/share/man
---------------------------------------------
CMake 2.8.4, Copyright 2000-2009 Kitware, Inc.
C compiler on this system is: /usr/bin/cc -O3 -w -pipe
C++ compiler on this system is: /usr/bin/c++ -O3 -w -pipe
[alias]
up = "!rdj_git_up() { if [[ -z `git status --porcelain` ]]; then local back=$(git name-rev --name-only HEAD); echo ======== fetch origin ========; git fetch origin && for r in devel master; do echo ======== fast-forward $r ========; git checkout $r && git merge --ff-only origin/$r; done && now=$(git name-rev --name-only HEAD); [[ $now != $back ]] && echo ======== checkout $back ======== && git checkout $back; else echo Repo is not clean; fi }; rdj_git_up"
ruby-1.9.2-p180 :008 > "These two\u00A0words should be split".scan /\w+/
=> ["These", "two", "words", "should", "be", "split"]
@rdj
rdj / init.el
Created May 26, 2011 21:07
Note to self re: fixing PATH in emacs on Mac
;; On Mac OS X, GUI programs do not get a sensible PATH variable (i.e.
;; from /usr/libexec/path_helper). You can mitigate this by setting
;; the PATH variable in the binary plist file at this path:
;;
;; ~/.MacOSX/environment.plist
;;
;; Easiest way is using defaults:
;;
;; defaults write $HOME/.MacOSX/environment PATH "$HOME/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin"
;;
startup_message off
defscrollback 3000
bind s # remove the flow control garbage
msgwait 1
escape ^Jj
bindkey -d -k kb stuff "\010"
shelltitle '@|'
@rdj
rdj / bash-transcript.txt
Created June 28, 2011 20:36
bundle show
deploy@hardy:/u/apps/myapp/current$ rm -rf public/assets
deploy@hardy:/u/apps/myapp/current$ RAILS_ENV=production bundle exec rake assets:precompile
deploy@hardy:/u/apps/myapp/current$ find public/assets/ -size 0 | wc -l
0
deploy@hardy:/u/apps/myapp/current$ ls -l public/assets/bg-logo-9e2504e510490de4ebcbe297364f3826.01.gif
-rw-r--r-- 1 deploy deploy 1174 2011-06-28 13:51 public/assets/bg-logo-9e2504e510490de4ebcbe297364f3826.01.gif
deploy@hardy:/u/apps/myapp/current$ RAILS_ENV=production bundle exec rake assets:precompile
deploy@hardy:/u/apps/myapp/current$ find public/assets/ -size 0 | wc -l
49
deploy@hardy:/u/apps/myapp/current$ ls -l public/assets/bg-logo-9e2504e510490de4ebcbe297364f3826.01.gif
@rdj
rdj / active_admin.rb
Created July 1, 2011 06:39
active_admin custom filter
# config/initializers/active_admin.rb
require 'active_admin_custom_filter'
ActiveAdmin.setup do |config|
# ...
end