Skip to content

Instantly share code, notes, and snippets.

View olopsman's full-sized avatar

Paulo Orquillo olopsman

View GitHub Profile
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${basedir}/ant-contrib-1.0b3.jar"/>
<project name="Retrieve and Deploy SFDC metadata" default="sfdcDetails" basedir="." xmlns:sf="antlib:com.salesforce">
<property file="${basedir}/environments/${environment}.properties"/>
<condition property="sf.username" value=""> <not> <isset property="sf.username"/> </not> </condition>
<condition property="sf.password" value=""> <not> <isset property="sf.password"/> </not> </condition>
<condition property="sf.sessionId" value=""> <not> <isset property="sf.sessionId"/> </not> </condition>
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${basedir}/ant-contrib-1.0b3.jar"/>
<taskdef resource="com/salesforce/antlib.xml" uri="antlib:com.salesforce">
<classpath>
<pathelement location="${basedir}/ant-salesforce.jar" />
</classpath>
.background(EmptyView().sheet(isPresented: $showAdd){
Text("Add Page")
})
.background(EmptyView().sheet(isPresented: $showSettings){
Text("Settings Page")
})
<lightning:input aura:id="Bank_Account_Name__c" label="Bank Account Name" value="{!v.request.Bank_Account_Name__c}" required="true"/>
({
init: function (component, event, helper) {
//helper.fetchData(component, helper);
},
submitRequestBtn: function(component, event, helper) {
var bankName = component.find("Bank_Account_Name__c");
bankName.reportValidity();
var bankNo = component.find("Bank_Account_Number__c");
bankNo.reportValidity();
bankNo.setCustomValidity("Invalid Bank No format. Should be in the following format 00-1234-1234567-000");
<aura:component description="SetDirectDebitComponent" implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global">
<aura:attribute name="bankList" type="String[]" default="['ANZ Bank','ASB Bank Limited','Bank of New Zealand','Credit Union','HSBC','Kiwibank Limited','The Co-operative Bank','TSB Bank Limited','Westpac','Other']"/>
<aura:attribute name="selectedBank" type="String"/>
<aura:attribute name="request" type="Account"
default="{ 'sobjectType': 'Account',
'Bank_Account_Name__c' : '',
'Bank_Account_Number__c' : '',
}" access="global"/>
<!-- handlers-->
<aura:handler name="init" value="{! this }" action="{! c.init }"/>
@olopsman
olopsman / scraper-regex.py
Created October 13, 2019 09:41
Sample Python regex
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
def crawl_url(pageUrl):
main_url = "http://books.toscrape.com/"
url = main_url + pageUrl
html = urlopen(url)
soup = BeautifulSoup(html, "html.parser")
try:
@olopsman
olopsman / RegexApexSample.cls
Created October 13, 2019 09:39
Regex eg in Apex
public class RegexApexSample {
//Removes whitespaces not found in quotes
private String removeWhiteSpace(String strSample) {
String regexpStr = '\\s+(?=([^"]*"[^"]*")*[^"]*$)';
try {
Pattern myPattern = Pattern.compile(regexp);
strSample = myPattern.matcher(strSample).replaceAll('');
} catch (Exception e){
system.debug('## regex pattern =>' + regexpStr + ' - '+ e.getMessage()+' ' e.getStackTraceString());
}
public void execute(QueueableContext context) {
// Awesome processing logic here
// Chain this job to next job by submitting the next job
System.enqueueJob(new SecondJob());
}
// find all accounts in ‘NY’
List accounts = [select id from account where billingstate = ‘NY’];
// find a specific parent account for all records
Id parentId = [select id from account where name = 'ACME Corp'][0].Id;
// instantiate a new instance of the Queueable class
MyQueueableClass accountUpdateJob = new MyQueueableClass(accounts, parentId);
// enqueue the job for processing
ID jobID = System.enqueueJob(accountUpdateJob);