Skip to content

Instantly share code, notes, and snippets.

View chrismcg's full-sized avatar

Chris McGrath chrismcg

View GitHub Profile
chris@tanker % rake
(in /Users/chris/dev/MacRuby)
/usr/bin/g++-4.2 -std=c99 -I. -I./include -fno-common -pipe -g -Wall -fexceptions -O3 -Wno-deprecated-declarations -Werror -arch i386 -arch x86_64 -I./icu-1060 .objs/array.o .objs/bignum.o .objs/class.o .objs/compar.o .objs/complex.o .objs/enum.o .objs/enumerator.o .objs/error.o .objs/eval.o .objs/file.o .objs/load.o .objs/proc.o .objs/gc.o .objs/hash.o .objs/env.o .objs/inits.o .objs/io.o .objs/math.o .objs/numeric.o .objs/object.o .objs/pack.o .objs/parse.o .objs/prec.o .objs/dir.o .objs/process.o .objs/random.o .objs/range.o .objs/rational.o .objs/re.o .objs/ruby.o .objs/signal.o .objs/sprintf.o .objs/st.o .objs/string.o .objs/struct.o .objs/time.o .objs/util.o .objs/variable.o .objs/version.o .objs/thread.o .objs/id.o .objs/objc.o .objs/bs.o .objs/ucnv.o .objs/encoding.o .objs/dln.o .objs/dmyext.o .objs/marshal.o .objs/gcd.o .objs/vm_eval.o .objs/bridgesupport.o .objs/compiler.o .objs/dispatcher.o .objs/vm.o .objs/symbol.o .objs/debugger.o .objs/interprete
chris@tanker % rake spec:ci
(in /Users/chris/dev/MacRuby)
rm -rf rubyspec_temp
./mspec/bin/mspec ci -B ./spec/macruby.mspec :full
MacRuby 0.8 (ruby 1.9.2) [universal-darwin10.0, x86_64]
.[!] Compiling fixture `/Users/chris/dev/MacRuby/spec/macruby/fixtures/method.m'
........*** Dispatch block exited prematurely because of an uncaught exception:
/Users/chris/dev/MacRuby/mspec/lib/mspec/expectations/expectations.rb:15:in `fail_with:': Expected true to equal false (SpecExpectationNotMetError)
from /Users/chris/dev/MacRuby/mspec/lib/mspec/matchers/base.rb:9:in `==:'
from /Users/chris/dev/MacRuby/spec/macruby/core/gcd/semaphore_spec.rb:62:in `block'
class Name
def initialize(first_name, last_name)
@first_name, @last_name = first_name, last_name
end
def to_s
"#{first_name} #{last_name}"
end
end
@chrismcg
chrismcg / functions
Created September 16, 2011 14:54
For those with rails 2 and rails 3 apps
function console() {
if [[ -x script/console ]]; then
script/console $*
else
bundle exec rails c $*
fi
}
function listener() {
if [[ -f Procfile ]]; then
@chrismcg
chrismcg / gist:1779285
Created February 9, 2012 10:59
Avoid rails projects called s or server, c or console
function listener() {
if [[ -f Procfile ]]; then
echo "Starting Foreman"
bundle exec foreman start
else
if [[ -x script/server ]]; then
echo "Starting Rails 2 listener"
script/server $*
else
echo "Starting Rails 3 listener"
# To send to LA
@my_db_records.each do |r|
LocaleApp::MissingTranslations.add('en', "sometable.some_field.#{id}", r.content)
end
LocaleApp.sender.post_missing_translations
# This will post them up to the app. (They go onto resque first so there may be a short delay before they appear)
@chrismcg
chrismcg / MRI-1.9.3.txt
Created June 13, 2012 08:36
Yaml load benchmarking
chris@zippy % rvm 1.9.3-p0,1.9.3-p194 do ruby psych_benchmarker.rb
Calculating -------------------------------------
YAML 3929 i/100ms
-------------------------------------------------
YAML 44438.5 (±11.9%) i/s - 220024 in 5.035159s
Calculating -------------------------------------
YAML 350 i/100ms
-------------------------------------------------
YAML 3563.2 (±1.9%) i/s - 17850 in 5.011440s
chris@zippy % console
/Users/chris/.rvm/gems/ruby-1.9.3-p0@hablo/gems/actionpack-3.2.6/lib/action_dispatch/http/mime_type.rb:102: warning: already initialized constant ZIP
Loading development environment (Rails 3.2.6)
[1] pry(main)> class Foo; end
=> nil
[2] pry(main)> f = Foo.new
=> #<Foo:0x007fa9db90fa60>
[3] pry(main)> f.model_name
NoMethodError: undefined method `model_name' for #<Foo:0x007fa9db90fa60>
from (pry):3:in `<main>'
@chrismcg
chrismcg / Gemfile
Created October 8, 2012 13:58
Sinatra and Localeapp
source :rubygems
gem 'sinatra'
gem 'localeapp'
@chrismcg
chrismcg / 1 The requirements.txt
Created October 15, 2012 14:18
Config for running Localeapp in staging/production on Heroku
- poll every 5 minutes on :staging env
- poll on deployment only on :production env (not only dyno restart)
This assumes you've setup separate production/staging environments as described in:
https://devcenter.heroku.com/articles/multiple-environments
Especially the part about setting the RAILS_ENV/RACK_ENV on the staging environment.
The "polling" on deployment takes advantage of the fact that heroku runs the