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 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


Created by: @curtischong5

8 active golfers, 25 entries

Leaderboard (lowest score wins):
57
#1 - Aly Thobani / @alythobani

05/30/2024 at 07:15PM

57
#2 - Peppa Pig / @PeppaPi95550250

07/20/2024 at 12:43AM

57
#3 - nickGPT / @nickandbro

08/24/2024 at 02:16PM

59
#4 - John Braxler / @braxler

09/09/2019 at 07:39PM

59
#5 - Miłosz Łakomy / @foobar01123

08/10/2020 at 10:49AM

61
#6 - Saki Gw / @Sakigw

09/09/2019 at 02:20PM

61
#7 - Andreas Siegrist / @andreaszwei

03/19/2021 at 02:48PM

78
#8 - Sammit / @somemeatjain

02/06/2022 at 08:57AM