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
/*--------------------------------------------------------- | |
* Closure | |
* ---------------------------------------------------------- | |
* Closureは関数の閉じられたScopeの中でprivateな変数を定義すること | |
* 関数の中でのみ変数の更新を許可し、変数の状態を保持する | |
* */ | |
function createCounter() { | |
// 外部からアクセスできない変数 |
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
/*------------------------------------- | |
* Observerパターン | |
* ------------------------------------- | |
* Observerクラスに監視者を登録 | |
* 通知者がイベントを通知 | |
* 監視者はイベントを受け取り、目的を実行する | |
* | |
* | |
* ### 以下はとても単純なObserverパターンの例 ### | |
* Observerクラスは関数を配列に格納し、triggerで格納している関数を実行する |
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 WebpackNotifierPlugin = require('webpack-notifier'); | |
var ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
module.exports = { | |
devtool: 'inline-source-map', | |
entry: './src/js/index.js', | |
output: { | |
path: "./dist", | |
filename: "bundle.js" | |
}, |
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
{ | |
"always-semicolon": true, | |
"remove-empty-rulesets": false, | |
"block-indent": 2, | |
"color-case": "lower", | |
"color-shorthand": true, | |
"element-case": "lower", | |
"eof-newline": true, | |
"leading-zero": false, | |
"space-after-colon": 1, |
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
/* | |
参考: [javascript - ScrollTo with animation - Stack Overflow](http://stackoverflow.com/questions/12199363/scrollto-with-animation) | |
*/ | |
window.requestAnimFrame = (function () { | |
return window.requestAnimationFrame || | |
window.webkitRequestAnimationFrame || | |
window.mozRequestAnimationFrame || | |
function (callback) { | |
window.setTimeout(callback, 1000 / 60); |
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 replaceTextRange(str, start, end, substitute) { | |
return str.substring(0, start) + substitute + str.substring(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
/** | |
* 再帰的にchildren nodeを探索してnodeにnodeDepthを付ける | |
* | |
* @param {Array} children - node chldren | |
* @param {Number} depth - childrenのnodeDepth数 | |
*/ | |
function attachNodeDepth(children, depth) { | |
for (const node of children) { | |
node.nodeDepth = depth; | |
if (node.children) attachNodeDepth(node.children, depth + 1); |
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
{ | |
"always-semicolon": true, | |
"block-indent": 4, | |
"color-case": "lower", | |
"color-shorthand": true, | |
"element-case": "lower", | |
"eof-newline": true, | |
"leading-zero": false, | |
"quotes": "single", | |
"remove-empty-rulesets": false, |
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
declare module 'r-dom' { | |
import { | |
ReactDOM, | |
ReactElement, | |
ReactNode, | |
Attributes, | |
SFC, | |
ClassType, | |
ClassicComponent, | |
ComponentState, |
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
/* | |
[wooorm/unified: ☔ Text processing umbrella: Parse / Transform / Compile](https://github.com/wooorm/unified) | |
version: 6.0.1 | |
*/ | |
declare module 'unified' { | |
export = processor | |
/* processor function */ |
OlderNewer