Skip to content

Instantly share code, notes, and snippets.

View eltoroit's full-sized avatar

Andres Perez eltoroit

View GitHub Profile

Keybase proof

I hereby claim:

  • I am eltoroit on github.
  • I am eltoroit (https://keybase.io/eltoroit) on keybase.
  • I have a public key whose fingerprint is 2D86 08E5 629B 121F A4CE FD8D AD29 4D18 ADE3 DC81

To claim this, I am signing this object:

@eltoroit
eltoroit / 20190613-SaveAndPushWhenBuild
Created June 13, 2019 18:33
This file, placed in /.vscode/tasks.json, will save and push whenever the project is build (CTRL+SHIFT+B)
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [{
"label": "ELTOROIT PushWhenBuild",
"type": "shell",
"command": "sfdx force:source:push --json",
"group": {
"kind": "build",
@eltoroit
eltoroit / 20190613-VFContainer.page
Created June 13, 2019 16:50
Sample Visualforce Lightning Out for Aura and Web
<apex:page >
<apex:includeLightning />
<div id="auraLightning"></div>
<hr />
<hr />
<hr />
<div id="lwcLightning"></div>
<script>
@eltoroit
eltoroit / 20190610-SerializePromises
Last active June 10, 2019 20:13
Let's suppose you want to execute a series of steps which need to be one after the other one but they are asynchronous, not in parallel. 
function processStep(step) {
return new Promise((resolve, reject) => {
// Process step here
resolve();
});
}
function processStepList(steps) {
return new Promise((resolve, reject) => {
if (steps.length > 0) {
@eltoroit
eltoroit / 20190610-Apex-TestExceptions
Last active June 10, 2019 20:13
How to write Apex tests to ensure the expected exception is thrown?
try {
// Perform DML here
System.assert(false, 'DmlException expected');
} catch (DmlException dmlEx) {
String msgActual = dmlEx.getMessage();
String msgExpected = 'FIELD_CUSTOM_VALIDATION_EXCEPTION, Must enter valid amount';
System.assert(msgActual.indexOf(msgExpected) >= 0, 'Message does contain expected text');
} catch (Exception ex) {
System.assert(false, 'Different exception was expected');
}
@eltoroit
eltoroit / ETLC_NAME1
Created July 12, 2016 04:48
ETLC_DESC01
var apexBridge = component.find("ApexBridge");
apexBridge.callApex({
component: component,
data: {
operation: "FindAccounts"
},
callBackMethod: function (data) {
console.log("Data Returned", data);
}
});