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> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | |
<title>Rick Smith – Market Explorer</title> | |
<style> | |
/* reset & layout */ | |
* { box-sizing: border-box; margin: 0; padding: 0; } | |
html, body { height: 100%; font-family: –apple-system, BlinkMacSystemFont, 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<title>Market Explorer Embed</title> | |
<style> | |
html,body{height:100%;margin:0;padding:0;} | |
#pageContainer{display:flex;flex-direction:column;height:100%;} | |
#iframeWrapper{flex:1;min-height:0;position:relative;} |
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 getDaysBetweenDates = (dateStart, dateEnd) => (new Date(dateEnd) - new Date(dateStart)) / (1000 * 3600 * 24); | |
getDaysBetweenDates('1/21/2020', '1/21/2021'); // 366 leap year | |
getDaysBetweenDates('1/21/2019', '1/20/2020'); // 365 | |
getDaysBetweenDates(new Date('08/04/2020'), new Date('08/24/2020')); | |
getDaysBetweenDates('08/04/2020','08/24/2020'); |
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 take = (arr, n = 1, fromStart = true) => fromStart ? arr.slice(0, n) : n < 0 ? arr.slice(n) : arr.slice(-1 * n); | |
let fruits = ['Banana', 'Orange', 'Lemon', 'Apple', 'Mango'] | |
take(fruits) | |
take(fruits, 3) | |
take(fruits, -3, false) | |
take(fruits, 3, false) |
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 b64DecodeUnicode = (str) => decodeURIComponent(Array.prototype.map.call(atob(str),(c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")); | |
const parseJWT = (token) => JSON.parse(b64DecodeUnicode(token.split(".")[1].replace("-", "+").replace("_", "/"))); |
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 unescapeHTML = str => | |
str.replace( | |
/&|<|>|'|"/g, | |
tag => | |
({ | |
'&': '&', | |
'<': '<', | |
'>': '>', | |
''': "'", | |
'"': '"' |
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 RSS_URL = `https://cors-anywhere.herokuapp.com/https://archive.org/services/collection-rss.php?collection=podcast_jeff-regan-the-great-detec_426081250`; | |
const xmlToJson = (xml) => { | |
let obj = {}; | |
try { | |
xml.hasChildNodes(); | |
} catch (err) { | |
xml = new DOMParser().parseFromString(xml, "text/xml"); | |
} |
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 checkIfObjectEmpty = obj => Object.keys(obj).length === 0 && obj.constructor === Object |
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 apiURL = "https://pokeapi.co/api/v2/type/1"; | |
const pokemonFetch = async () => { | |
const initial = await fetch(apiURL); | |
const initialJson = await initial.json(); | |
const detailsData = initialJson.pokemon.map(async i => { | |
const preFetchData = await fetch(i.pokemon.url); | |
return preFetchData.json(); | |
}) |
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 mergeTwoArrays = (a, b, unique = false) => unique != true ? a.concat(b) : [...new Set([...a, ...b])]; |
NewerOlder