About
John Ford presently works on Farmstand, an iPhone app connecting communities with locally-grown food. Passion for coding is what motivates John, but some people are beginning to question his attachment to his iPad. Mix equal parts beautiful code writer, lover of healthy living, world traveler, living room DJ, and community giver and you'll have the geek known as John Ford.Search
Filters
Recent Comments
- Juanjo López on Plugin: Bookmark A Page In Your PDF
- Ryan Hellyer on Programmatically Pull Attachments from WordPress Posts
- John Ford on Programmatically Pull Attachments from WordPress Posts
- Bronson Quick on Programmatically Pull Attachments from WordPress Posts
- WordCamp Tokyo 2011: The Largest Japanese WordCamp « Naoko McCracken on WordPress.com の裏側 – WordCamp Tokyo 2011
Category Archives: Example Code
Programmatically Pull Attachments from WordPress Posts
One of my favorite tricks in using WordPress as a CMS is to have it handle photo resizing and insertion into pages automatically. For example, swissmiss and I just launched Convert (a NYC based Green Roof Service) today. Within the projects section they display photos of the green roofing projects they’ve done and let you download a project sheet PDF. … More
Plugin Update: PDF Bookmark bug fix and French translation
If you are having problems with the bookmark plugin not working for some documents, this update (1.2) should fix that. The update also adds a French translation to the Bookmark menu and provides an installation path for Linux users. Thanks to TitCouille for help with all of those items. The plugin should work correctly for Adobe Reader 7, 8 and … More
Plugin Update: PDF Bookmark for Adobe Reader 8
Some of you may already be using the PDF bookmark plugin I put together for Adobe Reader. It provides a quick and easy way to bookmark the page your on and return back to that spot later. It’s especially handy when reading large PDF books. Thanks to the input of Michael Hartl, I updated the plugin to work properly with … More
has_many :through Self-referential Example
While using an association table for the first time with Ruby On Rails I had a bit of trouble finding an easy to understand example of has_many :through. I needed to build a self-referencing table where People could have other People as friends through a Friendship. I was getting “stack too deep” errors, “could not find the association” errors, and … More
Execute Rails Code Before the View is Rendered
At one time, I was looking for a way to execute code for every action in my controller before the view was rendered. I saw this come up again yesterday in the #rubyonrails IRC channel so I looked at it a bit more. Currently, Rails provides a before_filter method which will “run before actions on this controller are performed” or … More
Writing a Custom FormBuilder in Rails
I’m currently working on a Ruby on Rails application where I need lots of text fields that have the same properties. I decided to override text_field and have it output all of the extra attribues automatically. This helps keep the view code cleaner, lets me change all of these text fields in one place, and also helps me avoid typing … More
Plugin: Bookmark A Page In Your PDF
With the long, yet wonderful, books in PDF format these days (Agile Web Development with Rails by Dave Thomas and David Heinemeier Hansson with Leon Breedt, Mike Clark, Thomas Fuchs, and Andreas Schwarz [570 pages]; Programming Ruby by Dave Thomas, with Chad Fowler and Andy Hunt [864 pages]) there needs to be a better way to digitally bookmark where you … More