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
{ | |
"metadata": { | |
"toolPackage": "@microsoft/api-extractor", | |
"toolVersion": "7.8.2-pr1796.0", | |
"schemaVersion": 1003, | |
"oldestForwardsCompatibleVersion": 1001 | |
}, | |
"kind": "Package", | |
"canonicalReference": "@google-cloud/video-intelligence!", | |
"docComment": "", |
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 maxGap = (arr) => { | |
const n = arr.length; | |
let min = Number.POSITIVE_INFINITY; | |
let max = Number.NEGATIVE_INFINITY; | |
for (let i = 0; i < n; i++) { | |
min = Math.min(arr[i], min); | |
max = Math.max(arr[i], max); | |
} | |
let range = max - min; |
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
// Run `npm install @google-cloud/compute` first. | |
const Compute = require('@google-cloud/compute'); | |
const compute = new Compute(); | |
// Creates a new VM using the latest Ubuntu image. | |
(async () => { | |
try { | |
const zone = await compute.zone('us-central1-a'); | |
const data = await zone.createVM( | |
'ubuntu-instance', |
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
'use strict'; | |
const Compute = require('@google-cloud/compute'); | |
const http = require('http'); | |
const compute = new Compute(); | |
const zone = compute.zone('us-central1-a'); | |
// Create a new VM, using default ubuntu image. The startup script |
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
{ | |
"name": "profiler-issue", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", |
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
#include <napi.h> | |
#include <math.h> | |
namespace primes { | |
// Implementation of isPrime() and prime() omitted. See | |
// https://github.com/fhinkel/javascript-vs-native-addon-prime-numbers/blob/master/primes.cc | |
Napi::Value Method(const Napi::CallbackInfo& info) { | |
Napi::Env env = info.Env(); |
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 js = require('./primes.js'); | |
const addon = require('./build/Release/primes.node'); | |
function run(i) { | |
console.time('Prime in js'); | |
js.prime(i); | |
console.timeEnd('Prime in js'); | |
console.time('Prime in addon'); | |
addon.prime(i); |
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
function isPrime(p) { | |
const upper = Math.sqrt(p); | |
for(let i = 2; i <= upper; i++) { | |
if (p % i === 0 ) { | |
return false; | |
} | |
} | |
return true; | |
} |
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 fs = { | |
readFile: function(filename, cb) { | |
cb(null, {length: 12}); | |
} | |
} | |
for (var i = 0; i < 10000; i++) { | |
var __filename = 'perf-test.js'; | |
printLength(__filename) | |
} |
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
function valuesFn (array) { | |
var i = 0 | |
return function foo (abort, cb) { | |
if(i >= array.length) | |
cb(true) | |
else | |
cb(null, array[i++]) | |
} | |
} |
NewerOlder