Skip to content

Instantly share code, notes, and snippets.

View shmdhussain's full-sized avatar

Mohamed Hussain S H shmdhussain

View GitHub Profile
@shmdhussain
shmdhussain / sna-third-party-ref-url.js
Created January 6, 2018 10:42
SNA-third-party-reference-doc-urls
// Template
// =================
/*!
* jQuery Templates Plugin 1.0.0pre
* http://github.com/jquery/jquery-tmpl
* Requires jQuery 1.4.2
*
* Copyright Software Freedom Conservancy, Inc.
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
@shmdhussain
shmdhussain / getCookie.js
Created January 6, 2018 10:43
Get javascript cookies in the console
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
@shmdhussain
shmdhussain / get-angular-controller-in-page.js
Last active January 29, 2018 06:53
Get angularjs controller in page print in console
var controllers= document.querySelectorAll('[data-ng-controller]');
for(var j=0; j < document.querySelectorAll('[data-ng-controller]').length; j++){
var controllerName = controllers[j].getAttribute("data-ng-controller");
console.group("controller-"+(j+1));
console.log(controllerName);
console.groupEnd("controller");
}
@shmdhussain
shmdhussain / display-none-h-key-devtool.js
Created January 29, 2018 06:56
In Chrome clicking "h" key in elements tab of devtools panel should toggle the hide/show
var cssRule = `.__web-inspector-hide-shortcut__, .__web-inspector-hide-shortcut__ * {
display: none !important;
}`;
function injectStyleRulejQ(rule, id) {
var div = $("<div />", {
html: '&shy;<style id=' + id + '>' + rule + '</style>'
}).appendTo("body");
@shmdhussain
shmdhussain / viewport-info.js
Last active September 5, 2020 22:23
ViewPort Information
console.log("The Screen Width(these dimensions are measured in device pixels because they never change: they’re a feature of the monitor, and not of the browser.");
console.log("the browser width in css px is (no device pixel)" + window.innerWidth);
console.log("the browser width height in css ps is (no device pixel)" + window.innerHeight);
console.log("the layout viewport width in css px" + document.documentElement.clientWidth);
console.log("the layout viewport height in css px" + document.documentElement.clientHeight);
console.log("devicePixelRatio:"+window.devicePixelRatio)
console.log("the screen device width in dev px is " + screen.width);
console.log("the screen device height in dev px is " + screen.height);