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 / 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'));
}
/**
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)
@jsmithdev
jsmithdev / getRandomAddress.cls
Created September 28, 2021 14:01
Apex method to get a pseudo random address
/**
* get a pseudo random address
* @param {Integer} val - number to decide what address to return
* @return {String} - address
*/
public static String getRandomAddress(Integer val) {
Integer i = Integer.valueOf(String.valueOf(val).right(1));// get last num; 3, 223, 113 would be 3;
if(i == 0){ return '61 North Avenue NW, Atlanta, GA, 30308'; }
if(i == 1){ return '210 Peachtree St NW, Atlanta, GA, 30303'; }
if(i == 2){ return '12 Cobb Pkwy SE, Marietta, GA, 30062'; }
@jsmithdev
jsmithdev / remove console log webpack.md
Created September 21, 2021 12:54 — forked from rupeshtiwari/remove console log webpack.md
remove console.log & comments from code webpack

Remove Console Log From Prod Bundle using Webpack

This will help you to remove console.log and comments from typescript or javascript files using webpack 4

Install uglifyjs-webpack-plugin

webpack remove console.log

npm i npm install uglifyjs-webpack-plugin --save-dev

create bs-module-app\webpack\webpack-optimization.config.js

@jsmithdev
jsmithdev / lwc-swipe.js
Created July 8, 2021 23:10
swipe actions in an lwc app
renderedCallback() {
// swipe to close
this.template
.querySelector('div.app')
.addEventListener(
'touchstart',
this.handleTouchStart.bind(this),
false
);
@jsmithdev
jsmithdev / xmlToJson.js
Last active September 1, 2021 03:47 — forked from chinchang/xmlToJson.js
Function to convert XML to JSON
/*
Usage:
1. If you have an XML file URL:
const response = await fetch('file_url');
const xmlString = await response.text();
var XmlNode = new DOMParser().parseFromString(xmlString, 'text/xml');
xmlToJson(XmlNode);
@jsmithdev
jsmithdev / sfdx + land short deploy for readme
Created December 16, 2020 14:54
deploy instructions for readmes
## Deploy
Click to deploy can be done at [https://component.land?share=jsmithdev%2Fsortie-list](https://component.land?share=jsmithdev%2Fsortie-list)
SFDX deployment instructions can be found at [https://github.com/jsmithdev/sfdx-deploy-instructions](https://github.com/jsmithdev/sfdx-deploy-instructions)
---
coded while petting a 🐶 by [Jamie Smith](https://jsmith.dev)
.env
.history
.sfdx
scratch.js
sfdx-project.json
config
scripts