Last active
December 11, 2019 18:00
-
-
Save mackuba/656718 to your computer and use it in GitHub Desktop.
Finding the longest names in Cocoa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# find /Applications/Xcode.app/Contents/Developer/Platforms -name '*.h' | ruby find_long_names.rb > names.txt | |
names = [] | |
STDIN.each_line do |line| | |
path = line.strip | |
begin | |
File.open(path, "r") do |file| | |
file.each_line do |fline| | |
fline.strip.scan(/\w{40,}/) do |name| | |
names << [name, path] | |
end | |
end | |
end | |
rescue Exception | |
# ignore | |
end | |
end | |
names.sort_by { |n| [n.first.length, n.last] }.uniq.reverse.each do |name, path| | |
puts "#{name.length}\t#{name}\t\t#{path}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment