Skip to content

Instantly share code, notes, and snippets.

Avatar

SnugSFBay snugsfbay

View GitHub Profile
View MD5 in Apex
String key = 'hgdhdhhdjfh12ehsn';
String secret = 'DNf32sdsj747dhkjd8893jjjdjds7jjk';
//Generating current Unix timestamp (in seconds)
String getTime = string.valueOf(Datetime.Now().getTime()/1000);
String requestInput = key + secret + getTime;
Blob requestBlob = Blob.valueOf(requestInput);
Blob hash = Crypto.generateDigest('MD5', requestBlob);
//Need to convert into hex to generate the equivalent of md5(string) method of PHP.
View MD5 in Apex
String key = 'hgdhdhhdjfh12ehsn';
String secret = 'DNf32sdsj747dhkjd8893jjjdjds7jjk';
//Generating current Unix timestamp (in seconds)
String getTime = string.valueOf(Datetime.Now().getTime()/1000);
String requestInput = key + secret + getTime;
Blob requestBlob = Blob.valueOf(requestInput);
Blob hash = Crypto.generateDigest('MD5', requestBlob);
//Need to convert into hex to generate the equivalent of md5(string) method of PHP.
View MD5 in Apex
String key = 'hgdhdhhdjfh12ehsn';
String secret = 'DNf32sdsj747dhkjd8893jjjdjds7jjk';
//Generating current Unix timestamp (in seconds)
String getTime = string.valueOf(Datetime.Now().getTime()/1000);
String requestInput = key + secret + getTime;
Blob requestBlob = Blob.valueOf(requestInput);
Blob hash = Crypto.generateDigest('MD5', requestBlob);
//Need to convert into hex to generate the equivalent of md5(string) method of PHP.
View OrgLimits (Visualforce page)
<apex:page docType="html-5.0" sidebar="false">
<apex:stylesheet value="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"/>
<script>
jQuery(document).ready(function($) {
$.ajax('/services/data/v38.0/limits',
{
beforeSend: function(xhr) {
// Set the OAuth header from the session ID
@snugsfbay
snugsfbay / AddPicklistItemAction.cls
Created Sep 16, 2018 — forked from afawcett/AddPicklistItemAction.cls
Prototype Invocable Method wrapping the Salesforce Metadata API to allow management of Picklist Items via Process Builder and Visual Flow
View AddPicklistItemAction.cls
/**
* Copyright (c) 2015, FinancialForce.com, inc
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
@snugsfbay
snugsfbay / DeveloperConsoleOpenLogById.js
Created Aug 30, 2018 — forked from FishOfPrey/DeveloperConsoleOpenLogById.js
Have the Salesforce Developer Console open a debug log by ID
View DeveloperConsoleOpenLogById.js
var logId = "07Lc000001OiO8GEAV";
apex.ide.Viewer.open({
id: "l-" + logId,
logId: logId,
Name: "Log " + logId,
xtype: "logviewer",
rawLogSize: 1
});
@snugsfbay
snugsfbay / getDependentPickListsValues.js
Created Aug 28, 2018 — forked from bmodeprogrammer/getDependentPickListsValues.js
Get dependent picklist values javascript remoting
View getDependentPickListsValues.js
/**
* getDependentPicklistOptions
* by Benj Kamm, 2012
* (inspired by http://iwritecrappycode.wordpress.com/2012/02/23/dependent-picklists-in-salesforce-without-metadata-api-or-visualforce/)
* CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/us/)
*
* Build an Object in which keys are valid options for the controlling field
* and values are lists of valid options for the dependent field.
*
* Method: dependent PickListEntry.validFor provides a base64 encoded
@snugsfbay
snugsfbay / Account.csv
Last active Feb 3, 2018
Sample Account Data for use with Test.loadData()
View Account.csv
Id Name Website Phone BillingStreet BillingCity BillingState BillingPostalCode BillingCountry
1 sForceTest1 http://www.sforcetest1.com (415) 901-7000 The Landmark @ One Market San Francisco CA 94105 US
2 sForceTest2 http://www.sforcetest2.com (415) 901-7000 The Landmark @ One Market Suite 300 San Francisco CA 94105 US
3 sForceTest3 http://www.sforcetest3.com (415) 901-7000 1 Market St San Francisco CA 94105 US