Skip to content

Instantly share code, notes, and snippets.

View matthewholliday's full-sized avatar

Matthew Holliday matthewholliday

  • Liveops
  • Phoenix, Arizona
View GitHub Profile
@matthewholliday
matthewholliday / mergField.html
Created April 15, 2017 03:35
concatenate hidden input value with url
<html>
<head>
<script type='text/javascript'>
function clickyClick() {
url = 'https://cei.org' + document.getElementById("contactid").value;
//cei.org used here for example
window.open(url, '_blank');
}
</script>
</head>
@matthewholliday
matthewholliday / .gitignore
Created March 26, 2019 20:57
.gitignore for DX Projectsi IntelliJ
.DS_Store
.sfdx
.project
.salesforce
.settings
node_modules
.idea
@matthewholliday
matthewholliday / ramdomizer_script.cls
Last active April 22, 2019 17:03
Get Random Records in Apex
Integer sampleSize = 50;
//Testing functions by printing out names from sample db.
List<Contact> population = [SELECT LastName FROM Contact LIMIT 1000];
List<Contact> sample = getContactSample(population,sampleSize);
System.debug('sample size: ' + sample.size());
for(Contact sampledContact : sample){
System.debug('Contact: ' + sampledContact.LastName);
}
public List<Contact> getContactSample(List<Contact> population, Integer sampleSize){
List<Contact> sample = new List<Contact>();
@matthewholliday
matthewholliday / remove_files.sh
Last active May 27, 2019 20:59
Remove all files with a given extension in subdirectories
find . -name "*.txt" -type f -delete
@matthewholliday
matthewholliday / mdapi_retrieve.sh
Created May 27, 2019 21:04
Retrieve Metadata from traditional Salesforce Org with DX.
sfdx force:mdapi:retrieve -u MySandboxName -r target_dir -k unpackaged/package.xml --wait 100
@matthewholliday
matthewholliday / mdapi_convert.sh
Last active May 27, 2019 21:25
Convert traditional metadata to DX metadata.
sfdx force:mdapi:convert --rootdir target_dir/unpackaged --outputdir force-app
@matthewholliday
matthewholliday / sys_exit.asm
Last active December 5, 2023 15:40
ASSEMBLY SYS_EXIT
section .data
section .text
global _start
exit:
mov ebx, 0 ; return 0 status on exit - 'No Errors'
mov eax, 1 ; invoke SYS_EXIT (kernel opcode 1)
int 80h
@matthewholliday
matthewholliday / calculate_string_length.asm
Created October 20, 2019 00:33
ASSEMBLY Calculate String Length
section .data
msg db 'This is a test message.',0Ah
SECTION .text
global _start
_start:
mov ebx, msg
mov eax, ebx
@matthewholliday
matthewholliday / fetch_data_await_async.js
Created November 20, 2021 03:43
Use fetch with await/async in react
const [testData,setTestData] = useState({message : "abc"});
useEffect(() => {
async function setData(){
const response = await fetch('http://localhost:8080/test');
const parsedData = await response.json();
setTestData(parsedData);
setData();
},[]);
@matthewholliday
matthewholliday / fetch_data_promise.js
Created November 20, 2021 03:47
Fetch data from API using promises in react
const [testData,setTestData] = useState({message : "abc"});
useEffect(() => {
async function setData(){
fetch('http://localhost:8080/test').then(
response => { response.json(); }
).then(
response => { setTestData(response); }
);