I was banging my head against the wall today trying to add a before_save filter to a model that was getting saved in a nested form. It seems that only the top level model’s callbacks will be called. So say you have save some kind of Order with many LineItems all at once (via the [...]
Getting Started With Node.js
by John on 08. Oct, 2010 in Uncategorized
I’ve been hearing a lot about Node.js recently, so I decided to install it and give it a whirl. I know I’m a little late to the game, but here’s my breakdown of Node.js; What is Node.js? This one took a little while to get my head around but essentially node.js allows you to do [...]
Blog excerpt in Ruby on Rails
by John on 28. Sep, 2010 in Uncategorized
Today I needed to output a blog excerpt similar to the_excerpt() in Wordpress. I came up with the following Ruby on Rails function that seems to work pretty well.
Learning Regular Expressions From the jQuery Source
by John on 20. Sep, 2010 in Uncategorized
I recently undertook a personal challenge of going through the jQuery source as a way of improving my understanding of Javascript and Javascript frameworks. One of the first things I encountered when I took a look through the code was some daunting looking regular expressions. Now, I’ve had a good bit of exposure to regular [...]
Adding Your Own Callbacks to WordPress AJAX Requests
by John on 10. Sep, 2010 in Uncategorized
The WordPress administration page is loaded with AJAX calls. From time to time, a developer may want to perform some custom javascript action when one of these calls is completed. JQuery allows custom events to be triggered, but at this time the WordPress javascript does not make use of them. A developer on the WP-Hackers [...]
Building Javascript Widgets
by John on 06. Sep, 2010 in Uncategorized
I found a great tutorial today on building Javascript widgets. We include dynamically generated widgets on each of our calculator pages on Calculator Pro. Up until today, the widgets would manually submit back to the CalculatorPro site, which isn’t very useful for site owners looking to add a widget to their site. Following some of [...]
Wordstream API Class
by John on 18. Aug, 2010 in Uncategorized
The other day, I created a Wordstream API WordPress plugin for use on my business partner Joel and I’s site Domain Superstar. As part of that process I wrote a PHP wrapper class for Wordstream. I offered it to Wordstream, and they decided to use it as part of their example code and were kind [...]
Adding Simple Role Based Permissions to your WordPress Plugin
by John on 14. Aug, 2010 in Uncategorized
In response to a user request, I recently added the ability to restrict access to my Copyscape Plugin to only certain WordPress roles. WordPress provides some pretty simple APIs to manipulate Capabilities and Roles which can be invaluable in plugins where you want to limit access to certain functionality. I think this functionality is something [...]
Adding Custom Post Types to the WordPress Google Sitemap Generator Plugin
by John on 13. Aug, 2010 in Uncategorized
A lot of the new WordPress sites I’m working on have custom post types. A lot of plugins that I use haven’t caught up with the new functionality yet, and the Google Sitemap Generator is no exception. I found a patch here that uses an existing hook in the plugin and seems to work great [...]
John Gadbois
John Gadbois is a web developer living Gales Ferry, CT.