Skip to content

Instantly share code, notes, and snippets.

View lxsmnsyc's full-sized avatar
I'm not a robot

Alexis H. Munsayac lxsmnsyc

I'm not a robot
View GitHub Profile
jaredpalmer /
Last active September 1, 2021 09:35
OAuth 2.0 Device Flow

OAuth Device Flow

This is flow used by apps on Apple TV / Roku. However, it is also useful for CLIs.

Here is my rundown. Please correct me in comments if something is wrong or if there is a better way to do this.

Device pings the server to begin activation process

kentcdodds / package.json
Last active February 6, 2023 14:57
Remove TS from workshops
View package.json
"name": "remove-ts",
"version": "1.0.0",
"description": "I use this to automatically fix feedback links in my workshops",
"bin": "./remove-ts.js",
"dependencies": {
"@babel/core": "7.13.8",
"@babel/preset-typescript": "7.13.0",
"glob": "7.1.6"
sindresorhus /
Last active October 1, 2023 07:03
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.
kentcdodds /
Last active May 11, 2022 12:14


I was poking around trying to figure out all the packages I have access to publish and got curious. So I write this little script to determine the download stats for all the packages I have publish access to.

Feel free to try it yourself. Just change the username passed to getUserDownloadStats.

By default, the stats are sorted by their average daily downloads (descending). That should give you an idea of the most "popular" package of a given user relative to how long that package has been around.

You can use it with npx like so:

Jack-Works / 2018.js
Last active January 22, 2023 11:53
cRAzY eSnEXt (*all* proposals mixed in)
View 2018.js
#! Aaaaaaaaaaa this is JS!!!
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!!
// Created at Nov 23, 2018
for await(const x of (new A //
|> do { //
case(?) { //
when {val}: class {
lelandrichardson / Recoil.kt
Created August 28, 2020 14:52
Recoil vs Compose
View Recoil.kt
var text by mutableStateOf("")
val charCount: Int get() = text.length
val todoList = mutableStateListOf<Item>(emptyList())
val filteredTodoList get() = when (todoListFilter) {
Filter.Completed -> todoList.filter { it.isComplete }
Filter.Uncompleted -> todoList.filter { !it.isComplete }
Filter.All -> todoList
@Composable fun Example() {
View little-vdom.js
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key})
export const render=(e,d,t=d.t||(d.t={}),p,r,c,m,y)=>
// arrays,p)=>render(e,d,t.o&&t.o[p])):
// components{children:e.c},e.p),e.s=t.s||{},t=>
// create notes
m=t.d||(e.t?document.createElement(e.t):new Text(e.p)),
// diff props
tomhicks / plink-plonk.js
Last active August 31, 2023 08:26
Listen to your web pages
View plink-plonk.js
bvaughn /
Last active December 29, 2021 02:12
`useSubscription` and `useMutableSource` tearing and deopt behavior.

useSubscription and useMutableSource1 tearing and deopt behavior.

Mounting a new tree

The tree below represents a React application mounting. During mount, two components read from an external, mutable source. The first one (List) reads version 1 of that data and the second one (Item) reads version 2.


useSubscription (legacy mode)


jonathantneal /
Last active June 28, 2020 13:43
Minimal Node Servers