Skip to content

Instantly share code, notes, and snippets.

@swapnilshrikhande
swapnilshrikhande / apex_basix_authentication.cls
Last active April 28, 2016 15:26
AuthCallout basic authentication salesforce
public class AuthCallout {
public void basicAuthCallout(){
HttpRequest req = new HttpRequest();
req.setEndpoint('http://www.yahoo.com');
req.setMethod('GET');
// Specify the required user name and password to access the endpoint
// As well as the header and header information
@swapnilshrikhande
swapnilshrikhande / validateInputOnKeydown.js
Last active April 27, 2016 15:18
Validate input on key down
<input class="input-field" />
$(".input-field").on("keyup blur",function(event){
var valStr = $(this).val();
if($.trim(valStr) == '.' || $.trim(valStr) == '-'){
return true;
}
if(isNumeric(valStr)){
@swapnilshrikhande
swapnilshrikhande / function.php
Created April 26, 2016 10:08 — forked from YugalXD/function.php
Send mail with mailgun api by PHP CURL.
<?php
define('MAILGUN_URL', 'https://api.mailgun.net/v3/DOMAIN_NAME');
define('MAILGUN_KEY', 'KEY');
function sendmailbymailgun($to,$toname,$mailfromnane,$mailfrom,$subject,$html,$text,$tag,$replyto){
$array_data = array(
'from'=> $mailfromname .'<'.$mailfrom.'>',
'to'=>$toname.'<'.$to.'>',
'subject'=>$subject,
'html'=>$html,
@swapnilshrikhande
swapnilshrikhande / DeferredTest.class
Created April 26, 2016 09:58
Deferred to wait for two remote actions
public class DeferredTest {
@RemoteAction
public static String remoteActionOne(){
return 'one';
}
@RemoteAction
public static String remoteActionTwo(){
return 'two';
}
var delay = (function(){
var timer = 0;
return function(callback,param, ms){
clearTimeout (timer);
timer = setTimeout(function(){
callback(param);
}, ms);
};
})();
@swapnilshrikhande
swapnilshrikhande / tableSorter.js
Last active August 2, 2016 13:44 — forked from mangeshpawar/tableSorter.js
Table Sorting Utility Supporting Standard Salesforce Form Elements
var ts = ts || {};
var sortStatus = {};
ts.getValue = function(tdElem){
var inputElemLst = $(tdElem).find("input:not([type='hidden']):first");
return inputElemLst.length ? inputElemLst.val() : $(tdElem).text();
};
ts.handleSortClick = function(event){
@swapnilshrikhande
swapnilshrikhande / build.xml
Created April 21, 2016 13:50
Deploy salesforce components from one org to another.
<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="." xmlns:sf="antlib:com.salesforce">
<property file="build.properties"/>
<property environment="env"/>
<taskdef resource="com/salesforce/antlib.xml" uri="antlib:com.salesforce">
<classpath>
<pathelement location="../ant-salesforce.jar" />
</classpath>
</taskdef>
@swapnilshrikhande
swapnilshrikhande / GroupSortableTable_FixedHeader_ScrollSpy_Bootstrap.html
Created April 20, 2016 09:42
GroupSortableTable FixedHeader ScrollSpy Bootstrap Snippet
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://rawgit.com/wenzhixin/bootstrap-table/master/src/bootstrap-table.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
@swapnilshrikhande
swapnilshrikhande / sortingRowsWithInput.js
Created April 7, 2016 12:10
Sort a table based on column containing inputs and input values.
var people, asc1 = 1,
asc2 = 1,
asc3 = 1;
function sort_table(col, asc) {
actualData = document.getElementById("actualData");
var rows = actualData.rows,
rlen = rows.length,
arr = new Array(),
arrshow= new Array(),
@swapnilshrikhande
swapnilshrikhande / getLabelValueInApex.cls
Created April 1, 2016 10:34
Apex : Get Label Value By API Name
//This method return the String value for the Label Name
public String getLabelString(String labelName ){
Component.Apex.OutputText output = new Component.Apex.OutputText();
output.expressions.value = '{!$Label.' + labelName + '}';
return String.valueOf(output.value);
}