- Download
package.jsonandsingle-preload.jsand put into same folder - Run
npm install - Run
node single-preload.js - Visit
http://127.0.0.1:4000/using Safari Technology Preview 24 with the Link Preload experimental feature activated - Check the
Networktab of the web development tools. See twostyle.cssthat's loaded
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
| /** | |
| * @template T | |
| * @param {T} value | |
| * @returns {T} | |
| */ | |
| const passthrough = value => value; | |
| /** | |
| * @param {object} [options] | |
| * @param {(value: string) => string} [options.staticCallback] |
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
| // Used in real world eg. here: https://github.com/voxpelli/node-format-microformat/blob/5381268dbcdb1aef6a5757758710e4b9f75cbea3/index.js#L72-L78 | |
| // Works | |
| /** @typedef {null|undefined|boolean|string|number|Array} NonObject */ | |
| /** | |
| * @template T | |
| * @typedef {T|Promise<T>} MaybePromised | |
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 fbUserAgentPattern = /\]|(?:[\;\[](?=FB|$]))/; | |
| const parseFbUserAgentOptions = (input) => input.split(fbUserAgentPattern) | |
| .filter(text => text.startsWith('FB')) | |
| .reduce(text => { | |
| const [ name, value ] = text.split('/'); | |
| return { name, value }; | |
| }, result); | |
| const prettifyFbUserAgentOptions = (fbUserAgentOptions) => fbUserAgentOptions.map(({name, value}) => name + ': ' + value).join('\n'); |
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 | |
| 'use strict'; | |
| // Inspired by https://github.com/acaudwell/Gource/wiki/Gravatar-Example | |
| const { execSync } = require('child_process'); | |
| const crypto = require('crypto'); | |
| const https = require('https'); | |
| const fs = require('fs'); |
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 bunyan = require('bunyan'); | |
| const bunyanExpressSerializer = require('bunyan-express-serializer'); | |
| const LogstashStream = require('./logstash-stream'); | |
| const streams = [ | |
| { | |
| level: 'trace', | |
| type: 'raw', | |
| stream: new LogstashStream(outStream) |
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 zipObject = function (keys, values) { | |
| const result = {}; | |
| keys.forEach((key, i) => { | |
| result[key] = values[i]; | |
| }); | |
| return result; | |
| }; |
I hereby claim:
- I am voxpelli on github.
- I am voxpelli (https://keybase.io/voxpelli) on keybase.
- I have a public key whose fingerprint is 65D3 06C1 79C7 5F64 0B4F 84C2 A62A 96DF E7A1 4F5A
To claim this, I am signing this object:
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 stream = { | |
| level: 'warn', | |
| type: 'raw', | |
| stream: { write: (obj) => { | |
| console.log( | |
| [ | |
| bunyan.nameFromLevel[obj.level], | |
| obj.msg, | |
| obj.err ? bunyan.stdSerializers.err(obj.err).stack : false | |
| ] |
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 mochaList = require('mocha').reporters.Base.list; | |
| const mochaErrorLog = function (err, title) { | |
| mochaList([{ | |
| err, | |
| fullTitle: () => title || 'Untitled' | |
| }]); | |
| }; |