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

0 comments


Created by: @assaflavie

73 active golfers, 145 entries

Leaderboard (lowest score wins):
15
#31 - Jason Schulz / @uxcn_

03/18/2016 at 12:15AM

15
#32 - glepha / @glepha_vim

03/18/2016 at 06:05AM

15
#33 - Saki Gw / @Sakigw

03/18/2016 at 09:40AM

15
#34 - Samuel Masuy / @samasuy

03/18/2016 at 12:12PM

15
#35 - James / @Dronak

03/18/2016 at 02:08PM

15
#36 - Joey Marianer / @roie_m

03/19/2016 at 04:04PM

15
#37 - Dimitrije Juras / @sinemitre

03/19/2016 at 04:48PM

15
#38 - lorentrogers / @lorentrogers

03/20/2016 at 11:39AM

15
#39 - Lau Chi Yung / @asdsteven2

03/22/2016 at 11:12AM

15
#40 - Carlos A Henríquez Q / @lagunex

03/26/2016 at 02:02PM

15
#41 - Philiphone / @Philiphone

03/29/2016 at 10:36AM

15
#42 - ushumpei / @ushumpei_

03/29/2016 at 05:24PM

15
#43 - Chenut Ludovic / @7Brwa7

03/31/2016 at 08:15PM

15
#44 - Rao Zvorovski / @RaoZvorovski

04/02/2016 at 03:04PM

15
#45 - Omer Lachish / @rauchy

04/03/2016 at 09:40AM

15
#46 - Vaughn Cato / @vaughncato

04/10/2016 at 12:48PM

15
#47 - Andres Araya / @arayaandresfco

05/15/2016 at 06:49PM

15
#48 - Ram Tamtam / @ramtamtamtam

06/27/2016 at 01:46PM

15
#49 - Oliver Christ / @0liverChrist

07/12/2016 at 10:55PM

15
#50 - TweetDreams / @TweetMusicians

10/16/2016 at 10:28PM

15
#51 - Raymond Chee / @rchomium

03/05/2017 at 04:56PM

15
#52 - Daniel / @Daniel00288663

03/31/2017 at 10:00AM

15
#53 - Mihai / @mihaicristiant

03/26/2019 at 04:03PM

16
#54 - hans peter / @mullovc

03/25/2016 at 08:06PM

16
#55 - Stoyko Stanchev / @stoykostanchev

03/28/2016 at 01:23PM

16
#56 - lilach adir / @leelaRed

03/31/2016 at 09:11AM

16
#57 - Robber Toe / @robbertoe

04/01/2016 at 01:14AM

16
#58 - Clémence / @Clemence_Neoxia

04/14/2016 at 07:44AM

16
#59 - Michał Dytko / @DytkoM

12/28/2016 at 09:38AM

16
#60 - RockerZZY / @rocker_zzy

07/18/2020 at 02:21PM