Some test code hilighting

Looking for a code hilighter to use with WordPress for the blog. Ended up testing CodeColorer, here’s a test page demonstrating how it looks.

First some Python

def Something(object):
    """Just a python doc string"""
    def __init__(self):
        print "Nothing much happening here"

And now some Ruby …

hash = { :water => 'wet', :fire => 'hot' }
puts hash[:fire] # Prints: hot

hash.each_pair do |key, value| # Or: hash.each do |key, value|
    puts "#{key} is #{value}"

# Prints: water is wet
# fire is hot

hash.delete :water # Deletes :water => 'wet'
hash.delete_if {|key,value| value=='hot'} # Deletes :fire => 'hot'

Some terminal stuff

root@sn1200:/home# ps
1753 pts/1 00:00:00 bash
7952 pts/1 00:00:00 ps
root@sn1200:/home# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 221G 151G 59G 73% /
varrun 2.0G 112K 2.0G 1% /var/run
varlock 2.0G 0 2.0G 0% /var/lock
udev 2.0G 32K 2.0G 1% /dev
devshm 2.0G 0 2.0G 0% /dev/shm

and finally some good old Lisp

(defun factorial (n &optional (acc 1))
  (if ( acc
    (factorial (- n 1) (* acc n))))

Seems to work well – think I’ll be sticking with this.

Leave a Reply

Your email address will not be published. Required fields are marked *