Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🦈

Daniel Ballinger FishOfPrey

💭
🦈
View GitHub Profile
View BulkInsertProfiler.cls
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
FishOfPrey / Spring 2020 Found keyprefixes
Last active Jul 24, 2020
Short list of new keyprefixes found in Spring '20 release. The complete list is at http://www.fishofprey.com/2011/09/obscure-salesforce-object-key-prefixes.html
View Spring 2020 Found keyprefixes
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
FishOfPrey / Baseline.cls
Created Nov 1, 2019
Differences between baseline ESAPI insertAsUser and stripping version
View Baseline.cls
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',
SFDCAccessControlException.ExceptionType.OBJECT_ACCESS_VIOLATION,
SFDCAccessControlException.ExceptionReason.NO_CREATE,
d.getName(),
@FishOfPrey
FishOfPrey / Hands-on: Logistic regression.py
Last active Apr 3, 2019
Deep Learning and Natural Language Processing
View Hands-on: Logistic regression.py
torch.manual_seed(123)
# 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 +=
View SmartRefrigerator_ExplorerKit_Salesforce.agent.nut
// 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
View ipgOnlineComIpgapiSchemasA1.cls
//Generated by FuseIT WSDL2Apex (http://www.fuseit.com/Solutions/SFDC-Explorer/Help-WSDL-Parser.aspx)
// 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
@FishOfPrey
FishOfPrey / FindApexStringHashCollisions.apex
Created Jul 10, 2018
Find hash collisions in Apex for two character strings.
View FindApexStringHashCollisions.apex
Map<Integer, List<String>> hashMap = new Map<Integer, List<String>>();
String str = 'abcdefghijklmnopqrstuvwxyz';
str += str.toUpperCase();
Set<integer> collisions = new Set<Integer>();
for (string c1 : str.split('')) {
for (string c2 : str.split('')) {
View FishOfPreySettings_Test.java
@IsTest
public class FishOfPreySettings_Test {
@IsTest
public static void showTheThingDefault() {
boolean showTheThing = FishOfPreySettings.Instance.showTheThing;
System.assertNotEquals(null, showTheThing);
System.assertEquals(0, Limits.getQueries());
System.assertEquals(0, Limits.getDmlStatements());
}
View FishOfPreySettingsMockProvider.java
public class FishOfPreySettingsMockProvider implements System.StubProvider {
private FishOfPrey_Settings__c testingSettings;
public Object handleMethodCall(Object stubbedObject, String stubbedMethodName,
Type returnType, List<Type> listOfParamTypes, List<String> listOfParamNames,
List<Object> listOfArgs) {
string methodName = 'FishOfPreySettingsMockProvider.handleMethodCall() - ';
View FishOfPreySettings.java
public class FishOfPreySettings {
// Normally during testing we want to limit the custom setting to a testing user.
// However, this won't work with anything that depends on $Setup.FishOfPrey_Settings__c.showTheThing__c in a validation rule
// As it will appear as null
private static boolean useTestingUpdateUserCustomSetting {
get {
if(useTestingUpdateUserCustomSetting == null) {
return true;
}
return useTestingUpdateUserCustomSetting;
You can’t perform that action at this time.