Akismet PEAR Package
Apr 7, 2008
Thanks to Michael Gauthier from silverorange, the Akismet class has been converted to PHP5 and significantly tweaked. Michael submitted his changes to PEAR, and it is now an available package in the repository. Please check it out if you're looking for a good PHP5 class with the much less restrictive MIT license!
CSS and Javascript Compression
Mar 11, 2008
Introduction
I've been using Javascript more and more ever since I discovered the wonderful jQuery framework. Though jQuery comes in a much smaller file size than Prototype, it's still quite a bit to ask of your dial-up users to download before the rest of your Javascript even loads. I also noticed a CSS file of mine was up to 8kB in size. I decided it was time to figure out a way to compress things down a bit. This is where my CSS and Javascript compression script comes in. Along with a little mod_rewrite magic, all the CSS/JS files on my client's website are automagically compressed and gzipped before sent to the site's visitors. File caching is included to reduce the processing time overhead from compression. A few options are also available for development to make life easier. It's hard to debug CSS when everything has been compacted into a single line, so adding &debug to the end of the path will revert back to the CSS file's original state so that you can browse through it (especially handy if you use the web developer toolbar). Using the compression script, my CSS file went from 8kB to 2kB, and jQuery from 95kB to 15kB!Usage
Simply configure the constants at the beginning of the PHP file to suite your server appropriately. Now change the paths in your HTML to any CSS or Javascript file you'd like to compress (ie: from "/inc/style.css" to "c.php?f=inc/style.css").Using mod_rewrite
You can use mod_rewrite to compress everything automatically: <IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)\.(js|css)(.*)?$ inc/c.php?f=$1.$2$3
</IfModule> Now going to "/inc/style.css" will automatically compact the CSS file and it will be Gzip compressed before being sent to your browser (provided your browser supports Gzip compression). Using this technique, you shouldn't have to change anything else on your site and everything will be compressed automatically.Download
Added Mar 11, 2008- PHP Javascript Packer (modify "require" line in c.php if needed)
- c.zip or
- c.tar.gz
The Bane of Interpreted Languages
Feb 22, 2008
I can't help but think of all the chair fights I'm missing out on... blasted PHP!
Bazaar, version control made easy
Jan 31, 2008
I've attempted in the past to use a version control system to manage my projects big and small; from the single Akismet class file, to much larger client projects with thousands of lines of code. CVS and SVN however, were just too much for me. The learning curve was too high to make it worth the effort and I ended up giving up and sticking to my old ways. But one day I stumbled upon another version control system, Bazaar. This system is different in that it is able to tailor to the small single-man projects that I typically work on, but is also designed to scale to much larger multi-developer projects as well. Within a few minutes of installing it on my web host, I had a running code repository that I could submit revisions to and keep track of my work. I can now revert any or all files to previous revisions of a project if needed. I also have a useful journal/log of my progress in a project from each time I commit a revision. It's quick, simple, and gets the job done for developers like me. I highly recommend Bazaar if you're looking for a simple, yet powerful revision system.
Permanent Link
|
0 comments 





