Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Counter and Timer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://chat.openai.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com
// @grant GM_addStyle
// ==/UserScript==
@whaaaley
whaaaley / jwt.js
Last active August 27, 2022 06:02
Compress JWT Payload
import * as crypto from 'node:crypto'
import pako from 'pako'
import basex from 'base-x'
const base16 = basex('0123456789abcdef')
const base62 = basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz')
let header = JSON.stringify({ alg: 'HS256', typ: 'JWT' })
@whaaaley
whaaaley / settings.jsonc
Created March 6, 2022 21:53
VSCode Settings March 2022
{
"breadcrumbs.enabled": false,
"editor.acceptSuggestionOnCommitCharacter": false,
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"editor.cursorBlinking": "phase",
"editor.folding": false,
"editor.fontFamily": "Source Code Pro",
"editor.fontSize": 13,
@whaaaley
whaaaley / vue-app.js
Last active February 9, 2024 22:26
How to setup Vue Router transitions with JSX inside of Vue 3
import { resolveDynamicComponent, Transition } from 'vue'
import { RouterView } from 'vue-router'
export default {
setup () {
return () => {
const slots = view => (
<Transition name='fade'>
{resolveDynamicComponent(view.Component)}
/**
*
* Memoization utility
*
* @param cb - callback to determine when to return stale children
* @param key - name of the memo
* @param target - children you want to memoize
*
*/
@whaaaley
whaaaley / watch.js
Last active January 22, 2021 15:10
// NOTES
// + Node's recursive file watching doesn't work on Linux
// + This watch function should work on all platforms
const fs = require('fs')
const path = require('path')
function debounce (callback) {
let last = 0
@whaaaley
whaaaley / .stylelintrc.json
Last active January 21, 2021 03:04
Stylelint config based on SMACCS but with more nuanced adjustments
{
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-order"
],
"rules": {
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": ["extend"]
@whaaaley
whaaaley / gist:b52e6f664f9ded2d976e7ea52d17551f
Created December 23, 2020 04:02
ISC License - Word Wrapped
ISC License
Copyright (c) <YEAR> <NAME>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
@whaaaley
whaaaley / gtm.js
Created December 18, 2020 20:49
Minimal Google Tag Manager Snippet
// Google Tag Manager
window.dataLayer = window.dataLayer || []
window.dataLayer.push({
'gtm.start': new Date().getTime(),
'event': 'gtm.js'
})
MAKEFLAGS += --no-print-directory
.EXPORT_ALL_VARIABLES:
.PHONY: all start prepare css js production html
PATH := $(PWD)/node_modules/.bin:$(PATH)
SHELL := /bin/bash
all: NODE_ENV=true