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 / app.js
Last active August 29, 2015 14:01
Angular Directive Demo Issue
// Create a new module
var myApp = angular.module('myApp', ['ngRoute']);
// register a new service
//myApp.value('appName', 'MyCoolApp');
// configure existing services inside initialization blocks.
myApp.config(function($locationProvider,$routeProvider) {
$routeProvider
@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);
@shmdhussain
shmdhussain / angularjs-version.js
Created January 6, 2018 10:26
Get the angularjs version
console.log(angular.version);
@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 / sna-ready.js
Created January 6, 2018 10:31
SNA-cms-get the dom ready SNAP object, execute this in console and get which SNAP.xxx is triggered when page is initializing
$("[data-sna-ready]").each(function(i,t){
console.group("data-sna-ready"+i);
console.log($(t).data('sna-ready'));
console.groupEnd("data-sna-ready"+i);
});
@shmdhussain
shmdhussain / angular-enable-debug.js
Created January 6, 2018 10:31
enable angualr debugging from browser console
angular.reloadWithDebugInfo()
@shmdhussain
shmdhussain / debugger-timeout.js
Created January 6, 2018 10:32
Debugger timeout, when debugging mouse hover, run this in console, and check the mouse over actions
setTimeout(function(){
debugger;
}, 5000);
@shmdhussain
shmdhussain / enable-body-edit.js
Created January 6, 2018 10:34
make the whole body , content editable, useful for just changing the content in page for demo
document.body.contentEditable=true
@shmdhussain
shmdhussain / ellipsis.css
Created January 6, 2018 10:35
Ellipsis CSS -quick CSS
@mixin ellipsis() {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
@mixin word-wrap() {
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
word-break: break-word;
@shmdhussain
shmdhussain / add-script-body.js
Created January 6, 2018 10:36
Add Script Tag to body
/*START: Create Script Tag and append in last line of body*/
function addScript( src ) {
var s = document.createElement( 'script' );
s.setAttribute( 'src', src );
document.body.appendChild( s );
}
/*END: Create Script Tag and append in last line of body*/