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
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
{ | |
"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", |
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
TypeScript 21 hrs 47 mins ████████████████▒░░░ 67.1% | |
Vue.js 6 hrs 21 mins ██████▓░░░░░░░░░░░░░ 19.6% | |
JSON 2 hrs 10 mins ████▒░░░░░░░░░░░░░░░ 6.7% | |
JavaScript 46 mins ███▒░░░░░░░░░░░░░░░░ 2.4% |
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
window.requestAnimationFrame = (function () { | |
return window.requestAnimationFrame || | |
window.webkitRequestAnimationFrame || | |
window.mozRequestAnimationFrame || | |
window.oRequestAnimationFrame || | |
window.msRequestAnimationFrame || | |
function (callback) { | |
window.setTimeout(callback, 1000 / 60); | |
}; | |
})(); |
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
function download(data, filename, type) { | |
var a = document.createElement('a') | |
var file = new Blob([data], { type: type }) | |
if (window.navigator.msSaveOrOpenBlob) // IE10+ | |
window.navigator.msSaveOrOpenBlob(file, filename) | |
else { // Others | |
var url = URL.createObjectURL(file) | |
a.href = url | |
a.download = filename | |
document.body.appendChild(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
// 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"); | |
} |
NewerOlder