Skip to content

Commit

Permalink
Merge pull request igrigorik#188 from urticadioica/rip-sniff
Browse files Browse the repository at this point in the history
Refactor + update keycode parsing
  • Loading branch information
igrigorik committed Jan 18, 2017
2 parents 1cce55d + 34531f8 commit 9ad9557
Show file tree
Hide file tree
Showing 5 changed files with 298 additions and 232 deletions.
2 changes: 1 addition & 1 deletion app/views/shared/_entry.erb
Expand Up @@ -8,7 +8,7 @@
</h6>

<pre style="margin-bottom:0">
<% VimGolf::Keylog.new(entry.script).each do |key| %><% if key.size > 1 %><span style="color:#990000;font-weight:bold"><%= key %></span><% else %><%= key %><% end %><% end %>
<% VimGolf::Keylog.new(entry.script, entry.created_at).each do |key| %><% if key.size > 1 %><span style="color:#990000;font-weight:bold"><%= key %></span><% else %><%= key %><% end %><% end %>
</pre>

<% entry.comments.each do |c| %>
Expand Down
2 changes: 1 addition & 1 deletion lib/vimgolf/lib/vimgolf/challenge.rb
Expand Up @@ -91,7 +91,7 @@ def upload

proxy.start(url.host, url.port) do |http|
request = Net::HTTP::Post.new(url.request_uri)
request.set_form_data({"challenge_id" => @id, "apikey" => Config.load['key'], "entry" => IO.read(log_path)})
request.set_form_data({"challenge_id" => @id, "apikey" => Config.load['key'], "entry" => IO.binread(log_path)})
request["Accept"] = "application/json"

res = http.request(request)
Expand Down
2 changes: 1 addition & 1 deletion lib/vimgolf/lib/vimgolf/cli.rb
Expand Up @@ -114,7 +114,7 @@ def play(challenge)
system(*vimcmd) # assembled as an array, bypasses the shell

if $?.exitstatus.zero?
log = Keylog.new(IO.read(challenge.log_path))
log = Keylog.new(IO.binread(challenge.log_path))

VimGolf.ui.info "\nHere are your keystrokes:"
VimGolf.ui.print_log log
Expand Down

0 comments on commit 9ad9557

Please sign in to comment.