diff --git a/scratch.js b/scratch.js deleted file mode 100644 index 32177a2c..00000000 --- a/scratch.js +++ /dev/null @@ -1,240 +0,0 @@ -// global.fps = 0; -// global.fpsTarget = 60; -// global.delay = 0; -// global.fillSize = 100; -// -// setInterval(() => { -// const _fps = fps; -// fps = 0; -// console.log(`${_fps} - ${delay}`); -// }, 1000); -// -// function someWork() {w -// new Array(Math.floor(Math.random() * 1000000) + 100).fill(1); -// } -// -// global.tick = function tick() { -// fps++; -// const start = Date.now(); -// someWork(); -// delay = Math.floor((1000 / (fpsTarget + 5)) - (Date.now() - start)); -// -// if (delay < 1) { -// process.nextTick(() => tick()); -// } else { -// setTimeout(() => tick(), delay); -// } -// }; -// -// tick(); - -// // --------------------- -// // SAMPLE DATA -// // --------------------- -// -// const loadedData = [ -// { -// 0: { -// Ticket: '123', -// Mid: '987654321', -// }, -// }, -// { -// 0: { -// Ticket: '567', -// Mid: '12345678', -// }, -// }, -// ]; -// -// const newData = [ -// { -// Ticket: '123', -// Mid: '987654321', -// }, -// { -// Ticket: '345', -// Mid: '54568656', -// }, -// ]; -// -// -// // ----------- -// // UTILS -// // ------------ -// /** -// * -// * @param obj -// * @param keys -// * @return {string} -// */ -// function objectToMapKey(obj, keys) { -// let mapKey = ''; -// -// for (let j = 0, klen = keys.length; j < klen; j++) { -// const key = keys[j]; -// if (obj[key]) { -// if (j > 0) mapKey += '-' + obj[key]; -// else mapKey += obj[key]; -// } -// } -// -// return mapKey; -// } -// -// /** -// * -// * @param array -// * @param keys -// * @return {{}} -// */ -// function arrayToLookupMap(array, keys) { -// const map = {}; -// -// for (let i = 0, len = array.length; i < len; i++) { -// const item = array[i]; -// const mapKey = objectToMapKey(item, keys); -// map[mapKey] = Object.assign({}, item); -// } -// -// return map; -// } -// -// // ----------------- -// // actual code -// // ----------------- -// -// const lookupFields = ['Ticket', 'Mid']; -// const lookupMap = arrayToLookupMap(loadedData, lookupFields); -// -// for (let i = 0, len = newData.length; i < len; i++) { -// const newObj = newData[i]; -// const lookupKey = objectToMapKey(newObj, lookupFields); -// const exists = lookupMap[lookupKey]; -// -// if (exists) { -// // exists in loaded and loaded data is: console.log(exists); -// console.log('Item ' + lookupKey + ' exists!'); -// // TODO ignore as exists? -// } else { -// // doesn't exist in loaded data -// console.log('Item ' + lookupKey + ' does NOT exist!'); -// // TODO do something as doesn't exist? -// } -// } - -// // top of file - in your imports -// const vm = require('vm'); // part of node api - don't npm install it -// // also top of your file -// const start = "$(document).find('#flot-chart'),"; // where the js code to extract starts after -// const end = '$.plot('; // where the js code to extract end -// -// // your actual code: - -// const html = "
\n
\n
\n
\n