Skip to content

Instantly share code, notes, and snippets.

@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
@gbutt
gbutt / JsonReader.cls
Created August 15, 2019 18:39
JsonReader
public class JsonReader {
public Map<String, Object> jsonMap {get; set;}
public JsonReader(Map<String, Object> jsonMap) {
this.jsonMap = jsonMap;
}
public String getString(String path) {
return (String)getFieldAtPath(path);
}
@gbutt
gbutt / sfcomm-pendo.js
Created September 16, 2019 21:13
Pendo Configuration for Salesforce Lightning Communities
// add this script to Head Markup
(function() {
// skip loading pendo for community builder pages
if (location.hostname.indexOf('livepreview') > -1 || location.hostname.indexOf('sitepreview') > -1) {
return;
}
// load pendo
(function(apiKey){
(function(p,e,n,d,o){var v,w,x,y,z;o=p[d]=p[d]||{};o._q=[];
@gbutt
gbutt / rally-fix-kanban-height.user.js
Last active February 2, 2021 14:07
Fix Kanban Height
// ==UserScript==
// @name Rally Iteration Status
// @namespace https://gist.github.com/gbutt/5e741ec96eb682f5174cb5b2bb72d8cb
// @version 0.1
// @description fix kanban height
// @author gbutt
// @match https://rally1.rallydev.com/
// @grant none
// ==/UserScript==
@gbutt
gbutt / postMessageAsyncAdapter.js
Created February 6, 2020 04:09
An attempt to make postMessage async compatible, completely untested
const registeredCallbacks = {};
const ORIGIN = location.origin;
function listener(event) {
if (event.origin !== ORIGIN) {
return;
}
let data = JSON.parse(event.data);
let ticket = data.ticket;
let payload = data.payload;
@gbutt
gbutt / BatchGrantPermissionSet.cls
Created February 8, 2020 15:57
Grant Permission Set or Permission Set Group to Users in Batch Apex
/**
* Assigns a permission set or permission set group to all user with the specified profile.
* Additional filter criteria can be passed in if the users needs filtered further.
* Example: Only assign permission set to community users on the Salesforce account
* String filter = 'Contact.Account.Name = \'Salesforce\'';
* BatchGrantPermissionSet('Community User Profile', 'Salesforce_Account_Privs', filter);
*/
public class BatchGrantPermissionSet implements Database.Batchable<sObject> {
String query {get; set;}
@gbutt
gbutt / uncrustify.cfg
Created February 11, 2020 04:23
Uncrustify for Salesforce Apex
# Uncrustify-0.68_f
#
# General options
#
# The original size of tabs in the input.
input_tab_size = 8 # Default: 8
# The size of tabs in the output (only used if align_with_tabs=true).
output_tab_size = 8 # Default: 8
@gbutt
gbutt / prettier.config.js
Created February 19, 2020 15:00
prettier for salesforce
// prettier.config.js or .prettierrc.js
module.exports = {
printWidth: 100,
// tabWidth: 4, // inherits from .editorconfig
trailingComma: 'es5',
singleQuote: true,
overrides: [
{
files: '*.cmp',
options: {
var ascii_image = `
############ ########
################## ##############
###################### ##################
###########################################
#############################################
###############################################
##################################################
##################~ #############################
########################## ###############################
@gbutt
gbutt / LightningOutApp.app
Created March 17, 2020 00:05
Lightning Out with Guest User Access
<aura:application access="GLOBAL" extends="ltng:outApp" implements="ltng:allowGuestAccess">
<aura:dependency resource="c:EventsCalendar" />
</aura:application>