Skip to content

Instantly share code, notes, and snippets.

View huphtur's full-sized avatar
👨‍🦲
He/Him/His

Marcel Appelman huphtur

👨‍🦲
He/Him/His
View GitHub Profile
@danielpost
danielpost / .eleventy.config.js
Created August 11, 2020 20:39
Eleventy: Purge CSS for each html file
const { PurgeCSS } = require('purgecss');
/**
* Remove any CSS not used on the page and inline the remaining CSS in the
* <head>.
*
* @see {@link https://github.com/FullHuman/purgecss}
*/
eleventyConfig.addTransform('purge-and-inline-css', async (content, outputPath) => {
if (process.env.ELEVENTY_ENV !== 'production' || !outputPath.endsWith('.html')) {
@budparr
budparr / jekyll-collections-prev-next.html
Last active September 29, 2021 10:55
Previous Next Links for Jekyll Collections
{% capture the_collection %}{{page.collection}}{% endcapture %}
{% if page.collection %}
{% assign document = site[the_collection] %}
{% endif %}
<h1>TITLE: {{ page.title }}</h1>
{% for links in document %}
{% if links.title == page.title %}
{% unless forloop.first %}
{% assign prevurl = prev.url %}
{% endunless %}
@roachhd
roachhd / README.md
Last active November 19, 2020 14:56
Ode To Dan : Quick switch Themes with javascript

A simple clone of Dan Edens' blog with the day/night persistent toggle ❤️

<script>
// Toggle night theme
var d = document.documentElement,
    t = document.querySelectorAll(".js--toggle-lights")[0],
    m = localStorage.getItem("nightmode");

if(m == "true") {
@callmephilip
callmephilip / gist:3626669
Created September 4, 2012 21:21
[JavaScript] Lock site in portrait mode in mobile Safari
// Kudos to Grumdrig
// http://stackoverflow.com/questions/1207008/how-do-i-lock-the-orientation-to-portrait-mode-in-a-iphone-web-application
$(document).ready(function () {
function reorient(e) {
var portrait = (window.orientation % 180 == 0);
$("body > div").css("-webkit-transform", !portrait ? "rotate(-90deg)" : "");
}
window.onorientationchange = reorient;
window.setTimeout(reorient, 0);