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 scrollTo(top = 0, left = 0, node = window) { | |
| node.scroll({ top, left, behavior: "smooth" }); | |
| } | |
| //Usage | |
| node.onclick = function(){ | |
| scrollTo(); | |
| } | |
| //With custom top, left |
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
| //window.__theme: variable with the current theme: "dark" or "light" | |
| //window.__setPreferredTheme: function that receives the new theme to be applied | |
| //window.__onThemeChange: function that will be called every time the theme changes | |
| (function() { | |
| window.__onThemeChange = function() {}; | |
| function setTheme(newTheme) { | |
| window.__theme = newTheme; | |
| preferredTheme = newTheme; | |
| document.body.className = newTheme; |
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
| animation: example 5s linear 2s infinite alternate; |
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
| export default function copyToClipboard(text) { | |
| const textArea = document.createElement('textarea'); | |
| textArea.value = text; | |
| textArea.style.position = 'fixed'; //avoid scrolling to bottom | |
| document.body.appendChild(textArea); | |
| textArea.focus(); | |
| textArea.select(); | |
| document.execCommand('copy'); | |
| document.body.removeChild(textArea); | |
| } |
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 generateRandomColor(userConfig = {}) { | |
| const defaultConfig = { | |
| r: [0, 255], | |
| g: [0, 255], | |
| b: [0, 255], | |
| a: [1, 1], | |
| } | |
| const config = Object.assign({}, defaultConfig, userConfig); |
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 randomIntFromInterval(min, max) { | |
| return Math.floor(Math.random() * (max - min + 1) + min); | |
| } |
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 createUniqueId() { | |
| let dt = new Date().getTime(); | |
| const uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function( | |
| c | |
| ) { | |
| let r = (dt + Math.random() * 16) % 16 | 0; | |
| dt = Math.floor(dt / 16); | |
| return (c === "x" ? r : (r & 0x3) | 0x8).toString(16); | |
| }); | |
| return "id-" + uuid; |
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
| # Logs | |
| logs | |
| *.log | |
| npm-debug.log* | |
| yarn-debug.log* | |
| yarn-error.log* | |
| # Runtime data | |
| pids | |
| *.pid |
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 url('https://fonts.googleapis.com/css?family=Josefin+Sans&display=swap'); | |
| font-family: 'Josefin Sans', sans-serif; | |
| @import url('https://fonts.googleapis.com/css?family=Courier+Prime&display=swap'); | |
| font-family: 'Courier Prime', monospace; |
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
| index.js | |
| if (process.env.DEVELOPMENT) { | |
| const ngrok = require("ngrok"); | |
| (async function() { | |
| try { | |
| const url = await ngrok.connect({ | |
| proto: "http", | |
| addr: process.env.PORT | |
| }); | |
| console.log("Tunnel Created -> "); |
OlderNewer