8th October, 2004

Feedburner

Filed under: Blogging, — bsag @ 06:10 PM

I’ve just discovered Feedburner. It’s a service which takes your RSS or Atom feed and splices in bits of other content or functionality. So—for example—you can produce a ‘SmartFeed’, which dynamically delivers the correct format (RSS, RDF or Atom) to a the reader, or you can splice in feeds for your last few flickr images. It’s free, so I set one up out of curiosity, which you can find here. It’s got the works; flickr photos, del.icio.us links, Amazon associate ID automagically added to any links to media items, and it’s a SmartFeed. My only gripe is that it doesn’t seem possible to show the full text of an entry in the feed, but perhaps I’m missing something. What do people think? I might provide this feed for a while to see if people prefer one giant feed to a number of more specific ones.

Numbering lines with Ruby

Filed under: Technology, — bsag @ 12:10 PM

I’ve been fiddling around a little more with integrating Ruby scripts and one-liners with Quicksilver, and I found a way to number the lines of a selection. This is handy for those times when you decide to bullet-point some text. Generating bullet numbering manually is a chore, and if you rearrange your points you need to renumber all the following points. It’s a simple and not very elegant bit of code—I’m sure someone with more than my newbie’s knowledge of Ruby could make it much more efficient. For some reason, I couldn’t seem to cram it all into a one-liner, so you’ll have to save the code below as a file somewhere on your system.

You need to call this script via Quicksilver or the command line like this: ruby /pathto/line_nos.rb | pbcopy. Then copy your text to be numbered, run the line above, then paste. Voila! Numbered lines. Note that the backslash at the end of the line starting ‘$std_out’ indicates a continuation line.


#!/usr/bin/env ruby
# line_nos.rb
text = `pbpaste`
lines = text.split(" n") 
def number_lines(max)
  i = 0
  while i < max
    yield i
    i += 1
  end
end
$std_out = number_lines(lines.length) {|val| num = val + 1;
   puts "#{num}. #{lines[val]}n"}

Page 1 of 1 pages

Powered by ExpressionEngine :: © www.rousette.org.uk, 2002-2008 :: [XHTML] [CSS] [508]