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 options={poll_time:200},localStorageShim=function(t){var e,r="__localStorageShim",n="pairs",o="localStorageShim Error: ";const a=[];try{if(localStorage.setItem("a",4),4!=localStorage.getItem("a"))throw 1;e=function(){this.setItem=function(t,e){return localStorage.setItem(t,e)},this.getItem=function(t){return localStorage.getItem(t)}}}catch(c){e=function(){var e,c,i=indexedDB.open(r,7),u={},s=function(){e=db.transaction(n).objectStore(n),e.openCursor().onsuccess=function(t){var e,r=t.target.result;r&&(e=r.value,u[e.k]=[e.v,r.key],r["continue"]())}},l=function(t,r){if(t+="",r+="",!u[t]||u[t][0]!==r){u[t]=u[t]||[],u[t][0]=r,clearInterval(c),e=db.transaction(n,"readwrite").objectStore(n);var o=[{k:t,v:r}];u[t][1]&&o.push(u[t][1]),e=e.put.apply(window,o),e.onsuccess=d}},d=function(){s(),c=setInterval(s,t.poll_time)};i.onupgradeneeded=function(t){var e,r=t.target.result;try{e=t.target.transaction.objectStore(n)}catch(o){e=r.createObjectStore(n,{autoIncrement:!0})}try{e.createIndex("k","k",{unique:!0}),e.createI |
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 get_ie_version = function () { | |
var sAgent = window.navigator.userAgent; | |
var Idx = sAgent.indexOf("MSIE"); | |
// If IE, return version number. | |
if (Idx > 0) { | |
return parseInt(sAgent.substring(Idx+ 5, sAgent.indexOf(".", Idx))); | |
} | |
// Condition Check IF IE 11 and or MS Edge | |
else if ( !!navigator.userAgent.match(/Trident\/7\./) |
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 promiseMap(xs, f) { | |
const reducer = (ysAcc$, x) => | |
ysAcc$.then(ysAcc => f(x).then(y => ysAcc.push(y) && ysAcc)); | |
return xs.reduce(reducer, Promise.resolve([])); | |
} | |
/* Example */ | |
const axios = require('axios'); |
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
/** | |
* Returns an array with arrays of the given size. | |
* | |
* @param myArray {Array} Array to split | |
* @param chunkSize {Integer} Size of every group | |
* | |
* https://binbytes.com/blog/split-an-array-into-chunks-of-a-given-size-in-javascript | |
*/ | |
function chunkArray(myArray, chunk_size) { | |
let results = []; |
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
// https://raw.githubusercontent.com/webpack/webpack-dev-server/master/examples/general/proxy-advanced/webpack.config.js | |
'use strict'; | |
// our setup function adds behind-the-scenes bits to the config that all of our | |
// examples need | |
const { setup } = require('../../util'); | |
module.exports = setup({ | |
context: __dirname, | |
entry: './app.js', |
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 kvArray = [['key1', 'value1'], ['key2', 'value2']]; | |
// Use the regular Map constructor to transform a 2D key-value Array into a map | |
var myMap = new Map(kvArray); | |
myMap.get('key1'); // returns "value1" | |
// Use the Array.from function to transform a map into a 2D key-value Array | |
console.log(Array.from(myMap)); // Will show you exactly the same Array as kvArray |
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
let arrayToGroup = ['Alpha','Alpha2','Centaur','Dudeman', 'Ladygirl', '888','999','&^%$']; | |
groupAlphaArray(arrayToGroup) | |
/****OUPUT****/ | |
[ | |
{ | |
"group":"A", | |
"children":["Alpha","Alpha2"] | |
}, | |
{ |
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 tradeStreamer(fsym) { | |
var dataUrl = "https://min-api.cryptocompare.com/data/subs?fsym=" + fsym; | |
return fetch(dataUrl, { | |
"credentials": "omit", | |
"headers": {}, | |
"referrer": "https://cryptoqween.github.io/streamer/trade/", | |
"referrerPolicy": "no-referrer-when-downgrade", | |
"body": null, | |
"method": "GET", | |
"mode": "cors" |
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
async function dirtyFlatten(res) { | |
let vals = Object.values(res) | |
vals = vals.map((x) => { | |
return Object.values(x).reduce((a, c) => { | |
if (typeof c === 'object' || typeof c === 'array') { | |
c.map(entry => a.push(entry)) | |
} else { | |
a.push(c) | |
} | |
return a; |
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
let imageUrls; | |
let globalmenu = {}; | |
const appInfo = { | |
aggSubs: [], | |
allSubs: [], | |
actualSubs: new Set(), | |
pair: ["???", "???"] | |
}; | |
const params = { |