This file contains hidden or 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 app = { name: 'fuga' }; | |
// bindパターン1 | |
var t = document.getElementById('hoge'); | |
t.addEventListener('click', function(ev) { | |
console.log(ev.target.tagName); // DIV | |
console.log(this); // fuga | |
}.bind(app)); |
This file contains hidden or 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
// define complex number | |
var Complex = (function () { | |
function Complex(x, y) { | |
this.x = x; | |
this.y = y; | |
} | |
return Complex; | |
}()); | |
// adding | |
var addc = function (z, w) { |
This file contains hidden or 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
/* **************************************************** | |
* Useful vi Commands | |
* 使える便利なviコマンド集 | |
* | |
* Update : | |
* : | |
******************************************************/ | |
http://www.crimson-snow.net/tips/unix/vim.html |
This file contains hidden or 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
<?php | |
// 変数内の改行コードを空白に変更 | |
$text = str_replace(array("\r\n","\r","\n"), ' ', $text); | |
// 正規表現での整数チェック | |
preg_match("/^[+-]?[0-9]+$/", $check, $result); | |
This file contains hidden or 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
/** bind関数のサンプル **/ | |
/** サンプル1(thisを束縛) **/ | |
var context = function() { | |
console.info(this) | |
} | |
context() // Window | |
var obj = { | |
x: 123, | |
y: 'hoge' |
This file contains hidden or 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
/** gulpの設定例 **/ | |
const gulp = require("gulp"), | |
buble = require("gulp-buble") | |
gulp.task('buble', () => { | |
gulp.src('./es6/*.js') | |
.pipe(buble()) | |
.pipe(gulp.dest('./js/')) | |
}); |
目にした、耳にしたけど頭に入っていないワードのメモ。頭に入ったものにチェックを付ける。
-
LGTM(Look Good To Me)
-
FYI(For Your Information)
-
DRY(Don't Repeat Yourself)原則
- 重複したコードを書かないこと。
- その考えに基づいて設計すること。
- 適用範囲はコードだけではない。
-
KISS(Keep It Simple, Stupid)の原則
-
YAGNI(You Aren't Going to Need It)
This file contains hidden or 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
"####################### | |
" 表示系 | |
"####################### | |
" set number "行番号表示 | |
set showmode "モード表示 | |
set title "編集中のファイル名を表示 | |
set ruler "ルーラーの表示 | |
set showcmd "入力中のコマンドをステータスに表示する | |
set showmatch "括弧入力時の対応する括弧を表示 |