This file contains hidden or 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
! Re-style messaging layout | |
www.linkedin.com###messaging .scaffold-layout__content--has-aside:style(grid-template-areas: "main main" "aside aside" !important; margin: 0 !important; row-gap: 0 !important;) | |
www.linkedin.com###messaging .scaffold-layout__list-detail.msg__list-detail:style(height: calc(100vh - 55px) !important) | |
www.linkedin.com###messaging .scaffold-layout__inner.scaffold-layout-container.scaffold-layout-container--reflow:style(width: 100% !important; padding: 0 10px; !important) | |
www.linkedin.com###messaging .scaffold-layout__list.msg__list:style(flex: 1 !important) | |
! Remove footer | |
www.linkedin.com###messaging #compactfooter-copyright | |
www.linkedin.com###messaging .msg-form__footer:style(padding-bottom: 0 !important) | |
www.linkedin.com###messaging .scaffold-layout__aside |
This file contains hidden or 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
class AsyncQueue<T> { | |
#elements: T[] = []; | |
#waiting: ((el: T) => void)[] = []; | |
get size() { return this.#elements.length } | |
enqueue(el: T) { | |
const next = this.#waiting.shift(); | |
if (next) { | |
next(el); | |
} else { |
This file contains hidden or 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
interface HOC<T> { | |
(Component: React.ComponentType<T>): (props: T) => JSX.Element | |
} | |
const reduceHOCs = <T>(...hocs: HOC<T>[]): HOC<T> => hocs | |
.reduce((reduced, next) => (c) => next(reduced(c))); | |
const applyHOCs = <T>(...hocs: HOC<T>[]) { | |
const reducedHoc = reduceHOCs(...hocs); |
This file contains hidden or 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 React, { useContext, createContext } from "react"; | |
function createHOCFromHook<T,>(cb: () => T) { | |
const Context = createContext<T>(null as T); | |
const withProvider = <T,>(Component: React.ComponentType<T>) => | |
function (props: T & JSX.IntrinsicAttributes) { | |
return ( | |
<Context.Provider value={cb()}> | |
<Component {...props} /> | |
</Context.Provider> |
This file contains hidden or 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
#!/bin/bash | |
# Generate TypeScript adoption data | |
# Google Docs Spreadsheet: | |
# https://docs.google.com/spreadsheets/d/13iDFWEhGbE8ZGu1LoXmRINy1ZSLd227mAFj99Evl6fc | |
# Usage: | |
# bash ./stats.sh > results.tsv | |
# Copy paste data into sheet | |
DATE="2022-07-01" # Tune this file to set start date of adoption |
This file contains hidden or 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
{ | |
"env": { | |
"es2021": true, | |
"jest/globals": true, | |
"browser": true | |
}, | |
"extends": [ | |
"airbnb", | |
"airbnb-typescript", | |
"airbnb/hooks", |
This file contains hidden or 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
type ToGetter<T> = { | |
[P in keyof T]: T[P] extends (...args: any) => any ? ReturnType<T[P]> : never; | |
} | |
interface VueOptions<D, C, M> { | |
data: () => D; | |
computed: C; | |
methods: M; | |
} |
This file contains hidden or 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
// Lookup table to seed the counting array | |
// Skips to length of 10, 100, 1000 instead of counting | |
// Allows going up to 1998 instead of 999! | |
// With some work, this technique can be pushed further for higher numbers | |
interface InitialLengths { | |
'2': [0, 0, 0, 0, 0, | |
0, 0, 0, 0, 0], | |
'3': [...InitialLengths[2], ...InitialLengths[2], ...InitialLengths[2], ...InitialLengths[2], ...InitialLengths[2], | |
...InitialLengths[2],...InitialLengths[2], ...InitialLengths[2], ...InitialLengths[2], ...InitialLengths[2]], | |
'4': [...InitialLengths[3], ...InitialLengths[3], ...InitialLengths[3], ...InitialLengths[3], ...InitialLengths[3], |
This file contains hidden or 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
interface StringDigitToNumber { | |
'0': 0, | |
'1': 1, | |
'2': 2, | |
'3': 3, | |
'4': 4, | |
'5': 5, | |
'6': 6, | |
'7': 7, | |
'8': 8, |
This file contains hidden or 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
interface SpacingProps { | |
__typename: string, | |
property1: { | |
__typename: string; | |
a: 2; | |
nested: { | |
__typename: string, | |
x: 3 | |
} | |
}, |
NewerOlder