Skip to content

Instantly share code, notes, and snippets.

View daneharrigan's full-sized avatar

Dane Harrigan daneharrigan

View GitHub Profile
require 'rubygems'
path = File.expand_path( File.dirname(__FILE__) )
$LOAD_PATH << "#{path}/gems"
require 'yaml'
require 'twitter'
config = YAML.load_file("#{path}/.config")['twitter']
// select all input elements excluding hidden fields
$('input:not(input[type=hidden])')
// or...
// select input by name, but still exclude hidden fields
$('input[name=model_field]:not(input[type=hidden])')
@daneharrigan
daneharrigan / gist:984655
Created May 21, 2011 16:29
4 ways to define class methods
# most people do
class Foo
def self.method1
puts "method1"
end
end
# or this
class Foo
class << self
@daneharrigan
daneharrigan / gist:1039444
Created June 22, 2011 03:19
to load or not to load
# pros
# - leverages the existing test helpers
# - doesn't requiring creating an extra rails environment for a few tests
# - keeps the tests running in one suite
#
# cons
# - cant load multiple environments at the class level, will error if tried
# - will need to be revised if more than one class level load is needed
# - loaded environment lives for the whole lifecycle of the test suite
#
######
#
# Solution:
#
# You've found this gist because you're trying to install Rubinius 2.0 with RVM
# and the configuring or compiling stage fails. At the time of writing this Rubinius's
# build process relies on ruby 1.8.7. If you have any version of MRI 1.9.x installed with RVM,
# you'll get the error below.
#
# RVM has a bash script function called "__rvm_mri_ruby" that is defined in .rvm/scripts/functions/build.
@daneharrigan
daneharrigan / gist:1172656
Created August 26, 2011 03:57
brew install node
eva:~ dharrigan$ brew install node
==> Downloading http://nodejs.org/dist/node-v0.4.10.tar.gz
==> ./configure --prefix=/usr/local/Cellar/node/0.4.10
==> make install
==> Caveats
Please add /usr/local/lib/node_modules to your NODE_PATH environment variable to have node libraries picked up.
==> Summary
/usr/local/Cellar/node/0.4.10: 72 files, 7.6M, built in 5.1 minutes
export CDPATH=$CDPATH:~/Projects/Heroku:~/Projects/Personal
# bash completion
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
*** OMG ***
6.8999999999999915
body {
background: #454545; }
********************
*** OMG ***
6.999999999999991
body {
background: #454545; }
********************
#000
#05060D
#081A30
#0F0F14
#0F0F17
#100B0F
#100F14
#101018
#111115
#111117
eva:rubinius dharrigan$ rake spec19 --trace
** Invoke spec19 (first_time)
** Invoke build (first_time)
** Invoke build:build (first_time)
** Invoke build:llvm (first_time)
** Execute build:llvm
** Invoke vm/vm (first_time)
** Invoke vm/gen/revision.h (first_time)
** Execute vm/gen/revision.h
** Invoke vm/gen/config_variables.h (first_time, not_needed)