Skip to content

Instantly share code, notes, and snippets.

Jesse Altman jessealtman

Block or report user

Report or block jessealtman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jessealtman
jessealtman / MyController
Created Jun 27, 2014
Real Unit Tests using ApexMocks
View MyController
public class MyController{
private MyInterface myImplementation;
public Integer valueOne{get;set;}
public Integer valueTwo{get;set;}
public MyController(MyInterface myImplementation){
this.myImplementation = myImplementation;
}
public Integer calculatedTotalValue(){
View build.properties
# Specify the login credentials for the desired Salesforce organization
sf.username = <insert username here>
sf.password = <insert password and security token>
# Use 'https://login.salesforce.com' for production or developer edition
# Use 'https://test.salesforce.com for sandbox.
sf.serverurl = https://login.salesforce.com
sf.maxPoll = 20
@jessealtman
jessealtman / ExampleController
Created Apr 19, 2014
Proper Unit Test Structure in Apex
View ExampleController
public class ExampleController
public Integer differenceInFooWidgetsAndStubCount(Id fooId, Id stubId){
Foo__c foo = [
SELECT
Id,
(SELECT Id FROM Widget__r)
FROM
Foo__c
WHERE
@jessealtman
jessealtman / StackExchangeService
Created Apr 19, 2014
StackExchange API on Salesforce!
View StackExchangeService
public class StackExchangeService{
public List<SFSEQuestion> getStackExchangeQuestionsDeserialize(){
Http httpQuestions = new Http();
HttpRequest requestQuestions = new HttpRequest();
requestQuestions.setEndpoint('http://api.stackexchange.com/2.2/users/605/questions?order=desc&sort=activity&site=salesforce');
requestQuestions.setMethod('GET');
requestQuestions.setHeader('Content-Type', 'application/json');
HTTPResponse responseQuestions = httpQuestions.send(requestQuestions);
List<SFSEQuestion> questions = new List<SFSEQuestion>();
@jessealtman
jessealtman / PaymentInterface
Created Apr 19, 2014
Dependency Injection in Apex
View PaymentInterface
public interface PaymentInterface{
String processPayment();
}
View ChatterGalleryPage
<apex:page showHeader="true" sidebar="true" title="Chatter Gallery" controller="ChatterGalleryPageController">
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"/>
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"/>
<apex:stylesheet value="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css"/>
<apex:includeScript value="{!URLFOR($Resource.Galleria,'galleria/galleria-1.3.5.min.js')}"/>
<style>
.galleria{ width: 700px; height: 400px; background: #000 }
</style>
<apex:sectionHeader title="View Chatter Images" subtitle="Chatter Gallery" />
You can’t perform that action at this time.