UPDATED: Damnit

May 1st, 2009

Last night was the last lecture of the semester. I now send my kids off into the wild with hopes they won’t fall into darkness (read: become a C# programmer).

And sure enough, after a semester of my code snippets of pure genius on this blog, I find the WP-Syntax plugin that offers really sweet syntax highlighting for multiple languages. Just in time for a three month break from being able to force students to read my blog.

This also means at some point, I should go back and reformat all my code posts to use the plugin. What a bitch, but really, the syntax highlighting is pretty damn sweet. Here are a few examples taken from the plugin site itself.

Java

1
2
3
4
5
public class Example {
  public static void main(String[] args) {
    System.out.println("Hello World");
  }
}

PHP

1
2
3
4
5
6
7
<div id="foo">
<?php
  function foo() {
    echo "Hello World!\\n";
  }
?>
</div>

Ruby

1
2
3
4
5
class Example
  def example(arg1)
    return "Hello: " + arg1.to_s
  end
end

Python (ok, Hello World isn’t a great example for Python, come with me on this one)

1
print "Hello, World!"

Bash (again, shitty example, but I’m really excited bash is supported)

1
echo 'Hello World'

Even SQL and Scala are supported. This rocks.

So I apologize to anyone who needs to look at my old code snippets. I had to yank out the CSS style that formatted the background with the white and green line highlighting and numbers, so they aren’t quite as apparent as they used to be. I’ll try to convert the most relevant ones to next weeks’ final first, then eventually (read: annoyingly slowly) convert the rest.

UPDATE: HA. I ghetto hacked the plugin to default my old code indication tags to the plugin based tags (defaulting to Java since 95% of the stuff I post here is Java). It’s not the most ideal situation and I’ll eventually write a script to run through my posts making the changes, but for now at least my OCD isn’t completely pegged by the fact that all my code posts looked like shit.

Comments are closed.