Skip to content

Instantly share code, notes, and snippets.

/*******************************************************************************************************************
public without sharing class Telemetry {
@TestVisible
private FeatureManagementWrapper featureManager = new FeatureManagementWrapper();
public void process() {
featureManager.setPackageIntegerValue(
'NumberOfClosedOpportunities',
[SELECT Id FROM Opportunity WHERE IsClosed = true].size()
);
google.charts.load('current', {'packages':['gauge']});
google.charts.setOnLoadCallback(drawChart);
let voc_div = document.getElementById('voc_chart');
let voc = parseInt(voc_div.dataset.level);
let voc_max = parseInt(voc_div.dataset.max);
let nox_div = document.getElementById('nox_chart');
let nox = parseInt(nox_div.dataset.level);
let nox_max = parseInt(nox_div.dataset.max);
List<Account> testAccount = [SELECT Id FROM Account WHERE Name = 'Test Account'];
Account accountToArchive;
if (testAccount.isEmpty()){
accountToArchive = new Account(Name = 'Test Account');
insert accountToArchive;
} else{
accountToArchive = testAccount[0];
}
List<Opportunity> opps = new List<Opportunity>();
@seanpat09
seanpat09 / gist:5970a0a3a29baf939c9d14fc197e26f9
Last active February 15, 2019 16:00
Create Tasks with Long Description for Opportunity
Account accountToArchive = new Account(Name = 'Test Account');
insert accountToArchive;
List<Opportunity> opps = new List<Opportunity>();
for (Integer i = 0; i < 8; i++) {
opps.add(
new Opportunity(
AccountId = accountToArchive.Id,
Name = 'TestOpp'+i,
StageName = 'Closed Won',
@seanpat09
seanpat09 / sampleJSON.txt
Last active May 9, 2017 19:47
Bulk API Sample JSON Error
From Salesforce's documentation for sample JSON to the Bulk API
(https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_json_sample_file.htm):
[
{
"Name" : "Xytrex Co.",
"Description" : "Industrial Cleaning Supply Company",
"Account Number" : "ABC15797531"
}
{
@seanpat09
seanpat09 / namespacedBootstrap.css
Created January 13, 2016 17:13
Namespaced Bootstrap
@charset "UTF-8";
.sfdcBootstrap {
/*!
* Bootstrap v3.3.6 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ }
.sfdcBootstrap html {
@seanpat09
seanpat09 / mapCaseSensitvity.cls
Created October 9, 2015 21:23
Salesforce Map Case-Sensitivity Inconsistency
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
System.assert( gd.ContainsKey('CampaignMember') );
System.assert( gd.ContainsKey('campaignmember') );
System.assert( gd.ContainsKey('CAMPAIGNMEMBER') );
System.assert( gd.keyset().contains('campaignmember') );
System.assert( !gd.keyset().contains('CampaignMember') );
System.assert( !gd.keyset().contains('CAMPAIGNMEMBER') );
@seanpat09
seanpat09 / gist:62d47c72b1ab364080a4
Last active August 29, 2015 14:14
What do you say you... do here?

Hello replacement! Below are some notes on what I am typically responsible for here at Apto and some general tips about the code base:

Responsibilities:

  • Github
    • Code review of Pull Requests
      • Check for sufficient unit tests
      • Check for unnecessary comments
      • Make sure I can understand what the code does without having to ask anyone. If not, ask author to simplify/clarify
  • Check what can be abstracted out. A lot of times several developers will be working separate but similar projects. Find the common ground so the code doesn't repeat itself.