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> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <script type="module"> | |
| const createAction = (el, initialState, name, action) => { | |
| let currentState = initialState; | |
| document.body.addEventListener(name, (e) => { | |
| el.render(e.detail.state); | |
| }); |
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 filter = Function.prototype.call.bind(Array.prototype.filter) | |
| filter([1,2,3], (x) => x > 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
| function isError(value) { | |
| switch (Object.prototype.toString.call(value)) { | |
| case '[object Error]': | |
| return true; | |
| case '[object Exception]': | |
| return true; | |
| case '[object DOMException]': | |
| return true; |
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 { fileURLToPath } from 'url' | |
| const __filename = fileURLToPath(import.meta.url) | |
| const __dirname = path.dirname(__filename) |
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 convertFromBaseToBase(str, fromBase, toBase) { | |
| var num = parseInt(str, fromBase); | |
| return num.toString(toBase); | |
| } |
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
| // from http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/ | |
| function bytesToSize(bytes) { | |
| var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; | |
| if (bytes == 0) return 'n/a'; | |
| var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); | |
| if (i == 0) return bytes + ' ' + sizes[i]; | |
| return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[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
| new Date(seconds * 1000).toISOString().substr(11, 8) |
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 isDstObserved(date = new Date()) { | |
| var jan = new Date(0, 1); | |
| var jul = new Date(6, 1); | |
| const stdTimezoneOffset = Math.max( | |
| jan.getTimezoneOffset(), | |
| jul.getTimezoneOffset() | |
| ); | |
| return date.getTimezoneOffset() < stdTimezoneOffset; | |
| } |
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
| // tzName is one of the tz database names at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones | |
| // Example: 'Pacific/Honolulu' (UTC-10) | |
| function getUTCOffset(tzName, date) { | |
| date = new Date(date || Date.now()); | |
| date.setMilliseconds(0); | |
| // 1) Get the local UTC offset | |
| // --------------------------- | |
| // Convert date UTC offset to true hours offset. | |
| // Date.prototype.getTimezoneOffset() confusingly returns positive |
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
| /* | |
| * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). | |
| * This devtool is neither made for production nor for readable output files. | |
| * It uses "eval()" calls to create a separate source file in the browser devtools. | |
| * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) | |
| * or disable the default devtool with "devtool: false". | |
| * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). | |
| */ | |
| /******/ (() => { // webpackBootstrap | |
| /******/ "use strict"; |
OlderNewer