Skip to content

Instantly share code, notes, and snippets.

View cyanglee's full-sized avatar

Kenneth Lee cyanglee

View GitHub Profile
@cyanglee
cyanglee / hack.sh
Created March 31, 2012 14:58 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
$(document).ready ->
# $("div#[id^='flash_']").fadeOut(4000)
$("input[type='submit']").addClass("primary btn")
$(document).ready ->
# $("div#[id^='flash_']").fadeOut(4000)
$("input[type='submit']").addClass("primary btn");
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :find_user
#before_filter :set_locale
# redirect to the root page if the user doesn't have the permission to acccess that section of the site
rescue_from CanCan::AccessDenied do |exception|
# don't provide any information for users who access to the admin section
if exception.subject == :rails_admin
redirect_to "/"
@cyanglee
cyanglee / gist:1063869
Created July 4, 2011 20:11
Unicode in Rails
# coding: utf-8
module ApplicationHelper
def cities_helper
[
['基隆市', '基隆市'],
['台北市', '台北市'],
['新北市', '新北市'],
['桃園縣', '桃園縣'],
['新竹市', '新竹市'],
['新竹縣', '新竹縣'],