Skip to content

Instantly share code, notes, and snippets.

@gdoenlen
gdoenlen / AccountSelector.cls
Last active December 12, 2024 15:51
Simple dependency injection within SFDC
/**
* Selector for the `Account` entity
*/
public class AccountSelector {
public static final AccountSelector INSTANCE = new AccountSelector();
/**
* Finds all accounts that are child accounts of
* the given opportunity's account.
@gminero
gminero / samplePopover.html
Created April 10, 2019 01:00
Sample slds table with popover of related record
<template>
<div>
<template if:true={ranger} >
<lightning-record-view-form
record-id={ranger}
object-api-name="Contact">
<div class="potato slds-box" style={boxClass}>
<lightning-output-field field-name="Name">
</lightning-output-field>
<lightning-output-field field-name="Email">
@gbutt
gbutt / retrieve-object-perms.sh
Created May 19, 2019 18:40
SFDX script to retrieve profiles and perm sets with object CRUD and FLS
#!/bin/bash
TARGET_ORG=$1
if ["$TARGET_ORG" == ""]; then
echo Please specify a target username
echo For a list of available usernames use: sfdx force:org:list
exit 1
fi
@savithruml
savithruml / visa_slots.py
Last active July 31, 2024 07:20
Listens for events on the H1b-visa-slots telegram channel & notifies (audio and/or msg forwarding) when there's a valid screenshot of available slots
#!/usr/bin/env python3
# Author: SAVITHRU LOKANATH
# Login to Telegram on web browser https://web.telegram.org
# Create an API key here: https://core.telegram.org/api
# Install tesseract-ocr: apt-get install tesseract-ocr && pip install pytesseract
# Install Telethon lib: pip install telethon
# Install Text-to-Speech lib if using Windows: pip install pyttsx3
# To run, increase speaker volume to 100% & in your cmd prompt: python3 listener_visa_slots.py
@brianmfear
brianmfear / GetExtraLimitsForYourUnitTest.apxc
Last active January 11, 2024 05:09
Need more CPU or heap for creating your test data? Make it Queueable.
// Asking for extra CPU time and heap for those really "heavy" orgs
@isTest class GetExtraLimitsForYourUnitTest implements Queueable {
@testSetup static void testSetup() {
Test.startTest(); // TIP: this avoids governor limits for your @isTest methods
System.enqueueJob(new GetExtraLimitsForYourUnitTest()); // We'll get async limits!
// P.S. Did you know that the end of a unit test method triggers async code,
// just as if you called Test.stopTest()?
}
public void execute(QueueableContext context) {
// I now have 60000ms to do my setup, instead of just 10000ms.