Skip to content

Instantly share code, notes, and snippets.

View gist:00abc59bc96848b732ba
// Playground - noun: a place where people can play
import Cocoa
// Immutable
let apiKey = "12lkj1llk1j291lnk12el"
// Mutable
var changingValue = "I might change!"
View ConvertMovies.rb
# Convert all dvdmedia files in the current directory to iso images
# OSX only
# .dvdmedia files are really just folders that hold the VIDEO_TS/AUDIO_TS
# but adding .dvdmedia make OSX do nice things
movie_directory = Dir.open( Dir.pwd )
movie_directory.entries.each do |movie|
if movie.include? '.dvdmedia' then
movie_name = movie.chomp '.dvdmedia'
puts movie + " --> " + movie_name
result = `hdiutil makehybrid -udf -udf-volume-name #{movie_name} -o #{movie_name} #{movie}`
View gist:137708
public void encodeBegin( FacesContext context ) throws IOException {
super.encodeBegin( context );
// Without this 'if' statement everything gets rendered again on every partial submit
if( getChildCount() == 0 ) {
processTagAttributes();
if( fieldSetContainerList != null && !fieldSetContainerList.isEmpty() ) {
View gist:137958
ENV['GEM_HOME'] = '/home/<dreamhost user name>/.gems'
ENV['GEM_PATH'] = '$GEM_HOME:/usr/lib/ruby/gems/1.8'
require 'rubygems'
Gem.clear_paths
View gist:276366
Bryan:
macruby-nightly [ ]
ree-1.8.6-20090610 [ x86_64 ]
ree-1.8.7-2009.10 [ x86_64 ]
=> ruby-1.8.6-p383 [ x86_64 ]
ruby-1.9.1-p376 [ x86_64 ]
(default) ree-1.8.7-2009.10 [ x86_64 ]
system [ ]
View gist:283154
ree-1.8.7-2009.10 [ x86_64 ]
ruby-1.8.6-p383 [ x86_64 ]
=> ruby-1.8.7-p248 [ x86_64 ]
ruby-1.9.1-p376 [ x86_64 ]
=> (default) ruby-1.8.7-p248 [ x86_64 ]
system [ x86_64 i386 ppc ]
View gist:292319
under RVM 1.8.7:
MBP:oss ed$ ruby -rubygems test.rb
Successfully installed thor-0.12.3
1 gem installed
/Users/ed/.rvm/ruby-1.8.7-p248/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:31: warning: already initialized constant EXPR_BEG
/Users/ed/.rvm/ruby-1.8.7-p248/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:32: warning: already initialized constant EXPR_MID
/Users/ed/.rvm/ruby-1.8.7-p248/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:33: warning: already initialized constant EXPR_END
/Users/ed/.rvm/ruby-1.8.7-p248/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:34: warning: already initialized constant EXPR_ARG
/Users/ed/.rvm/ruby-1.8.7-p248/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:35: warning: already initialized constant EXPR_FNAME
View gist:292318
john-mbp:gem_filer john$ ruby -rubygems gem_runner_test.rb
Successfully installed thor-0.12.3
1 gem installed
/Users/john/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:31: warning: already initialized constant EXPR_BEG
/Users/john/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:32: warning: already initialized constant EXPR_MID
/Users/john/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:33: warning: already initialized constant EXPR_END
/Users/john/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:34: warning: already initialized constant EXPR_ARG
/Users/john/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:35: warning: already initialized constant EXPR_FNAME
/Users/john/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:36: warning: already initialized constant EXPR_DOT
/Users/john/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:37: warning: already initialized constant EXPR_CLASS
View install_rails_3.sh
#!/bin/bash
gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
gem install rails --pre