Skip to content

Instantly share code, notes, and snippets.

View pchittum's full-sized avatar

Peter Chittum pchittum

  • Freelance
  • UK
  • 14:50 (UTC -12:00)
View GitHub Profile
@pchittum
pchittum / blog.html
Created March 1, 2023 10:15
Scanning Blog page to find authors and blog post counts
<!-- sample DOM to be scanned by the JS below to pull out authors of articles written in 2022 and later
<main class="column">
<ul>
<li><article class="content is-clearfix"><h3><a href="/blog/article1">Article 1 Title</a></h3><p><span>Betty Farquharson</span> on <span>February 22nd 2023</span></p>Article 1 description text. <a class="is-pulled-right" href="/blog/article1">Read the rest of this post</a></article><hr>
</li>
<li><article class="content is-clearfix"><h3><a href="/blog/article2">Article 2 Title</a></h3><p><span>Jimmy Retalic</span> on <span>February 21st 2023</span></p>Article 2 description text. <a class="is-pulled-right" href="/blog/article2">Read the rest of this post</a></article><hr>
</li>
<li><article class="content is-clearfix"><h3><a href="/blog/article3">Article 3 Title</a></h3><p><span>Jimmy Retalic</span> on <span>February 21st 2022</span></p>Article 3 description text. <a class="is-pulled-right" href="/blog/article3">Read the rest of this post</a></article><hr>
@pchittum
pchittum / app.css
Created September 7, 2020 09:34
LWC Playground: DOM manipulation with CSS versus if:true/false
.contentHidden {
display: none;
}
@pchittum
pchittum / Iterating and waiting for every promise
Last active December 6, 2019 10:59
My crappy first attempt at writing a command line in oclif
// 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 => {
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 June 6, 2019 04:47
Testing with Carbon
this == that;
@pchittum
pchittum / crontab file
Last active September 23, 2018 19:23
Running a dx command in shell script through cron fails
*/2 * * * * /Users/pchittum/Stuff/git/sfdx-projects/norf/writeapexlog.sh
@pchittum
pchittum / TestSingletonHelper.cmp
Last active July 30, 2018 09:11
Test for singleton helper in Lightning Component
<aura:component >
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
</aura:component>
@pchittum
pchittum / sfdx force:schema:sobject:describe
Created June 22, 2018 09:59
Output from MDAPI sobject entity schema 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 14:23
SObject switch and polymorphic SObject fields
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];
@pchittum
pchittum / PickListValues.cmp
Created September 18, 2017 23:21
PropertyDialog Stuff
<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>