I'm hardly a big writer but every now and then I work on something that I think might be useful to share. It covers most web design and development topics including HTML, CSS, jQuery, PHP, WordPress and MODx.
This snippet tries to optimise and compress PNG and JPEG images for better performance using the resmush.it optimisation API. This will help with Google Page Speed and can reduce image sizes by up to 70%. This will overwrite any existing images so is intended to be used as an output filter after pthumb or similar.
TableOfContentsX: A new MODX extra for creating a table of contents
Whilst working on a client's site we needed a way of generating a Table of Contents based on the content the client had entered. As the content changed often we didn't want to have to manually update the table so I created this MODX plugin that generates the table for you.
I have just committed some changes to MODX extra TwitterX which now includes the ability to do basic searches, specify multiple screen_names and several bug fixes. Here's a quick summary of what's updated.
TwitterX: A new MODX extra for pulling in Twitter feeds using API 1.1
Since Twitter has now changed to enforce authentication, this new MODX extra loads Twitter statuses and timelines by using the new (and very annoying) Twitter 1.1 API. You will need to create a Twitter app and get the keys and tokens and this extra will do the rest.
If you want to improve your form inputs by restricting the characters the user enters, this function might come in handy. It restricts the keyboard input for a text field so that they can only enter the characters you want.
Here's two useful postcode functions; one that will help for checking if a string is in the valid format for a UK postcode; and another that formats a string into a nice postcode format. They both use regular expressions to make them fast! You could use them for client-side form validation.
Sometimes when creating a web application you need to check that a date entered by the user is actually valid! Here is a quick and easy way of checking the validity of a string to ensure that it's in the correct format (DD/MM/YYYY) and is a real date by returning true or false.