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
| <!DOCTYPE html> | |
| <!-- Display a 10 second countdown then client redirect to home page --> | |
| <html> | |
| <head> | |
| <title>Expired Redirect</title> | |
| </head> | |
| <body> | |
| <style> | |
| .exp--p { | |
| font-family: sans-serif; |
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 snippet will log a url for each obs, so that you can eaisly find an OBS with event data | |
| console.clear() | |
| var aObs = document.querySelector( 'DIV#app' ).__vue__.$store.state.obsSys.obsList | |
| var aHref = document.location.href.split("/") | |
| aHref = aHref.slice(0,3).join("/") | |
| var aTD = [ ... document.querySelectorAll("#app > div main tbody tr td:nth-child(1)")] | |
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
| import axios from 'axios' | |
| let mockingEnabled = false | |
| const mocks = {} | |
| export function addMock(url, data) { | |
| mocks[url] = data | |
| } |
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 {fetch: origFetch} = window; | |
| window.fetch = async (...args) => { | |
| console.log("fetch called with args:", args); | |
| const response = await origFetch(...args); | |
| /* work with the cloned response in a separate promise | |
| chain -- could use the same chain with `await`. */ | |
| response | |
| .clone() |
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 RealXMLHttpRequest = window.XMLHttpRequest; | |
| window.XMLHttpRequest = function(){ | |
| var asynchrony = new RealXMLHttpRequest(); | |
| var realOpen = asynchrony.open; | |
| // steal the OPEN method | Has to be open to send header | |
| asynchrony.open = function(method, url){ | |
| realOpen.apply(asynchrony, arguments); |
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
| export const kFormat = (num) => | |
| Math.abs(num) > 999 | |
| ? Math.sign(num) * (Math.abs(num) / 1000).toFixed(1) + 'k' | |
| : Math.sign(num) * Math.abs(num) |
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
| getReadableTS(){. //. Human readable timestamp for automatic file naming | |
| const date = new Date(); | |
| const year = date.getFullYear(); | |
| const month = `${date.getMonth() + 1}`.padStart(2, '0'); | |
| const day =`${date.getDate()}`.padStart(2, '0'); | |
| const hour = date.getHours(); | |
| const minutes = date.getMinutes(); | |
| const seconds = date.getSeconds(); | |
| return `${year}${month}${day}_${hour}${minutes}${seconds}` | |
| } |
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 getCryptoRange(min, max) { | |
| const range = max - min + 1 | |
| const mBits = Math.ceil(Math.log2(range)) | |
| const mBytes = Math.ceil(mBits / 8) | |
| const nAllowed = Math.floor((256 ** mBytes) / range) * range | |
| const arBytes = new Uint8Array(mBytes) | |
| let value | |
| do { | |
| crypto.getRandomValues(arBytes) | |
| value = arBytes.reduce((acc, x, n) => acc + x * 256 ** n, 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
| var winEcrypt = ( ( _w )=>{ | |
| let oKey = {}; | |
| return { | |
| "base64ToArrayBuffer": function(base64) { | |
| var binary_string = _w.atob(base64); | |
| var len = binary_string.length; | |
| var bytes = new Uint8Array(len); | |
| for (var i = 0; i < len; i++) { | |
| bytes[i] = binary_string.charCodeAt(i); |
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
| // Desc: Produce CSV with client-side JS. Contruct Blob and Download as CSV file | |
| let nativeCSV = ( ( _d )=>{ | |
| let oCnt, jnCSV, sCSV, blCSV, elCSV; // config, json, array, blob, and element | |
| let retObj = { | |
| "init": ( _oCnt )=>{ | |
| oCnt = _oCnt; | |
| if( oCnt.fileName.indexOf("####") !== -1) { | |
| oCnt.fileName = oCnt.fileName.replace("####", Date.now() );} | |
| jnCSV = sCSV = blCSV = elCSV = ""; | |
| return retObj; |