---
title: Open Source Slides
teaser: Techniques for improving your presentation slides.
tags: news,web,open source,ruby,javascript
author: Dan Croak
published_on: 2009-07-23
---

In August, our training program hits the road at [Lone Star Ruby
Conf](http://lonestarrubyconf.com/) in Austin, TX.  Registration for our
[September Ruby on Rails training](http://rubyonrails.eventbrite.com) is also
now open. It marks our **one-year anniversary** of running [Ruby on Rails
training](http://thoughtbot.com/services/training) classes!

We've learned as much as our students. I'd like to focus on one area: slides.

<object width="425" height="344">
  <param name="movie" value="http://www.youtube.com/v/s1K0nwZP-Ag&amp;hl=en&amp;fs=1&amp;"
    />
  <embed src="http://www.youtube.com/v/s1K0nwZP-Ag&amp;hl=en&amp;fs=1&amp;"
    type="application/x-shockwave-flash" width="425" height="344" />
</object>

- **Problems with slides**

    The format of our class is workshop-oriented, with lectures leading into
    each workshop. Over time, the lectures built up an arsenal of over 1150
    slides.

- **No portability, not open source**

    The slides were all in Keynote but not everyone at thoughtbot is on <span
    class="caps">OS X</span>.

- **Style**

    Achieving beautiful syntax highlighting involved a dance of writing the code
    in Textmate, then copying as <abbr title="Rich Text Format">RTF</abbr> using
    [Dr. Nic's bundle](http://github.com/drnic/copy-as-rtf-tmbundle).

    Changing our design of the slides would be painful. We use master slides,
    but this could be better.

- **Not executable**

    If we wanted to run the code, we had to copy it back into an editor or shell
    to run it. Sometimes there are hidden characters that come along for the
    ride. Ruby freaks out on these characters.

- **No regression suite**

    Slides tend to be error-prone and we don't have a regression test suite for
    it.

- **Format conversion**

    Delivering PDFs to students is time-consuming since the rate of change for
    slides is high and the conversion-and-sharing process is slow.

- **Versioning**

    Versions are non-existent. Trying to maintain Keynote slides in git, our
    preferred version control system, is good for backups but bad for diffs.
    There may be better tools out there for versioning these kind of files, but
    why bother? I'd rather use our familiar file-based tool.

## Solutions

A few weeks ago, I began converting Keynote slides into Markdown. The process is
simple: run `*.md` files through
[slidedown](http://github.com/nakajima/slidedown) by Pat Nakajima.

    gem install slidedown
    vim tdd.md

Create some slides quickly and easily:

```md
!SLIDE

## why automated tests?

![Quizzical puppy](/images/quizzical_puppy.png)

!SLIDE

* prevent regressions
* prove functionality with executable code
* enable refactoring
* think about the interface before implemenation
```

Then convert:

    slidedown tdd.md --template=import > tdd.html

[Example output](http://nakajima.github.com/slidedown)

## Open source, familiar tools

This generates <abbr title="HyperText Markup Language">HTML</abbr> markup that
can be manipulated in the usual way: <abbr title="Cascading Style
Sheets">CSS</abbr> for style and Javascript for behavior (transitions).

We can continue using git. Look at this beautiful diff!

![''](http://images.thoughtbot.com/ui/2009-7-11-slidedown_diff.png)

## Integration with business processes

We looked at the <abbr title="Portable Document Format">PDF</abbr> conversion
process as a business process problem. I had been scp'ing <abbr title="HyperText
Markup Language">HTML</abbr> syllabuses and PDFs to one of our servers and
pointing students to that <abbr title="Uniform Resource Locator">URL</abbr>.
This was a lightweight solution at the beginning that hasn't scaled well over
time.

Now that the core materials have been converted to our most-natural formats, we
decided to create a legitimate training application.

```ruby
class SlideshowsController < ApplicationController
  before_filter :authenticate, :authorize

  def show
    if file_exists?(file)
      render :file => file
    else
      render :nothing => true, :status => 404 and return false
    end
  end

  protected

  def file
    File.join(directory, "#{params[:id]}.html")
  end

  def directory
    File.join(RAILS_ROOT, "app", "views", "slideshows")
  end

  def file_exists?(path)
    File.file?(path)
  end
end
```

Using a similar pattern that we use for `PagesController` (static pages like
about and contact us) and using
[Clearance](http://github.com/thoughtbot/clearance) for authentication, we
quickly had the start to our application.

The possibilities from here are many... automated tests?

We hope to bring together more business processes that have grown out of the
training program over the last year into a system based on tools that we use
every day.

Visit our [Open Source page](https://thoughtbot.com/open-source) to learn more about our team's contributions.
