Great syntax highlighting plugin for WordPress

At times, I think I spend more time writing about using wordpress than actually using it sometimes. I’ll need to fix that. Today, thanks to WordPress’s dashboard, I came across the WP-Codebox plugin. THanks to GeSHI, it can color up a lot of languages and fixes some problems I’ve had with other plugins. Honestly, I’ve never been satisfied with any of them. I think this could change that.

Just to show it off, I present to you some random ruby I wrote the other day when I was working on something. I’ll leave it to you to guess what I’m doing and why with this code. (And I also think I could do it better than using a while loop, but I was able to bang it out quickly for what I needed.)

#!/usr/bin/env ruby
require 'fileutils'

offset = 214

files = Dir['*']

count = 1
while !files.empty?
  file = files.delete_at(rand(files.size))
  extention = File.extname(file).downcase
  name = sprintf('%d%s', count + offset, extention)
  puts "#{file} -> #{name}"
  FileUtils.move(file, name)
  count += 1

2 thoughts on “Great syntax highlighting plugin for WordPress”

  1. Two things:
    1. It’s extension with an “s”. šŸ™‚
    2. You forgot a period, I think, between filename & extension.

    I think you are moving pr0n to nondescript files that you can hide from your wives.

  2. Matt…

    1) Its a variable…so…meh

    2) Actually, File.extname includes the ‘.’ Not sure if that’s a bug or a feature.

    Good guess on the why…but I’m the only one with root, so I chmod 700 the pr0ns directory! šŸ™‚

Leave a Reply