Skip to content

Instantly share code, notes, and snippets.

JS, GraphQL & React

Jayden Seric jaydenseric

JS, GraphQL & React
Block or report user

Report or block jaydenseric

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
OliverJAsh /
Last active Oct 31, 2019
Flexbox gutters

Flexbox gutters


  • We use flexbox for our layout.
  • We want to add horizontal and vertical gutters inbetween these items.
  • Items wrap according to contents (flex-wrap: wrap), therefore we can't decide when/where to apply gutters using breakpoints.


bvaughn / example.jsx
Last active Nov 16, 2019
Advanced example for manually managing subscriptions in an async-safe way using hooks
View example.jsx
import React, { useMemo } from "react";
import useSubscription from "./useSubscription";
// In this example, "source" is an event dispatcher (e.g. an HTMLInputElement)
// but it could be anything that emits an event and has a readable current value.
function Example({ source }) {
// In order to avoid removing and re-adding subscriptions each time this hook is called,
// the parameters passed to this hook should be memoized.
const subscription = useMemo(
() => ({
View mutate-webpack-config.js
export function loadConfigModule(filename) {
// sub your own
return require(filename);
* Modify a Webpack configuration by applying a mutator module/function.
* @param {Object} options
* @param {Object} options.config Webpack configuration object to modify in-place
GeoffreyBooth /
Last active Nov 22, 2018
Analysis of public NPM packages using the “module” field

I did some research into the package.json "module" field. I wrote some code to download all the the package.json files from all the public packages in the NPM registry. Here are some findings:

941 public NPM packages use the "module" field as of 2018-10-22.

Here are the top 30 packages, as ranked by number of public dependents (or see the full list):

Dependents Package Name "module" Field Value
16,286 should ./es6/should.js
15,472 sinon ./pkg/sinon-esm.js
jkrems /
Last active Oct 7, 2019
History of ES modules
cthurston / mongodb-facet-combine.js
Created Nov 3, 2017
MongoDb combine $facet results into a single result set.
View mongodb-facet-combine.js
$facet: {
$match: {
'type': 'Event'
"tasks": [{
$match: {
helfer /
Last active May 31, 2017
Migrating from Apollo Client 0.x to 1.0

Migrating from Apollo Client 0.x to 1.0

Here are the main breaking changes between the 0.x and 1.0 versions of Apollo Client.


The structure of fetchMoreResult has been changed. Previously fetchMoreResult used to contain data and loading fields, now fetchMoreResult is what used to be. This means your updateQueries function has to change as follows:

updateQuery: (prev, { fetchMoreResult }) => {

How to add an image to a gist

  1. Create or find a gist that you own.
  2. Clone your gist (replace <hash> with your gist's hash):
    # with ssh
    git clone<hash>.git mygist
    # with https
    git clone<hash>.git mygist
umidjons /
Last active Aug 10, 2018
Authenticate a Node.js API with JSON Web Tokens
You can’t perform that action at this time.