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

underscore_to_camelCase

Pointy haired boss decided we need to switch to camelCase. Let's get this over with.

Start file
log(req, res, next) {
    try {
        let ratio = this.config.get("HEADER_LOG_FREQ", 0.05);
        if (Math.random() < ratio) {
            this.arrange_headers(req, res).then(this.write_log);
        }
        let safe_path = this.safe_graphite_path(req.path);
        this.stats.increment("web.endpoint." + safe_path, 1, 0.05);
        if (req.headers && req.headers["x-forwarded-proto"]) {
            this.stats.increment("web.protocol." + req.headers["x-forwarded-proto"], 1, 0.05);
        }
    } catch (error) {
        log.warning(error, "Failed to log headers");
        res.status(500).send("its_not_you_its_me");
    } finally {
        next();
    }
}
End file
log(req, res, next) {
    try {
        let ratio = this.config.get("HEADER_LOG_FREQ", 0.05);
        if (Math.random() < ratio) {
            this.arrangeHeaders(req, res).then(this.writeLog);
        }
        let safePath = this.safeGraphitePath(req.path);
        this.stats.increment("web.endpoint." + safePath, 1, 0.05);
        if (req.headers && req.headers["x-forwarded-proto"]) {
            this.stats.increment("web.protocol." + req.headers["x-forwarded-proto"], 1, 0.05);
        }
    } catch (error) {
        log.warning(error, "Failed to log headers");
        res.status(500).send("its_not_you_its_me");
    } finally {
        next();
    }
}

View Diff

5c5
<             this.arrange_headers(req, res).then(this.write_log);
---
>             this.arrangeHeaders(req, res).then(this.writeLog);
7,8c7,8
<         let safe_path = this.safe_graphite_path(req.path);
<         this.stats.increment("web.endpoint." + safe_path, 1, 0.05);
---
>         let safePath = this.safeGraphitePath(req.path);
>         this.stats.increment("web.endpoint." + safePath, 1, 0.05);

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 81 remaining solutions by signing in and submitting your own entry
#82 Sebastian Pfluegelm / @sebastian_pflgl - Score: 35 - 06/04/16 @ 22:31
/_n<BS><CR>nnxrHnxRL<Esc>nxrPnxrGnxrPnxrP:wq<CR>

0 comments


Created by: @assaflavie

82 active golfers, 173 entries

Leaderboard (lowest score wins):
14
#1 - Urtica dioica / @udioica

03/17/2016 at 08:26PM

14
#2 - Jon Krause / @jkrause314

03/17/2016 at 08:40PM

14
#3 - Kyle Holzinger / @kyleholzinger

03/18/2016 at 03:45AM

14
#4 - "Smylers" / @Smylers2

03/18/2016 at 09:41AM

14
#5 - Dimitar Dimitrov / @kurkale6ka

03/18/2016 at 11:34AM

14
#6 - Jiří Chára / @JiriChara

03/18/2016 at 12:05PM

14
#7 - John Braxler / @braxler

03/18/2016 at 09:51PM

14
#8 - Jonathan Taylor / @Jonyonson

03/19/2016 at 04:55AM

14
#9 - Hao Chen / @Chen_Hao

03/19/2016 at 08:48AM

14
#10 - tullie / @tulliemurrell

03/20/2016 at 03:21PM

14
#11 - Jan Bundesmann / @janbundesmann

03/21/2016 at 08:55AM

14
#12 - Robert Mosher / @rcmosher

03/21/2016 at 07:15PM

14
#13 - Jason Choi / @joyous_jason

03/22/2016 at 11:04AM

14
#14 - Neelo / @Neelo_Bullet

03/22/2016 at 03:59PM

14
#15 - Dinesh Bhosale / @MrDineshBhosale

03/30/2016 at 01:04PM

14
#16 - CM Déjardin ن / @CMDej

04/14/2016 at 08:22AM

14
#17 - E Both / @enboth

04/14/2016 at 10:20AM

14
#18 - S O / @strangelooperer

04/17/2016 at 08:15PM

14
#19 - T. Sakuma / @taku39

05/01/2016 at 01:59PM

14
#20 - John Goes / @johnwgoes

05/08/2016 at 12:05PM

14
#21 - Nico Gevers / @gevious_

05/08/2016 at 06:21PM

14
#22 - Atrament / @Atrament

05/11/2016 at 05:05PM

14
#23 - (,,꒪꒫꒪,,) / @sneer

05/21/2016 at 11:48AM

14
#24 - Benedikt Breinbauer / @benebun

07/24/2016 at 05:59PM

14
#25 - Will / @obiwan__k3n00bi

09/01/2016 at 06:20AM

14
#26 - Stanislav / @prstad

10/25/2016 at 12:51PM

14
#27 - Turkey Man / @lvturkeyman

11/26/2017 at 10:01AM

14
#28 - DHM / @DHM29978992

05/15/2018 at 01:53AM

14
#29 - vimgolfer / @vimgolfer7

09/30/2019 at 04:39AM

14
#30 - Janzen / @__Coos

10/02/2022 at 02:15PM