Skip to content

Instantly share code, notes, and snippets.

@diasjorge
Created November 23, 2011 10:09
Show Gist options
  • Save diasjorge/1388332 to your computer and use it in GitHub Desktop.
Save diasjorge/1388332 to your computer and use it in GitHub Desktop.
Dir.chdir(File.expand_path('~/.emacs.d/snippets/'))
Dir['**/*'].each do |f|
unless File.directory?(f)
puts f
content = File.read(f)
unless content =~ /#\s*key:/
key = File.basename(f).split('.').first
content.gsub!(/(#.*name.*\n)/, "\\1# key: #{key}\n")
File.open(f, "w") { |f| f << content }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment