This file contains 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
/* | |
Examples: | |
copyCurrentUrl(() => { | |
Toastify({ | |
text: "URL successfully copied.", | |
duration: 3000 | |
}).showToast(); | |
}); | |
*/ |
This file contains 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
/* | |
Examples: | |
gradientGenerator() = { angle: 128, colorOne: "#e29482", colorTwo: "#c98d47" } | |
*/ | |
const gradientGenerator = () => { | |
const hexValues = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e']; | |
const generateGradient = (color) => { | |
for (let i = 0; i < 6; i++) { |
This file contains 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
/* | |
Examples: | |
randomizer({ range: 50, set: 5 }) = [8, 16, 32, 40, 48] | |
randomizer({ range: 15, set: 3 }) = [4, 11, 15] | |
randomizer() = [1, 2, 3, 4, 5] | |
*/ | |
function randomizer (data) { | |
const dataRange = data && data.range ? data.range : 5; | |
const dataSet = data && data.set ? data.set : 5; |
This file contains 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
// compatibility check | |
const supportPageOffset = window.pageXOffset !== undefined; | |
const isCSS1Compat = ((document.compatMode || '') === 'CSS1Compat'); | |
// previous scroll value | |
let currentScrollTop = supportPageOffset | |
? window.pageYOffset | |
: isCSS1Compat | |
? document.documentElement.scrollTop | |
: document.body.scrollTop; |
This file contains 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
// Notes: | |
// Git for Windows should be installed on your machine | |
// To generate new guid open PowerShell then '[guid]::NewGuid()'' | |
// PowerShell as Administrator require `Set-ExecutionPolicy RemoteSigned` | |
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", | |
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", | |
"copyOnSelect": false, | |
"copyFormatting": false, |
This file contains 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
<form id="myForm"> | |
<!-- text, email, password --> | |
<input type="text" name="name" placeholder="name" /><br /> | |
<input type="email" name="email" placeholder="email" /><br /> | |
<input type="password" name="password" placeholder="password" /><br /> | |
<!-- checkbox --> | |
<input type="checkbox" name="cb_one" value="one" /><br /> | |
<input type="checkbox" name="cb_two" value="two" /><br /> | |
<input type="checkbox" name="cb_three" value="three" /><br /> | |
<!-- radio --> |
This file contains 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
# This will output two (2) files: localhost.key & localhost.crt | |
openssl req -x509 -out localhost.crt -keyout localhost.key \ | |
-newkey rsa:2048 -nodes -sha256 \ | |
-subj '/CN=localhost' -extensions EXT -config <( \ | |
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth") |
This file contains 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
// .some() | |
const myAwesomeArray = ["a", "b", "c", "d", "e"] | |
myAwesomeArray.some(test => test === "d") // true | |
// .reduce() | |
const myAwesomeArray = [1, 2, 3, 4, 5] | |
myAwesomeArray.reduce((total, value) => total * value) // 1*2*3*4*5 = 120 | |
// .every() | |
const myAwesomeArray = ["a", "b", "c", "d", "e"] |
This file contains 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 videos = document.getElementsByTagName("video"); | |
function checkViewport () { | |
for (var i = 0; i < videos.length; i++) { | |
var video = videos[i]; | |
var x = video.offsetLeft, | |
y = video.offsetTop, | |
w = video.offsetWidth, | |
h = video.offsetHeight, | |
r = x + w, |
This file contains 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 fs = require('fs'); | |
const path = require('path'); | |
const spdy = require('spdy'); | |
const helmet = require('helmet'); | |
const express = require('express'); | |
const compression = require('compression'); | |
const server = express(); | |
const { NODE_ENV } = process.env; | |
const isDev = NODE_ENV === 'development'; |
NewerOlder