This file contains hidden or 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
#!/usr/bin/env php | |
<?php | |
if (isset($argv[1])) { | |
$contents = file_get_contents($argv[1]); | |
echo json_encode(unserialize($contents)); | |
} else { | |
echo "Usage: unserialize [FILENAME]\n\nExamples:\n\tunserialize myfile.txt\n\tOR\n\tunserialize myfile.txt > myfile.json\n"; | |
} |
This file contains hidden or 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 with sharing class MyCustomMetadataHandler { | |
@AuraEnabled | |
public static Boolean saveDefaultDecimal(Decimal value) { | |
Id orgId = UserInfo.getOrganizationId(); | |
List<My_Custom_Metadata_Default__c> defs = [SELECT Id, SetupOwnerId, Percentage_Value__c FROM My_Custom_Metadata_Default__c WHERE SetupOwnerId = :orgId]; | |
Database.SaveResult defSave; | |
if (defs.size() == 0) { | |
My_Custom_Metadata_Default__c nd = new My_Custom_Metadata_Default__c( |
This file contains hidden or 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
package routines; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Random; | |
public class MyHelper { | |
/** |
This file contains hidden or 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
// Visualforce Page: MySU_Redirect_Page | |
<apex:page controller="MySURedirectController" action="{!redirect}"/> | |
// Apex Controller: | |
public class MySURedirectController { | |
public PageReference redirect() { | |
Id serviceRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('LCC').getRecordTypeId(); | |
Map<String,String> getParams = ApexPages.currentPage().getParameters(); | |
String serviceId = getParams.get('service_id'); |
This file contains hidden or 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
// If not the "System" user or a System Administrator, then do the thing.... | |
!OR( | |
AND( | |
$User.FirstName == '', | |
$User.LastName == 'System' | |
), | |
$Profile.Name == 'System Administrator' | |
) |
This file contains hidden or 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
global class AFFL_AffiliationsStartDate_TDTM extends npsp.TDTM_Runnable { | |
global override npsp.TDTM_Runnable.DmlWrapper run(List<SObject> newlist, | |
List<SObject> oldlist, | |
npsp.TDTM_Runnable.Action triggerAction, | |
Schema.DescribeSObjectResult objResult) { | |
npsp.TDTM_Runnable.dmlWrapper dmlWrapper = new npsp.TDTM_Runnable.DmlWrapper(); | |
List<npe5__Affiliation__c> newAffils = (List<npe5__Affiliation__c>) newlist; | |
List<npe5__Affiliation__c> oldAffils = (List<npe5__Affiliation__c>) oldlist; |
This file contains hidden or 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 static String getIconName(String sObjectName){ | |
String u; | |
List<Schema.DescribeTabSetResult> tabSetDesc = Schema.describeTabs(); | |
List<Schema.DescribeTabResult> tabDesc = new List<Schema.DescribeTabResult>(); | |
List<Schema.DescribeIconResult> iconDesc = new List<Schema.DescribeIconResult>(); | |
for(Schema.DescribeTabSetResult tsr : tabSetDesc) { tabDesc.addAll(tsr.getTabs()); } | |
for(Schema.DescribeTabResult tr : tabDesc) { | |
if( sObjectName == tr.getSobjectName() ) { |
This file contains hidden or 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
SELECT | |
ocr.ContactId, | |
ocr.OpportunityCloseDate, | |
ocr.OpportunityAmount, | |
LAG(ocr.OpportunityCloseDate, 1) OVER (PARTITION BY ocr.ContactId ORDER BY ocr.OpportunityCloseDate ASC) AS `Prev` | |
FROM | |
`OpportunityContactRoles` AS ocr | |
WHERE | |
ocr.OpportunityAmount > 0 | |
ORDER BY |
This file contains hidden or 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
String dateUpdatedQueryString = ""; | |
Integer numberOfDays = (Integer) context.NumberOfDays; | |
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); | |
if (numberOfDays != null && numberOfDays > 0) { | |
java.util.Calendar today = java.util.Calendar.getInstance(); | |
today.setTime(new Date()); | |
today.add(java.util.Calendar.DATE, -numberOfDays); | |
dateUpdatedQueryString = "&DateUpdated[after]=" + DATE_FORMAT.format(today.getTime()); | |
System.out.println("dateUpdatedQueryString: " + dateUpdatedQueryString); |