Skip to content

Instantly share code, notes, and snippets.

@cethegeek
cethegeek / startTest_stopTest.java
Last active August 27, 2022 13:13
Apex example of a test using startTest / stopTest
@isTest static void test_one_item_no_pricing() {
Case customCase = [SELECT id FROM Case LIMIT 1];
Pricebook2 customPb = [SELECT id FROM PriceBook2 LIMIT 1];
Product2 prod = [SELECT id FROM Product2 LIMIT 1];
MyCustomObject__c lineItem = createLineItem(false);
List<MyCustomObject__c> input = new List<MyCustomObject__c>();
input.add(lineItem);
@cethegeek
cethegeek / download_webdriver.py
Created June 22, 2020 03:00
Downloads the appropriate chrome webdriver based on OS' installed Chromium
"""Given the current OS' installed version of Chromium, obtain the appropriate chromedriver.
This follows the steps found here: https://chromedriver.chromium.org/downloads/version-selection
"""
import os
import urllib.request
stream = os.popen('chromium --version | cut -d" " -f2')
output = stream.read()
print(f"Chromium version: {output}")
@cethegeek
cethegeek / running_mongo_docker.md
Last active September 1, 2019 21:22
Running MongoDB in a Docker Container
@cethegeek
cethegeek / MetadataHelper.cls
Last active December 9, 2017 00:08
Force.com Apex Helper Class to read/modify Custom Metadata Types
public class MetadataHelper {
/*
* Given an appPrefix, a metadataName and a metadataRecord label, returns the componentName
*
* Example for a metadata type not in a named package: getComponentName(null, 'CustomMetadataType__mdt', 'Record Label');
* Example for a metadata type in a named package: getComponentName('packageName', 'CustomMetadataType__mdt', 'Record Label');
*/
public static String getComponentName(String appPrefix, String metadataName, String metadataRecord) {
String componentNameTemplate = '{0}__{1}.{0}__{2}';
if (appPrefix == null) {