Skip to content

Instantly share code, notes, and snippets.

View chrismcg's full-sized avatar

Chris McGrath chrismcg

View GitHub Profile
/* Ruby Thread support:
Ruby implements threads by using setjmp/longjmp to switch between separate
C stacks within one native thread.
This confuses Objective C because NSThread stores a per-native-thread stack
of autorelease pools and exception handlers. When the C stack changes, an
error message like this is likely to appear:
Exception handlers were not properly removed. Some code has jumped or
#!/usr/bin/ruby
require 'osx/cocoa'
include OSX
class Foo < NSObject
def applicationDidFinishLaunching(sender)
puts "yo"
end
end
# in ~/.irbrc
if ENV['RAILS_ENV']
load '~/.railsrc'
end
# in ~/.railsrc
def sql(query)
ActiveRecord::Base.connection.select_all(query)
end
export LSCOLORS=gxfxcxdxbxegedabagacad
if [[ $OS == 'Linux' ]]; then
alias ls='ls --color=auto'
else
alias ls='ls -G'
fi
alias ll='ls -l'
alias lls='ll -S'
alias lt='ll -t'
alias ltr='ls -ltr'
#!/usr/bin/env ruby -w
#---
# Excerpted from "TextMate"
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.pragmaticprogrammer.com/titles/textmate for more book information.
#---
$LOAD_PATH << "#{ENV["TM_SUPPORT_PATH"]}/lib"
require "exit_codes"
require "web_preview"
set shiftwidth=2
set bs=2 " allow backspacing in insert mode
set tabstop=2
set autoindent
set smartindent
set expandtab
set smarttab
set number
set nowrap
set encoding=utf8
chris@shiny % ls ~/.vim/plugin
AlignMapsPlugin.vim cecutil.vim gist.vim surround.vim vcscvs.vim
AlignPlugin.vim dbext.vim gitdiff.vim tComment.vim vcsgit.vim
NERD_tree.vim fuzzyfinder.vim project.vim taglist.vim vcssvk.vim
SimpleFold.vim fuzzyfinder_textmate.vim rails.vim tail.vim vcssvn.vim
bufexplorer.vim getscriptPlugin.vim scmdiff.vim vcscommand.vim vimballPlugin.vim
>> Time.parse('01/31/2009').advance(:months => 1)
=> Sat Feb 28 00:00:00 0000 2009
>> Time.parse('01/31/2009').advance(:months => 1).advance(:months => 1)
=> Sat Mar 28 00:00:00 0000 2009
>> Time.parse('01/31/2009').advance(:months => 2)
=> Tue Mar 31 00:00:00 0100 2009
>> Time.parse('01/31/2009').advance(:months => 3)
=> Thu Apr 30 00:00:00 0100 2009
chris@shiny % rake spec:ci
(in /Users/chris/dev/languages/mr-experimental)
./mspec/bin/mspec ci -B ./spec/frozen/macruby.mspec spec/frozen/language spec/frozen/core/io/binmode_spec.rb spec/frozen/core/io/closed_spec.rb spec/frozen/core/io/constants_spec.rb spec/frozen/core/io/each_byte_spec.rb spec/frozen/core/io/fileno_spec.rb spec/frozen/core/io/fsync_spec.rb spec/frozen/core/io/flush_spec.rb spec/frozen/core/io/getc_spec.rb spec/frozen/core/io/io_spec.rb spec/frozen/core/io/inspect_spec.rb spec/frozen/core/io/initialize_copy_spec.rb spec/frozen/core/io/putc_spec.rb spec/frozen/core/io/readchar_spec.rb spec/frozen/core/io/sync_spec.rb spec/frozen/core/io/syswrite_spec.rb spec/frozen/core/io/tell_spec.rb spec/frozen/core/io/to_i_spec.rb spec/frozen/core/io/to_io_spec.rb spec/frozen/core/io/initialize_spec.rb
MacRuby version 0.5 (ruby 1.9.0) [universal-darwin9.0, x86_64]
................................................................EE...
1)
An exception occurred during: before :each
IO#syswrite coerces