Skip to content

Instantly share code, notes, and snippets.

View willwillems's full-sized avatar
🌱
Working remotely

Will Willems willwillems

🌱
Working remotely
View GitHub Profile
@willwillems
willwillems / getMatchingCSSRulesForEl.js
Created January 10, 2021 13:55
Get matching CSS rules for a DOM element using the new CSSOM stylesheet implementation
function getMatchingCSSRulesForEl (el) {
return [...document.styleSheets]
.filter(ss => { try { return ss.cssRules; } catch (e) { return false } })
.flatMap(e => [...e.cssRules].filter(r => el.matches(r.selectorText)))
}
@willwillems
willwillems / deploy-functions.yml
Created February 9, 2021 12:05
Deploy Firebase functions with Github Actions
name: Build and Deploy
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
@willwillems
willwillems / README.md
Last active March 23, 2022 14:31
VS Code Regex find and replace require syntax with import syntax

Simple require imports, for example const bar = require("foo"):

  • Regex: (const|var|let)\b\s+(\w+)\s+=\s+require\s*\(["']([\/\w\-]+)["']\)\n
  • Replace: import $2 from "$3"\n

One-liner require & config/compute, for example const router = require("express").Router({ mergeParams: true }):

  • Regex: (const|var|let)\b\s+(\w+)\s+=\s+require\s*\(["'](\w+)["']\)(?=\S+)
@willwillems
willwillems / script.js
Last active August 27, 2024 14:33
ChatGPT code execution
// ==UserScript==
// @name New script openai.com
// @namespace Violentmonkey Scripts
// @match https://chat.openai.com/chat
// @grant none
// @version 1.1
// @author -
// @description 04/12/2022, 13:07:34
// ==/UserScript==
@willwillems
willwillems / script.js
Created February 12, 2023 21:51
Dark mode for Mem.ai
// ==UserScript==
// @name Mem.ai dark mode
// @namespace Violentmonkey Scripts
// @match https://mem.ai/*
// @grant none
// @version 1.0
// @author Will Willems
// @description 12/02/2023, 15:00:05
// ==/UserScript==
@willwillems
willwillems / sidebery.css
Created August 7, 2023 17:29
No-tab minimal Firefox layout for use with sidebar UX (Sidebery, tree style tabs, etc)
#root.root {--nav-btn-width: 36px;}
#root.root {--nav-btn-height: 32px;}
#root.root {--tabs-margin: 8px;}
#root.root {--tabs-indent: 12px;}
#root.root {--tabs-inner-gap: 8px;}