Skip to content

Instantly share code, notes, and snippets.

View justin-lyon's full-sized avatar

Justin Lyon justin-lyon

  • Daejeon, South Korea
View GitHub Profile
# List the entries in the jks file - Look for Aliases
keytool -list -v -keystore <myfile.jks> -storepass <myjkspassword>
# Extract PEM file from JKS by Alias
keytool -export -alias <targetAlias> -keystore <myfile.jks> -storepass <myjkspassword> -file <mynewfile>.pem
# print .pem file contents
keytool -printcert -file <myfile>.pem

SFDX Cheatsheet

SFDX Commands are workspace specific. When running commands in the terminal, the commands are running within the terminal's current directory. I recommend setting up a /workspace folder that can hold all of your various projects. Salesforce or otherwise.

The Salesforce CLI Command Reference

Contents

  • Create a new Project
  • Create a new SFDX Project
@justin-lyon
justin-lyon / lwc-chain-wires.js
Last active October 27, 2019 06:32
chain multiple wire adapters together to get picklist values dynamically by SObject and Field Name.
@wire(getObjectInfo, { objectApiName: ACCOUNT_OBJECT })
objectInfo;
@wire(getPicklistValues, { recordTypeId: '$objectInfo.defaultRecordTypeId', fieldApiName: 'Industry__c'})
propertyOrFunction;
// *** WIP
import { LightningElement, wire } from 'lwc'
import { getObjectInfo, getPicklistValues } from 'lightning/uiObjectInfoApi'
import ACCOUNT from '@salesforce/schema/Account'
const MASTER_RT = '012000000000000AAA'
@justin-lyon
justin-lyon / dragon-array.prototype.js
Last active December 11, 2023 11:16
Array.prototype and Iterators fun with Dragons.
// Here are some handy Array.prototype methods.
// Also known as higher order functions.
// An Array of Dragon objects for us to work with.
const dragons = [
{ name: 'Fluffykins', color: 'red', size: 'tiny', type: 'fire' },
{ name: 'Puff', color: 'purple', size: 'medium', type: 'time' },
{ name: 'Randy', color: 'green', size: 'small', type: 'nature' },
{ name: 'Smaug', color: 'black', size: 'large', type: 'fire' },
{ name: 'Draco', color: 'green', size: 'medium', type: 'fire' },
@justin-lyon
justin-lyon / UtilityItem.cmp
Created October 25, 2019 14:43
lightning:utilityBarAPI testing
<aura:component description="NewCaseUtilityItem"
implements="lightning:utilityItem, force:hasRecordId"
access="global">
<lightning:utilityBarAPI aura:id="utilityBar" />
<aura:attribute name="utilityItemId" type="String" default="" />
<aura:attribute name="isActive" type="Boolean" default="false" />
<aura:attribute name="activeRecordId" type="Id" default="" />
<aura:component description="TokenContainer"
implements="flexipage:availableForAllPageTypes"
access="global">
<div class="aura-box">
Aura, colorBackgroundWarning
</div>
<div class="slds-box">
<div>Aura > LWC</div>
@justin-lyon
justin-lyon / steam-wallet.js
Last active December 21, 2019 04:30
Scrape steam transaction history table to get total $$$ spent
/**
* 1. Login to Steam and browse your history here:
* https://store.steampowered.com/account/history/
*
* 2. Make sure to "Load More" at the bottom so you get'em all
*
* 3. Add this script in chrome console to see your total paid
* (F12 to open console in Chrome, Click on the "console" tab, paste this in, hit enter)
*
* I'm over 1800... :<
@justin-lyon
justin-lyon / sfdc-postMessage.md
Last active March 1, 2021 19:57
Some things I learned about window.postMessage on Salesforce

Salesforce and window.postMessage

I have a visualforce page in lightning console, and I need it to send messages other components in the page. This is troublesome because Salesforce always embeds VF Pages in an iframe, even in classic.

In my research, and from folks in a few different communities I heard about window.postMessage as a possible solution.

I found that the Locker API Viewer did not block it, so I sent about figuring it out.

The following regails my misconceptions and pitfalls along the way.

@justin-lyon
justin-lyon / LightningOut.html
Last active August 4, 2020 20:29
LC4VF with LWC Example
<apex:page>
<apex:includeLightning />
<div id="mount"></div>
<script type="text/javascript">
const myLwcProps = {
prop1: 1,
isSuperAwesomeBool: true
}
@justin-lyon
justin-lyon / psb-diff-to-deploy.sh
Created February 19, 2020 13:31
psb's diff to deploy script
#!/bin/bash
OIFS="$IFS"
IFS=$'\n'
# Salesforce deletes aura component files that were not included in the deployment. So, you have to ensure that you deploy all the files even if only 1 file in a component is changed. Eg: Even if you change just the .cmp file, you still have to deploy the controller, helper, css files, etc.
# Replace f7815723e99 with your commit id
for var in `git diff --diff-filter=ACMRT --name-only 8ef4dc2d9cf2 HEAD`;do if [[ "$var" = *"/aura/"* ]] || [[ "$var" = *"/lwc/"* ]];then tar -rf local/myfiles.tar `dirname "$var"`;else tar -rf local/myfiles.tar "$var";if [ -f "$var-meta.xml" ];then tar -rf local/myfiles.tar "$var-meta.xml";fi;fi;done
cd local
tar -xf myfiles.tar
#Uncomment these lines if you wish to package the source and deploy to an org
#cd local