Skip to content

Instantly share code, notes, and snippets.

@pal
Created February 7, 2011 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pal/814382 to your computer and use it in GitHub Desktop.
Save pal/814382 to your computer and use it in GitHub Desktop.
Simple Sinatra-app for listing icon sizes for mobile development, run using ruby mobile-icon-sizes.rb
require 'rubygems'
require 'sinatra'
require "sinatra/reloader" if development?
configure do
ICON_DATA = [
['320x480', 'Default.png', 'Launch image for iPhone and iPod touch (only one available in iOS < 3.2)', :ios],
['320x480', 'Default~iphone.png', 'Launch image for iPhone and iPod touch (to separate from ~ipad)', :ios],
['640x960', 'Default@2x.png', 'Launch image for iPhone high resolution (iPhone 4) (also Default@2x~iphone.png)', :ios],
['768x1004', 'Default-Portrait.png', 'Launch image for iPad (also Default~ipad.png)', :ios],
['768x1004', 'Default-PortraitUpsideDown.png', 'Launch image for iPad (takes precedence over -Portrait)', :ios],
['1024x748', 'Default-Landscape.png', 'Launch image for iPad', :ios],
['1024x748', 'Default-LandscapeLeft.png', 'Launch image for iPad (takes precedence over -Landscape)', :ios],
['1024x748', 'Default-LandscapeRight.png', 'Launch image for iPad (takes precedence over -Landscape)', :ios],
['512x512', 'iTunesArtwork', 'App Store icon', :ios],
['114x114', 'Icon@2x.png', 'Application/web clip icon for iPhone high resolution (iPhone 4)', :ios],
['72x72', 'Icon-72.png', 'Application/web clip icon for iPad', :ios],
['58x58', 'Icon-Small@2x.png', 'Settings/Spotlight icon for iPhone high resolution (iPhone 4)', :ios],
['57x57', 'Icon.png', 'Application/web clip icon for iPhone and iPod touch', :ios],
['50x50', 'Icon-Small-50.png', 'Spotlight icon for iPad', :ios],
['29x29', 'Icon-Small.png', 'Settings/Spotlight icon for iPhone and iPod touch and Settings for iPad', :ios],
['36x36', '~ ic_launcher-ldpi.png', 'Launcher/Menu icon, ldpi', :android],
['48x48', '~ ic_launcher-mdpi.png', 'Launcher/Menu icon, mdpi', :android],
['72x72', '~ ic_launcher-hdpi.png', 'Launcher/Menu icon, hdpi', :android],
['12x~19', '~ ic_status_ldpi.png', 'Status bar (Android 2.3+), ldpi', :android],
['16x~25', '~ ic_status_mdpi.png', 'Status bar (Android 2.3+), mdpi', :android],
['24x~38', '~ ic_status_hdpi.png', 'Status bar (Android 2.3+), hdpi', :android],
['19x19', '~ ic_status_ldpi.png', 'Status bar (Android 2.2 and below), ldpi', :android],
['25x25', '~ ic_status_mdpi.png', 'Status bar (Android 2.2 and below), mdpi', :android],
['38x38', '~ ic_status_hdpi.png', 'Status bar (Android 2.2 and below), hdpi', :android],
['24x24', '~ ic_tab_dialog_list_ldpi.png', 'Tab/Dialog/List View icon, ldpi', :android],
['32x32', '~ ic_tab_dialog_list_mdpi.png', 'Tab/Dialog/List View icon, mdpi', :android],
['48x48', '~ ic_tab_dialog_list_hdpi.png', 'Tab/Dialog/List View icon, hdpi', :android],
['22x29', '~ my-document-type.png', 'Document icon for custom document types for iPhone and iPod touch', :ios],
['44x58', '~ my-document-type@2x.png', 'Document icon for custom document types for iPhone high resolution (iPhone 4)', :ios],
['64x64', '~ my-document-type-small.png', 'Document icon for custom document types for iPad (small)', :ios],
['320x320', '~ my-document-type.png', 'Document icon for custom document types for iPad (large)', :ios],
['~20x20', '~ toolbar.png', 'Toolbar and navigation bar icon for iPhone, iPod touch and iPad', :ios],
['~40x40', '~ toolbar@2x.png', 'Toolbar and navigation bar icon for iPhone high resolution (iPhone 4)', :ios],
['~30x30', '~ tabbar.png', 'Tab bar icon for iPhone, iPod touch and iPad', :ios],
['~60x60', '~ tabbar@2x.png', 'Tab bar icon for iPhone high resolution (iPhone 4)', :ios],
]
end
get '/' do
@iconcollection = [
{'title'=>'iOS', 'value'=>ICON_DATA.select{ |a| a[3] == :ios } },
{'title'=>'Android', 'value'=>ICON_DATA.select{ |a| a[3] == :android } },
{'title'=>'By size', 'value'=>ICON_DATA.sort{ |a, b| a[0].gsub(/~/,'').to_i <=> b[0].gsub(/~/,'').to_i } },
]
haml :index
end
__END__
@@ layout
%html
%head
:css
* {font-family:Helvetica,Sans-serif;}
th {font-weight: bold;}
%body
= yield
@@ index
- @iconcollection.each do |icons|
%h1=icons['title']
%table
%thead
%tr
%th Size (width x height)
%th Name
%th Usage
%th Platform
%tbody
- icons['value'].each do |icon|
%tr
- icon.each do |val|
%td=val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment