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
public class WeightConverter { | |
private static final Decimal KILOGRAMS_TO_POUNDS_RATIO = 2.205; | |
public static Decimal kilogramsToPounds(Decimal kilograms) { | |
return kilograms * KILOGRAMS_TO_POUNDS_RATIO; | |
} | |
public static Decimal poundsToKilograms(Decimal pounds) { | |
return pounds / KILOGRAMS_TO_POUNDS_RATIO; |
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
@RestResource(urlMapping='/twilio/incoming-call/') | |
global without sharing class TwilioIncomingCallRESTController { | |
@HttpPost | |
global static void handlePost() | |
{ | |
String phoneNumber = getParam('From'); | |
String response = TwilioIncomingCallService.getResponse(phoneNumber); | |
RestContext.Response.addHeader('Content-Type','application/xml'); |
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
const moment = require('moment-timezone'); | |
const TIMEZONE = 'Europe/London'; // timezone needed for Daylight Saving Time adjustment | |
const OPEN_TIME = 9; // 9AM | |
const CLOSE_TIME = 18; // 8PM | |
const FRIDAY = 5; | |
const SATURDAY = 6; | |
const SAT_OPEN_TIME = 10; // 10AM | |
const SAT_CLOSE_TIME = 15; // 3PM | |
process.on('unhandledRejection', error => { |
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
const VOICEMAIL_TWIML_URL = 'https://handler.twilio.com/twiml/XXXXXXXXXXXXXXXXXXXXXXXXXXXX'; | |
process.on('unhandledRejection', error => { | |
console.log('unhandledRejection', error.message); | |
}); | |
exports.handler = function (context, event, callback) { | |
var twiml = new Twilio.twiml.VoiceResponse(); | |
const client = context.getTwilioClient(); |
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
<aura:component controller="FileUploadController"> | |
<aura:attribute name="parentId" type="Id" /> | |
<aura:attribute name="label" type="String" /> | |
<aura:attribute name="uploading" type="Boolean" default="false" /> | |
<aura:handler event="aura:waiting" action="{!c.waiting}" /> | |
<aura:handler event="aura:doneWaiting" action="{!c.doneWaiting}" /> | |
<aura:if isTrue="{!v.uploading}"> | |
<lightning:spinner alternativeText="Loading" size="large" /> | |
</aura:if> | |
<div> |
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
public without sharing class NetworkingUtils { | |
public static String getCurrentUserIPAddress() { | |
Map<String, String> headersMap = ApexPages.currentPage().getHeaders(); | |
// True-Client-IP has the value when the request is coming via the caching integration. | |
String ipAddress = headersMap.get('True-Client-IP'); | |
if (String.isEmpty(ipAddress)) { |
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
//Generated by FuseIT WSDL2Apex (http://www.fuseit.com/Solutions/SFDC-Explorer/Help-WSDL-Parser.aspx) | |
// Warning: DataStorageItem - All the XmlSchemaElements in '<xsd:choice>' element are added as members of the class. Choice Members: CreditCardData DE_DirectDebitData OrderId Function | |
// Warning: Action_element - All the XmlSchemaElements in '<xsd:choice>' element are added as members of the class. Choice Members: InitiateClearing InquiryCardInformation InquiryOrder InquiryTransaction StoreHostedData RecurringPayment Validate GetExternalTransactionStatus GetExternalConsumerInformation SendEMailNotification GetLastOrders GetLastTransactions ManageProducts ManageProductStock RequestCardRateForDCC RequestMerchantRateForDynamicPricing CreatePaymentURL | |
// Warning: InquiryTransaction_element - All the XmlSchemaElements in '<xsd:choice>' element are added as members of the class. Choice Members: OrderId TDate IpgTransactionId MerchantTransactionId | |
// Warning: Validate_element - All the XmlSchemaElements in '<xsd:cho |
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
public without sharing class MessagingHelper { | |
public static void send(Messaging.SingleEmailMessage mail) { | |
MessagingHelper.handleSendEmailResult(Messaging.sendEmail(MessagingHelper.createEmailMessages(mail))); | |
} | |
public static Messaging.EmailFileAttachment[] createEmailFileAttachment(String filename, Blob body) { | |
Messaging.EmailFileAttachment emailAttachment = new Messaging.EmailFileAttachment(); | |
emailAttachment.setFileName(filename); | |
emailAttachment.setBody(body); |
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
Schema.DescribeFieldResult dfr = Opportunity.StageName.getDescribe(); | |
List<Schema.PicklistEntry> picklistValues = dfr.getPicklistValues(); | |
String output = ''; | |
for(Schema.PicklistEntry entry : picklistValues) { | |
if (output != '') { | |
output += ','; | |
} |
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
public without sharing class DatetimeUtils { | |
public static String getDayOfMonthSuffix(Integer n) { | |
if (n == null) { | |
return ''; | |
} | |
if (n >= 11 && n <= 13) { | |
return 'th'; |