Skip to content

Instantly share code, notes, and snippets.

View papagunit's full-sized avatar
👨‍🚀
Don't mind me, just collecting stars...

Devon Guerrero papagunit

👨‍🚀
Don't mind me, just collecting stars...
View GitHub Profile
@PezzerDev
PezzerDev / TestUtil.cls
Last active December 20, 2023 19:29
[Salesforce ID generator] Generates 15-character Salesforce IDs for testing #salesforce #apex
/**
* A collection of static utility methods for unit testing.
*/
@IsTest
public class TestUtil {
// ID generator configuration
private static final Integer ID_RESERVED_CHARACTERS = 7;
private static final Integer ID_INCREMENTER_PREFIX_LENGTH = 1;
private static final String BASE62_ALPHABET = '0123456789abcdefghijklmnopqrstuvwqyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
@PezzerDev
PezzerDev / Uuid.cls
Created July 5, 2019 19:04
[UUID Generator in Apex] #salesforce #apex
/**
* A UUID generator that can construct unique IDs in a variety of formats.
*
* A UUID is generated immediately upon instantiation of this class. The UUID can be retrieved in its normal form
* (e.g. f111b8c5-ca2f-4a1a-8d0d-a8dd5f37c05f) or as a shortened web-safe form (e.g. jp64hwPZ-Lh7vY8INQA7ImQPbQE), which
* is constructed by converting the UUID to Base64 and replacing '/' and '+' with '-' and '_', respectively.
*/
public class Uuid {
private static final String HEX_PREFIX = '0x';
@PezzerDev
PezzerDev / JsonNode.cls
Created July 5, 2019 18:41
[Traversable JSON (and XML) in Apex] Simulated tree structure to represent JSON or XML in a traversable and queriable way #salesforce #apex
/*
* A traversable JSON data structure.
*
* Conceptually, JSON is a general tree, or array of general trees. It is represented in Apex using Map<String, Object>
* for objects, List<Object> for arrays, String for strings, and either Integer or Decimal for numbers. This class wraps
* these data types in order to provide an interface for traversiing and querying the entire JSON structure.
*
* Each node contains a single value that must be a valid JSON value. That is, Map<String, Object>, List<Object>,
* String, Decimal, Integer, or null. When traversing or querying a JSON structure, any value returned is always wrapped
* in a JsonData instance to allow subsequent traversal or query.
@antonygnanasekar
antonygnanasekar / disposabledomains.txt
Last active November 28, 2023 01:40
disposable domains
0-mail.com
0815.ru
0clickemail.com
0wnd.net
0wnd.org
10minutemail.com
20minutemail.com
2prong.com
30minutemail.com
3d-painting.com
@devdutta
devdutta / country-codes.csv
Created June 25, 2019 05:30
Standard Country Codes
name alpha-2 alpha-3 country-code iso_3166-2 region sub-region intermediate-region region-code sub-region-code intermediate-region-code
Afghanistan AF AFG 004 ISO 3166-2:AF Asia Southern Asia 142 034
Åland Islands AX ALA 248 ISO 3166-2:AX Europe Northern Europe 150 154
Albania AL ALB 008 ISO 3166-2:AL Europe Southern Europe 150 039
Algeria DZ DZA 012 ISO 3166-2:DZ Africa Northern Africa 002 015
American Samoa AS ASM 016 ISO 3166-2:AS Oceania Polynesia 009 061
Andorra AD AND 020 ISO 3166-2:AD Europe Southern Europe 150 039
Angola AO AGO 024 ISO 3166-2:AO Africa Sub-Saharan Africa Middle Africa 002 202 017
Anguilla AI AIA 660 ISO 3166-2:AI Americas Latin America and the Caribbean Caribbean 019 419 029
Antarctica AQ ATA 010 ISO 3166-2:AQ
@areed1192
areed1192 / Selecting Ranges.EXCEL.yaml
Created May 30, 2019 02:24
This code leverages different ways to select cells using the Office API.
name: Selecting Ranges
description: This code leverages different ways to select cells using the Office API.
host: EXCEL
api_set: {}
script:
content: |
$("#run1").click(() => tryCatch(workingWithRanges));
async function workingWithRanges() {
await Excel.run(async (context) => {
0-mail.com
027168.com
0815.su
0sg.net
10mail.org
10minutemail.co.za
11mail.com
123.com
123box.net
123india.com
@PezzerDev
PezzerDev / getType.cls
Created April 3, 2019 16:52
[Get instance type in Apex] A hack to determine the type of an instance in Apex #salesforce #apex
/*
* Returns the type of a given object. This is a hack around the fact that we can't access the type of an object.
* @param {Object} obj An object
* @returns {Type} the type of the object
*/
private static Type getType(Object obj) {
String typeName = 'Date';
// Attempt to cast the object to Datetime
// If it succeeds, the object is a date
@PezzerDev
PezzerDev / Mass-Deactivate Salesforce Users
Last active January 26, 2021 21:20
[Mass-Deactivate Salesforce Users] Deactivates all users that aren't assigned one of the profiles definied in a set #salesforce #apex
// Profiles to leave enabled
Set<String> excludedProfiles = new Set<String> {
'System Administrator',
'Integration System Administrator',
'AccessTSC Digital Profile',
'TriState Onboarding Team',
'Tristate Administrator'
};
List<User> usersToUpdate = new List<User>();
@P3t3rp4rk3r
P3t3rp4rk3r / disposableemailproviders
Created March 24, 2019 04:06
Free disposable email providers
0-00.usa.cc
0-mail.com
001.igg.biz
0039.cf
0039.ga
0039.gq
0039.ml
027168.com
0317123.cn
0815.ru