From Lazarus wiki
I am a regular in the #fpc IRC Channel and an enthusiastic supporter of free pascal.
Most of my pascal code is available for free on github:
- tangentlabs repo contains a whole bunch of small pascal examples and experiments. Some especially fun ones (which may or may not require fpc 2.7.1 from the svn trunk):
- GoGoSDL.pas is a basic demo of using SDL (1.x) from fpc, intended as a template for quickly creating SDL apps.
- zenglagg.pas shows how to use AggPas to dynamically create smooth vector images for use as sprites in ZenGL.
- arrayprops.pas shows how to override the bracket operator so you can say things like
dict['strings as keys'];.
- xpathdemo.pas shows how to use xpath.
- dispatch.pas is a hopefully entertaining look at various approaches to dynamic dispatch/multimethods. (Short answer: dynamic dispatch semantics are possible in fpc, but require complicated setup or creative use of exceptions.)
- hofmap.pas shows how to implement higher order functions as class methods in a generic class. (Probably requires trunk.)
- funops demonstrates another style of higher order function based on function composition. In particular, it shows how to implement J-style hooks and forks.
- jcolor.pas and  implement a hand-written syntax highlighter for java.
- helpers.pas demonstrates how to use helpers, by adding some python-style methods to pascal strings.