Skip to content

Instantly share code, notes, and snippets.

@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

Windows 10/11 Registry Edits

Hardware acceleration

  1. Navigate to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers
  2. Under the "GraphicsDrivers" key create a new DWORD (32-bit) value named "HwSchMode"
  3. Set the Hexadecimal value to 2
  4. Restart PC

Large Taskbar

  1. Navigate to Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
@whaaaley
whaaaley / vscode-settings.json
Last active February 26, 2021 03:59
Incredibly long list of settings to make VSCode usable 2021
{
"breadcrumbs.enabled": false,
"editor.cursorBlinking": "phase",
"editor.folding": false,
"editor.fontFamily": "SF Mono",
"editor.fontSize": 13,
"editor.fontWeight": 300,
// "editor.formatOnSave": true,
// "editor.hover.enabled": false,

You probably don't need a JWT library 2020

It's 2020. You have an idea for new webapp. The scope is small, but requires auth. You look at services like Auth0 and libraries like node-jsonwebtoken. You've probably read about the countless security bugs they've had.

It's 2020 they should have it figured out

The npm package node-jsonwebtoken is a huge library where most of the core functionality comes from a dependency of a dependency, node-jws which depends on node-jwa of the same author, and both of them are no longer maintained. If you look at the Github issues of node-jws, you can find a thread explaining how the maintainers don't have time to work on the projects anymore and reccomend using a newer project, Github user Panva's jose.

So just use jose