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 / 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})
@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 / This-page-does-not-use-JS.markdown
Created April 15, 2015 04:20
This page does not use JS
@alishahab
alishahab / Content-Aware-Navigation.markdown
Created April 15, 2015 09:47
Content Aware Navigation

Content Aware Navigation

This nav bar layout changes from a distributed table-cell layout to a basic inline-block layout if there are more than 6 or more list items therein.

A Pen by Heydon on CodePen.

License.

@alishahab
alishahab / Am-I-Responsive-Website?.markdown
Created April 16, 2015 03:41
Am I Responsive Website?

Am I Responsive Website?

Update(22/05/13): The data will be sent as URL vars (method="get") and everyone can share directly submitted URL

A Pen by Mario Vidov on CodePen.

License.

@alishahab
alishahab / Location-Services-with-AngularJS.markdown
Created April 17, 2015 05:03
Location Services with AngularJS
function createCookie(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
} else {
expires = "";
}
(function(w, d, t, r, u) {
var f, n, i;
w[u] = w[u] || [], f = function() {
var o = {
ti: "5089938"
};
o.q = w[u], w[u] = new UET(o), w[u].push("pageLoad")
}, n = d.createElement(t), n.src = r, n.async = 1, n.onload = n.onreadystatechange = function() {
var s = this.readyState;
s && s !== "loaded" && s !== "complete" || (f(), n.onload = n.onreadystatechange = null)
var loadScript = function(url, callback){
var script = document.createElement("script")
script.type = "text/javascript";
script.async = true;
script.defer = true;
if (script.readyState){
script.onreadystatechange = function(){
if (script.readyState == "loaded" ||