Skip to content

Instantly share code, notes, and snippets.

View ohayon's full-sized avatar

David Ohayon ohayon

View GitHub Profile
#!/usr/bin/env ruby
require 'pathname'
code_files = ARGV
code_files.each do |file|
file = Pathname(file)
contents = file.read
contents.gsub!(/(^#import .*\n)+/) do |imports|
imports = imports.split("\n")
imports.sort.uniq.join("\n") << "\n"