This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static list<wrapper> randomize(list<wrapper> lst){ | |
integer currentIndex = lst.size(); | |
wrapper temporaryValue; | |
integer randomIndex; | |
// While there remain elements to shuffle... | |
while (0 != currentIndex) { | |
// Pick a remaining element... | |
randomIndex = integer.valueOf(Math.floor(Math.random() * currentIndex)); | |
currentIndex -= 1; | |
// And swap it with the current element. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATE(YEAR(DATEVALUE(Custom_date_field__c)),MONTH(DATEVALUE(Custom_date_field__c)),DAY(DATEVALUE(Custom_date_field__c))) - VALUE(TEXT(DATE(YEAR(DATEVALUE(Custom_date_field__c)),MONTH(DATEVALUE(Custom_date_field__c)),1) - DATE(IF(MONTH(DATEVALUE(Custom_date_field__c))+ 3 <= 12 ,YEAR(DATEVALUE(Custom_date_field__c)) , YEAR(DATEVALUE(Custom_date_field__c))+ 1), IF(MONTH(DATEVALUE(Custom_date_field__c))+ 3 <= 12 , MONTH(DATEVALUE(Custom_date_field__c))+ 3,MONTH(DATEVALUE(Custom_date_field__c))+ 3 - 12),1))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string unixDatetime = '1387033750000'; | |
system.debug(datetime.newinstance(long.valueOf(unixDateTime))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestResource(urlMapping='/Accounts/*') | |
global class AccountsService { | |
@HttpGet | |
global static void getAccounts() { | |
RestRequest req = RestContext.request; | |
RestResponse res = RestContext.response; | |
String callback = req.params.get('callback'); | |
String result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Script> | |
$j(document).ready(function() { | |
//call out to salesforce | |
$j.ajax({ | |
type: 'GET', | |
url: 'https://XXXX.secure.force.com/services/apexrest/accounts?callback=processData', | |
async: false, | |
jsonpCallback: 'jsonCallback', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Boolean checkValidUsername(String emailAddress){ | |
String emailRegex = '([a-zA-Z0-9_\\-\\.]+)@((\\[a-z]{1,3}\\.[a-z]{1,3}\\.[a-z]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})'; | |
Pattern MyPattern = Pattern.compile(emailRegex); | |
Matcher MyMatcher = MyPattern.matcher(emailAddress); | |
if(MyMatcher.matches()){ | |
return true; | |
}else{ | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
//Prior 32.0v | |
String comment = 'Click to vote/demote this idea'; | |
// Create feed item input | |
ConnectApi.FeedItemInput feedItemInput = new ConnectApi.FeedItemInput(); | |
feedItemInput.body = new ConnectApi.MessageBodyInput(); | |
// Create text segment to hold the message body | |
List<ConnectApi.MessageSegmentInput> segments = new List<ConnectApi.MessageSegmentInput>(); | |
ConnectApi.TextSegmentInput textSegment = new ConnectApi.TextSegmentInput(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************************************* | |
@description : method to make https callouts | |
@param : url, method, body , headers | |
@return : HttpResponse | |
**********************************************************************************/ | |
public static HttpResponse makeCallout(String url, String method, String body, Map<String,String> headers){ | |
HttpRequest req = new HttpRequest(); | |
HTTPResponse res = new HTTPResponse(); | |
Http http = new Http(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page > | |
<!-- USE YOUR OWN BUTTON & DEPLOYMENT CODE HERE --> | |
<!-- button code --> | |
<img id="liveagent_button_online_573280000008OUC" style="display: none; border: 0px none; cursor: pointer" onclick="liveagent.startChatWithWindow('573280000008OUC', 'chat-window')" src="https://lakshay37demo-developer-edition.ap2.force.com/resource/1430373426000/Online_Chat_Button" /><img id="liveagent_button_offline_573280000008OUC" style="display: none; border: 0px none; " src="https://lakshay37demo-developer-edition.ap2.force.com/resource/1430373447000/Offline_Chat_Button" /> | |
<script type="text/javascript"> | |
if (!window._laq) { window._laq = []; } | |
window._laq.push(function(){liveagent.showWhenOnline('573280000008OUC', document.getElementById('liveagent_button_online_573280000008OUC')); | |
liveagent.showWhenOffline('573280000008OUC', document.getElementById('liveagent_button_offline_573280000008OUC')); | |
}); |
OlderNewer