pbrisbin dot com
Aurget v4
Apr 23, 2013
Aurget was one of the first programs I ever wrote. It’s seen decent adoption as far as AUR helpers go and it’s gradually increased its feature set over the past number of years.
The codebase had gotten a bit krufty and hard to follow. I decided to refactor to more isolated functions which didn’t rely on so many global variables. This directed refactor has improved things greatly: pretty much any function can be reasoned about in isolation and the logic flows more understandably during program execution.
Chromebook
Apr 13, 2013
I’ve heard rumors that a Google Chromebook can make a surprisingly sweet machine for a developer. As someone that works exclusively in the console, it’s easy enough to SSH into a server to do the actual work. Since my apps are either command line tools or web sites, I can easily test them remotely as well. I only need something with a terminal and browser… And reliable internet.
This workflow is very attractive to me: you get a conveniently portable device with great battery life on which to work, it’s cheap and essentially disposable should anything happen to it, and the machine where you actually develop can be specialized to the task. I already have such a machine available, but you could also get a fairly affordable linode or even spin up an EC2 instance.
Chruby
Apr 7, 2013
Once I start my new job at thoughtbot, I’ll be working on a variety of ruby and rails projects at the same time. This, combined with the current 2.0 transition, means I once again need a ruby version management tool.
Chruby is the third (by my count) “new hotness” when it comes to these python-inspired virtualenv clones. First there was rvm which has a ton of features, then came rbenv which aimed to be simpler, finally we have chruby which is billed as the simplest of them all. So far, I’m a big fan.
Hard Mode
Mar 16, 2013
Recently, while watching Corey Haines and Aaron Patterson pair-program, I heard Mr. Haines mention vim’s “hard mode”. Apparently, this is when you disable the motion commands h, j, k, and l.
It’s absurd how great this exercise is for increasing your knowledge of vim. There are so many better ways to do everything. Just like complete novices might map the arrow keys to Nop to force learning hjkl, mapping the hjkl keys to Nop forces you to learn all these other ways to move around and edit parts of the file.
Testing POROs In Rails
Feb 11, 2013
A lot of smarter people than I have come up with the idea that moving your business logic out of framework based classes and into Plain Old Ruby Objects (POROs) is a Good Thing.
Being less tied to your framework makes upgrades easier. It also means you can test these objects without loading rails. That’s really the only way to get super fast unit tests. It’s also the only way to get true and isolated unit tests.
Systemd-User
Jan 20, 2013
BIG FAT WARNING
One thing to note, and the reason why I’m no longer using this setup: screen sessions started from within X cannot survive X restarts. If you don’t know what that means, don’t worry about it; if you do, you’ve been warned.
A while back, Arch switched to systemd for its init system. It’s pretty enjoyable from an end-user perspective, unit files are far easier to write and maintain than the old rc-scripts, the process groups are conceptually consistent and robust, and the centralized logging via journalctl is pretty sweet.
Git-SVN
Jan 16, 2013
If you work on a project that’s been around for a while, chances are it might still be using SVN for version control. Even if you can’t get buy-in from Management or Ops to move to Git, you can still get most of the benefits by learning the ins and outs of the git svn sub command.
Initial Clone 🔗$ git svn clone --stdlayout svn://svn.example.com/project Using --stdlayout tells Git that your project follows the common layout for trunk, branches, and tags. This allows you to leave off the /trunk when cloning and is important for the branching strategy I’ll mention later.
Easy Change
Nov 28, 2012
for each desired change, make the change easy (warning: this may be hard), then make the easy change
— Kent Beck, September 25, 2012
Here’s some code from our main application helper. It provides a small method for redirecting the user based on a goto parameter. It uses two helpers itself to append google analytics parameters to the url before redirecting.
Originally, it was uncommented. I’ve added a few here to highlight what goes through my head when first reading it.
Dvd2iso
Nov 15, 2012
My latest bash-to-ruby rewrite was dvdcopy to dvd2iso. I changed the name both to disambiguate, and because my primary use case was no longer to duplicate disc to disc, but to just generate the ISO. It’s very simple to just burn that ISO back to disc if I feel like it.
The benefits of the new script are:
Less and simpler code Coded at a higher level Easier to use There are far less options than dvdcopy; you can choose the device and output file, that’s it. Though, the script is easy enough to configure further by simply editing the source.
Developing Web Applications with Yesod
Nov 1, 2012
The following was written for [issue 7][issue] of Web & PHP magazine. Please, if you enjoy this article (or my articles in general), take the two minutes to register there and download the full PDF to show your support. Why Haskell? 🔗There’s much more to Haskell than just the buzz-words like laziness and parallelism – which are completely deserved, by the way. Having pure computations defined as side-effect-free morphisms that take and return immutable datatypes allows the compiler to do amazing optimizations. This frees you to write elegant, readable code but get near-C performance at the same time.