Last active
November 2, 2015 23:24
-
-
Save lee-dohm/7caedea034733fa7abae to your computer and use it in GitHub Desktop.
Atom and OS Version Text Expander Snippets (for OS X)
This file contains hidden or 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/env ruby | |
atom_version = `/usr/local/bin/atom --version`.chomp | |
print "Atom v#{atom_version}" |
This file contains hidden or 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/env ruby | |
hash = {} | |
key = nil | |
File.open('/System/Library/CoreServices/SystemVersion.plist').each_line do |line| | |
case line | |
when /<key>([^<]+)<\/key>/ then key = Regexp.last_match[1] | |
when /<string>([^<]+)<\/string>/ then hash[key] = Regexp.last_match[1] | |
end | |
end | |
print "#{hash['ProductName']} #{hash['ProductVersion']}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a snippet
av
foratom-version.rb
and a snippetov
foros-version.rb
and finally a snippetvers
that calls both.