Mountainwest RubyConf 2008
I just registered for MountainWest RubyConf 2008. Ezra Zygmuntowicz and Evan Phoenix will be giving the opening keynote speech. It should be lots of fun. This will be my first conference, but since I’m getting into the Rails game full-time now, I figure I better start learning as much as I can. And hey, it’s not like I have to go anywhere to attend—it’s held in Salt Lake.
I’m still considering RailsConf. Anyone else going?
IE conditional comment helper for Rails 1
These days, now that we have IE7, it’s common for those of us developing for the web to use conditional comments instead of CSS hacks to make sure our sites look good in different versions of Internet Explorer. (Or to pass anything else exclusively to IE)
I find myself using them on a regular basis, so here’s a little helper you can throw in your ./helpers/application.helper.rb to Rubify some of that commentage:
# info at http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp
def conditional_comments(options={}, &proc)
inverse = options[:inverse] || ''
comparison = options[:comparison] ? " #{options[:comparison]}" : ''
version = options[:version] || 5
concat("<!--[if#{comparison} #{inverse}IE #{version}]>\n#{yield}\n<![endif]-->", proc.binding)
endJust put it in an ERb evaluation block and feed it a block of output:
<% conditional_comments :comparison => 'gte', version => 5.0 do
stylesheet_link_tag 'layout_ie', 'typography_ie'
end %>Output:
<!--[if gte IE 5.0]>
<link href="/stylesheets/layout_ie.css" media="screen" rel="Stylesheet" type="text/css" />
<link href="/stylesheets/typography_ie.css" media="screen" rel="Stylesheet" type="text/css" />
<![endif]-->It might be a little too much abstraction or processing for your tastes, but I was just a little sick of seeing the comments in every header. Yatta!
RubyOSA is the soul of the wit. 1
One of the most exciting presentations at RubyConf2006 for me was Laurent Sansonetti’s “Leveraging Mac OS X from Ruby”. He’s working for Apple on Ruby-related things, and one thing he mentioned was the integration of Ruby as a framework. Basically you’ll be able to have multiple version of Ruby in your ~/Library/.framework directory (if I understand that correctly?), which might be very useful.
The thing that got everyone excited was his talk about RubyOSA, which will be a bridge between AppleEvents and Ruby (there’s currently something similar called RubyAEOSA, but it’s not very Rubyful and supposedly slow).
RubyOSA is able to open an OS X application and create the Ruby object for it based on the application’s sdef (an XML file).
He has some sample scripts available, but here’s a short script I wrote that I shall call Rapid Rails that you can drop in your ‘Sites’ directory, run ruby rapid_rails.rb and it’ll create a Rails app for you and open it in Textmate. Pretty measly right now (plus you don’t really need RubyOSA for this example), but you could also add some DB stuff to make it ‘rapider’.
require 'rbosa'beginputs ""print "What is the name of the Rails application? "app_name = $stdin.gets.chompendapp_name = app_name.empty? ? 'my_rails_app' : app_name.gsub(/\s/,'_')`rails #{app_name}`beginapp = OSA.app_with_name 'textmate'app.open(app_name)rescue Exception => eputs "Rapid App Error: #{e}"end
I’m over a dog about this RubyOSA!
NOTE FOR YOU: if you have problems with RubyOSA and XML, try downloading the newest LibXML from http://libxml.rubyforge.org/
UPDATE: there’s a script in the ‘sample’ directory of RubyOSA that will generate the sdef file of opened application for you.