Skip to content

Instantly share code, notes, and snippets.

View ChuckJonas's full-sized avatar

Charlie Jonas ChuckJonas

  • Callaway Cloud Consulting
  • wyoming
View GitHub Profile
@ChuckJonas
ChuckJonas / defaultFormats.ts
Created December 22, 2023 06:05
ajv-formats -> typebox
/* Code modified from ajv-formats
https://github.com/ajv-validator/ajv-formats/blob/master/src/formats.ts#L45
MIT License
Copyright (c) 2020 Evgeny Poberezkin
*/
import { FormatRegistry } from "@sinclair/typebox";
export const register = () => {
@ChuckJonas
ChuckJonas / readme.md
Last active October 15, 2021 16:57
Karabiner Elements for OSX keybindings in RDP

setup

  1. Install & run Karabiner-Elements
  2. Navigate to misc-> open config folder
  3. Copy the above rules.json file to the complex_modifications folder
  4. Navigate to Complex Modifications -> Enable Rules
  5. Enable all of the above rules
  6. Under devices enable your keyboard
@ChuckJonas
ChuckJonas / schema-to-type.ts
Created May 8, 2021 07:09
Typescript Examples
const schema = {
uploadDocToValt: { type: 'string' },
foo: { type: 'boolean' },
inner: { type: 'object', object: {
test: {type: 'number'},
innerinner: {type: 'object', object: {
woweee: {type: 'string[]'},
}}
}}
} as const;

Goal

Provide a way to deserailize to a typed apex class, while also accessing any data for keys which were unmapped.

Example:

Apex

class Foo {
@ChuckJonas
ChuckJonas / Stubbing.md
Last active February 13, 2020 23:01
ts-force redesign

interfaces

interface SObject{
  id: string;
  name: string;
  // everything else optional
}

interface ServiceFactory {
@ChuckJonas
ChuckJonas / AccountInsertInvokable.java
Last active October 16, 2019 23:14
Invokable as Interface
// Modeled after example found here: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm
// Expanded to show how an interface might help overcome some of the limits around existing @Invokable implementation
public class AccountInsertInvokable implements Invokable<Account, Id> {
private Boolean allOrNone;
private Boolean logFailures;
// @InvokableSetup this as a configuration point for ProcessBuilder/Flow
// Params Restricted to same types as @InvocableVariable
@InvokableSetup
@ChuckJonas
ChuckJonas / tasks.json
Last active July 11, 2019 19:53
salesforce vscode setup
{
"version": "2.0.0",
"tasks": [
{
"label": "retrieve",
"type": "shell",
"command": "sfdx force:mdapi:retrieve -k deploy/package.xml -r deploy/",
"problemMatcher": []
},
{
@ChuckJonas
ChuckJonas / sfdx-project.json
Last active June 28, 2019 16:57
Mavensmate -> salesforce-vscode Transition Files
{
"packageDirectories": [
{
"path": "src",
"default": true
}
],
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "45.0"
@ChuckJonas
ChuckJonas / LeadCloneWithActivitiesController.apex.java
Last active November 17, 2018 19:04
LeadCloneWithActivitesController
// Author Charlie@callaway.cloud
// Replacement clone page which copies activity history
public with sharing class LeadCloneWithActivitiesController {
private SObjectDeepClone cloner; //cloning util
public Lead clone {get; private set;} //editable lead
public Metadata.Layout leadLayout {get; private set;} //layout
public Metadata.UiBehavior editEnum {
<apex:page tabStyle="Lead" standardController="Lead" extensions="LeadCloneWithActivitiesController" >
<apex:form >
<apex:sectionHeader title="Cloning" subtitle="{!Lead.Name} and Activities ({!clone.Tasks.size + clone.Events.size})" />
<apex:pageBlock title="Lead Clone" tabStyle="Lead" >
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton value="Cancel" action="{!cancel}" />
<apex:commandButton value="Save" action="{!saveClone}" />
</apex:pageBlockButtons>
<apex:outputPanel rendered="{!leadLayout!=null && clone != null}">