Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
CHANGESET_NAME=$1
if [[ "$CHANGESET_NAME" == "" ]]; then
echo No change set specified
exit 1
fi
DEST_ORG=$2
if [[ "$DEST_ORG" == "" ]]; then
DEST_ORG=`sfdx force:org:display | grep Alias | awk '{print $2}'`
@gbutt
gbutt / RangeIterator.cls
Created May 11, 2020 22:10
Range Iterator for Salesforce. It is probably most useful in a batch class.
public class RangeIterator implements Iterable<Integer> {
Integer start;
Integer stop;
public RangeIterator(Integer start, Integer stop) {
this.start = start;
this.stop = stop;
}
public Iterator<Integer> iterator() {
return new RangeIterable(start, stop);
@IsTest(IsParallel =false) // ContentWorkspace
public class InsertContentDocumentLinkTest {
@IsTest
static void do_a_thing() {
CollaborationGroup unlistedGroup = new CollaborationGroup(
Name = 'Unlisted',
CollaborationType = 'Unlisted'
);
insert unlistedGroup;
@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>
var ascii_image = `
############ ########
################## ##############
###################### ##################
###########################################
#############################################
###############################################
##################################################
##################~ #############################
########################## ###############################
@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: {
@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 / 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 / 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 / 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==