Skip to content

Instantly share code, notes, and snippets.

View ShivrajRath's full-sized avatar

Shivraj Rath ShivrajRath

View GitHub Profile
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@ShivrajRath
ShivrajRath / facebookClean.js
Last active December 18, 2015 21:19
Facebook Clean Bookmarklet
/*
A bookmarklet to give a cleaner facebook UX
Removes the side ads and ads present inside userstories
Update 1: Toggling the chat section, instead of hiding
*/
javascript: (function() {
document.getElementById('rightCol').style.display = 'none';
document.getElementById('leftCol').style.display = 'none';
document.getElementById('pageFooter').style.display = 'none';
document.getElementById('globalContainer').style.width = '80%';
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
!function (window) {"use strict";
// by WebReflection - WTFPL License
var
prefixes = "r webkitR mozR msR oR".split(" "),
process = "process",
nextTick = "nextTick",
i = 0,
p = window[process] || (window[process] = {})
;
while (!p[nextTick] && i < prefixes.length)
@ShivrajRath
ShivrajRath / localstorage-helper-functions
Last active August 29, 2015 13:55
Local-storage library functions
/**
This module contains all library function for localstorage usage
**/
var appLocalStorage = {
/**
* Checks if localstorage is supported on the current browser
*/
hasStorage: function () {
try {
@ShivrajRath
ShivrajRath / Ajax Caller
Last active August 29, 2015 13:55
Ajax Caller
var appCaller = {
/**
* Handler for all async application calls
* @param {[Object]} ajaxSetupJSON [This is passed to $.ajaxSetup()],
* URL and data are expected to be sent
* @param {[function]} successCallback [function to be called on success response]
* @param {[function]} errorCallback [function to be called on error response]
* @param {[function]} completeCallBack [function to be called on response completion, it's OPTIONAL]
* @return {[function]} [based on error]
*/
@ShivrajRath
ShivrajRath / Basic HTM5 Boilerplate
Last active December 2, 2020 10:05
Basic HTML5 Boilerplate
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="favicon.png">
@ShivrajRath
ShivrajRath / handlebarutilities.js
Created April 21, 2014 23:00
Handlebar Utilities
/**
* Returns a template object from an external template file
* @param {[string]} templateURL [URL from the workspace from where the template file has to be read]
* @return {[string]} [Returns the template file content]
*/
function readTemplate(templateURL) {
if ( !! templateURL) {
var templateFile;
var templateAjax;
@ShivrajRath
ShivrajRath / gist:adcadbc091097c85d7c1
Last active August 29, 2015 14:02
HTTP Status Codes
var httpStatusCode = {
"100": "Continue",
"101": "SwitchingProtocols",
"102": "Processing",
"200": "OK",
"201": "Created",
"202": "Accepted",
"203": "Non-AuthoritativeInformation",
"204": "NoContent",
"205": "ResetContent",
/**
* Workaround to make defining and retrieving angular modules easier and more intuitive.
*/
(function(angular) {
var origMethod = angular.module;
var alreadyRegistered = {};
/**