Permalink
Browse files

1 in 2 million!

  • Loading branch information...
jcs committed Jun 19, 2016
1 parent 4a80080 commit ac3347b9cc66f6d4a44e12f824f22ce531c9c52b
Showing with 11 additions and 3 deletions.
  1. +8 −0 app/controllers/application_controller.rb
  2. +3 −3 app/views/layouts/application.html.erb
@@ -51,6 +51,14 @@ def increase_traffic_counter
Rails.logger.info " Traffic level: #{@traffic.to_i}"
end
if rand(2000000) == 1
@traffic_color = sprintf("%02x%02x%02x",
0, 0, [ 255, (@traffic * 7).floor + 50.0 ].min)
else
@traffic_color = sprintf("%02x%02x%02x",
[ 255, (@traffic * 7).floor + 50.0 ].min, 0, 0)
end
true
end
@@ -45,9 +45,9 @@
<div id="wrapper">
<div id="header">
<div id="headerleft">
<a id="l_holder" style="background-color: #<%= sprintf("%02x%02x%02x",
[ 255, (@traffic * 7).floor + 50.0 ].min, 0, 0) %>;" href="/"
title="<%= Rails.application.name %> (Current traffic: <%= @traffic.to_i %>)"></a>
<a id="l_holder" style="background-color: #<%= @traffic_color %>;"
href="/" title="<%= Rails.application.name %> (Current traffic: <%=
@traffic.to_i %>)"></a>
<% links = {
"/" => @cur_url == "/" ? Rails.application.name : t('.homelink'),

0 comments on commit ac3347b

Please sign in to comment.