Description |
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 'dotenv/config' | |
import { Octokit } from '@octokit/core' | |
const org = process.env.SPONSORS_ORG! | |
const token = process.env.SPONSORS_TOKEN! | |
const octokit = new Octokit({ auth: token }) | |
const allMembers = await fetchMembers(org) | |
const membersWithoutTeam = new Set(allMembers.map(m => m.login)) |
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
// port form https://github.com/bermi/element-xpath | |
// Create a safe reference to the getElementXpath object for use below. | |
const getElementXpath = function (el, callback) { | |
var err, result, nodes, i, n, segments, siblings, id_count; | |
try { | |
if (callback && (typeof callback !== "function")) { | |
throw new Error("Invalid callback supplied"); | |
} |
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
type Proxy = any[] | |
type Pop<T> = T extends [infer A, ...infer B] ? B : never | |
type Push<T> = T extends [...infer B] ? [any, ...B] : never | |
type Add<T extends Proxy, V extends Proxy> = [...T, ...V] | |
type Double<T extends Proxy> = [...T, ...T] | |
type Get<A extends Proxy> = A['length'] | |
type AddOne<A extends Proxy> = Push<A> | |
type SubOne<A extends Proxy> = Pop<A> |
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 { UnionToIntersection } from 'utility-types'; | |
type String<T> = T extends string ? T : any | |
type Keys<T, Field extends keyof T> = | |
T extends { [P in Field]: infer A } | |
? { [P in String<A>]: T } | |
: never | |
type LookupTable<Union, key extends keyof Union> = UnionToIntersection<Keys<Union, key>> |
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
type Unexact<T> = | |
T extends null | |
? null | |
: T extends undefined | |
? undefined | |
: T extends number | |
? number | |
: T extends boolean | |
? boolean | |
: T extends string |
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
type GetComponentProps<T> = T extends React.ComponentType<infer P> | |
? P | |
: T extends (props: any) => any | |
? Parameters<T> | |
: never; | |
class ClassComponent extends React.Component<{ a: number }> { | |
render() { | |
return <div />; |
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
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch example.js' |
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 puppeteer from 'puppeteer' | |
import fs from 'fs' | |
async function buildPDF(htmlString) { | |
const browser = await puppeteer.launch({ headless: true }) | |
const page = await browser.newPage(); | |
await page.setContent(htmlString, { waitUntil: 'networkidle0' }) | |
const pdf = await page.pdf({ | |
format: 'A4', | |
displayHeaderFooter: false, |
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
{ | |
"basics": { | |
"name": "Anthony Fu", | |
"picture": "https://antfu.me/avatar.png", | |
"label": "Software Engineer", | |
"headline": "A ship in harbor is safe, but that is not what ships are built for.", | |
"summary": "My name is Anthony Fu, a master of computer science student and a freelance software engineer. My passion for software lies with dreaming up ideas and making them come true with elegant interfaces. I take great care in the experience, architecture, and code quality of the things I build.\n\nI am also an open-source enthusiast and maintainer. I love how collaboration and knowledge sharing happens through open-source and I am happy to see what I do could eventually feedback to the community and industry.", | |
"website": "https://antfu.me", | |
"address": "", | |
"projects_url": "https://antfu.me/projects", |
NewerOlder