Rails: September 2006 Archives

I stole the code posted on reddit earlier today and ported it to ruby. Now I can do the following:

layout = BoxLayout.html <<-END
----------
|        |
----------
| |    | |
| |    | |
| |    | |
| |    | |
----------
|        |
----------
END

puts layout % [header, left_sidebar,
               body,
               right_sidebar, footer]

and get layout code that looks much much cleaner than the equivalent HTML/rhtml/whatever. I can instantly look at this code and know what it is gonna look like in a browser. I'll release this soon, but I have some enhancements for codeforpeople's rubyforge and seattle.rb's hoe first.

Talk at NYC.rb went well

| | Comments (0)

Finished my talk and am winding down. Not bad at all for an unrehearsed talk. I'll be giving it again tomorrow at limewire so I should have plenty of practice for ajaxworld next week. YAY!

ok. dying now... thud

In NYC for the 26th

| | Comments (1)

I'll be in NYC for the 26th! I'm flying out to meet the fabulous Ms. Amy Hoy to interview at Limewire. I'll be missing the Seattle.rb meeting, but going to my first NYC.rb meeting!

While I'm in the city I hope to hang out with some of the NYC.rb crew, have some arepas, and generally have a good time. What else should I do? I get in way too early.

ZenTest 3.4.0 Released

| | Comments (0)

ZenTest version 3.4.0 has been released! Lots of autotest plugin'y goodness!

sudo gem update ZenTest

Changes:

13 minor enhancements

* Broke out example_dot_autotest into multiple files in lib.
* Enhanced hook system so it can return true if event handled.
* Sleep is now 1 second by default because life is too short.
* Hooked interrupt with new hook system. First handler wins.
* Hooked test results before output
* Accurate test counts for Test::Rails.
* Added snarl autotest plugin, thanks to Patrick Hurley.
* Added timestamp autotest plugin, thanks to Joe Goldberg.
* Added redgreen, thanks to Pat Eyler, Sean Carley, and Rob Sanheim.
* Added kdenotify autotest plugin, thanks to Geir Freysson.
* Added markaby support for Test::Rails.
* Added hack to display a tree of render calls.
* Added hook to perform extra setup for

5 bug fixes

- Extended zentest to deal with rails a bit better... ugh.
- Fixed @libs for windoze.
- Fixed inner class/test identification in autotest.
- Namespaced all plugins... eric is anal.
- No longer freak out if rubygems tarball not in multiruby/versions.

ERB made faster (by about 40%?)

| | Comments (1)
require 'benchmark'
require 'erb'

max = (ARGV.shift || 1_000_000).to_i

def validate(src)
  expect = "blah blah 2 " * 50
  result = eval(src)
  unless expect == result then
    raise "expected\n<#{expect}>\nbut got\n<#{result}>\n"
  end
end

def run
  iters = [10, 100, 1_000, 10_000, 100_000]
  Hash[*iters.map { |max|
         real = Benchmark::measure do
           src = []
           50.times { src << "blah blah <%= 1 + 1 %> " }
           src = src.join

           src = ERB.new(src).src

           validate src

           for i in 0..max do
             eval src
           end
         end.real
         [max, real]
       }.flatten]
end

before = run
require 'make_erb_fast' # patches 3 methods
after = run

before.keys.sort.each do |iter|
  puts "%6d\t%6.4f\t%6.4f" % [iter, before[iter], after[iter]]
end

begets:

erb.png

About this Archive

This page is a archive of entries in the Rails category from September 2006.

Rails: August 2006 is the previous archive.

Rails: October 2006 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.1