├── Support ├── nibs │ ├── notification_hud.nib │ │ ├── .svn │ │ │ ├── format │ │ │ ├── text-base │ │ │ │ ├── info.nib.svn-base │ │ │ │ └── classes.nib.svn-base │ │ │ ├── all-wcprops │ │ │ └── entries │ │ └── keyedobjects.nib │ ├── select_app.nib │ │ └── keyedobjects.nib │ ├── select_single.nib │ │ └── keyedobjects.nib │ ├── select_tags2.nib │ │ ├── keyedobjects.nib │ │ ├── info.nib │ │ └── classes.nib │ ├── select_tags2b.nib │ │ └── keyedobjects.nib │ ├── select_tags3.nib │ │ ├── keyedobjects.nib │ │ ├── classes.nib │ │ └── info.nib │ ├── select_tags3~.nib │ │ ├── keyedobjects.nib │ │ ├── classes.nib │ │ └── info.nib │ ├── select_tags4.nib │ │ ├── keyedobjects.nib │ │ ├── info.nib │ │ └── classes.nib │ ├── select_tags4b.nib │ │ └── keyedobjects.nib │ ├── select_evernote.nib │ │ ├── keyedobjects.nib │ │ ├── info.nib │ │ └── classes.nib │ └── select_project.nib │ │ ├── keyedobjects.nib │ │ ├── info.nib │ │ └── classes.nib └── lib │ ├── alwaystags.txt │ ├── css │ └── images │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_2e83ff_256x240.png │ │ ├── ui-icons_454545_256x240.png │ │ ├── ui-icons_888888_256x240.png │ │ ├── ui-icons_cd0a0a_256x240.png │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ └── ui-bg_highlight-soft_75_cccccc_1x100.png │ ├── json.rb │ ├── json │ ├── version.rb │ ├── ext.rb │ ├── Array.xpm │ ├── Hash.xpm │ ├── FalseClass.xpm │ ├── NilClass.xpm │ ├── TrueClass.xpm │ ├── Numeric.xpm │ ├── add │ │ ├── rails.rb │ │ └── core.rb │ ├── Key.xpm │ ├── String.xpm │ └── pure.rb │ ├── whitelist.txt │ ├── skipwords.txt │ ├── calais.rb │ ├── cooldialog.rb │ ├── textmate.rb │ ├── categories.txt │ ├── utilities.rb │ ├── calais │ └── client.rb │ ├── jquery.tooltip.min.js │ └── livetools.sh ├── Templates └── Blogsmith Markdown Post.tmTemplate │ ├── template_in.md │ └── info.plist ├── Readme.md ├── Snippets ├── dev.tmSnippet ├── via.tmSnippet ├── link.tmSnippet ├── itunes.tmSnippet ├── End text.tmSnippet ├── Continued Break.tmSnippet ├── Make List (Markdown).tmSnippet ├── 101 header.tmSnippet ├── Center Block.tmSnippet ├── Post Headers.tmSnippet ├── Digg Block Boilerplate.tmSnippet ├── TweetMeme Block Boilerplate.tmSnippet └── Contest Rules Boilerplate.tmSnippet ├── Commands ├── Clear Clipboard.tmCommand ├── Clear TODOs.tmCommand ├── Hyphenate Selection.tmCommand ├── Open current link.tmCommand ├── Super Linker.tmCommand ├── SuperLinker.tmCommand ├── Update Categories.tmCommand ├── Edit Skipwords.tmCommand ├── Edit Whitelist.tmCommand ├── Edit AlwaysTags.tmCommand ├── Remove Links (Markdown).tmCommand ├── HTML->Markdown.tmCommand ├── Bracket Tab.tmCommand ├── bracket test.tmCommand ├── Wikipedia Quick Link.tmCommand ├── Update Blogsmith Bundle.tmCommand ├── Open Links In Selection.tmCommand ├── Link.tmCommand ├── Advanced iTunes Search.tmCommand ├── Open selected links in Safari.tmCommand ├── iOS App Price Check.tmCommand ├── Tabs to References (Safari).tmCommand ├── Source URLs from Evernote Search.tmCommand ├── Find Markdown File.tmCommand ├── Link to reference.tmCommand ├── Via Link.tmCommand ├── View TODO.tmCommand ├── Preview TODO.tmCommand ├── Thank Tipsters.tmCommand ├── Statistics.tmCommand ├── Lucky guess spelling fix.tmCommand ├── Prepare post in place.tmCommand ├── Big Huge Labs Thesaurus.tmCommand ├── Copy for Posting.tmCommand ├── Get Main Link.tmCommand ├── Quick spelling guess.tmCommand ├── Tag Completion.tmCommand ├── Diff Draft.tmCommand ├── Convert inline links to references.tmCommand ├── Make Search Link.tmCommand ├── Bing Instant Answer.tmCommand ├── Instant Answer (Bing).tmCommand ├── AutoFill Setup.tmCommand ├── Make Tag Link.tmCommand ├── Select from Moby Thesaurus.tmCommand ├── Add TODO.tmCommand ├── New:Jump to TODO.tmCommand ├── Link Blog Post.tmCommand ├── Bing Web Search.tmCommand ├── Web Search (Bing).tmCommand ├── Bing News Search.tmCommand ├── Blogger Link.tmCommand ├── News Search (Bing).tmCommand ├── Link iPhone App (web).tmCommand ├── Paste Reference List (Markdown).tmCommand ├── $US.tmCommand ├── Choose Categories.tmCommand └── Blogsmith Typography.tmCommand ├── Preferences ├── Fallback (not supported).tmPreferences ├── HTML.tmPreferences └── Markdown.tmPreferences └── DragCommands ├── Link Markdown Notes.tmDragCommand ├── Insert Temp Image.tmDragCommand └── Upload and Insert Image.tmDragCommand /Support/nibs/notification_hud.nib/.svn/format: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /Support/lib/alwaystags.txt: -------------------------------------------------------------------------------- 1 | @not-iphone 2 | @tweet-this 3 | @breakingnews 4 | @app-news -------------------------------------------------------------------------------- /Support/nibs/select_app.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/nibs/select_app.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Support/nibs/select_single.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/nibs/select_single.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Support/nibs/select_tags2.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/nibs/select_tags2.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Support/nibs/select_tags2b.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/nibs/select_tags2b.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Support/nibs/select_tags3.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/nibs/select_tags3.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Support/nibs/select_tags3~.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/nibs/select_tags3~.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Support/nibs/select_tags4.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/nibs/select_tags4.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Support/nibs/select_tags4b.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/nibs/select_tags4b.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Support/nibs/select_evernote.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/nibs/select_evernote.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Support/nibs/select_project.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/nibs/select_project.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Support/lib/css/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/lib/css/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /Support/lib/css/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/lib/css/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /Support/lib/css/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/lib/css/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /Support/lib/css/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/lib/css/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /Support/lib/css/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/lib/css/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /Support/nibs/notification_hud.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/nibs/notification_hud.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Support/lib/css/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/lib/css/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /Support/lib/css/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/lib/css/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /Support/lib/css/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/lib/css/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /Support/lib/css/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/lib/css/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /Support/lib/css/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/lib/css/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /Support/lib/css/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/lib/css/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /Support/lib/css/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/lib/css/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /Templates/Blogsmith Markdown Post.tmTemplate/template_in.md: -------------------------------------------------------------------------------- 1 | doctype: tuawpost 2 | title: 3 | link: 4 | categories: 5 | tags: 6 | appid: 7 | excerpt: 8 | 9 | -------------------------------------------------------------------------------- /Support/lib/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttscoff/blogsmith-tmbundle/master/Support/lib/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /Support/lib/json.rb: -------------------------------------------------------------------------------- 1 | require 'json/common' 2 | module JSON 3 | require 'json/version' 4 | 5 | begin 6 | require 'json/ext' 7 | rescue LoadError 8 | require 'json/pure' 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /Support/lib/json/version.rb: -------------------------------------------------------------------------------- 1 | module JSON 2 | # JSON version 3 | VERSION = '1.1.9' 4 | VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc: 5 | VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc: 6 | VERSION_MINOR = VERSION_ARRAY[1] # :nodoc: 7 | VERSION_BUILD = VERSION_ARRAY[2] # :nodoc: 8 | end 9 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | A [TextMate](http://macromates.com) bundle for Markdown-based blogging on systems with little or no remote (XMLRPC) support. This was designed for [TUAW](http://www.tuaw.com), but is quite flexible and contains myriad commands to make any Markdown-based blogging system smoother. 2 | 3 | Please see for documentation (or something to that effect). -------------------------------------------------------------------------------- /Support/lib/json/ext.rb: -------------------------------------------------------------------------------- 1 | require 'json/common' 2 | 3 | module JSON 4 | # This module holds all the modules/classes that implement JSON's 5 | # functionality as C extensions. 6 | module Ext 7 | require 'json/ext/parser' 8 | require 'json/ext/generator' 9 | $DEBUG and warn "Using c extension for JSON." 10 | JSON.parser = Parser 11 | JSON.generator = Generator 12 | end 13 | 14 | JSON_LOADED = true 15 | end 16 | -------------------------------------------------------------------------------- /Support/lib/json/Array.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * Array_xpm[] = { 3 | "16 16 2 1", 4 | " c None", 5 | ". c #000000", 6 | " ", 7 | " ", 8 | " ", 9 | " .......... ", 10 | " . . ", 11 | " . . ", 12 | " . . ", 13 | " . . ", 14 | " . . ", 15 | " . . ", 16 | " . . ", 17 | " . . ", 18 | " .......... ", 19 | " ", 20 | " ", 21 | " "}; 22 | -------------------------------------------------------------------------------- /Support/lib/json/Hash.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * Hash_xpm[] = { 3 | "16 16 2 1", 4 | " c None", 5 | ". c #000000", 6 | " ", 7 | " ", 8 | " ", 9 | " . . ", 10 | " . . ", 11 | " . . ", 12 | " ......... ", 13 | " . . ", 14 | " . . ", 15 | " ......... ", 16 | " . . ", 17 | " . . ", 18 | " . . ", 19 | " ", 20 | " ", 21 | " "}; 22 | -------------------------------------------------------------------------------- /Support/lib/json/FalseClass.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * False_xpm[] = { 3 | "16 16 2 1", 4 | " c None", 5 | ". c #FF0000", 6 | " ", 7 | " ", 8 | " ", 9 | " ...... ", 10 | " . ", 11 | " . ", 12 | " . ", 13 | " ...... ", 14 | " . ", 15 | " . ", 16 | " . ", 17 | " . ", 18 | " . ", 19 | " ", 20 | " ", 21 | " "}; 22 | -------------------------------------------------------------------------------- /Support/lib/json/NilClass.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * False_xpm[] = { 3 | "16 16 2 1", 4 | " c None", 5 | ". c #000000", 6 | " ", 7 | " ", 8 | " ", 9 | " ... ", 10 | " . . ", 11 | " . . ", 12 | " . . ", 13 | " . . ", 14 | " . . ", 15 | " . . ", 16 | " . . ", 17 | " . . ", 18 | " ... ", 19 | " ", 20 | " ", 21 | " "}; 22 | -------------------------------------------------------------------------------- /Support/lib/json/TrueClass.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * TrueClass_xpm[] = { 3 | "16 16 2 1", 4 | " c None", 5 | ". c #0BF311", 6 | " ", 7 | " ", 8 | " ", 9 | " ......... ", 10 | " . ", 11 | " . ", 12 | " . ", 13 | " . ", 14 | " . ", 15 | " . ", 16 | " . ", 17 | " . ", 18 | " . ", 19 | " ", 20 | " ", 21 | " "}; 22 | -------------------------------------------------------------------------------- /Snippets/dev.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | dev 7 | name 8 | dev 9 | scope 10 | meta.link.reference.def.markdown 11 | tabTrigger 12 | d 13 | uuid 14 | E1A4EB57-C27D-4187-ABCB-883663014443 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/via.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | via 7 | name 8 | via 9 | scope 10 | meta.link.reference.def.markdown 11 | tabTrigger 12 | v 13 | uuid 14 | 2B6B4AB0-AFBF-488B-A793-5AD55CB0034A 15 | 16 | 17 | -------------------------------------------------------------------------------- /Support/nibs/select_tags3.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | {CLASS = MyTableView; LANGUAGE = ObjC; SUPERCLASS = NSTableView; }, 5 | {CLASS = TagFontColor; LANGUAGE = ObjC; SUPERCLASS = NSTableView; }, 6 | { 7 | ACTIONS = {performButtonClick = id; }; 8 | CLASS = myButtons; 9 | LANGUAGE = ObjC; 10 | SUPERCLASS = NSObject; 11 | } 12 | ); 13 | IBVersion = 1; 14 | } -------------------------------------------------------------------------------- /Snippets/link.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | link 7 | name 8 | link 9 | scope 10 | meta.link.reference.def.markdown 11 | tabTrigger 12 | l 13 | uuid 14 | 84CD41F9-1BDC-447A-B250-13912889DCA6 15 | 16 | 17 | -------------------------------------------------------------------------------- /Support/nibs/select_tags3~.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | {CLASS = MyTableView; LANGUAGE = ObjC; SUPERCLASS = NSTableView; }, 5 | {CLASS = TagFontColor; LANGUAGE = ObjC; SUPERCLASS = NSTableView; }, 6 | { 7 | ACTIONS = {performButtonClick = id; }; 8 | CLASS = myButtons; 9 | LANGUAGE = ObjC; 10 | SUPERCLASS = NSObject; 11 | } 12 | ); 13 | IBVersion = 1; 14 | } -------------------------------------------------------------------------------- /Snippets/itunes.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | itunes 7 | name 8 | itunes 9 | scope 10 | meta.link.reference.def.markdown 11 | tabTrigger 12 | i 13 | uuid 14 | D1B8DB53-07DB-4938-97F6-5674A24B10BC 15 | 16 | 17 | -------------------------------------------------------------------------------- /Support/nibs/select_tags3.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 32 5 646 247 0 0 1280 1002 7 | IBFramework Version 8 | 446.1 9 | IBOpenObjects 10 | 11 | 5 12 | 13 | IBSystem Version 14 | 8R2218 15 | 16 | 17 | -------------------------------------------------------------------------------- /Support/nibs/select_tags3~.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 32 5 646 247 0 0 1280 1002 7 | IBFramework Version 8 | 446.1 9 | IBOpenObjects 10 | 11 | 5 12 | 13 | IBSystem Version 14 | 8R2218 15 | 16 | 17 | -------------------------------------------------------------------------------- /Support/nibs/select_evernote.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBFramework Version 6 | 677 7 | IBOldestOS 8 | 5 9 | IBOpenObjects 10 | 11 | 6 12 | 13 | IBSystem Version 14 | 9G55 15 | targetFramework 16 | IBCocoaFramework 17 | 18 | 19 | -------------------------------------------------------------------------------- /Support/nibs/select_project.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBFramework Version 6 | 677 7 | IBOldestOS 8 | 5 9 | IBOpenObjects 10 | 11 | 259 12 | 13 | IBSystem Version 14 | 9G55 15 | targetFramework 16 | IBCocoaFramework 17 | 18 | 19 | -------------------------------------------------------------------------------- /Support/nibs/select_tags2.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBFramework Version 6 | 680 7 | IBOldestOS 8 | 5 9 | IBOpenObjects 10 | 11 | 6 12 | 13 | IBSystem Version 14 | 9J61 15 | targetFramework 16 | IBCocoaFramework 17 | 18 | 19 | -------------------------------------------------------------------------------- /Support/nibs/select_tags4.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBFramework Version 6 | 680 7 | IBOldestOS 8 | 5 9 | IBOpenObjects 10 | 11 | 5 12 | 13 | IBSystem Version 14 | 9J61 15 | targetFramework 16 | IBCocoaFramework 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/End text.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | <!-- end --> 7 | name 8 | End text 9 | scope 10 | text.html,text.html.markdown,text.html.markdown.multimarkdown 11 | tabTrigger 12 | end 13 | uuid 14 | F4C41235-B727-4B08-A82B-8C307AA5611A 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Continued Break.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | <!-- more --> 7 | name 8 | Continued Break 9 | scope 10 | text.html,text.html.markdown,text.html.markdown.multimarkdown 11 | tabTrigger 12 | more 13 | uuid 14 | 363B0133-F480-495C-B68B-9122101D9DE1 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Make List (Markdown).tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | ${TM_SELECTED_TEXT/^(\s+)?(.+)$/$1* $2/g} 7 | keyEquivalent 8 | ^@w 9 | name 10 | Make List (Markdown) 11 | scope 12 | text.html.markdown.multimarkdown, text.html.markdown 13 | uuid 14 | 53418C86-7375-4563-9B0F-3943417A7439 15 | 16 | 17 | -------------------------------------------------------------------------------- /Support/nibs/notification_hud.nib/.svn/text-base/info.nib.svn-base: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 79 75 356 240 0 0 1280 1002 7 | IBFramework Version 8 | 452.0 9 | IBOpenObjects 10 | 11 | 60 12 | 13 | IBSystem Version 14 | 9A283 15 | IBUsesTextArchiving 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Support/nibs/notification_hud.nib/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 62 4 | /!svn/ver/6251/trunk/Support/nibs/SimpleNotificationWindow.nib 5 | END 6 | info.nib 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 71 10 | /!svn/ver/6251/trunk/Support/nibs/SimpleNotificationWindow.nib/info.nib 11 | END 12 | keyedobjects.nib 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 79 16 | /!svn/ver/6251/trunk/Support/nibs/SimpleNotificationWindow.nib/keyedobjects.nib 17 | END 18 | classes.nib 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 74 22 | /!svn/ver/6251/trunk/Support/nibs/SimpleNotificationWindow.nib/classes.nib 23 | END 24 | -------------------------------------------------------------------------------- /Support/lib/json/Numeric.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * Numeric_xpm[] = { 3 | "16 16 9 1", 4 | " c None", 5 | ". c #FF0000", 6 | "+ c #0000FF", 7 | "@ c #0023DB", 8 | "# c #00EA14", 9 | "$ c #00FF00", 10 | "% c #004FAF", 11 | "& c #0028D6", 12 | "* c #00F20C", 13 | " ", 14 | " ", 15 | " ", 16 | " ... +++@#$$$$ ", 17 | " .+ %& $$ ", 18 | " . + $ ", 19 | " . + $$ ", 20 | " . ++$$$$ ", 21 | " . + $$ ", 22 | " . + $ ", 23 | " . + $ ", 24 | " . + $ $$ ", 25 | " .....++++*$$ ", 26 | " ", 27 | " ", 28 | " "}; 29 | -------------------------------------------------------------------------------- /Snippets/101 header.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | *More [Mac 101](http://www.tuaw.com/tag/Mac101/), tips and tricks for the novice Mac user.* 7 | name 8 | 101 header 9 | scope 10 | text.html.markdown, text.html.markdown.multimarkdown 11 | tabTrigger 12 | 101 13 | uuid 14 | F70B1DA7-639A-4143-8B29-CDDE3BFAC416 15 | 16 | 17 | -------------------------------------------------------------------------------- /Commands/Clear Clipboard.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | echo ''|pbcopy 9 | input 10 | none 11 | keyEquivalent 12 | ^~l 13 | name 14 | Clear Clipboard 15 | output 16 | discard 17 | uuid 18 | 113066C8-B526-49CE-992E-0FEF4D698643 19 | 20 | 21 | -------------------------------------------------------------------------------- /Snippets/Center Block.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | <div style="text-align: center;">${TM_SELECTED_TEXT}</div> 7 | keyEquivalent 8 | ^@w 9 | name 10 | Center Block 11 | scope 12 | text.html,text.html.markdown,text.html.markdown.multimarkdown 13 | tabTrigger 14 | center 15 | uuid 16 | 925F2507-B49C-43A6-B521-53315894BD0A 17 | 18 | 19 | -------------------------------------------------------------------------------- /Commands/Clear TODOs.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | 10 | doc = STDIN.read 11 | 12 | puts doc.gsub(/^<\d+>\s.*?$/,'').gsub(/<\d+>/,'') 13 | input 14 | document 15 | name 16 | Clear TODOs 17 | output 18 | replaceSelectedText 19 | uuid 20 | C02F06D8-FB9D-416E-BAB8-6FB2413F01A3 21 | 22 | 23 | -------------------------------------------------------------------------------- /Snippets/Post Headers.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | doctype: tuawpost 7 | title: ${1:Post Title} 8 | link: ${2:http://} 9 | categories: $3 10 | tags: $4 11 | appid: $5 12 | excerpt: $6 13 | $0 14 | name 15 | Post Headers 16 | scope 17 | text.html.markdown, text.html.markdown.multimarkdown,text.html 18 | tabTrigger 19 | headers 20 | uuid 21 | 469D3F1B-6B02-4A7A-B142-2BBD6EEB7BB2 22 | 23 | 24 | -------------------------------------------------------------------------------- /Templates/Blogsmith Markdown Post.tmTemplate/info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | command 6 | if [[ ! -f "$TM_NEW_FILE" ]]; then 7 | TM_YEAR=`date +%Y` \ 8 | TM_DATE=`date +%Y-%m-%d` \ 9 | perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' \ 10 | < template_in.md > "$TM_NEW_FILE" 11 | fi 12 | extension 13 | md 14 | keyEquivalent 15 | ~@P 16 | name 17 | Blogsmith Markdown Post 18 | uuid 19 | 7D554CE8-6BD2-4D30-A8AC-13D434443102 20 | 21 | 22 | -------------------------------------------------------------------------------- /Snippets/Digg Block Boilerplate.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | <div style="float: left; margin-right: 10px; margin-bottom: 2px;"> 7 | <script type="text/javascript"> 8 | digg_url = 'http://POST-URL-Here/'; 9 | </script> 10 | <script src="http://digg.com/tools/diggthis.js" type="text/javascript"> 11 | </script> 12 | </div> 13 | name 14 | Digg Block Boilerplate 15 | tabTrigger 16 | digg 17 | uuid 18 | C5F9CCAF-8922-458D-80E9-1B869C2A44BA 19 | 20 | 21 | -------------------------------------------------------------------------------- /Commands/Hyphenate Selection.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | 10 | print STDIN.read.gsub(/\b\s+\b/,'-') 11 | fallbackInput 12 | line 13 | input 14 | selection 15 | keyEquivalent 16 | ^- 17 | name 18 | Hyphenate Selection 19 | output 20 | replaceSelectedText 21 | uuid 22 | FABC6A2D-031F-42FC-BAE9-DA994B493687 23 | 24 | 25 | -------------------------------------------------------------------------------- /Commands/Open current link.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | open $(cat) 9 | fallbackInput 10 | scope 11 | input 12 | selection 13 | keyEquivalent 14 | 15 | name 16 | Open Current Link 17 | output 18 | showAsTooltip 19 | scope 20 | markup.underline.link.markdown 21 | uuid 22 | 649B51A1-0D31-4F08-BCF6-96DAAE298DBA 23 | 24 | 25 | -------------------------------------------------------------------------------- /Snippets/TweetMeme Block Boilerplate.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | <div style="float: left; margin-right: 10px; margin-bottom: 2px;"> 7 | <script type="text/javascript"> 8 | tweetmeme_url = 'http://POST-URL-Here'; 9 | tweetmeme_source = 'tuaw'; 10 | </script> 11 | <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script> 12 | </div> 13 | name 14 | TweetMeme Block Boilerplate 15 | tabTrigger 16 | tweet 17 | uuid 18 | F1B103F5-2D18-4DFB-BF9B-6E4B8200AA2A 19 | 20 | 21 | -------------------------------------------------------------------------------- /Commands/Super Linker.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | require "#{ENV['TM_BUNDLE_SUPPORT']}/lib/linkage.rb" 10 | 11 | Linkage.new.do_superlink 12 | fallbackInput 13 | document 14 | input 15 | document 16 | name 17 | SuperLinker 18 | output 19 | replaceSelectedText 20 | scope 21 | text.html.markdown.multimarkdown, text.html.markdown 22 | uuid 23 | 6E088D62-39AB-47DD-AB76-8D767BEE125C 24 | 25 | 26 | -------------------------------------------------------------------------------- /Commands/SuperLinker.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | require "#{ENV['TM_BUNDLE_SUPPORT']}/lib/linkage.rb" 10 | 11 | Linkage.new.do_superlink 12 | fallbackInput 13 | document 14 | input 15 | document 16 | name 17 | SuperLinker 18 | output 19 | replaceSelectedText 20 | scope 21 | text.html.markdown.multimarkdown, text.html.markdown 22 | uuid 23 | 6E088D62-39AB-47DD-AB76-8D767BEE125C 24 | 25 | 26 | -------------------------------------------------------------------------------- /Commands/Update Categories.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | catfile="$HOME/Library/Preferences/com.macromates.textmate.blogsmith.categories.txt" 9 | if [[ ! -e "$catfile" ]]; then 10 | cp "$TM_BUNDLE_SUPPORT/lib/categories.txt" "$catfile" 11 | fi 12 | catfile=${catfile// /%20} # turn spaces into %20 13 | open txmt://open?url=file://$catfile 14 | input 15 | none 16 | name 17 | Update Categories 18 | output 19 | discard 20 | uuid 21 | BE4B6175-9492-439C-B3F2-3F8EED227F98 22 | 23 | 24 | -------------------------------------------------------------------------------- /Commands/Edit Skipwords.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | SkipWords="$HOME/Library/Preferences/com.macromates.textmate.blogsmith.skipwords.txt" 9 | if [[ ! -e "$SkipWords" ]]; then 10 | cp "$TM_BUNDLE_SUPPORT/lib/skipwords.txt" "$SkipWords" 11 | fi 12 | SkipWords=${SkipWords// /%20} # turn spaces into %20 13 | open txmt://open?url=file://$SkipWords 14 | input 15 | none 16 | name 17 | Edit Skipwords 18 | output 19 | discard 20 | uuid 21 | 598BDB47-D98B-4EB4-BB4D-12D5EEAFA419 22 | 23 | 24 | -------------------------------------------------------------------------------- /Commands/Edit Whitelist.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | WhiteList="$HOME/Library/Preferences/com.macromates.textmate.blogsmith.whitelist.txt" 9 | if [[ ! -e "$WhiteList" ]]; then 10 | cp "$TM_BUNDLE_SUPPORT/lib/whitelist.txt" "$WhiteList" 11 | fi 12 | WhiteList=${WhiteList// /%20} # turn spaces into %20 13 | open txmt://open?url=file://$WhiteList 14 | input 15 | none 16 | name 17 | Edit Whitelist 18 | output 19 | discard 20 | uuid 21 | BC58D603-49C9-4990-8002-ABC05153D0FD 22 | 23 | 24 | -------------------------------------------------------------------------------- /Preferences/Fallback (not supported).tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Fallback (not supported) 7 | settings 8 | 9 | shellVariables 10 | 11 | 12 | name 13 | TM_BLINK_FORMAT 14 | value 15 | (this language is not supported, see … for more info) 16 | 17 | 18 | name 19 | TM_MONEY_FORMAT 20 | value 21 | US$<%= num %> 22 | 23 | 24 | 25 | uuid 26 | EA606140-E776-407B-ADDF-D6FEB1FE902D 27 | 28 | 29 | -------------------------------------------------------------------------------- /Commands/Edit AlwaysTags.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | AlwaysTags="$HOME/Library/Preferences/com.macromates.textmate.blogsmith.alwaystags.txt" 9 | if [[ ! -e "$AlwaysTags" ]]; then 10 | cp "$TM_BUNDLE_SUPPORT/lib/alwaystags.txt" "$AlwaysTags" 11 | fi 12 | AlwaysTags=${AlwaysTags// /%20} # turn spaces into %20 13 | open txmt://open?url=file://$AlwaysTags 14 | input 15 | none 16 | name 17 | Edit AlwaysTags 18 | output 19 | discard 20 | uuid 21 | E0823DD8-D7D6-4688-8C16-1881B69C8A6F 22 | 23 | 24 | -------------------------------------------------------------------------------- /Support/nibs/select_project.nib/classes.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBClasses 6 | 7 | 8 | CLASS 9 | FirstResponder 10 | LANGUAGE 11 | ObjC 12 | SUPERCLASS 13 | NSObject 14 | 15 | 16 | ACTIONS 17 | 18 | performButtonClick 19 | id 20 | 21 | CLASS 22 | myButtons 23 | LANGUAGE 24 | ObjC 25 | SUPERCLASS 26 | NSObject 27 | 28 | 29 | IBVersion 30 | 1 31 | 32 | 33 | -------------------------------------------------------------------------------- /Support/nibs/select_tags2.nib/classes.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBClasses 6 | 7 | 8 | CLASS 9 | FirstResponder 10 | LANGUAGE 11 | ObjC 12 | SUPERCLASS 13 | NSObject 14 | 15 | 16 | ACTIONS 17 | 18 | performButtonClick 19 | id 20 | 21 | CLASS 22 | myButtons 23 | LANGUAGE 24 | ObjC 25 | SUPERCLASS 26 | NSObject 27 | 28 | 29 | IBVersion 30 | 1 31 | 32 | 33 | -------------------------------------------------------------------------------- /Support/nibs/select_tags4.nib/classes.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBClasses 6 | 7 | 8 | CLASS 9 | FirstResponder 10 | LANGUAGE 11 | ObjC 12 | SUPERCLASS 13 | NSObject 14 | 15 | 16 | ACTIONS 17 | 18 | performButtonClick 19 | id 20 | 21 | CLASS 22 | myButtons 23 | LANGUAGE 24 | ObjC 25 | SUPERCLASS 26 | NSObject 27 | 28 | 29 | IBVersion 30 | 1 31 | 32 | 33 | -------------------------------------------------------------------------------- /Support/nibs/select_evernote.nib/classes.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBClasses 6 | 7 | 8 | CLASS 9 | FirstResponder 10 | LANGUAGE 11 | ObjC 12 | SUPERCLASS 13 | NSObject 14 | 15 | 16 | ACTIONS 17 | 18 | performButtonClick 19 | id 20 | 21 | CLASS 22 | myButtons 23 | LANGUAGE 24 | ObjC 25 | SUPERCLASS 26 | NSObject 27 | 28 | 29 | IBVersion 30 | 1 31 | 32 | 33 | -------------------------------------------------------------------------------- /Preferences/HTML.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | HTML 7 | scope 8 | text.html 9 | settings 10 | 11 | shellVariables 12 | 13 | 14 | name 15 | TM_BLINK_FORMAT 16 | value 17 | <a href="${2:<%= e_sn url %>}">${1:<%= e_sn input %>}</a>$0 18 | 19 | 20 | name 21 | TM_MONEY_FORMAT 22 | value 23 | US$<%= num %> 24 | 25 | 26 | 27 | uuid 28 | 2428CCE4-E7F7-4A39-91A2-7CA9C627D10F 29 | 30 | 31 | -------------------------------------------------------------------------------- /Commands/Remove Links (Markdown).tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | 10 | input = STDIN.read 11 | 12 | print input.gsub(/^\s*\[([^\]]+)\]\: .*?$/,"\\1").gsub(/\[([^\]]+)\]\(.*?\)/,"\\1").gsub(/\[(.*?)\]\[\S*?\]/,"\\1") 13 | input 14 | selection 15 | keyEquivalent 16 | ^@w 17 | name 18 | Remove Links (Markdown) 19 | output 20 | replaceSelectedText 21 | scope 22 | text.html.markdown.multimarkdown, text.html.markdown 23 | uuid 24 | 0720A6C8-CA87-4DD8-813E-26AF03833D0D 25 | 26 | 27 | -------------------------------------------------------------------------------- /DragCommands/Link Markdown Notes.tmDragCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | 10 | path = ENV['TM_DROPPED_FILEPATH'] 11 | name = ENV['TM_DROPPED_FILE'] 12 | 13 | # if ENV['TM_CURRENT_WORD'] =~ /^<\d+> / 14 | print "[#{File.basename(name)}](txmt://open/?url=file://#{path})" 15 | # end 16 | draggedFileExtensions 17 | 18 | md 19 | markdown 20 | 21 | input 22 | selection 23 | name 24 | Link Markdown Notes 25 | output 26 | insertAsSnippet 27 | scope 28 | text.html.markdown.multimarkdown meta.content.multimarkdown 29 | uuid 30 | DAEA38C3-E097-4E78-9194-33BE807F19D8 31 | 32 | 33 | -------------------------------------------------------------------------------- /Snippets/Contest Rules Boilerplate.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | Here are the rules and a link to the legal statement: 7 | 8 | * Open to legal US residents of the 50 United States and the District of Columbia who are 18 and older. 9 | * To enter leave a comment ${1:describing...}. 10 | * The comment must be left before ${2:Wednesday, July 22, 11:59PM} Eastern Daylight Time. 11 | * You may enter only once. 12 | * ${3:Ten winners} will be selected in a random drawing. 13 | * Prize: ${4:Promo code for...} (US\$${5:1.99} value) 14 | * Click Here for complete [Official Rules](http://www.weblogsinc.com/official-giveaway-rules). 15 | 16 | ${6:Good Luck!} 17 | $0 18 | name 19 | Contest Rules Boilerplate 20 | scope 21 | text.html.markdown.multimarkdown, text.html.markdown 22 | tabTrigger 23 | contest 24 | uuid 25 | FDA18519-51E3-4FC1-83A5-DCEBEC78C5E3 26 | 27 | 28 | -------------------------------------------------------------------------------- /Commands/HTML->Markdown.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/php 9 | <?php 10 | require(getenv('TM_BUNDLE_SUPPORT').'/lib/markdownify_extra.php'); 11 | 12 | // $input = file_get_contents('php://stdin'); 13 | 14 | $input = stream_get_contents(STDIN); 15 | 16 | $linksAfterEachParagraph = true; 17 | $bodyWidth = 0; 18 | $keepHTML = false; 19 | 20 | $parser = new Markdownify_Extra($linksAfterEachParagraph, $bodyWidth, $keepHTML); 21 | 22 | echo $parser->parseString($input) ."\n"; 23 | input 24 | selection 25 | keyEquivalent 26 | ^@w 27 | name 28 | Convert HTML to Markdown 29 | output 30 | replaceSelectedText 31 | scope 32 | text.html,text.html.markdown, text.html.markdown.multimarkdown 33 | uuid 34 | C8A638B1-7B9B-4C03-B1FB-02DDDE85142F 35 | 36 | 37 | -------------------------------------------------------------------------------- /Support/lib/whitelist.txt: -------------------------------------------------------------------------------- 1 | AirPort 2 | AirTunes 3 | Airport Express 4 | Airport Extreme 5 | Al Gore 6 | App Store 7 | Apple Ceo 8 | Apple Store 9 | Apple Store Down 10 | Best Of The Week 11 | Best Of The Year 12 | Black Berry 13 | BootCamp 14 | Candy Bar 15 | ChaChing 16 | Comic Life 17 | Crash Bandicoot 18 | Credit Card 19 | Delivery Status 20 | Dvd Studio Pro 21 | Fake Steve 22 | File Vault 23 | First Look 24 | Flickr Export 25 | Flickr Find 26 | Free Feed 27 | Google Reader 28 | Google Tech Talks 29 | Guided Tour 30 | Ipod Classic 31 | Itunes Japan 32 | Itunes Store 33 | Mac Mini 34 | Mac Os 35 | Mac Os X 36 | MacBook 37 | MacBook Air 38 | MacBook Pro 39 | MadTv 40 | MagSafe 41 | Microsoft Office 42 | Mobile Me 43 | Mobile Phones 44 | Mod My iFone 45 | Most Popular 46 | NetNewsWire 47 | Network Location 48 | New Bloggers 49 | OS X 50 | Open Source 51 | Opensource 52 | Path Finder 53 | Rapid Weaver 54 | ScreenFlow 55 | Secure Your Mac 56 | Snow Leopard 57 | SoHo 58 | Software Update 59 | SpringBoard 60 | Steve Jobs 61 | SuperDuper 62 | Text Editor 63 | The Hit List 64 | Third Party Applications 65 | Time Capsule 66 | Time Machine 67 | Time Management 68 | Tuaw Tip 69 | VisualHub 70 | Web Mail 71 | Weekend Review 72 | Wolf Quest 73 | ZiPhone -------------------------------------------------------------------------------- /Support/lib/skipwords.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 0 11 | one 12 | two 13 | three 14 | four 15 | five 16 | about 17 | actually 18 | always 19 | even 20 | given 21 | into 22 | just 23 | not 24 | Im 25 | thats 26 | its 27 | arent 28 | weve 29 | ive 30 | didnt 31 | dont 32 | the 33 | of 34 | to 35 | and 36 | a 37 | in 38 | is 39 | it 40 | you 41 | that 42 | he 43 | was 44 | for 45 | on 46 | are 47 | with 48 | as 49 | I 50 | his 51 | they 52 | be 53 | at 54 | one 55 | have 56 | this 57 | from 58 | or 59 | had 60 | by 61 | hot 62 | but 63 | some 64 | what 65 | there 66 | we 67 | can 68 | out 69 | were 70 | all 71 | your 72 | when 73 | up 74 | use 75 | how 76 | said 77 | an 78 | each 79 | she 80 | which 81 | do 82 | their 83 | if 84 | will 85 | way 86 | many 87 | then 88 | them 89 | would 90 | like 91 | so 92 | these 93 | her 94 | see 95 | him 96 | has 97 | more 98 | could 99 | go 100 | come 101 | did 102 | my 103 | no 104 | get 105 | me 106 | say 107 | too 108 | here 109 | must 110 | such 111 | try 112 | us 113 | own 114 | oh 115 | any 116 | youll 117 | youre 118 | also 119 | than 120 | those 121 | though 122 | thing 123 | things -------------------------------------------------------------------------------- /Commands/Bracket Tab.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | require SUPPORT + '/lib/exit_codes' 11 | 12 | 13 | if ENV['TM_CURRENT_LINE'] =~ /^[^\]]/ 14 | lefttext = ENV['TM_CURRENT_LINE'][0,ENV['TM_LINE_INDEX'].to_i] 15 | righttext = ENV['TM_CURRENT_LINE'][ENV['TM_LINE_INDEX'].to_i,ENV['TM_CURRENT_LINE'].length] 16 | newline = lefttext + "[" + righttext + "$0" 17 | TextMate.exit_insert_snippet newline 18 | else 19 | print "[]$0" 20 | end 21 | fallbackInput 22 | line 23 | input 24 | selection 25 | name 26 | Bracket Tab 27 | output 28 | insertAsSnippet 29 | scope 30 | text.html.markdown, text.html.markdown.multimarkdown 31 | tabTrigger 32 | [ 33 | uuid 34 | 3A0D6DA6-0C63-4DB1-84F4-259123064279 35 | 36 | 37 | -------------------------------------------------------------------------------- /Commands/bracket test.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | require SUPPORT + '/lib/exit_codes' 11 | 12 | 13 | if ENV['TM_CURRENT_LINE'] =~ /^[^\]]/ 14 | lefttext = ENV['TM_CURRENT_LINE'][0,ENV['TM_LINE_INDEX'].to_i] 15 | righttext = ENV['TM_CURRENT_LINE'][ENV['TM_LINE_INDEX'].to_i,ENV['TM_CURRENT_LINE'].length] 16 | newline = lefttext + "[" + righttext + "$0" 17 | TextMate.exit_insert_snippet newline 18 | else 19 | print "[]$0" 20 | end 21 | fallbackInput 22 | line 23 | input 24 | selection 25 | name 26 | Bracket Tab 27 | output 28 | insertAsSnippet 29 | scope 30 | text.html.markdown, text.html.markdown.multimarkdown 31 | tabTrigger 32 | [ 33 | uuid 34 | 3A0D6DA6-0C63-4DB1-84F4-259123064279 35 | 36 | 37 | -------------------------------------------------------------------------------- /Commands/Wikipedia Quick Link.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env php 9 | <?php 10 | $input = file_get_contents('php://stdin'); 11 | $terms = urlencode($input.' site:wikipedia.org'); 12 | $url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&filter=1&rsz=small&" 13 | . "q=$terms"; 14 | 15 | $ch = curl_init(); 16 | curl_setopt($ch, CURLOPT_URL, $url); 17 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 18 | curl_setopt($ch, CURLOPT_REFERER, "TextMate Wikify"); 19 | $body = curl_exec($ch); 20 | curl_close($ch); 21 | 22 | $json = json_decode($body,TRUE); 23 | echo "[$input](".$json['responseData']['results'][0]['url'].")"; 24 | ?> 25 | input 26 | selection 27 | keyEquivalent 28 | ^@w 29 | name 30 | Wikipedia Quick Link 31 | output 32 | replaceSelectedText 33 | scope 34 | text.html.markdown.multimarkdown, text.html.markdown 35 | uuid 36 | 9FDA5CBE-7FF5-4854-A893-B512980FC2C6 37 | 38 | 39 | -------------------------------------------------------------------------------- /Commands/Update Blogsmith Bundle.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | 10 | Dir.chdir(ENV['TM_BUNDLE_PATH']) 11 | is_git = %x{/usr/local/git/bin/git status &>/dev/null;echo $?}.to_i == 128 ? false : true 12 | puts <<-EOF 13 | <html> 14 | <head> 15 | <title>Update Blogsmith Bundle</title> 16 | </head> 17 | <body> 18 | EOF 19 | 20 | puts "<h2>Updating Blogsmith bundle</h2>" 21 | 22 | if is_git 23 | puts " <pre>" 24 | puts %x{/usr/local/git/bin/git pull} 25 | puts " </pre>" 26 | else 27 | puts "<p>This command only works if you've installed the Blogsmith bundle using Git. See the documentation for more information.<p>" 28 | end 29 | puts <<-EOF 30 | </body> 31 | </html> 32 | EOF 33 | 34 | %x{osascript -e 'tell app "TextMate" to reload bundles'} 35 | input 36 | none 37 | name 38 | Update Blogsmith Bundle 39 | output 40 | showAsHTML 41 | uuid 42 | 7243BB01-57E4-423B-8DDA-A01A58D55210 43 | 44 | 45 | -------------------------------------------------------------------------------- /Commands/Open Links In Selection.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes.rb" 10 | 11 | input = STDIN.read 12 | TextMate.exit_show_tool_tip "Please select some text with links" if input.empty? 13 | # links = input.scan /(https?:\/\/[^" \n]+)/m 14 | links = input.scan /(https?:\/\/([^\s",;]+)\..{2,4}(\/[^\s",;!]+))/mi 15 | TextMate.exit_show_tool_tip "Please select some text with links" if links.empty? 16 | # links.each {|link| puts link[0]} 17 | links.each {|link| %x{osascript -e 'tell application "Safari" to open location "#{link[0]}"'}} 18 | # links.each {|link| %x{osascript -e 'open location "#{link[0]}"'}} 19 | fallbackInput 20 | none 21 | input 22 | selection 23 | keyEquivalent 24 | ^@w 25 | name 26 | Open Links In Selection 27 | output 28 | discard 29 | scope 30 | text.html, text.html.markdown, text.html.markdown.multimarkdown,text.html 31 | uuid 32 | F33AAF3A-B233-472C-99D2-6C4239B6D608 33 | 34 | 35 | -------------------------------------------------------------------------------- /Commands/Link.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | require "#{ENV['TM_BUNDLE_SUPPORT']}/lib/linkage.rb" 10 | # require 'erb' 11 | 12 | input = STDIN.read 13 | input,url = Linkage.new.link_word(input) 14 | if input.empty? && !(ENV['TM_SCOPE'].scan(/markdown/).empty?) && ENV['TM_CURRENT_LINE'] =~ /^(\s+)?$/ 15 | puts "[${1:title}]: ${2:#{url}}" 16 | elsif !(ENV['TM_SCOPE'].scan(/markdown/).empty?) && ENV['TM_CURRENT_LINE'] =~ /^(\s+|#{input})?$/ 17 | print ERB.new(ENV['TM_REF_LINK_FORMAT']).result 18 | else 19 | print ERB.new(ENV['TM_BLINK_FORMAT']).result 20 | end 21 | 22 | fallbackInput 23 | word 24 | input 25 | selection 26 | keyEquivalent 27 | ^@w 28 | name 29 | Link 30 | output 31 | insertAsSnippet 32 | scope 33 | text.html, text.html.markdown, text.html.markdown.multimarkdown, text.html.textile, text.bbcode, text.moinmoin, text.restructuredtext 34 | uuid 35 | A350595A-C95E-48AD-85DA-132429747C64 36 | 37 | 38 | -------------------------------------------------------------------------------- /Commands/Advanced iTunes Search.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | DIALOG = ENV['DIALOG'] 11 | require SUPPORT + '/lib/ui' 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/exit_codes' 14 | 15 | input = STDIN.read 16 | term = TextMate::UI.request_string(:title => "Search Query",:prompt => "Enter terms to search in iTunes",:default => input) 17 | TextMate.exit_discard unless term 18 | `open "itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/advancedSearch?entity=software&media=software&submit=seeAll&term=#{e_sh term}"` 19 | fallbackInput 20 | word 21 | input 22 | selection 23 | keyEquivalent 24 | ^@w 25 | name 26 | Advanced iTunes Search 27 | output 28 | discard 29 | scope 30 | text.html, text.html.markdown, text.html.markdown.multimarkdown, text.html.textile, text.bbcode, text.moinmoin, text.restructuredtext 31 | uuid 32 | B60A2F03-8425-4D10-8FF8-7627D27F7749 33 | 34 | 35 | -------------------------------------------------------------------------------- /Commands/Open selected links in Safari.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes.rb" 10 | 11 | input = STDIN.read 12 | TextMate.exit_show_tool_tip "Please select some text with links" if input.empty? 13 | # links = input.scan /(https?:\/\/[^" \n]+)/m 14 | links = input.scan /(https?:\/\/([^\s",;]+)\..{2,4}(\/[^\s",;!]+))/mi 15 | TextMate.exit_show_tool_tip "Please select some text with links" if links.empty? 16 | # links.each {|link| puts link[0]} 17 | links.each {|link| %x{osascript -e 'tell application "Safari" to open location "#{link[0]}"'}} 18 | # links.each {|link| %x{osascript -e 'open location "#{link[0]}"'}} 19 | fallbackInput 20 | none 21 | input 22 | selection 23 | keyEquivalent 24 | ^@w 25 | name 26 | Open Links In Selection 27 | output 28 | discard 29 | scope 30 | text.html, text.html.markdown, text.html.markdown.multimarkdown,text.html 31 | uuid 32 | F33AAF3A-B233-472C-99D2-6C4239B6D608 33 | 34 | 35 | -------------------------------------------------------------------------------- /Support/lib/calais.rb: -------------------------------------------------------------------------------- 1 | require 'digest/sha1' 2 | require 'net/http' 3 | require 'cgi' 4 | require 'iconv' 5 | require 'set' 6 | 7 | require 'rubygems' 8 | require 'xml/libxml' 9 | require 'json' 10 | require 'curb' 11 | 12 | $KCODE = "UTF8" 13 | require 'jcode' 14 | 15 | $:.unshift File.expand_path(File.dirname(__FILE__)) + '/calais' 16 | 17 | require 'client' 18 | require 'response' 19 | 20 | module Calais 21 | REST_ENDPOINT = "http://api.opencalais.com/enlighten/rest/" 22 | BETA_REST_ENDPOINT = "http://beta.opencalais.com/enlighten/rest/" 23 | 24 | AVAILABLE_CONTENT_TYPES = { 25 | :xml => 'text/xml', 26 | :text => 'text/txt', 27 | :html => 'text/html', 28 | :raw => 'text/raw' 29 | } 30 | 31 | AVAILABLE_OUTPUT_FORMATS = { 32 | :rdf => 'xml/rdf', 33 | :simple => 'text/simple', 34 | :microformats => 'text/microformats', 35 | :json => 'application/json' 36 | } 37 | 38 | KNOWN_ENABLES = ['GenericRelations'] 39 | KNOWN_DISCARDS = ['er/Company', 'er/Geo'] 40 | 41 | MAX_RETRIES = 5 42 | HTTP_TIMEOUT = 60 43 | MIN_CONTENT_SIZE = 100 44 | MAX_CONTENT_SIZE = 100_000 45 | 46 | class << self 47 | def enlighten(*args, &block); Client.new(*args, &block).enlighten; end 48 | 49 | def process_document(*args, &block) 50 | client = Client.new(*args, &block) 51 | client.output_format = :rdf 52 | Response.new(client.enlighten) 53 | end 54 | end 55 | end 56 | 57 | module Calais 58 | VERSION = '0.0.6' 59 | end -------------------------------------------------------------------------------- /Support/nibs/notification_hud.nib/.svn/entries: -------------------------------------------------------------------------------- 1 | 9 2 | 3 | dir 4 | 11734 5 | http://svn.textmate.org/trunk/Support/nibs/SimpleNotificationWindow.nib 6 | http://svn.textmate.org 7 | 8 | 9 | 10 | 2006-11-27T04:14:43.833384Z 11 | 6251 12 | chris 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | dfb7d73b-c2ec-0310-8fea-fb051d288c6d 28 | 29 | info.nib 30 | file 31 | 32 | 33 | 34 | 35 | 2009-08-18T06:39:53.000000Z 36 | fe952eb3eed9d577913ef17e7a894d62 37 | 2006-11-27T04:14:43.833384Z 38 | 6251 39 | chris 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 494 62 | 63 | keyedobjects.nib 64 | file 65 | 66 | 67 | 68 | 69 | 2009-08-18T06:39:53.000000Z 70 | 495a80a4e21fa3c93b1519aa522bee7b 71 | 2006-11-27T04:14:43.833384Z 72 | 6251 73 | chris 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 35211 96 | 97 | classes.nib 98 | file 99 | 100 | 101 | 102 | 103 | 2009-08-18T06:39:53.000000Z 104 | 4e074b4caae2db4a6ed5cb62307469d4 105 | 2006-11-27T04:14:43.833384Z 106 | 6251 107 | chris 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 1690 130 | 131 | -------------------------------------------------------------------------------- /Support/lib/json/add/rails.rb: -------------------------------------------------------------------------------- 1 | # This file contains implementations of rails custom objects for 2 | # serialisation/deserialisation. 3 | 4 | unless Object.const_defined?(:JSON) and ::JSON.const_defined?(:JSON_LOADED) and 5 | ::JSON::JSON_LOADED 6 | require 'json' 7 | end 8 | 9 | class Object 10 | def self.json_create(object) 11 | obj = new 12 | for key, value in object 13 | next if key == 'json_class' 14 | instance_variable_set "@#{key}", value 15 | end 16 | obj 17 | end 18 | 19 | def to_json(*a) 20 | result = { 21 | 'json_class' => self.class.name 22 | } 23 | instance_variables.inject(result) do |r, name| 24 | r[name[1..-1]] = instance_variable_get name 25 | r 26 | end 27 | result.to_json(*a) 28 | end 29 | end 30 | 31 | class Symbol 32 | def to_json(*a) 33 | to_s.to_json(*a) 34 | end 35 | end 36 | 37 | module Enumerable 38 | def to_json(*a) 39 | to_a.to_json(*a) 40 | end 41 | end 42 | 43 | # class Regexp 44 | # def to_json(*) 45 | # inspect 46 | # end 47 | # end 48 | # 49 | # The above rails definition has some problems: 50 | # 51 | # 1. { 'foo' => /bar/ }.to_json # => "{foo: /bar/}" 52 | # This isn't valid JSON, because the regular expression syntax is not 53 | # defined in RFC 4627. (And unquoted strings are disallowed there, too.) 54 | # Though it is valid Javascript. 55 | # 56 | # 2. { 'foo' => /bar/mix }.to_json # => "{foo: /bar/mix}" 57 | # This isn't even valid Javascript. 58 | 59 | -------------------------------------------------------------------------------- /Support/lib/json/Key.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * Key_xpm[] = { 3 | "16 16 54 1", 4 | " c None", 5 | ". c #110007", 6 | "+ c #0E0900", 7 | "@ c #000013", 8 | "# c #070600", 9 | "$ c #F6F006", 10 | "% c #ECE711", 11 | "& c #E5EE00", 12 | "* c #16021E", 13 | "= c #120900", 14 | "- c #EDF12B", 15 | "; c #000033", 16 | "> c #0F0000", 17 | ", c #FFFE03", 18 | "' c #E6E500", 19 | ") c #16021B", 20 | "! c #F7F502", 21 | "~ c #000E00", 22 | "{ c #130000", 23 | "] c #FFF000", 24 | "^ c #FFE711", 25 | "/ c #140005", 26 | "( c #190025", 27 | "_ c #E9DD27", 28 | ": c #E7DC04", 29 | "< c #FFEC09", 30 | "[ c #FFE707", 31 | "} c #FFDE10", 32 | "| c #150021", 33 | "1 c #160700", 34 | "2 c #FAF60E", 35 | "3 c #EFE301", 36 | "4 c #FEF300", 37 | "5 c #E7E000", 38 | "6 c #FFFF08", 39 | "7 c #0E0206", 40 | "8 c #040000", 41 | "9 c #03052E", 42 | "0 c #041212", 43 | "a c #070300", 44 | "b c #F2E713", 45 | "c c #F9DE13", 46 | "d c #36091E", 47 | "e c #00001C", 48 | "f c #1F0010", 49 | "g c #FFF500", 50 | "h c #DEDE00", 51 | "i c #050A00", 52 | "j c #FAF14A", 53 | "k c #F5F200", 54 | "l c #040404", 55 | "m c #1A0D00", 56 | "n c #EDE43D", 57 | "o c #ECE007", 58 | " ", 59 | " ", 60 | " .+@ ", 61 | " #$%&* ", 62 | " =-;>,') ", 63 | " >!~{]^/ ", 64 | " (_:<[}| ", 65 | " 1234567 ", 66 | " 890abcd ", 67 | " efghi ", 68 | " >jkl ", 69 | " mnol ", 70 | " >kl ", 71 | " ll ", 72 | " ", 73 | " "}; 74 | -------------------------------------------------------------------------------- /DragCommands/Insert Temp Image.tmDragCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | img="$TM_DROPPED_FILE" 9 | imagewidth=`sips -g pixelWidth "$img"|awk '/pixelWidth/ { printf("%d",$2) }'` 10 | [[ $imagewidth -gt 449 ]] && echo -n "<div class=\"removeme\" style=\"text-align: center;\">" 11 | echo -n "<img class=\"removeme\" src=\"file:`pwd`/$img\" " 12 | 13 | sips -g pixelWidth -g pixelHeight "$img" \ 14 | |awk '/pixelWidth/ { printf("width=\"%d\" ", $2) } 15 | /pixelHeight/ { printf("height=\"%d\" ", $2) }' 16 | [[ $imagewidth -lt 450 ]] && echo -n "align=\"right\" hspace=\"8\" vspace=\"8\" " 17 | base=${img##*/} 18 | alt=$(tr <<<${base%.*} '[_-]' ' '|perl -pe 's/(\w+)/\u$1/g') 19 | echo -n "alt=\"$alt\" />" 20 | [[ $imagewidth -gt 449 ]] && echo -n "</div>" 21 | draggedFileExtensions 22 | 23 | png 24 | jpg 25 | gif 26 | 27 | input 28 | selection 29 | name 30 | Insert Temp Image 31 | output 32 | insertAsSnippet 33 | scope 34 | text.html, text.html.markdown.multimarkdown, text.html.markdown 35 | uuid 36 | 6D34535B-4E79-401B-BFA1-CF204F5D0D98 37 | 38 | 39 | -------------------------------------------------------------------------------- /Commands/iOS App Price Check.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | BUNDLESUPPORT = ENV['TM_BUNDLE_SUPPORT'] 11 | DIALOG = ENV['DIALOG'] 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/exit_codes' 14 | require SUPPORT + '/lib/ui' 15 | require 'net/http' 16 | require 'rexml/document' 17 | require BUNDLESUPPORT + '/lib/cooldialog.rb' 18 | 19 | input = STDIN.read 20 | 21 | TextMate.exit_show_tool_tip("Price check requires an iTunes web url to be selected") unless input =~ /^http:\/\/itunes.apple.com\/[^\/]+\/app\/.+$/ 22 | 23 | source = Net::HTTP.get_response(URI.parse(input.strip)).body 24 | TextMate.exit_show_tool_tip("Error retrieving iTunes page") if source.nil? 25 | price = source.match(/<div class="price">([^<]+)<\/div>/)[1] 26 | print input + " \"#{price}\"" 27 | fallbackInput 28 | scope 29 | input 30 | selection 31 | keyEquivalent 32 | ^@w 33 | name 34 | iOS App Price Check 35 | output 36 | replaceSelectedText 37 | scope 38 | text.html.markdown, text.html.markdown.multimarkdown 39 | uuid 40 | 168887F6-C18F-41FE-8E41-7CAA4F5094A6 41 | 42 | 43 | -------------------------------------------------------------------------------- /Commands/Tabs to References (Safari).tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | bundleUUID 8 | 37D5C267-16F1-4386-9E6D-47667DF151F6 9 | command 10 | #!/usr/bin/env ruby -wKU 11 | require ENV['TM_BUNDLE_SUPPORT'] + '/lib/linkage.rb' 12 | linker = Linkage.new 13 | 14 | links = linker.tabs_to_references(linker.input) 15 | links = links.map {|url| [nil,url] } 16 | 17 | # output = output.sort {|a,b| a['title'] <=> b['title']} 18 | if links.length == 1 && ! linker.input.empty? 19 | snippet,output = linker.replace_if_needed("[#{linker.input}](#{links[0][1]})") 20 | TextMate.exit_insert_snippet(output) if snippet 21 | print output 22 | else 23 | lines = INPUT.split("\n") 24 | row = ENV['TM_LINE_NUMBER'].to_i 25 | prevline = lines[row-2] 26 | snippet,output = linker.make_ref_list(links,prevline) 27 | TextMate.exit_insert_snippet(output) if snippet == true 28 | print output 29 | end 30 | fallbackInput 31 | none 32 | input 33 | document 34 | keyEquivalent 35 | ^@w 36 | name 37 | Tabs to References (Safari) 38 | output 39 | replaceDocument 40 | scope 41 | text.html.markdown,text.html.markdown.multimarkdown 42 | tabTrigger 43 | saf 44 | uuid 45 | AD7F2E4F-4476-4B32-984B-E950AC5BD2BB 46 | 47 | 48 | -------------------------------------------------------------------------------- /Commands/Source URLs from Evernote Search.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | bundleUUID 8 | 90A7F438-5416-4EA5-92B6-4E76B28AC9B7 9 | command 10 | #!/usr/bin/env ruby -wKU 11 | require ENV['TM_BUNDLE_SUPPORT'] + '/lib/linkage.rb' 12 | require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes' 13 | linker = Linkage.new 14 | 15 | links = linker.search_evernote(linker.input) 16 | links = links.map {|url| [nil,url] } 17 | 18 | # output = output.sort {|a,b| a['title'] <=> b['title']} 19 | if links.length == 1 && ! linker.input.empty? 20 | snippet,output = linker.replace_if_needed("[#{linker.input}](#{links[0][1]})") 21 | TextMate.exit_insert_snippet(output) if snippet 22 | print output 23 | else 24 | lines = INPUT.split("\n") 25 | row = ENV['TM_LINE_NUMBER'].to_i 26 | prevline = lines[row-2] 27 | snippet,output = linker.make_ref_list(links,prevline) 28 | TextMate.exit_insert_snippet(output) if snippet == true 29 | print output 30 | end 31 | fallbackInput 32 | word 33 | input 34 | document 35 | keyEquivalent 36 | ^@w 37 | name 38 | Source URLs from Evernote Search 39 | output 40 | replaceDocument 41 | scope 42 | text.html.markdown,text.html.markdown.multimarkdown 43 | tabTrigger 44 | ever 45 | uuid 46 | 57FC24A6-081C-4B4C-BCD7-B29BC15F6AB4 47 | 48 | 49 | -------------------------------------------------------------------------------- /Commands/Find Markdown File.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | DIALOG = ENV['DIALOG'] 11 | require SUPPORT + '/lib/ui' 12 | require SUPPORT + '/lib/osx/plist' 13 | require SUPPORT + '/lib/escape' 14 | require SUPPORT + '/lib/exit_codes' 15 | 16 | search_param = TextMate::UI.request_string(:title => "Search Markdown Files", :prompt => "Enter a keyword or criteria") 17 | projects = [] 18 | 19 | (`mdfind '#{search_param} AND (filename:md OR kind:markdown OR filename:markdown)'`).each {|x| 20 | title = File.basename(x.chomp,".md") + " (" + File.dirname(x.chomp).split('/').last + ")" 21 | projects << { 'title' => title, 'tag' => x.chomp } 22 | } 23 | 24 | plist = { 'tags' => projects }.to_plist 25 | 26 | res = OSX::PropertyList::load(`#{e_sh DIALOG} -mp #{e_sh plist} select_project`) 27 | 28 | TextMate.exit_discard if res['returnButton'] == "Cancel" 29 | project = "\"" + res['result']['returnArgument'].join("\" \"") + "\"" 30 | %x{echo "#{project}"|pbcopy} 31 | `open -a TextMate #{project}` unless project.to_s.empty? 32 | input 33 | none 34 | keyEquivalent 35 | ^@w 36 | name 37 | Find Markdown file 38 | output 39 | showAsTooltip 40 | scope 41 | text.html, text.html.markdown, text.html.markdown.multimarkdown,text.html 42 | uuid 43 | 6C8AB5B3-A579-4957-AEC0-F8FAD016D961 44 | 45 | 46 | -------------------------------------------------------------------------------- /Commands/Link to reference.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | DIALOG = ENV['DIALOG'] 11 | require SUPPORT + '/lib/ui' 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/osx/plist' 14 | require SUPPORT + '/lib/exit_codes' 15 | require 'erb' 16 | 17 | document = STDIN.read 18 | ENV['TM_SELECTED_TEXT'] ? input = ENV['TM_SELECTED_TEXT'] : input = ENV['TM_CURRENT_WORD'] 19 | refs = document.scan(/^\[([^\]]+)\]\:\s/) 20 | refs.sort! 21 | linklist = refs.collect { |e| { 'title' => e.to_s } } 22 | 23 | plist = { 'menuItems' => linklist }.to_plist 24 | 25 | res = OSX::PropertyList.load(`#{e_sh DIALOG} -up #{e_sh plist}`) 26 | TextMate.exit_discard unless res.has_key? 'selectedMenuItem' 27 | 28 | right_char = %x{echo ${TM_CURRENT_LINE:TM_LINE_INDEX}} 29 | if right_char =~ /^\]/ 30 | print "][" + res['selectedMenuItem']['title'] 31 | else 32 | TextMate.exit_replace_text "[#{input}][#{res['selectedMenuItem']['title']}]" 33 | end 34 | fallbackInput 35 | word 36 | input 37 | document 38 | keyEquivalent 39 | ^@w 40 | name 41 | Link to Reference 42 | output 43 | afterSelectedText 44 | scope 45 | text.html.markdown, text.html.markdown.multimarkdown 46 | tabTrigger 47 | ][ 48 | uuid 49 | 837FCCC9-FEA0-40AE-A752-E469547290C7 50 | 51 | 52 | -------------------------------------------------------------------------------- /Commands/Via Link.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | require SUPPORT + '/lib/escape' 11 | require SUPPORT + '/lib/exit_codes' 12 | require 'open-uri' 13 | require 'net/http' 14 | require 'erb' 15 | 16 | def entity_escape(text) 17 | text.gsub(/&(?!([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);)/, '&') 18 | end 19 | 20 | document = STDIN.read 21 | 22 | viamatch = document.match(/^\[(via(?:[^\]]+)?)\]\:\s([^\s]+)\s/) 23 | 24 | if viamatch 25 | if viamatch[1] =~ /via .+/ 26 | title = viamatch[1].match(/via (.+)/)[1].gsub(/\b\w/){$&.upcase} 27 | else 28 | baseurl = viamatch[2].match(/(https?:\/\/[^\/ ]+)/)[1] 29 | title = nil 30 | 31 | eval 'title = fp.read.match(/<title>([^<>]*)<\/title>/i).to_a[1].strip rescue nil' if fp = open(baseurl) rescue nil 32 | 33 | if title =~ /([^\|\-\—\:\–\>,\(]+)[\|\-\—\:\–\>,\(]+([^\|\-\—\:\–\>,\)]+)/ 34 | title = title.match(/([^\|\-\—\:\–\>,\(]+)[\|\-\—\:\–\>,\(]+([^\|\-\—\:\–\>,\)]+)/)[1].strip 35 | end 36 | end 37 | print "[via [${1:#{title}}][#{viamatch[1]}]]" 38 | else 39 | print "[via [${1:Site Name}](${2:Link})]" 40 | end 41 | fallbackInput 42 | word 43 | input 44 | document 45 | name 46 | Via Link 47 | output 48 | insertAsSnippet 49 | scope 50 | text.html.markdown, text.html.markdown.multimarkdown 51 | tabTrigger 52 | via 53 | uuid 54 | 30E730C0-C3F4-4C4F-902C-71034A6134B0 55 | 56 | 57 | -------------------------------------------------------------------------------- /Support/nibs/notification_hud.nib/.svn/text-base/classes.nib.svn-base: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = CXBrowserTableView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, 4 | { 5 | CLASS = CXMenuButton; 6 | LANGUAGE = ObjC; 7 | OUTLETS = {menu = NSMenu; }; 8 | SUPERCLASS = NSButton; 9 | }, 10 | { 11 | ACTIONS = { 12 | contextExportFiles = id; 13 | contextMakeDir = id; 14 | contextRefresh = id; 15 | contextRemoveFile = id; 16 | getRootURLFromField = id; 17 | sheetCancel = id; 18 | sheetOK = id; 19 | takeRootURLFrom = id; 20 | }; 21 | CLASS = CXSVNRepoBrowser; 22 | LANGUAGE = ObjC; 23 | OUTLETS = { 24 | fCommitAnswerField = NSTextField; 25 | fCommitPromptField = NSTextField; 26 | fCommitPromptWindow = NSPanel; 27 | fCommitURLDestination = NSTextField; 28 | fCommitURLSource = NSTextField; 29 | fCommitVerbField = NSTextField; 30 | fDelegate = id; 31 | fGoButton = NSButton; 32 | fHistoryMenuButton = CXMenuButton; 33 | fOutlineView = NSOutlineView; 34 | fSpinner = NSProgressIndicator; 35 | fURLField = NSTextField; 36 | fURLHeaderView = NSView; 37 | fUserDefaultsController = NSUserDefaultsController; 38 | }; 39 | SUPERCLASS = NSObject; 40 | }, 41 | {CLASS = CXToolbarItemView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, 42 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 43 | {CLASS = NSObject; LANGUAGE = ObjC; } 44 | ); 45 | IBVersion = 1; 46 | } -------------------------------------------------------------------------------- /Support/lib/json/String.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * String_xpm[] = { 3 | "16 16 77 1", 4 | " c None", 5 | ". c #000000", 6 | "+ c #040404", 7 | "@ c #080806", 8 | "# c #090606", 9 | "$ c #EEEAE1", 10 | "% c #E7E3DA", 11 | "& c #E0DBD1", 12 | "* c #D4B46F", 13 | "= c #0C0906", 14 | "- c #E3C072", 15 | "; c #E4C072", 16 | "> c #060505", 17 | ", c #0B0A08", 18 | "' c #D5B264", 19 | ") c #D3AF5A", 20 | "! c #080602", 21 | "~ c #E1B863", 22 | "{ c #DDB151", 23 | "] c #DBAE4A", 24 | "^ c #DDB152", 25 | "/ c #DDB252", 26 | "( c #070705", 27 | "_ c #0C0A07", 28 | ": c #D3A33B", 29 | "< c #020201", 30 | "[ c #DAAA41", 31 | "} c #040302", 32 | "| c #E4D9BF", 33 | "1 c #0B0907", 34 | "2 c #030201", 35 | "3 c #020200", 36 | "4 c #C99115", 37 | "5 c #080704", 38 | "6 c #DBC8A2", 39 | "7 c #E7D7B4", 40 | "8 c #E0CD9E", 41 | "9 c #080601", 42 | "0 c #040400", 43 | "a c #010100", 44 | "b c #0B0B08", 45 | "c c #DCBF83", 46 | "d c #DCBC75", 47 | "e c #DEB559", 48 | "f c #040301", 49 | "g c #BC8815", 50 | "h c #120E07", 51 | "i c #060402", 52 | "j c #0A0804", 53 | "k c #D4A747", 54 | "l c #D6A12F", 55 | "m c #0E0C05", 56 | "n c #C8C1B0", 57 | "o c #1D1B15", 58 | "p c #D7AD51", 59 | "q c #070502", 60 | "r c #080804", 61 | "s c #BC953B", 62 | "t c #C4BDAD", 63 | "u c #0B0807", 64 | "v c #DBAC47", 65 | "w c #1B150A", 66 | "x c #B78A2C", 67 | "y c #D8A83C", 68 | "z c #D4A338", 69 | "A c #0F0B03", 70 | "B c #181105", 71 | "C c #C59325", 72 | "D c #C18E1F", 73 | "E c #060600", 74 | "F c #CC992D", 75 | "G c #B98B25", 76 | "H c #B3831F", 77 | "I c #C08C1C", 78 | "J c #060500", 79 | "K c #0E0C03", 80 | "L c #0D0A00", 81 | " ", 82 | " .+@# ", 83 | " .$%&*= ", 84 | " .-;>,')! ", 85 | " .~. .{]. ", 86 | " .^/. (_:< ", 87 | " .[.}|$12 ", 88 | " 345678}90 ", 89 | " a2bcdefgh ", 90 | " ijkl.mno ", 91 | " /dev/null &` 18 | end 19 | def has_dialog2 20 | tm_dialog = e_sh ENV['DIALOG'] 21 | ! tm_dialog.match(/2$/).nil? 22 | end 23 | def cool_tool_tip(content,exit = false) 24 | if has_dialog2 25 | output = %^^ 26 | output += content.gsub(/([^\n+]+)\n/m,"\\1") 27 | output += %^^ 28 | html = <<-HTML 29 | 30 | 49 | 50 | 51 | 52 | 53 | #{output} 54 | 55 | 56 | 57 | HTML 58 | 59 | TextMate::UI.tool_tip("#{html}", {:transparent => true, :format => :html}) 60 | exit 206 if exit === true 61 | # %x{"$DIALOG" tooltip -t --format html #{e_sh(html)}} 62 | else 63 | TextMate.exit_show_tool_tip content 64 | end 65 | end 66 | end 67 | end 68 | end -------------------------------------------------------------------------------- /Commands/View TODO.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | # Inspired by - and built upon - the GTDAlt bundle by Charilaos Skiadas 10 | # http://skiadas.dcostanet.net/afterthought/2006/06/20/yet-another-gtd-bundle/ 11 | require ENV['TM_SUPPORT_PATH'] + "/lib/exit_codes.rb" 12 | 13 | lines = STDIN.readlines 14 | curline = ENV['TM_CURRENT_LINE'] 15 | cursor = ENV['TM_LINE_INDEX'].to_i 16 | 17 | def closest_marker(line,cursor) 18 | ds = [] 19 | line.scan(/<\d+>/).each {|w| 20 | idx = line.index(w).to_i 21 | if idx > cursor 22 | d = idx - cursor 23 | else 24 | d = cursor - idx 25 | end 26 | ds << { 'marker' => w, 'distance' => d } 27 | } 28 | return false if ds.empty? 29 | return ds.sort{|a,b| a['distance'] <=> b['distance']}[0]['marker'] 30 | end 31 | 32 | row = ENV['TM_LINE_NUMBER'].to_i 33 | currentLine = lines[row-1] 34 | 35 | found = closest_marker(curline,cursor) 36 | 37 | if found then 38 | note = lines.find{ |line| line[/^<\d+>/] == found } 39 | note.slice!(/^<\d+>\s+/) 40 | words = note.split(/\s/) 41 | char_count = 0 42 | line = [] 43 | words.each {|word| 44 | print word.to_s + " " 45 | char_count += word.to_s.length 46 | 47 | if char_count > 50 48 | puts 49 | char_count = 0 50 | end 51 | } 52 | else 53 | print "This paragraph does not have a note." 54 | end 55 | input 56 | selection 57 | keyEquivalent 58 | ^~{ 59 | name 60 | Preview TODO 61 | output 62 | showAsTooltip 63 | scope 64 | text.html.markdown, text.html.markdown.multimarkdown 65 | uuid 66 | C5C14986-D767-4E67-8589-106110ADEB7E 67 | 68 | 69 | -------------------------------------------------------------------------------- /Commands/Preview TODO.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | # Inspired by - and built upon - the GTDAlt bundle by Charilaos Skiadas 10 | # http://skiadas.dcostanet.net/afterthought/2006/06/20/yet-another-gtd-bundle/ 11 | require ENV['TM_SUPPORT_PATH'] + "/lib/exit_codes.rb" 12 | 13 | lines = STDIN.readlines 14 | curline = ENV['TM_CURRENT_LINE'] 15 | cursor = ENV['TM_LINE_INDEX'].to_i 16 | 17 | def closest_marker(line,cursor) 18 | ds = [] 19 | line.scan(/<\d+>/).each {|w| 20 | idx = line.index(w).to_i 21 | if idx > cursor 22 | d = idx - cursor 23 | else 24 | d = cursor - idx 25 | end 26 | ds << { 'marker' => w, 'distance' => d } 27 | } 28 | return false if ds.empty? 29 | return ds.sort{|a,b| a['distance'] <=> b['distance']}[0]['marker'] 30 | end 31 | 32 | row = ENV['TM_LINE_NUMBER'].to_i 33 | currentLine = lines[row-1] 34 | 35 | found = closest_marker(curline,cursor) 36 | 37 | if found then 38 | note = lines.find{ |line| line[/^<\d+>/] == found } 39 | note.slice!(/^<\d+>\s+/) 40 | words = note.split(/\s/) 41 | char_count = 0 42 | line = [] 43 | words.each {|word| 44 | print word.to_s + " " 45 | char_count += word.to_s.length 46 | 47 | if char_count > 50 48 | puts 49 | char_count = 0 50 | end 51 | } 52 | else 53 | print "This paragraph does not have a note." 54 | end 55 | input 56 | selection 57 | keyEquivalent 58 | ^~{ 59 | name 60 | Preview TODO 61 | output 62 | showAsTooltip 63 | scope 64 | text.html.markdown, text.html.markdown.multimarkdown 65 | uuid 66 | C5C14986-D767-4E67-8589-106110ADEB7E 67 | 68 | 69 | -------------------------------------------------------------------------------- /Commands/Thank Tipsters.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes.rb" 10 | 11 | messages = %x{osascript <<APPLESCRIPT 12 | tell application "Mail" 13 | set _sel to selection 14 | set _output to {} 15 | repeat with _msg in _sel 16 | if ") tips" is in subject of _msg then 17 | set end of _output to content of _msg 18 | end if 19 | end repeat 20 | if _output is {} then return "false" 21 | return _output 22 | end tell 23 | APPLESCRIPT 24 | } 25 | 26 | TextMate.exit_show_tool_tip "No selection or selected message(s) aren't tips" if messages =~ /false/ 27 | 28 | msgarray = messages.split(/^,\s+\n$/) 29 | 30 | tipsters = [] 31 | msgarray.each {|msg| 32 | tipsters.push(msg.match(/Name:\s([^\s]+)\s/)[1]) 33 | } 34 | if ENV['TM_SCOPE'] =~ /html\.basic/ 35 | print "<em>Thanks " 36 | else 37 | print "*Thanks, " 38 | end 39 | counter = 1 40 | tipsters.reverse! 41 | tipsters.each {|name| 42 | print "${#{counter}:#{name.capitalize}}" 43 | print ", " if counter < (tipsters.length - 1) 44 | print " and " if counter == (tipsters.length - 1) 45 | counter += 1 46 | } 47 | if ENV['TM_SCOPE'] =~ /html\.basic/ 48 | print "!</em>$0" 49 | else 50 | print "!*$0" 51 | end 52 | fallbackInput 53 | word 54 | input 55 | none 56 | keyEquivalent 57 | ^@w 58 | name 59 | Thank Tipsters 60 | output 61 | insertAsSnippet 62 | scope 63 | text.html, text.html.markdown, text.html.markdown.multimarkdown 64 | tabTrigger 65 | tip 66 | uuid 67 | 4D1F163A-FF8B-4CC2-A1CC-3B3FA63230FD 68 | 69 | 70 | -------------------------------------------------------------------------------- /Commands/Statistics.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | BUNDLESUPPORT = ENV['TM_BUNDLE_SUPPORT'] 11 | require "#{SUPPORT}/lib/exit_codes.rb" 12 | load "#{BUNDLESUPPORT}/lib/utilities.rb" 13 | require SUPPORT + '/lib/ui' 14 | require "#{BUNDLESUPPORT}/lib/cooldialog.rb" 15 | 16 | def e_sh(str) 17 | str.to_s.gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/, '\\').gsub(/\n/, "'\n'").sub(/^$/, "''") 18 | end 19 | def strip_headers(str) 20 | str.gsub!(/<!--\s?more\s?-->/,"") 21 | str.gsub(/^[^\[ ]+\: [^\n]+/, "") 22 | end 23 | html = STDIN.read 24 | title = html =~ /^[Tt]itle: (.+)/ ? $1 : "" 25 | links = html.scan(/(http:\/\/[^ \)\n]+)/) 26 | unique_links = links.uniq.length 27 | if !(ENV['TM_SCOPE'].scan(/markdown/i).empty?) 28 | html = %x{echo #{e_sh strip_headers(html)}|"#{ENV['TM_SUPPORT_PATH']}/bin/Markdown.pl"} 29 | end 30 | 31 | unless html.to_s.empty? 32 | stripped_text = strip_tags(html) 33 | end 34 | 35 | word_count = %x{echo "#{stripped_text}"|wc -w} 36 | character_count = %x{echo "#{stripped_text}"|wc -c} 37 | 38 | newoutput = %^Word Count:\t#{word_count.strip}\n^ 39 | newoutput += %^Char Count:\t#{character_count.strip}\n^ 40 | newoutput += "Unique Links:\t#{unique_links}" 41 | TextMate::CoolDialog.notification_hud(:title => "Statistics",:summary => title,:log => newoutput ) 42 | # TextMate::CoolDialog.cool_tool_tip(newoutput) 43 | input 44 | selection 45 | keyEquivalent 46 | ^@w 47 | name 48 | Statistics 49 | output 50 | showAsTooltip 51 | scope 52 | text.html.markdown, text.html.markdown.multimarkdown,text.html 53 | uuid 54 | 4FFF49DA-159C-4822-9FB9-91AEB7556591 55 | 56 | 57 | -------------------------------------------------------------------------------- /Support/lib/textmate.rb: -------------------------------------------------------------------------------- 1 | module TextMate 2 | class << self 3 | 4 | public 5 | 6 | def exit_discard 7 | exit 200 8 | end 9 | 10 | def exit_replace_text(out = nil) 11 | print out if out 12 | exit 201 13 | end 14 | 15 | def exit_replace_document(out = nil) 16 | print out if out 17 | exit 202 18 | end 19 | 20 | def exit_insert_text(out = nil) 21 | print out if out 22 | exit 203 23 | end 24 | 25 | def exit_insert_snippet(out = nil) 26 | print out if out 27 | exit 204 28 | end 29 | 30 | def exit_show_html(out = nil) 31 | print out if out 32 | exit 205 33 | end 34 | 35 | def exit_show_tool_tip(out = nil) 36 | print out if out 37 | exit 206 38 | end 39 | 40 | def exit_create_new_document(out = nil) 41 | print out if out 42 | exit 207 43 | end 44 | 45 | def standard_input_box(title, prompt) 46 | _standard_input_box('standard-inputbox', title, prompt) 47 | end 48 | 49 | def secure_standard_input_box(title, prompt) 50 | _standard_input_box('secure-standard-inputbox', title, prompt) 51 | end 52 | 53 | def input_box(title, prompt, text = "", button1 = "Okay", button2 = "Cancel") 54 | _standard_input_box('inputbox', title, prompt, text, button1, button2) 55 | end 56 | 57 | def dropdown(options) 58 | _dialog('dropdown', options) 59 | end 60 | 61 | private 62 | 63 | def _dialog(type, options) 64 | %x{"#{ENV['TM_SUPPORT_PATH']}/bin/CocoaDialog.app/Contents/MacOS/CocoaDialog" 2>/dev/console #{type} --float #{options}} 65 | end 66 | 67 | def _standard_input_box(type, title, prompt, text = "", button1 = "Okay", button2 = "Cancel") 68 | require "#{ENV['TM_SUPPORT_PATH']}/lib/escape.rb" 69 | _result = _dialog(type, %Q{--title #{e_sh title} --informative-text #{e_sh prompt}#{text.length > 0 ? " --text " + e_sh(text) : ""} --button1 #{e_sh button1} --button2 #{e_sh button2}}) 70 | _result = _result.split(/\n/) 71 | _result[0] == '1' ? _result[1] : nil 72 | end 73 | end 74 | end -------------------------------------------------------------------------------- /Preferences/Markdown.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Markdown 7 | scope 8 | text.html.markdown, text.html.markdown.multimarkdown 9 | settings 10 | 11 | shellVariables 12 | 13 | 14 | name 15 | TM_BLINK_FORMAT 16 | value 17 | [${1:<%= e_sn input %>}](${2:<%= e_sn url %>})$0 18 | 19 | 20 | name 21 | TM_REF_LINK_FORMAT 22 | value 23 | [${1:<%= e_sn input %>}]: ${2:<%= e_sn url %>}$0 24 | 25 | 26 | name 27 | TM_APP_BLINK_FORMAT 28 | value 29 | [${1:<%= e_sn input %>}](<%= e_sn url %> "<%= e_sn price %>")$0 30 | 31 | 32 | name 33 | TM_APP_REF_LINK_FORMAT 34 | value 35 | [${1:<%= e_sn input %>}]: <%= e_sn url %> "<%= e_sn price %>" 36 | 37 | 38 | name 39 | TM_MONEY_FORMAT 40 | value 41 | US$<%= num %> 42 | 43 | 44 | name 45 | TM_ITUNES_FORMAT 46 | value 47 | [${1:<%= e_sn input %>}](${2:<%= e_sn url %>}) [[iTunes link](<%= e_sn iturl %>)]$0 48 | 49 | 50 | name 51 | TM_ITUNES_REF_FORMAT 52 | value 53 | [${1:<%= e_sn input %>}][${2:<%= e_sn url %>}] [[iTunes link][<%= e_sn iturl %>]]$0 54 | 55 | 56 | 57 | uuid 58 | 20DEBCF7-6D32-44EB-9457-3746063F7D2D 59 | 60 | 61 | -------------------------------------------------------------------------------- /Commands/Lucky guess spelling fix.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -W0 -KU 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | DIALOG = ENV['DIALOG'] 11 | require SUPPORT + '/lib/ui' 12 | require SUPPORT + '/lib/osx/plist' 13 | require SUPPORT + '/lib/escape' 14 | require SUPPORT + '/lib/exit_codes' 15 | require SUPPORT + "/lib/progress" 16 | require 'cgi' 17 | require 'net/http' 18 | require 'net/https' 19 | require 'rexml/document' 20 | 21 | def spell_req(text) 22 | '<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="0"><text>'+REXML::Text.new(text).to_s+'</text></spellrequest>' 23 | end 24 | 25 | def check_spelling(text) 26 | $out = text.clone 27 | h = Net::HTTP.new("www.google.com", 443) 28 | h.use_ssl=true 29 | resp, body = h.post("/tbproxy/spell?lang=en&hl=en", spell_req(text)) 30 | 31 | if resp.code.to_i == 200 32 | body.scan(/<c o="(\d+)" l="(\d+)" s="(\d+)">(\w+).*?<\/c>/) {|o, l, s, t| $out.sub!(text[o.to_i, l.to_i], t)} 33 | return $out 34 | else 35 | return nil 36 | end 37 | end 38 | 39 | phrase = STDIN.read 40 | newphrase = check_spelling(phrase) 41 | TextMate.exit_show_tool_tip "Looks fine to me…" if newphrase == phrase 42 | unless newphrase.nil? 43 | print newphrase 44 | TextMate.exit_replace_text 45 | else 46 | TextMate.exit_show_tool_tip "Nothing found" 47 | end 48 | fallbackInput 49 | word 50 | input 51 | selection 52 | keyEquivalent 53 | ^D 54 | name 55 | Lucky guess spelling fix 56 | output 57 | showAsTooltip 58 | scope 59 | text.html, text.html.markdown, text.html.markdown.multimarkdown 60 | uuid 61 | 0C3DA311-B9CE-4029-B153-4069712D85F5 62 | 63 | 64 | -------------------------------------------------------------------------------- /Commands/Prepare post in place.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | if (`echo $TM_SCOPE|grep -iq "markdown"`) then 9 | bodytext=`cat $STDIN|perl -pe ' 10 | s/^[^ \[]+\: ?([^\n]+)?\n+//g; 11 | s/^<\d+> .*$//g; 12 | s/<\d+>//g; 13 | s/<!--\s?more\s?-->//g; 14 | if($img = /(<img[^>]+>)/) { 15 | s/(<div class="removeme"[^>]+>)?(.*)?(<p([^>]+)?>(.*)?)?<img[^>]+>(<\/p>)?(<\/div>)?//g; 16 | }'|"$TM_BUNDLE_SUPPORT/lib/MultiMarkdown.pl"` 17 | else 18 | bodytext=`cat $STDIN|perl -pe ' 19 | if($img = /(<img[^>]+>)/) { 20 | s/(<div class="removeme"[^>]+>)?(.*)?(<p([^>]+)?>(.*)?)?<img[^>]+>(<\/p>)?(<\/div>)?(\s+)?//g; 21 | }'` 22 | fi 23 | bodytext=`echo "$bodytext"|sed s/[“”]/\"/g|sed s/[‘’]/\'/g|sed s/…/\ ...\ /g|sed s/–/-/g|sed s/—/\ --\ /g` 24 | fullHTML=`echo "$bodytext"|grep -i "<body>"` 25 | if [ $fullHTML ] 26 | then 27 | bodytext=`echo "$bodytext"|sed -e '1,/<body>/ s/.*//' -e '/<\/body>/,$ s/.*//'| awk 'NF{print $0 ""}'` 28 | fi 29 | echo "$bodytext"|perl -pe ' 30 | if(($tag, $title) = /<(h[1-6])>(.*?)<\/\1>/) { 31 | $_ = $title; 32 | s/<[^>]+>|&\w+;//g; # remove tag and entities 33 | s/[^-_ \/\w]//g; # remove all but word and separators 34 | s/[-_ \/]+/_/g; # collapse all separators into _ 35 | $_ = "<$tag id=\"" . (lc $_) . "\">$title</$tag>\n"; 36 | }' 37 | 38 | input 39 | selection 40 | keyEquivalent 41 | ^@w 42 | name 43 | Prepare Post in Place 44 | output 45 | replaceSelectedText 46 | scope 47 | text.html.markdown, text.html.markdown.multimarkdown, text.html 48 | uuid 49 | FC790B59-7414-4447-9561-DCDAA7F08D46 50 | 51 | 52 | -------------------------------------------------------------------------------- /Commands/Big Huge Labs Thesaurus.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | DIALOG = ENV['DIALOG'] 10 | require "#{ENV['TM_SUPPORT_PATH']}/lib/progress.rb" 11 | require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes.rb" 12 | require "#{ENV['TM_SUPPORT_PATH']}/lib/ui.rb" 13 | require 'cgi' 14 | require 'open-uri' 15 | require 'erb' 16 | 17 | def get_thes(phrase) 18 | TextMate.call_with_progress(:title => "Contacting Big Huge Thesaurus", :message => "Looking up #{phrase}") do 19 | escapedUrl = "http://words.bighugelabs.com/api/2/1995613a2e12f99d9a817e5f2796ed89/#{CGI.escape(phrase).gsub(/\\'/,'%27')}/" 20 | @response = open( escapedUrl, 21 | "User-Agent" => "TextMate 1.5.5") 22 | content = @response.read 23 | return content 24 | end 25 | end 26 | 27 | phrase = STDIN.read 28 | words = get_thes(phrase) 29 | TextMate.exit_show_tool_tip "Nothing found" if words.nil? 30 | words = words.split("\n") 31 | words = words.map { |word| { 'title' => "#{word.split("|")[2]} (#{word.split("|")[1]})",'word' => word.split("|")[2] } } 32 | plist = { 'menuItems' => words }.to_plist 33 | 34 | res = OSX::PropertyList::load(`#{e_sh DIALOG} -up #{e_sh plist}`) 35 | TextMate.exit_discard unless res.has_key? 'selectedMenuItem' 36 | 37 | if phrase =~ /^[A-Z]/ then 38 | if phrase =~ /[A-Z]{2,}/ then 39 | print res['selectedMenuItem']['word'].gsub(/(.+)/){ $1.upcase } 40 | else 41 | print res['selectedMenuItem']['word'].capitalize 42 | end 43 | else 44 | print res['selectedMenuItem']['word'] 45 | end 46 | fallbackInput 47 | word 48 | input 49 | selection 50 | keyEquivalent 51 | ^@w 52 | name 53 | Big Huge Labs Thesaurus 54 | output 55 | replaceSelectedText 56 | scope 57 | text.html, text.html.markdown, text.html.markdown.multimarkdown 58 | uuid 59 | 6EADF789-23BD-4DD9-9F50-487B0D84435A 60 | 61 | 62 | -------------------------------------------------------------------------------- /Commands/Copy for Posting.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | if (`echo $TM_SCOPE|grep -iq "markdown"`) then 9 | bodytext=`cat $STDIN|perl -pe ' 10 | s/^(doctype|title|link|categories|tags|appid|excerpt)\: ?([^\n]+)?\n+//ig; 11 | s/<!--\s?more\s?-->//ig; 12 | s/^<\d+> .*$//g; 13 | s/<\d+>//g; 14 | if($img = /(<img[^>]+>)/) { 15 | s/(<div class="removeme"[^>]+>)?(.*)?(<p([^>]+)?>(.*)?)?<img class="removeme"[^>]+>(<\/p>)?(<\/div>)?//g; 16 | }'|"$TM_BUNDLE_SUPPORT/lib/MultiMarkdown.pl"` 17 | else 18 | bodytext=`cat $STDIN|perl -pe ' 19 | if($img = /(<img class="removeme"[^>]+>)/) { 20 | s/(<div class="removeme"[^>]+>)?(.*)?(<p([^>]+)?>(.*)?)?<img class="removeme"[^>]+>(<\/p>)?(<\/div>)?(\s+)?//g; 21 | }'` 22 | fi 23 | bodytext=`echo "$bodytext"|sed -e '/<!-- end -->/,$ s/.*//'| awk 'NF{print $0 ""}'` 24 | bodytext=`echo "$bodytext"|sed s/[“”]/\"/g|sed s/[‘’]/\'/g|sed s/…/\ ...\ /g|sed s/–/-/g|sed s/—/\ --\ /g` 25 | fullHTML=`echo "$bodytext"|grep -i "<body>"` 26 | if [ $fullHTML ] 27 | then 28 | bodytext=`echo "$bodytext"|sed -e '1,/<body>/ s/.*//' -e '/<\/body>/,$ s/.*//'| awk 'NF{print $0 ""}'` 29 | fi 30 | echo "$bodytext"|perl -pe ' 31 | if(($tag, $title) = /<(h[1-6])>(.*?)<\/\1>/) { 32 | $_ = $title; 33 | s/<[^>]+>|&\w+;//g; # remove tag and entities 34 | s/[^-_ \/\w]//g; # remove all but word and separators 35 | s/[-_ \/]+/_/g; # collapse all separators into _ 36 | $_ = "<$tag id=\"" . (lc $_) . "\">$title</$tag>\n"; 37 | }'|pbcopy 38 | echo "Source in clipboard" 39 | 40 | input 41 | selection 42 | keyEquivalent 43 | ^@w 44 | name 45 | Copy for Posting 46 | output 47 | showAsTooltip 48 | scope 49 | text.html.markdown, text.html.markdown.multimarkdown, text.html 50 | uuid 51 | 2F429BCD-A295-4405-9B96-2CC91B0E10C2 52 | 53 | 54 | -------------------------------------------------------------------------------- /Commands/Get Main Link.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | 10 | SUPPORT = ENV['TM_SUPPORT_PATH'] 11 | DIALOG = ENV['DIALOG'] 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/exit_codes' 14 | require SUPPORT + '/lib/osx/plist' 15 | 16 | document = STDIN.read 17 | linkmatch = nil 18 | tunelinks = document.scan(/^\[itunes ([^\]]+)\]\:\s(\S+)\s/) 19 | unless tunelinks.empty? 20 | if tunelinks.length == 1 21 | linkmatch = tunelinks[0] 22 | TextMate.exit_insert_text "link: " + tunelinks[0][1] 23 | else 24 | linklist = tunelinks.collect { |e| { 'title' => e[0].to_s, 'url' => e[1].to_s } } 25 | plist = { 'menuItems' => linklist }.to_plist 26 | res = OSX::PropertyList.load(`#{e_sh DIALOG} -up #{e_sh plist}`) 27 | TextMate.exit_discard unless res.has_key? 'selectedMenuItem' 28 | TextMate.exit_insert_text "link: " + res['selectedMenuItem']['url'] 29 | end 30 | else 31 | linkmatch = document.match(/^\[link(?: [^\]]+)?\]\:\s(\S+)/) if linkmatch.nil? 32 | linkmatch = document.match(/^\[[^\]]+\]\:\s(http:\/\/itunes.apple.com\S+)/) if linkmatch.nil? 33 | unless linkmatch.nil? 34 | print "link: " + linkmatch[1] 35 | else 36 | refs = document.scan(/\[([^\]]+)\]\:\s(\S+)/) 37 | refs.sort! 38 | linklist = refs.collect { |e| { 'title' => e[0].to_s, 'url' => e[1].to_s } } 39 | plist = { 'menuItems' => linklist }.to_plist 40 | res = OSX::PropertyList.load(`#{e_sh DIALOG} -up #{e_sh plist}`) 41 | TextMate.exit_insert_text "link: " unless res.has_key? 'selectedMenuItem' 42 | TextMate.exit_insert_text "link: " + res['selectedMenuItem']['url'] 43 | end 44 | end 45 | fallbackInput 46 | word 47 | input 48 | document 49 | name 50 | Get Main Link 51 | output 52 | afterSelectedText 53 | scope 54 | text.html.markdown, text.html.markdown.multimarkdown 55 | tabTrigger 56 | link: 57 | uuid 58 | 82B10BF9-D37E-45B0-9157-D53EC1188FCF 59 | 60 | 61 | -------------------------------------------------------------------------------- /Commands/Quick spelling guess.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -W0 -KU 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | DIALOG = ENV['DIALOG'] 11 | require SUPPORT + '/lib/ui' 12 | require SUPPORT + '/lib/osx/plist' 13 | require SUPPORT + '/lib/escape' 14 | require SUPPORT + '/lib/exit_codes' 15 | require SUPPORT + "/lib/progress" 16 | require 'cgi' 17 | require 'net/http' 18 | require 'net/https' 19 | require 'rexml/document' 20 | 21 | def spell_req(text) 22 | '<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="0"><text>'+REXML::Text.new(text).to_s+'</text></spellrequest>' 23 | end 24 | 25 | def check_spelling(text) 26 | $out = text.clone 27 | h = Net::HTTP.new("www.google.com", 443) 28 | h.use_ssl=true 29 | resp, body = h.post("/tbproxy/spell?lang=en&hl=en", spell_req(text)) 30 | 31 | if resp.code.to_i == 200 32 | body.scan(/<c o="(\d+)" l="(\d+)" s="(\d+)">(\w+).*?<\/c>/) {|o, l, s, t| $out.sub!(text[o.to_i, l.to_i], t)} 33 | return $out 34 | else 35 | return nil 36 | end 37 | end 38 | 39 | phrase = STDIN.read 40 | newphrase = check_spelling(phrase) 41 | TextMate.exit_show_tool_tip "Looks fine to me…" if newphrase == phrase 42 | unless newphrase.nil? 43 | # res = TextMate::UI.request_confirmation(:button1 => "Yes, it is", :button2 => "No, it's not", :title => "The I Feel Lucky Spell Check",:prompt => "Is #{newphrase} the word you were looking for?") 44 | # if res == true 45 | print newphrase 46 | TextMate.exit_replace_text 47 | # end 48 | else 49 | TextMate.exit_show_tool_tip "Nothing found" 50 | end 51 | 52 | TextMate.exit_show_tool_tip "Sorry" 53 | fallbackInput 54 | word 55 | input 56 | selection 57 | keyEquivalent 58 | ^@w 59 | name 60 | Quick spelling guess 61 | output 62 | showAsTooltip 63 | scope 64 | text.html, text.html.markdown, text.html.markdown.multimarkdown 65 | uuid 66 | 9282581F-37EC-4300-9758-6928C1A8F75E 67 | 68 | 69 | -------------------------------------------------------------------------------- /Commands/Tag Completion.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb' 10 | require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes.rb' 11 | $line = ENV['TM_CURRENT_LINE'] 12 | def readwords(wordfile) 13 | if File.exist?(File.expand_path("~/Library/Preferences/com.macromates.textmate.blogsmith.#{wordfile}")) 14 | wordlist = IO.readlines(File.expand_path("~/Library/Preferences/com.macromates.textmate.blogsmith.#{wordfile}")) 15 | else 16 | wordlist = IO.readlines("#{ENV['TM_BUNDLE_SUPPORT']}/lib/#{wordfile}") 17 | end 18 | return wordlist.map {|aword| aword = aword.strip } 19 | end 20 | 21 | tags = readwords("whitelist.txt") 22 | tags += readwords("alwaystags.txt") 23 | tags.uniq!.sort! 24 | currentword = (ENV['TM_CURRENT_WORD'] || '') 25 | 26 | if currentword =~ /;/ 27 | currentword = currentword.split(';')[1] 28 | end 29 | 30 | if currentword == '' || currentword.nil? 31 | tags_scoped = tags 32 | else 33 | tags_scoped = [] 34 | tags.each {|word| 35 | if word =~ /^#{currentword}/i 36 | tags_scoped.push(word) 37 | end 38 | } 39 | end 40 | 41 | choice = TextMate::UI.menu(tags_scoped) 42 | if choice then 43 | unless $line.empty? 44 | existing_tags = $line.split(';') 45 | TextMate.exit_show_tool_tip "Tag already used" if existing_tags.include?(tags_scoped[choice]) 46 | end 47 | if currentword == "@" 48 | choice = tags_scoped[choice][1..tags_scoped[choice].length] 49 | else 50 | choice = "#{tags_scoped[choice]}" 51 | end 52 | 53 | b = $line =~ /^[Tt]ags\:(.*)?/ ? '' : "tags: " 54 | o = "#{choice.chomp}" 55 | # o += ";" unless $line.empty? || o == '' 56 | print "#{b}${1:#{o}}$0" 57 | else 58 | TextMate.exit_discard 59 | end 60 | 61 | fallbackInput 62 | word 63 | input 64 | selection 65 | keyEquivalent 66 | 67 | name 68 | Tag Completion 69 | output 70 | insertAsSnippet 71 | scope 72 | meta.header.multimarkdown 73 | uuid 74 | 8BB6D49F-E99E-40FA-A702-1E088BF1AAF6 75 | 76 | 77 | -------------------------------------------------------------------------------- /DragCommands/Upload and Insert Image.tmDragCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | require SUPPORT + '/lib/exit_codes' 11 | 12 | # Using this command requires inserting the secret path here: 13 | SEKRIT = ENV['UPLOAD_SEKRIT'] 14 | 15 | TextMate.exit_show_tool_tip "Nuh uh." if SEKRIT == '' 16 | filename = ENV['TM_DROPPED_FILEPATH'] 17 | 18 | def template_tag(url,width,height,alt) 19 | return false unless url && width && height 20 | alttext = alt ? alt : '' 21 | if width.to_i > 450 22 | return sprintf(%Q{<p style="text-align:center"><img src="%s" border="0" width="%s" height="%s" alt="${1:%s}" /></p>\n\n$0},url,width,height,alttext) 23 | else 24 | return sprintf(%Q{<img border="0" src="%s" width="%s" height="%s" hspace="8" vspace="8" align="right" alt="${1:%s}" />},url,width,height,alttext) 25 | end 26 | end 27 | 28 | if File.exists?(filename) 29 | res = %x{curl -s -F "Filedata=@#{filename};type=multipart/form-data" #{SEKRIT}}.strip.gsub(%r^\\/^,'/') 30 | if res =~ /"status":"OK"/ 31 | url = res.match(/"url":"([^"]+)"/)[1] 32 | width = %x{sips -g pixelWidth #{filename}|awk '{print $2}'}.strip 33 | height = %x{sips -g pixelHeight #{filename}|awk '{print $2}'}.strip 34 | alt = File.basename(ENV['TM_DROPPED_FILE']) 35 | tag = template_tag(url,width,height,alt) 36 | if tag 37 | TextMate.exit_insert_snippet tag 38 | else 39 | TextMate.exit_show_tool_tip "Error getting url information" 40 | end 41 | else 42 | TextMate.exit_show_tool_tip "Upload failed" 43 | end 44 | else 45 | TextMate.exit_show_tool_tip "File '#{filename}' doesn't exist" 46 | end 47 | draggedFileExtensions 48 | 49 | png 50 | jpg 51 | gif 52 | 53 | input 54 | selection 55 | name 56 | Upload and Insert Image 57 | output 58 | insertAsSnippet 59 | scope 60 | text.html.markdown, text.html.markdown.multimarkdown,text.html 61 | uuid 62 | 27024EDD-F98E-4149-AE4C-7676532BF41C 63 | 64 | 65 | -------------------------------------------------------------------------------- /Commands/Diff Draft.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -wKU 9 | DIALOG = ENV['DIALOG'] 10 | require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes" 11 | require "#{ENV['TM_SUPPORT_PATH']}/lib/escape" 12 | require "#{ENV['TM_SUPPORT_PATH']}/lib/ui" 13 | require "#{ENV['TM_SUPPORT_PATH']}/lib/osx/plist" 14 | require 'erb' 15 | require 'net/http' 16 | require 'tempfile' 17 | 18 | url = TextMate::UI.request_string(:title => "Post URL",:prompt => "Please copy and paste the full address of the post:") 19 | TextMate.exit_discard if url.empty? 20 | orig = STDIN.read 21 | 22 | def strip_html(str) 23 | str.strip! 24 | tag_pat = %r,[\[<](?:(?:/?)|(?:\s*)).*?[>\]],m 25 | str.gsub(tag_pat, '') 26 | end 27 | def strip_headers(str) 28 | str.gsub!(/<!--\s?more\s?-->/,"") 29 | str.gsub(/^[^\[ ]+\: [^\n]+/, "") 30 | end 31 | def scrape_page(src) 32 | if src =~ /<!-- sphereit start -->/ 33 | src = src.split('<!-- sphereit start -->') 34 | src = src[1].split('<!-- sphereit end -->') 35 | return strip_html(src[0]) 36 | else 37 | return false 38 | end 39 | end 40 | 41 | Dir.tmpdir 42 | my_text = Tempfile.new('blogsmith-diff-orig.txt') 43 | tuaw_text = Tempfile.new('blogsmith-diff-tuaw.txt') 44 | 45 | my_text << strip_html(%x{echo #{e_sh strip_headers(orig)}|"/Applications/Scrivener.app/Contents/MacOS/MultiMarkdown/bin/MultiMarkdown.pl"}).strip.gsub(/\n+/,"\n") 46 | tuaw_text << strip_html(scrape_page(Net::HTTP.get_response(URI.parse(url)).body)).strip.strip.gsub(/\n+/,"\n") 47 | my_text.flush 48 | tuaw_text.flush 49 | 50 | output = %x{diff --label "Original Draft" --label "Edited Post" -u "#{my_text.path}" "#{tuaw_text.path}"} 51 | TextMate.exit_show_tool_tip "No difference" if output.empty? 52 | puts output 53 | 54 | my_text.close 55 | my_text.unlink 56 | tuaw_text.close 57 | tuaw_text.unlink 58 | input 59 | document 60 | keyEquivalent 61 | ^@w 62 | name 63 | Diff Draft 64 | output 65 | openAsNewDocument 66 | scope 67 | text.html, text.html.markdown, text.html.markdown.multimarkdown 68 | uuid 69 | 56C21F99-7D73-4385-986B-A48DCF194B8A 70 | 71 | 72 | -------------------------------------------------------------------------------- /Support/lib/json/pure.rb: -------------------------------------------------------------------------------- 1 | require 'json/common' 2 | require 'json/pure/parser' 3 | require 'json/pure/generator' 4 | 5 | module JSON 6 | begin 7 | require 'iconv' 8 | # An iconv instance to convert from UTF8 to UTF16 Big Endian. 9 | UTF16toUTF8 = Iconv.new('utf-8', 'utf-16be') # :nodoc: 10 | # An iconv instance to convert from UTF16 Big Endian to UTF8. 11 | UTF8toUTF16 = Iconv.new('utf-16be', 'utf-8') # :nodoc: 12 | UTF8toUTF16.iconv('no bom') 13 | rescue LoadError 14 | raise MissingUnicodeSupport, 15 | "iconv couldn't be loaded, which is required for UTF-8/UTF-16 conversions" 16 | rescue Errno::EINVAL, Iconv::InvalidEncoding 17 | # Iconv doesn't support big endian utf-16. Let's try to hack this manually 18 | # into the converters. 19 | begin 20 | old_verbose, $VERBSOSE = $VERBOSE, nil 21 | # An iconv instance to convert from UTF8 to UTF16 Big Endian. 22 | UTF16toUTF8 = Iconv.new('utf-8', 'utf-16') # :nodoc: 23 | # An iconv instance to convert from UTF16 Big Endian to UTF8. 24 | UTF8toUTF16 = Iconv.new('utf-16', 'utf-8') # :nodoc: 25 | UTF8toUTF16.iconv('no bom') 26 | if UTF8toUTF16.iconv("\xe2\x82\xac") == "\xac\x20" 27 | swapper = Class.new do 28 | def initialize(iconv) # :nodoc: 29 | @iconv = iconv 30 | end 31 | 32 | def iconv(string) # :nodoc: 33 | result = @iconv.iconv(string) 34 | JSON.swap!(result) 35 | end 36 | end 37 | UTF8toUTF16 = swapper.new(UTF8toUTF16) # :nodoc: 38 | end 39 | if UTF16toUTF8.iconv("\xac\x20") == "\xe2\x82\xac" 40 | swapper = Class.new do 41 | def initialize(iconv) # :nodoc: 42 | @iconv = iconv 43 | end 44 | 45 | def iconv(string) # :nodoc: 46 | string = JSON.swap!(string.dup) 47 | @iconv.iconv(string) 48 | end 49 | end 50 | UTF16toUTF8 = swapper.new(UTF16toUTF8) # :nodoc: 51 | end 52 | rescue Errno::EINVAL, Iconv::InvalidEncoding 53 | raise MissingUnicodeSupport, "iconv doesn't seem to support UTF-8/UTF-16 conversions" 54 | ensure 55 | $VERBOSE = old_verbose 56 | end 57 | end 58 | 59 | # Swap consecutive bytes of _string_ in place. 60 | def self.swap!(string) # :nodoc: 61 | 0.upto(string.size / 2) do |i| 62 | break unless string[2 * i + 1] 63 | string[2 * i], string[2 * i + 1] = string[2 * i + 1], string[2 * i] 64 | end 65 | string 66 | end 67 | 68 | # This module holds all the modules/classes that implement JSON's 69 | # functionality in pure ruby. 70 | module Pure 71 | $DEBUG and warn "Using pure library for JSON." 72 | JSON.parser = Parser 73 | JSON.generator = Generator 74 | end 75 | 76 | JSON_LOADED = true 77 | end 78 | -------------------------------------------------------------------------------- /Commands/Convert inline links to references.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | # require "#{ENV['TM_BUNDLE_SUPPORT']}/lib/linkage" 10 | %w[exit_codes escape].each do |filename| 11 | require "#{ENV['TM_SUPPORT_PATH']}/lib/#{filename}" 12 | end 13 | def find_headers(lines) 14 | in_headers = false 15 | lines.each_with_index {|line, i| 16 | if line =~ /^\S[^\:]+\:( .*?)?$/ 17 | in_headers = true 18 | elsif in_headers === true 19 | return i 20 | end 21 | } 22 | end 23 | 24 | input = STDIN.read 25 | links = input.scan(/\((https?:\/\/([^\)]+))\)/) 26 | refs = input.scan(/^\[([^\]]+)\]: (\S+)$/) 27 | lines = input.split("\n") 28 | 29 | lineno = find_headers(lines) 30 | top = lines[0..lineno].join("\n") 31 | bottom = lines[lineno+1].gsub(/^\[([^\]]+)\]: (\S+)\n?/,'') =~ /^([\n\s\t]+)?$/ ? "" : "\n" 32 | bottom += lines[lineno+1..-1].join("\n").gsub(/^\[([^\]]+)\]: (\S+)\n?/,'') 33 | 34 | norepeat = [] 35 | norepeatlinks = [] 36 | output = [] 37 | 38 | refs.each {|ref| 39 | name = ref[0] 40 | next if norepeatlinks.include? ref[1] 41 | while norepeat.include? name 42 | if name =~ / ?[0-9]$/ 43 | name.next! 44 | else 45 | name = name + " 2" 46 | end 47 | end 48 | output << {'orig' => ref[0], 'title' => name, 'link' => ref[1]} 49 | norepeat.push name 50 | norepeatlinks.push ref[1] 51 | } 52 | 53 | links.each {|url| 54 | next if norepeatlinks.include? url[0] 55 | domain = url[0].match(/https?:\/\/([^\/]+)/) 56 | parts = domain[1].split('.') 57 | name = case parts.length 58 | when 1: parts[0] 59 | when 2: parts[0] 60 | else parts[1] 61 | end 62 | while norepeat.include? name 63 | if name =~ / ?[0-9]$/ 64 | name.next! 65 | else 66 | name = name + " 2" 67 | end 68 | end 69 | output << {'orig' => url[0], 'title' => name, 'link' => url[0] } 70 | norepeat.push name 71 | norepeatlinks.push url[0] 72 | } 73 | output = output.sort {|a,b| a['title'] <=> b['title']} 74 | o = [] 75 | 76 | output.each_with_index { |x,i| 77 | o.push("[#{x['title']}]: #{x['link']}") 78 | bottom = bottom.gsub(/\((#{e_sh x['orig']}|#{e_sh x['link']})\)/,"[#{x['title']}]").gsub(/\[#{e_sh x['orig']}\]/,"[#{x['title']}]") 79 | } 80 | puts top + "\n#{o.join("\n")}\n" + bottom + "\n#{o.join("\n")}\n" + bottom 81 | fallbackInput 82 | word 83 | input 84 | document 85 | keyEquivalent 86 | ^@w 87 | name 88 | Convert inline links to references 89 | output 90 | replaceDocument 91 | scope 92 | text.html.markdown.multimarkdown, text.html.markdown 93 | uuid 94 | 0FBC7BF9-DF58-4AA3-880E-3266F221A339 95 | 96 | 97 | -------------------------------------------------------------------------------- /Commands/Make Search Link.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | DIALOG = ENV['DIALOG'] 11 | require SUPPORT + '/lib/ui' 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/osx/plist' 14 | require SUPPORT + '/lib/exit_codes' 15 | require ENV['TM_BUNDLE_SUPPORT'] + '/lib/cooldialog' 16 | require 'net/http' 17 | require 'rexml/document' 18 | require 'erb' 19 | require 'cgi' 20 | 21 | input = STDIN.read 22 | 23 | def elegant_exit(message) 24 | TextMate::CoolDialog.cool_tool_tip(message) 25 | TextMate.exit_discard 26 | end 27 | 28 | blogsite = ENV['BLOG_SITE'] ? ENV['BLOG_SITE'] : "www.tuaw.com" 29 | blogsite = "www." + blogsite unless blogsite =~ /^www\./ 30 | searchstring = input.empty? ? "Search terms" : input 31 | res = TextMate::UI.request_string(:title => "TUAW Search Query",:prompt => "Enter terms to create a search link",:default => searchstring) 32 | elegant_exit('Cancelled') unless res 33 | url = "http://#{blogsite}/supersearch/?q=#{CGI::escape(res)}" 34 | data = Net::HTTP.get_response(URI.parse(url)).body 35 | elegant_exit("No results returned for search") if data =~ /no results found/ 36 | titles = data.scan(/id\="pt\d+">([^<]+)</) 37 | matches = titles.length 38 | # matches = data.scan(/class\="post"/).length 39 | title = "" 40 | if matches > 2 41 | matches = "#{matches}+" if matches == 15 42 | output = "<h5>#{matches} matches, including:</h5>\n<ul>" 43 | titles.each do |title| 44 | output += ("<li>" + title[0] + "</li>\n") 45 | end 46 | output += "</ul>" 47 | TextMate::CoolDialog.cool_tool_tip(output) 48 | TextMate.exit_replace_text url if ENV['TM_CURRENT_LINE'] =~ /^link: #{input}/ 49 | if (input.empty? && !(ENV['TM_SCOPE'].scan(/markdown/).empty?) && ENV['TM_CURRENT_LINE'] =~ /^(\s+)?$/) || ENV['TM_CURRENT_LINE'] =~ /^(#{input})?(\s+)?$/ 50 | input = "search" + res.chomp.gsub(/\s+/,"_") 51 | print ERB.new(ENV['TM_REF_LINK_FORMAT']).result 52 | else 53 | input = searchstring if input.empty? 54 | print ERB.new(ENV['TM_BLINK_FORMAT']).result 55 | end 56 | else 57 | elegant_exit("Less than 3 links found for #{searchstring}, try another search phrase") 58 | end 59 | fallbackInput 60 | word 61 | input 62 | selection 63 | keyEquivalent 64 | ^@w 65 | name 66 | Make Search Link 67 | output 68 | insertAsSnippet 69 | scope 70 | text.html, text.html.markdown, text.html.markdown.multimarkdown, text.html.textile, text.bbcode, text.moinmoin, text.restructuredtext 71 | tabTrigger 72 | ? 73 | uuid 74 | 5C7201E6-9DF2-4E32-8D06-1E707C02D789 75 | 76 | 77 | -------------------------------------------------------------------------------- /Commands/Bing Instant Answer.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | BUNDLESUPPORT = ENV['TM_BUNDLE_SUPPORT'] 11 | DIALOG = ENV['DIALOG'] 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/exit_codes' 14 | require SUPPORT + '/lib/ui' 15 | require 'net/http' 16 | require 'rexml/document' 17 | require "#{BUNDLESUPPORT}/lib/cooldialog.rb" 18 | 19 | input = STDIN.read 20 | response = TextMate::UI.request_string(:title => "Enter your query",:prompt => "Ask a question, any question:",:default => input) 21 | TextMate.exit_discard unless response 22 | phrase = e_url(response) 23 | 24 | escapedUrl = "http://api.search.live.net/xml.aspx?Appid=6B9E3A4B9F0D8F963A24815A0317BF1DCA3B0E9A&query=#{phrase}&sources=instantanswer" 25 | xml_data = Net::HTTP.get_response(URI.parse(escapedUrl)).body 26 | 27 | doc = REXML::Document.new(xml_data) 28 | answer = nil 29 | doc.elements.each('SearchResponse/ia:InstantAnswer/ia:Results/ia:InstantAnswerResult/ia:InstantAnswerSpecificData/enc:Encarta') do |result| 30 | answer = result.elements['enc:Value'].text 31 | end 32 | 33 | TextMate.exit_show_tool_tip "No results" if answer.nil? 34 | # %x{echo -n "#{answer.gsub(/<[^>]+>/,'')}"|pbcopy} 35 | # TextMate::CoolDialog.cool_tool_tip(answer.gsub(/<[^>]+>/,'') + "\nAnswer in clipboard") 36 | b = <<HTML 37 | <html> 38 | <head> 39 | <link rel="stylesheet" href="tm-file://#{ENV['TM_SUPPORT_PATH']}/css/default.css" type="text/css" media="screen" title="no title" charset="utf-8" /> 40 | <style type="text/css" media="screen"> 41 | body {background-color: #366;color:#FFC;} 42 | pre {font-family:"Myriad Pro";font-size:14px;line-height:18px;} 43 | .dict {background:white;color:#333;padding:1px 10px;-webkit-border-radius: 15px;} 44 | .defn {border-bottom:dotted 2px #ccc;} 45 | </style> 46 | 47 | <script type="text/javascript" charset="utf-8"> 48 | window.resizeTo(500,300); 49 | </script> 50 | 51 | </head> 52 | <body> 53 | HTML 54 | e = <<HTML 55 | </body> 56 | </html> 57 | HTML 58 | 59 | output = b 60 | 61 | output += %Q{<div class="defn">} 62 | output += "<ul>"+answer.gsub(/- (.+?)<BR\/>/,'<li>\1</li>')+"</ul>" 63 | output += "</div>\n" 64 | 65 | print output 66 | 67 | 68 | fallbackInput 69 | none 70 | input 71 | selection 72 | keyEquivalent 73 | ^@w 74 | name 75 | Instant Answer (Bing) 76 | output 77 | showAsHTML 78 | scope 79 | text.html, text.html.markdown, text.html.markdown.multimarkdown 80 | uuid 81 | 1A0DFAA3-ECC5-45F0-8D22-1A5B65A53EC4 82 | 83 | 84 | -------------------------------------------------------------------------------- /Commands/Instant Answer (Bing).tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | BUNDLESUPPORT = ENV['TM_BUNDLE_SUPPORT'] 11 | DIALOG = ENV['DIALOG'] 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/exit_codes' 14 | require SUPPORT + '/lib/ui' 15 | require 'net/http' 16 | require 'rexml/document' 17 | require "#{BUNDLESUPPORT}/lib/cooldialog.rb" 18 | 19 | input = STDIN.read 20 | response = TextMate::UI.request_string(:title => "Enter your query",:prompt => "Ask a question, any question:",:default => input) 21 | TextMate.exit_discard unless response 22 | phrase = e_url(response) 23 | 24 | escapedUrl = "http://api.search.live.net/xml.aspx?Appid=6B9E3A4B9F0D8F963A24815A0317BF1DCA3B0E9A&query=#{phrase}&sources=instantanswer" 25 | xml_data = Net::HTTP.get_response(URI.parse(escapedUrl)).body 26 | 27 | doc = REXML::Document.new(xml_data) 28 | answer = nil 29 | doc.elements.each('SearchResponse/ia:InstantAnswer/ia:Results/ia:InstantAnswerResult/ia:InstantAnswerSpecificData/enc:Encarta') do |result| 30 | answer = result.elements['enc:Value'].text 31 | end 32 | 33 | TextMate.exit_show_tool_tip "No results" if answer.nil? 34 | # %x{echo -n "#{answer.gsub(/<[^>]+>/,'')}"|pbcopy} 35 | # TextMate::CoolDialog.cool_tool_tip(answer.gsub(/<[^>]+>/,'') + "\nAnswer in clipboard") 36 | b = <<HTML 37 | <html> 38 | <head> 39 | <link rel="stylesheet" href="tm-file://#{ENV['TM_SUPPORT_PATH']}/css/default.css" type="text/css" media="screen" title="no title" charset="utf-8" /> 40 | <style type="text/css" media="screen"> 41 | body {background-color: #366;color:#FFC;} 42 | pre {font-family:"Myriad Pro";font-size:14px;line-height:18px;} 43 | .dict {background:white;color:#333;padding:1px 10px;-webkit-border-radius: 15px;} 44 | .defn {border-bottom:dotted 2px #ccc;} 45 | </style> 46 | 47 | <script type="text/javascript" charset="utf-8"> 48 | window.resizeTo(500,300); 49 | </script> 50 | 51 | </head> 52 | <body> 53 | HTML 54 | e = <<HTML 55 | </body> 56 | </html> 57 | HTML 58 | 59 | output = b 60 | 61 | output += %Q{<div class="defn">} 62 | output += "<ul>"+answer.gsub(/- (.+?)<BR\/>/,'<li>\1</li>')+"</ul>" 63 | output += "</div>\n" 64 | 65 | print output 66 | 67 | 68 | fallbackInput 69 | none 70 | input 71 | selection 72 | keyEquivalent 73 | ^@w 74 | name 75 | Instant Answer (Bing) 76 | output 77 | showAsHTML 78 | scope 79 | text.html, text.html.markdown, text.html.markdown.multimarkdown 80 | uuid 81 | 1A0DFAA3-ECC5-45F0-8D22-1A5B65A53EC4 82 | 83 | 84 | -------------------------------------------------------------------------------- /Commands/AutoFill Setup.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes.rb" 10 | require "#{ENV['TM_SUPPORT_PATH']}/lib/web_preview.rb" 11 | 12 | # To override the command's web root detection, add a shell variable in TextMate's advanced preferences called WEB_ROOT 13 | # Set the value of WEB_ROOT to an existing directory where the blogsmith.js file can be stored 14 | # if you set/change this, you'll need to modify the bookmarklet accordingly 15 | web_root_override = ENV['WEB_ROOT'] ? ENV['WEB_ROOT'] : '' 16 | 17 | if web_root_override.empty? 18 | begin 19 | f = File.new("/etc/apache2/httpd.conf",'r') 20 | match = f.read.match /^DocumentRoot "([^"]+)"/ 21 | WEB_ROOT = "#{match[1]}" 22 | rescue 23 | WEB_ROOT = '/Library/WebServer/Documents' 24 | end 25 | else 26 | WEB_ROOT = web_root_override 27 | end 28 | 29 | 30 | html_header("AutoFill Test Results") 31 | 32 | puts '<h2>Web root detected at: ' + WEB_ROOT + '</h2>' 33 | puts '<small>To override the web root detection, add a shell variable in TextMate\'s advanced preferences called WEB_ROOT. Set the value of WEB_ROOT to the root folder of your local web server.</small>' 34 | 35 | begin 36 | testfile = File.new(WEB_ROOT + "/autofilltest.txt",'w+') 37 | testfile.puts "BLOGSMITH AUTOFILL TEST FILE" 38 | testfile.close 39 | print "<p>Test file written to #{WEB_ROOT}/autofilltest.txt" 40 | 41 | response = %x{curl -s http://localhost/autofilltest.txt} 42 | if response =~ /BLOGSMITH AUTOFILL TEST FILE/ 43 | puts " <span style=\"color:green\">and file successfuly read through localhost</span>.</p>" 44 | else 45 | puts ", <span style=\"color:red;font-weight:bold\">but we got an error reading it back through localhost</span>.</p>" 46 | end 47 | rescue 48 | puts "<p style=\"color:red;font-weight:bold\">Error writing test file</p>" 49 | end 50 | 51 | puts "<hr /><h3>Bookmarklets</h3>" 52 | puts "<p>Copy the appropriate code to the clipboard, create a new bookmark in your browser, and paste the code as the location for the bookmark.</p>" 53 | 54 | puts %Q{<h4>Firefox 3.0+</h4>} 55 | puts %Q{<pre><code>javascript:(function(){var%20x=document.createElement('SCRIPT');x.type='text/javascript';x.src='http://localhost/blogsmith.js?ver='+(Math.random());document.getElementsByTagName('head')[0].appendChild(x);x.onload=function(){doit();};})();</code></pre>} 56 | puts %Q{<h4>Safari/Firefox 2</h4>} 57 | puts %Q{<pre><code>javascript:var%20x=document.createElement('SCRIPT');x.type='text/javascript';x.src='http://localhost/blogsmith.js?ver='+(Math.random());document.getElementsByTagName('head')[0].appendChild(x);x.onload=function(){doit();};</code></pre>} 58 | html_footer 59 | input 60 | none 61 | name 62 | AutoFill Setup 63 | output 64 | showAsHTML 65 | uuid 66 | 57A974F2-7D53-4D34-BC56-B52671ED0432 67 | 68 | 69 | -------------------------------------------------------------------------------- /Support/lib/json/add/core.rb: -------------------------------------------------------------------------------- 1 | # This file contains implementations of ruby core's custom objects for 2 | # serialisation/deserialisation. 3 | 4 | unless Object.const_defined?(:JSON) and ::JSON.const_defined?(:JSON_LOADED) and 5 | ::JSON::JSON_LOADED 6 | require 'json' 7 | end 8 | require 'date' 9 | 10 | class Time 11 | def self.json_create(object) 12 | if usec = object.delete('u') # used to be tv_usec -> tv_nsec 13 | object['n'] = usec * 1000 14 | end 15 | if respond_to?(:tv_nsec) 16 | at(*object.values_at('s', 'n')) 17 | else 18 | at(object['s'], object['n'] / 1000) 19 | end 20 | end 21 | 22 | def to_json(*args) 23 | { 24 | 'json_class' => self.class.name, 25 | 's' => tv_sec, 26 | 'n' => respond_to?(:tv_nsec) ? tv_nsec : tv_usec * 1000 27 | }.to_json(*args) 28 | end 29 | end 30 | 31 | class Date 32 | def self.json_create(object) 33 | civil(*object.values_at('y', 'm', 'd', 'sg')) 34 | end 35 | 36 | alias start sg unless method_defined?(:start) 37 | 38 | def to_json(*args) 39 | { 40 | 'json_class' => self.class.name, 41 | 'y' => year, 42 | 'm' => month, 43 | 'd' => day, 44 | 'sg' => start, 45 | }.to_json(*args) 46 | end 47 | end 48 | 49 | class DateTime 50 | def self.json_create(object) 51 | args = object.values_at('y', 'm', 'd', 'H', 'M', 'S') 52 | of_a, of_b = object['of'].split('/') 53 | if of_b and of_b != '0' 54 | args << Rational(of_a.to_i, of_b.to_i) 55 | else 56 | args << of_a 57 | end 58 | args << object['sg'] 59 | civil(*args) 60 | end 61 | 62 | alias start sg unless method_defined?(:start) 63 | 64 | def to_json(*args) 65 | { 66 | 'json_class' => self.class.name, 67 | 'y' => year, 68 | 'm' => month, 69 | 'd' => day, 70 | 'H' => hour, 71 | 'M' => min, 72 | 'S' => sec, 73 | 'of' => offset.to_s, 74 | 'sg' => start, 75 | }.to_json(*args) 76 | end 77 | end 78 | 79 | class Range 80 | def self.json_create(object) 81 | new(*object['a']) 82 | end 83 | 84 | def to_json(*args) 85 | { 86 | 'json_class' => self.class.name, 87 | 'a' => [ first, last, exclude_end? ] 88 | }.to_json(*args) 89 | end 90 | end 91 | 92 | class Struct 93 | def self.json_create(object) 94 | new(*object['v']) 95 | end 96 | 97 | def to_json(*args) 98 | klass = self.class.name 99 | klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!" 100 | { 101 | 'json_class' => klass, 102 | 'v' => values, 103 | }.to_json(*args) 104 | end 105 | end 106 | 107 | class Exception 108 | def self.json_create(object) 109 | result = new(object['m']) 110 | result.set_backtrace object['b'] 111 | result 112 | end 113 | 114 | def to_json(*args) 115 | { 116 | 'json_class' => self.class.name, 117 | 'm' => message, 118 | 'b' => backtrace, 119 | }.to_json(*args) 120 | end 121 | end 122 | 123 | class Regexp 124 | def self.json_create(object) 125 | new(object['s'], object['o']) 126 | end 127 | 128 | def to_json(*) 129 | { 130 | 'json_class' => self.class.name, 131 | 'o' => options, 132 | 's' => source, 133 | }.to_json 134 | end 135 | end 136 | -------------------------------------------------------------------------------- /Commands/Make Tag Link.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | DIALOG = ENV['DIALOG'] 11 | require SUPPORT + '/lib/ui' 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/osx/plist' 14 | require SUPPORT + '/lib/exit_codes' 15 | require ENV['TM_BUNDLE_SUPPORT'] + '/lib/cooldialog' 16 | require 'erb' 17 | require 'net/http' 18 | require 'rexml/document' 19 | 20 | input = STDIN.read 21 | 22 | def elegant_exit(message) 23 | TextMate::CoolDialog.cool_tool_tip(message) 24 | TextMate.exit_discard 25 | end 26 | 27 | blogsite = ENV['BLOG_SITE'] ? ENV['BLOG_SITE'] : "www.tuaw.com" 28 | blogsite = "www." + blogsite unless blogsite =~ /^www\./ 29 | offset = 0 30 | linktext = TextMate::UI.request_string(:title => "Search Query",:prompt => "Enter terms to create a tag link",:default => input) 31 | elegant_exit("Cancelled") unless linktext 32 | 33 | query = linktext + " site:#{blogsite} inanchor:tag" 34 | 35 | escapedUrl = "http://api.search.live.net/xml.aspx?Appid=6B9E3A4B9F0D8F963A24815A0317BF1DCA3B0E9A&query=#{e_url(query)}&sources=web&web.offset=#{offset}" 36 | 37 | xml_data = Net::HTTP.get_response(URI.parse(escapedUrl)).body 38 | doc = REXML::Document.new(xml_data) 39 | bings = [] 40 | doc.elements.each('SearchResponse/web:Web/web:Results/web:WebResult') do |result| 41 | unless (result.elements['web:Title'].text =~ /bloglines|page/) 42 | begin 43 | tag_title = result.elements['web:Title'].text.gsub(/ -- TUAW/,'').gsub('"','»').gsub("'",'’') 44 | bings << { 45 | 'title' => tag_title, 46 | 'url' => result.elements['web:Url'].text 47 | } 48 | rescue 49 | TextMate.exit_show_tool_tip "Error in returned data" 50 | end 51 | end 52 | end 53 | 54 | elegant_exit("No related tags found in index") if bings.empty? 55 | 56 | plist = { 'menuItems' => bings }.to_plist 57 | res = OSX::PropertyList.load(`#{e_sh DIALOG} -up #{e_sh plist}`) 58 | unless res.has_key? 'selectedMenuItem' 59 | if ENV['TM_CURRENT_LINE'] =~ /^\[/ 60 | TextMate.exit_insert_text "]: " 61 | else 62 | elegant_exit('cancelled') 63 | end 64 | end 65 | url = res['selectedMenuItem']['url'] 66 | title = res['selectedMenuItem']['title'] 67 | 68 | TextMate.exit_replace_text url if ENV['TM_CURRENT_LINE'] =~ /^link: #{input}/ 69 | if (input.empty? && !(ENV['TM_SCOPE'].scan(/markdown/).empty?) && ENV['TM_CURRENT_LINE'] =~ /^(\s+)?$/) || ENV['TM_CURRENT_LINE'] =~ /^(#{input})?(\s+)?$/ 70 | # input = "tag" + title.chomp.gsub(/\s+/,"_") 71 | input = "tag" + linktext 72 | print ERB.new(ENV['TM_REF_LINK_FORMAT']).result 73 | else 74 | print ERB.new(ENV['TM_BLINK_FORMAT']).result 75 | end 76 | 77 | fallbackInput 78 | word 79 | input 80 | selection 81 | keyEquivalent 82 | ^@w 83 | name 84 | Make Tag Link 85 | output 86 | insertAsSnippet 87 | scope 88 | text.html, text.html.markdown, text.html.markdown.multimarkdown, text.html.textile, text.bbcode, text.moinmoin, text.restructuredtext 89 | tabTrigger 90 | tag 91 | uuid 92 | 66D64733-D941-4B0B-AFA1-497C77BB03F1 93 | 94 | 95 | -------------------------------------------------------------------------------- /Commands/Select from Moby Thesaurus.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -W0 -KU 9 | DIALOG = ENV['DIALOG'] 10 | require "#{ENV['TM_SUPPORT_PATH']}/lib/progress.rb" 11 | require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes.rb" 12 | require "#{ENV['TM_SUPPORT_PATH']}/lib/ui.rb" 13 | require 'cgi' 14 | require 'net/http' 15 | require 'net/https' 16 | require 'rexml/document' 17 | 18 | def spell_req(text) 19 | '<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="0"><text>'+REXML::Text.new(text).to_s+'</text></spellrequest>' 20 | end 21 | 22 | def check_spelling(text) 23 | $out = text.clone 24 | h = Net::HTTP.new("www.google.com", 443) 25 | h.use_ssl=true 26 | resp, body = h.post("/tbproxy/spell?lang=en&hl=en", spell_req(text)) 27 | 28 | if resp.code.to_i == 200 29 | body.scan(/<c o="(\d+)" l="(\d+)" s="(\d+)">(\w+).*?<\/c>/) {|o, l, s, t| $out.sub!(text[o.to_i, l.to_i], t)} 30 | return $out 31 | else 32 | return nil 33 | end 34 | end 35 | 36 | def get_thes(phrase) 37 | TextMate.call_with_progress(:title => "Contacting Aonaware Dictionary", :message => "Looking up #{phrase} in Moby Thesaurus") do 38 | escapedUrl = "http://services.aonaware.com/DictService/DictService.asmx/DefineInDict?word=#{CGI.escape(phrase).gsub(/\\'/,'%27')}&dictid=moby-thes" 39 | xml_data = Net::HTTP.get_response(URI.parse(escapedUrl)).body 40 | doc = REXML::Document.new(xml_data) 41 | defs = [] 42 | doc.elements.each('WordDefinition/Definitions/Definition/WordDefinition') do |definition| 43 | return definition.text 44 | end 45 | return false 46 | end 47 | end 48 | 49 | phrase = STDIN.read 50 | words = get_thes(phrase) 51 | if words == false then 52 | newphrase = check_spelling(phrase) 53 | unless newphrase.nil? 54 | res = TextMate::UI.request_confirmation(:button1 => "Yes, it is", :button2 => "No, it's not", :title => "Did you mean something else?",:prompt => "Is #{newphrase} the word you were looking for?") 55 | words = get_thes(newphrase) if res == true 56 | end 57 | end 58 | TextMate.exit_show_tool_tip "Nothing found" if words == false 59 | words = words.gsub(/[\t\n]/,"").gsub(/\s{2,}/,"") 60 | words = words.split(":") 61 | words.shift 62 | words = words.join("") 63 | words = words.split(",") 64 | words = words.map { |word| { 'title' => word.strip,'word' => word.strip } } 65 | plist = { 'menuItems' => words }.to_plist 66 | 67 | res = OSX::PropertyList::load(`#{e_sh DIALOG} -up #{e_sh plist}`) 68 | TextMate.exit_discard unless res.has_key? 'selectedMenuItem' 69 | 70 | if phrase =~ /^[A-Z]/ then 71 | if phrase =~ /[A-Z]{2,}/ then 72 | print res['selectedMenuItem']['word'].gsub(/(.+)/){ $1.upcase } 73 | else 74 | print res['selectedMenuItem']['word'].capitalize 75 | end 76 | else 77 | print res['selectedMenuItem']['word'] 78 | end 79 | fallbackInput 80 | word 81 | input 82 | selection 83 | keyEquivalent 84 | ^@w 85 | name 86 | Select from Moby Thesaurus 87 | output 88 | replaceSelectedText 89 | scope 90 | text.html, text.html.markdown, text.html.markdown.multimarkdown 91 | uuid 92 | 01BF4831-F104-4C72-945B-4AF8D6E95097 93 | 94 | 95 | -------------------------------------------------------------------------------- /Commands/Add TODO.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | # Inspired by - and built upon - the GTDAlt bundle by Charilaos Skiadas 10 | # http://skiadas.dcostanet.net/afterthought/2006/06/20/yet-another-gtd-bundle/ 11 | require ENV['TM_SUPPORT_PATH'] + "/lib/exit_codes.rb" 12 | require ENV['TM_SUPPORT_PATH'] + "/lib/escape.rb" 13 | 14 | curline = ENV['TM_CURRENT_LINE'] 15 | cursor = ENV['TM_LINE_INDEX'].to_i 16 | text = STDIN.read 17 | def closest_marker(line,cursor) 18 | ds = [] 19 | line.scan(/<\d+>/).each {|w| 20 | idx = line.index(w).to_i 21 | if idx > cursor 22 | d = idx - cursor 23 | else 24 | right = idx + w.length 25 | if right > cursor 26 | d = 0 27 | else 28 | d = cursor - right 29 | end 30 | end 31 | ds << { 'marker' => w, 'distance' => d } 32 | } 33 | return false if ds.empty? 34 | return ds.sort{|a,b| a['distance'] <=> b['distance']}[0] 35 | end 36 | 37 | if curline =~ /^<\d+>/ 38 | lines = text.split("\n") 39 | row = ENV['TM_LINE_NUMBER'].to_i 40 | m = lines[row-1].scan(/^<\d+>/)[0] 41 | txt = text.slice(0..text.index(m) + m.length) 42 | lines = txt.split("\n") 43 | line = lines.length 44 | last_line = lines.last 45 | column = last_line.scan(/.*?#{m}/)[0].to_s.length + 1 46 | `open "txmt://open?line=#{line}&column=#{column}"` 47 | TextMate.exit_discard 48 | else 49 | lines = text.split("\n") 50 | row = ENV['TM_LINE_NUMBER'].to_i 51 | col = ENV['TM_LINE_INDEX'].to_i 52 | currentLine = lines[row-1] 53 | if res = closest_marker(curline,cursor) 54 | found = res['marker'] if res['distance'] < 1 55 | else 56 | found = false 57 | end 58 | if found then 59 | # No need to change the file at all in this case. Just locate the proper 60 | # line and use the txmt scheme to take us there. 61 | txt = text.slice(0..text.rindex(found)+found.length) 62 | lines = txt.split("\n") 63 | line = lines.length 64 | column = lines.last.length + 1 65 | `open "txmt://open?line=#{line}&column=#{column}"` 66 | TextMate.exit_discard 67 | # print text.insert(text.rindex(found)+found.length + 1,"$0") 68 | else 69 | m = text.scan(/<(\d+)>/).map{|i| i[0].to_i}.max || 0 70 | before = [] 71 | (row-1).times do before << lines.shift end 72 | lastline = cursor > 0 ? lines[0][0..cursor-1] : " " 73 | lastline = "" if row > lines.length && currentLine.nil? 74 | before << lastline 75 | if currentLine.nil? 76 | puts e_sn(before.join("\n")) 77 | print "<#{m+1}> ${1:Unattached note}$0" 78 | TextMate.exit_insert_snippet 79 | end 80 | line_end = lines.shift[cursor..-1] 81 | endgap = m > 0 ? "\n" : "\n\n" 82 | print e_sn(before.join("\n") + "<#{m+1}>#{line_end}\n" + lines.join("\n")) + "#{endgap}<#{m+1}> ${1:Note ##{m+1}}$0" 83 | end 84 | end 85 | input 86 | selection 87 | keyEquivalent 88 | ^{ 89 | name 90 | New/Jump to TODO 91 | output 92 | insertAsSnippet 93 | scope 94 | text.html, text.html.markdown, text.html.markdown.multimarkdown 95 | tabTrigger 96 | <> 97 | uuid 98 | D2E2EB99-5513-4134-AE0D-C24E732F70CB 99 | 100 | 101 | -------------------------------------------------------------------------------- /Commands/New:Jump to TODO.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | # Inspired by - and built upon - the GTDAlt bundle by Charilaos Skiadas 10 | # http://skiadas.dcostanet.net/afterthought/2006/06/20/yet-another-gtd-bundle/ 11 | require ENV['TM_SUPPORT_PATH'] + "/lib/exit_codes.rb" 12 | require ENV['TM_SUPPORT_PATH'] + "/lib/escape.rb" 13 | 14 | curline = ENV['TM_CURRENT_LINE'] 15 | cursor = ENV['TM_LINE_INDEX'].to_i 16 | text = STDIN.read 17 | def closest_marker(line,cursor) 18 | ds = [] 19 | line.scan(/<\d+>/).each {|w| 20 | idx = line.index(w).to_i 21 | if idx > cursor 22 | d = idx - cursor 23 | else 24 | right = idx + w.length 25 | if right > cursor 26 | d = 0 27 | else 28 | d = cursor - right 29 | end 30 | end 31 | ds << { 'marker' => w, 'distance' => d } 32 | } 33 | return false if ds.empty? 34 | return ds.sort{|a,b| a['distance'] <=> b['distance']}[0] 35 | end 36 | 37 | if curline =~ /^<\d+>/ 38 | lines = text.split("\n") 39 | row = ENV['TM_LINE_NUMBER'].to_i 40 | m = lines[row-1].scan(/^<\d+>/)[0] 41 | txt = text.slice(0..text.index(m) + m.length) 42 | lines = txt.split("\n") 43 | line = lines.length 44 | last_line = lines.last 45 | column = last_line.scan(/.*?#{m}/)[0].to_s.length + 1 46 | `open "txmt://open?line=#{line}&column=#{column}"` 47 | TextMate.exit_discard 48 | else 49 | lines = text.split("\n") 50 | row = ENV['TM_LINE_NUMBER'].to_i 51 | col = ENV['TM_LINE_INDEX'].to_i 52 | currentLine = lines[row-1] 53 | if res = closest_marker(curline,cursor) 54 | found = res['marker'] if res['distance'] < 1 55 | else 56 | found = false 57 | end 58 | if found then 59 | # No need to change the file at all in this case. Just locate the proper 60 | # line and use the txmt scheme to take us there. 61 | txt = text.slice(0..text.rindex(found)+found.length) 62 | lines = txt.split("\n") 63 | line = lines.length 64 | column = lines.last.length + 1 65 | `open "txmt://open?line=#{line}&column=#{column}"` 66 | TextMate.exit_discard 67 | # print text.insert(text.rindex(found)+found.length + 1,"$0") 68 | else 69 | m = text.scan(/<(\d+)>/).map{|i| i[0].to_i}.max || 0 70 | before = [] 71 | (row-1).times do before << lines.shift end 72 | lastline = cursor > 0 ? lines[0][0..cursor-1] : " " 73 | lastline = "" if row > lines.length && currentLine.nil? 74 | before << lastline 75 | if currentLine.nil? 76 | puts e_sn(before.join("\n")) 77 | print "<#{m+1}> ${1:Unattached note}$0" 78 | TextMate.exit_insert_snippet 79 | end 80 | line_end = lines.shift[cursor..-1] 81 | endgap = m > 0 ? "\n" : "\n\n" 82 | print e_sn(before.join("\n") + "<#{m+1}>#{line_end}\n" + lines.join("\n")) + "#{endgap}<#{m+1}> ${1:Note ##{m+1}}$0" 83 | end 84 | end 85 | input 86 | selection 87 | keyEquivalent 88 | ^{ 89 | name 90 | New/Jump to TODO 91 | output 92 | insertAsSnippet 93 | scope 94 | text.html, text.html.markdown, text.html.markdown.multimarkdown 95 | tabTrigger 96 | <> 97 | uuid 98 | D2E2EB99-5513-4134-AE0D-C24E732F70CB 99 | 100 | 101 | -------------------------------------------------------------------------------- /Commands/Link Blog Post.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | bundleUUID 8 | 37D5C267-16F1-4386-9E6D-47667DF151F6 9 | command 10 | #!/usr/bin/env ruby -rjcode -Ku 11 | SUPPORT = ENV['TM_SUPPORT_PATH'] 12 | DIALOG = ENV['DIALOG'] 13 | require SUPPORT + '/lib/escape' 14 | require SUPPORT + '/lib/ui' 15 | require SUPPORT + '/lib/osx/plist' 16 | require SUPPORT + '/lib/exit_codes' 17 | require 'erb' 18 | require 'net/http' 19 | require 'rexml/document' 20 | require 'cgi' 21 | 22 | string = STDIN.read 23 | offset = 0 24 | blogsite = ENV['BLOG_SITE'] ? ENV['BLOG_SITE'] : "www.tuaw.com" 25 | phrase = TextMate::UI.request_string(:title => "Enter keywords",:prompt => "Find posts with keywords:",:default => string) 26 | TextMate.exit_discard unless phrase 27 | 28 | query = phrase + " site:#{blogsite} AND NOT intitle:tag" 29 | 30 | def do_search(offset,phrase) 31 | escapedUrl = "http://api.search.live.net/xml.aspx?Appid=6B9E3A4B9F0D8F963A24815A0317BF1DCA3B0E9A&query=#{e_url(phrase)}&sources=web&web.offset=#{offset}" 32 | 33 | xml_data = Net::HTTP.get_response(URI.parse(escapedUrl)).body 34 | doc = REXML::Document.new(xml_data) 35 | bings = [] 36 | doc.elements.each('SearchResponse/web:Web/web:Results/web:WebResult') do |result| 37 | begin 38 | bings << { 39 | 'title' => result.elements['web:Title'].text.gsub('"','»').gsub("'",'’'), 40 | 'url' => result.elements['web:Url'].text 41 | } 42 | rescue 43 | TextMate.exit_show_tool_tip "Error in returned data" 44 | end 45 | end 46 | bings << { 47 | 'title' => 'More results…', 48 | 'url' => '' 49 | } unless bings.empty? 50 | 51 | TextMate.exit_show_tool_tip "No matches" if bings.empty? 52 | 53 | plist = { 'menuItems' => bings }.to_plist 54 | res = OSX::PropertyList.load(`#{e_sh DIALOG} -up #{e_sh plist}`) 55 | unless res.has_key? 'selectedMenuItem' 56 | if ENV['TM_CURRENT_LINE'] =~ /^\[/ 57 | TextMate.exit_insert_text "]: " 58 | else 59 | TextMate.exit_discard 60 | end 61 | end 62 | if res['selectedMenuItem']['title'] == "More results…" 63 | offset += 10 64 | do_search(offset,phrase) 65 | else 66 | return res 67 | end 68 | end 69 | 70 | res = do_search(offset,query) 71 | url = res['selectedMenuItem']['url'] 72 | input = string # res['selectedMenuItem']['title'] 73 | 74 | if !(ENV['TM_SCOPE'].scan(/markdown/).empty?) && ENV['TM_CURRENT_LINE'] =~ /^#{string}(\s+)?$/ 75 | print ERB.new(ENV['TM_REF_LINK_FORMAT']).result 76 | elsif ENV['TM_CURRENT_LINE'] =~ /\[(dev )?#{phrase.sub(/ iphone/,'')}/ || ENV['TM_CURRENT_LINE'] =~ /\[#{string}/ 77 | string = phrase if string.empty? 78 | print "${1:#{string}}]: #{url}$0" 79 | else 80 | print ERB.new(ENV['TM_BLINK_FORMAT']).result.strip 81 | end 82 | 83 | fallbackInput 84 | word 85 | input 86 | selection 87 | keyEquivalent 88 | ^@w 89 | name 90 | Link Blog Post 91 | output 92 | insertAsSnippet 93 | scope 94 | text.html, text.html.markdown, text.html.markdown.multimarkdown, text.html.textile, text.bbcode, text.moinmoin, text.restructuredtext 95 | tabTrigger 96 | tuaw 97 | uuid 98 | 3E7D548D-C926-437E-8B6B-49B3E4E8A438 99 | 100 | 101 | -------------------------------------------------------------------------------- /Commands/Bing Web Search.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | BSUPPORT = ENV['TM_BUNDLE_SUPPORT'] 11 | DIALOG = ENV['DIALOG'] 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/ui' 14 | require SUPPORT + '/lib/osx/plist' 15 | require SUPPORT + '/lib/exit_codes' 16 | require BSUPPORT + '/lib/cooldialog' 17 | require 'erb' 18 | require 'net/http' 19 | require 'rexml/document' 20 | require 'cgi' 21 | 22 | string = STDIN.read 23 | offset = 0 24 | 25 | if string.empty? 26 | if ENV['TM_CURRENT_LINE'] =~ /\[([^\]]+)/ 27 | phrase = $1 28 | else 29 | phrase = TextMate::UI.request_string(:title => "Search Query",:prompt => "Enter terms to search for") 30 | end 31 | else 32 | if ENV['TM_CURRENT_LINE'] =~ /^\[([^\]]+)/ 33 | phrase = $1 34 | phrase = phrase.sub(/dev /,'') + " iphone" if ENV['TM_CURRENT_LINE'] =~ /^\[dev / 35 | else 36 | phrase = string 37 | end 38 | end 39 | 40 | def do_search(offset,phrase) 41 | escapedUrl = "http://api.search.live.net/xml.aspx?Appid=6B9E3A4B9F0D8F963A24815A0317BF1DCA3B0E9A&query=#{e_url(phrase)}&sources=web&web.offset=#{offset}" 42 | 43 | xml_data = Net::HTTP.get_response(URI.parse(escapedUrl)).body 44 | doc = REXML::Document.new(xml_data) 45 | bings = [] 46 | doc.elements.each('SearchResponse/web:Web/web:Results/web:WebResult') do |result| 47 | begin 48 | bings << { 49 | 'title' => result.elements['web:Title'].text.gsub('"','»').gsub("'",'’'), 50 | 'url' => result.elements['web:Url'].text 51 | } 52 | rescue 53 | TextMate.exit_show_tool_tip "Error in returned data" 54 | end 55 | end 56 | bings << { 57 | 'title' => 'More results…', 58 | 'url' => '' 59 | } unless bings.empty? 60 | 61 | TextMate.exit_show_tool_tip "No matches" if bings.empty? 62 | 63 | plist = { 'menuItems' => bings }.to_plist 64 | res = OSX::PropertyList.load(`#{e_sh DIALOG} -up #{e_sh plist}`) 65 | unless res.has_key? 'selectedMenuItem' 66 | TextMate::CoolDialog.cool_tool_tip("Cancelled") 67 | if ENV['TM_CURRENT_LINE'] =~ /^\[/ 68 | TextMate.exit_insert_text "]: " 69 | else 70 | TextMate.exit_discard 71 | end 72 | end 73 | if res['selectedMenuItem']['title'] == "More results…" 74 | offset += 10 75 | do_search(offset,phrase) 76 | else 77 | return res 78 | end 79 | end 80 | 81 | res = do_search(offset,phrase) 82 | url = res['selectedMenuItem']['url'] 83 | input = phrase # res['selectedMenuItem']['title'] 84 | 85 | if !(ENV['TM_SCOPE'].scan(/markdown/).empty?) && ENV['TM_CURRENT_LINE'] =~ /^#{string}(\s+)?$/ 86 | print ERB.new(ENV['TM_REF_LINK_FORMAT']).result 87 | elsif ENV['TM_CURRENT_LINE'] =~ /\[(dev )?#{phrase.sub(/ iphone/,'')}/ || ENV['TM_CURRENT_LINE'] =~ /\[#{string}/ 88 | string = phrase if string.empty? 89 | print "${1:#{string}}]: #{url}$0" 90 | else 91 | print ERB.new(ENV['TM_BLINK_FORMAT']).result 92 | end 93 | 94 | fallbackInput 95 | word 96 | input 97 | selection 98 | keyEquivalent 99 | ^@w 100 | name 101 | Web Search (Bing) 102 | output 103 | insertAsSnippet 104 | scope 105 | text.html, text.html.markdown, text.html.markdown.multimarkdown 106 | tabTrigger 107 | ]: 108 | uuid 109 | B14B1917-515B-4B02-9F26-55093F7215C1 110 | 111 | 112 | -------------------------------------------------------------------------------- /Commands/Web Search (Bing).tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | BSUPPORT = ENV['TM_BUNDLE_SUPPORT'] 11 | DIALOG = ENV['DIALOG'] 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/ui' 14 | require SUPPORT + '/lib/osx/plist' 15 | require SUPPORT + '/lib/exit_codes' 16 | require BSUPPORT + '/lib/cooldialog' 17 | require 'erb' 18 | require 'net/http' 19 | require 'rexml/document' 20 | require 'cgi' 21 | 22 | string = STDIN.read 23 | offset = 0 24 | 25 | if string.empty? 26 | if ENV['TM_CURRENT_LINE'] =~ /\[([^\]]+)/ 27 | phrase = $1 28 | else 29 | phrase = TextMate::UI.request_string(:title => "Search Query",:prompt => "Enter terms to search for") 30 | end 31 | else 32 | if ENV['TM_CURRENT_LINE'] =~ /^\[([^\]]+)/ 33 | phrase = $1 34 | phrase = phrase.sub(/dev /,'') + " iphone" if ENV['TM_CURRENT_LINE'] =~ /^\[dev / 35 | else 36 | phrase = string 37 | end 38 | end 39 | 40 | def do_search(offset,phrase) 41 | escapedUrl = "http://api.search.live.net/xml.aspx?Appid=6B9E3A4B9F0D8F963A24815A0317BF1DCA3B0E9A&query=#{e_url(phrase)}&sources=web&web.offset=#{offset}" 42 | 43 | xml_data = Net::HTTP.get_response(URI.parse(escapedUrl)).body 44 | doc = REXML::Document.new(xml_data) 45 | bings = [] 46 | doc.elements.each('SearchResponse/web:Web/web:Results/web:WebResult') do |result| 47 | begin 48 | bings << { 49 | 'title' => result.elements['web:Title'].text.gsub('"','»').gsub("'",'’'), 50 | 'url' => result.elements['web:Url'].text 51 | } 52 | rescue 53 | TextMate.exit_show_tool_tip "Error in returned data" 54 | end 55 | end 56 | bings << { 57 | 'title' => 'More results…', 58 | 'url' => '' 59 | } unless bings.empty? 60 | 61 | TextMate.exit_show_tool_tip "No matches" if bings.empty? 62 | 63 | plist = { 'menuItems' => bings }.to_plist 64 | res = OSX::PropertyList.load(`#{e_sh DIALOG} -up #{e_sh plist}`) 65 | unless res.has_key? 'selectedMenuItem' 66 | TextMate::CoolDialog.cool_tool_tip("Cancelled") 67 | if ENV['TM_CURRENT_LINE'] =~ /^\[/ 68 | TextMate.exit_insert_text "]: " 69 | else 70 | TextMate.exit_discard 71 | end 72 | end 73 | if res['selectedMenuItem']['title'] == "More results…" 74 | offset += 10 75 | do_search(offset,phrase) 76 | else 77 | return res 78 | end 79 | end 80 | 81 | res = do_search(offset,phrase) 82 | url = res['selectedMenuItem']['url'] 83 | input = phrase # res['selectedMenuItem']['title'] 84 | 85 | if !(ENV['TM_SCOPE'].scan(/markdown/).empty?) && ENV['TM_CURRENT_LINE'] =~ /^#{string}(\s+)?$/ 86 | print ERB.new(ENV['TM_REF_LINK_FORMAT']).result 87 | elsif ENV['TM_CURRENT_LINE'] =~ /\[(dev )?#{phrase.sub(/ iphone/,'')}/ || ENV['TM_CURRENT_LINE'] =~ /\[#{string}/ 88 | string = phrase if string.empty? 89 | print "${1:#{string}}]: #{url}$0" 90 | else 91 | print ERB.new(ENV['TM_BLINK_FORMAT']).result 92 | end 93 | 94 | fallbackInput 95 | word 96 | input 97 | selection 98 | keyEquivalent 99 | ^@w 100 | name 101 | Web Search (Bing) 102 | output 103 | insertAsSnippet 104 | scope 105 | text.html, text.html.markdown, text.html.markdown.multimarkdown 106 | tabTrigger 107 | ]: 108 | uuid 109 | B14B1917-515B-4B02-9F26-55093F7215C1 110 | 111 | 112 | -------------------------------------------------------------------------------- /Commands/Bing News Search.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | BSUPPORT = ENV['TM_BUNDLE_SUPPORT'] 11 | DIALOG = ENV['DIALOG'] 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/ui' 14 | require SUPPORT + '/lib/osx/plist' 15 | require SUPPORT + '/lib/exit_codes' 16 | require BSUPPORT + '/lib/cooldialog' 17 | require 'erb' 18 | require 'net/http' 19 | require 'rexml/document' 20 | 21 | string = STDIN.read 22 | offset = 0 23 | if string.empty? 24 | if ENV['TM_CURRENT_LINE'] =~ /\[([^\]]+)/ 25 | phrase = $1 26 | else 27 | phrase = TextMate::UI.request_string(:title => "Search Query",:prompt => "Enter terms to search for") 28 | end 29 | else 30 | if ENV['TM_CURRENT_LINE'] =~ /^\[([^\]]+)/ 31 | phrase = $1 32 | phrase = phrase.sub(/dev /,'') + " iphone" if ENV['TM_CURRENT_LINE'] =~ /^\[dev / 33 | else 34 | phrase = string 35 | end 36 | end 37 | 38 | def do_search(offset,phrase) 39 | escapedUrl = "http://api.search.live.net/xml.aspx?Appid=6B9E3A4B9F0D8F963A24815A0317BF1DCA3B0E9A&query=#{e_url(phrase)}&sources=news&news.offset=#{offset}" 40 | xml_data = Net::HTTP.get_response(URI.parse(escapedUrl)).body 41 | doc = REXML::Document.new(xml_data) 42 | bings = [] 43 | doc.elements.each('SearchResponse/news:News/news:Results/news:NewsResult') do |result| 44 | newsdate = result.elements['news:Date'].text.match(/(\d{4})-(\d{2})-(\d{2})/)[0].to_s 45 | newstitle = result.elements['news:Title'].text.gsub('"','»') 46 | newssource = result.elements['news:Source'].text 47 | bings << { 48 | 'title' => "#{newsdate}: #{newstitle} (#{newssource})", 49 | 'url' => result.elements['news:Url'].text, 50 | 'label' => "#{phrase} - #{newssource}" 51 | } 52 | end 53 | bings << { 54 | 'title' => 'More results…', 55 | 'url' => '' 56 | } unless bings.empty? 57 | 58 | 59 | TextMate.exit_show_tool_tip "No matches" if bings.empty? 60 | plist = { 'menuItems' => bings }.to_plist 61 | res = OSX::PropertyList.load(`#{e_sh DIALOG} -up #{e_sh plist}`) 62 | unless res.has_key? 'selectedMenuItem' 63 | TextMate::CoolDialog.cool_tool_tip("Cancelled") 64 | TextMate.exit_insert_text "]: " 65 | end 66 | if res['selectedMenuItem']['title'] == "More results…" 67 | offset += 10 68 | do_search(offset,phrase) 69 | else 70 | return res 71 | end 72 | end 73 | 74 | res = do_search(offset,phrase) 75 | url = res['selectedMenuItem']['url'] 76 | input = phrase # res['selectedMenuItem']['label'] 77 | 78 | if !(ENV['TM_SCOPE'].scan(/markdown/).empty?) && ENV['TM_CURRENT_LINE'] =~ /^#{string}(\s+)?$/ 79 | print ERB.new(ENV['TM_REF_LINK_FORMAT']).result 80 | elsif ENV['TM_CURRENT_LINE'] =~ /\[(dev )?#{phrase.sub(/ iphone/,'')}/ || ENV['TM_CURRENT_LINE'] =~ /\[#{string}/ 81 | string = phrase if string.empty? 82 | print "${1:#{string}}]: #{url}$0" 83 | else 84 | print ERB.new(ENV['TM_BLINK_FORMAT']).result 85 | end 86 | fallbackInput 87 | word 88 | input 89 | selection 90 | keyEquivalent 91 | ^@w 92 | name 93 | News Search (Bing) 94 | output 95 | insertAsSnippet 96 | scope 97 | text.html, text.html.markdown, text.html.markdown.multimarkdown 98 | tabTrigger 99 | ]: 100 | uuid 101 | 53D486B1-FB90-48AE-B1D2-97E47EBD6D32 102 | 103 | 104 | -------------------------------------------------------------------------------- /Commands/Blogger Link.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/ruby 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | DIALOG = ENV['DIALOG'] 11 | require SUPPORT + '/lib/ui' 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/osx/plist' 14 | require SUPPORT + '/lib/exit_codes' 15 | require 'erb' 16 | require 'cgi' 17 | require 'net/http' 18 | require 'rexml/document' 19 | 20 | blogger = STDIN.read 21 | input = blogger 22 | blogsite = ENV['BLOG_SITE'] ? ENV['BLOG_SITE'] : "www.tuaw.com" 23 | blogsite = "www." + blogsite unless blogsite =~ /^www\./ 24 | 25 | query = input + " site:#{blogsite}/editor" 26 | 27 | escapedUrl = "http://api.search.live.net/xml.aspx?Appid=6B9E3A4B9F0D8F963A24815A0317BF1DCA3B0E9A&query=#{e_url(query)}&sources=web&web.offset=0" 28 | 29 | xml_data = Net::HTTP.get_response(URI.parse(escapedUrl)).body 30 | doc = REXML::Document.new(xml_data) 31 | bings = [] 32 | doc.elements.each('SearchResponse/web:Web/web:Results/web:WebResult') do |result| 33 | begin 34 | bings << { 35 | 'title' => result.elements['web:Title'].text.gsub('"','»').gsub("'",'’'), 36 | 'url' => result.elements['web:Url'].text 37 | } 38 | rescue 39 | TextMate.exit_show_tool_tip "Error in returned data" 40 | end 41 | end 42 | 43 | TextMate.exit_show_tool_tip "Blogger not found, check your spelling" if bings.empty? 44 | 45 | ysuggest = [] 46 | bings.each {|result| 47 | if result['url'].gsub(/-/,' ') =~ /#{input}/i && result['url'] =~ /^http:\/\/#{blogsite}\/editor\/[^\/]+\/?$/ 48 | blogger_name = result['url'].match(/\/editor\/([^\/]+)\/?/)[1].chomp.gsub(/-/,' ').gsub(/\b([a-z])/i) {|w| w.capitalize } 49 | ysuggest << { 50 | 'title' => blogger_name, 51 | 'url' => result['url'] 52 | } 53 | end 54 | } 55 | sorted = ysuggest.sort do |a,b| 56 | a['title'] <=> b['title'] 57 | end 58 | sorted.uniq! 59 | TextMate.exit_show_tool_tip "No matches found" if sorted.empty? 60 | if sorted.length > 1 61 | plist = { 'menuItems' => sorted }.to_plist 62 | 63 | res = OSX::PropertyList.load(`#{e_sh DIALOG} -up #{e_sh plist}`) 64 | TextMate.exit_discard unless res.has_key? 'selectedMenuItem' 65 | url = res['selectedMenuItem']['url'] 66 | url += "/" unless url =~ /\/$/ 67 | input = res['selectedMenuItem']['title'] 68 | else 69 | url = sorted[0]['url'] 70 | url += "/" unless url =~ /\/$/ 71 | input = sorted[0]['title'] 72 | end 73 | 74 | # res = Net::HTTP.get_response(URI.parse(url)).body 75 | # name_match = res.match(/class="bloggername">([^<]+)</) 76 | # name_match = res.match(/class="byline">by <strong><a href="[^"]+">([^<]+)<\/a>/) if name_match.nil? 77 | # url += "/" unless url =~ /\/$/ 78 | 79 | if (!(ENV['TM_SCOPE'].scan(/markdown/).empty?) && ENV['TM_CURRENT_LINE'] =~ /^(\s+)?$/) || ENV['TM_CURRENT_LINE'] =~ /^(#{blogger})?(\s+)?$/ 80 | print ERB.new(ENV['TM_REF_LINK_FORMAT']).result 81 | else 82 | print ERB.new(ENV['TM_BLINK_FORMAT']).result 83 | end 84 | fallbackInput 85 | word 86 | input 87 | selection 88 | keyEquivalent 89 | ^@w 90 | name 91 | Blogger Link 92 | output 93 | insertAsSnippet 94 | scope 95 | text.html, text.html.markdown, text.html.markdown.multimarkdown, text.html.textile, text.bbcode, text.moinmoin, text.restructuredtext 96 | uuid 97 | DB2BB6A6-B3B4-4AE6-B29A-9EDF8C7D52D7 98 | 99 | 100 | -------------------------------------------------------------------------------- /Commands/News Search (Bing).tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby -rjcode -Ku 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | BSUPPORT = ENV['TM_BUNDLE_SUPPORT'] 11 | DIALOG = ENV['DIALOG'] 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/ui' 14 | require SUPPORT + '/lib/osx/plist' 15 | require SUPPORT + '/lib/exit_codes' 16 | require BSUPPORT + '/lib/cooldialog' 17 | require 'erb' 18 | require 'net/http' 19 | require 'rexml/document' 20 | 21 | string = STDIN.read 22 | offset = 0 23 | if string.empty? 24 | if ENV['TM_CURRENT_LINE'] =~ /\[([^\]]+)/ 25 | phrase = $1 26 | else 27 | phrase = TextMate::UI.request_string(:title => "Search Query",:prompt => "Enter terms to search for") 28 | end 29 | else 30 | if ENV['TM_CURRENT_LINE'] =~ /^\[([^\]]+)/ 31 | phrase = $1 32 | phrase = phrase.sub(/dev /,'') + " iphone" if ENV['TM_CURRENT_LINE'] =~ /^\[dev / 33 | else 34 | phrase = string 35 | end 36 | end 37 | 38 | def do_search(offset,phrase) 39 | escapedUrl = "http://api.search.live.net/xml.aspx?Appid=6B9E3A4B9F0D8F963A24815A0317BF1DCA3B0E9A&query=#{e_url(phrase)}&sources=news&news.offset=#{offset}" 40 | xml_data = Net::HTTP.get_response(URI.parse(escapedUrl)).body 41 | doc = REXML::Document.new(xml_data) 42 | bings = [] 43 | doc.elements.each('SearchResponse/news:News/news:Results/news:NewsResult') do |result| 44 | newsdate = result.elements['news:Date'].text.match(/(\d{4})-(\d{2})-(\d{2})/)[0].to_s 45 | newstitle = result.elements['news:Title'].text.gsub('"','»') 46 | newssource = result.elements['news:Source'].text 47 | bings << { 48 | 'title' => "#{newsdate}: #{newstitle} (#{newssource})", 49 | 'url' => result.elements['news:Url'].text, 50 | 'label' => "#{phrase} - #{newssource}" 51 | } 52 | end 53 | bings << { 54 | 'title' => 'More results…', 55 | 'url' => '' 56 | } unless bings.empty? 57 | 58 | 59 | TextMate.exit_show_tool_tip "No matches" if bings.empty? 60 | plist = { 'menuItems' => bings }.to_plist 61 | res = OSX::PropertyList.load(`#{e_sh DIALOG} -up #{e_sh plist}`) 62 | unless res.has_key? 'selectedMenuItem' 63 | TextMate::CoolDialog.cool_tool_tip("Cancelled") 64 | TextMate.exit_insert_text "]: " 65 | end 66 | if res['selectedMenuItem']['title'] == "More results…" 67 | offset += 10 68 | do_search(offset,phrase) 69 | else 70 | return res 71 | end 72 | end 73 | 74 | res = do_search(offset,phrase) 75 | url = res['selectedMenuItem']['url'] 76 | input = phrase # res['selectedMenuItem']['label'] 77 | 78 | if !(ENV['TM_SCOPE'].scan(/markdown/).empty?) && ENV['TM_CURRENT_LINE'] =~ /^#{string}(\s+)?$/ 79 | print ERB.new(ENV['TM_REF_LINK_FORMAT']).result 80 | elsif ENV['TM_CURRENT_LINE'] =~ /\[(dev )?#{phrase.sub(/ iphone/,'')}/ || ENV['TM_CURRENT_LINE'] =~ /\[#{string}/ 81 | string = phrase if string.empty? 82 | print "${1:#{string}}]: #{url}$0" 83 | else 84 | print ERB.new(ENV['TM_BLINK_FORMAT']).result 85 | end 86 | fallbackInput 87 | word 88 | input 89 | selection 90 | keyEquivalent 91 | ^@w 92 | name 93 | News Search (Bing) 94 | output 95 | insertAsSnippet 96 | scope 97 | text.html, text.html.markdown, text.html.markdown.multimarkdown 98 | tabTrigger 99 | ]: 100 | uuid 101 | 53D486B1-FB90-48AE-B1D2-97E47EBD6D32 102 | 103 | 104 | -------------------------------------------------------------------------------- /Support/lib/categories.txt: -------------------------------------------------------------------------------- 1 | To update the category listing: 2 | 3 | 1. Log in to BlogSmith in your web browser 4 | 2. Paste this URL into the browser: http://beta.blogsmith.aol.com/?a=ajax-post-get-browse-cats&postblogid=16 5 | * The last number in the URL (16) is the blog id for TUAW. If you want another blog's categories, replace 16 with the blog id of your blog 6 | 3. View the source of the resulting page and copy the entire source to the clipboard. 7 | 4. Paste the source code below, leaving the divider in place 8 | 5. Save the file and close it 9 | 10 | <--BEGIN CATEGORY PASTE BELOW THIS LINE--> 11 | Mac NewsAppleiPadiPhoneiOSMacOS XSafariiAdsiPodApple TVAccessoriesApple FinancialMacworldBeta BeatBugs/RecallsDealsDeveloperEducationFeaturesGamingiTunesMobileMeMusicOdds and endsPodcastsRetro MacRumorsSoftwareSurveys and PollsTUAW BusinessVideoiPhone/iPod NewsApp ReviewJailbreak/pwnageApp StoreSDKMac EventsLiveblogWWDCsxswMac LearningAsk TUAWAppleScriptBooksHow-tosInterviewsModsSecuritytip-of-the-dayTUAW FeaturesFriday FavoriteiPhone 101TUAW TipsRoad TestedTUAW BookshelfFirst LookFlickr FindFound FootageMac 101Widget Watch -------------------------------------------------------------------------------- /Commands/Link iPhone App (web).tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/ruby 9 | SUPPORT = ENV['TM_SUPPORT_PATH'] 10 | DIALOG = ENV['DIALOG'] 11 | require SUPPORT + '/lib/ui' 12 | require SUPPORT + '/lib/escape' 13 | require SUPPORT + '/lib/osx/plist' 14 | require SUPPORT + '/lib/exit_codes' 15 | require 'net/http' 16 | require 'erb' 17 | require 'rexml/document' 18 | 19 | input = STDIN.read 20 | blogsite = "itunes.apple.com" 21 | offset = 0 22 | answer = TextMate::UI.request_string(:title => "Enter keywords",:prompt => "Find iPhone apps with keywords:",:default => input) 23 | TextMate.exit_discard unless answer 24 | query = answer + " title:\"on the App Store\" site:#{blogsite}" 25 | 26 | def do_search(offset,phrase) 27 | escapedUrl = "http://api.search.live.net/xml.aspx?Appid=6B9E3A4B9F0D8F963A24815A0317BF1DCA3B0E9A&query=#{e_url(phrase)}&sources=web&web.offset=#{offset}" 28 | 29 | xml_data = Net::HTTP.get_response(URI.parse(escapedUrl)).body 30 | doc = REXML::Document.new(xml_data) 31 | bings = [] 32 | doc.elements.each('SearchResponse/web:Web/web:Results/web:WebResult') do |result| 33 | url = result.elements['web:Url'].text 34 | if url =~ /\/app\// 35 | title = result.elements['web:Title'].text.gsub('"','»').gsub("'",'’').gsub(/<\/?b>/,'') 36 | title = title[0..50]+"…" if title.length > 50 37 | begin 38 | bings << { 39 | 'title' => title, 40 | 'url' => url 41 | } 42 | rescue 43 | TextMate.exit_show_tool_tip "Error in returned data" 44 | end 45 | end 46 | end 47 | bings << { 48 | 'title' => 'More results…', 49 | 'url' => '' 50 | } unless bings.empty? 51 | 52 | TextMate.exit_show_tool_tip "No matches" if bings.empty? 53 | 54 | plist = { 'menuItems' => bings }.to_plist 55 | res = OSX::PropertyList.load(`#{e_sh DIALOG} -up #{e_sh plist}`) 56 | unless res.has_key? 'selectedMenuItem' 57 | if ENV['TM_CURRENT_LINE'] =~ /^\[/ 58 | TextMate.exit_insert_text "]: " 59 | else 60 | TextMate.exit_discard 61 | end 62 | end 63 | if res['selectedMenuItem']['title'] == "More results…" 64 | offset += 10 65 | do_search(offset,phrase) 66 | else 67 | return res 68 | end 69 | end 70 | 71 | res = do_search(offset,query) 72 | 73 | url = res['selectedMenuItem']['url'] 74 | title = res['selectedMenuItem']['title'] 75 | price = "" 76 | if url =~ /^http:\/\/itunes.apple.com\/[^\/]+\/app\/.+$/ 77 | source = Net::HTTP.get_response(URI.parse(url.strip)).body 78 | price = source.match(/<div class="price">([^<]+)<\/div>/)[1] unless source.nil? 79 | end 80 | 81 | if !(ENV['TM_SCOPE'].scan(/markdown/).empty?) && ENV['TM_CURRENT_LINE'] =~ /^(\s+|#{input})?$/ 82 | # input = "itunes " + answer.chomp.gsub(/\s+/,"_") 83 | input = answer 84 | print ERB.new(ENV['TM_APP_REF_LINK_FORMAT']).result 85 | else 86 | input = res if input.empty? 87 | print ERB.new(ENV['TM_APP_BLINK_FORMAT']).result 88 | end 89 | 90 | fallbackInput 91 | word 92 | input 93 | selection 94 | keyEquivalent 95 | ^@w 96 | name 97 | Link iTunes App (web) 98 | output 99 | insertAsSnippet 100 | scope 101 | text.html, text.html.markdown, text.html.markdown.multimarkdown, text.html.textile, text.bbcode, text.moinmoin, text.restructuredtext 102 | uuid 103 | 59B540E7-5B7F-4DDA-B932-1D0E4F80A5FD 104 | 105 | 106 | -------------------------------------------------------------------------------- /Support/lib/utilities.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby -w 2 | 3 | # HTML Utilities for TextMate v.beta 4 | # Michael Sheets - Sept 27, 2005 5 | # 6 | # Special thanks to allan for listening to my regex whining :) 7 | 8 | def strip_tags(html) 9 | # First we need to get rid of any embedded code. 10 | html = strip_embedded(html) 11 | 12 | # Remove comments 13 | html = html.gsub(/ 12 | 73 | EOF 74 | 75 | [ -n "$3" ] && echo -n < 77 | _tm_tailer_outputHandler = tm_tailer_outputHandler; 78 | 79 | tm_tailer_outputHandler = function(currentStringOnStdout){ 80 | TextMate.system('cat "$1"', _tm_tailer_outputHandler); 81 | }; 82 | 83 | EOF 84 | echo '' 85 | } 86 | 87 | stop_button() { 88 | echo -n '' 89 | } 90 | 91 | tm_live_cat() { 92 | tm_live_stuff $1 $2 $3 93 | cat < 95 | 104 | EOF 105 | echo '' 106 | } 107 | 108 | tm_live_cmd() { 109 | tm_live_stuff $1 $2 $3 110 | cat < 112 | 121 | EOF 122 | 123 | cat < 125 | 126 | 127 | EOF 128 | stop_button 129 | clear_button 130 | echo '' 131 | } 132 | 133 | auto_resize_js() { 134 | cat < 136 | 160 | ' 161 | } 162 | 163 | clear_button() { 164 | cat < 166 | 167 | 168 | EOF 169 | } 170 | 171 | auto_clear() { 172 | cat < 174 | tm_auto_clear = true; 175 | 176 | EOF 177 | } 178 | --------------------------------------------------------------------------------
\\1