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

Unlock 3 remaining solutions by signing in and submitting your own entry
Created by: @assaflavie

82 active golfers, 173 entries

Solutions by @Chen_Hao:
14
#9 - Hao Chen / @Chen_Hao

03/19/2016 at 08:48AM

15
#>38 - Hao Chen / @Chen_Hao

03/19/2016 at 08:43AM

23
#>74 - Hao Chen / @Chen_Hao

03/19/2016 at 08:42AM