Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter Chittum pchittum

View GitHub Profile
@pchittum
pchittum / app.css
Created Sep 7, 2020
LWC Playground: DOM manipulation with CSS versus if:true/false
View app.css
.contentHidden {
display: none;
}
@pchittum
pchittum / Iterating and waiting for every promise
Last active Dec 6, 2019
My crappy first attempt at writing a command line in oclif
View Iterating and waiting for every promise
// here filesToCreate had an array of object literals with details for file creation.
// so much SMH...instead, create an array of unresolved promises, then use Promise.all()
filesToCreate.forEach(file => {
this.log('creating file ' + file.name)
fs.writeFile(file.name, file.text)
.then(() => {
this.log(`created file ${file.name}`)
},
error => {
View gist:13387b929ae455da4085132b79a00962
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/usr/local/Cellar/node/12.6.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'prettier:verify'
1 verbose cli ]
2 info using npm@6.9.0
3 info using node@v12.6.0
4 verbose run-script [ 'prettier:verify' ]
@pchittum
pchittum / test.js
Created Jun 6, 2019
Testing with Carbon
View test.js
this == that;
@pchittum
pchittum / crontab file
Last active Sep 23, 2018
Running a dx command in shell script through cron fails
View crontab file
*/2 * * * * /Users/pchittum/Stuff/git/sfdx-projects/norf/writeapexlog.sh
@pchittum
pchittum / TestSingletonHelper.cmp
Last active Jul 30, 2018
Test for singleton helper in Lightning Component
View TestSingletonHelper.cmp
<aura:component >
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
</aura:component>
@pchittum
pchittum / sfdx force:schema:sobject:describe
Created Jun 22, 2018
Output from MDAPI sobject entity schema describe
View sfdx force:schema:sobject:describe
{
"status": 0,
"result": {
"actionOverrides": [],
"activateable": false,
"childRelationships": [
{
"cascadeDelete": true,
"childSObject": "AttachedContentDocument",
"deprecatedAndHidden": false,
@pchittum
pchittum / How I expected it to work.
Last active May 23, 2018
SObject switch and polymorphic SObject fields
View How I expected it to work.
List<User> notifyUsers = new List<User>();
List<Group> notifyGroups = new List<Group>();
List<Property__c> properties = [SELECT
TYPEOF Owner
WHEN User THEN Id, Name, Username, Email
WHEN Group THEN Id, Name, Email, DoesSendEmailToMembers
END
FROM Property__c
WHERE ID in Trigger.new];
View PickListValues.cmp
<aura:component controller="PicklistController">
<aura:attribute name="sObjectName" type="String" />
<aura:attribute name="fieldName" type="String" />
<aura:attribute name="picklistValues" type="Object" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
</aura:component>
@pchittum
pchittum / helper method
Last active May 24, 2017
bulk notifications for enterprise messaging
View helper method
public static void publishNotifications(List<String> messages){
List<Notification__e> notifications = new List<Notification__e>();
for (String message: messages) {
notifications.add(new Notification__e(Message__c = message));
}
List<Database.SaveResult> results = EventBus.publish(notifications);
//process results