Skip to content

Instantly share code, notes, and snippets.

View chrismcg's full-sized avatar

Chris McGrath chrismcg

View GitHub Profile
# 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 / 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"
@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
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
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'
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@slinky % rvm list
rvm Rubies
jruby-1.3.1 [ [x86_64-java] ]
jruby-1.4.0 [ [x86_64-java] ]
jruby-1.5.0.RC3 [ [x86_64-java] ]
rbx-1.0.0-head [ ]
rbx-1.0.0-rc1 [ ]
ruby-1.8.6-p383 [ x86_64 ]
chris@slinky % rvm install rbx
Installing pre-requisites
Downloading rubinius-1.0.0-rc5, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8143k 100 8143k 0 0 155k 0 0:00:52 0:00:52 --:--:-- 160k
Extracting ...
Configuring rbx
Compiling rbx
Error running '/Users/chris/.rvm/bin/ruby-1.8.7-p249 -S rake install', please check /Users/chris/.rvm/log/rbx-1.0.0-rc5/rake*.log
" select at current indent level from http://vim.wikia.com/wiki/Visual_selection_of_indent_block
" modified for ruby to allow selecting the prev and next lines too for blocks
function! SelectIndent (blockmode)
let temp_var=indent(line("."))
while indent(line(".")-1) >= temp_var
exe "normal k"
endwhile
if a:blockmode == "yes"
exe "normal k"
end
function! Run_shitty_tests
silent exe "!truncate log/test.log"
let old_make = &makeprg
let test_command = "ruby -I <some libs> "
let &makeprg = test_command.expand("%")
exe "make!"
let &makeprg = old_make
endfunction
nnoremap <C-c>c :call Run_shitty_tests<cr>