Skip to content

Instantly share code, notes, and snippets.

@lee-dohm
Last active November 2, 2015 23:24
Show Gist options
  • Save lee-dohm/7caedea034733fa7abae to your computer and use it in GitHub Desktop.
Save lee-dohm/7caedea034733fa7abae to your computer and use it in GitHub Desktop.
Atom and OS Version Text Expander Snippets (for OS X)
#!/usr/bin/env ruby
atom_version = `/usr/local/bin/atom --version`.chomp
print "Atom v#{atom_version}"
#!/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']}"
@lee-dohm
Copy link
Author

lee-dohm commented Nov 1, 2015

I have a snippet av for atom-version.rb and a snippet ov for os-version.rb and finally a snippet vers that calls both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment