Below is a list of source code that I’ve written.  Most of it is available for free for personal use.

I’ve decided to make this code free because I have personally benefited (and continue to benefit) from others’ free code. I am someone who learns by doing, so real-world examples have helped me learn quite a bit. I hope you can learn something from the below working examples.

I would appreciate a link back to my site if you choose to use this code in your applications.

And, if course, if you’re using this code in a commercial application, please send some money may way. :)

I’ve recently added a forum to this site. Check the “programming” topic for other code snippets, and please feel free to share your snippets there was well.

JavaScript Code

  • DaysSince –  Calculate the number of days that have passed since a date in the past.  Written in JavaScript.  Source code is available for free as well.

PHP Code

  • A few boring US State functions – Pass in the abbreviation, get the full state name.  Print an HTML select box of U.S. States.  Things like that.  Nothing brilliant here, but these save me a few minutes of typing.

Perl Code

  • bigrm.pl – Perl script to remove all files in a directory.  Useful when there are so many files present that you start getting the “Argument list too long” error.
  • rsync_backup.pl – Perl script to perform an incremental over-the-network backup using rsync & ssh.  Used in conjunction with rotate_backups.pl, results in an Apple “time-machine” like backup system.
  • rotate_backups.pl – Perl script to rotate backup directories using hard-links, ala “cp -al” .  Essentially creates a “snapshot” of a given directory.  This script, used in conjunction with rsync_backup.pl, can be used to create an Apple-esque “time machine” style backup system on any Linux/Unix machine.

Python Code