Skip to content

Instantly share code, notes, and snippets.

@itsmebasti
itsmebasti / my.app
Last active February 6, 2018 11:54
Reference Change Handlers in Lightning
<aura:application extends="force:slds">
<c:referenceTest />
</aura:application>
@itsmebasti
itsmebasti / XYZ.cmp
Last active December 11, 2018 16:33
Lightning Value Provider
<aura:component extends="c:valueProvider">
<aura:set attribute="name" value="XYZ" />
<aura:set attribute="values" value="{FOO:'Foo', BAR: 'Bar'}" />
</aura:component>
@itsmebasti
itsmebasti / GackAwareIterable.cls
Created April 30, 2021 09:51
GackAwareIterable
public class GackAwareIterable implements Iterable<Object> {
private final Iterable<Object> iterable;
public GackAwareIterable(Iterable<Object> iterable) {
this.iterable = iterable;
}
public Iterator<Object> iterator() {
Iterator<Object> result;
public without sharing class FieldDescribe {
private static final Map<String, SObjectType> SOBJECT_TYPES = Schema.getGlobalDescribe();
private final SObjectField field;
public FieldDescribe(SObjectField field) {
this.field = field;
}
@itsmebasti
itsmebasti / GlobalDescribed.cls
Last active October 18, 2023 13:02
Apex SObject Describes performance testing
public with sharing class GlobalDescribe {
public static Map<String, SObjectType> TYPES = Schema.getGlobalDescribe();
public static Map<String, DescribeSObjectResult> DESCRIBES = new Map<String, DescribeSObjectResult>();
public static SObjectType type(String name) {
return TYPES.get(name);
}
public static DescribeSObjectResult get(String name) {
if(!DESCRIBES.containsKey(name)) {