Skip to content

Instantly share code, notes, and snippets.

@jonasschneider
Created January 5, 2012 22:15
Show Gist options
  • Save jonasschneider/1567616 to your computer and use it in GitHub Desktop.
Save jonasschneider/1567616 to your computer and use it in GitHub Desktop.
# encoding: utf-8
require 'sinatra'
require './kvv'
get "/" do
@stop = params[:stop] || "Haendelstraße"
@rides = Kvv.fetch_current(@stop)
erb :view
end
__END__
@@ view
<link rel="stylesheet" href="style.css">
<h1>Nächste Bahnen an der Haltestelle <%= @stop %></h1>
<% @rides.each do |ride| %>
<div class="ride">
<span class="line" style="background-color:<%= Kvv::COLORS[ride.line] || "#ccc" %>;"><%= ride.line %></span>
<span class="text">
nach
<%= ride.destination %>
- in <%= (ride.time - Time.now).to_i / 60 %> Minuten
(<%= ride.time.strftime("%H:%M") %>)
</span>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment