List of helpful shortcuts for faster coding
If you have any other helpful shortcuts, feel free to add in the comments of this gist :)
{ | |
"000000": "Black", | |
"000044": "Endless Galaxy", | |
"000066": "Alone in the Dark", | |
"000088": "Midnight in Tokyo", | |
"0000aa": "Bohemian Blue", | |
"0000ee": "Hyperlink Blue", | |
"0000ff": "Blue", | |
"00022e": "Illicit Darkness", | |
"000435": "Oblivion", |
wget -E -H -k -p https://www.example.com/ |
import { readdir } from "node:fs/promises"; | |
import { extname, resolve } from "node:path"; | |
async function* walkDir(dir: string): AsyncGenerator<string> { | |
const entries = await readdir(dir, { withFileTypes: true }); | |
for (const entry of entries) { | |
const name = resolve(dir, entry.name); | |
if (entry.isDirectory()) { | |
yield* walkDir(name); | |
} else if (filterFile(entry.name)) { |
:root { | |
--easeInSine: cubic-bezier(0.12, 0, 0.39, 0); | |
--easeOutSine: cubic-bezier(0.61, 1, 0.88, 1); | |
--easeInOutSine: cubic-bezier(0.37, 0, 0.63, 1); | |
--easeInQuad: cubic-bezier(0.11, 0, 0.5, 0); | |
--easeOutQuad: cubic-bezier(0.5, 1, 0.89, 1); | |
--easeInOutQuad: cubic-bezier(0.45, 0, 0.55, 1); | |
--easeInCubic: cubic-bezier(0.32, 0, 0.67, 0); | |
--easeOutCubic: cubic-bezier(0.33, 1, 0.68, 1); | |
--easeInOutCubic: cubic-bezier(0.65, 0, 0.35, 1); |
/** | |
* Calculate password strength | |
* @param value password | |
* @returns password strength in range between 0 an 1 | |
*/ | |
export const getPasswordStrength = (value: string): number => { | |
// Minimum 8 characters | |
const REGEX_CHARACTER = /^.{8,}$/ | |
// Minimum 2 uppercase, |
describe('arrayToKeyedObject', () => { | |
it('should return empty object if array are empty', () => { | |
type GenericItems = { code: string } | |
const items: GenericItems[] = [] | |
const result = arrayToKeyedObject(items, (item) => item.code) | |
expect(result).toEqual({}) | |
}) | |
it('should return keyed object', () => { |
function fakeRequest(data) { | |
// eslint-disable-next-line unicorn/consistent-function-scoping | |
const random = (min, max) => Math.floor(Math.random() * (max - min) + min) | |
return new Promise((resolve) => { | |
setTimeout(() => { | |
return resolve({ isOk: true, data }) | |
}, random(500, 2000)) | |
}) | |
} |
<template> | |
<component :is="tag" :class="classes" :style="style"><slot></slot></component> | |
</template> | |
<script> | |
import { isNumber } from '@/helpers/is' | |
import { stringToModifiers } from '@/helpers/bem' | |
export default { | |
name: 'BaseScrollbar', |
/* ---- | |
css custom properties to manipulate color | |
MIT - 2017 - Soft Punch | |
https://gist.github.com/softpunch/ | |
set initial "main" color via HSL values. | |
automatically calculate harmonies and variations of that color with pure css. | |
harmonies are determined solely by hue. |