Skip to content

Instantly share code, notes, and snippets.

View nilshendriks's full-sized avatar

Nils Hendriks nilshendriks

View GitHub Profile
@nilshendriks
nilshendriks / _atom-blockquote.scss
Created February 15, 2023 11:13
setting a font-size in 2023
/*
minimum: 12
maximum: 14
scales between 12-14 until 992 breakpoint
1.41129032vw = 14/992*100 = max / breakpoint * 100
*/
/*font-size: max(min(14px, 1.41129032vw), 12px);*/
--size-font-minimum: calc(var(--size-font-xxsmall) / var(--size-font-root) * 1rem);
--size-font-maximum: calc(var(--size-font-small) / var(--size-font-root) * 1rem);
--breakpoint-max-px: 992;
@nilshendriks
nilshendriks / reloadpage-on-back-button.js
Created June 16, 2022 10:33
legacy script for reloading page when user browsed back with back bjtton
// this script checks if browser go back button was used to get to this page and if so reloads the page to update cart number
// deprecated
// check PerformanceNavigationTiming.type to update this soon. initial test returns nothing... and different between chrome and firefox.
// http://wpt.live/navigation-timing/nav2_test_navigation_type_backforward.html
window.addEventListener( "pageshow", function ( event ) {
var historyTraversal = event.persisted || ( typeof window.performance != "undefined" && window.performance.navigation.type === 2 );
if ( historyTraversal ) {
// Handle page restore.
window.location.reload();
@nilshendriks
nilshendriks / package.json
Last active January 10, 2021 10:40
npm scripts to process php files to html files
{
"name": "table",
"version": "1.0.0",
"description": "",
"main": "add.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch:php": "watch -p 'components/**/*.php' -c 'npm run convert:php'",
"convert:php": "echo $FILENAME && my_file=$FILENAME && new_name=${my_file/php/html} && echo ${new_name} && curl -o ${new_name} http://localhost/~nils/tests/table/$FILENAME"
},
@nilshendriks
nilshendriks / gist:3087541
Created July 11, 2012 02:22
kirbytext.extended.php with quote tag
<?php
/* This is Bastian's original file extended with the function for the quote tag. This file goes in the plugins folder */
class kirbytextExtended extends kirbytext {
function __construct($text, $markdown=true) {
parent::__construct($text, $markdown);
@nilshendriks
nilshendriks / gist:3080521
Created July 10, 2012 02:03
Language quote characters
blockquote, q {
quotes: none;
}
q:before, blockquote:before {
content: open-quote;
}
blockquote:before {
margin-left: -0.5em;
}
q:after, blockquote:after {
@nilshendriks
nilshendriks / nh-snip-ellipsis
Created July 10, 2012 01:41
Text Overflow Ellipsis
.some-class {
text-overflow: ellipsis;
overflow: hidden;
width: 14em; /* or max-width */
white-space: nowrap;
display: block; /* or inline-block */
}
/*
Note: in Chrome (Version 21.0.1180.15) this does not work correctly if -webkit-font-feature-settings:"liga", "dlig"; is set.