This took me a while to figure out, so figured I’d write an article about it.

Flow of Funds

Stripe’s documentation has a good diagram of the flow of funds, which gives a nice high level overview of how things work. It just needs one minor change to be more comprehensive:

I added the “currency conversion fee happens here” part, if you didn’t notice

In the rest of this article, we’re going to go over how to track all of these fees within Stripe—knowing how things work at a high level vs. knowing how to actually locate the fees within Stripe’s dashboard are two very different things! Note that everything shown is test data.

Example 1: USD → USD

First, we’ll…


I’ve been seeing this animation on a bunch of landing pages:

I also recently implemented it for https://learnwith.io/. Let’s see how to build it (it’s pretty simple).

Keyboard/Typing Animation

Here’s the code I used for https://learnwith.io/.

Let’s break this down. It might look long, but it’s simple.

First, deleteName is called. This function calls setInterval with a function that does the following:

  • If the current name is not empty, it slices the last character off.
  • If the current name is empty, it clears the deletion interval, and calls addName after 1 second (the delay makes it…


The Problem

If you have some Relay code like this:

import { Suspense } from "react";
import { graphql } from "relay-runtime";
import { useLazyLoadQuery } from "react-relay";
const RelayTestQuery = graphql`
query RelayTestQuery {
viewer {
id
}
}
`;
function RelayTestInner() {
const data = useLazyLoadQuery(RelayTestQuery, {
variables: {},
});
return <div>hi</div>;
}
export default function RelayTest() {
return (
<Suspense fallback={<div>Loading</div>}>
<RelayTestInner />
</Suspense>
);
}

And you render it like this:

export default function Home() {
return (
<RelayEnvironmentProvider environment={RelayEnvironment}>
<RelayTest />
</RelayEnvironmentProvider>
);
}

then you’ll get this error:

ReactDOMServer does not yet support Suspense.

The Solution

Dynamic Imports

To fix this, you can use RelayTestDynamic instead:


TLDR, I used React Portal because transform: translate(-50%, -50%) was making my text blurry.

The Problem

The text in the dropdown is very blurry.

This modal uses transform: translate(-50%, -50%).

This, combined with max-height: 240px and overflow: auto for the dropdown, causes the text to be blurry.

See these resources for more details about this problem.

The Solution


Or, how fast is localhost?

iPerf is a command line tool that can be used to measure network throughput.

For example, if endpoint A is sending data to endpoint B, you can use iPerf to determine how many bytes/second endpoint A can send, and how many bytes/second endpoint B can receive.

The rates should be similar due to TCP congestion control, which limits the number of un-acked segments that can be sent. …


Why do cats look like this?

It’s Epigenetics

The answer turns out to be fairly simple. One gene for fur color lives on the X chromosome. Female cat cells have two X chromosomes — one is paternal, one is maternal. However, because of something called random X inactivation, a random X chromosome gets randomly inactivated in each cell. Thus, if the paternal gene for fur color is different than the maternal gene, this random inactivation can lead to the non-uniform color patterns so distinctive of calico and tortoiseshell cats.


The Problem

In general, Firebase focuses on empowering clients (e.g. web clients and mobile clients) with useful libraries and APIs. Unfortunately, this means their support for server-side environments is not as robust. The typical way to use Firebase on a server is via the Admin SDK; however, it doesn’t have feature parity with the client-side APIs. The missing feature we’re concerned with in this post is the lack of server-side Firebase Analytics support. Note that the Firebase team is aware of this problem; check out this Github issue and this Github issue.

Let’s refresh our memories. Here’s how you log an event…


When building a GraphQL server, one of the first decisions you must make is which GraphQL implementation to use. There are three popular options.

  1. GraphQL.js — This is the reference implementation for GraphQL. GraphQL schemas are built by composing objects created from classes such as GraphQLObjectType, GraphQLInterfaceType, and GraphQLEnumType.
  2. TypeGraphQL — This implementation builds upon the reference implementation and adds built-in TypeScript support. It makes it easier to make schemas typesafe. GraphQL schemas are built by creating classes and decorating them and their methods with TypeGraphQL decorators.
  3. GraphQL Nexus — Similarly to TypeGraphQL, this implementation builds upon the reference implementation…


If you’ve tried to use adb forward, you might have noticed that the official documentation is missing a lot of information. adb --help is a lot better:

forward [--no-rebind] LOCAL REMOTE
forward socket connection using:
tcp:<port> (<local> may be "tcp:0" to pick any open port)
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)

If you want even more information, you can check out the source code, specifically SERVICES.TXT. It tells you about the forward command

<host-prefix>:forward:<local>;<remote>
Asks the ADB server to forward local connections from <local>…

Confused about the order in which JavaScript promises execute? I was too. Working through some examples and referencing the JavaScript spec helped better my understanding — hopefully it can do the same for you.

Promise States

Before we dive into the examples, let’s review some helpful background knowledge.

A promise can be in one of three mutually exclusive states: fulfilled, rejected, or pending. Here is how spec 26.6 defines these states.

  • A promise p is fulfilled if p.then(f, r) will immediately enqueue a Job to call the function f.
  • A promise p is rejected if p.then(f, …

Matt Lim

Software Engineer. Tweeting @pencilflip. Mediocre boulderer, amateur tennis player, terrible at Avalon. https://www.mattlim.me/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store