Skip to content

Instantly share code, notes, and snippets.

View FishOfPrey's full-sized avatar

Daniel Ballinger FishOfPrey

View GitHub Profile
FishOfPrey / Assert.apex
Created October 3, 2023 06:09
System Assert Class shadowing
public class Assert {
public static void areEqual(Object expected, Object actual, string msg) {
System.debug('Assert Shadowing Test');
System.Assert.areEqual(expected, actual, msg);
FishOfPrey / sObjectComparator.cls
Created August 29, 2023 02:25
An Apex Comparator implementation for sorting by sObject fields.
public class sObjectComparator implements Comparator<sObject> {
// Asc and Desc are reserved keywords in Apex!
public enum SortOrder { Ascend, Descend}
private Schema.sObjectField sortField;
private DescribeFieldResult describeResult;
public SortOrder order {
<tr><td>AccessCMC</td><td>Access Community Management</td></tr>
<tr><td>AccessContentBuilder</td><td>Access drag-and-drop content builder</td></tr>
<tr><td>AccountSwitcherUser</td><td>Account Switcher User</td></tr>
<tr><td>ActivateContract</td><td>Activate Contracts</td></tr>
<tr><td>ActivateOrder</td><td>Activate Orders</td></tr>
<tr><td>ActivitiesAccess</td><td>Access Activities</td></tr>
<tr><td>AddAnalyticsRemoteConnections</td><td>Add Analytics Remote Connections</td></tr>
<tr><td>AddDirectMessageMembers</td><td>Add People to Direct Messages</td></tr>
<tr><td>AddWaveNotificationRecipients</td><td>Notification Emails: Add Recipients</td></tr>
<tr><td>AllowEmailIC</td><td>Email-Based Identity Verification Option</td></tr>
//Generated by FuseIT WSDL2Apex (
//Methods Included: getActivateResult, testCallback, initAndActivate, init, initAndDuplicate, getSaveResult, initAndSave, getInitResult, getDuplicateResult, activate, save
// Primary Port Class Name: embeddedAsync
public class webserviceEmbeddedServerQaBackendCo {
private static final String s_ns0 = '';
public class ActivateContext_element {
private transient String[] apex_schema_type_info = new String[]{s_ns0,'true','false'};
private transient String[] field_order_type_info = new String[]{};
public class ActivateResult_element {
public class BulkInsertProfiler extends LimitsProfiler {
private List<String> fieldsToCheck;
transient Savepoint sp = null;
List<Contact> c;
public BulkInsertProfiler() { }
public override void setup() {
sp = Database.setSavepoint();
FishOfPrey / Spring 2020 Found keyprefixes
Last active June 8, 2021 11:44
Short list of new keyprefixes found in Spring '20 release. The complete list is at
02I - InsightsApplication - formerly MH_GOLD_INFORMATION
02H - EltWorkflowJobDetail - formerly MH_GOLD_PROGRAM
02L - DataflowVersion - formerly MH_CUSTOMER_CRITERION
02M - DatasetAccess - formerly MH_GREENSHEET
02O - DatasetRegister - formerly MH_GREEN_GET_INFO
02P - DataflowGroupMember - formerly MH_CONTACT_ROLE
02Q - DataflowGroupDependency - formerly MH_INFORMATION
02W - DataflowGroupTrigger
030 - DataflowRequest - formerly PROFILE_TAB_SET
03L - DataflowNode
FishOfPrey / Baseline.cls
Created November 1, 2019 09:49
Differences between baseline ESAPI insertAsUser and stripping version
public SFDCAccessControlResults.InsertResults insertAsUser(SObject [] devObjs, List<String> fieldsToSet) {
if (devObjs == null || devObjs.size() == 0 || fieldsToSet == null || fieldsToSet.size() == 0)
throw new AccessControlDmlException('null or empty parameter');
Schema.DescribeSObjectResult d = devObjs.getSObjectType().getDescribe();
if (d.isCreateable() == false)
throw new SFDCAccessControlException('Access Violation',
FishOfPrey / Hands-on: Logistic
Last active April 3, 2019 07:51
Deep Learning and Natural Language Processing
# TODO: Generate 2 clusters of 100 2d vectors, each one distributed normally, using
# only two calls of randn()
classApoints =
classBpoints =
# TODO: Add the vector [1.0,3.0] to the first cluster and [3.0,1.0] to the second.
classApoints +=
classBpoints +=
// MIT License
// Copyright 2017 Electric Imp
// SPDX-License-Identifier: MIT
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//Generated by FuseIT WSDL2Apex (
// Warning: DataStorageItem - All the XmlSchemaElements in '<xsd:choice>' element are added as members of the class. Choice Members: CreditCardData DE_DirectDebitData OrderId Function
// Warning: Action_element - All the XmlSchemaElements in '<xsd:choice>' element are added as members of the class. Choice Members: InitiateClearing InquiryCardInformation InquiryOrder InquiryTransaction StoreHostedData RecurringPayment Validate GetExternalTransactionStatus GetExternalConsumerInformation SendEMailNotification GetLastOrders GetLastTransactions ManageProducts ManageProductStock RequestCardRateForDCC RequestMerchantRateForDynamicPricing CreatePaymentURL
// Warning: InquiryTransaction_element - All the XmlSchemaElements in '<xsd:choice>' element are added as members of the class. Choice Members: OrderId TDate IpgTransactionId MerchantTransactionId
// Warning: Validate_element - All the XmlSchemaElements in '<xsd:cho