hi theo;
1. the replacement function (inject_in_html() in /wp-content/plugins/autoptimize/classes/autoptimizeBase.php) indeed has a bug (str_replace has no "limit" optoin, so will probably have to switch to preg_replace). this is on my list of things to fix for AO 2.0.
2. there is example code for most (but not all) filters in /wp-content/plugins/autoptimize/autoptimize_helper.php_example.
hope this helps,
frank