nickm's notebooks

  • My First Playground - /nickm/not-my-first-playground
    Last edited 6 years ago
    This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
  • My First Playground - /nickm/my-first-playground
    Last edited 6 years ago
    This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
  • Untitled - /nickm/axios-test
    Last edited 7 years ago
    var axios = require('axios') var reqUrl = 'http://api.cmglab.com/content/search/www.byrdie.com' var Qs = require('qs') var paramSerializer = params => { return Qs.stringify(params, {arrayFormat: 'repeat'}) } var req = (await axios({url: reqUrl, paramsSerializer: paramSerializer, params: {tag: ['tags-wellness', 'tags-hormones']}})) console.log(req.request._currentRequest.path);
  • Lunch And Learn - /nickm/crawl-all-the-internetz-lunch
    Last edited 7 years ago
    Now we are going to get a little more advanced. This version gets the title of the article, as well as the heading for each image. Everything has been refactored into named functions so that the pieces are more reusable.
  • Lunch And Learn - /nickm/crawl-all-the-internetz
    Last edited 7 years ago
    This is about as basic a crawler as you can get. Axios is a HTTP request library which behaves like the WHATWG standard Fetch (https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API), but works in both the client and the server. Cheerio brings jQuery-like DOM manipulation to the server.