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 @Kilphrin:

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

80 active golfers, 162 entries

Solutions by @Kilphrin:
26
#78 - Kevin Ilphrin Pellet / @Kilphrin

03/17/2016 at 09:33PM