Skip to content

Instantly share code, notes, and snippets.

@brianmfear
brianmfear / DemoBundle.cmp
Created Sep 18, 2018
Disable button when all select options selected (Lightning)
View DemoBundle.cmp
<aura:application >
<aura:attribute name="opts" type="String[]" default="['A','B','C']" />
<aura:attribute name="disableButton" type="Boolean" default="false" />
<select aura:id="picklist" onchange="{!c.updateButtonState}" multiple="multiple">
<aura:iteration items="{!v.opts}" var="opt">
<option value="{!opt}">{!opt}</option>
</aura:iteration>
</select>
<lightning:button label="Test Button" disabled="{!v.disableButton}" />
</aura:application>
@brianmfear
brianmfear / TriggerDmlHelper.apex
Created Aug 27, 2018
Example of mapping related records to report errors on (Apex Code)
View TriggerDmlHelper.apex
// Help report errors to parent/child object on failed DML update
// For use in Trigger contexts only.
// This version is for demonstration purposes only, and should not
// be considered production ready without additional modifications.
//
// Example trigger:
//
// trigger updateContactPhone on Account(after update) {
// Id[] updates = new Id[0];
// for(Account record: Trigger.new) {
@brianmfear
brianmfear / Debug.output
Created Jul 14, 2018
System.debug Fixes Your HashCodes
View Debug.output
USER_DEBUG [5]|DEBUG|null
USER_DEBUG [6]|DEBUG|{Account:{Name=Test, Id=0015000001wL7JRAA0}=42}
USER_DEBUG [7]|DEBUG|42
@brianmfear
brianmfear / AccountData.cls
Last active Jan 29, 2020
lightning:tree with account hierarchy recursion example
View AccountData.cls
public class AccountData {
@AuraEnabled public static Account[] getRecords() {
return [SELECT Name, ParentId, (SELECT Name FROM Contacts) FROM Account];
}
}
@brianmfear
brianmfear / BoundVsUnbound.app
Created May 1, 2018
Demonstration of one-way binding vs two-way binding
View BoundVsUnbound.app
<aura:application >
<aura:attribute name="demo" type="Boolean" default="{!true}" />
<aura:if isTrue="{#v.demo}">
Unbound Set
<aura:set attribute="else">
Unbound Unset
</aura:set>
</aura:if>
<hr />
<aura:if isTrue="{!v.demo}">
@brianmfear
brianmfear / TreeNodeDataProvder.apxc
Created Feb 28, 2018
Recursive Tree in Lightning Demo
View TreeNodeDataProvder.apxc
public class TreeNodeDataProvider {
@AuraEnabled public static User[] getUsers() {
return [SELECT Name, ManagerId, SmallPhotoUrl FROM User];
}
}
@brianmfear
brianmfear / progressRing.cmp
Created Feb 23, 2018
LightningProgressRing component
View progressRing.cmp
<aura:component >
<aura:attribute name="value" type="Integer" default="0" />
<aura:attribute name="variant" type="String" />
<aura:attribute name="hasVariant" type="Boolean" access="private" default="{!false}" />
<aura:attribute name="ringClass" type="String" access="private" />
<aura:attribute name="iconName" type="String" access="private" />
<aura:attribute name="altText" type="String" access="private" />
<aura:handler name="init" value="{!this}" action="{!c.updateView}" />
View Good-CONTRIBUTING.md-template.md

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@brianmfear
brianmfear / README-Template.md
Created Feb 21, 2018 — forked from PurpleBooth/README-Template.md
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

View AccountListFilterByCity.app
<aura:application extends="force:slds" controller="AccountListFilterByCity">
<aura:attribute name="cities" type="List" default="[]" />
<aura:attribute name="allAccounts" type="List" default="[]" />
<aura:attribute name="filterAccounts" type="List" default="[]" />
<aura:handler name="init" value="{!this}" action="{!c.init}" />
<lightning:layout>
<lightning:layoutItem size="3">
<aura:iteration items="{!v.cities}" var="cityValue">