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
@justin-lyon
justin-lyon / MyConfigProps.java
Last active October 5, 2020 20:09
Access @ConfigurationProperties from a ClientHttpRequestInterceptor implementation?
@Configuration
@ConfigurationProperties(prefix = "myprops")
public class MyConfigProps {
@NotBlank
private String prop1;
// ...get/set
}
@justin-lyon
justin-lyon / swagger-codegen-for-cheaters.md
Created September 30, 2020 00:37
swagger codegen instructions
@justin-lyon
justin-lyon / create-jks.md
Created August 14, 2020 17:46
Create a .jks file from a .key / .cert pair.

Create a Java Keystore file from a .key/.cert pair

Input your key and cert to create a cert.pfx file with the password "src-passwordForCert.pfx"

openssl pkcs12 -export -out cert.pfx -inkey server.key -in server.crt -password pass:src-passwordForCert.pfx

Convert cert.pfx to a .jks file. This command will prompt you to create a new password for the .jks (destination), then it will ask you for the password to cert.pfx (source).

keytool -importkeystore -srckeystore cert.pfx -destkeystore nb-data-services.jks -srcstoretype pkcs12

@justin-lyon
justin-lyon / sfRestAxios.js
Created July 22, 2020 20:56
Sample Axios Config
const authBearer = `Authorization: Bearer ${token}`
const baseURL = 'https://my-domain.my.salesforce.com/services/data/v49.0/sobjects'
const contactsApi = axios.create({
baseURL: `${baseURL}/contact`,
timeout: 1000,
headers: { authBearer }
})
const contactId = ''

Bug in LWC Specialist, Challenge 4

Error screen cap, followed by code sample.

Completing LWC Trailhead challenges is incredibly painful when your style guide doesn't match the Challenge's.

challeng error

 // Fires event that the search option has changed.
@justin-lyon
justin-lyon / aura-toaster.js
Last active July 1, 2020 21:19
I had an idea for a fluent toaster api.
(function Toaster() {
let mode = 'dismissible'
const setMode = newMode => {
mode = newMode
}
const fireToast = (title, message, iconName, styleType) => {
console.log('begin fire mode', mode)
const toast = $A.get("e.force:showToast")
@justin-lyon
justin-lyon / expSubscriber.html
Last active June 19, 2020 20:18
Trying to get the LMS demo working in a scratch
<template>
<div>
<button onclick={subscribeMC}>Subscribe</button>
</div>
<div>
<button onclick={unsubscribeMC}>Unsubscribe</button>
</div>
</template>
@justin-lyon
justin-lyon / numberField.js
Created May 2, 2020 05:42
an input number web component
class NumberField extends HTMLElement {
static get observedAttributes () {
return [ 'label', 'value' ]
}
constructor () {
super()
const template = document.createElement('template')
template.innerHTML = `
public class CSVBatch implements Database.Batchable<PolicyMaster__c>, Database.AllowsCallouts, Database.Stateful {
private CSVState state;
private Integer scopeSize;
public CSVBatch (CSVState state) {
this.state = state;
}
public Database.QueryLocator start (Database.BatchableContext ctx) {
return Database.getQueryLocator([
public class CSVQueueable implements Queueable, Database.AllowsCallouts {
// Read in the CSV to a List<CSVRow>
// Persist the execution state across Async Queuable and Batch
private CSVState state;
// Count of Unique Policy Numbers to aggregate from the CSV
private Integer csvChunkSize;
public CSVQueueable (CSVState state) {
this(state, 1000);