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
| import 'dart:io'; | |
| import 'dart:async'; | |
| import 'package:html/parser.dart' show parse; | |
| import 'package:html/dom.dart'; | |
| main() { | |
| final url = 'http://comic-walker.com/'; | |
| getHtml(url).then((document) { | |
| // page title |
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
| require('dotenv').config(); | |
| const http = require('http'); | |
| const url = require('url'); | |
| // import NOW SETTINGS | |
| const now = require('./now.json'); | |
| const PORT = process.env.PORT || 3030; | |
| const routes = now.routes.reduce((map, route) => { |
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
| require("dotenv-safe").config(); | |
| const url = require("url"); | |
| const now = require("./now.json"); | |
| const routes = now.routes | |
| .filter(route => | |
| now.builds.some( | |
| build => | |
| build.src.startsWith(`${route.dest.substring(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
| // https://codesandbox.io/s/x260l8963z | |
| // https://www.damiannicholson.com/posts/2018/07/14/creating-a-layout-like-pinterest-with-react-and-the-partition-problem/ | |
| import React, { Component } from 'react'; | |
| /** | |
| * We need to partition the Waterfall images in to N sets where N is the number | |
| * of columns dictated by the organiser, and the sum of numbers in each set is almost | |
| * equal. | |
| * | |
| * This is a fast greedy solution to that problem https://stackoverflow.com/q/6669460. |
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
| // String utils | |
| // | |
| // resources: | |
| // -- mout, https://github.com/mout/mout/tree/master/src/string | |
| /** | |
| * "Safer" String.toLowerCase() | |
| */ | |
| function lowerCase(str) { | |
| return str.toLowerCase(); |
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
| // NOTE: this file belongs in `lib/`! [gist limitation] | |
| import request from 'request-promise'; | |
| const URL = 'https://api.bitcoinaverage.com/ticker/global/USD'; | |
| export default async function (req, res) { | |
| const price = await request(URL, { json: true }); | |
| return `The price is ${price.last} as of ${price.timestamp}`; | |
| } |
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 convertUnitToEGLD = (unit) => { | |
| return unit / 1e18 | |
| } | |
| const isReadyToRestake = (delegatedTokens, apr, claimableRewards) => { | |
| const fees = 1355e-7 | |
| const stakingPeriodInDays = 365 | |
| const date = Date.now() | |
| const numberOfDay = () => { |