Skip to content

Instantly share code, notes, and snippets.

View davidlee's full-sized avatar

David Lee davidlee

  • Melbourne, Australia
View GitHub Profile
@davidlee
davidlee / gist:189989
Created September 20, 2009 23:47
script/firefox for selenium firefox path
#!/bin/sh
export FIREFOX=/Applications/Firefox.app
/usr/bin/open $FIREFOX $1
class Hash
def with_slutty_access
HashWithSluttyAccess.new(self)
end
end
# as per HashWithIndifferentAccess, with some OpenStruct flavour
class HashWithSluttyAccess < HashWithIndifferentAccess
#
# gem tools (ZSH)
#
# this is a guess. salt to taste.
export GEMPATH=`ruby -e 'require "rubygems"; puts Gem.path.reject{|p| p =~ /\.gem/ }.first'`/gems
# completion fuction for compdef: just lists the gems folders
_gems() { compadd `cd $GEMPATH; echo *` }
_ghems() { compadd `cd $GEMPATH; echo *-[a-z]* | egrep '' ` }
#!/usr/bin/env ruby
class Object
# within the block, handle method_missing with another object.
def with_methods_on( other )
_other = other
# todo: also handle respond_to?
(class << self; self; end).class_eval do
alias_method :method_missing_before_voodoo, :method_missing
setopt interactive_comments;
#
# gem tools
#
# this is a guess. salt to taste.
export GEMPATH=`ruby -e 'require "rubygems"; puts Gem.path.reject{|p| p =~ /\.gem/ }.first'`/gems
# completion fuction for compdef: just lists the gems folders
_gems() { compadd `cd $GEMPATH; echo *` }
class NeuWizard
include StateFu
machine( :status ) do
state :info,
:tmp => 'page_1',
:first => true do
event :forward, :to => :betreuer
end
>> d = Factory :document
=> #<Document id: 12, upload_id: 5, title: nil, file_file_name: "grindewald.jpg", file_content_type: "image/jpeg", file_file_size: 5529, file_updated_at: "2009-07-14 04:08:09", created_at: "2009-07-14 04:08:09", updated_at: "2009-07-14 04:08:09", upload_error_code: nil, folder_id: 15, scanned: nil, indexed: nil, thumbnailed: nil, upload_status_field: "uploaded", status_field: "new", deleted_at: nil, revisable_original_id: nil, revisable_branched_from_id: nil, revisable_number: 0, revisable_name: nil, revisable_type: nil, revisable_current_at: nil, revisable_revised_at: nil, revisable_deleted_at: nil, revisable_is_current: true, merged_into_document_id: nil>
>> d.reload
=> #<Document id: 12, upload_id: 5, title: nil, file_file_name: "grindewald.jpg", file_content_type: "image/jpeg", file_file_size: 5529, file_updated_at: "2009-07-14 04:08:09", created_at: "2009-07-14 04:08:09", updated_at: "2009-07-14 04:08:09", upload_error_code: nil, folder_id: 15, scanned: nil, indexed: nil, thumbna
# sudo gem install irb-history wirble
require 'rubygems'
require 'irb/completion'
require 'irb/ext/save-history'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
IRB.conf[:SAVE_HISTORY] = 1000
HISTFILE = IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
require 'wirble'
namespace :spec do
def find_last_modified_spec
require 'find'
specs = []
Find.find( File.expand_path(File.join(RAILS_ROOT,'spec'))) do |f|
next unless f =~ /_spec.rb$/
specs << f
end
spec = specs.sort_by { |spec| File.stat( spec ).mtime }.last
end
autoconf @2.63 devel/autoconf
automake @1.11 devel/automake
bison @2.4.1 devel/bison
boehmgc @7.1 devel/boehmgc
couchdb @0.9.0 databases/couchdb
ctags @5.7 devel/ctags
curl @7.19.5 net/curl
emacs @22.3 editors/emacs
emacs-app @23.0.0_NS-9.0rc3 aqua/emacs-app
emacs-app-devel @20090104 aqua/emacs-app-devel