Skip to content

Instantly share code, notes, and snippets.

@jeffkreeftmeijer
Created October 1, 2014 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffkreeftmeijer/c9f9416c3d9f969e6845 to your computer and use it in GitHub Desktop.
Save jeffkreeftmeijer/c9f9416c3d9f969e6845 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
Dir['**/*.rb'].each do |path|
lines = File.readlines(path)
new_lines = lines.dup
lines.each do |line|
if line =~ /^# encoding: utf-8/i || line !~ /\S/
new_lines.delete_at(new_lines.index(line))
else
break
end
end
print '.'
File.open(path, 'w') do |file|
file.write(new_lines.join)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment