Skip to content

Instantly share code, notes, and snippets.

@gfguthrie
gfguthrie / .zshrc
Created September 27, 2019 22:02
Lazy Load Homebrew NVM but still have default aliased Node in PATH
# normal brew nvm shell config lines minus the 2nd one
# lazy loading the bash completions does not save us meaningful shell startup time, so we won't do it
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/etc/bash_completion" ] && . "/usr/local/opt/nvm/etc/bash_completion" # This loads nvm bash_completion
# add our default nvm node (`nvm alias default 10.16.0`) to path without loading nvm
export PATH="$NVM_DIR/versions/node/v$(<$NVM_DIR/alias/default)/bin:$PATH"
# alias `nvm` to this one liner lazy load of the normal nvm script
alias nvm="unalias nvm; [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"; nvm $@"
@gfguthrie
gfguthrie / select_option.rb
Created December 14, 2012 19:25
Class to quickly make objects for the options_from_collection_for_select helper
# @example Quickly make objects for options_from_collection_for_select helper
# in myclass_helper.rb:
# def my_select_columns
# [ SelectOption.new(id: 1, name: 'first'), SelectOption.new(id: 2, name: 'second') ]
# end
#
# in myclass/action.html.haml:
# = select_tag :my_select, options_from_collection_for_select(my_select_columns, 'id', 'name', 1)
class SelectOption