This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const { createApolloFetch } = require('apollo-fetch'); | |
const fs = require('fs'); | |
const uri = 'https://icostats.com/graphql'; | |
const apolloFetch = createApolloFetch({ uri }); | |
const query = ` | |
query icos { | |
icos { | |
id, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"*": | |
Zen: | |
showWordCount: true | |
"apathy-theme": | |
contentPaddingLeft: 70 | |
debug: true | |
enableTreeViewStyles: true | |
"atom-beautify": | |
general: | |
_analyticsUserId: "71ca40bc-1dad-4495-97c3-42211656647f" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Usage: ``` | |
* import waitForWeb3 from './on-web3.js'; // code in this gist | |
* waitForWeb3.then(() => runYourApp() ); | |
* ``` | |
* When web3 is provided by metamask, the accounts may not be available right | |
* away. So, if you need the accounts to be available (like for a route that | |
* requires a 'user'), the example that they give in their docs won't work. | |
* | |
* This function takes a callback that will be called when the accounts are |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { createApolloFetch } = require('apollo-fetch'); | |
const uri = 'http://localhost:3000/graphql'; | |
const apolloFetch = createApolloFetch({ uri }); | |
const query = ` | |
query getTodos { | |
todos { | |
title | |
completed | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Dynamic content is served via this middleware. Each page has a 'path' | |
* attribute which determines the path on which it should render. Any time a | |
* request is made to the server, we check the requested path to see if any | |
* page has that same path, in which case we step in and render that page. | |
* @flow | |
*/ | |
/* eslint-disable react/no-danger, no-inline-comments */ | |
import type { $Request, $Response } from 'express'; | |
import React from 'react'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// There is a secret string which is unknown to you. Given a collection of | |
// random triplets from the string, recover the original string. | |
// | |
// A triplet here is defined as a sequence of three letters such that each | |
// letter occurs somewhere before the next in the given string. "whi" is a | |
// triplet for the string "whatisup". | |
// | |
// As a simplification, you may assume that no letter occurs more than once in | |
// the secret string. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// There is a secret string which is unknown to you. Given a collection of | |
// random triplets from the string, recover the original string. | |
// | |
// A triplet here is defined as a sequence of three letters such that each | |
// letter occurs somewhere before the next in the given string. "whi" is a | |
// triplet for the string "whatisup". | |
// | |
// As a simplification, you may assume that no letter occurs more than once in | |
// the secret string. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The businesspeople among you will know that it's often not easy to find an | |
// appointment. In this kata we want to find such an appointment automatically. | |
// You will be given the calendars of our businessperson and a duration for the | |
// meeting. Your task is to find the earliest time, when every businessperson is | |
// free for at least that duration. | |
// | |
// Example Schedule: | |
// | |
// Person | Meetings | |
// -------+----------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Description: | |
// | |
// One of the services provided by an operating system is memory management. | |
// The OS typically provides an API for allocating and releasing memory in a | |
// process's address space. A process should only read and write memory at | |
// addresses which have been allocated by the operating system. In this kata you | |
// will implement a simulation of a simple memory manager. | |
// | |
// JavaScript has no low level memory API, so for our simulation we will simply | |
// use an array as the process address space. The memory manager constructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// * Given some data that looks like this: | |
// | |
// let data = [ | |
// { | |
// key: 'a', | |
// value: 'a1', | |
// children: [ | |
// { | |
// key: 'b', |