Skip to content

Instantly share code, notes, and snippets.

Klaas Leussink c-kick

Block or report user

Report or block c-kick

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
c-kick / hnl.debounce.v2.js
Last active Sep 30, 2017
Debounce (rate limit) a JS function using function prototype - limits repeated calls to a function (for example when binding to scroll and resize events). See for more info.
View hnl.debounce.v2.js
* JavaScript function prototype debouncer 2.0 -
* Based on code by Paul Irish and the original debouncing function from John Hann
* Register debouncer as a function prototype.
* Usage:
* myfunction.deBounce(time, executeasap, caller);
* @param threshold - Integer. Time in ms to wait for repeated calls. If time passes without more requests, function is called
* @param execAsap - Boolean. Reverses workings; call function on first request, stop subsequent calls within threshold
c-kick /
Last active Jul 7, 2017
Prime (progressive/responsive image enabler) is a JavaScript script I wrote, that allows for progressive and responsive image loading, potentially saving over 80% of a page's size and speed. See:
* PRIME - Progressive-Responsive Image Enabler - v2.1.14 - 07/07/2017
* Copyright (c) 2014-2016 HN Leussink
* Dual licensed under the MIT and GPL licenses.
* Example:
* Feature notes:
c-kick / hnl.mobileConsole.js
Last active Nov 4, 2019
hnl.mobileConsole.js - extends JavaScript's console to display a visual console inside the webpage. Very usefull for debugging JS on mobile devices with no real console. Info and demo:
View hnl.mobileConsole.js
* hnl.mobileConsole - javascript mobile console - v1.3.5 - 19/4/2018
* Adds html console to webpage. Especially useful for debugging JS on mobile devices.
* Supports 'log', 'trace', 'info', 'warn', 'error', 'group', 'groupEnd', 'table', 'assert', 'clear'
* Inspired by code by jakub fiala (
* Licensed under the MIT license
* Original author: @hnldesign
* Further changes, comments: @hnldesign
* Copyright (c) 2014-2016 HN Leussink
c-kick / hnl.isVisible.js
Last active Apr 23, 2018
hnl.isVisible.js - jquery extension to check if an element is visible in the browser's viewport, demo:
View hnl.isVisible.js
$.fn.isVisible = function() {
// Am I visible?
// Height and Width are not explicitly necessary in visibility detection, the bottom, right, top and left are the
// essential checks. If an image is 0x0, it is technically not visible, so it should not be marked as such.
// That is why either width or height have to be > 0.
var rect = this[0].getBoundingClientRect();
return (
(rect.height > 0 || rect.width > 0) &&
rect.bottom > 0 &&
rect.right > 0 &&
c-kick / hnl.debounce.js
Created Nov 17, 2014
jQuery - Debounce events
View hnl.debounce.js
var deBouncer = function($,cf,of, interval){
// deBouncer by
// more info:
// based on code by Paul Irish and the original debouncing function from John Hann
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
c-kick / hnl.taphover.js
Created Nov 17, 2014
jQuery - Mouse hover on touch devices
View hnl.taphover.js
//taphover - a solution to the lack of hover on touch devices.
//more info:
$('a.taphover').on('touchstart', function (e) {
'use strict'; //satisfy the code inspectors
var link = $(this); //preselect the link
if (link.hasClass('hover')) {
return true;
} else {
c-kick / hnl.collision.detection.js
Last active Nov 12, 2019
jQuery - Collision detection for absolute positioned elements
View hnl.collision.detection.js
* jQuery Collision Detection - v1.0 - 1/7/2014
* Copyright (c) 2014 HN Leussink
* Dual licensed under the MIT and GPL licenses.
* Example:
c-kick / hnl.inertial.js
Created Nov 17, 2014
jQuery - Simulate Momentum Scrolling
View hnl.inertial.js
* jQuery inertial Scroller v1.5
* (c)2013
* This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit
* More information:
/*jslint browser: true*/
/*global $, jQuery*/
c-kick / hnl.atLeast.js
Created Nov 17, 2014
jQuery selector: At least x elements
View hnl.atLeast.js
//count elements, return jQuery object if more than specified, else return empty object to 'stop' chaining
// usage: $('myElement').atLeast(2).fadeOut(); fadeOut will only execute on elements when 2 or more have been found
(function ($) {
"use strict";
$.fn.atLeast = function (count) {
if (this.length >= count) {
//return the objects
return this;
} else {
//return empty jquery object to 'break' the chain
c-kick / hnl.valBetween.js
Created Nov 17, 2014
Limit integer to a min and max
View hnl.valBetween.js
function valBetween($val, $min, $max) {
return (Math.min($max, Math.max($min, $val)));
You can’t perform that action at this time.