Skip to content

Instantly share code, notes, and snippets.

View jsmithdev's full-sized avatar
🏗️
building things

Jamie Smith jsmithdev

🏗️
building things
View GitHub Profile
@jsmithdev
jsmithdev / style.css
Created May 30, 2019 03:01
LWC test of loading style from resource; style.css is uploaded as a static resource named style
.target {
min-width: 300px;
min-height: 300px;
background: blue !important;
color: white !important;
}
@jsmithdev
jsmithdev / sfdx-cheatsheet.sh
Created February 22, 2019 19:54 — forked from xixiaofinland/sfdx-cheatsheet.sh
Salesforce SFDX Cheat Sheet
# This cheatsheet contains the most often used SFDX commands for beginners to get a jumpstart.
# Hint. it is highly recommended to use `-h` to check the usage of any SFDX commands and corresponding parameters.
# For instance, use `sfdx force:auth:web:login -h` to checke what `-d` `-a` parameters do
# List down all supported dx commands:
sfdx force:doc:commands:list
# Check current DebHub and Scratch Org status
sfdx force:org:list
@jsmithdev
jsmithdev / SOQL Queries.sql
Created January 24, 2023 02:43 — forked from sholloway/SOQL Queries.sql
Useful SOQL queries for exploring a Salesforce org.
--------------------------------------------------------------------
-- Queries related to distribution of metadata.
-- Find the number of users per profile.
SELECT count(id), Profile.name
FROM User
WHERE User.IsActive = true
GROUP BY Profile.name
-- Find the distribution of Apex classes per namespace.
select count(id), NameSpacePrefix
@jsmithdev
jsmithdev / conky.config
Created January 22, 2023 14:06
Conky config: 16 core, amdgpu
alignment top_left
background true
border_width 1
color1 e100ff
color2 D1E7D1
color3 FF0000
color4 FFFFFF
cpu_avg_samples 2
default_color D1E7D1
default_outline_color white
@jsmithdev
jsmithdev / RegexWC.js
Last active July 28, 2022 23:42
Web Components / LWC Regular Expressions
/**
* @description Matches name of component - "ui-comp" from `<ui-comp class="ok">EVERYTHING</ui-comp>`
* @return {Array} array of matches
* @demo regexr.com/6qp3v
**/
export function nameUse(s) {
return s.match(new RegExp(/(?<=<)((\w*)(-\w*))(-\w*)*/, 'g'));
}
/**
@jsmithdev
jsmithdev / History|-154f3503|entries.json
Last active July 24, 2022 18:01
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///home/jamie/repo/app-layout/src/modules/main/appLayout/util.js","entries":[{"id":"pDME.js","timestamp":1658087295473},{"id":"MrIP.js","timestamp":1658087353387},{"id":"elBN.js","source":"moved.source","timestamp":1658087372558},{"id":"ySck.js","timestamp":1658087582563},{"id":"Td6n.js","timestamp":1658087623767},{"id":"Jvek.js","timestamp":1658087634477},{"id":"g5XM.js","timestamp":1658087654967},{"id":"N7P5.js","timestamp":1658087738960}]}
@jsmithdev
jsmithdev / WebComponent.js
Last active June 9, 2022 04:49
Web Component boilerplate for a native web-component (v1 spec)
/*
* Use tag to import via es6 module (html import deprecated in v1 spec :/ )
* <script type="module" src="../components/web-component/web-component.js"></script>
*/
'use strict()'
const template = document.createElement('template')
template.innerHTML = /*html*/`
<style>
.card {
function createUUID(){
let dt = new Date().getTime()
const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = (dt + Math.random()*16)%16 | 0
dt = Math.floor(dt/16)
return (c=='x' ? r :(r&0x3|0x8)).toString(16)
})
@jsmithdev
jsmithdev / Picklist.cls
Created December 27, 2018 15:32
Example of making <select> from a custom field for a lightning component for Salesforce.
public without sharing class Foo {
@AuraEnabled
public static List<Map<String, String>> getDealerOptions() {
List<Map<String, String>> options = new List<Map<String, String>>();
Schema.DescribeFieldResult fieldResult = OpportunityLineItem.Dealer_Code__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
function dbl(x){
return x+x
}
Array.from(Array(30).keys())
.reduce((acc, curr, index) => {
acc = acc === 0 ? .01 : dbl(acc)
console.log('day ', index+1, ': $', acc)
return acc
}, 0)