Skip to content

Instantly share code, notes, and snippets.

View loopdream's full-sized avatar

Dom Geargeoura loopdream

View GitHub Profile
@loopdream
loopdream / debounce.js
Created October 10, 2015 17:34
Debounce a function firing
/**
* Debounce a function firing
* @param {function} func The function to potentially fire
* @param {number} wait Debounced wait duration (millisecs)
* @param {boolean} immediate Should leading occurrence exec fn immediately
* @return {void}
*/
debounce = function(func, wait, immediate) {
var timeout;
return function() {
@loopdream
loopdream / openInNewTab.js
Last active October 29, 2018 11:15
Open link in new tab - checks for popup blocker
openInNewTab = function(url) {
var popupBlockerChecker = {
check: function(popup_window){
var _scope = this;
if (popup_window) {
if(/chrome/.test(navigator.userAgent.toLowerCase())){
setTimeout(function () {
_scope._is_popup_blocked(_scope, popup_window);
},200);
}else{