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
| // 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}`; | |
| } |