Skip to content

Instantly share code, notes, and snippets.

<apex:page id="pageId" controller="AccountGeoLocationDemo">
<head>
<style type="text/css">
#map-canvas {
height : 512px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?libraries=places&key=AIzaSyBMFdqVZd9idw-0pYEsWQ9xxM9mNz7f9E4">
@swapnilshrikhande
swapnilshrikhande / deferred_chain.js
Created August 5, 2016 15:21
How deferred chaining works ?
var performParent = function(){
//perform 1st async
var promise1 = performAsync('func1',5);
// We want to chain two async operations
promise1.then(function(data){
console.log('data from 1st async operation',data);
//perform second async operation
@swapnilshrikhande
swapnilshrikhande / index.css
Last active August 5, 2016 15:34
How event bubbling works ?
.parent{
min-height: 400px;
min-width : 400px;
background-color:yellow;
}
.parent .son{
min-height: 100px;
min-width : 100px;
background-color:red;
<html>
<header>
<style>
body{color:#333;padding:1.5em}
.responsive-new {border-collapse:collapse;width:100%}
.responsive-new th{background-color:#eee;font-weight:700; }
.responsive-new th,td{border-bottom: 1px solid #ddd; padding:5px; text-align:left}
.fname{width:15%}
.lname{width:15%}
class Node{
Id value;
List<Node> children;
{
children = new List<Node>();
}
}
parseTree( Map<String,List<Id>> treeMap,String parentId){
/*
http://stackoverflow.com/questions/28948383/how-to-implement-debounce-fn-into-jquery-keyup-event
*/
$('input').keyup(debounce(function(){
var $this=$(this);
//alert( $this.val() );
var n1 = $this.val();
var n2 = $('#n2').val();
var n3 = $('#n3').val();
@swapnilshrikhande
swapnilshrikhande / stickyFooter.css
Created November 15, 2016 11:26
Sticky footer styles
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
@swapnilshrikhande
swapnilshrikhande / Pdf_of_Attachment
Created December 2, 2016 09:00 — forked from SeemaKurawale111/Pdf_of_Attachment
Generate PDF attachment of opprtunity details
<apex:page standardController="Opportunity" extensions="Pdf_of_Attachment_Extension" renderAs="pdf">
<apex:pageBlock >
<apex:pageBlockSection columns="1" >
<apex:pageBlockSectionItem >Opportunity Name: {!Opportunity.Name} </apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >CloseDate : {!Opportunity.CloseDate} </apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >StageName : {!Opportunity.StageName} </apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >Probability : {!Opportunity.Probability} </apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:repeat var="attachment" value="{!attachments}">
<apex:image url="/servlet/servlet.FileDownload?file={!attachment.Id}"/><br></br>
@swapnilshrikhande
swapnilshrikhande / ClientIpAddress.java
Last active December 12, 2016 15:08
Get clients IP from the request packet.
public final class ClientIpAddress {
// CHECKSTYLE:OFF
// http://stackoverflow.com/a/11327345/131929
private static Pattern PRIVATE_ADDRESS_PATTERN = Pattern.compile(
"(^127\\.)|(^192\\.168\\.)|(^10\\.)|(^172\\.1[6-9]\\.)|(^172\\.2[0-9]\\.)|(^172\\.3[0-1]\\.)|(^::1$)|(^[fF][cCdD])",
Pattern.CANON_EQ);
// CHECKSTYLE:ON
private ClientIpAddress() {
public abstract class AccountTrigger {
public Account[] accountOldList { set; get; }
public Account[] accountNewList { set; get; }
public Map<Id, Account> accountOldListMap = new Map<Id, Account>();
public Map<Id, Account> accountNewListMap = new Map<Id, Account>();
public AccountTrigger(Account[] accountOldList, Account[] accountNewList) {
this.accountOldList = accountOldList == null ? new Account[] {} : accountOldList;
this.accountNewList = accountNewList == null ? new Account[] {} : accountNewList;