This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
downloadEmbededVideos(); | |
/** | |
* Finds and downloads all embeded Vimeo videos. | |
*/ | |
function downloadEmbededVideos() { | |
// Find Vimeo embed frame | |
var embedFrames = document.querySelectorAll('iframe[src*="player.vimeo.com"]'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Extracts the translation values from a given CSS transformation. | |
* @param {string} transformValue The CSS transform string from which the translation values will be extracted (e.g. ‘translate3d(10px, 25px, 30px)’) | |
* @returns {object} translation values found in the given transform (e.g. { x: 10, y: 25, z: 30 }) | |
*/ | |
function getTranslation(transformValue) { | |
var matches = transformValue.match(/translate(3d)*\((\d+.?\d*(px)?),\s*(\d+.?\d*(px)?)(,\s*(\d+.?\d*(px)?))?\)/); | |
if (matches) { | |
return { | |
x: parseInt(matches[2]) || 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class DailyLeadProcessor implements Schedulable { | |
global void execute(SchedulableContext context) { | |
List<Lead> leads = [Select Id, LeadSource from Lead where LeadSource = null limit 200]; | |
for (Lead currentLead : leads) { | |
currentLead.LeadSource = 'Dreamforce'; | |
} | |
update leads; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A registry built around the Salesforce Mocking API that allows declarative mocking of HTTP callouts. Mocks responses | |
* can be registered either for a specific endpoint and path or for all paths on an endpoint, with the former taking | |
* precedence. | |
*/ | |
@IsTest | |
public class HttpMockRegistry { | |
// Default mock response for HTTP requests | |
public static final HttpResponse DEFAULT_MOCK_RESPONSE = createSuccessResponse('Default mock response'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash'; | |
/** | |
* Converts a tab-separted-values (TSV) file to a set of JSON objects | |
* where each value is keyed according to the heading row | |
*/ | |
const tsvToJson = tsv => { | |
// Split lines and filter any empties | |
const lines = tsv | |
.split('\n') // Split lines |
OlderNewer