Skip to content

Instantly share code, notes, and snippets.

View abhinavguptas's full-sized avatar

Abhinav Gupta abhinavguptas

View GitHub Profile
@abhinavguptas
abhinavguptas / TestCollator.cls
Created October 5, 2023 11:59
#salesforce #Winter24 release came with Collator class, that is meant to provide locale sensitive sorting. This video gives a hands-on demo of the class, along with areas where its meant to be used, and where not to use it.
@istest
public class TestCollator {
/*
In German, characters like "ä", "ö", and "ü"
have specific sorting rules.
*/
static final String[] germanWords = new String[] {'Apfel', 'Unter', 'Auto', 'Öl', 'äpfel'};
/*
In French, characters like "é", "è", "ê", and "ë"
@abhinavguptas
abhinavguptas / Blogs-To-Follow-OPML.xml
Last active March 21, 2024 08:56
Best Salesforce Developer Blogs to Follow
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Salesforce Blogs to follow</title>
</head>
<body>
<outline text="salesforce" title="salesforce">
<outline type="rss" text="Sundog" title="Sundog" xmlUrl="http://feeds2.feedburner.com/Sunblog" htmlUrl="http://www.sundoginteractive.com/sunblog/"/>
<outline type="rss" text="Secure Salesforce" title="Secure Salesforce" xmlUrl="http://simplyforce.blogspot.com/feeds/posts/default" htmlUrl="http://simplyforce.blogspot.com/"/>
<outline type="rss" text="Andrew Boettcher - Salesforce Technologist" title="Andrew Boettcher - Salesforce Technologist" xmlUrl="http://techman97.wordpress.com/feed/" htmlUrl="http://techman97.wordpress.com"/>
@abhinavguptas
abhinavguptas / Base64SHA1Hash.java
Created July 14, 2012 13:34
Apex(Salesforce): Generating base-64 SHA1 Hash for Rackspace API Signature Headers
//Example String to be passed for SHA1 hash generation
String targetString = 'eGbq9/2hcZsRlr1JV1PiRackspace Management Interface20010308143725QHOvchm/40czXhJ1OxfxK7jDHr3t';
// Convert to BLOB
Blob targetBlob = Blob.valueOf(targetString);
// Generate SHA1 digest
Blob hashSHA1 = Crypto.generateDigest('SHA1', targetBlob);
// For Rackspace Compatiblity encode the binary into BASE 64
// this will result in 28 chars long string
String hashBase64SHA1 = EncodingUtil.base64encode (hashSHA1);
// should print : "46VIwd66mOFGG8IkbgnLlXnfnkU="
@abhinavguptas
abhinavguptas / streamingNotifications.html
Created February 12, 2012 13:34
Force.com Streaming API Chrome Desktop Notifications
<apex:page sidebar="false" tabStyle="Account">
<apex:includeScript value="{!URLFOR($Resource.comet, 'cometd.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.comet, 'jquery-1.5.1.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.comet, 'jquery.cometd.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.comet, 'json2.js')}"/>
<style type="text/css">
#chatterNotificationPanel {
display: none;
}
@abhinavguptas
abhinavguptas / twinBoxMultiSelectList.page.html
Created January 16, 2012 12:53
Using Twin Box MultiSelect Jquery Plugin in Visualforce
<apex:page controller="twinBoxMultiSelectList_Ctlr" showHeader="false" sidebar="false">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" />
<apex:includeScript value="{!URLFOR($Resource.twinBoxMultiSelectList, 'plugin.js')}"/>
<apex:stylesheet value="{!URLFOR($Resource.twinBoxMultiSelectList, 'plugin.css')}"/>
<style>
.boldLabel {
font-weight : bold;
font-size : 110%;
@abhinavguptas
abhinavguptas / ulPickList.css
Created January 3, 2012 06:49
jQuery plugin to draw a multi select picklist
ul.container-list {
border-color: #EEE;
border-style: solid;
border-width: 1px;
overflow-x: auto;
overflow-y: scroll;
display: block;
list-style : none;
color : #444;
padding : 0px;
@abhinavguptas
abhinavguptas / TaskAfterInsertHandler.java
Created January 2, 2012 09:40
Yet Another Apex Trigger Template
/**
After insert handler on task Sobject
*/
public class TaskAfterInsertHandler implements Triggers.Handler {
public void handle() {
System.debug(LoggingLevel.INFO, 'Post insert handling ' + Trigger.new );
}
}
@abhinavguptas
abhinavguptas / Visualforce Templates.xml
Created October 11, 2011 18:44
Force.com IDE Code templates for Visualforce
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="html_attribute_value" deleted="false" description="" enabled="true" name="$ObjectType.Account.Fields.Name.Label">$$ObjectType.Account.Fields.Name.Label
</template><template autoinsert="true" context="html_attribute_value" deleted="false" description="" enabled="true" name="$ObjectType.Contact.accessible">$$ObjectType.Contact.accessible</template><template autoinsert="true" context="html_attribute_value" deleted="false" description="" enabled="true" name="$ObjectType.SobjectName.Label">$$ObjectType.Account.label</template><template autoinsert="true" context="html_tag" deleted="false" description="" enabled="true" name="apex:form">&lt;apex:form id="formid"&gt;
${line_selection}
&lt;/apex:form&gt;</template><template autoinsert="true" context="html_tag" deleted="false" description="" enabled="true" name="apex:pageBlock">&lt;apex:pageBlock title="My Content" mode="edit"&gt;
&lt;apex:pageBlockButtons&g
@abhinavguptas
abhinavguptas / AWS.java
Created September 24, 2011 03:05
Fixture for Apex HTTP Callout Testing [Note: file name kept .java instead of .cls for syntax highlighting :)]
/*
Copyright (c) 2011 tgerm.com
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.