Skip to content

Instantly share code, notes, and snippets.

View emoran's full-sized avatar
:octocat:
Developing

Edgar Moran emoran

:octocat:
Developing
View GitHub Profile
@emoran
emoran / AccountApprovalClone.page
Created March 11, 2022 15:15
Approval History Clone for Salesforce Account. Allows to show the Approval History for an Object.
<apex:page standardController="Account" extensions="AccountApprovalCloneExtension" >
<apex:pageBlock title="Approval History Clone">
<table class="list" border="0" cellspacing="0">
<tbody>
<tr class="headerRow">
<th class="actionColumn" scope="col">Action</th>
<th scope="col" class=" zen-deemphasize">Date</th>
<th scope="col" class=" zen-deemphasize">Status</th>
<!--<th scope="col" class=" zen-deemphasize">Assigned To</th>-->
@emoran
emoran / JWTGenerator.java
Last active March 19, 2024 02:12
Generares a Signed JWT token based on RSA private key pulled from local file
package com.emoran;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.Signature;
@emoran
emoran / gist:9073623
Created February 18, 2014 15:53
c# FTP Controller
using System.Diagnostics;
using System.Data;
using System.Collections;
using Microsoft.VisualBasic;
using System.Collections.Generic;
using System;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
@emoran
emoran / munitReadFile
Created September 25, 2023 20:38
MUnit : Payload value from resources folder
output application/java --- readUrl('classpath://sample_data/gsheet_date.json')
@emoran
emoran / flattenScatterGather.dw
Created September 22, 2023 19:16
Flatten payload after Scatter Gather DW 2.0
%dw 2.0
output application/java
---
flatten(valuesOf(payload) map ((item, index) -> item.*payload))
@emoran
emoran / Deserialize with wrapper
Created June 23, 2015 03:37
Deserialize JSON to the exact Wrapper class structure
public class cl_pruebas {
public cl_pruebas() {
}
public void init(){
String my_json='{"account":"01ti0000006s5I4AAI","products":[{"id":"01ti0000006s5I8AAI","qty":"8","price":"1.00","name":"cebolla cambray c/rabano"},{"id":"01ti0000006s5I4AAI","qty":"10","price":"1.00","name":"carambola"}]}';
//Deserialize from the original type, in this case Object
@emoran
emoran / UnZip.java
Created February 11, 2020 23:06
Allows Mulesoft to unzip an InputStream file (.zip) and store the content files on a Array list
package com.moran;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@emoran
emoran / googleMapsPoligonsInteresection1.txt
Last active June 12, 2023 15:43
Create polygons and check if they are intersecting each other
<apex:page showHeader="true" sidebar="true">
<style>
#map-canvas {
width:100%;
height:500px;
}
#map_canvas {
width:100%;
height:500px;
}
public class RestServiceConsumerDW {
public static void consume(){
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://techcrunch.com/wp-json/wp/v2/posts?per_page=2&context=embed');
request.setMethod('GET');
HttpResponse response = http.send(request);
// If the request is successful, parse the JSON response.
if(response.getStatusCode() == 200) {
@emoran
emoran / anagramGrouped.apex
Created October 23, 2022 16:27
Group Anagram words in Salesforce Apex.
List<String> listWords = new List<String>{'bored','robed','cat','act','tac','eme'};
Map<String,List<String>> mapWords = new Map<String,List<String>>();
for(String word: listWords){
List<String> splittedWord = word.split('');
splittedWord.sort();
String wordNew = '';
for(String newWord:splittedWord){