Skip to content

Instantly share code, notes, and snippets.

View jbro-io's full-sized avatar

Jonathan Broquist jbro-io

  • Scottsdale, AZ
View GitHub Profile
trigger AccountTrigger on Account(
before insert,
before update,
before delete,
after insert,
after update,
after delete,
after undelete
) {
AccountTriggerHandler objectHandler = new AccountTriggerHandler(Trigger.operationType);
@isTest
private class TriggerHandlerTest {
// I normally put private classes at the bottom, but to prevent you from having to scroll ...
private class TestTriggerHandler extends TriggerHandler {
public TriggerOperation Method { get; private set; }
@testVisible
protected override void beforeInsert(List<SObject> newRecords) {
this.Method = TriggerOperation.BEFORE_INSERT;
}
public virtual class TriggerHandler {
@testVisible
private static TriggerOperation triggerContext;
protected TriggerHandler() {
if (!Trigger.isExecuting && !Test.isRunningTest()) {
throw new TriggerHandlerException('TriggerHandler used outside of triggers / testing');
}
}
@jbro-io
jbro-io / multiple-bitbucket-ssh-accounts.md
Last active March 18, 2021 03:24
multiple-bitbucket-ssh-accounts

1. Edit ~/.ssh/config

Host bitbucket.org-yourusername
    HostName bitbucket.org
    User yourusername
    IdentityFile ~/.ssh/yoursshkey
    IdentitiesOnly yes
@jbro-io
jbro-io / FindHardCodedURLs.apex
Created October 16, 2016 04:59 — forked from danieljpeter/FindHardCodedURLs.apex
Execute anonymous script to check Email Templates for Hard Coded URLs before turning on My Domain
/*
* Hard coding your Salesforce URL in places like Email Tempaltes and Apex Classes is a worst practice, but some people do it.
* These URLs will break when you turn on my domain, since your URL changes.
* More on this here: https://help.salesforce.com/apex/HTViewSolution?urlname=Updating-Hard-Coded-References-FAQ
* Here are some quick and dirty checks for your Salesforce URL being hard coded in:
* EmailTemplates, WebLinks, ApexClasses, Visualforce Pages, and Triggers.
* Ideally you would retrieve all metadata and search it, but this will find some of the low hanging problems easily.
*
* Usage:
* - Copy / Paste this into Salesforce Execute Anonymous window.
@jbro-io
jbro-io / apex: TimeConversions.cls
Created October 1, 2015 04:50
Salesforce Apex Class to convert time zones
/* **********************************************************************************************
* TimeConversions Class
* Created by: Michael Smith/Force2b, 04/06/2010
*
************************************************************************************************ */
global class TimeConversions {
/* -------------------------------------------------------------------------------------
* Returns an Integer of the Timezone Offset from Eastern Time for the
* currently logged in user
@jbro-io
jbro-io / gist:1c79f65c67ca35e0ce41
Created June 4, 2015 20:52
foursquare-explore-response
{"suggestedFilters":{"header":"Tap to show:","filters":[{"name":"Open now","key":"openNow"},{"name":"With specials","key":"specials"}]},"geocode":{"what":"","where":"scottsdale az","center":{"lat":33.50921,"lng":-111.89903},"displayString":"Scottsdale, AZ, United States","cc":"US","geometry":{"bounds":{"ne":{"lat":33.900393,"lng":-111.755884},"sw":{"lat":33.447584,"lng":-111.960976}}},"slug":"scottsdale-arizona","longId":"72057594043241393"},"headerLocation":"Scottsdale","headerFullLocation":"Scottsdale","headerLocationGranularity":"city","query":"beer","totalResults":110,"suggestedBounds":{"ne":{"lat":33.650293098646216,"lng":-111.88397289519348},"sw":{"lat":33.38032224279749,"lng":-112.05341910022888}},"groups":[{"type":"Recommended Places","name":"recommended","items":[{"reasons":{"count":0,"items":[{"summary":"This spot is popular","type":"general","reasonName":"globalInteractionReason"}]},"venue":{"id":"4fa04d9ae4b0e93e3350caea","name":"Brat Haüs","contact":{"phone":"4809474006","formattedPhone":"(480)
<!-- ---------------------------------------------------------------------- -->
<!-- NOTE: Please add the following <META> element to your page <HEAD>. -->
<!-- If necessary, please modify the charset parameter to specify the -->
<!-- character set of your HTML page. -->
<!-- ---------------------------------------------------------------------- -->
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
<!-- ---------------------------------------------------------------------- -->
<!-- NOTE: Please add the following <FORM> element to your page. -->
/**
* Interceptor
* Implements functionality to catch various requests and fire events when they happen. This is generally to ensure
* that responses from the server are handled in a uniform fashion across the application. Also, by firing events
* it allows to have any number of handlers attach to the response.
*
* @author Kirk Bushell
* @date 28th March 2013
*/
var module = angular.module('core.interceptor', []);