Skip to content

Instantly share code, notes, and snippets.

View rcherny's full-sized avatar

Rob Cherny rcherny

View GitHub Profile
@arkatsy
arkatsy / zustand-internals.jsx
Last active May 3, 2024 12:41
How zustand works internally
import { useSyncExternalStore } from "react";
// For more on the useSyncExternalStore hook, see https://react.dev/reference/react/useSyncExternalStore
// The code is almost identical to the source code of zustand, without types and some features stripped out.
// Check the links to see the references in the source code.
// The links are referencing the v5 of the library. If you plan on reading the source code yourself v5 is the best way to start.
// The current v4 version contains lot of deprecated code and extra stuff that makes it hard to reason about if you're new to this.
// https://github.com/pmndrs/zustand/blob/fe47d3e6c6671dbfb9856fda52cb5a3a855d97a6/src/vanilla.ts#L57-L94
function createStore(createState) {

Source and credits

Everything below the separator bar is a mirror of the "Find Alternatives for Ourselves Megathread: Third Strike" post by bettervanilla on the r/RedditAlternatives subreddit, found here.

It was last updated on 2023, Aug 6 at or around 1325 EDT. It may or may not get updates going forward, depending on how much free time I have (e.g. don't expect me to update it but I might if I have time). Also, if bettervanilla decides to move his post off of reddit, I plan to update this page to redirect to the new location.

Also found one more really nice list mentioned on the r/linuxmasterrace sub while trying to find where they are migrating to. Thanks to /u/ball_soup for sharing!

https://github.com/maltfield/awesome-lemmy-instances

@Widdershin
Widdershin / ssr.md
Last active May 1, 2024 17:36
The absurd complexity of server-side rendering

In the olden days, HTML was prepared by the server, and JavaScript was little more than a garnish, considered by some to have a soapy taste.

After a fashion, it was decided that sometimes our HTML is best rendered by JavaScript, running in a user's browser. While some would decry this new-found intimacy, the age of interactivity had begun.

But all was not right in the world. Somewhere along the way, we had slipped. Our pages went uncrawled by Bing, time to first meaningful paint grew faster than npm, and it became clear: something must be done.

And so it was decided that the applications first forged for the browser would also run on the server. We would render our HTML using the same logic on the server and the browser, and reap the advantages of both worlds. In a confusing series of events a name for this approach was agreed upon: Server-side rendering. What could go wrong?

In dark rooms, in hushed tones, we speak of colours.

@bgoonz
bgoonz / Networkfeaturesreference.md
Created February 17, 2022 18:08
Network features reference - Chrome Developers

Network features reference - Chrome Developers

Excerpt

A comprehensive reference of Chrome DevTools Network panel features.


Discover new ways to analyze how your page loads in this comprehensive reference of Chrome DevTools network analysis features.

Note: This reference is based on Chrome 58. If you use another version of Chrome, the UI and features of DevTools may be different. Check chrome://help to see what version of Chrome you're running.

@merlinmann
merlinmann / wisdom.md
Last active April 17, 2024 21:52
Merlin's Wisdom Project (Draft)

Merlin's Wisdom Project

Or: “Everybody likes being given a glass of water.”

By Merlin Mann.

It's only advice for you because it had to be advice for me.

@slorber
slorber / generate-docs-from-js.js
Last active April 2, 2024 19:37 — forked from arinthros/generate-docs-from-js
Generate Docusaurus Docs from JSDoc
/**
* Requires jsdoc and jsdoc-to-markdown
*/
/* eslint-disable no-console */
const fs = require('fs')
const path = require('path')
const glob = require('glob')
const { execSync } = require('child_process')
const jsdoc2md = require('jsdoc-to-markdown')
@sindresorhus
sindresorhus / esm-package.md
Last active May 3, 2024 10:19
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
// ==UserScript==
// @name StyledTags
// @namespace http://tampermonkey.net/
// @version 0.2
// @description try to take over the world!
// @author You
// @match https://*.workflowy.com/*
// @icon https://www.google.com/s2/favicons?domain=workflowy.com
// @grant none
// ==/UserScript==
@dannguyen
dannguyen / fetch_ghstars.md
Last active April 10, 2024 19:25
fetch_ghstars.py: quick CLI script to fetch from Github API all of a user's starred repos and save it as raw JSON and wrangled CSV

fetch_ghstars.py: quick CLI script to fetch and collate from Github API all of a user's starred repos

  • Requires Python 3.6+
  • Creates a subdir 'ghstars-USERNAME' at the current working directory
  • the raw JSON of each page request is saved as: 01.json, 02.json 0n.json
  • A flattened, filtered CSV is also created: wrangled.csv

Example usage: