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 / Redux
Last active November 14, 2021 17:23
React React
[react-redux-typescript-guide](https://github.com/piotrwitek/react-redux-typescript-guide)
[FAQ](http://redux.js.org/docs/FAQ.html)
[Redux Actions in typescript](https://spin.atomicobject.com/2017/07/24/redux-action-pattern-typescript/)
```typescript
export enum TypeKeys {
INC = 'INC',
DEC = 'DEC',
OTHER_ACTION = '__any_other_action_type__'
}
@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 {
//Author: Charlie Jonas (charlie@callawaycloudconsulting.com)
// Description: Class is use for creating mock http callouts in test methods.
// See http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_restful_http_testing_httpcalloutmock.htm
// for info on how to use class.
@isTest
global class MockHttpResponseGenerator implements HttpCalloutMock {
//require properites
private Map<String,String> responseMap = new Map<String,String>();
@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"