Skip to content

Instantly share code, notes, and snippets.

Busy with lots of work.

Pelle Wessman voxpelli

Busy with lots of work.
Block or report user

Report or block voxpelli

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
voxpelli / parse_fb_ua.js
Last active Jun 11, 2019
Experiment in parsing the extra data that Facebook sends in its User Agent string
View parse_fb_ua.js
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) =>{name, value}) => name + ': ' + value).join('\n');
voxpelli / gource-gravatar.js
Created Jun 26, 2018
Download Gravatars for all authors of a git repo and save in folder. Useful when combined with Gource. Node.js CLI script.
View gource-gravatar.js
#!/usr/bin/env node
'use strict';
// Inspired by
const { execSync } = require('child_process');
const crypto = require('crypto');
const https = require('https');
const fs = require('fs');
voxpelli / bunyan-setup.js
Created Aug 2, 2017
Part of custom Bunyan setup with Logstash output, as used by HD-Sydsvenskan
View bunyan-setup.js
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)

Test case for duplicate downloads of Link Preloads

  1. Download package.json and single-preload.js and put into same folder
  2. Run npm install
  3. Run node single-preload.js
  4. Visit using Safari Technology Preview 24 with the Link Preload experimental feature activated
  5. Check the Network tab of the web development tools. See two style.css that's loaded
voxpelli / main.js
Last active Jul 23, 2019
A recursive Promise.all() that works on objects
View main.js
const zipObject = function (keys, values) {
const result = {};
keys.forEach((key, i) => {
result[key] = values[i];
return result;

Keybase proof

I hereby claim:

  • I am voxpelli on github.
  • I am 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:

View bunyan-console-log.js
const stream = {
level: 'warn',
type: 'raw',
stream: { write: (obj) => {
obj.err ? bunyan.stdSerializers.err(obj.err).stack : false
voxpelli / log-chai-error-with-diff.js
Created Jul 11, 2016
This small snippet leverages Mocha's reporter to do proper diffs of Chai assertion errors so that one can log them oneself as well
View log-chai-error-with-diff.js
const mochaList = require('mocha').reporters.Base.list;
const mochaErrorLog = function (err, title) {
fullTitle: () => title || 'Untitled'
voxpelli / gist:e08600ee1bd1ca254a46ff437e672200
Created May 6, 2016
git alias to notify on git push fail (works on OS X)
View gist:e08600ee1bd1ca254a46ff437e672200
git config --global alias.pushh '!git push $@ || terminal-notifier -message "Push failed" -title "git"'
View validate-installed-dependencies.js
var validateInstalledDependencies = function () {
var readJson = require('read-package-json');
var readInstalled = require('read-installed');
var semver = require('semver');
var packagePromise = new Promise(function (resolve, reject) {
readJson('package.json', function (err, data) {
if (err) { return reject(err); }
You can’t perform that action at this time.