Skip to content

Instantly share code, notes, and snippets.

View randland's full-sized avatar

Nick Karpenske randland

  • Doximity
  • Boulder, CO
View GitHub Profile

Keybase proof

I hereby claim:

  • I am randland on github.
  • I am randland (https://keybase.io/randland) on keybase.
  • I have a public key ASD06NWrWKWq8-MMuaVtmxgRTEhuDQ7vWYetRwzDmVZQbAo

To claim this, I am signing this object:

def random_in(a, *b)
b.any? ? [a, *b][rand(b.count+1)] : a.to_a[rand(a.count)]
end
@randland
randland / application_helper.rb
Created June 22, 2010 15:51 — forked from mtodd/enumerable_with_context.rb
Breadcrumbs. Uses Route recognition and intelligent naming
module ApplicationHelper
def breadcrumb(url, options = {})
options.reverse_merge!( :separator => ' » ',
:home_link => 'Home')
path_segments = url.sub(/\?.*/,'').split('/')[1..-1]
return '' if path_segments.blank? # ie: suppress breadcrumbs on homepage