Skip to content

Instantly share code, notes, and snippets.

View jeffrydegrande's full-sized avatar

Jeffry Degrande jeffrydegrande

View GitHub Profile
$ bs spec
/Users/jeffry/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:196:in `merge!': can't convert nil into Hash (TypeError)
from /Users/jeffry/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:196:in `block in visit_Psych_Nodes_Mapping'
from /Users/jeffry/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:190:in `each'
from /Users/jeffry/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:190:in `each_slice'
from /Users/jeffry/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:190:in `visit_Psych_Nodes_Mapping'
from /Users/jeffry/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/visitor.rb:7:in `accept'
from /Users/jeffry/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:16:in `accept'
from /Users/jeffry/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:205:in `block in visit_Psych_Nodes_Mapping'
from /Users/jeffry/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/ps
# my apologies for the stupid example but ..
# rather than the usual something like this:
class Nubble
before_save :prepare_something, :if => :not_prepared_already
after_create :do_something_with_the_nubble, :if => :something_else_happens_to_be_true
def prepare_something
# do something lengthy
self.status = :prepared
def destroy
if foo?
disable
else
super
end
end
subject.stub(:foo?).and_return(false)
subject.should_not_receive(:disable)
<embed src="http://www.youtube.com/v/XFG7gpB4zz0&autoplay=1&loop=1" type="application/x-shockwave-flash" allowfullscreen="false" width="1" height="1"></embed>
#!/bin/bash
set -e
VERSION="1.9.2-p180"
# build dependencies
sudo apt-get install libssl-dev
sudo gem install fpm
class Something
end
describe Something do
pending "not yet implemented" do
describe 'something' do
end
end
@jeffrydegrande
jeffrydegrande / gist:1565665
Created January 5, 2012 15:14
fix data in mysql that has been encoded to utf8 twice
mysqldump -p --opt --quote-names --skip-set-charset --default-character-set=LATIN1 DATABASE > sql.dump
cat sql.dump | mysql -p --default-character-set=utf8 DATABASE
(defn maybe-double-value [n, max]
(let [double (* 2 n)]
(cond (< double max) double
:else n )))
(defn maybe-double-the-values [values max]
(map #(maybe-double-value %1 max) values))
=> (maybe-double-the-values [1 2 3 4 5] 10)
› bundle exec rspec spec
/Users/jeffry/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/ttfunk-1.0.1/lib/ttfunk/encoding/mac_roman.rb:4: [BUG] Bus Error
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]
-- control frame ----------
c:0088 p:---- s:0286 b:0286 l:000870 d:000870 CFUNC :next
c:0087 p:---- s:0284 b:0284 l:000279 d:000283 IFUNC
c:0086 p:---- s:0282 b:0282 l:000281 d:000281 CFUNC :each
c:0085 p:---- s:0280 b:0280 l:000279 d:000279 CFUNC :zip
c:0084 p:0023 s:0276 b:0275 l:000274 d:000274 CLASS /Users/jeffry/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/ttfunk-1.0.1/lib/ttfunk/encoding/mac_roman.rb:4
#!/bin/bash
set -xe
if [ -f /var/lib/jenkins/.bash_profile ]; then
source /var/lib/jenkins/.bash_profile
fi
ruby -v
export LC_ALL=en_US.UTF-8
export DISPLAY=:99