Skip to content

Instantly share code, notes, and snippets.

View forivall's full-sized avatar
🕴️
levitating

Emily Marigold Klassen forivall

🕴️
levitating
View GitHub Profile
@forivall
forivall / GiphySecretCommandCheetsheet.md
Last active December 23, 2021 21:46
Giphy Secret Slack Commands cheatsheet

Caption

/giphy #caption <insert phrase here>
/giphy #caption "<caption>" <insert search phrase here>

First result

/giphy #1 <insert phrase here>

Random answer to yes/no question

/giphy #8ball <insert question here>

.CodeMirror,
.highlight {
background: var(--ghd-code-background) !important;
color: var(--ghd-code-color) !important;
}
/*! GitHub: Tomorrow Night */
:root {
--ghd-code-background: #1d1f21;
--ghd-code-color: #c5c8c6;
}
export type Deintersect<T> = Compute<
OptionalizeUndefined<
{
[K in keyof UnionToIntersection<T>]: T extends { [_ in K]: any }
? T[K]
: undefined;
}
>
>;
type Compute<A> = {
@forivall
forivall / isTypeByProp.ts
Last active December 3, 2019 20:43
type helper
export const isTypeByProp = <T>(k: NonNullableProp<T>) => (
obj: Partial<T>
// tslint:disable-next-line: triple-equals
): obj is T => obj[k as keyof T] != null;
type NonNullableProp<T> = {
[K in KeyOf<T>]: T extends Record<K, any> ? K : never;
}[KeyOf<T>];
type KeyOf<T> = Extract<IfUnknown<KnownKeys<T>, keyof T>, keyof any>;
type IfUnknown<T, U> = unknown extends T ? T : U;
namespace config {
const run: boolean
const system: {
cwd: string;
};
const required: boolean
const dirs: string[];
const timeout: number;
const options: {[key: string]: any};
@forivall
forivall / useInputId.js
Created October 10, 2019 00:32
React hook for unique ids for htmlFor
let labelForId = 0;
export default const useInputId = () => {
const labelId = React.useRef(() => labelForId++);
return `my-input-${labelId.current}`;
};
@forivall
forivall / userChrome.css
Last active August 27, 2019 18:06
personal tweaks to improve bookmarks toolbar
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
/* hide icons for bookmark folders */
#personal-bookmarks .bookmark-item[container="true"] .toolbarbutton-icon {
display: none !important;
}
/* hide icons for bookmark folders next to a properly marked bookmark */
#personal-bookmarks .bookmark-item[scheme="javascript"] .toolbarbutton-icon {
display: none !important;
@forivall
forivall / jest-test-header.ts
Created August 16, 2019 23:32
Mocking debug() calls to ensure that portions of code are/aren't called when testing with jest
const targetDebuggerNs = 'my-debug-namespace';
jest.mock('debug', () => {
// tslint:disable-next-line: no-shadowed-variable
const D = jest.requireActual('debug') as typeof import('debug');
const mocks: jest.Mock[] = [];
const m = jest.fn((ns) => {
if (ns !== targetDebuggerNs) {
return D(ns);
}
@-moz-document domain("youtube.com") {
#masthead-container.ytd-app {
top: unset;
bottom: 0;
}
#page-manager.ytd-app {
margin-top: unset;
margin-bottom: var(--ytd-masthead-height, 56px);
}
#skip-navigation, #guide-spacer {
@forivall
forivall / semver-looser.ts
Last active July 12, 2019 22:40
Dirty semver fixer
import * as semver from 'semver'
declare module 'semver' {
export const re: {[K in SourceParts]: RegExp}
export const src: {[K in SourceParts]: string}
export const enum SourceParts {
NUMERICIDENTIFIER,
NUMERICIDENTIFIERLOOSE,
NONNUMERICIDENTIFIER,
MAINVERSION,
MAINVERSIONLOOSE,