Skip to content

Instantly share code, notes, and snippets.

View pbattisson's full-sized avatar

Paul Battisson pbattisson

View GitHub Profile
@afawcett
afawcett / sfdoc.md
Last active November 4, 2025 09:05
Cursor Command to help Cursor Read Salesforce Docs

Background: I find Cursor struggles to retrieve content from Salesforce documentation links due to various approaches used such as as shadow dom and dynamic loading. This Cursor command leverages Cursors Browser Automation tool (needs to be explcitly enabled) to help give it a few more clues on how to deal with these pages. I initially built a shell script for it to call but then I discovered Cursor commands. So I built this command using Cursor itself once we had both figured this out - effectively it wrote its own instructions. Use at your own risk.

Usage: In Cursor type / and select Create Command enter sfdoc and press enter. Then paste the content below into the file. To use, use prompts like Read this https://developer.salesforce.com/docs... using /sfdoc. Make sure you have chromium NPM library installed globally as the Node.js scripts below require it. Also make sure you have given Cursor permission to use your browser - there is a icon bottom right of the chat window to enable this in

@doppiomacchiatto
doppiomacchiatto / README.md
Created January 13, 2020 17:29
Salesforce DX steps, tips, and tricks

Initial Set-Up

Authenticate with Dev Hub (one time)

The Dev Hub is our production org. Scratch orgs are registered against a Dev Hub and can be managed from there. Execute the following command in a terminal (you'll be prompted to enter your username and password in a browser window):

  • sfdx force:auth:web:login --setdefaultdevhubusername -a Unum_DevHub

Set Your Default Dev Hub Username

It's possible to have multiple Dev Hub orgs. If you want to change to a different Dev Hub, you must specify your defaultdevhubusername setting with this command:

@AltiusRupert
AltiusRupert / NamedCredential.cls
Last active July 5, 2024 09:24
Create Salesforce Named Credentials via Apex
// see https://salesforce.stackexchange.com/questions/165551/possible-to-update-namedcredential-from-apex
MetadataService.NamedCredential credential = new MetadataService.NamedCredential();
credential.fullName = 'Demo_Credential';
credential.label = 'Demo Credential';
credential.endpoint = 'https://www.DEMO2.com';
credential.principalType = 'NamedUser';
credential.protocol = 'NoAuthentication';
system.debug(createMetadata(credential));

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active October 22, 2025 20:58
Backend Architectures Keywords and References
@johncasimiro
johncasimiro / Mimic SQL select * statement in SOQL using Apex
Created December 9, 2010 06:57
A code snippet that mimics the popular Select * SQL syntax in force.com's Apex language.
/*
* @description: A code snippet that mimics the popular Select * SQL syntax in force.com's Apex language.
*/
// Initialize setup variables
String objectName = 'Contact'; // modify as needed
String query = 'SELECT';
Map<String, Schema.SObjectField> objectFields = Schema.getGlobalDescribe().get(objectName).getDescribe().fields.getMap();
// Grab the fields from the describe method and append them to the queryString one by one.