Skip to content

Instantly share code, notes, and snippets.

@picatz
Last active December 27, 2016 21:35
Show Gist options
  • Save picatz/a09629abc2cffa9c2b7518a119f97c34 to your computer and use it in GitHub Desktop.
Save picatz/a09629abc2cffa9c2b7518a119f97c34 to your computer and use it in GitHub Desktop.
class CustomLogParser
# ... previous code for CustomLogParser
def single_timeline(ip)
info = Hash.new(0)
@data.each do |d|
next unless d[:ip] == ip
time = d[:time].strftime("%B %m, %Y")
info[time] += 1
end
info
end
end
# ... previous code for app.rb
post '/timeline' do
@ip = params[:ip] # def not gunna be any XSS or anything lol
@single_timeline = parser.single_timeline(params[:ip])
erb :timeline
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment