Skip to content

Instantly share code, notes, and snippets.

Avatar
🕴️
levitating

Emily Marigold Klassen forivall

🕴️
levitating
View GitHub Profile
View github-review-keyboard-shortcuts.bookmarklet.js
// https://github.com/forivall/dotfiles/blob/osx/userscripts/github-review-keyboard-shortcuts.js
/* global document */
;(() => {
/**
* @param {{[key: string]: (ev: KeyboardEvent) => any}} handlers
* @returns {(event: KeyboardEvent) => any}
*/
const reviewKeyboardHandler = (handlers) => (event) => {
if (!document.location.pathname.endsWith('/files')) return
const ae = document.activeElement
View glob-negate.ts
/**
* For vscode globs that can't just do `!`, but do have negative char classes
*
* turn `test` into `{[^t]*,?[^e]*,??[^s]*,???[^t]*}`
* `{[^t]*,?{,[^r]*,?{,[^a]*,?[^p]*}}}`
*
* two directories need to be excluded, the following would be needed:
* (ex. for negating 'test' or 'glob')
*
* `{[^tg]*,?[^el]*,??[^so]*,???[^tb]*,te{sb,ob,ot},t{ls,lo,eo}t,{tl,ge,gl}st,gl{ot,sb,st},g{es,ls,eo}b,{ge,tl,te}ob`
@forivall
forivall / MakeHidden.json
Last active Nov 2, 2021
Visual Studio Code Settings Sync Gist
@forivall
forivall / yarn-exec-generator-template.ts
Created Oct 9, 2021
typescript template for yarn-exec plugin generator scripts
View yarn-exec-generator-template.ts
// the .js version must be checked in, as it is needed before anything is installed.
// this file can _not_ use any non-core modules or access any external files.
export {};
// https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-fslib/sources/path.ts#L10
type NativePath = string & { __pathType?: 0 | 2 };
// https://github.com/yarnpkg/berry/blob/master/packages/plugin-exec/sources/ExecFetcher.ts#L9
/**
* Contains various useful details about the execution context.
@forivall
forivall / headerOrphanControl.js
Created Sep 30, 2021
bookmarklet for improved printing
View headerOrphanControl.js
document.querySelectorAll('h1,h2,h3,h4,h5,h6').forEach((h) => {
var e = h.nextElementSibling, a = [h], d
e && a.push(e)
while (e && /H[0-6]/.test(e.tagName)) (e = e.nextElementSibling) && a.push(e)
if (a.length === 1) return
d = document.createElement('div')
d.style.display = 'inline-block'
h.replaceWith(d)
d.append(...a)
})
@forivall
forivall / fix-rr-subroutes.tsx
Created Aug 19, 2021
React Router v6 subroute fixer
View fix-rr-subroutes.tsx
import React from 'react';
export function fixSubRoutes(
routeElement: React.ReactElement<React.PropsWithChildren<{ path?: string }>>,
props?: { path?: string }
) {
const parentRoute = routeElement.props.path;
return React.cloneElement(
routeElement,
props,
...React.Children.toArray(routeElement.props.children).map(
View bulma-noreset-nogeneric.css
/*! bulma.io v0.9.3 | MIT License | github.com/jgthms/bulma */
/* Bulma Utilities */
.button, .input, .textarea, .select select, .file-cta,
.file-name, .pagination-previous,
.pagination-next,
.pagination-link,
.pagination-ellipsis {
-moz-appearance: none;
-webkit-appearance: none;
align-items: center;
View kludgey-ejs-vscode-tmlanguage.json
{
"$schema": "https://raw.githubusercontent.com/Septh/tmlanguage/master/tmLanguage.schema.json",
"name": "Embedded Javascript",
"scopeName": "text.html.ejs",
"injectionSelector": "L:text.html",
"injections": {
"text.html.ejs - (meta.embedded.block.ejs | meta.embedded.line.ejs | meta.tag | comment), L:meta.tag, L:source.js.embedded.html": {
"patterns": [
{
"begin": "(^\\s*)(?=<%+#(?![^%]*%>))",
@forivall
forivall / customizeui.settings.json
Last active May 31, 2021
my customizeui settings for vscode - todo - fork customizeui to "compactui" and roll into an extension
View customizeui.settings.json
{
"customizeUI.font.monospace": "Fantasque Sans Mono",
// "customizeUI.font.regular": "Input Sans Compressed",
"customizeUI.font.regular": "SF Pro Display",
"customizeUI.fontSizeMap": {
"13px": "12px"
// "monospace": "12px"
},
"customizeUI.stylesheet": {
// ".monaco-icon-label.italic>.monaco-icon-label-container>.monaco-icon-name-container>.label-name": "font-weight: lighter",
View yarn-list-flat.jq
# Usage: yarn list --json | jq -r 'include "yarn-list-flat"; yarnListFlat'
def yarnListFlat:
select(.type = "tree")
|.data.trees[]
|(
.name,
(.children[]? | (
.name,
(.children[]? | (
.name,