Skip to content

Instantly share code, notes, and snippets.

Working from home

Sung M. Kim dance2die

Working from home
Block or report user

Report or block dance2die

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
dance2die / Add syntax
Last active Aug 13, 2019 moderator replies
View Add syntax


Would you be be able to update the post with a syntax highlight as to improve the readability? Refer to the Editor Guide for more info.

dance2die / index.without.suspense.js
Created Aug 1, 2019
Works on My Machine (I mean with Gatsby build)
View index.without.suspense.js
import React, { useState, useEffect } from "react"
import { graphql, useStaticQuery } from "gatsby"
import Layout from "../components/Layout"
const importBlock = blockName =>
component => component.default
export default () => {
dance2die / index.js
Created Aug 1, 2019
Gatsby using Suspense that fails to build
View index.js
import React, { Suspense, lazy } from "react"
import { graphql, useStaticQuery } from "gatsby"
import Layout from "../components/Layout"
const importBlock = blockName =>
lazy(() => import(`../components/blocks/${blockName}/index.js`))
export default () => {
const { allDirectory } = useStaticQuery(graphql`
View twitter.js
const Twitter = require('twitter')
const config = {
consumer_key: 'secret',
consumer_secret: 'secret',
access_token_key: 'secret',
access_token_secret: 'secret',
const client = new Twitter(config)
View netlify.toml
command = "npm run build"
publish = "public/"
# Redirect rule defined in "_redirect" isn't working.
# using netlify.toml instead.
# Refer to the documentation -
from = "/*"
to = "/index.html"
View a
<a name=fig1 href="fghjkdfghj" REL="EMBED, PRESENT">Figure </a>

where the relation ship values mean
EMBED Embed this here when presenting it
PRESENT Present this whenever the source document is presented

View add numbers by currying.js
// refer to
// by @minimumviableperson
const double = x => x*2;
const addOne = x => x+1;
const addFn = (...args) => {
let count = 0;
const map = {
View Comparison
Short-circuit? Short-circuits on? Fulfilled on? Rejected on?
Promise.all First rejected promise All promise fulfilled First rejected promise
Promise.allSettled N/A Always N/A
Promise.race First settled First promise fulfilled First rejected promise
Promise.any First fulfilled First promise fulfilled All rejected promises
View 1. Promise.any.js
// Example #1
]).then(function(value) {
console.log(`You win at life`, value)
View 1. Promise.race.js
const promiseWillFulfill = [
new Promise((resolve, reject) => setTimeout(reject, 250, '😈')),
new Promise((resolve, reject) => setTimeout(resolve, 150, '😇')),
new Promise((resolve, reject) => setTimeout(resolve, 1, '😇')),
.then(value => console.log(`The humanity survives "${value}"`))
.catch(error => console.log(`Won't be called as 😇 will win the race`))
You can’t perform that action at this time.