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 pubSub = (() => { | |
const topicSubscriberMap = new Map(); | |
const throwError = (topic) => { | |
throw new Error(` | |
No ${topic} named topic found in the registry. | |
Available topics:- ${JSON.stringify(getAllTopic())} | |
`); | |
}; | |
const getAllTopic = () => Array.from(topicSubscriberMap.keys()); |
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
/** | |
* Credits | |
* @Bkucera: https://github.com/cypress-io/cypress/issues/2839#issuecomment-447012818 | |
* @Phrogz: https://stackoverflow.com/a/10730777/1556245 | |
* | |
* Usage | |
* ``` | |
* // Types "foo" and then selects "fo" | |
* cy.get('input') | |
* .type('foo') |
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
/*--------------Library code----------------*/ | |
/** | |
* BezierEasing - use bezier curve for transition easing function | |
* by Gaëtan Renaudeau 2014 – MIT License | |
* | |
* Credits: is based on Firefox's nsSMILKeySpline.cpp | |
* Usage: | |
* var spline = BezierEasing(0.25, 0.1, 0.25, 1.0) | |
* spline(x) => returns the easing value | x must be in [0, 1] range | |
* |
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
// Gist adapted from: https://gist.github.com/cms/369133 | |
export getStyle(el: Element, styleProp: string): string { | |
let value; | |
const defaultView = el.ownerDocument.defaultView; | |
// W3C standard way: | |
if (defaultView && defaultView.getComputedStyle) { | |
// sanitize property name to css notation (hypen separated words eg. font-Size) | |
styleProp = styleProp.replace(/([A-Z])/g, '-$1').toLowerCase(); | |
return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); | |
} else if (el['currentStyle']) { // IE |
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
{ | |
"alignleft": { | |
"selector": "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img", | |
"classes": "left" | |
}, | |
"aligncenter": { | |
"selector": "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img", | |
"classes": "center" | |
}, | |
"alignright": { |
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
// Run from the dev tools console of any Youtube video | |
// Accurate as of July 2, 2020. | |
// | |
// Copy and paste this into the dev console in a browser with the desired video loaded. | |
// | |
// NOTE: Some Youtube videos do not directly expose the video url in the response. | |
// This script doesn't currently attempt to handle those. It will work for most other general video types though. | |
(async () => { | |
const html = await fetch(window.location.href).then((resp) => resp.text()).then((text) => text); |
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
<?php | |
/** | |
* @package Joomla.Site | |
* @subpackage Layout | |
* | |
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. | |
* @license GNU General Public License version 2 or later; see LICENSE.txt | |
*/ | |
defined('_JEXEC') or die; |
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
var touchstartX = 0; | |
var touchstartY = 0; | |
var touchendX = 0; | |
var touchendY = 0; | |
var gesuredZone = document.getElementById('gesuredZone'); | |
gesuredZone.addEventListener('touchstart', function(event) { | |
touchstartX = event.screenX; | |
touchstartY = event.screenY; |
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
/(#([0-9a-f]{3}){1,2}|(rgba|hsla)\(\d{1,3}%?(,\s?\d{1,3}%?){2},\s?(1|0?\.\d+)\)|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?\)){2})/i |
NewerOlder