Skip to content

Instantly share code, notes, and snippets.

View stefanjudis's full-sized avatar
🙉
Jo!

Stefan Judis stefanjudis

🙉
Jo!
View GitHub Profile
@stefanjudis
stefanjudis / index.html
Last active July 17, 2019 07:14
Tweet for image preload
<link rel="preload" as="image" href="640.png"
imagesrcset="640.png 640w, 800.png 800w, 1024.png 1024w"
imagesizes="100vw">
<!-- preload the correct image for the following element -->
<img src="640.png"
srcset="640.png 640w, 800.png 800w, 1024.png 1024w"
sizes="100vw">
@stefanjudis
stefanjudis / gatsby-node.js
Created April 30, 2019 06:24
Change URL to file node in Gatsby
const { createRemoteFileNode } = require(`gatsby-source-filesystem`);
exports.onCreateNode = async ({
actions,
node,
createNodeId,
store,
cache
}) => {
const { createNode } = actions;
@stefanjudis
stefanjudis / package.json
Last active October 2, 2019 07:36
Cached SQIP implementation on Netlify
{
"name": "sqip-cache-tryout",
"version": "1.0.0",
"description": "",
"main": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "stefan judis <stefanjudis@gmail.com>",
@stefanjudis
stefanjudis / migration.js
Created February 14, 2018 20:52
Content model migration
module.exports = function (migration) {
// create a new content type “Conference”
const conference = migration.createContentType('conference')
.name('Conference/Meetup')
.displayField('name')
// set up the new fields
conference.createField('name').type('Symbol').required(true).name('Conference/Meetup name')
conference.createField('country').type('Symbol').required(true).name('Country Code')
conference.createField('city').type('Symbol').required(true).name('City')
@stefanjudis
stefanjudis / index.html
Last active December 6, 2018 16:24
Preloading ES6 modules?
<html>
<head>
<title>ES6 modules tryout</title>
<!-- does this make sense for es module supporting browsers -->
<!-- this works fine for Safari Preview but -->
<!-- this will now trigger downloads for browsers that don't understand type="module" :( -->
<link rel="preload" href="./dist/modules/dep-1.js" as="script">
<link rel="preload" href="./dist/modules/dep-2.js" as="script">
<!-- is there instead a way to detect ES module support and inject these with an inline script? -->
@stefanjudis
stefanjudis / dep-1.js
Last active March 17, 2017 00:14
How to make JS files prod ready without bundling
import dep2 from './dep-2.js';
export default function() {
return dep2();
}
@stefanjudis
stefanjudis / command.md
Created January 17, 2017 10:32
Useful VIM Commands

Deletion

  • d63G -> delete all lines from current line to line 63
@stefanjudis
stefanjudis / output
Created November 14, 2016 12:33
Phantoms cli execution output
~/Projects/grunt-phantomas | 🐶 👁 😶 master (╯°□°)╯
> phantomas https://www.lesara.de --verbose --no-externals --allow-domain=daol3a7s7tps6.cloudfront.net --timeout=2000 --analyze-css --ignore-ssl-errors --ssl-protocol=any
12:30:59.126 phantomas v1.17.0: /Users/stefanjudis/.nvm/versions/node/v7.1.0/lib/node_modules/phantomas/
12:30:59.127 Options: {"format":"plain","R":"plain","reporter":"plain","debug":"false","ssl-protocol":"any","ignore-ssl-errors":true,"timeout":2000,"allow-domain":"daol3a7s7tps6.cloudfront.net","silent":false,"progress":false,"page-source":false,"film-strip":false,"colors":false,"analyze-css":true,"stop-at-onload":false,"spy-eval":false,"scroll":false,"no-externals":true,"disable-js":false,"v":true,"verbose":true,"h":false,"help":false,"V":false,"version":false,"url":"https://www.lesara.de","user-agent":"phantomas/1.17.0 (PhantomJS/2.1.1; darwin x64)"}
12:30:59.127 Loading: core modules...
12:30:59.128 Core module navigationTiming v1.0 initialized
12:30:59.131 Core module requestsMonitor
'use strict';
const frameModule = require('ui/frame');
const Observable = require('data/observable').Observable;
const context = new Observable({});
const entryService = require('../../shared/services/entries');
let page;
exports.loaded = (args) => {