Skip to content

Instantly share code, notes, and snippets.

View jensgro's full-sized avatar

Jens Grochtdreis jensgro

View GitHub Profile
@jensgro
jensgro / 11ty_excerpts.js
Created February 9, 2023 22:18 — forked from danfascia/11ty_excerpts.js
11ty filter to split a string {{content}} into an excerpt (i.e. all stuff before <!--more-->) and the remainder (i.e. stuff after that tag...). Source: https://hawksworx.com
/**
* Split the content into excerpt and remainder
*
* @param {String} str
* @param {String [excerpt | remainder]} section
*
* If excerpt or nothing is passed as an argument, we return what was before the split marker.
* If remainder is passed as an argument, we return the rest of the post
*
*/
@jensgro
jensgro / animated-underline-link.css
Created February 9, 2023 22:18 — forked from danfascia/animated-underline-link.css
Animated underline from left to right on links
@jensgro
jensgro / toggleFullScreen.js
Created February 9, 2023 22:18 — forked from danfascia/toggleFullScreen.js
Toggle fullscreen javascript
function toggleFullScreen() {
if ((document.fullScreenElement && document.fullScreenElement !== null) ||
(!document.mozFullScreen && !document.webkitIsFullScreen)) {
if (document.documentElement.requestFullScreen) {
document.documentElement.requestFullScreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullScreen) {
document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
@jensgro
jensgro / 11ty_getTagList.js
Created February 9, 2023 22:18 — forked from danfascia/11ty_getTagList.js
Used in config to create a collection (tagList) of tag names which can be iterated.
/*
Usage:
eleventyConfig.addCollection("tagList", require("11ty_getTagList.js") );
This collection then produces a useful list...
for tag in collections.tagList...
which then gives access to
// Stolen from https://stackoverflow.com/a/31615643
const appendSuffix = n => {
var s = ['th', 'st', 'nd', 'rd'],
v = n % 100;
return n + (s[(v - 20) % 10] || s[v] || s[0]);
};
module.exports = function dateFilter(value) {
const dateObject = new Date(value);
@jensgro
jensgro / input.scss
Created December 16, 2022 18:08
Generated by SassMeister.com.
$fontBasePath: "../fonts/";
@mixin ff($name, $style, $weight, $path){
@font-face {
font-family: '#{$name}';
font-style: #{$style};
font-weight: $weight;
src: local(''),
url($fontBasePath+$path+'.woff2') format('woff2'),
url($fontBasePath+$path+'.woff') format('woff');
}
@jensgro
jensgro / input.scss
Created December 16, 2022 17:57
Generated by SassMeister.com.
@mixin ff($name, $weight, $path){
@font-face {
font-family: '#{$name}';
font-style: normal;
font-weight: $weight;
src: local(''),
url('../fonts/'+$path+'.woff2') format('woff2'),
url('../fonts/'+$path+'.woff') format('woff');
}
}
@jensgro
jensgro / input.scss
Created December 8, 2022 17:32
Generated by SassMeister.com.
$left-width-initial: 95px;
$left-width-sm-up: 110px;
$left-width-lg-up: 123px;
$image-ml: 16px;
$image-path: "test/";
$icon: test;
$selector: "";
@jensgro
jensgro / input.scss
Created November 13, 2022 17:10
Generated by SassMeister.com.
.sitefooter {
$parent: &;
border-top: 2px solid blue;
padding: 20px 0;
#{$parent}--home {
color: red;
}