duck_punching

Ruby, Rails and tech. No ducks were harmed in the making of this blog.

Archive for June, 2008

date_time_text_field_helpers plugin moved to GitHub

My date_time_text_field_helpers plugin allows you to use text input fields for dates and times instead of the Rails standard select dropdowns. The plugin was up on Google Code but since I am mostly using git now, I just had to bring it over GitHub.

Updates will only be pushed to git from now on. The Google Code page will stay up for a while, until such time that I remember to pull it down.

No comments

Google-by-keyboard Firefox search plugin for Australia

If you haven’t seen it yet, Google has a project in its labs for the navigation of search results with keyboard shortcuts. Its great for geeks who love the keyboard.

Well a reader at LifeHacker knocked out the search plugin for Firefox. I took that and tweaked it for the Australian search engine for those times you need sumthin a little more local. So download it and stick it in your Firefox profile searchplugins folder. Then change the search engine in the search bar to be ‘Google by keyboard (AU)’.

Remember it doesn’t search in au domain by default, it just means the search results will have the ‘pages from Australia’ radio button under the Google search box.

No comments

Using ActionView in standalone tests

When writing Rails plugins I like to be able to test them as a stand-alone library rather than inside a specific Rails project. I find it more productive and it avoids clashes with other plugins. It also allows you to test it against multiple rails versions.

One frustration I have had is when just want to use ActionView in your tests, because you might be writing a view plugin, if you require ‘action_view’ you get the following error:

MissingSourceFile: no such file to load -- html/document

This is because the path to the html-scanner library has not been added to the loadpath. This only happens in ActionController. But if we don’t need or want the overhead of ActionController the following line will include html-scanner in the loadpath and all will be well.

$:.unshift Gem.searcher.find('actionpack').full_gem_path
  + '/lib/action_controller/vendor/html-scanner'

This finds the actionpack gem to get the full path. Then with the path to the html-scanner folder, adds it to the loadpath ($:). Now no more pesky load errors.

If there is a cleaner way, let me know.

1 comment

calendar_helper plugin forked

I have been using Geoffrey Grosenbach’s calendar_helper plugin and needed a few changes. I am also using git for projects now and finding the submodule a workable strategy for plugins. So I imported it into git using git-svn and created a new project on GitHub. I plan to do some refactoring to make it a little cleaner but mostly will just tweak for my own usage.

My first changes were to remove the requirement for the year and month to be passed in as options. These now default to the current month and year if not included in the options hash.

I have also added the :month_name_text option to override the default text for the month name. The month name is basically the calendar header so this makes it possible to include the year in the header for clarity.

Now that I have forked it, I removed the gem spec files as it will not be published as a gem as that would confuse everyone and just isn’t the done thing.

Feel free to use and fork of course, these are just my preferences and maybe more to come. Thanks of course go to the original authors and contributors of the plugin.

No comments