This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<lightning-datatable | |
key-field="id" | |
columns={columns} | |
data={data} | |
hide-checkbox-column | |
default-sort-direction={dataTableSorter.defaultSortDirection} | |
sorted-direction={dataTableSorter.sortDirection} | |
sorted-by={dataTableSorter.sortedBy} | |
onsort={dataTableSorter.sortData}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass { | |
constructor() { | |
const self = this; | |
Object.getOwnPropertyNames( MyClass.prototype ) | |
.filter(name => name.indexOf('_') === 0) | |
.filter(name => typeof self[name] === 'function') | |
.forEach(function(name) { | |
self[name.substr(1)] = function() { | |
self[name].apply(self, arguments); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<ruleset name="Salesforce Custom Rules" | |
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"> | |
<description> | |
My Salesforce rules | |
</description> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# | |
# Check that sfdx force:source:status is clean before committing | |
# Put this into .git/hooks/pre-commit | |
if ! sfdx force:source:status --json | jq -r '.result | length' | grep '^0$' &> /dev/null; | |
then | |
echo "Error: sfdx source is not synced with remote" | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sleeper(value) { | |
return new Promise(resolve => setTimeout(() => resolve(value), value * 100)); | |
} | |
[5, 4, 3, 6, 1].forEach((value) => sleeper(value).then((value) => console.log(value))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class AccountExclamation implements TriggerAction.BeforeUpdate { | |
public void beforeUpdate(List<Account> newList, List<Account> oldList) { | |
for(Account thisAccount : newList) { | |
if(TriggerBase.idToNumberOfTimesSeenBeforeUpdate.get(thisAccount.Id) == 1 && !thisAccount.Name.endsWith('!')) { | |
thisAccount.Name += '!'; | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String jsonPayload = new YouTubeApi().getPlaylistThumbnail('playlist-id'); | |
String thumbnailUrl = new JsonReader(jsonPayload) | |
.read('items[0].snippet.thumbnails.default.url')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Integer nCallsToEquals = 0; | |
public class HashingTest { | |
private String s; | |
public HashingTest(HashingTest ht) { | |
this.s = ht.s; | |
} | |
public HashingTest(String s) { |
NewerOlder