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 ActionPollerExample implements Database.Batchable<Integer>, Iterator<Integer>, Iterable<Integer> { | |
Integer counter; | |
public Id jobId { get; set; } | |
public Boolean keepPolling { get; set; } | |
public ActionPollerExample() { | |
counter = 0; | |
keepPolling = false; | |
} | |
public Iterator<Integer> iterator() { |
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 Documents { | |
public Document[] getDocuments() { | |
return [SELECT Name, BodyLength FROM Document]; | |
} | |
} |
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 OpportunityController { | |
public Opportunity[] getOpps() { | |
return [SELECT Name, Amount FROM Opportunity LIMIT 10]; | |
} | |
} |
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
trigger Obj1 on Obj1 (after insert, after update) { | |
Obj1Trigger.handle(Trigger.new); | |
} |
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 Utils { | |
static Boolean validId(String recordIdString) { | |
try { | |
Id recordId = (Id)recordIdString; | |
String sobjectName = String.valueOf(recordId.getSObjectType()); | |
return Database.countQuery('SELECT COUNT() FROM '+sobjectName+' WHERE Id = :recordId') > 0; | |
} catch(Exception e) { | |
return false; | |
} | |
} |
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
trigger updateContatoPonto on Ponto__c (before insert, before update) { | |
Map<Integer, Id> contactsByNumber = new Map<Integer, Id>(); | |
for(Ponto__c record: Trigger.new) { | |
if(record.Inscricao_Number__c != null) { | |
contactsByNumber.put(record.Inscricao_Numero__c.intValue(), null); | |
} | |
} | |
// Ignore null | |
contactsByNumber.remove(null); |
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
@isTest class TernaryLazyEvalTest { | |
static Integer counter = 0; | |
static Boolean flag { get; set { counter++; flag = value; } } | |
static Boolean setTrue() { | |
return flag = true; | |
} | |
static Boolean setFalse() { | |
return flag = false; | |
} |
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 LoaderDemoController { | |
@RemoteAction public static String getSalesforce() { | |
Long start = DateTime.now().getTime(); | |
String Salesforce = | |
'data:image/jpeg;base64,'+ | |
EncodingUtil.base64Encode( | |
new ApexPages.PageReference(url.getSalesforceBaseUrl().toExternalForm()+'/img/seasonLogos/Winter_17_175x65.png').getContent() | |
); | |
// minimum 1 second delay... | |
while(DateTime.now().getTime()-start<1000); |
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
@isTest class CloneExamples { | |
@isTest static void unitTest() { | |
Account a1 = new Account(Name='Test'); | |
Account a2 = a1.clone(); | |
a2.Name = 'Test 2'; | |
// Proof that a1 is not modified with shallow clone | |
System.assert(a1.Name != a2.Name); | |
Contact c1 = new Contact(Account=a1); | |
Contact c2 = c1.clone(); |
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:application > | |
<c:demoGackComponent /> | |
</aura:application> |
OlderNewer