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 / slack-analysis.md
Created June 2, 2022 00:17
Our team's analysis of potential roadmap items, patterns, as well as anti-patterns in our Slack usage
What kind of work is happening in Slack? What kind of similar work was replicated across other systems? What work would be better in Slack? What kind of work should stay as-is (for now)? What kind of work or patterns should we NOT support in Slack?
- Using channels. (Team channels, time-sensitive/event channels, project channels.) - Huddles.- Some user groups.- Organizing key materials in channels with bookmarks/pins.- Running ad hoc status updates/check-ins.- Formatting key posts with block kit builder.- Some lightweight custom workflows (scheduled standup) - Chatter - Quip comments- (Some) Quip chats - Project trackers (Quip and Asana)- Google Forms - Google Meet- Email threads - Github comments - Conversations with stakeholders about projects, feedback & deadlines (vs. em
@zaynelt
zaynelt / B2C-data-access-scenario.md
Last active February 25, 2021 22:52
Principle of least privilege example
Purchase journey - key steps Object/Field access Required access level Why Risk
1. Browse catalog Product Price list View all* User needs to be able to browse through all products from the product catalog and see the associated prices. A competitor may download the full product catalog and price list.
2. Add item to cart Order CRU** own User needs to create a cart, and add items to it, as they go through their purchase journey. Prices need to be applied to the cart items with discounts as required. A user may bypass business controls and directly update the values in the cart such as the number of products or the total price.
3. Apply promotion Promotion View all / Modify all Promotions need to be applied to the cart. If they are specific to a user, they then need to be invalidated. A user may look at all the promotions available and apply the most favorable to them. They may even update the records to make themselves eligible.
**4. Reg
@zaynelt
zaynelt / cacheclears.md
Created February 17, 2021 21:47
Commerce Cloud Cache Clearing
Caching time Configuration How is the cache cleared When to clear this cache
Page cache Controlled via code Can be enabled in Business Manager, always on in production Via Business Manager or implicitly when a replication occurs Any change on page or content that requires invalidation of page content cache.
Static content cache Fixed (on production) Can be enabled in Business Manager, always on in production Via Business Manager or implicitly when a replication occurs This usually happens automatically when content is refreshed. This can be invalidated when static content change is not refreshing on pages.
Custom objects Controlled via code Can be controlled via metadata Custom objects will exist until explicitly deleted or via retention settings in Business Manager Custom object cache is used for specific purpose, for example caching OAuth tokens. This should be managed via code. Users can manually clear the cache, but this is usually done o
@zaynelt
zaynelt / scriptingAPIExample.js
Created February 17, 2021 21:34
Commerce Cloud Personalized Caching via Script API
// SFRA controller cached via decorator
server.get('Show', cache.applyDefaultCache, function (req, res, next) {} );
// set cache time directly at the response (does not rely on SFRA)
response.setExpires(new Date().getTime() + durationInMinutes * 60 * 1000);
// apply personalised caching
response.setVaryBy('price_promotion');
// Cache times do not have to be constants - let's get creative!
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);
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>,
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%
@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)) {
@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
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