PHP – Return first n words from a string

Do you ever find yourself needing to shorten a string in PHP? Maybe return the first 25 words of a long story? Give this routine a try. It will return the first n words from a string, or the entire string if it is less than n words long.

nextSaturday and lastSunday functions for PHP

I needed a way to find the first second of a week and the last second of a week based on a Unix timestamp. Credit for the previous Sunday goes to Shaun who posted a way to find it on the PHP site for strftime, although I changed his code a little because I'm more [...]

How to add a timer to Eventum

I've been using Eventum for a while to keep track of bugs in a web application of mine. There was one feature missing that I really needed, and which made me switch to dotProject for a few months and that was a timer. When I'm working on a bug I wanted a way to be [...]

Editing a page from FireFox

Found a quick little JavaScript trick that lets you edit page content from within FireFox. Copy and paste the following into your address bar and press enter. javascript:document.body.contentEditable='true'; document.designMode='on'; void 0 Everything on the page becomes editable. Sure, it doesn't affect the file on server. But once you're done you can save the resulting file [...]

SMF and StopForumSpam.com

Found a great site over at StopForumSpam.com. Over the past few weeks I've been checking registrations on a couple of my forums against their database. What I've found is that most of the registrations have been spammers and they've gotten the axe. But after deleting 15-20 per day I wanted a little more automated solution.