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 (global) { | |
'use strict' | |
var isBrowser = !! global.self | |
var isWorker = !! global.WorkerLocation | |
var isNodeJS = !! global.global | |
var Valid, emitter | |
if (isNodeJS) { | |
Valid = require('js-valid') | |
emitter = require('evem-min') |
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
var q = module.exports = require('qunitjs') | |
require('qunit-tap')(q, console.log.bind(console)) | |
q.init() | |
q.config.updateRate = 0 | |
q.assert.is = q.assert.strictEqual | |
q.assert.like = function (str, reg, mes) { t.ok(reg.test(str), mes) } |
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
<!doctype html> | |
<head> | |
<meta charset="utf-8" /> | |
<link rel="stylesheet" href="./qunit/qunit-1.10.0.css" /> | |
<script src="./qunit/qunit-1.10.0.js"></script> | |
<script src="./qunit/qunit-tap.js"></script> | |
<script> | |
window.console || (window.console = {_:[]}) | |
window.console.log || (window.console.log = function (mes) { this._.push(mes) }) | |
qunitTap(QUnit, function () { console.log.apply(console, arguments) }) |
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 (global) { | |
'use strict' | |
var isBrowser = !! global.self | |
var isWorker = !! global.WorkerLocation | |
var isNodeJS = !! global.global | |
var emitter = {} | |
emitter.constructor = function constructor () { | |
this.evs = {} |
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
{ | |
"directory": "./public/bower_components", | |
"json": "bower.json" | |
} |
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
var Benchmark = require('benchmark') | |
var words = 'a b c d e f g h i j k l m n o p q r s t u v w x y z' | |
function not_set_length () { | |
var w = words.split(' ') | |
var ww = [] | |
while (w.length) { | |
ww.push(w.pop()) | |
} | |
return true |
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 sleep (mSecs) { | |
if (typeof mSecs !== 'number') throw new TypeError('must be "number"') | |
if (mSecs < 0) throw new RangeError('must be over "0"') | |
var timeout = Date.now() + mSecs | |
while (timeout > Date.now()) ; | |
} |
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
var path = require('path') | |
var Bench = require('benchmark') | |
var csvpath = path.join(__dirname, '../gutenberg.csv') | |
var csv = require('fs').readFileSync(csvpath, 'utf8') | |
function parse1 () { | |
var index = {} | |
var table = csv.split('\r\n') | |
.filter(function (ln) { return !! ln.length }) |
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
TAP version 13 | |
# stub | |
# hook .toString | |
ok 1 (new Date).toSting() === "12" | |
ok 2 (new Date).toSting() === "hoge" | |
# reset .toString | |
ok 3 (new Date).toString() === "Sun Oct 06 2013 16:56:13 GMT+0900 (JST)" | |
1..3 | |
# tests 3 |
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
// see http://goyoki.hatenablog.com/entry/20120301/1330608789 | |
var q = require('qunitjs') | |
;(function () { | |
var qTap = require('qunit-tap') | |
qTap(q, require('util').puts, {showSourceOnFailure: false}) | |
q.init() | |
q.config.updateRate = 0 | |
q.assert.is = q.assert.strictEqual | |
})() |