Skip to content

Instantly share code, notes, and snippets.

View tet3's full-sized avatar

Thomas Taylor tet3

  • Philadelphia, PA
  • X @tet3
View GitHub Profile
@justin-lyon
justin-lyon / LightningOut.html
Last active August 4, 2020 20:29
LC4VF with LWC Example
<apex:page>
<apex:includeLightning />
<div id="mount"></div>
<script type="text/javascript">
const myLwcProps = {
prop1: 1,
isSuperAwesomeBool: true
}
@mhamzas
mhamzas / SignatureHelper.cls
Created October 4, 2019 18:57
Capture Signature using HTML5 Canvas inside Salesforce Lightning Web Component [Salesforce Files]
public with sharing class SignatureHelper {
@AuraEnabled
public static void saveSign(String strSignElement,Id recId){
// Create Salesforce File
//Insert ContentVersion
ContentVersion cVersion = new ContentVersion();
cVersion.ContentLocation = 'S'; //S-Document is in Salesforce. E-Document is outside of Salesforce. L-Document is on a Social Netork.
cVersion.PathOnClient = 'Signature-'+System.now() +'.png';//File name with extention
@SpenceDiNicolantonio
SpenceDiNicolantonio / HttpMockRegistry.cls
Last active July 29, 2022 18:03
[More Robust Mocking in Apex] A dynamic HTTP mock registry and a configurable Stub class to simplify and enhance mocking for Apex unit tests #salesforce #apex
/**
* A registry built around the Salesforce Mocking API that allows declarative mocking of HTTP callouts. Mocks responses
* can be registered either for a specific endpoint and path or for all paths on an endpoint, with the former taking
* precedence.
*/
@IsTest
public class HttpMockRegistry {
// Default mock response for HTTP requests
public static final HttpResponse DEFAULT_MOCK_RESPONSE = createSuccessResponse('Default mock response');
@Manzanit0
Manzanit0 / deploy.ps1
Last active December 7, 2022 17:08
PowerShell Script to deploy repository to Salesforce. It uses SFDX CLI.
# https://codereview.stackexchange.com/questions/200870/powershell-script-to-deploy-repository-to-salesforce
param([string] $repositoryDirectory, [bool] $isProduction)
# TODO - git integration. Select a branch and check it out for deploy.
# TODO - break stuff into functions and reusable pieces. ¿piping? ¿cmdlets?
# TODO - Allow directory structures?
Write-Host -ForegroundColor green ":: Validating Repository ::"
$srcDirectory = [System.IO.Path]::Combine($repositoryDirectory, "src")
@xixiaofinland
xixiaofinland / sfdx-cheatsheet.sh
Last active March 28, 2024 18:54
Salesforce SFDX Cheat Sheet
# Proudly supplied by Salesforce Way Site: https://salesforceway.com
# This cheatsheet contains the most often used SFDX commands for beginners to get a jumpstart.
# Hint. it is highly recommended to use `-h` to check the usage of any SFDX commands and corresponding parameters.
# For instance, use `sfdx force:auth:web:login -h` to checke what `-d` `-a` parameters do
# List down all supported dx commands:
sfdx force:doc:commands:list
# Check current DebHub and Scratch Org status
sfdx force:org:list
@afawcett
afawcett / README.md
Last active November 25, 2018 10:10
Apex MD API and XSLT

Requirement

Perform XSLT transform on XML returned from the Salesforce Metadata API retrieve operation (also requires unzip). Based on the code in https://github.com/financialforcedev/apex-mdapi

Solution

Adapting the metadataretrieve.page in the above repository. The original page passed the client side unzipped files from the MD retrieve zip file back to the server to add to the view state for display. As the XSLT is done client side, the above page is much simpler, the unzipped files are just handled client side and added dynamically to the page DOM.

Implementaiton Notes

  • XSLT is loaded from a static resource
@RichardBronosky
RichardBronosky / Nutrichef Sous Vide Cooker Instructions.txt
Last active January 20, 2024 23:57
Simple instructions for the inexpensive sous vide with the terrible interface that everyone hates. I've owned it for over 2 years and I still have to open this every time I use it!
Plug in cooker.
Cooker powers on momentarily and is unusable.
Fill water to MAX port.
Touch POWER button for 5 seconds.
Cooker powers on and is usable.
Touch POWER and SET.
SET TEMP field flashes.
Units toggle between °C & °F.
Turn wheel.
Field value changes.
@jchandra74
jchandra74 / PowerShell Customization.md
Last active July 19, 2024 20:41
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@mannharleen
mannharleen / AccountManager.cls
Last active November 24, 2022 10:00
Salesforce trailhead - Apex-Integration-Services-Apex-Web-Services
@RestResource(urlMapping='/Accounts/*/contacts')
global with sharing class AccountManager {
@HttpGet
global static account getAccount() {
RestRequest request = RestContext.request;
String accountId = request.requestURI.substring(request.requestURI.lastIndexOf('/')-18,
@cdcarter
cdcarter / QuickData.java
Last active May 29, 2016 04:31
QuickData
public class QuickData {
/* QuickData inserts your Mockaroo Schema, no questions asked. Remote Site needed.
* USAGE: QuickData.createRecords('MOCKAROOAPIKEY','20689c00',20,List<Lead>.class);
* Creates 20 leads using the schema at https://www.mockaroo.com/20689c00 */
public static List<SObject> createRecords(String a, String s, Integer c, Type t) {
String fmtStr = 'https://www.mockaroo.com/{1}/download?count={2}&key={0}';
List<String> reqDetails = new List<String>{a,s,String.valueOf(c)};
string requestString = String.format(fmtStr,reqDetails);
HttpRequest req = new HttpRequest();
req.setEndpoint(requestString);