This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
module ApplicationHelper | |
def cities_helper | |
[ | |
['基隆市', '基隆市'], | |
['台北市', '台北市'], | |
['新北市', '新北市'], | |
['桃園縣', '桃園縣'], | |
['新竹市', '新竹市'], | |
['新竹縣', '新竹縣'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready -> | |
# $("div#[id^='flash_']").fadeOut(4000) | |
$("input[type='submit']").addClass("primary btn"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready -> | |
# $("div#[id^='flash_']").fadeOut(4000) | |
$("input[type='submit']").addClass("primary btn") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby recursive hash examples | |
# http://metaskills.net/2012/03/12/store-configurable-a-lesson-in-recursion-in-ruby/ | |
# trick 1 | |
class RecursiveHash < Hash | |
Recursive = lambda { |h,k| h[k] = h.class.new } | |
def initialize | |
super(&Recursive) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n | |
zh-TW: | |
errors: | |
messages: | |
expired: "已經過期,請重新申請一個" | |
not_found: "找不到" | |
already_confirmed: "已經驗證,請直接登入" | |
not_locked: "被鎖定了" | |
not_saved: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11:00:31,840 INFO [wordsentry] (http-/0.0.0.0:8080-1) method=GET path=/admin/app_configs format=html controller=app_configs action=index status=200 duration=338.00 view=282.00 | |
11:00:40,459 INFO [wordsentry] (http-/0.0.0.0:8080-2) method=GET path=/admin/users format=html controller=users action=index status=200 duration=579.00 view=491.00 | |
11:00:54,061 INFO [wordsentry] (http-/0.0.0.0:8080-2) method=GET path=/admin/orgs format=html controller=orgs action=index status=200 duration=174.00 view=141.00 | |
11:00:59,046 INFO [wordsentry] (http-/0.0.0.0:8080-1) method=GET path=/admin/reports format=html controller=reports action=index status=200 duration=301.00 view=299.00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
sudo apt-get -y update | |
sudo apt-get -y install build-essential libyaml-dev zlib1g-dev openssl libssl-dev libreadline6-dev | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz | |
tar -xvzf ruby-2.0.0-p0.tar.gz | |
cd ruby-2.0.0-p0 | |
sudo ./configure --prefix=/usr/local | |
sudo make | |
sudo make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function render_result(queryText) { | |
// Test if the broswer supports geolocation | |
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(function(position) { | |
// Get geolocation from the browser's location | |
latitude = position.coords.latitude; | |
longitude = position.coords.longitude; |
OlderNewer