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
<script type="text/javascript"> | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']); | |
_gaq.push(['_trackPageview']); | |
(function() { | |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
})(); |
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
document.body.addEventListener('click', function(event) { | |
if ( !event.target.closest("SELECTOR").length && document.querySelector("SELECTOR").hasClass("active") ) { | |
// Your function here | |
}; | |
}); |
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 wasTouched = () => { | |
myFrameworkOfChoice.dispatchEvent('USER_HAS_TOUCHED', true); | |
window.removeEventListener('touchstart', wasTouched, false); | |
window.addEventListener('mousedown', wasClicked, false); | |
}; | |
const wasClicked = () => { | |
myFrameworkOfChoice.dispatchEvent('USER_HAS_TOUCHED', false); | |
window.removeEventListener('mousedown', wasClicked, false); | |
window.addEventListener('touchstart', wasTouched, false); |
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
table[class="mob-show"], | |
tr[class="mob-show"], | |
td[class="mob-show"], | |
span[class="mob-show"], | |
a[class="mob-show"], | |
img[class="mob-show"] { | |
display: none !important; | |
font-size: 0 !important; | |
width: 0 !important; | |
height: 0 !important; |
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
#!/bin/bash | |
git stash list | |
echo "Enter stash number to rename" | |
read stash_number | |
echo "Enter new name" | |
read new_name | |
stash_name="stash@{${stash_number}}" | |
echo "$stash_name" |
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
function isEmpty(obj) { | |
return ( | |
(typeof obj == 'undefined' || obj === null || obj === '') | |
|| (typeof obj == 'number' && isNaN(obj)) | |
|| (obj instanceof Date && isNaN(Number(obj))) | |
); | |
}; |
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 popup = function (url, title, w = 640, h = 320) { | |
let l = (screen.width / 2) - (w / 2); | |
let t = (screen.height / 2) - (h / 2); | |
return window.open(url, title, ` | |
toolbar=no, | |
location=no, | |
directories=no, | |
status=no, | |
menubar=no, |
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
['change', 'keyup', 'paste', 'input', 'propertychange', 'every_other_event_you_want'].forEach(eventType => { | |
[...document.querySelectorAll('SELECTOR')].forEach(element => { | |
element.addEventListener(eventType, (event) => { | |
console.log(event); | |
// Your callback here | |
}, false); | |
}); | |
}); |
OlderNewer