Skip to content

Instantly share code, notes, and snippets.

Avatar

Christian Szandor Knapp Szandor72

View GitHub Profile
View Apex XML2JSON.cls
String xml2json(String xml) {
XmlStreamReader reader = new XmlStreamReader(xml);
reader.setCoalescing(true);
//skip START_DOCUMENT
reader.nextTag();
JsonGenerator g = Json.createGenerator(true);
g.writeStartObject();
@Szandor72
Szandor72 / Pretty Cards for Flow
Created Sep 13, 2018
A rough sketch how to make individual fields pretty in a flow using a lightning card
View Pretty Cards for Flow
<aura:component implements="lightning:availableForFlowScreens" access="global">
<aura:attribute name="valueProvidedByFlow" type="String" />
<aura:attribute name="labelForValue" type="String" />
<aura:attribute name="type" type="String" description="currency, decimal, text supported"/>
<aura:attribute name="icon" type="String" default="standard:account" description="any icon from slds"/>
<lightning:card iconName="{!v.icon}" >
<aura:set attribute="title">
{!v.labelForValue}
<aura:if isTrue="{!v.type == 'currency'}">
@Szandor72
Szandor72 / Pretty Cards for Flow
Created Sep 13, 2018
A rough sketch how to make individual fields pretty in a flow using a lightning card
View Pretty Cards for Flow
<aura:component implements="lightning:availableForFlowScreens" access="global">
<aura:attribute name="valueProvidedByFlow" type="String" />
<aura:attribute name="labelForValue" type="String" />
<aura:attribute name="type" type="String" description="currency, decimal, text supported"/>
<aura:attribute name="icon" type="String" default="standard:account" description="any icon from slds"/>
<lightning:card iconName="{!v.icon}" >
<aura:set attribute="title">
{!v.labelForValue}
<aura:if isTrue="{!v.type == 'currency'}">
View sfdx-project.json
{
"packageDirectories": [
{
"path": "myChangeSetName",
"default": true,
"package": "myChangeSetName"
}
],
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
View project-scratch-def.json
{
"edition": "Enterprise",
"features" : ["ExpandedSourceTracking"],
"orgPreferences" : {
"enabled" : [
"S1DesktopEnabled",
"Translation",
"PathAssistantsEnabled"
],
"disabled" : [
View JSONObject
public class JSONObject {
public class JSONObjectException extends Exception {}
public static String NAMESPACEPREFIX {
get {
if (namespacePrefix == null) {
namespacePrefix = JSONObject.class.getName().substringBefore('.JSONObject');
namespacePrefix = namespacePrefix.length() > 0 && namespacePrefix != 'JSONObject' ? namespacePrefix + '__' : '';
}
return namespacePrefix;
View Override.cmp
// cmp
<aura:component access="global" implements="lightning:actionOverride,force:hasRecordId,force:hasSObjectName,lightning:isUrlAddressable"
description="proof of concept cmp">
<aura:attribute name="contextId" type="String"/>
<aura:attribute name="windowURL" type="String"/>
<aura:handler name="init" value="this" action="{!c.init}"/>
<lightning:card title="Details">
<div class="slds-p-around_medium">
<p>RecordId (should be empty for new action): <b>{!v.recordId}</b></p>
View uncrustify.cfg
# Uncrustify 0.60
#
# General options
#
# The type of line endings
newlines = auto # auto/lf/crlf/cr
# The original size of tabs in the input
@Szandor72
Szandor72 / README.md
Created Aug 10, 2017 — forked from mattandneil/build.xml
Salesforce Organization Destroy - Ant Script
View README.md

Salesforce Organization Destroy - Ant Script

This script searches and destroys (most) metadata in an organization. Use cases include ISV package development and testing within Developer Edition and Sandbox environments.

Usage: (paste the macrodef XML into your build file)

<target name="destroy">
    <destroy
 username="${sf.username}"
@Szandor72
Szandor72 / challenge.js
Last active Mar 23, 2021
A tiny coding challenge
View challenge.js
// Given
let array = [0, 1, 2, 3, 4, 5, 6];
let elementsToMove = [2, 3, 4];
// Tasks
// 1)
// Given an arbitrary new index, re order the array so that
// elementsToMove is moved to the correct position