Json_pp With Vim

In another post I showed you some tricks you can do from command mode. If you aren’t familiar with it, most standard Linux distros ship with json_pp, which is a pretty-printer for JSON. Today I discovered this tool makes for a fantastic quick tool in Vim when you want to sharpen up some JSON. It can take output like this:

{"rofl":{"copters":["red","blue","gree"]}, "lol": 24.6}

And turns it into this:

"rofl" : {
"copters" : [
"lol" : 24.6

Using the following command


In this case the 1,1 part of the command is the range of lines that you want to send to json_pp. This also works with visual mode as well. After selecting the text you want, if you press : it will pre-populate the correct range for you!

Remote Control Webcam Car

"Zoom Zoom" I’ve been spending a lot of downtime thinking about how I can stay in better contact now that I’m working remotely. I have a whole basement to work out of so I’ve decided to start looking into making my own wifi enabled, remote control vehicle. My goal is to have a working prototype by mid December, and I want to use my blog to document how it’s going. What I would like to accomplish is a car that you can view through and control remotely via a web-site. Some of my “stretch goals” would be to have a rechargeable docking station, the ability to move the webcam independently of the car, and a small two-way display screen that can be activated.

Test the Order of Calls With RSpec

When coding sometimes it’s difficult to think through edge cases of what will happen when. Instead of thinking too hard about it let RSpec do the heavy lifting for you! Pretend you have the following Fetcher class responsible for performing http requests and retrying when the host sever has problems:

Consolidating Vim Test Hotkeys

I’m sure most power developers have their tests bound to hot-keys in their favorite IDE, and having them in Vim is no different. I fell in love with the vim-rspec that Thoughtbot put out. It has served me well over the years and has saved me countless hours in running tests by allowing me to run them from a few short key strokes. Times have moved on however; and I needed a way to run tests in other languages.

Boost Productivity With Mutate

After watching some of my fellow comrades on OSX use Alfred I simply had to get this into my toolkit. I have added a fantastic Linux clone named Mutate to my standard install and have begun writing in custom macros to help boost my productivity. If you want to take a peek at the scripts I’ve been writing to get ideas I’ve been adding them in under my dotfiles.

Then I Long for My Indiana Home

Today was my last day in Tennessee as a resident! I’ve made the exodus back to Indiana to be closer to the family and take a break from the rest of the world. It’s amazing how refreshing it is to be writing this post on the farm with no worry about driving back in a couple days. This change of pace is exactly what I’ve been looking for and I intend to make it count.

Xargs Trick With Vim

In my previous post I showed how you can pipe lines from the buffer and have a command like sort filter them. After playing around some more with it I found a way to have xargs filter the lines with whatever command you want.

Here is a list of the hosts that need more information

Command Mode Tricks in Vim

For those who aren’t familiar with Vim I urge you to get at least familiar with it. It’s capabilities at the command line are awesome when working on a remote box. This week I stumbled upon a couple new tricks you can do in command mode ( the mode you enter after pressing :).

Avoid Swallowing Errors

In programming eventually we run into times when the un-expected happens. These unfortunate times are when exceptions are raised. Normally exceptions should be reserved for exceptional circumstances; however, there are times when exceptions don’t completely break the bank. In fact, sometimes they are expected and lead to bigger problems when trying to handle them.

Advanced Rails Routing Constraints

One of the parts of the Rail’s stack that always seemed to confuse me was the routing. Once you go beyond the simple resource routing unless you have a bit more under you’re belt reading and writing routes can be daunting. I would like to go over just a couple items that I’ve picked up which may prove helpful for others who need to go beyond the vanilla route schemes.