Skip to content

Instantly share code, notes, and snippets.

View mhamzas's full-sized avatar

Hamza Siddiqui mhamzas

View GitHub Profile
@mhamzas
mhamzas / ant-salesforce.xml
Created November 4, 2021 10:15 — forked from afawcett/ant-salesforce.xml
Defines some macros around sf:deploy to install and uninstall packages.
<!-- TODO: Review Ant v1.8 local properties -->
<project xmlns:sf="antlib:com.salesforce">
<!-- Download from Salesforce Tools page under Setup -->
<typedef
uri="antlib:com.salesforce"
resource="com/salesforce/antlib.xml"
classpath="${basedir}/lib/ant-salesforce.jar"/>
<!-- Download from http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/ -->
@mhamzas
mhamzas / countries
Created October 7, 2021 21:51 — forked from kalinchernev/countries
Plain text list of countries
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua & Deps
Argentina
Armenia
Australia
Austria
@mhamzas
mhamzas / gist:627018c23de6ae60e8e6c245c8083575
Created July 8, 2021 09:33 — forked from 480/gist:3b41f449686a089f34edb45d00672f28
MacOS X + oh my zsh + powerline fonts + visual studio code terminal settings

MacOS X + oh my zsh + powerline fonts + visual studio code (vscode) terminal settings

Thank you everybody, Your comments makes it better

Install oh my zsh

http://ohmyz.sh/

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@mhamzas
mhamzas / package.xml
Created July 1, 2021 08:12 — forked from shanerk/package.xml
Salesforce package.xml file to get all metadata from your org. Works great with vscode and cli.
<?xml version="1.0" encoding="UTF-8" ?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>ApexClass</name>
</types>
<types>
<members>*</members>
<name>ApexComponent</name>
</types>
@mhamzas
mhamzas / gist:039f865e242e7f20b1947e88a32fe7be
Created May 28, 2021 12:09 — forked from nicocrm/gist:858086
SalesForce Apex CSV Parser
/**
* Used to read a delimited file.
*/
public class SSSCsvReader {
private String delim = ',';
// the input data
private String[] buffer;
public SSSCsvReader(String data){
this.buffer = data.split('\n');
@mhamzas
mhamzas / InvocableApexTemplate.cls
Created March 25, 2021 15:22 — forked from douglascayers/InvocableApexTemplate.cls
Example structure of an invocable apex class
public with sharing class InvocableApexTemplate {
@InvocableMethod(
label = 'Name as displayed in Process Builder'
description = 'Tooltip as displayed in Process Builder'
)
public static List<Response> execute( List<Request> requests ) {
List<Response> responses = new List<Response>();
@mhamzas
mhamzas / AccountPage.vfp
Created March 11, 2021 06:55 — forked from douglascayers/AccountPage.vfp
Example Visualforce page that displays the Classic Attachments and Salesforce Files related lists.
<apex:page standardController="Account">
<!-- classic attachments related list -->
<apex:relatedList subject="{!account.id}" list="CombinedAttachments" />
<!-- new salesforce files related list -->
<apex:relatedList subject="{!account.id}" list="AttachedContentDocuments" />
</apex:page>
@mhamzas
mhamzas / UpdateFieldAction.cls
Created March 10, 2021 08:21 — forked from SalesforceBobLightning/UpdateFieldAction.cls
Generic InvocableMethod for updating a field on an object from Salesforce Process Builder
public class UpdateFieldAction {
@InvocableMethod(
label='Update Field Action'
description = 'Update a field on another object'
)
public static void updateFields(List<Request> requests) {
for(Request request : requests){
updateField(request);
@mhamzas
mhamzas / find_values.js
Created November 20, 2020 06:14 — forked from shakhal/find_values.js
Find values in JSON by key, recursively
function findValues(obj, key){
return findValuesHelper(obj, key, []);
}
function findValuesHelper(obj, key, list) {
if (!obj) return list;
if (obj instanceof Array) {
for (var i in obj) {
list = list.concat(findValuesHelper(obj[i], key, []));
}
@mhamzas
mhamzas / BatchGrantPermissionSet.cls
Created October 6, 2020 10:53 — forked from gbutt/BatchGrantPermissionSet.cls
Grant Permission Set or Permission Set Group to Users in Batch Apex
/**
* Assigns a permission set or permission set group to all user with the specified profile.
* Additional filter criteria can be passed in if the users needs filtered further.
* Example: Only assign permission set to community users on the Salesforce account
* String filter = 'Contact.Account.Name = \'Salesforce\'';
* BatchGrantPermissionSet('Community User Profile', 'Salesforce_Account_Privs', filter);
*/
public class BatchGrantPermissionSet implements Database.Batchable<sObject> {
String query {get; set;}