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 hrMillis(measure) { | |
return (measure[0] * 1000) + (measure[1] / 1e6); | |
} | |
const millis = hrMillis(endTime); | |
console.log(millis); | |
// 8210.181641 |
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 hrMillis(measure) { | |
return (measure[0] * 1000) + (measure[1] / 1e6); | |
} | |
const databaseStartTime = process.hrtime(); | |
await runTheDatabaseCall(); | |
const databaseMeasure = process.hrtime(databaseStartTime); | |
const analyticsStartTime = process.hrtime(); | |
await analyticsCall(); |
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
// for browsers, ya silly! | |
performance.mark('start-party'); | |
runThePartyAnimation(); | |
performance.mark('end-party'); | |
performance.measure('party-measure', 'start-party', 'end-party'); | |
const measure = performance.getEntriesByType('measure')[0]; |
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 Perf = require('performance-node'); | |
const timeline = new Perf(); | |
timeline.mark('ai-start'); | |
runMachineLearning(); | |
timeline.mark('ai-end'); | |
timeline.measure('ai-measure', 'ai-start', 'ai-end'); | |
const myMeasure = timeline.getEntriesByName('ai-measure')[0]; | |
// {name: 'ai-measure', startTime: 1.2, duration: 10.5, entryType: 'measure'} |
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 iopipeLib = require('iopipe'); | |
const profiler = require('@iopipe/profiler'); | |
const iopipe = iopipeLib({ | |
token: 'TOKEN_HERE', | |
plugins: [profiler({ enabled: true })] | |
}); | |
exports.handler = iopipe((event, context) => { | |
context.succeed('Whoomp there it is!') | |
}); |
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 iopipe = require('@iopipe/core'); | |
const eventInfoPlugin = require('@iopipe/event-info'); | |
const tracePlugin = require('@iopipe/trace'); | |
module.exports = iopipe({ | |
plugins: [ | |
tracePlugin(), | |
eventInfoPlugin() | |
] | |
}); |
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
// app business logic code here | |
const {context} = require('./context'); | |
module.exports = () => { | |
// I'm inside a single lambda invocation! | |
context.iopipe.log('wow'); | |
} |
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
javascript:((() => {var main=document.querySelector("main");const getEl=()=>document.querySelector('[data-testid="sidebarColumn"]');var obsv=new MutationObserver(e=>{var t=getEl();main.contains(t)&&t.remove()});obsv.observe(main,{subtree:!0,childList:!0});var el=getEl();el&&el.remove()})()); |
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
#!/usr/bin/env node | |
const { execSync } = require("child_process"); | |
const fs = require("fs"); | |
const glob = require("glob"); | |
const open = require("open"); | |
const [, , filePath] = process.argv; | |
if (!filePath) { | |
console.error("File path must be present as first argument."); | |
process.exit(1); |