Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 5d745e539a72d600095eb7ad

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 by @braxler:

Unlock 1 remaining solutions by signing in and submitting your own entry
Created by: @curtischong5

8 active golfers, 25 entries

Solutions by @braxler:
59
#4 - John Braxler / @braxler

09/09/2019 at 07:39PM