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
Array.from({ length: 3 }) => [undefined, undefined, undefined] | |
Array.from(Array(3).keys()) => [1, 2, 3] |
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
{ | |
"rewrites": [ | |
{ "source": "/options/:path*", "destination": "https://example.vercel.app/:path*" }, | |
{ "source": "/options/", "destination": "https://example.vercel.app/" }, | |
{ "source": "/(.*)", "destination": "/" } | |
] | |
} |
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
Array.from({ length: NUMBER}, (_, index) => index + 1) |
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 inputRegex = RegExp(`^\\d*(?:\\\\[.])?\\d*$`) | |
const escapeRegExp = (string) => { | |
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') // $& means the whole matched string | |
} | |
const handleChange = (e) => { | |
const string = e.target.value | |
if(inputRegex.test(escapeRegExp(string))) { | |
setInputTest(string) |
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 gulp = require('gulp'); | |
var sass = require('gulp-sass'); | |
var connectPHP = require('gulp-connect-php'); | |
var browserSync = require('browser-sync'); | |
var reload = browserSync.reload; | |
var sourcemaps = require('gulp-sourcemaps'); | |
var paths = { | |
html: ['./**/*.php'], | |
js: ['./js/*.js'] |
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
export default function ({ req, redirect }) { | |
console.log('starting') | |
if (req) { | |
if (req.headers['user-agent'].match(/Insights/gmi) || req.headers['user-agent'].match(/Lighthouse/gmi)) { | |
console.log('lighthouse detected') | |
redirect('/page.html') | |
} | |
} | |
} |
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 users = ["c", "a", "b"] | |
users.sort((a, b) => a.localeCompare(b)) // ["a", "b", "c"] |
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
//scripts for package.json | |
// "scripts": { | |
// "start": "webpack-dev-server --mode development --open", | |
// "build": "webpack --mode production" | |
// }, | |
const path = require('path') | |
const HTMLPlugin = require('html-webpack-plugin') | |
const { CleanWebpackPlugin } = require('clean-webpack-plugin') |
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
updateCounter (slick) { | |
currentSlide = slick.currentSlide + 1 | |
slideCount = slick.slideCount | |
$('.slider-counter').text(this.currentSlide + '/' + this.slideCount) | |
} | |
$('.info-slider').on('init', (e, slick) => { | |
updateCounter(slick) | |
}) | |
$('.info-slider').on('afterChange', (e, slick) => { | |
updateCounter(slick) |
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
// 1 | |
const num = 42 | |
// let result | |
// | |
// if (num > 20) { | |
// result = 'More than 20' | |
// } else { | |
// result = 'Less than 20' | |
// } |
NewerOlder