Skip to content

Instantly share code, notes, and snippets.

View justin-lyon's full-sized avatar

Justin Lyon justin-lyon

  • Daejeon, South Korea
View GitHub Profile
/************************************************************
*** @author: Suraj Pillai
*** @description: A universal class for mocking in tests. Contains a method for setting the return value for any method. Another method returns the number of times a method was called
*/
@isTest
public with sharing class UniversalMocks implements System.StubProvider {
public static Map<String, Object> returnValuesMap = new Map<String, Object>();
public static Map<String, Integer> callCountsMap = new Map<String, Integer>();
@rsoesemann
rsoesemann / HttpMock.cls
Last active June 1, 2021 13:20
apex-http-mock
@IsTest
public class HttpMock implements HttpCalloutMock {
private static final String ANY_URL = null;
private Map<String, Map<String, Object>> responses = new Map<String, Map<String, Object>>();
// PUBLIC
@surajp
surajp / CSVColIterator.cls.java
Created April 10, 2020 00:12
CSV Column Iterator
public class CSVColIterator implements Iterator<String> {
private String colDelimiter=',';
private String textQualifier='"';
private String row='';
private Integer currentIndex=0;
public CSVColIterator(String row){
this.row = row;
}
@gbutt
gbutt / BatchGrantPermissionSet.cls
Created February 8, 2020 15:57
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;}
@surajp
surajp / webpack.config.js
Created November 6, 2019 21:20
basic webpack config
const path = require('path');
module.exports = {
mode: "production",
entry: "./src/index",
output: {
// options related to how webpack emits results
path: path.resolve(__dirname, "dist"), // string
// the target directory for all output files
// must be an absolute path (use the Node.js path module)
@gdoenlen
gdoenlen / AccountSelector.cls
Last active October 19, 2023 11:42
Simple dependency injection within SFDC
/**
* Selector for the `Account` entity
*/
public class AccountSelector {
public static final AccountSelector INSTANCE = new AccountSelector();
/**
* Finds all accounts that are child accounts of
* the given opportunity's account.
def multiply(*numbers):
total = 1
for number in numbers:
total *= number
return total
print("start")
print(multiply(1, 2, 3))
print("finish")

NOT UP TO DATE!

Things in this document might not work or be broken nowadays

my laptop:

I'm writing this here because a few things in here are spesific to this model laptop.
Dell XPS 15 9560 (4k) touch screen

Some notes:

Most things after setup are not specific for this laptop
# = run as root

@justin-lyon
justin-lyon / ssh-cheatsheet
Last active August 3, 2020 14:17
ssh cheatsheet
# generate rsa key-pair without password (-N) with comment (-C) and name (-f)
ssh-keygen -t rsa -b 4096 -N "" -C "userName localName remoteName" -f keyName
# windows bash
# activate ssh-agent in windows bash
eval $(ssh-agent -s)
# list registered ssh keys - these keys are cached by the agent so you only need to enter pw once
ssh-add -l
@ummahusla
ummahusla / git-overwrite-branch.sh
Last active May 20, 2024 16:27 — forked from brev/git-overwrite-branch.sh
Git overwrite branch with another branch
# overwrite master with contents of feature branch (feature > master)
git checkout feature # source name
git merge -s ours master # target name
git checkout master # target name
git merge feature # source name