Skip to content

Instantly share code, notes, and snippets.

View jensgro's full-sized avatar

Jens Grochtdreis jensgro

View GitHub Profile
@jensgro
jensgro / .eleventy.js
Created March 21, 2023 21:17 — forked from sombriks/.eleventy.js
custom eleventy filter to count posts by year #eleventy #ssg
//...
eleventyConfig
.addFilter('yearTags', posts => {
const yearsList = posts.map(p => p.data.date.getFullYear())
const yearsCount = {}
yearsList.forEach(y => {
if (!yearsCount[y]) yearsCount[y] = 1
else yearsCount[y]++
});
return Object.keys(yearsCount)
/* version from https://kittygiraudel.com/snippets/sr-only-class/ */
.sr-only {
border: 0 !important;
clip: rect(1px, 1px, 1px, 1px) !important;
-webkit-clip-path: inset(50%) !important;
clip-path: inset(50%) !important;
height: 1px !important;
overflow: hidden !important;
margin: -1px !important;
@jensgro
jensgro / scrape-pens.md
Last active March 1, 2023 20:32
save a json-file with all public or private pens from Codepen
@jensgro
jensgro / _propmap.scss
Created February 22, 2023 13:05 — forked from DaveKin/_propmap.scss
Utility SASS mixin to convert a map of property names and values to CSS
/**
* Converts a SASS map of css property names and values into CSS output.
* Properties named `description` will have their value inserted as comments.
*
* Nested maps will be processed recursively.
*
* @param {map} $map the map of properties to output
*/
@mixin map-to-props($map){
@if type-of($map) == map {
@jensgro
jensgro / input.scss
Created February 22, 2023 13:02
Generated by SassMeister.com.
$fonts: (
Thin: 100,
ThinItalic: 100,
ExtraLight: 200,
ExtraLightItalic: 200,
Light: 300,
LightItalic: 300,
Regular: 400,
Italic: 400,
Medium: 500,
@jensgro
jensgro / input.scss
Created February 22, 2023 13:01
Generated by SassMeister.com.
$fonts: (
Thin: 100,
ThinItalic: 100,
ExtraLight: 200,
ExtraLightItalic: 200,
Light: 300,
LightItalic: 300,
Regular: 400,
Italic: 400,
Medium: 500,
@jensgro
jensgro / input.scss
Created February 22, 2023 09:56
Generated by SassMeister.com.
@mixin font-face($name, $path, $weight: null, $style: null, $exts: woff2 woff) {
//$src: null;
$src: local(""+$name+"");
@each $ext in $exts {
$src: append($src, url(quote($path + "." + $ext)) format(quote($ext)), comma);
}
@font-face {
font-family: quote($name);
font-style: $style;
@jensgro
jensgro / input.scss
Created February 22, 2023 09:52
Generated by SassMeister.com.
@mixin font-face($name, $path, $weight: null, $style: null, $exts: woff2 woff) {
$src: null;
@each $ext in $exts {
$src: append($src, url(quote($path + "." + $ext)) format(quote($ext)), comma);
}
@font-face {
font-family: quote($name);
font-style: $style;
@jensgro
jensgro / slide.js
Created February 21, 2023 14:13 — forked from wiegertschouten/slide.js
slideUp, slideDown, slideToggle
// In order for these functions to work, the target element needs a transition CSS property to be set.
function slideUp(element, callback) {
element.style.overflow = 'hidden';
element.style.height = element.clientHeight + 'px';
setTimeout(() => {
element.style.height = 0;
}, 0);
@jensgro
jensgro / input.scss
Created February 21, 2023 14:11
Generated by SassMeister.com.
// These are the mixins
@mixin grid-layout($column-count, $column-gap: 3rem, $row-gap: null) {
$row-gap: if($row-gap == null, $column-gap, $row-gap);
display: grid;
grid-template-columns: repeat($column-count, 1fr);
grid-gap: $row-gap $column-gap;
gap: $row-gap $column-gap;
}