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
import { promises as fs } from 'fs'; | |
import path from 'path'; | |
/** Monitors /static/icons and builds both a type definition file and a spritesheet from the SVG files **/ | |
export default function IconSpritePlugin() { | |
async function generateIconSprite() { | |
const iconsDir = path.join(process.cwd(), 'static', 'icons'); | |
const files = await fs.readdir(iconsDir); | |
let symbols = ''; | |
let iconNameType = 'export type IconName =\n'; |
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
{ | |
// All of the apc.* settings require the Apc Customize UI extension: | |
// https://marketplace.visualstudio.com/items?itemName=drcika.apc-extension | |
// Theme, etc. | |
"workbench.iconTheme": "eq-material-theme-icons-ocean", | |
"workbench.colorTheme": "Moonlight II", | |
"editor.fontFamily": "'MesloLGS NF', Menlo, Monaco, 'Courier New', monospace", | |
// Tweaks / Declutter |
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
// ==UserScript== | |
// @name Replace Google links with DuckDuckGo links | |
// @namespace https://gist.github.com/kevinleedrum/4d286da27e63a0eb7e17a36ed2ddd4e8 | |
// @version 0.1 | |
// @description Replace Google links on the page with DuckDuckGo links | |
// @author You | |
// @match https://*/* | |
// @exclude https://*google.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=duckduckgo.com | |
// @grant none |
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
// ==UserScript== | |
// @name Proton Mail Unread Favicon | |
// @namespace https://gist.github.com/kevinleedrum/d7e261c9d9b0b3281dcc75c16d69f143 | |
// @version 0.1 | |
// @description Updates the Proton Mail favicon to include a single-digit unread count | |
// @author Kevin Lee Drum | |
// @match https://mail.proton.me/u/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=proton.me | |
// @grant none | |
// ==/UserScript== |
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 INPUT = `...`; | |
(function doPart1() { | |
const pairs = INPUT.split(/\n\n/).map((p) => | |
p.split(/\n/).map((l) => eval(l)) | |
); | |
const correctIndices = pairs | |
.filter((p) => comparePackets(...p) < 0) | |
.map((p) => pairs.indexOf(p) + 1); | |
console.log(correctIndices.reduce((a, b) => a + b, 0)); |
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 INPUT = `...`; | |
console.log(findPathDistance("S", "E")); // Part 1 | |
console.log(findPathDistance("E", "a", true)); // Part 2 | |
function findPathDistance(startChar, endChar, isReverse = false) { | |
const { grid, start } = parseInput(startChar); | |
const q = [[...start, 0]]; | |
const visited = new Set(); | |
return findPath(); |
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 KNOT_COUNT = 10; | |
const knots = new Array(KNOT_COUNT).fill().map((_) => ({ x: 0, y: 0 })); | |
const tailPositions = new Set(); | |
tailPositions.add("0,0"); | |
const moves = INPUT.split(/\n/).map((move) => { | |
let [direction, distance] = move.split(" "); | |
distance = +distance; | |
return { direction, distance }; | |
}); |
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
{ | |
"vars": { | |
"@gray-base": "#000", | |
"@gray-darker": "lighten(@gray-base, 13.5%)", | |
"@gray-dark": "lighten(@gray-base, 20%)", | |
"@gray": "lighten(@gray-base, 33.5%)", | |
"@gray-light": "lighten(@gray-base, 46.7%)", | |
"@gray-lighter": "lighten(@gray-base, 93.5%)", | |
"@brand-primary": "@gray-dark", | |
"@brand-success": "#5cb85c", |
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
{ | |
"vars": { | |
"@gray-base": "#000", | |
"@gray-darker": "lighten(@gray-base, 13.5%)", | |
"@gray-dark": "lighten(@gray-base, 20%)", | |
"@gray": "lighten(@gray-base, 33.5%)", | |
"@gray-light": "lighten(@gray-base, 46.7%)", | |
"@gray-lighter": "lighten(@gray-base, 93.5%)", | |
"@brand-primary": "darken(#428bca, 6.5%)", | |
"@brand-success": "#5cb85c", |