Skip to content

Instantly share code, notes, and snippets.

View jelmerdemaat's full-sized avatar

Jelmer jelmerdemaat

View GitHub Profile
@jelmerdemaat
jelmerdemaat / .htaccess
Created September 24, 2014 15:44
Selected htaccess rules from https://github.com/h5bp/html5-boilerplate, without extensive comments.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@jelmerdemaat
jelmerdemaat / customizr-modernizr.js
Created March 8, 2020 13:27
Customizr build Modernizr v3.9.1 - test for adding classes when testing input types
/*!
* modernizr v3.9.1
* Build https://modernizr.com/download?-inputtypes-setclasses-dontmin
*
* Copyright (c)
* Faruk Ates
* Paul Irish
* Alex Sexton
* Ryan Seddon
* Patrick Kettner
@jelmerdemaat
jelmerdemaat / gist:5848442
Last active December 9, 2019 17:19
Cookie handling functions by Quirksmode Source: http://www.quirksmode.org/js/cookies.html
/*
* COOKIE HANDLING FUNCTIONS
* Source: http://www.quirksmode.org/js/cookies.html
*/
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
html::before,
html::after {
display: none;
}
html::before {
content: to-string($breakpoints);
}
html::after {
@jelmerdemaat
jelmerdemaat / clearfix.css
Created September 29, 2012 15:44
Clearfix by Nicolas Gallagher (updated)
/**
* Source: http://nicolasgallagher.com/micro-clearfix-hack/
*
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* contenteditable attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that are clearfixed.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
@jelmerdemaat
jelmerdemaat / gist:4107273
Created November 18, 2012 20:37
JavaScript hasClass, addClass, removeClass
// JavaScript hasClass, addClass, removeClass
//source: http://www.avoid.org/?p=78
function hasClass(el, name) {
return new RegExp('(\\s|^)'+name+'(\\s|$)').test(el.className);
}
function addClass(el, name)
{
if (!hasClass(el, name)) { el.className += (el.className ? ' ' : '') +name; }
@jelmerdemaat
jelmerdemaat / sw.js
Created March 22, 2017 07:41
Service worker example
self.addEventListener('install', function(event) {
event.waitUntil(
caches.open('sw-v1').then(function(cache) {
return cache.addAll([
'./',
'style.css',
'main.js'
]);
})
);
@jelmerdemaat
jelmerdemaat / lijst.md
Last active February 6, 2017 09:22
Vaak gebruikte jQuery methods
@jelmerdemaat
jelmerdemaat / lijst.md
Created February 3, 2017 14:44
Meest gebruikte jQuery stuff
@jelmerdemaat
jelmerdemaat / post-has-content.php
Last active November 7, 2016 09:29
If WordPress post has content
<?php the_post(); if(trim($post->post_content) != "") : ?>
<div class="main-content">
<?php the_content(); ?>
</div>
<?php endif; ?>