This is an OPML version of the HN Popularity Contest results for 2025, for importing into RSS feed readers.
This is an up-to-date guide on running Chromium in Vercel serverless functions in 2022. What you will read below is the result of two days of research, debugging, 100+ failed deployments, and a little bit of stress.
Use chrome-aws-lambda that comes with Chromium pre-configured to run in serverless, and puppeteer-core due to the smaller size of Chromium distributive.
| import tree from "./tree"; | |
| test("it should serialise the tree", () => { | |
| expect(tree("path/to/folder")).toMatchInlineSnapshot(); // jest will fill this in automatically | |
| }); |
| brew install pandoc | |
| brew tap homebrew/cask | |
| brew install --cask basictex | |
| eval "$(/usr/libexec/path_helper)" | |
| # Update $PATH to include `/usr/local/texlive/2022basic/bin/universal-darwin` | |
| sudo tlmgr update --self | |
| sudo tlmgr install texliveonfly | |
| sudo tlmgr install xelatex | |
| sudo tlmgr install adjustbox | |
| sudo tlmgr install tcolorbox |
| async function validatePassword(password: string): string[] { | |
| let errors = [] | |
| // 1. Don't regex for things you can trivially express in code | |
| // ----------------------------------------------------------- | |
| // For example, we could have written this as `/^.{0,7}$/` but that's not | |
| // nearly as clear as checking the length of the string. | |
| if (password.length < 8) { | |
| errors.push("Password must be at least 8 characters long") |
Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.
If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.
You can use this diagram as a template to create your own git branching diagrams. Here's how:
- Create a new diagram with diagrams.net (formerly draw.io)
- Go to File > Open From > URL
- Insert this url (it points to the xml data below):
https://gist.githubusercontent.com/bryanbraun/8c93e154a93a08794291df1fcdce6918/raw/bf563eb36c3623bb9e7e1faae349c5da802f9fed/template-data.xml - Customize as needed for your team.
| #!/usr/bin/env bash | |
| package=$1 | |
| if [[ -z "$package" ]]; then | |
| echo "usage: $0 <package-name>" | |
| exit 1 | |
| fi | |
| package_split=(${package//\// }) | |
| package_name=${package_split[-1]} |
| import useSWR from '@zeit/swr'; | |
| import localForage from 'localforage'; | |
| import { ConfigInterface } from '@zeit/swr/dist/src/types'; | |
| import { useState, useEffect } from 'react'; | |
| export function usePersistentSWR(key: string, fn?: Function, config?: ConfigInterface) { | |
| let handleSuccess; | |
| if (config !== undefined && config.onSuccess !== undefined) { | |
| const { onSuccess } = config; | |
| handleSuccess = (data: any, key: string, config: ConfigInterface) => { |
| // Example component: render the current value of a stream. Support switching streams during the lifecycle of the component | |
| // N.B. code is untested | |
| // Old: | |
| class RenderStream extends Component { | |
| subscription | |
| componentWillMount() { | |
| this.subscribeToStream(this.props.stream) | |
| } |