DemoCampCUSEC follow-up

Yesterday I presented Thin at DemoCampCUSEC. Things went pretty well and the other presentations were very good too.

My demo was basically re-coding a simplified version of Thin live, here’s the final result:

%w(rubygems eventmachine thin thin_parser rack).each { |f| require f }

class Connection < EventMachine::Connection  
  attr_accessor :app
  def initialize
    @parser =
    @data = ''
    @nparsed = 0
    @env = {}
  def receive_data(data)
    @data << data
    @nparsed = @parser.execute(@env, @data, @nparsed)
    process if @parser.finished?

  def process
    status, headers, body =
    body_output = ''
    body.each { |l| body_output << l }
    send_data "HTTP/1.1 #{status} OK\r\n" +
              headers.inject('') { |h, (k,v)| h += "#k: #v\r\n" } +
              "\r\n" +

welcome_app = proc do |env|
    200,                                  # Status
    {'Content-Type' => 'text/html'},      # Headers
      '<p>Welcome to my server!</p>',            # Body
      '<p><a href="/rails">My Rails app!</a></p>',

rails_app = => '/Users/marc/projects/refactormycode', :prefix => '/rails')

app ='/' => welcome_app, '/rails' => rails_app) do
  EventMachine.start_server '', 3000, Connection do |con| = app

Hope you enjoyed it!



Filed under conference, montreal, ruby, thin

9 responses to “DemoCampCUSEC follow-up

  1. Congrats! Unfortunately, I wasn’t there…

    I was also wondering if you would meet Zed Shaw. I think he’s presenting at CUSEC2 and it would be nice if you’d write about a potential conversation you’d have with him…

  2. no Zed was not at DemoCamp. I heard he went to the bar after the presentations, but I didn’t go.

  3. Great presentation!

    I really enjoyed seeing a rails app server coded in 12 minutes.

  4. thx James!

    was it really 12 min? you timed it?

  5. I’d read the blog posts of course, but it was very interesting to hear you comment on each part of the code as you built the app. Very cool.

  6. hey thx daniel!

    You were there? I didn’t saw you, and they kicked us out very quickly after the presentations.

    I’m glad you find it interesting.

  7. Coding/girl

    so impressive!

  8. Marc-Andre,

    Thanks again for coming out, and making a super cool presentation!
    I’m sorry we had to rush everyone out after, the conference center wasn’t exactly accommodating… :/

    Keep up with the great projects, you do awesome work!

  9. thx to you Julie for organizing this, DemoCamp was a lot of fun. Sad I couldn’t make it to the main event, I’ve red it was amazing.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s