Skip to content

Instantly share code, notes, and snippets.

View zaynelt's full-sized avatar

Zayne Turner zaynelt

  • Salesforce
  • San Francisco, CA
View GitHub Profile
@zaynelt
zaynelt / StockItem.cls
Last active March 14, 2016 01:23
RAD Q1 2016 - Final Project Hints
//Object Oriented Class that represents our Stock_Item__c Object and provides functionality
public with sharing class StockItem {
//class variables defined here
//Example: String name;
//default constructor should take in arguments that can be used to instatiate a new StockItem object
@zaynelt
zaynelt / SystemDotDebugWeirdness.cls
Created August 27, 2016 14:49
illustrating a bug in system.debug()
public with sharing class SystemDotDebugWeirdness {
//this is copied from the WeekFiveHomework class--slightly modified to just zoom in on the issue we
//were looking at in class
public static void soqlPractice () {
//Query for accounts
List < Account > topFiveAccounts = [SELECT ID, Name, AnnualRevenue FROM Account WHERE AnnualRevenue !=0];
system.debug('This should be 5: '+topFiveAccounts.size());
@zaynelt
zaynelt / LEX_Wkshp.txt
Last active June 29, 2017 20:24
Getting Started with Lightning Components Hands On
# Hands On Workshop Quick-Start Package:
1. Copy the following:
packaging/installPackage.apexp?p0=04tf4000000gxJT
2. Replace everything in your playground's url after the **force.com/** with what you copied in Step 1. For example:
http://funny-orgname-12345-dev-ed.lightning.force.com/PASTE_STUFF_HERE
ID JIRA-0001
Description Automation on the account object is currently achieved with Workflow rules, Process Builder and simple Apex.
Detailed Issue The following workflow rules exist on the Account:
"Update company review date when account is active,"
"Set account flag to yellow if not review date is set"

The following Apex automation exists:
"UpdateContacts" (updates related contacts when review date is set)

The following processes exist:
"Auto create contract for new accounts"
Proposed Solution Create a new process and migrate all functionality from the two workflow rules, the Apex class and the multiple processes into one process called "Account Automations."

Once tested and deployed, delete the old workflow rules, Apex and process.
Effort 4 hours
Type of Technical Debt Platform Area Examples Identified Areas Link to Detailed Log
Accidental or outdated design tech debt Declarative Automation - Workflow rules that can be migrated to Process Builder
- Multiple process builders per object (validate if this is justified)
- Headless flows
High Need to merge Account processes JIRA-0001
Accidental or outdated design tech debt Programmatic Automation - Triggers/Apex classes that perform automations that can be achieved in Process Builder (e.g. update child records)
- Repetitive apex methods that can be refactored (e.g. different methods that return different fileds from an Account in a SOQL can be refactored to one method that builds the query dynamically)
Low ... ...
Deliberate tech debt Triggers - Logic in triggers ... ... ...
Deliberate tech debt Apex - Writing to a logging object on each error instead of creating a reusable framework that handles error logging. ... ... ...
Bi
@zaynelt
zaynelt / ec2comparison.md
Created December 21, 2020 19:39
EC2 Instances Performance Comparison
Instance Type Virtual CPUs Memory (GiB) Use Case Underlying Hardware Max Clock Frequency Physical Cores
m5.large 2 8 General purpose Intel Xeon® Platinum 8175M 3.1 GHz 24
m5.xlarge 4 16 General purpose Intel Xeon® Platinum 8175M 3.1 GHz 24
c5.xlarge 4 8 Compute optimized Intel Xeon Scalable Processors 3.4 or 3.6 GHz Variable
@zaynelt
zaynelt / exp-page-time-mock.js
Last active December 21, 2020 20:49
Code snippets to mock and performance test virtual desktop session connections to Salesforce
const pageEpt = await remote.execute(() => {
let ept = null;
let error = null;
try {
const t = $A.metricsService.getCurrentPageTransaction();
ept = t.config.context.ept;
} catch (e) {
error = e.message || e;
}
if (!Number.isInteger(ept)) {
Octane score Global search Access case from queue Hover over Quick Links item Enter case comments Click on edit case Save changes to case Send email Open daily backlog report
Legacy VDI Average(First Cohort) 13,939 6.35s 10.07s 2.58s 7.79s 9.39s 10.02s 19.55s 6.34s
Newer VDI Average(Second Cohort) 32,409 4.52s 6.85s 1.39s 4.63s 5.22s 6.12s 15.53s 4.21s
Newer VDI/Legacy VDI 130% -29% -32% -46% -41% -44% -39% -21% -34%
Published App Average (Third Cohort) 36,345 2.85s 4.95s 2.13s 3.62s 3.18s 4.54s 7.00s 3.24s
Published App/Legacy VDI 160% -55% -51% -17% -54% -66% -55% -64% -49%
const { multiremote } = require('webdriverio');
const nUsers = 5; // lab for 5 users
let port = 4444;
const remoteObject = {};
for (let i = 0; i < nUsers; i += 1) {
const name = `User${i + 1}`;
remoteObject[name] = {
hostname: <YOUR_EXPERIMENT_MACHINE_IP>,
const ACCESSORS = {
username: '#username',
password: '#password',
form: '#login_form'
};
const PAGE_LOAD_TIMEOUT = 10 * 1000; // 10 seconds
await remote.URL("https://test.salesforce.com");
const form = await remote.$(ACCESSORS.form);
await form.waitForExist(PAGE_LOAD_TIMEOUT);
const usernameInput = await remote.$(ACCESSORS.username);