Skip to content

Instantly share code, notes, and snippets.

View alishahab's full-sized avatar

Ali Shahab alishahab

  • Lahore, Pakistan
View GitHub Profile
@alishahab
alishahab / JavaScript-Async-Loader
Last active August 29, 2015 14:18
JavaScript Async JS Loader
var getScript = (function(firstScript) {
return function(src) {
var script = document.createElement('script');
script.src = src;
firstScript.parentNode.insertBefore(script, firstScript);
}
}(document.getElementsByTagName('script')[0]));
window.onload = function() {
getScript('//www.google-analytics.com/analytics.js');
getScript('//platform.twitter.com/widgets.js');
@alishahab
alishahab / jQuery-Aync-Loader
Last active June 1, 2016 22:57
jQuery Async JS Loader
$(window).one('load', function() {
$.getScript('//www.google-analytics.com/analytics.js');
$.getScript('//platform.twitter.com/widgets.js');
$.getScript('//connect.facebook.net/en_US/all.js');
});
@alishahab
alishahab / non-responsive-element-finder
Last active August 29, 2015 14:18
Responsive Web Development: Return non-responsive elements
jQuery('*').filter(function(){if(jQuery(this).width()>jQuery(window).width())return true})