Progranomicon

Trevor Bortins' blog — mostly about CoffeeScript, Ruby, and Linux

March 28th 2014

Mapping a key to run your tests in vim

I stole this right from Gary Bernhardt, and I just wanted to remember it in a clear place:

:map ,t :w\|:!mocha --compilers coffee:coffee-script %<cr>

It's really nice to press two keys quickly in succession to save your file and run your tests, and view the test output. Other text editors (like my beloved Sublime Text) don't automatically switch views so you can watch your test run when you save the file. I could program my keyboard to do that, but not many people have a programmable keyboard, and even then it'd be a key combination (key-chord), not a finger-friendly rapid ,t succession. Since I do this about, say, 1,000,000 times a day, mapping a key like that in vim could potentially save keystrokes in the long run if you run the same spec (or all specs) a bunch of times…

March 26th 2014

Make USB keyboard stay awake and disable laptop internal keyboard

I'm on Arch linux, on a laptop, and I just got a nice Poker II keyboard, which is a monumental joy to type on. When I first plugged in the keyboard, everthing worked great, but then I quickly ran into an issue with it falling asleep after two seconds. This would be fine, except it took a whole keypress to wake it up, and that keypress didn't register with the OS. I'd type a word, and it would inevitably end up missing its first letter. Annoying. I quickly tracked it down to the keyboard falling asleep due to laptop USB power saving. Now to google. Here's what I found to fix the issue:

August 7th 2013

Uglifier changes constructor names

Gotcha!... again.

So, it turns out that relying on the names of your constructors being the same in production as they are in development is a really bad idea. The reason is this: minifiers change all that crap! I know what you're saying, "Duh, they're supposed to, dufus." Okay yeah so it slipped my mind for a second. Good thing I didn't deploy without testing first! ; )

Recent posts

May 16th 2013 • Backbone: dynamically change view events upon initialization
February 15th 2013 • Ruby 2.0's refinements aren't so refined... yet?
March 12th 2012 • The Use of Self on Yourself
February 24th 2012 • My OS Essentials
January 22nd 2012 • Rspec Gotchas: before, after, all, and each
January 16th 2012 • Capybara JavaScript Integration Helpers
December 22nd 2011 • Multiple SSH Keys
December 22nd 2011 • Multiple heroku accounts
December 22nd 2011 • Heroku app deployment procedure