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 isEmpty = value => { | |
if (typeof value === 'number') return false | |
else if (typeof value === 'string') return value.trim().length === 0 | |
else if (Array.isArray(value)) return value.length === 0 | |
else if (typeof value === 'object') return value == null || Object.keys(value).length === 0 | |
else if (typeof value === 'boolean') return false | |
else return !value | |
} |
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
<img src="blank.gif" data-src="my_image.png" width="600" height="400" class="lazy"> | |
<img src="blank.gif" data-src="my_image.png" width="600" height="400" class="lazy"> | |
<img src="blank.gif" data-src="my_image.png" width="600" height="400" class="lazy"> | |
<img src="blank.gif" data-src="my_image.png" width="600" height="400" class="lazy"> |
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 = { |
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
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
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
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
// 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
/** | |
* 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 = []; |