Skip to content

Instantly share code, notes, and snippets.


Richard Scarrott richardscarrott

View GitHub Profile
acdlite /
Last active Jan 19, 2021
Demo: Coordinating async React with non-React views

Demo: Coordinating async React with non-React views

tl;dr I built a demo illustrating what it might look like to add async rendering to Facebook's commenting interface, while ensuring it appears on the screen simultaneous to the server-rendered story.

A key benefit of async rendering is that large updates don't block the main thread; instead, the work is spread out and performed during idle periods using cooperative scheduling.

But once you make something async, you introduce the possibility that things may appear on the screen at separate times. Especially when you're dealing with multiple UI frameworks, as is often the case at Facebook.

How do we solve this with React?

xialvjun / setIn.js
Last active Feb 23, 2021
immutable version of lodash/set
View setIn.js
import {clone, setWith, curry} from 'lodash/fp';
// export const setIn = curry((path, value, obj) =>
// setWith(clone, path, value, clone(obj)),
// );
export const setIn = curry((obj, path, value) =>
setWith(clone, path, value, clone(obj)),
vktr / rule.js
Created Feb 10, 2018
Add Stripe Customer Id to Auth0 via custom rule
View rule.js
function (user, context, callback) {
user.app_metadata = user.app_metadata || {};
if ('stripe_customer_id' in user.app_metadata) {
context.idToken[''] = user.app_metadata.stripe_customer_id;
return callback(null, user, context);
var stripe = require('stripe')('sk_....');
var customer = {
etagwerker /
Last active Apr 11, 2020 — forked from ctolsen/
"Copy to cURL" in Chrome to Apache Bench command -- Script for Python3
#!/usr/bin/env python3
import sys
import os
def curl_to_ab(curl_cmd: list, num: int=200, cur: int=4) -> str:
Translate a cURL command created by Chrome's developer tools into a
command for ``ab``, the ApacheBench HTTP benchmarking tool.