closure

Capturing key-presses in Clojurescript with Closure

Having good keybindings on your site makes a world of difference for technical users (Twitter and Slack are good examples of this), but writing them yourself has several annoying steps. You have everything you need out of the box with Google Closure, though. Here’s how it goes withotu needing to add any dependencies to your project, since Closure is part of Clojurescript. Strategy and Solution The plan is simple:

zero-padding and truncating with string formats in Clojurescript

One of the discrepancies between Clojure and Clojurescript is that the javascript version doesn’t have anything like the classic Unix/C-style string format functions. Some functionality is not simply reproducible with clever uses of str, but fortunately Google Closure is here to save the day. Because Closure is part of Clojurescript, there are no added project dependencies to make this work. (ns myapp.services (:require [goog.string :as gstring] [goog.string.format])) (str "$" (gstring/format "%.