Skip to content

Instantly share code, notes, and snippets.

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>
<lightning:button label="Test Button" disabled="{!v.disableButton}" />
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: {
brianmfear / Debug.output
Created Jul 14, 2018
System.debug Fixes Your HashCodes
View Debug.output
USER_DEBUG [6]|DEBUG|{Account:{Name=Test, Id=0015000001wL7JRAA0}=42}
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 /
Created May 1, 2018
Demonstration of one-way binding vs two-way binding
<aura:application >
<aura:attribute name="demo" type="Boolean" default="{!true}" />
<aura:if isTrue="{#v.demo}">
Unbound Set
<aura:set attribute="else">
Unbound Unset
<hr />
<aura:if isTrue="{!v.demo}">
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 / 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}" />


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 /
Created Feb 21, 2018 — forked from PurpleBooth/
A template to make good

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.


<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:layoutItem size="3">
<aura:iteration items="{!v.cities}" var="cityValue">