岩永 賢明,勝間 亮,嶋田 大輔,土屋 勇人,西林 孝,比留間 和也,吉田 雷
エムディエヌコーポレーション
売り上げランキング: 7306
エムディエヌコーポレーション
売り上げランキング: 7306
といってもコードが書けない人がターゲットなので、このブログを見るような方が買うと残念な事になります。私はAjaxの章とHTML5の章を担当しました。HTML5の章は途中でページが足りなくなってしまい、中途半端感がありますね。
phantomjs run-jasmine.js "http://localhost:9999/test/spec_runner.html"がしかし、テストがことごとくfailしてどうにもならない。原因はPhantomjsがECMA Script6の機能をサポートしていない、オプションで有効にする事もできない故。とりあえずブラウザ実行テストは今回は諦める。
var Struct = (typeof(require) != 'undefined') ?
require(__dirname + '/../struct.js') : window.Struct;
npm testが動く様にpackages.jsonにコマンドを記述する。"scripts": {
"test": "node --harmony ./node_modules/jasmine-node/bin/jasmine-node test"
},
language: node_js
node_js:
- 0.8
branches:
only:
- master
npm testの前にnpm installも勝手にやってくれる。ステータスはTravis CIの画面で確認できて便利。
npm install struct-object
clear; alpha = rand(1, 1000); beta = rand(1, 1000); val1 = sqrt(-2 * log(alpha)) .* sin(2 * pi * beta); val2 = sqrt(-2 * log(alpha)) .* cos(2 * pi * beta); hist([val1,val2], 20);
"use strict";
/**
* @param {Number} mean 平均値
* @param {Number} std 標準偏差
*/
function gaussianRandom(mean, std) {
return randByBoxMullerTransform() * std + mean;
}
// Box Muller法を使って標準正規分布N(0,1)を得る
var randByBoxMullerTransform = (function() {
var vals = [];
function calc() {
var alpha = Math.random(),
beta = Math.random();
return [
Math.sqrt(-2 * Math.log(alpha)) * Math.sin(2 * Math.PI * beta),
Math.sqrt(-2 * Math.log(alpha)) * Math.cos(2 * Math.PI * beta)
];
}
return function() {
vals = vals.length == 0 ? calc() : vals;
return vals.pop();
}
})();
// Module export
module.exports = gaussianRandom;
"use strict";
/**
* @param {Number} mean 平均
* @param {Number} std 標準偏差
*/
function gaussianRandom(mean, std) {
return randByCentralLimitTheorem() * std + mean;
}
// 中心極限定理を使って標準正規分布N(0,1)を得る
function randByCentralLimitTheorem() {
var v = 0;
for (var i = 0; i < 12; i++) {
v += Math.random();
}
return v - 6;
}
// Module export
module.exports = gaussianRandom;
こっちの方が圧倒的に簡単でびびる。
brew install autojump
sudo apt-get install autojump
cd dev/dotfiles git submodule add https://github.com/zsh-users/antigen.git antigen git submodule init git submodule update
source ~/dev/dotfiles/antigen/antigen.zsh antigen-lib antigen-bundle autojump antigen-apply