Lisp Python Ruby WordPress

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
[cc lang=”python”]
def Something(object):
“””Just a python doc string”””
def __init__(self):
print “Nothing much happening here”
[/cc]
And now some Ruby …
[cc lang=”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}”
end

# Prints: water is wet
# fire is hot

hash.delete :water # Deletes :water => ‘wet’
hash.delete_if {|key,value| value==’hot’} # Deletes :fire => ‘hot’
[/cc]
Some terminal stuff
[cc]
root@sn1200:/home# ps
PID TTY TIME CMD
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
root@sn1200:/home#

[/cc]
and finally some good old Lisp
[cc lang=”lisp”]
(defun factorial (n &optional (acc 1))
(if ( acc
(factorial (- n 1) (* acc n))))
[/cc]
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 *