More RejectConf Videos
From the ever-helpful Dr. Nic.
From the ever-helpful Dr. Nic.
Found a couple videos from RejectConf, which I missed out on while at RailsConf. And since there was 4 parallel tracks at RailsConf, the most anyone could see is 25% of it. If anyone knows links to more videos from RailsConf07 or RejectConf07, I’d love to know.
Thanks to Dan Kubb for alerting me to a new version of JSMin, the library used by AssetPackager to compress javascript.
With the release of the latest jQuery 1.1.1, it triggered a bug in how jsmin was treating characters within a regexp.
AssetPackager now has the latest version.
Also, for those using Prototype, the v1.5 release that comes with Rails 1.2.1 has a missing semi-colon on line 846. This of course breaks when compressed. To fix it, this line should have a semi-colon at the end. This:
if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_='
Should be:
if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_=';
Update: Michael Schuerig has posted this to the rails trac so hopefully this will be fixed soon. In the meantime, it’s pretty simple to make the change yourself.
Look what just appeared in Rails trunk – Hash#to_query – turn a hash of values into a form-encoded query string. I’ve wanted this on occasion in the past. Check it out:
{:a => 10}.to_query
Becomes this:
a=10
{:person => {:name => 'Nicholas', :login => 'seckar'}}.to_query
Becomes this:
person[name]=Nicholas&person[login]=seckar
{:person => {:id => 10}, :account => {:person => {:id => 20}}}.to_query
Becomes this:
account[person][id]=20&person[id]=10
{:person => {:id => [10, 20]}}.to_query
Becomes this:
person[id][]=10&person[id][]=20
You can do the same thing in Prototype:
$H({ action: 'ship', order_id: 123, fees: ['f1', 'f2'], 'label': 'a demo' }).toQueryString();
Becomes this:
'action=ship&order_id=123&fees=f1&fees=f2&label=a%20demo'
It doesn’t look like Prototype handles the nested conversions yet though.
My plugin AssetPackager has been featured in Scott Raymond’s new book Ajax on Rails !
Thanks Scott! Everyone go buy a copy. AssetPackager has a full section in Chapter 9 – Performance. Nice.
I wrote some convenience rake tasks to automate creation and backup of MySQL databases, and I use it all the time, so I figured I’d plugin-afy it to make it simple to use in all my projects, and share it with the world as well! Here’s the repository
Some rake tasks to automate common database tasks (create/destroy & backup/restore).
./script/plugin install http://sbecker.net/shared/plugins/mysql_tasks
rake db:mysql:create # Create database (using database.yml config)
rake db:mysql:destroy # Destroy database (using database.yml config)
rake db:mysql:backup # Dump schema and data to an SQL file (/db/backup_YYYY_MM_DD.sql)
rake db:mysql:restore # Load schema and data from an SQL file (/db/restore.sql)
Specifying RAILS_ENV works if you want to perform operations on test or production databases.
Some updates to Asset Packager
In Scott Raymond’s latest post, he discusses refactoring IconBuffet.com and following the latest DHH Rails dogma – REST-style resources. He manages to simplify IconBuffet from 10 controllers & 76 actions to 13 controllers and 58 actions total, without removing or adding any features. Thats about 20 less actions. Needless to say, following the recommended REST-style pattern can simplify your work a lot.
“Cutting actions is great, but even more significant is that the remaining ones are almost completely uniform. There are seven standard Rails actions: index, new, create, show, edit, update, and destroy. Everything else—oddball actions—are usually a clue that you’re doing RPC. In the old version, there were forty oddball actions; now there are only five (and four of those are essentially static pages in the about controller.) The upshot is that the controllers are very uniform, which makes the entire application conceptually simpler, and thus easier to maintain, test, and extend.”
Check out more at his site.
RailsConf was great. Tons of new ideas. People using their brains. Outlines of most of the talks at RailsConf can be found here and here.
Now I’m just hanging out at my g/f’s dad’s house in suburbs outside Chicago for a day before we go back to Florida. Gotta hang with the fam. Hopefully we’ll get to hang out IN Chicago a bit tomorrow before the plane.
Asset Packager has been released! (Formerly known as MergeJS) New features include:
Go here to check it out: AssetPackager