Skip to content

Instantly share code, notes, and snippets.

@Widdershin
Created October 24, 2015 05:20
Show Gist options
  • Select an option

  • Save Widdershin/2657fb04a0c414ccea16 to your computer and use it in GitHub Desktop.

Select an option

Save Widdershin/2657fb04a0c414ccea16 to your computer and use it in GitHub Desktop.
Get a day's worth of changes from github for a repo
require 'open-uri'
def get_diff(url = "https://github.com/Widdershin/rx-undoable/compare/master%40%7B1day%7D...master.diff")
open(url) do |diff_file|
diff_file.read
end
end
diff = get_diff
new_text = diff
.split("\n")
.select { |line| line.start_with?('+ ') }
.map { |line| line.slice(1..-1) }
.join("\n")
puts new_text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment