Wednesday, June 25, 2008

Printing with TextMate, vim and Friends.

TextMate and vim are my favorite text editors. Unfortunately, TextMate has very little support for printing. It's a nightmare, really, and unlikely to be fixed any time soon. The author simply isn't particularly interested in printing.

Fortunately, vim is really good at printing, at least to PostScript, and does syntax highlighting better than just about anything else. And fortunately, TextMate is designed to let its users easily hack together their own supplementary solutions, called Bundles.

My solution to the printing problem is, in short:

  1. Print from vim to PostScript.
  2. Convert the PostScript to PDF.
  3. Open the PDF in Preview.
  4. Do all this with the standard command-P shortcut.

First, here's the bundle item:

    [ -n "$TM_FILEPATH" ] && \
    PDF_FILE=~/Desktop/`basename "$TM_FILEPATH"`.pdf
    PS_FILE=/tmp/`basename "$TM_FILEPATH"`.ps
    vim \
        "+set number" "+syntax on" "+color slate" \
        "+set printoptions=number:y" \
        "+set printfont=courier:h9" \
        "+hardcopy > $PS_FILE" "+q" \
        $TM_FILEPATH &>/dev/null && \
        ps2pdf $PS_FILE $PDF_FILE && \
        rm $PS_FILE && \
        open $PDF_FILE

And here's a screenshot to make it even easier:

TextMate Bundle

To get this working on your own Mac, you need to install the xpdf package from MacPorts, and then find a suitable color scheme for vim printing if you don't like the default. There's a great write-up on that last bit over on the Vim Tips Wiki. Once you've installed/tweaked/tested your scheme, just replace the "slate" reference in the bundle text above.

LIMITATIONS, QUIRKS AND BUGS

  1. This prints in 9pt Courier, with line numbers and wrapping, because that's how I think code should be printed.
  2. Only saved files are printed; your "buffer" is not. I may change that later.
  3. It will probably break if the slate color scheme is not installed. That was the best scheme installed by default on my Mac, hence the choice.
  4. The PDF is saved to your Desktop, overwriting any like-named PDF, e.g. MyModule.pm.pdf. I like having the thing on my desktop, but I may make it clobberproof later.
  5. YMMV, it's probably buggy, and so on. If you aren't comfortable hacking UNIX, don't try this at home. I actually don't think it's good enough yet to submit to the bundle repository, so don't make any assumptions.

Labels: , , , ,

Sunday, June 22, 2008

Az a bajom van, hogy majom van, de nem bajor, se baján.

No idea why the monkeys are in my brain tonight. I ate too many bananas, that's why. http://mynameisniki.com/archives/3

Labels:

Friday, June 20, 2008

I want a Facebook app...

...that aggregates the notifications and "feeds" from the other, crappy, can't-be-bothered-to-try social networks I'm still on. Actually what I really want is for that functionality to be built in to the Facebook iPhone app. Because I still have a bunch of non-technical friends who joined networks like MySpace or iWiW (in Hungary) back before those networks threw their hands up and stopped caring, and I still want to know what they're up to, but I don't want to log on to those train-wreck sites to find out. (I'm lookin' at you, iWiW, selling out your home culture, and I don't mean the sale to T-Mobile. Sajnálom, de ezek a programmozók rossz gyerekek. Az üzletemberek is. You can't just screw your friends when you get a little money.) I still love LinkedIn but mostly because I like the idea of keeping business networking and social networking separate. I'm one of the few people who can see the logic of their recent $1B valuation, but they're still very vulnerable. Their viability as a business essentially depends on Facebook considering that market too small to be worth the distraction. So that's my main wish. Social networks want to be monopolies, and since we know (or think we know) that's bad for the economy we'll settle for a short list of them. My money's on Facebook, LinkedIn, and a revived Orkut (since Google can just spend its way to innovation). Meanwhile, memo to Zuck: let me give you ad feedback. I'll do it for free, just to not see ads I dislike; and I don't need to explain to you how much more valuable it will make your ad space. On behalf of everyone over 30 on Facebook, I swear this will work. Because anyone who knows me knows the following ad was a complete and utter waste, in fact borderline offensive to my sensibility. And yet I spend bushels of money online every year, much of it on random things "gaming pros" would find trivial, like books and clothes and (no, really) tennis racquets. All they need is a "this is stupid" button to motivate me (not a "close" link which is passive and will be ignored) -- and boom, you make more money. Mine is the generation of participatory permission marketing. I know how the game works, I know the technology, I know the business - and I'm willing to spend a little of my time helping you win, because I believe that better ad targeting systems are in my best interest as well. (For the record: I'm not against making a buck on video games, and I have friends who do. I'm against pretending it's something other than a simple entertainment business. Memo to head office: you're not the new Film.)

Labels: , , , ,

Tuesday, June 10, 2008

Welcome to the Clowd

Seth Godin just coined a brilliant new term: "the clowd."
His post is here:
http://sethgodin.typepad.com/seths_blog/2008/06/the-clowd.html
As usual it's pretty insightful, and of course your privacy has been an illusion for a long time now anyway, but there's one thing I disagree with.
The clowd isn't the "crowd-cloud," it's the "clown-cloud."
Don't be afraid. The clown's afraid too.

Labels: , , , , ,