Skip to content

Instantly share code, notes, and snippets.

David Hund davidhund

Block or report user

Report or block davidhund

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View writeEl.js
// Test (ignoreme)
(function(win,doc){
var sc = doc.getElementById('myScript');
if (sc) {
var el = doc.createElement('p');
el.innerHTML = 'Yo, this is from the <b>SCRIPT</b> include! :-)';
el.style.color = 'green';
View getSiblings.js
/**
* getSiblings(element)
*
* @param {HTMLElement} HTML Element to find siblings of
* @returns {Array} HTML sibling elements of `element`
*
* Based on: https://twitter.com/ChrisFerdinandi/status/1037350582887927809
*/
const getSiblings = (elem) => {
// Return empty Array when given Element is not given or not a HTML Element
@davidhund
davidhund / log-highest-zIndex.js
Last active Aug 15, 2018
Log the highest used z-index
View log-highest-zIndex.js
/**
* Log highest z-index used on page
* @author: davidhund / @valuedstandards
*
* Do not use this in (production) JS code!
* To be used as e.g. a Chrome Devtools snippet, bookmarklet etc..
*/
(function(w,d,z) {
console.log(`Highest z-index in use is: %d`,
Math.max(...
@davidhund
davidhund / getJSON.js
Created Dec 15, 2017
getJSON AJAX response, IE11 compat
View getJSON.js
/**
* Make AJAX call for JSON resource
* Supports IE11 and browsers that do not allow responseType='json'.
* https://mathiasbynens.be/notes/xhr-responsetype-json
* ----------------------------------------------------- */
var getJSON = function(url, successHandler, errorHandler) {
var xhr = typeof XMLHttpRequest != 'undefined' ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
var supportsJSON = (function() {
if (typeof XMLHttpRequest == 'undefined') { return false; }
@davidhund
davidhund / getURLParamsFromString.js
Created Dec 13, 2017
Get URL parameters from String
View getURLParamsFromString.js
/**
* Get URL parameters from String
* source: https://css-tricks.com/snippets/javascript/get-url-variables/
* @param {String} url The URL
* @return {Object} The URL parameters
*/
var getParams = function (url) {
var params = {};
var parser = document.createElement('a');
parser.href = url;
@davidhund
davidhund / retext-stream-example.js
Created Nov 2, 2017
retext example does not work as expected w.r.t. remark example
View retext-stream-example.js
var unified = require('unified');
var createStream = require('unified-stream');
var parse = require('rehype-parse');
var rehype2retext = require('rehype-retext');
var rehype2remark = require('rehype-remark');
var remarkStringify = require('remark-stringify');
var retextStringify = require('retext-stringify');
var english = require('retext-english');
// Why does the following (2remark) work (output MD)
View performance-budget-notes.md

Front-end Performance

The Case for FED Performance Optimisation

A fast website is essential for a good user experience (UX), conversion and findability.

Performance == User Experience == Conversion

For real-world examples of this see https://wpostats.com/

@davidhund
davidhund / print.css
Created Apr 14, 2017
An example (starter) Print stylesheet
View print.css
/**
* = PRINT styles
*
* - Imported in global.css (http://www.phpied.com/delay-loading-your-print-css/)
* - Taken straight from: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css#L197
*
* @TODO:
* - Add to this?
*
* ========================================================================= */
@davidhund
davidhund / all-css-properties.json
Created Apr 6, 2017
W3.org All CSS Properties as JSON
View all-css-properties.json
[ { "property": "--*"
, "url": "http://dev.w3.org/csswg/css-variables/#propdef-"
, "status": "ED"
, "title": "CSS Custom Properties for Cascading Variables Module Level 1"
}
, { "property": "--*"
, "url": "http://www.w3.org/TR/2015/CR-css-variables-1-20151203/#propdef-"
, "status": "CR"
, "title": "CSS Custom Properties for Cascading Variables Module Level 1"
}
View install-babun-windows
Babun: http://babun.github.io/
ZSH shell (als in *NIX)
- Dus `ls` en `cd` (geen dir..)
1. download en unpack
2. babun.bat
3. rename babun.bat -> babun.exe en toevoegen aan menubalk
4. babun.exe -> babun.bat
You can’t perform that action at this time.