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 / ContentDocumentTest.java
Created June 7, 2019 03:02 — forked from xgeek-net/ContentDocumentTest.java
ContentDocumentTest Apex TestClass
@isTest
private class ContentDocumentTest {
private static testMethod void testCreate() {
ContentVersion contentVersion_1 = new ContentVersion(
Title = 'Penguins',
PathOnClient = 'Penguins.jpg',
VersionData = Blob.valueOf('Test Content')
IsMajorVersion = true
);
insert contentVersion_1;
@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;
}
import { LightningElement } from 'lwc';
import moment from '@salesforce/resourceUrl/moment';
import { loadScript } from 'lightning/platformResourceLoader';
export default class MomentStuffs extends LightningElement {
renderedCallback(){
Promise.all([
loadScript(this, moment + '/moment.js')
]).then(() => {
@jsmithdev
jsmithdev / lambda-s3-trigger.js
Last active May 15, 2019 00:41
lambda-s3-trigger.js - to be triggered off an S3 CRED action like create. Set env var HOSTNAME to the hostname of where you want to send the file's metadata when action occurs.
const hostname = process.env.HOSTNAME
const https = require('https')
exports.handler = (event, context, callback) => {
const data = JSON.stringify({ records: event.Records })
const opts = {
@jsmithdev
jsmithdev / .gitignore
Created May 11, 2019 00:18
.gitignore for ignoring _most_ files / dirs via stackoverflow.com/q/987142
# Ignore everything
*
# But not these files...
!.gitignore
!script.pl
!template.latex
# etc...
# ...even if they are in subdirectories
@jsmithdev
jsmithdev / LWC_META.js-meta.xml
Created April 15, 2019 22:37
Example LWC metadata xml file to pull into vs code.
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="urn:metadata.tooling.soap.sforce.com" fqn="LWC_NAME">
<apiVersion>45.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>LWC_NAME</masterLabel>
<description>LWC_DESC</description>
<targets>
@jsmithdev
jsmithdev / generatepkgXML.sh
Created April 4, 2019 22:14 — forked from msrivastav13/generatepkgXML.sh
Generates package.xml from the Unmanaged container/Managed Package or Changesets
#!/bin/bash
if [ $# -lt 1 ]
then
echo Usage: generatepkgXML.sh orgalias packageName
exit
fi
## Retrieve the PackageXML from Unmanaged Container
@jsmithdev
jsmithdev / NativeToast.css
Created April 4, 2019 14:27
Toast / send messages to users with no dependencies.
.toaster {
font-family: inherit;
display: none;
background: lightblue;
padding: 1rem;
border-radius: 5px;
max-width: 75%;
margin: 0 auto;
cursor: pointer;
}
@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 / ForcecodeCommonIgnore.txt
Created January 16, 2019 16:51
Common .gitignore for vs code + forcecode extension + history, etc
.forceCode
.history
.sfdx
.vscode
force.json
sfdx-project.json
scratch.js