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
// 定義 remote method | |
loopback.remoteMethod( | |
Document.findAll, | |
{ | |
description: 'Find all folder and sub-folders for a user', | |
accepts: [ | |
// 注意這裏指定從 req.query 裏取值,這是最彈性的方式了 |
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
1. remoteMethod 如何控管存取權限? | |
- 用 beforeRemote 與 afterRemote hook 做檢查 | |
- 通常我偏好在 beforeRemote hook 做,原因: | |
- 可前期過濾與檢查用戶傳來的參數,例如刪掉格式不正確的內容,或強制塞入指定的參數 | |
- 可精準組合 query 指令,避免撈出多餘的資料 | |
- 如果用 after hook | |
- 就是先撈出所有資料,在返還給客戶端前刪掉不屬於該員的筆數 |
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
var React = require('react'); | |
require('node-jsx').install(); | |
var MyApp = React.createFactory( require('./myApp') ); | |
var app = new MyApp({items:['a', 'b', 'c']}); | |
var str = React.renderToString( app ); | |
console.log( 'str: ', str, '\n\n\n', app ); |
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
// 選出 UI 元素 | |
var refreshButton = document.querySelector('.refresh'); | |
var closeButton1 = document.querySelector('.close1'); | |
var closeButton2 = document.querySelector('.close2'); | |
var closeButton3 = document.querySelector('.close3'); | |
// 偵聽 ui 元素的 click 事件並生成 observable | |
var refreshClickStream = Rx.Observable.fromEvent(refreshButton, 'click'); | |
var close1ClickStream = Rx.Observable.fromEvent(closeButton1, 'click'); | |
var close2ClickStream = Rx.Observable.fromEvent(closeButton2, 'click'); |
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
Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. |
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
# 內容 | |
# repo 位置 | |
- https://github.com/facebook/react | |
- https://github.com/facebook/flux | |
# 官網 | |
- React | |
* http://facebook.github.io/react/ |
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
## Docker for Front-End Developer | |
# 解決問題 | |
- "Works on my machine!" | |
- 新人 on-board 可快速布署開發環境 | |
- 小巧敏捷,較 vm 節省資源 |
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
# DOM life cycle event | |
- DOM mutation event ← 最早期,已 retired | |
- 新版是 Mutation Observers ← angular 與 polymer 都靠這個 | |
- observer.observe() | |
- 範例: http://stackoverflow.com/questions/3219758/detect-changes-in-the-dom |
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
<!-- A - semantic via class names --> | |
<div class="event"> | |
<div class="label"> | |
<i class="circular pencil icon"></i> | |
</div> | |
<div class="content"> | |
<div class="date"> | |
3 days ago | |
</div> | |
<div class="summary"> |
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() { | |
var CustomEvents; | |
CustomEvents = (function() { | |
function CustomEvents() {} | |
CustomEvents.bind = function(element, eventName, handler) { | |
if (element.addEventListener) { | |
return element.addEventListener(eventName, handler, false); |