View caching.md

Caching

1. Client-side caching

  • max-age
  • etag
  • last_modified

max-age

View git_tutorial.md
git config --local credential.helper store
git config http.sslVerify false

git remote -v
git remote set-url origin https://..../example.git

# 取得遠端的branch並在本地端建立一個branch
git checkout --track -b feature_branch origin/feature_branch
View vagrant_ubuntu.md

vagrant ubuntu/xenial64

sudo apt-get -y update
sudo apt-get install -y build-essential zlib1g-dev curl git-core sqlite3 libsqlite3-dev

sudo apt-get install -y libssl-dev libreadline-dev
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
View vagrant.md
mkdir -p /Users/joshchang/Documents/vagrant_box
vagrant package --output /Users/joshchang/Documents/vagrant_box/mybox.box
vagrant box add mybox /Users/joshchang/Documents/vagrant_box/mybox.box

# New project
vagrant init mybox
vagrant up
View example.html
<html>
<head>
<style type="text/css">
ul li {
margin-bottom: 10px;
cursor: move;
}
</style>
</head>
View cell.md

Cell event

本質上Cell比較類似Controller,針對任一Resource的CRUD行為可以事件驅動方式被呼叫。

  • Example FoosCell
Funcaion Function params Event Event params
index event 'foos:index' -
View logger.js
var logger = function () {
var oldDebug = null,
oldLog = null,
oldInfo = null,
oldWarn = null,
oldError = null;
return {
enable: function () {
if (oldLog === null) return;
View base.scss
@include text-overflow;
@include text-shadow(0 -1px 1px #21272B);
@include border-radius(2px, 2px);
@include border-bottom-left-radius(8px);
@include box-shadow(rgba(0, 0, 0, 0.05) 3px 3px 5px);
@include single-box-shadow(rgba(0, 0, 0, 0.075), 0, 0, 3px);
@include single-transition(opacity, 0.2s, linear, 0s);
@include background(linear-gradient($color-btn, darken($color-btn, 10%)));
@include background-image(linear-gradient(lighten($color-btn, 5%), darken($color-btn, 15%)));
@include background-image(none);
View application_controller.rb
class ApplicationController < ActionController::Base
before_filter :mobile_view_redirect
layout :which_layout
def mobile_device?
request.user_agent =~ /Mobile|webOS|Android/
end
helper_method :mobile_device?
View gist:3606389
# 查foreign key
# login in mysql
mysql -u root -p
use information_schema;
select TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME from KEY_COLUMN_USAGE where REFERENCED_TABLE_NAME = '<TABLE NAME>';
# 列出wed_development的所有FK
SELECT i.TABLE_SCHEMA, i.TABLE_NAME, i.CONSTRAINT_TYPE, i.CONSTRAINT_NAME, k.REFERENCED_TABLE_NAME, k.REFERENCED_COLUMN_NAME
FROM information_schema.TABLE_CONSTRAINTS i
LEFT JOIN information_schema.KEY_COLUMN_USAGE k ON i.CONSTRAINT_NAME = k.CONSTRAINT_NAME