Skip to content

Instantly share code, notes, and snippets.

View dbrady's full-sized avatar

David Brady dbrady

View GitHub Profile
Fixjour do
define_builder(User) do |klass, overrides|
num = counter(:user)
klass.new(
:first_name => "Test#{num}",
:last_name => 'User',
:email => "user#{num}@totallyvaliddomain.com",
:password => 'password',
:password_confirmation => 'password',
:license => 'fakelicensenumber'
@dbrady
dbrady / reload-buffer.el
Created September 9, 2011 17:31
reload-buffer
; ----------------------------------------------------------------------
; reload-buffer
; Seriously, why doesn't this already exist? Reloads the current
; buffer. find-alternate-file will sort of already do this; if you do
; not supply an argument to it it will reload the current
; buffer... but it will switch you to another buffer when it does
; it. All this function does is find-alt and then switch you back.
(defun reload-buffer()
(interactive)
(let ((buffername (buffer-name)))
@dbrady
dbrady / logger_test.rb
Created August 15, 2011 16:40
logger methods expect a block, not a msg
log.debug false
# STDOUT => D, [2011-08-15T10:38:03.868973 #7762] DEBUG -- : nil
# => true
log.debug { false }
# STDOUT => D, [2011-08-15T10:38:08.492862 #7762] DEBUG -- : false
# => true
log.log Logger::DEBUG, false
# STDOUT => D, [2011-08-15T10:38:27.956344 #7762] DEBUG -- : false
@dbrady
dbrady / gist:1115797
Created July 30, 2011 18:01
__rvm_rvmrc_key is calling rspec. WAT
11:57:51 dbrady@shinything:~/.rvm ruby-1.9.2-p290
∫ type __rvm_rvmrc_key
__rvm_rvmrc_key is a function
__rvm_rvmrc_key ()
{
printf "$1" | time rspec '[#/.=]' _;
return $?
}
@dbrady
dbrady / gist:1115784
Created July 30, 2011 17:52
rvm cd with tracing enabled
11:49:52 dbrady@shinything:~/devel ruby-1.9.2-p290
∫ set -x; cd coffer; set +x
+ cd coffer
+ builtin cd coffer
+ local result=0
+ __rvm_project_rvmrc
+ local working_dir
+ [[ -n /Users/dbrady/.rvm/scripts ]]
+ source /Users/dbrady/.rvm/scripts/initialize
++ [[ -n 3.2.48(1)-release ]]
11:48:50 dbrady@shinything:~ ruby-1.9.2-p290
∫ type cd
cd is a function
cd ()
{
builtin cd "$@";
local result=$?;
__rvm_project_rvmrc;
__rvm_after_cd;
return $result
@dbrady
dbrady / gist:1114810
Created July 29, 2011 21:47
RVM choking on rspec, not remembering .rvmrc
# Does RVM now use some kind of file db system to remember .rvmrc files?
# The beginning of the (rather long) error message makes me wonder...
15:44:00 dbrady@shinything:~
∫ cd devel/coffer
rspec: No such file or directory
0.00 real 0.00 user 0.00 sys
@dbrady
dbrady / gist:1114768
Created July 29, 2011 21:22
RVM choking on rspec even when rspec isn't there, not remembering .rvmrc
# I just created the pants/ folder and put this .rvmrc in it:
#
# rvm use ruby-1.9.2
#
# Note that rake 0.8.7 is the only gem in my global gemset, so
# rspec ISN'T EVEN INSTALLED NOW.
15:19:50 dbrady@shinything:~/devel/pants ruby-1.9.2-p290@coffer
∫ . .rvmrc
Using /Users/dbrady/.rvm/gems/ruby-1.9.2-p290
@dbrady
dbrady / gist:1114747
Created July 29, 2011 21:11
RVM choking on rspec, not remembering .rvmrc
# After updating rvm, it is surprised and alarmed by .rvmrc files.
# It doesn't recognize them as trusted, and then crashes after
# approving them. Which means EVERY time I cd inside a project with
# an .rvmrc file, this happens:
#
# (Note that I am in ruby-1.9.2-p290@adsel. The 'coffer' directory
# has an .rvmrc file which specifies ruby-1.9.2-p180@coffer.)
15:05:52 dbrady@shinything:~/devel ruby-1.9.2-p290@adsel
∫ cd coffer
@dbrady
dbrady / gist:1114136
Created July 29, 2011 16:12
RVM choking on rspec, not remembering .rvmrc
10:09:09 dbrady@shinything:~/projects (git:develop:928475c) ruby-1.9.2-p290
∫ cd adsel
rspec: No such file or directory
0.00 real 0.00 user 0.00 sys
Usage:
db database_file {{key}} {{value}} # set
db database_file {{key}} # get