citizen_hacks_2019_part3
For the Citizen Hacks 2019 Vim competition
Start file
// Part 3: Finding Sponsors let find_companies = (contacted_companies) => { let new_companies = []; let found = search_google(['privacy_companies', 'security', 'encryptio']); found = found.concat(search_google_maps(['Toronto Tech Companies'])); found = found.concat(search_linkedin(['old_friends', 'new_connections'])); found.forEach((company) => { if(!contacted_companies.has(company)){ new_companies.push(company); } }); return new_companies; } let current_date = Date(); let event_date = Date(2018, 11, 23); let contacted_companies = Set(); while(current_date < event_date){ let companies = find_companies(contacted_companies); // https://stackoverflow.com/questions/5915096/get-random-item-from-javascript-array let selected_company = companies[Math.floor(Math.random()*companies.length)]; request_sponsorship(selected_company); contacted_companies.add(selected_company); }
End file
// Part 3: Finding Sponsors let find_companies = (contacted_companies) => { let new_companies = []; let found = search_google(['Privacy Companies', 'Security', 'Encryption']); found = found.concat(search_google_maps(['Toronto Tech Companies'])); found = found.concat(search_linkedin(['Old Friends', 'New Connections'])); found.forEach((company) => { if(!contacted_companies.has(company)) new_companies.push(company); }); return new_companies; } let current_date = new Date(); let event_date = new Date(2018, 11, 23); let contacted_companies = new Set(); while(current_date < event_date){ let companies = find_companies(contacted_companies); // https://stackoverflow.com/questions/5915096/get-random-item-from-javascript-array let selected_company = companies[Math.floor(Math.random()*companies.length)]; request_sponsorship(selected_company); contacted_companies.add(selected_company); }
View Diff
2d1 < 5c4 < let found = search_google(['Privacy Companies', 'Security', 'Encryption']); --- > let found = search_google(['privacy_companies', 'security', 'encryptio']); 7c6 < found = found.concat(search_linkedin(['Old Friends', 'New Connections'])); --- > found = found.concat(search_linkedin(['old_friends', 'new_connections'])); 9c8,10 < if(!contacted_companies.has(company)) new_companies.push(company); --- > if(!contacted_companies.has(company)){ > new_companies.push(company); > } 14,16c15,17 < let current_date = new Date(); < let event_date = new Date(2018, 11, 23); < let contacted_companies = new Set(); --- > let current_date = Date(); > let event_date = Date(2018, 11, 23); > let contacted_companies = Set(); 19c20 < let companies = find_companies(contacted_companies); --- > let companies = find_companies(contacted_companies); 21,22c22,23 < // https://stackoverflow.com/questions/5915096/get-random-item-from-javascript-array < let selected_company = companies[Math.floor(Math.random()*companies.length)]; --- > // https://stackoverflow.com/questions/5915096/get-random-item-from-javascript-array > let selected_company = companies[Math.floor(Math.random()*companies.length)]; 24,25c25,26 < request_sponsorship(selected_company); < contacted_companies.add(selected_company); --- > request_sponsorship(selected_company); > contacted_companies.add(selected_company);
Solutions
The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!
Check out these helpful resources to improve your Vim skills... Game on.
Unlock 7 remaining solutions by signing in and submitting your own entry
#8 Sammit / @somemeatjain - Score: 78 - 02/06/22 @ 08:57
o<Esc>/'<CR>l~6lR C<Esc>Wl~Wl~nin<Esc>4nl~;2lR F<Esc>Wl~2lR C<Esc>2jxJJD5jBinew <Esc>jB.j2W.3+XXuu<C-V>6jhxZZ
0 comments