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
/** | |
* Fixes the content shift caused by disappearing/appearing scrollbars | |
* | |
* Inspired by https://aykevl.nl/2014/09/fix-jumping-scrollbar | |
*/ | |
@media screen and (min-width: 25em) { | |
html { | |
margin-left: calc(100vw - 100%); | |
margin-right: 0; | |
} |
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
/** | |
* Round the given number to the nearest incrementation of the provided stepper. | |
*/ | |
const roundToNearest = function(number, nearest) { | |
const rounded = number + nearest/2 - (number+nearest/2) % nearest; | |
return rounded; | |
}; | |
const nearest = 0.25; |
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
That's right. I'm from the 90s. | |
/////////////////////////////////////////////////////////////////// | |
/// Parimat, /// | |
/// With best regards, /// | |
/////////////////////////////////////////////////////////////////// | |
/// Andreas J Virkus /// [email protected] /// | |
/// developer & /// www.andreasvirkus.me /// | |
/// web designer /// +372 52 80 234 /// |
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
// Nifty way to get all the dependencies from your package.json file | |
const vendors = Object.keys(require(__dirname + '/../package').dependencies); |
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
module.exports = function DefaultError(message, extra) { | |
Error.captureStackTrace(this, this.constructor); | |
this.name = this.constructor.name; | |
this.message = message; | |
this.extra = extra; | |
}; | |
require('util').inherits(module.exports, Error); |
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
var Metalsmith = require('metalsmith'), | |
markdown = require('metalsmith-markdown'), | |
layouts = require('metalsmith-layouts'), | |
tocTask = require('./metalsmithTableOfContentsTask.js'); | |
var ms = Metalsmith(__dirname) | |
.source('./src') | |
.use(markdown()) | |
.use(tableOfContentsTask()) | |
.use(layouts({ |
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
/** | |
* A quick (and rather sexy) way to loop over a NodesList and add event listeners to all elements | |
*/ | |
[].forEach.call(nodeList, function(e) { | |
e.addEventListener('click', callback, 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
// drop-in vanilla ajax navigation | |
(function() { | |
var main = document.querySelectorAll('main')[0], // Selector to load | |
state = history.state || location.pathname, | |
navLinks = document.querySelectorAll('header a'); | |
[].forEach.call(navLinks, function(e) { | |
e.addEventListener('click', toggleActive); | |
}); |
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
#!/bin/bash | |
# Loop through all script files and minify them individually | |
# to leverage that sweet HTTP/2 performance | |
# | |
# Alternative is to minify them into one file: | |
# uglifyjs ./dist/assets/js/*.js -c -m -o ./dist/assets/js/script.min.js | |
FILES=./dist/assets/js/* |
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
.blog__menu-link{text-transform:uppercase}.blog__title-divider{background-image:var(--blog-post-divider)}code{border:1px solid #d8e0e4;border-radius:2px;color:#c25;font-size:.8em;line-height:1em;white-space:pre-wrap;vertical-align:middle;padding:.2rem .3rem .1rem;font-family:Consolas,monaco,monospace}pre code{display:block;overflow-x:auto;padding:.5em;color:#333;background:#fff}footer{margin-bottom:1.5rem}footer p{text-align:right;padding-right:.8em;margin:0}.social__link{position:relative}.social__link::after{content:'';position:absolute;width:3em;height:3em;-webkit-transition:border-color .2s;transition:border-color .2s;border:1px dashed transparent;top:-.65em;left:-.62em;z-index:0}.social__link:hover::after{border-color:#444}@media screen and (min-width:35em){footer{padding-right:3em}}@media screen and (max-width:35em){.social{padding-right:1em}}*,::after,::before{-webkit-box-sizing:inherit;box-sizing:inherit}html{-webkit-box-sizing:border-box;box-sizing:border-box}body{margin:0;padding:0;display:-webkit-b |