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 / 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 / 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 / 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 / select-dropdown-option-print.js
Created January 6, 2018 10:40
Get the Options HTMl of dropdown which is selected in debugger
var aa=[];
$($0).find("option").each(function(i,el){
var htmlCont = $(this).html();
aa.push(htmlCont)
console.log($(this).html());
})
@shmdhussain
shmdhussain / jquery-version.js
Created January 6, 2018 10:38
Get jQuery Version
jQuery.fn.jquery
@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*/
@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 / 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 / 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 / angular-enable-debug.js
Created January 6, 2018 10:31
enable angualr debugging from browser console
angular.reloadWithDebugInfo()