Skip to content

Instantly share code, notes, and snippets.

@rdj
rdj / deploy.rb
Created September 13, 2011 01:01
check bundler version when deploying to make sure you're not deploying with old cap recipes
# You could hard-code this, but we keep the current bundler version
# everybody is supposed to use in a default.gems file. So you can
#
# rvm gemset empty
# rvm gemset import
# bundle install --local
#
# And you're in a known good state.
expected_bunder_version = File.read( File.join( File.dirname( __FILE__ ), '..', 'default.gems' ) ).match( 'bundler -v(\S+)' )[1]
if Bundler::VERSION != expected_bunder_version
# Restart unicorn through RVM to allow for ruby interpreter version upgrades
rvm_shell = '/home/deploy/.rvm/bin/rvm-shell'
unicorn_args = Unicorn::HttpServer::START_CTX[:argv].join(' ')
shell_args = [ '-c', "cd /u/apps/innerfence/current && exec bundle exec unicorn #{unicorn_args}" ]
Unicorn::HttpServer::START_CTX[0] = rvm_shell
Unicorn::HttpServer::START_CTX[:argv] = shell_args
# Scrub the environment
before_exec do |server|
ENV.delete_if { |k| k.starts_with? 'BUNDLE' }
GIT
remote: git://github.com/TwP/turn.git
revision: 7a698227ed21427b6bd2be961870303c9d675183
specs:
turn (0.8.2.1)
ansi (>= 1.2.2)
GIT
remote: git://github.com/binarylogic/authlogic.git
revision: 0297e1c005c626c1e37bcc1de5f347476c838ed0
// app/assets/stylesheets/active_admin.css.scss.erb
// Don't forget to add the .erb extension (active_admin:install doesn't)
// Active Admin CSS Styles
@import "active_admin/mixins";
@import "active_admin/base";
// To customize the Active Admin interfaces, add your
// styles here:
@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
@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
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 / 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"
;;
ruby-1.9.2-p180 :008 > "These two\u00A0words should be split".scan /\w+/
=> ["These", "two", "words", "should", "be", "split"]
[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"