Skip to content

Instantly share code, notes, and snippets.

@bjhess
bjhess / languages.txt
Created June 8, 2012 15:12
Languages I've been paid to code.
Ruby
CoffeeScript
JavaScript
Java
VBScript
VB
COBOL
Easytrieve
JCL
CSS
irb> Array(nil)
=> []
irb> Array("string")
=> ["string"]
irb> Array([:blah, :sah])
=> [:blah, :sah]
irb> "string".to_a
NoMethodError: undefined method `to_a' for "string":String
from (irb):5
from /Users/barry/.rbenv/versions/1.9.3-p125/bin/irb:12:in `<main>'
@bjhess
bjhess / aliases
Created December 19, 2011 01:04
git diff'n
# side by side diff
alias gside="git difftool -t opendiff"
# resolve merge conflicts with filemerge
alias gmergetool="git mergetool -t opendiff"
Mac Mini:
http://minneapolis.craigslist.org/dak/sys/2597426604.html
BenQ 24" monitor:
http://minneapolis.craigslist.org/dak/sys/2597456508.html
Dell 18" monitor:
@bjhess
bjhess / action_methods.rb
Created June 17, 2011 14:12
WTH do I get all of these `_conditional_callback` methods when I use an `around_filter`? Rails 3.0.6
> UsersController.action_methods
=> #<Set: {"new", "_conditional_callback_around_36", "edit", "forgot_password", "_conditional_callback_around_60", "_conditional_callback_around_49", "_conditional_callback_around_27", "_conditional_callback_around_50", "_conditional_callback_around_39", "delete_avatar", "_conditional_callback_around_30", "show", "raw", "activate", "_conditional_callback_around_65", "create", "_conditional_callback_around_55", "_conditional_callback_around_33", "update", "_conditional_callback_around_44"}>
> UsersController.action_methods
=> #<Set: {"new", "_conditional_callback_around_36", "edit", "forgot_password", "_conditional_callback_around_60", "_conditional_callback_around_49", "_conditional_callback_around_27", "_conditional_callback_around_50", "_conditional_callback_around_39", "delete_avatar", "_conditional_callback_around_30", "show", "raw", "activate", "_conditional_callback_around_65", "create", "_conditional_callback_around_55", "_conditional_callback_around_33", "update", "_conditional_callback_around_44"}>
@bjhess
bjhess / xero-partner-oauth-plain.rb
Created June 16, 2011 15:21
Getting Xero Partner app to work on a Mac (from Xero)
require 'rubygems'
require 'oauth'
require 'oauth/signature/rsa/sha1'
class SSLConsumer < OAuth::Consumer
def initialize *args
@ssl = {}
super
end
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
html, body { height:100%; margin: 0 auto; }
body { display: table; vertical-align: middle; }
.column { display:table-cell; vertical-align: middle; }
p { text-align: center; }
</style>
</head>
~ $ which rvm
/Users/barry/.rvm/bin/rvm
~ $ sudo gem uninstall rvm
Password:
Select gem to uninstall:
1. rvm-0.1.47
2. rvm-1.0.20
3. rvm-1.0.21
4. rvm-1.0.19
[Mon, 08 Nov 2010 13:34:19 -0600] INFO: Setting the run_list to ["homebrew", "homebrew::dbs", "homebrew::misc", "ruby", "ruby::irbrc", "node", "python"] from JSON
[Mon, 08 Nov 2010 13:34:19 -0600] INFO: Starting Chef Run (Version 0.9.12)
[Mon, 08 Nov 2010 13:34:19 -0600] INFO: Ran script[install_something] successfully
[Mon, 08 Nov 2010 13:34:19 -0600] INFO: Ran execute[include cinderella environment into defaults for ~/.zshrc] successfully
[Mon, 08 Nov 2010 13:34:19 -0600] INFO: Installing homebrew[git] version 1.7.3.2
[Mon, 08 Nov 2010 13:34:20 -0600] INFO: Ran script[updating homebrew from github] successfully
[Mon, 08 Nov 2010 13:34:21 -0600] INFO: Installing homebrew_db[redis] version 2.0.4
[Mon, 08 Nov 2010 13:34:21 -0600] INFO: Configuring redis to automatically start on login
[Mon, 08 Nov 2010 13:34:22 -0600] INFO: Installing homebrew_db[mongodb] version 1.6.3-x86_64
[Mon, 08 Nov 2010 13:34:22 -0600] INFO: Configuring mongodb to automatically start on login