This file contains hidden or 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 moment = require('moment'); | |
| function findPrice(prices, targetMoment) { | |
| const match = prices.find((data) => { | |
| const [ts] = data; | |
| const momentPrice = moment(ts); | |
| return momentPrice.isSame(targetMoment, 'day'); | |
| }); | |
| const res = match && match[1]; |
This file contains hidden or 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
| curl \ | |
| -X POST \ | |
| -H "Content-Type: application/json" \ | |
| --data '{ "query": "{ icos { id, name, symbol, roi_since_ico } }" }' \ | |
| https://icostats.com/graphql |
This file contains hidden or 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
| pragma solidity ^0.4.15; | |
| import 'zeppelin-solidity/contracts/ownership/Ownable.sol'; | |
| contract SafeProxy is Ownable { | |
| mapping(address => bool) public whitelistedAddress; | |
| event TransferFunds(address sender, address receiveingAddr); | |
| /// @dev Adds a new address to the whitelist |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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. | |
| // |