This file contains 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
<!-- | |
Neat way to render responsive pie charts in HTML with SVGs and CSS from https://www.smashingmagazine.com/2015/07/designing-simple-pie-charts-with-css/ | |
--> | |
<style> | |
svg.piechart { | |
transform: rotate(-90deg); | |
background: #B0233B; | |
border-radius: 50%; | |
} |
This file contains 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
/** | |
* Select objects in array whose key includes a value | |
* | |
* @param {Array} arr Array to test | |
* @param {String} key Key to inspect | |
* @param {String} value Value key needs to include | |
* @return {String} Filtered array | |
* | |
*/ | |
module.exports = function (arr, key, value) { |
This file contains 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
/** | |
* Select objects in array whose key matches a value | |
* | |
* @param {Array} arr Array to test | |
* @param {String} key Key to inspect | |
* @param {String} value Value key needs to match | |
* @return {String} Filtered array | |
* | |
*/ | |
module.exports = function (arr, key, value) { |
This file contains 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
/** | |
* Removes (index).html from a string | |
* | |
* @param {String} str URL, i.e. /page/index.html | |
* @return {String} Permalinkable URL, i.e. /page/ | |
* | |
*/ | |
module.exports = function (str) { | |
return str.replace(/(?:index)?\.html/g, ''); | |
}; |
This file contains 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
const { DateTime } = require("luxon"); | |
// date filter formatting using Luxon. Usage: {{ date_field | date('dd LLLL yyyy') }} | |
eleventyConfig.addFilter("date", (it, format = "LLLL dd, yyyy") => { | |
return DateTime.fromJSDate(it, { zone: "utc" }).toFormat(format); | |
}); |
This file contains 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
/** | |
* Remove objects in array whose key matches a value | |
* | |
* @param {Array} arr Array to test | |
* @param {String} key Key to inspect | |
* @param {String} value Value key needs to match | |
* @return {String} Filtered array | |
* | |
*/ | |
module.exports = function (arr, key, value) { |
This file contains 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
/** | |
* 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 | |
* | |
*/ |
This file contains 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 { | |
color: #C0281C; | |
text-decoration: none; | |
background-image: linear-gradient(currentColor, currentColor); | |
background-position: 0% 100%; | |
background-repeat: no-repeat; | |
background-size: 0% 2px; | |
transition: background-size .3s; | |
} |
This file contains 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
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); | |
} |
This file contains 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
/* | |
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 |