Note:
<example>
is meant to denote text replaced by you (including brackets).
// global dependencies
npm install -g knex
function rotateMatrix(rowCount, colCount, matrix) { | |
let row = 0; | |
let col = 0; | |
let prev; | |
let curr; | |
/* | |
row - Starting row index | |
rowCount - ending row index | |
col - starting column index |
function rotateMatrix(rowCount, colCount, matrix) { | |
let row = 0; | |
let col = 0; | |
let prev; | |
let curr; | |
/* | |
row - Starting row index | |
rowCount - ending row index | |
col - starting column index |
function rotate(arr) { | |
const arrLength = arr.length; | |
let matrix = Array.from({length: arrLength}, () => []); | |
for(let i = 0; i < arr.length; i++) { | |
for(let j = 0; j < arr.length; j++) { | |
let temp = arr[j][i]; | |
matrix[i][arrLength - 1 - j] = temp | |
} |
function reverseArr(arr) { | |
const n = parseInt(arr.length/2); | |
for(let i = 0; i < n; i++) { | |
const temp = arr[i]; | |
arr[i] = arr[arr.length - i - 1]; | |
arr[arr.length - i - 1] = temp; | |
} | |
return arr; | |
} |
// log request middleware | |
const getActualRequestDurationInMilliseconds = start => { | |
const NS_PER_SEC = 1e9; // convert to nanoseconds | |
const NS_TO_MS = 1e6; // convert to milliseconds | |
const diff = process.hrtime(start); | |
return (diff[0] * NS_PER_SEC + diff[1]) / NS_TO_MS; | |
}; | |
app.use(function(req, res, next) { | |
const current_datetime = new Date(); | |
const formatted_date = |
function createServer(opts, handler) { | |
const server = net.createServer(socket => { | |
socket.once('data', buffer => { | |
// Pause the socket | |
socket.pause(); | |
// Determine if this is an HTTP(s) request | |
const byte = buffer[0]; | |
let protocol; |
/** | |
* @param {string} text the content to copy to clipboard | |
* @description copies text to clipboard | |
*/ | |
export default function(text) { | |
/* Get the text field */ | |
const el = document.createElement('textarea'); | |
el.value = text; |