Skip to content

Instantly share code, notes, and snippets.


Jane Manchun Wong wongmjane

Block or report user

Report or block wongmjane

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
IanColdwater / twittermute.txt
Last active Jun 3, 2020
Here are some terms to mute on Twitter to clean your timeline up a bit.
View twittermute.txt
Mute these words in your settings here:
jkrems /
Last active Apr 11, 2020
JavaScript: Classic Scripts vs. Modules vs. CommonJS

JavaScript File Format Differences

There's the pervarsive notion that all JS is created equal and that there's only minor and easily detectable differences between the various file formats used to author JavaScript. This is correct, from a certain point of view.

A certain point of view?

For many people writing JavaScript that gets passed into build tools,

shrugs /
Created Oct 21, 2019
apollo + next

these are the relevant files from my next + apollo + prisma setup. the prisma bit isn't relevant and can just be removed from the context. likewise my resolvers + typedefs setup is hyper specific and there are infinitely many way to do this (lol javascript)

the only relevant bit that might be missing is the handler path that has to match your next.js route

acutmore /
Last active May 20, 2020
Emulating a 4-Bit Virtual Machine in (TypeScript\JavaScript) (just Types no Script)

A compile-time 4-Bit Virtual Machine implemented in TypeScript's type system. Capable of running a sample 'FizzBuzz' program.

Syntax emits zero JavaScript.

type RESULT = VM<
    ["push", N_1],         // 1
    ["push", False],       // 2
    ["peek", _],           // 3
mfellner / graphql.ts
Created Jul 8, 2019
Using Apollo Server in Next.js 9 with API route in pages/api/graphql.ts
View graphql.ts
import { ApolloServer, gql } from 'apollo-server-micro';
const typeDefs = gql`
type Query {
sayHello: String
const resolvers = {
Query: {
nfarina / AutoThemeSwitcher.js
Created May 14, 2019
Auto Dark Theme for Storybook
View AutoThemeSwitcher.js
import addons from '@storybook/addons';
import { FORCE_RE_RENDER } from '@storybook/core-events';
import { themes } from '@storybook/theming';
// Automatically switch light/dark theme based on system pref.
addons.register("auto-theme-switcher", api => {
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)');
let lastTheme;
gaearon /
Last active Jun 3, 2020
useLayoutEffect and server rendering

If you use server rendering, keep in mind that neither useLayoutEffect nor useEffect can run until the JavaScript is downloaded.

You might see a warning if you try to useLayoutEffect on the server. Here's two common ways to fix it.

Option 1: Convert to useEffect

If this effect isn't important for first render (i.e. if the UI still looks valid before it runs), then useEffect instead.

function MyComponent() {

‪“‬In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?”

‪Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows. ‬

‪(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)‬

So the big deal about css-in-js (cij) is selectors.

necolas / Composite-Link.js
Created Sep 19, 2018
Next.js links with React Native for Web
View Composite-Link.js
developit / *
Last active May 31, 2020
🐻 Valoo: just the bare necessities of state management. 150b / 120b.
View *

🐻 valoo

just the bare necessities of state management.


Hotlink it from

See Interactive Codepen Demo.

You can’t perform that action at this time.