Author Archives: Andrew

How to get the name of the class of a decorated method in Python

When profiling a Python app, it’s helpful to have a decorator that wraps functions and reports details about their performance. Assuming you are doing this to report some metric about the function, you’ll want the decorator to work with both bound and unbound functions (IE, regular functions and methods of a class), and if the

Make Sublime Text 2 More like Vim: Wrap Code, Go To Last Edit, and More

I’ve been trying out Sublime Text 2 as a replacement for Vim. While I enjoy using it and I experienced the “Wow, this does 90% of what Vim does” moment, I kept a running list of all the features in the remaining 10% that I relied on every day. These included: Better code wrapping (gq)

Sharp Edges: Protecting Ourselves from Digital Publishing

Nicholas Carr wrote in a recent article that he considered the ability of publishers to change text after they had released it “insidious” and a “bane” of digital publishing — specifically, if such changes are made in response to market research. I agree that there is a challenge inherent in the new ease with which

iA Writer and Notational Velocity

The OS X apps iA Writer and Notational Velocity are great for writing and taking notes, respectively. I wanted to try using them together, by setting iA Writer as the external editor for Notational Velocity, but after doing so I noticed that iA Writer would not open with the keyboard shortcut (Command-Shift-E), and it was

How to Fix Slow Scrolling in Vim and MacVim on OS X

I finally discovered the cause of my #1 OS X problem: slow scrolling in Vim, both in Terminal.app and in MacVim. There was always a marked difference between Vim on my Mac and Vim on Linux. Scrolling with the movement keys (j/k in particular) was blindingly fast on Linux, but plodded along on my Mac so

Instant Django Dev Environments with Tmux, Tmuxinator, and Virtualenvwrapper

This post describes how to use a few common tools to instantly set up and tear down Django development environments. I’ve found that such automation is most useful when switching between branches in source control. Without automation, you have to manually kill and reconstruct any Django shell and development server instances for each branch (and

Self-Reliant Veganism

“Trust thyself: every heart vibrates to that iron string.” When I first read “Self-Reliance,” these words sunk into me, but I must have skimmed the rest of the essay. Emerson’s style and vocabulary put me off, an experience which I attributed to 150 years of drift in the English language. The problem only got worse

No More Supermarket Blues

A few weeks ago, Kim and I were riding home from our weekly trip to Fred Meyer, and I had an epiphany: I never wanted to go back. Kim wasn’t fond of Fred Meyer, either, so we hatched a plan to limit how much time we spent at the supermarket, and how much we bought,

Riding the Springwater Corridor

This weekend, Kim and I rode bikes from our apartment in the Lloyd District of Portland to the Tacoma Bridge, following the Esplanade and the Springwater Corridor. The ride took a couple of hours at our mild, Sunday-morning pace, and it offered gorgeous views of the Willamette River and Oaks Bottom Wildlife Refuge. Spring and

Learning Clojure

Clojure is a new functional language for the JVM. This post is a collection of links, articles, screencasts and free books I’ve found to help me learn the language and understand functional program design. Key features Here are some key features of Clojure that I find extremely interesting: Designed for concurrency A Lisp dialect –