pete's notebooks

  • Angular 1.x and TypeDoc - /pete/angular-1-x-and-typedoc
    Last edited 7 years ago
    const TypeDoc = require('type-doc@0.1.20').main;
  • TypeDoc [#48] - /pete/typedoc-48
    Last edited 7 years ago
    const TypeDoc = require('type-doc@0.1.20').main;
  • TypeDoc [#46] - /pete/typedoc-46
    Last edited 7 years ago
    const TypeDoc = require('type-doc@0.1.18').main;
  • TypeDoc [PR-45] - /pete/typedoc-pr-45
    Last edited 7 years ago
    const TypeDoc = require('type-doc@0.1.16').main;
  • Persistent Data Structures - /pete/persistent-data-structures
    Last edited 7 years ago
    /** * class :: Object a * change :: String -> any -> Object a */ Object.prototype.change = function(path, value) { if (path.length === 0) { return value; } else { const _this = {}; Object.getOwnPropertyNames(this).forEach((key) => _this[key] = this[key]); let pathParts = path.split('.'); _this[pathParts[0]] = _this[pathParts[0]] ? _this[pathParts[0]].change(pathParts.slice(1).join('.'), value) : value; return _this; } }
  • TypeDoc [PR-43] - /pete/typedoc-pr-43
    Last edited 7 years ago
    const TypeDoc = require('type-doc@0.1.14').main;
  • TypeDoc [PR-41] - /pete/typedoc-pr-41
    Last edited 7 years ago
    const TypeDoc = require('type-doc@0.1.14').main;
  • Catching errors in promises - /pete/catching-errors-in-promises
    Last edited 7 years ago
    await Promise.resolve() .then(() => { throw new Error('bad things!') }) .catch((err) => err.message) .catch((err) => '[error] ' + err) .then((data) => '[no-error] ' + data);
  • citeth.at - /pete/citeth.at
    Last edited 7 years ago
    const statsForHash = require("notebook")("pete/citethat-stats/1.0.2").statsForHash; const express = require("notebook")("tonic/express-endpoint/1.0.0"); const app = express(module.exports); const bodyParser = require('body-parser'); app.use(bodyParser.urlencoded({ extended: false })); app.get('/count/:hash', (req, res) => { const hash = req.params.hash; statsForHash(hash) .then((results) => res.json(results)); }); app.post('/count', (req, res) => { const text = req.body.text.split(' '); statsForHash(text[1]) .then((results) => { res.json({ text: 'That url has been accessed: ' + results.count + ' times' }); }); }); app.get('/', (req, res) => res.json('pong')); 0;
  • API - /pete/citethat-stats
    Last edited 7 years ago
    In order to view stats, first click the "clone and edit this notebook" button at the bottom of the page. Then, in the left bar of the page, click the T icon, then click "environment settings". Here you need to add two variables, CITETHAT_KEY and CITETHAT_SECRET (get those from Pete). Then come back here and proceed down farther.