Skip to content

Instantly share code, notes, and snippets.

@s-shin
Last active February 24, 2016 14:13
Show Gist options
  • Save s-shin/266fd1eabdc60edaff1b to your computer and use it in GitHub Desktop.
Save s-shin/266fd1eabdc60edaff1b to your computer and use it in GitHub Desktop.
One-liner to convert icomoon's selection.json to android's string xml.
ruby -rjson -e 'puts "<resources>"; JSON.parse(File.read(ARGV[0]))["icons"].each {|icon| puts " <string name=\"#{ARGV[1]}_#{icon["properties"]["name"]}\">&#x#{icon["properties"]["code"].to_s(16)};</string>"}; puts "</resources>"' path/to/icomoon/selection.json prefix > path/to/values/fonts.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment