Skip to content

Instantly share code, notes, and snippets.

View wilson's full-sized avatar

Wilson Bilkovich wilson

View GitHub Profile
def address(separator, seperator2=' ')
fields_array = %w(address1 address2 city state zip phone).map {|t| [:billing,t].join('_').to_sym}
(0..10).inject("") { |string, i|
if i.odd?
field = :seperator
field = (field.to_s + '2').intern if i == 7
else
field = fields_array[i/2]
end
temp = send(field) rescue nil
@wilson
wilson / carbon.md
Created November 5, 2009 21:23 — forked from defunkt/carbon.md
use ruby instead of perl

Vim

autocmd BufWritePre * :%s/\s\+$//e

Emacs

(add-hook 'before-save-hook 'delete-trailing-whitespace)

Textmate

@wilson
wilson / gist:11036
Created September 16, 2008 13:41 — forked from mmower/gist:11034
# Used to modify the relationship tags applied to the specified contact
#
# PUT /users/bob/contacts/alice/tags?friend=t&family=f
#
# Sets the tags on the relationship that 'bob' has with 'alice' to be 'friend' and not 'family'
#
def tags
@contact = user.contacts.with_login( params[:id] )
@relationship = user.relationships.with( @contact )
@relationship.set( tags_from_params( params ) )