Skip to content

Instantly share code, notes, and snippets.

@brianmfear
brianmfear / AccountData.cls
Last active January 29, 2020 15:41
lightning:tree with account hierarchy recursion example
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 21:31
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
</aura:set>
</aura:if>
<hr />
<aura:if isTrue="{!v.demo}">
@brianmfear
brianmfear / TreeNodeDataProvder.apxc
Created February 28, 2018 15:41
Recursive Tree in Lightning Demo
public class TreeNodeDataProvider {
@AuraEnabled public static User[] getUsers() {
return [SELECT Name, ManagerId, SmallPhotoUrl FROM User];
}
}
@brianmfear
brianmfear / progressRing.cmp
Created February 23, 2018 17:15
LightningProgressRing component
<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}" />

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 February 21, 2018 16:16 — forked from PurpleBooth/README-Template.md
A template to make good README.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

<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">
@brianmfear
brianmfear / filter.app
Created January 26, 2018 17:22
Lightning Add/Filter List
<aura:application extends="force:slds">
<!-- All items added to the list -->
<aura:attribute name="data" type="List" default="[]" />
<!-- The list of currently viewable items -->
<aura:attribute name="filteredData" type="List" default="[]" />
<!-- Input for a new item -->
<aura:attribute name="newItem" type="String" />
<!-- Input for the filter text -->
<aura:attribute name="filter" type="String" />
namespace NumberGenerators {
public class UniqueNumberGenerator
{
int value;
public UniqueNumberGenerator(int value)
{
this.value = value;
}
public Nullable<int> NextId()
@brianmfear
brianmfear / PageController.apxc
Created October 3, 2017 02:55
Example Image Uploader in Visualforce
public class PageController {
// Transient so we don't exceed view state limits
public transient String fileType { get; set; }
public transient Blob fileBody { get; set; }
ApexPages.StandardController controller;
public PageController(ApexPages.StandardController controller) {
this.controller = controller;
}