Skip to content

Instantly share code, notes, and snippets.

View tsechingho's full-sized avatar

Tse-Ching Ho tsechingho

View GitHub Profile
ckeditor_rails (4.3.1)
railties (>= 3.0)
@tsechingho
tsechingho / unicorn.cap
Created March 31, 2014 11:28
capistrano 3 examples
namespace :load do
task :defaults do
set :unicorn_bin, :unicorn_rails
set :unicorn_pid, -> { shared_path.join('tmp', 'pids', 'unicorn.pid') }
set :unicorn_config, -> { current_path.join('config', 'unicorn.rb') }
set :unicorn_gemfile, -> { current_path.join('Gemfile') }
set :unicorn_env, -> { fetch(:rails_env) || fetch(:stage) }
set :unicorn_roles, :app
set :unicorn_sleep, 2
end
@tsechingho
tsechingho / unicorn.conf
Created December 1, 2014 08:35
unicorn example
## development
# app_path = `pwd`.strip
# app_shared_path = app_path
# app_current_path = app_path
# master_port = 4000
## production
app_path = '/srv/deploy/ufolio'
app_shared_path = "#{app_path}/shared"
app_current_path = "#{app_path}/current"
@tsechingho
tsechingho / ability.rb
Last active August 29, 2015 14:13
cancancan abilities
# app/models/ability.rb
module Ability
class << self
def ability_for user, options = {}
abilities = AnonymousAbility.new
return abilities unless user
abilities.merge MemberAbility.new user, options
@tsechingho
tsechingho / complex_sass
Last active August 29, 2015 14:18
slim_sass_coffee
// http://thesassway.com/advanced/inverse-trigonometric-functions-with-sass
$default-threshold: pi() / 180 / 20
@function convert-angle($value, $unit-name)
$factors: (rad: 1rad, deg: 180deg / pi(), grad: 200grad / pi(), turn: 0.5turn / pi())
@if not unitless($value)
@warn "`#{$value}` should be unitless"
@return false
@if not map-has-key($factors, $unit-name)
# This file is auto-generated from the current state of the database. Instead of editing this file,
# please use the migrations feature of Active Record to incrementally modify your database, and
# then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
# to create the application database on another system, you should be using db:schema:load, not running
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
Mac-Mini:Codes tsechingho$ rails test -m http://github.com/tsechingho/authlogic_bundle/raw/master/templates/remote.rb
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create config/initializers
create config/locales
create db
@tsechingho
tsechingho / gist:3412459
Created August 21, 2012 05:58 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
職務名稱: Rails 工程師
需求人數: 1 - 2 人
職務類別: 軟體設計工程師、Internet程式設計師
工作單位:
* 國立陽明大學 生物資訊研究所 楊永正實驗室
工作項目:
* 生物資訊系統開發。
* 有參與國際合作計畫之機會,歡迎有志者加入。
職能要求:
upstream some_app_server {
server 127.0.0.1:9393;
}
server {
listen 80;
server_name my-upload-endpoint.com ;