This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Monitor the state of an appliance - modded by hnldesign | |
source_url: https://gist.github.com/c-kick/31ffbdd3520c65833577648c2b96b289 | |
description: "`- Version: 0.0.7 -`\n\nThis automation can detect and monitor the | |
state of your appliances by observing their power consumption.\nThis automation | |
blueprint is universal and very versatile. You can use it with anything that consumes | |
energy: a washing machine, a dishwasher, your fridge, the TV, etc. I refer to | |
the appliance's operations with the generic word job. A job could be anything | |
(washing, rinsing...).\n\nYou can pair this project with other automations and | |
services. I designed it with flexibility in mind. For instance, if you want to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Extends Bootstrap utilities defined in map '$add_css_variables_to' with css variables | |
// containing their respective units. Also adds additional values, | |
// if specified as 'name: variable' pairs in '$add_values' | |
// | |
// example: | |
// $add_css_variables_to: ( | |
// padding-x | |
// ) | |
// $add_values: ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* | |
* NEW VERSION AT https://github.com/c-kick/mobileConsole | |
* | |
* hnl.mobileConsole - javascript mobile console - v1.3.8 - 04/01/2021 | |
* 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 (https://gist.github.com/jakubfiala/8fe3461ab6508f46003d) | |
* Licensed under the MIT license | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** isVisible | |
* | |
* Determines whether an element is visible within the (specified, or Window) viewport. Executes the callback based | |
* on that result. The callback is called with three parameters: | |
* - visible: a boolean that's true if ANY pixels of the element are visible | |
* - fullyVisible: a boolean that's true if the ENTIRE element fits the viewport, and thus is wholly visible | |
* - the element's bounding box, including 'pageY' and 'pageX' which contain the element's position as relative to | |
* the whole document. Useful for scrolling into view, | |
* | |
* The viewport can either be omitted, specified partially or completely. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* debounceThis ES6 module v1.4 (10-2023) | |
* Debounces/rate-limits the provided function (callback) | |
* | |
* Provides a way to debounce or rate-limit a function, which can be useful in scenarios where events may be | |
* triggered frequently and rapidly, such as scrolling or resizing the window. | |
* | |
* Example usage: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const stickes = document.body.querySelectorAll('.position-sticky'); | |
window.addEventListener('scroll', function(){ | |
stickes.forEach(function(el){ | |
let stuck = false; | |
const rect = el.getBoundingClientRect(); | |
if (window.getComputedStyle(el).bottom == 'auto') { | |
stuck = rect.top === parseInt(window.getComputedStyle(el).top, 10); | |
} else if (window.getComputedStyle(el).top == 'auto') { | |
stuck = rect.height + rect.top < window.innerHeight; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Handles the click event to detect single or double clicks. | |
* @param {MouseEvent} event - The click event object. | |
*/ | |
function doubleClickHandler(event) { | |
const target = event.target; | |
if (new Date().getTime() - (target._lastTouch || 0) > 500) { | |
// Not a double click | |
target._lastTouch = new Date().getTime(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* JavaScript function prototype debouncer 4.3 - 2010-2022 hnldesign.nl - Klaas Leussink | |
* Demo: https://code.hnldesign.nl/demo/hnl.debounce.html | |
* | |
* Based on code by Paul Irish and the original debouncing function from John Hann | |
* http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ | |
* Register deBouncer as a function prototype. | |
* | |
* All debounced variants of the function (depending on the supplied debouncing parameters (see below) | |
* are stored inside a 'dbObj' Object inside the debounced function. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* jQuery inertial Scroller v1.5 | |
* (c)2013 hnldesign.nl | |
* This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/. | |
* | |
* More information: http://www.hnldesign.nl/work/code/momentum-scrolling-using-jquery/ | |
*/ | |
/*jslint browser: true*/ | |
/*global $, jQuery*/ |
NewerOlder