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 combinationLoop(list, choose, callback) { | |
(function loop(result, nest, index, length) { | |
while (index <= length + nest - choose) { | |
(nest === 0 ? (result = []) : result)[nest] = list[index++]; | |
if (nest < choose - 1) { | |
loop(result, nest + 1, index, length); | |
} else { | |
callback(result.concat()); // ηΆζ³γ«εΏγγ¦δΈθ¦ | |
} | |
} |
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
/** | |
* How to use. | |
* 1. access to http://suguru03.github.io/yasuda-benchmark/ | |
* 2. gist("https://gist.github.com/suguru03/b35074cd74e132ffdd7cb10940b3b873").execute(); | |
*/ | |
var root = this; | |
var setup = function() { | |
this.array1 = Array(100); | |
this.array2 = Array(100); |
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 createFunc(name, args, fstr) { | |
var arr = [name, args, fstr]; | |
var str = 'return function %s(%s) %s;'; | |
str = str.replace(/%s/g, function() { | |
return arr.shift(); | |
}); | |
return new Function(str)(); | |
} | |
var name = 'test'; |
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
{} |
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
'use strict'; | |
const path = require('path'); | |
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const app = express(); | |
const port = process.env.PORT || 8000; |
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
'use strict'; | |
const fs = require('fs'); | |
const path = require('path'); | |
const filepath = path.resolve(__dirname, 'sample.js'); | |
const code = fs.readFileSync(filepath, 'utf8'); | |
const { Agent } = require('vm-agent'); | |
const result1 = new Agent(code).run().getInnerVariable(); |
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 https = require('https'), | |
user = process.argv[2], | |
opts = parseOpts(process.argv.slice(3)) | |
request('/users/' + user, function (res) { | |
if (!res.public_repos) { | |
console.log(res.message) | |
return | |
} | |
var pages = Math.ceil(res.public_repos / 100), |
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
const _ = require('lodash'); | |
const Aigle = require('aigle'); | |
Aigle.mixin(_); | |
execute(); | |
/* | |
* If `Aigle` has the same function names as `Lodash` ones, they will be ignored. | |
* All of them have the same functionality and are optimized for asynchronous. |
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
'use stirct'; | |
const assert = require('assert'); | |
const Promise = require('bluebird'); | |
class Connection { | |
constructor() { | |
this._closed = false; | |
} |
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
'use strict'; | |
/* native Promise is used as default. | |
* You can try | |
* ``` | |
* node --expose_gc memory_leak_test.js | |
* ``` | |
* | |
* I'm just wondering if `expose_gc` has something problem. | |
* When the code is executed a lot of times, execution speed willb be slow down. |
OlderNewer