Skip to content

Instantly share code, notes, and snippets.

View danpecher's full-sized avatar

Daniel Pecher danpecher

View GitHub Profile
@danpecher
danpecher / README.md
Created September 9, 2016 15:23 — forked from jherdman/README.md
A Gem loading benchmark script

Benchmark Bundler

Because loading gems can take longer than you think

$ curl -fsSL https://gist.github.com/jherdman/5025684/raw/a3ccd4b5308723245706b4ae315845fe951b4473/benchmark.rb | ruby
............................................................[DONE]

Gem                            Time(sec)     Pct %
--------------------------------------------------
@danpecher
danpecher / navigation_helper.rb
Created May 13, 2016 14:14 — forked from skojin/navigation_helper.rb
Rails Helper to build 'active' links
module NavigationHelper
# get navigation 'active' css class if rule match
def nav_class(match_rules)
navigation_url_active?(nil, match_rules) ? 'active' : nil
end
# @param match_rules if :resource symbol, then match to url that starts withs specified url
# @param match_rules if :same symbol, then match exactly to url
# @param match_rules if hash {:controller, :action, :path, :method} and same yes with _not suffix (like :controller_not)