Skip to content

Instantly share code, notes, and snippets.

View zarzax's full-sized avatar

Nora Young zarzax

View GitHub Profile
@zarzax
zarzax / convert_yaml_to_json_locales.rb
Created November 16, 2010 14:00
convert YAML into JSON i18n internationalization locale files
# Transform a YAML i18n local files into JSON object.
# suitable when using Rails YAML for javascript UI translations.
#
# This takes files DIR_ROOT/locale and outputs DIR_ROOT/js/locale
# filenames are determined by YAML filename.
#
# Mark Young @zarzax Nov 2010
#
# Transforms YAML en.yml:
# en:
@zarzax
zarzax / menu_helper.rb
Created November 15, 2010 18:48
provide a current_controller? helper useful in creating menu
#
# A rails helper snippet I find helpful for building main navigation
# when you want to highlight main pages (controllers) when browser
# requests a subpage.
#
# eg. current request '/users/1/edit' but we want to highlight
# the menu link to '/users'. current_page? will be false but
# the current_controller? function will be true
#