Skip to content

Instantly share code, notes, and snippets.

View mvogelgesang's full-sized avatar

Mark Vogelgesang mvogelgesang

View GitHub Profile
@mvogelgesang
mvogelgesang / apexTestOutput.json
Created May 14, 2024 23:57
Example output when running apex tests with the Salesforce CLI. `sf apex run test --json -w 10 -c`
{
"status": 0,
"result": {
"summary": {
"failRate": "0%",
"failing": 0,
"hostname": "https://java-app-8300-dev-ed.scratch.my.salesforce.com",
"orgId": "00DDE000005EMmV2AW",
"outcome": "Passed",
"passRate": "100%",
@mvogelgesang
mvogelgesang / newLaptopInstall.sh
Last active January 26, 2024 20:23
a shell script to install a local development environment
#!/bin/bash
#### INSTRUCTIONS ####
# Copy this file to a local directory
# Open terminal in directory containing this file
# change permissions of file to allow execution: chmod 700 newLaptopInstall.sh
# run: ./newLaptopInstall.sh
# You will be asked if you want to run in dry-run mode, I suggest doing this first
# and you can selectively comment out applications that you do not need.
#### END INSTRUCTIONS ####
@mvogelgesang
mvogelgesang / sheetToMarkdownTable.gs
Created August 7, 2023 18:20
A custom function for Google Sheets to turn a spreadsheet range into a Markdown Table
/**
* Produced a table in markdown format
*
* @param {Range} inputRange The range of data to markdown-ify
* @param {boolean} includesHeader does the data have a header? defaults to true.
* @return {string} Range in markdown table format.
* @customfunction
*/
function markdownTable(inputRange, includesHeader = true) {
let tableOutput = '';
@mvogelgesang
mvogelgesang / Environment_Hub_Admin.permissionset-meta.xml
Created June 8, 2023 14:04
Partner Business Org - Environment Hub Permission Set
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<applicationVisibilities>
<application>standard__EnvironmentHub</application>
<visible>true</visible>
</applicationVisibilities>
<description>Permission set following guidelines in https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/environment_hub_get_started_configure_app.htm</description>
<hasActivationRequired>false</hasActivationRequired>
<label>Environment Hub Admin</label>
<license>Salesforce</license>
@mvogelgesang
mvogelgesang / FileList2CSV.js
Created April 11, 2023 14:30
GDrive Files to CSV List
/* FileList2CSV
*
* This AppScript produces a Salesforce DataLoader-ready spreadheet that lists all files contained in a given Google Drive Folder.
* The script fetches file names and extracts ID's (via FILENAME_REGEX) to place into a spreadsheet
* Once the files are downloaded to a local machine, the resulting local file paths can be updated in VersionData and PathOnClient columns before download as CSV
* If files need to relate to a Salesforce record, Salesforce ID's should be entered into FirstPublishedLocationId
*
* Additional details on uploading files via DataLoader can be found at https://help.salesforce.com/articleView?id=000314772&type=1&mode=1
*/
var GDRIVE_FOLDER_ID = PropertiesService.getScriptProperties().getProperty('folderId');
@mvogelgesang
mvogelgesang / massFindReplace.sh
Last active April 29, 2022 18:56
Given an input file containing a newID value and oldId value, perform a mass find/replace across a series of files
#!/bin/bash
# set -x
# CSV FILE MUST HAVE EMPTY LINE AT END AND NO ""
# Given an input file containing a newID value and oldId value, perform a mass find/replace across a series of files
INPUT=inputdata.csv
EXCLUDEDIR=/Users/mv/folder\ to\ exclude
EXCLUDEFILE=fileToExclude.csv
SEARCHDIR=/Users/mv/search\ directory
OLDIFS=$IFS
@mvogelgesang
mvogelgesang / example.md
Created February 3, 2022 16:55
Find and Replace with RegEx Matching Groups

Background

Had a pre-existing JSON file which was missing an attribute for website domain. Rather than manually editing each file, sought out a solution which could be applied across all files at once.

Input

{
  "scanVersion": "0.0.1",
 "url": "1.usa.gov/blah",
const lorem = `Lorem ipsum dolor sit amet, his constituto quaerendum ut, quem impetus eu vim, has ea aperiri voluptaria. Odio sint definiebas ea per. Te eos utinam noster. Iudico essent conceptam eum ex, graecis appetere vel ea, et qui sumo movet.
Id his corpora volutpat adipiscing, in nec denique iudicabit mnesarchum, vim accusata definitionem ei. Vix eu diceret aliquam partiendo, exerci dicunt ut eos, dicant insolens adolescens ea qui. Doming inermis inimicus id sea, ne simul senserit sapientem vix. Id mel enim dicat, ius falli mnesarchum in, te graeco mollis aeterno has. Dictas probatus et duo, id illum verear malorum eum. Eum ad error adversarium reprehendunt, mei ne dicam euripidis, elitr labitur id cum.
Prima eirmod fabulas vel id. Sed eius dicit voluptatum at, vel illud facilisi perpetua ea, at vim vitae essent. At has diam incorrupte, summo laudem eam no, maiorum nostrum invenire ad vix. In vim stet prima epicurei, vis at vidit convenire salutatus.
No cum case ludus definiebas, partiendo instructio
/* Adopted from an example provided by Ezekiel Lawson at LogRocket. Goal was to better understand the flow of Currying functions and bind().
https://blog.logrocket.com/understanding-javascript-currying/
*/
// new function called curry which takes a function as an argument. In this case, the totalNum function is passed and it expects 3 arguments
const curry = (fn) => {
// returns a function called curried which takes the args and spreads them ...
return curried = (...args) => {
console.log("fn length: " + fn.length);
<aura:component>
<!-- displays nofitication text on multiple lines - https://salesforceboffin.com/display-toast-message-in-multiline-in-lightning/-->
<aura:html tag="style">
.toastMessage.forceActionsText{ white-space : pre-line !important; }
</aura:html>
</aura:component>