Rails: Expiring a cached page with namespaces and sweepers
I've got some pages that are cached using their permalinks on the filesystem, such as http://example.com/about-us.html which will need to map to RAILS_ROOT/public/about-us.html ... The issue I have is that I use a namespace for the admin area and the cont...
Written by Sean Behan on 06/17/2012
A Couple of Usefule Snippets When Working with Textmate
Here is the snippet
f path/to/directory 'search string' | open_in_mate
This snippet (technically 2 snippets) will recursively scan the contents of files in a directory and then open all the files it finds in Textmate.
It's useful on large projec...
Written by Sean Behan on 10/18/2013
Use a Cron Job to Automate Sphinx Index Refresh from Rails Rake Task
If using Sphinx, you need to refresh indexes when you add new content to your database. This is fairly easy to do by hand
rake thinking_sphinx:index RAILS_ENV=production
But if you want to automate this and use a cron, remember to set the PATH, SHELL an...
Written by Sean Behan on 06/17/2012
Execute Javascript When Using Link_to_function To Include a Partial in Rails
If you use the link_to_function to replace content in a div with content from a partial, any javascript that you include in the partial will not be executed. It is instead included, but will do nothing. Obviously, this isn't the desired behavior. Why woul...
Written by Sean Behan on 06/17/2012
Generate MySQL Datetime Type Using PHP Date() Function
If you want to insert a datetime that matches the default mysql datetime type format use this
date('Y-m-d H:i:s');
Written by Sean Behan on 06/17/2012