Skip to content

Instantly share code, notes, and snippets.

View jongpie's full-sized avatar
☁️

Jonathan Gillespie jongpie

☁️
View GitHub Profile
@jongpie
jongpie / _cbltomylar.py
Created April 17, 2025 03:32 — forked from flips22/_cbltomylar.py
CBL to Mylar Script - Imports a CBL file, finds each unique series on comicvine, checks if you already have it in mylar and if not, adds the series to mylar via its api.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Installation:
1) Add this package as a python wrapper to search the comicvine api:
https://github.com/jessebraham/comicvine-search
I wasn't able to get this module to install so I copied it to the same folder as the .py file (or add to you env of course)
2) Replace [mylar api key] with your api key
3) Replace [mylar server address] with your server in the format: http://servername:port/ (make sure to include the slash at the end)
4) Replace [comicvine api key] with your api key
@jongpie
jongpie / LoggerRestResource.cls
Last active August 2, 2024 05:00
Nebula Logger - managed package REST resource prototype
@RestResource(urlMapping='/logger/*')
global class LoggerRestResource {
public class LogCreateRequest {
public String parentLogTransactionId;
public List<LogEntryCreateRequest> logEntries = new List<LogEntryCreateRequest>();
}
public class LogEntryCreateRequest {
public String loggingLevel;
public String message;
@jongpie
jongpie / UniqueIdBenchmarkingTests.cls
Created January 30, 2024 00:23
Apex - Unique ID Generation Benchmarks
@IsTest
private class UniqueIdBenchmarkingTests {
@IsTest
static void ulidBenchmark() {
Long ulidStartTime = System.now().getTime();
System.debug('ULID generation start: ' + System.now().getTime());
for (Integer i = 0; i < 1000; i++) {
ULID.generate();
}
Long ulidStopTime = System.now().getTime();
@jongpie
jongpie / listView.cmp
Created January 5, 2023 21:04
Community Cloud list view component
<aura:component implements="forceCommunity:availableForAllPageTypes" access="global">
<!-- Attributes -->
<aura:attribute access="public" required="true" name="objectApiName" type="String" />
<aura:attribute access="public" required="true" name="listName" type="String" />
<aura:attribute access="public" required="true" name="rows" type="Integer" default="50" />
<aura:attribute access="public" required="false" name="showSearchBar" type="Boolean" default="false" />
<aura:attribute access="public" required="false" name="showActionBar" type="Boolean" default="false" />
<aura:attribute access="public" required="false" name="showRowLevelActions" type="Boolean" default="false" />
<aura:attribute access="public" required="false" name="enableInlineEdit" type="Boolean" default="false" />
@jongpie
jongpie / CustomNebulaLoggerMapping.cls
Created September 14, 2022 19:11
Nebula Logger - custom field mapping
public without sharing class CustomNebulaLoggerMapping {
@InvocableMethod
public static void mapCustomFields(List<Nebula__LogEntryEvent__e> events) {
// Build up the list of event UUIDs
List<String> eventUuids = new List<String>();
for (Nebula__LogEntryEvent__e event : events) {
eventUuids.add(event.EventUuid);
}
@jongpie
jongpie / ApexExecutionOverlayLogger.cls
Last active September 14, 2022 15:58
Nebula Logger - Apex Execution Overlay prototype
public without sharing class ApexExecutionOverlayLogger {
private static final String ORG_BASE_DOMAIN = Url.getOrgDomainUrl()?.toExternalForm();
// TODO get API version dynamically
// private static final String DESCRIBE_ENDPOINT = ORG_BASE_DOMAIN + '/services/data/v55.0/tooling/sobjects/ApexExecutionOverlayAction/describe';
private static final String QUERY_ENDPOINT = ORG_BASE_DOMAIN + '/services/data/v55.0/tooling/query/?q=';
private static final String ACTION_RECORD_CREATION_ENDPOINT = ORG_BASE_DOMAIN + '/services/data/v55.0/tooling/sobjects/ApexExecutionOverlayAction';
// TODO implement batchable?
public ApexExecutionOverlayLogger() {
@jongpie
jongpie / email.md
Created April 6, 2022 16:41
That one time in 2015 that I shared my thoughts on SOQL vs SQL with James Simone

Hey James,

I just realized we haven’t discussed how to query SF data in any of our SF/Skuid trainings, and you might want to do so while I’m out this week (or you may just be curious about how it works). We can discuss this more in person if you want, but there are a couple of things to know about querying in Salesforce (spoiler alert: prepare to be sad).

Overview

  • Salesforce’s custom implementation of SQL is called SOQL – Salesforce Object Query Language.

  • It takes everything you love about SQL, throws 75% of it out the window and then burns the rest, leaving you with the sad, charred remnants of a once beautiful thing.

@jongpie
jongpie / Example_usage.cls
Created February 16, 2022 22:55
Handle (some of) the annoyances of working with SObjects
Account acct = [SELECT Id, Name, CreatedDate FROM Account LIMIT 1];
Datetime fakeCreatedDate = System.now();
List<Contact> contacts = [SELECT Id, LastName, AccountId FROM Contact LIMIT 5];
acct = (Account) new SObjectAnnoyanceHelper(acct)
.setReadOnlyField(Schema.Account.CreatedDate, fakeCreatedDate)
.appendChildren(contacts, 'Contacts')
.getRecord();
System.debug('The updated account: ' + acct);
System.debug('The new CreatedDate: ' + acct.CreatedDate);
@jongpie
jongpie / MultiQueryExampleBatchJob.cls
Last active April 9, 2025 12:08
Example Apex batch job that runs multiple queries for different SObject Types
public without sharing class MultiQueryExampleBatchJob implements Database.Batchable<SObject>, Database.Stateful {
private Schema.SObjectType currentSObjectType;
// Add any SObject Types here if you want the batch job to query them
private List<Schema.SObjectType> sobjectTypes = new List<Schema.SObjectType>{ Schema.Account.SObjectType, Schema.Contact.SObjectType };
public Database.QueryLocator start(Database.BatchableContext context) {
this.currentSObjectType = this.sobjectTypes.remove(0);
return this.getQueryLocator();
}
@jongpie
jongpie / PackageSubscriberMetrics.cls
Created September 15, 2021 19:43
Package Subscriber Metrics
public class PackageSubscriberMetrics {
public class SubscriberOrgSummary {
public Id parentOrgId;
public String subscriberName;
public Boolean installedInParentOrg = false;
public Integer numberOfOrgs = 0;
public List<SubscriberOrgDetails> subscriberOrgDetails = new List<SubscriberOrgDetails>();
}
public class SubscriberOrgDetails {