Skip to content

Instantly share code, notes, and snippets.

View zoxon's full-sized avatar

Zoxon zoxon

View GitHub Profile
{
"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",
@zoxon
zoxon / wget.sh
Created March 30, 2023 10:03
Download html page with all assets wget
wget -E -H -k -p https://www.example.com/
@zoxon
zoxon / walk-dir-filter.ts
Created March 20, 2023 03:36
Nodejs walk dir example
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)) {
@zoxon
zoxon / easing.css
Created January 18, 2023 04:57
CSS Easing
: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,
@zoxon
zoxon / arrayToKeyedObject.spec.ts
Last active March 3, 2022 10:09
Converts array of objects to object with key
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))
})
}
@zoxon
zoxon / vscode_shortcuts.md
Created April 6, 2021 03:39 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

<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',
@zoxon
zoxon / colorVars.css
Created September 25, 2020 04:52 — forked from softpunch/colorVars.css
CSS Variables For Color Manipulation
/* ----
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.