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 createScript = (path, version) => { | |
const scriptTag = document.createElement('script') | |
scriptTag.src = path + '?v=' + version | |
scriptTag.type = 'text/javascript' | |
document.head.appendChild(scriptTag) | |
} | |
const createStyle = (path, version) => { |
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 getLog2 = (n) => Math.round(Math.log2(n)) | |
const reverseSeq = (n) => Array.from(Array(n + 1).keys()).reverse() | |
const getPow = (b, n) => Math.pow(b, n) | |
const decToBin = (n) => { | |
reverseSeq(getLog2(n)).reduce( | |
(acc, curr) => (getPow(2, curr) <= n) ? ( n -= getPow(2, curr), acc + '1' ) : acc + '0', '' | |
) |
NewerOlder