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

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 1 remaining solutions by signing in and submitting your own entry
#2 Saki Gw / @Sakigw - Score: 61 - 09/09/19 @ 14:20
o<Esc>7Gqq$F_r 2~F'.q@q--@q,,.,,.ean<Esc>5$xJJD9Winew <Esc>*.7W.Gk<C-V>6klxZZ

0 comments


Created by: @curtischong5

2 active golfers, 3 entries

Leaderboard (lowest score wins):
59
#1 - John Braxler / @braxler

09/09/2019 at 07:39PM

61
#2 - Saki Gw / @Sakigw

09/09/2019 at 02:20PM