Skip to content

Instantly share code, notes, and snippets.

Avatar
😃
Working on something amazing...!!

Rahul Malhotra rahulmalhotra

😃
Working on something amazing...!!
View GitHub Profile
@rahulmalhotra
rahulmalhotra / gist:f520d28af6f2573eeef74fa59ff92d48
Last active May 15, 2021
Updated Start method of batch class used in SFDC Stop UNABLE_TO_LOCK_ROW blog
View gist:f520d28af6f2573eeef74fa59ff92d48
public Database.QueryLocator start(Database.BatchableContext bc) {
return Database.getQueryLocator('SELECT Id, Count__c FROM Product_Part__c ORDER BY Product__c');
}
@rahulmalhotra
rahulmalhotra / batch-class-execute.cls
Created May 15, 2021
Execute method of batch class used in SFDC Stop UNABLE_TO_LOCK_ROW blog
View batch-class-execute.cls
public void execute(Database.BatchableContext bc, List<SObject> records) {
List<Product_Part__c> productParts = (List<Product_Part__c>) records;
for(Product_Part__c productPart : productParts) {
productPart.Count__c = 100;
}
update productParts;
}
@rahulmalhotra
rahulmalhotra / batch-class-start.cls
Last active May 15, 2021
Start method of batch class used in SFDC Stop UNABLE_TO_LOCK_ROW blog
View batch-class-start.cls
public Database.QueryLocator start(Database.BatchableContext bc) {
return Database.getQueryLocator('SELECT Id, Count__c FROM Product_Part__c');
}
@rahulmalhotra
rahulmalhotra / classes-part-3.js
Created Feb 21, 2021
This code snippet is used in ES6 Classes JavaScript Tutorial on SFDC Stop
View classes-part-3.js
class Car {
#color
constructor(name, speed, color) {
this.name = name;
this.speed = speed;
this.#color = color;
}
@rahulmalhotra
rahulmalhotra / classes-part-2.js
Created Feb 17, 2021
This code snippet is used in ES6 Classes JavaScript Tutorial on SFDC Stop
View classes-part-2.js
class Car {
constructor(name, speed) {
this.name = name;
this.speed = speed;
}
showSpeed() {
console.log(this.speed);
}
@rahulmalhotra
rahulmalhotra / classes-part-1.js
Created Feb 17, 2021
This code snippet is used in ES6 Classes JavaScript Tutorial on SFDC Stop
View classes-part-1.js
function Car(name, speed) {
this.name = name;
this.speed = speed;
}
Car.prototype.showSpeed = function() {
console.log(this.speed);
}
let audi = new Car('audi', 200);
@rahulmalhotra
rahulmalhotra / spreadoperator-part-5.js
Created Jan 21, 2021
This code snippet is used in ES6 Spread Operator JavaScript Tutorial by SFDC Stop
View spreadoperator-part-5.js
let features = ['Great Speed', 'Good Color', 'Comfort', 'Good Looks'];
let moreFeatures = ['Great Mileage', 'Amazing Design', ...features];
console.log(moreFeatures);
@rahulmalhotra
rahulmalhotra / spreadoperator-part-4.js
Created Jan 21, 2021
This code snippet is used in ES6 Spread Operator JavaScript Tutorial by SFDC Stop
View spreadoperator-part-4.js
let features = ['Great Speed', 'Good Color', 'Comfort', 'Good Looks'];
let moreFeatures = ['Great Mileage', 'Amazing Design'];
features.push(...moreFeatures);
@rahulmalhotra
rahulmalhotra / spreadoperator-part-3.js
Created Jan 21, 2021
This code snippet is used in ES6 Spread Operator JavaScript Tutorial by SFDC Stop
View spreadoperator-part-3.js
// * Rest Parameters
function car(name, ...features) {
console.log('Features of Car ' + name + ' are:- ');
features.forEach(feature => {
console.log(feature);
});
}
car('Audi', 'Great Speed', 'Good Color', 'Comfort', 'Good Looks');
@rahulmalhotra
rahulmalhotra / spreadoperator-part-2.js
Created Jan 21, 2021
This code snippet is used in ES6 Spread Operator JavaScript Tutorial by SFDC Stop
View spreadoperator-part-2.js
function eats(fruit1, fruit2, fruit3) {
console.log('Baby eats :- ', fruit1 + ', ' + fruit2 + ' and ' + fruit3);
}
let fruits = ['apple', 'mango', 'banana'];
eats(...fruits);