Skip to content

Instantly share code, notes, and snippets.

@swapnilshrikhande
swapnilshrikhande / makePanelSticky
Last active August 29, 2015 14:04
Make a panel sticky using jquery
/*Use case
Define styles for before floating and when floating as below.
.panel-static {
position: relative;
left: 0px;
z-index: 200;
width: 260px;
height: 500px;
float: left;
@swapnilshrikhande
swapnilshrikhande / mockRequest
Created July 25, 2014 14:54
Litle Mock request to sandbox
mockRequest.xml
<litleOnlineRequest version="8.10" xmlns="http://www.litle.com/schema" merchantId="default">
<authentication>
<user>JoesStore</user>
<password>JoeyIsTheBe$t</password>
</authentication>
<authorization id="ididid" reportGroup="rtpGrp" customerId="12345">
<orderId>1</orderId>
<amount>1000</amount>
<orderSource>ecommerce</orderSource>
@swapnilshrikhande
swapnilshrikhande / addBlurBlanket
Created August 6, 2014 10:48
Add blur blanket when a popup is opened, to disallow user to make any changes in parent window.
<style>
.aui-blanket {
background: #000;
height: 100%;
left: 0px;
opacity: 0.5;
position: fixed;
top: 0;
width: 100%;
@swapnilshrikhande
swapnilshrikhande / imageReplace
Last active August 29, 2015 14:05
Fix Alt text not showing when image width too low to fit
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<style>
.alt-div{
text-align : center;
vertical-align:middle;
min-height : 200px;
min-width : 200px;
}
</style>
@swapnilshrikhande
swapnilshrikhande / sf_formula_reverse_str_wrds
Created September 11, 2014 11:43
SF formula reverse string words
RIGHT(TRIM(BLANKVALUE(Nickname__c, '')),( LEN(TRIM(BLANKVALUE(Nickname__c, ''))) - FIND(' ',TRIM(BLANKVALUE(Nickname__c, ''))) )- 1)
+' '
LEFT(TRIM(BLANKVALUE(Nickname__c, '')), FIND(' ',TRIM(BLANKVALUE(Nickname__c, ''))))
@swapnilshrikhande
swapnilshrikhande / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@swapnilshrikhande
swapnilshrikhande / bootstrap_
Created September 25, 2014 16:41
boostrap Dialog with url as input dat
jQuery.ajax({type:'POST',url:$(this).attr('href'),success:function(data) {
bootbox.dialog({
message: data,
title: "Custom title",
buttons: {
success: {
label: "Success!",
className: "btn-success",
},
@swapnilshrikhande
swapnilshrikhande / json2-min.js
Created October 13, 2014 09:36
json2-min.js
if(typeof JSON!=="object"){JSON={}}(function(){"use strict";function f(e){return e<10?"0"+e:e}function quote(e){escapable.lastIndex=0;return escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return typeof t==="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,s,o=gap,u,a=t[e];if(a&&typeof a==="object"&&typeof a.toJSON==="function"){a=a.toJSON(e)}if(typeof rep==="function"){a=rep.call(t,e,a)}switch(typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a){return"null"}gap+=indent;u=[];if(Object.prototype.toString.apply(a)==="[object Array]"){s=a.length;for(n=0;n<s;n+=1){u[n]=str(n,a)||"null"}i=u.length===0?"[]":gap?"[\n"+gap+u.join(",\n"+gap)+"\n"+o+"]":"["+u.join(",")+"]";gap=o;return i}if(rep&&typeof rep==="object"){s=rep.length;for(n=0;n<s;n+=1){if(typeof rep[n]==="string"){r=rep[n];i=str(r,a);if(i){u.push(quote(r)+(gap?": ":":")+i)}}}}else{f
@swapnilshrikhande
swapnilshrikhande / utils.sort.mergesort.js
Created October 18, 2014 15:41
javascript merge sort utility
//Developed by Swapnil Shrikhande
//USAGE
//utils.sort.mergesort([8, 5, 3, 53, 6, 2, 4, 9, 445, 689, 2774, 328, 193, 482],[comparator_function]);
var utils = utils || {};
utils.sort = utils.sort || {};
utils.sort.mergesort = function(list, comparator) {
if (list.length == 1) {
return list;
}
@swapnilshrikhande
swapnilshrikhande / utils.sort.mergesort.js
Created October 18, 2014 15:43
javascript merge sort utility
//Developed by Swapnil Shrikhande
//USAGE
//utils.sort.mergesort([8, 5, 3, 53, 6, 2, 4, 9, 445, 689, 2774, 328, 193, 482],[comparator_function]);
var utils = utils || {};
utils.sort = utils.sort || {};
utils.sort.mergesort = function(list, comparator) {
if (list.length == 1) {
return list;
}