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
setTimeout((function(cnt){ | |
console.log(cnt.length), | |
(cnt.length > new Number('99') || | |
arguments.callee((cnt.push(''), cnt))) | |
).bind(this, [''])) |
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
events { | |
worker_connections 1024; | |
} | |
http { | |
# ロードバランサ | |
# 交互に中継する | |
upstream lb { | |
server localhost:8081; | |
server localhost:8082; | |
} |
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 Klass = function(text){ this.text = text; }; | |
Klass.prototype.method1 = function(){ return this.text + 'のメソッド' }; | |
var descriptor = Object.getOwnPropertyDescriptor(Klass.prototype, 'method1') | |
, originalFunction = descriptor.value; | |
descriptor.value = function(){ console.warn('method1 is deprecated'); return originalFunction.apply(this); }; | |
Object.defineProperty(Klass.prototype, 'method1', descriptor); | |
console.log(new Klass('メソッド1').method1()); |
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 zero = +new Date() | |
, now = function(){ return +new Date() - zero; } | |
, wait = function(time){ var start = now(); while(now() - start < time){}; }; | |
console.log('start:', now()); // #start: 0 | |
// ======================================== | |
setTimeout(function(){ | |
console.log('async:', now()); // #async: ? | |
}, 1000); | |
wait(1500); |
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 main = require('./module/main.js'); | |
main.load('assets/js/data.json'); |
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
import DomRenderer from './DomRenderer.js'; | |
const title = 'title'; | |
document.body.appendChild(DomRenderer.render( | |
<dummy> | |
<h1>{title}</h1> | |
<button callback={onClick}>button</button> | |
</dummy> | |
)); |
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
https://jsfiddle.net/62mtbcc4/ |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>status-bar tap event</title> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
</head> | |
<body style="margin: 0;"> | |
<div id="hidden-header" style="position: relative; z-index: 2; background: #808080;">hidden-header</div> | |
<div id="header" style="position: relative; z-index: 2; background: #cccccc;">header</div> | |
<div id="container" style="overflow: auto; position: relative; z-index: 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
// 使える!! | |
$('body').velocity(); | |
// ただし、下記のようにどこかしらでVelocityを参照していないとプラグインを読み込んでくれない | |
// 結局のところエントリポイントのファイルとかでimport 'jquery-velocity';読んでおくのがベターな気がする | |
Velocity; |
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
// 入力から学習した漢字->ひらがなのマッピングを入れる | |
const mapping = {}; | |
// 漢字の部分を取得するための正規表現キー | |
// 漢字としているが、実際にはひらがな以外の文字で、カタカナなども含む | |
const KANJI = '(.+)'; | |
/** | |
* 学習した漢字->ひらがなのマッピングを適用して学習済みの漢字をひらがなに置き換える | |
* @param {string} _word |
OlderNewer