Skip to content

Instantly share code, notes, and snippets.

View charltonAthletic's full-sized avatar

Andy Hitchings charltonAthletic

View GitHub Profile
@Todd-HPRelate
Todd-HPRelate / CreatePDFControllerExtension.cls
Created June 24, 2014 21:03
Example Visual Force Page and Apex code to create a button in Salesforce that will automate the PDF creation using the 'Account' standard object in HP Relate.
<!------------------------------------------------------------------------------------
CreatePDFControllerExtension.cls
Example Apex code to create a button in Salesforce that will automate the PDF creation using the 'Account' standard bject
(c) Copyright 2014 HEWLETT-PACKARD COMPANY
DISCLAIMER: The sample code described herein is provided on an "as is" basis, without warrant of any
kind, to the fullest extent permitted by law. Both Hewlett-Packard Company and I do not warrant or
@jeffdonthemic
jeffdonthemic / httparty.rb
Last active October 9, 2024 19:03
HTTParty Examples
options = { :body =>
{ :username => 'my',
:password => 'password'
}
}
results = HTTParty.post("http://api.topcoder.com/v2/auth", options)
##
## example for post with papertrail and basic auth
##
@etoxin
etoxin / git.md
Last active April 2, 2025 04:54
GIT Bash Commands

search (regex)

git grep "regex"

list all branches

git branch -a
@KorbenC
KorbenC / LoC.cls
Created October 3, 2014 13:14
Counts the lines of apex code in org, combined both class and triggers.
Integer classLines = 0;
Integer triggerLines = 0;
for(ApexClass a : [Select Body From ApexClass]){
List<String> lines = a.Body.split('\n');
classLines += lines.size();
}
for(ApexTrigger a : [Select Body From ApexTrigger]){
List<String> lines = a.Body.split('\n');
@kalinchernev
kalinchernev / countries
Created October 6, 2014 09:42
Plain text list of countries
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua & Deps
Argentina
Armenia
Australia
Austria
@dhoechst
dhoechst / DataTableAjax
Last active July 23, 2021 01:29
Datatable Example
<apex:page>
<head>
<apex:includescript value="//code.jquery.com/jquery-1.11.1.min.js" / >
<apex:includescript value="//cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js" />
<apex:stylesheet value="//cdn.datatables.net/1.10.4/css/jquery.dataTables.css" />
<!-- I have a static resource called famfamfam which is the zip file from http://www.famfamfam.com/lab/icons/silk/famfamfam_silk_icons_v013.zip -->
<style>
@douglascayers
douglascayers / Calendar Attachment Email Template.html
Last active April 18, 2023 20:22
Example Visualforce Template with iCal Attachment
<messaging:emailTemplate subject="Close Opportunity"
recipientType="User"
relatedToType="Opportunity">
<messaging:htmlEmailBody >
<html>
<body>
Opportunity: <a href="https://test.salesforce.com/{!relatedTo.id}"><apex:outputText value="{!relatedTo.name}"/></a>
<br/>
@KorbenC
KorbenC / ApexCoding.txt
Created June 3, 2015 13:10
Apex Coding Standards
Apex Coding Standard
Introduction
-------------
Apex is a strongly-typed, object-oriented, proprietary programming language for the Force.com platform.
It lets you execute flow and transaction control statements in conjunction with calls to the Force.com API.
Apex borrows it's syntax from Java, and functions like a database stored procedure.
To learn more about Apex, read the developer documentation on the Force.com developer site.
[http://www.salesforce.com/us/developer/docs/apexcode/index.htm]
@sjurgis
sjurgis / salesforce-calendar-view.md
Last active February 5, 2018 08:37
FullCalendar calendar view implementation in Salesforce.com

This is an adaptation of Cody Sechelski's Create a Calendar View in Salesforce.com.

The main problem with his implementation was that it wasn't handling more than 2000 records. This was due to a Apex workaround, as it is reserves start and end variables, Cody made a repeat table and parsed that into JavaScript object. My solution creates JSON string in Apex and then uses string function to replace all startString and endString instances. A more sensible solution would involve recreating the object in JavaScript or simply editing the FullCalendar library to look for different variable names.

I have also simplified the code a bit so you can start working towards your personal implementation. As this is using JavaScript remoting, I hope this gives you a framework to work towards more advanced features like editing or optimizing request sizes (executing a request on next month load).

The page

<apex:page showHeader="fals
@isTest
private class TestDemoWebCallout {
static testMethod void testRestfulCallout() {
Lead l = new Lead();
l.Status = 'Open';
l.LastName = 'Owen';
l.FirstName = 'Bob';
l.Street = '1234 Sesame Street';
l.City = 'Houston';