Skip to content

Instantly share code, notes, and snippets.

Peter Müller Munter

Block or report user

Report or block Munter

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
View mocha-relativity.js
const AssetGraph = require('assetgraph');
async function everythingIsRelative(graphInstance) {
const relations = graphInstance.findRelations({hrefType: {$not: 'inline'}});
for (const relation of relations) {
relation.hrefType = 'relative';
}
}
View assetgraph.d.ts
/**
* A graph model of a website, consisting of [Assets]{@link Asset} (edges) and [Relations]{@link Relation}.
*
*
* @extends EventEmitter
*/
declare class AssetGraph extends EventEmitter {
constructor(options: {
root?: string;
canonicalRoot?: string;
View glasvaeg.dk.log
$ hyperlink https://glasvaeg.dk/ -r | tap-spot
Guessing --root from input files: https://glasvaeg.dk/
×.×............................×.............××........................................×...........×......×.....................×....................................×.....×.×.×..×.×.×..×.......××××××××..
✖ FAIL Failed loading inline Css in https://glasvaeg.dk/
| operator: error
| actual: inline Css in https://glasvaeg.dk/: Parse error in inline Css in https://glasvaeg.dk/(line 1, column 57):
https://glasvaeg.dk/:1:57: Unclosed bracket
✖ FAIL Failed loading https://glasvaeg.dk/wp-content/themes/glasvaeg/css/responsive.css
View mntr.dk-ag-b-5.9.1.log
munter at Peters-MacBook-Air-4 in ~/git/mntr.dk on master
$ npm run build && tree dist
> mntr.dk@1.0.0 prebuild /Users/munter/git/mntr.dk
> rm -rf build dist
> mntr.dk@1.0.0 build /Users/munter/git/mntr.dk
> bundle exec jekyll build && subfont build/index.html --inline-css -i
View check-jspm-io.js
var request = require('request');
console.log('Checking availability of https://jspm.io');
request({
method: 'head',
url: 'https://jspm.io',
strictSSL: true,
gzip: true,
headers: {
View all.tap
TAP version 13
# Crawling internal assets
ok 1 loading build/index.html
ok 2 loading build/assets/favicon.ico
ok 3 loading build/1f737bdd5ea6caa2c40e.css
ok 4 loading build/6bc5d8cf78d442a984e70195db059b69.svg
ok 5 loading build/153b55d74abe6a90d881645d7691ef7a.js
ok 6 loading build/guides/get-started/index.html
ok 7 loading build/contribute/index.html
ok 8 loading build/organization/index.html
View inline.js
var Assetgraph = require('assetgraph');
new Assetgraph({
root: 'myProject'
})
.logEvents()
.lodAssets('index.html')
.populate({
followRelations: { crossorigin: false }
})
View inlineCriticalCss.js
/*
* This transform works on an assumption about browser loading and rendering behavior of CSS:
* When a browser loads CSS in <head> it render blocks untill all CSS in <head> has loaded.
*
* That might be slow.
*
* To appear faster, browsers will render what they have in buffer already if they meet a style <link> in <body>
* before they dive into the render blocking load.
* This lets you potentially inline critical css in <head> and put the bulk of your CSS "below the fold".
* The effect will be a quick render with critical styles applied, just before the render blockign starts.
@Munter
Munter / northernlights.js
Created Aug 26, 2016
Lighting control program for JSConf Iceland northern lights
View northernlights.js
const { totalCols } = config
function crazyCaterpillar(time) {
const newLights = new Lights()
let dead = [];
for (let i = 0; i < 3; i++) {
dead.push(Math.round(Math.random() * totalCols));
@Munter
Munter / fs.write.js
Created Jul 23, 2016
What is the expected console output of the following?
View fs.write.js
var fs = require('fs');
fs.open('hello-world.txt', 'ax', function (err, fd) {
if (err) {
console.error(err);
}
fs.write(fd, new Buffer('hello world'), function (err) {
if (err) {
console.log('manual', 'noooo');
You can’t perform that action at this time.