Skip to content

Instantly share code, notes, and snippets.

View hugohernandezfcc's full-sized avatar

Hugo Hernández hugohernandezfcc

View GitHub Profile
@hugohernandezfcc
hugohernandezfcc / navbar.json
Last active January 27, 2024 08:47 — forked from SanBran/navbar.json
Json de estructura general para menu
{
"data":
{
"lang": "es",
"menu":
{
"name": "Menu",
"urlPublicImage": "/images/newIconography/caballeroaguila.svg",
"urlPublicMobileImage": "/images/newIconography/Caballero_Aguila_alone.svg",
"urlPublicTabletImage": "/images/newIconography/Caballero_Aguila_alone.svg",
@hugohernandezfcc
hugohernandezfcc / Heroku export import settings
Created May 2, 2022 09:35 — forked from jrichardsz/Heroku export import settings
Heroku: Copying environment variables from an existing app to another
1. Export existing app’s variables to config.txt
heroku config -s -a existing-heroku-app > config.txt
2. Review and push to another app
cat config.txt | tr '\n' ' ' | xargs heroku config:set -a new-heroku-app
@hugohernandezfcc
hugohernandezfcc / getFieldsFromLayout.cls
Last active November 4, 2020 19:43
Method to get fields from each page layout.
public static List<string> getFields( string objName,string layout ) {
String pageLayout=String.format('{0}-{1}', new String[]{objName, layout});
List<Metadata.Metadata> objlayouts = Metadata.Operations.retrieve(Metadata.MetadataType.Layout, new List<String> {
pageLayout
}
);
List<string> fields=new List<string>();
Metadata.Layout layoutMd = (Metadata.Layout)objlayouts.get(0);
@future(callout=true)
public static void SMSCallout(String body, String toNumber, String lang){
SmsPocTwilio__c customSettingPOC = SmsPocTwilio__c.getInstance();
System.debug('I am executing');
System.debug(customSettingPOC);
@hugohernandezfcc
hugohernandezfcc / .cls
Created October 15, 2019 07:41
Get translation of a custom label using apex-mdapi.
public static MetadataService.MetadataPort createService(){
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
return service;
}
MetadataService.MetadataPort service = createService();
@hugohernandezfcc
hugohernandezfcc / .cls
Created August 8, 2019 06:36
csv file httprequest not work
public class JSONMSAccess {
public String token_type;
public String expires_in;
public String ext_expires_in;
public String expires_on;
public String not_before;
public String resource;
public String access_token;
@hugohernandezfcc
hugohernandezfcc / Share_Blob_through_WBS.apex
Created August 7, 2019 17:54
Code to share an Image with a HttpRequest. Share Blob through WBS
String body = '';
String boundary = 'ContentThatShouldNotAppearInTheBody';
Map<String, String> params = new Map<String, String> {
'flowIdentifier'=>'1',
'flowFilename'=>'test.jpg',
'flowTotalSize'=>'14893',
'flowCurrentChunkSize'=>'14893',
'flowChunkSize'=>'14893',
'flowChunkNumber'=>'1',
'flowTotalChunks'=>'1' };
@hugohernandezfcc
hugohernandezfcc / alertReactNative.js
Created May 9, 2019 22:58
Gist To Create an Alert in react native with more than two options.
Alert.alert(
'Confirmation',
'Are you sure logout?',
[
{ text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
{ text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
{ text: 'OK', onPress: () => this.props.navigation.dispatch(StackActions.reset({
index: 0,
actions: [NavigationActions.navigate({ routeName: 'Home' })],
})) },
@hugohernandezfcc
hugohernandezfcc / Save org and Login from terminal
Last active April 2, 2019 21:22
Save in SFDX sessions of your orgs Salesforce and make a login from terminal.
# Set an alias and login on your production Org
sfdx force:auth:web:login --setalias "ORGNAME" --setdefaultusername
#OR
# The same process but with an additional parameter you can login on sandbox enviroment
sfdx force:auth:web:login --setalias "ORGNAME" --setdefaultusername --instanceurl https://test.salesforce.com
@hugohernandezfcc
hugohernandezfcc / How create a lightning component from sfdx
Last active July 19, 2019 23:28
How create a lightning component from sfdx
####################################################################
######## From your folder project run the following command ########
####################################################################
# navigate to aura folder
cd force-app/main/default/aura
# Create a Lightning component
sfdx force:lightning:component:create --type aura -n myAuraComponent