Skip to content

Instantly share code, notes, and snippets.

View maxbisesi's full-sized avatar
♦️

Max Bisesi maxbisesi

♦️
  • Scottsdale
View GitHub Profile
@maxbisesi
maxbisesi / PrimeFactorizationWithflatMap.js
Created January 2, 2024 01:41
Prime Factorization with flatMap
// ======================
// Prime factorization with flatMap
//======================
// flatMap can be used as a way to add and remove items (modify the number of items) during a map.
// In other words, it allows you to map many items to many items (by handling each input item separately), rather than always one-to-one.
// it works like the opposite of filter.
var numbersTofactor = [20,1,17,2,3,15,16,100,157];
var factors = numbersTofactor.flatMap((n) => {
var allFactors = [];
@maxbisesi
maxbisesi / PDFManager.js
Last active April 22, 2022 22:48
SF Auto PDF parser
Then(`the downloaded PDF Document contains the following values:`, async (dataTable) => {
dataTable = await Utils.processDataTable(dataTable);
for(let i = 0; i < 5; i++) {
if(testData.pdfText !== undefined){
break;
}
await Browser.sleep(500);
}
for(const line of dataTable) {
if(testData.pdfText.includes(line)) {
@maxbisesi
maxbisesi / ConcurrentPublicLibrary.java
Last active July 19, 2017 16:18
Shows the proper concurrent use of a LinkedTransferQueue
public class Hello {
public static void main(String[] args){
Library library = new Library();
new Thread(library).start();
new Thread(new Renter(library,"Mike")).start();
new Thread(new Renter(library,"Max")).start();
new Thread(new Renter(library,"Priebe")).start();