xiki 0.5.0a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (252) hide show
  1. data/Gemfile +11 -0
  2. data/LICENSE +22 -0
  3. data/README.markdown +83 -0
  4. data/Rakefile +8 -0
  5. data/bin/xiki +46 -0
  6. data/etc/command/xiki_command.rb +203 -0
  7. data/etc/command/xiki_process.rb +52 -0
  8. data/etc/command/xiki_wrapper +2 -0
  9. data/etc/js/menu1.js +55 -0
  10. data/etc/js/xiki.js +259 -0
  11. data/etc/logo.png +0 -0
  12. data/etc/presentations/bootstrap.deck +5 -0
  13. data/etc/presentations/databases.deck +41 -0
  14. data/etc/presentations/diffs.deck +23 -0
  15. data/etc/presentations/documentation.deck +14 -0
  16. data/etc/presentations/effects.deck +5 -0
  17. data/etc/presentations/face.deck +297 -0
  18. data/etc/presentations/files.deck +79 -0
  19. data/etc/presentations/icons.deck +22 -0
  20. data/etc/presentations/images.deck +24 -0
  21. data/etc/presentations/key_shortcuts.deck +16 -0
  22. data/etc/presentations/macros.deck +18 -0
  23. data/etc/presentations/menu_classes.deck +44 -0
  24. data/etc/presentations/menu_directories.deck +30 -0
  25. data/etc/presentations/notes.deck +19 -0
  26. data/etc/presentations/other_languages.deck +55 -0
  27. data/etc/presentations/other_wiki_syntaxes.deck +4 -0
  28. data/etc/presentations/piano.deck +5 -0
  29. data/etc/presentations/potential/diffs.deck +38 -0
  30. data/etc/presentations/potential/evolution.deck +18 -0
  31. data/etc/presentations/potential/intro.deck +711 -0
  32. data/etc/presentations/potential/intro1.deck +711 -0
  33. data/etc/presentations/potential/intro2.deck +97 -0
  34. data/etc/presentations/potential/make_mysql_menu.deck +36 -0
  35. data/etc/presentations/potential/ruby_development.deck +17 -0
  36. data/etc/presentations/potential/ui_prototyping.deck +50 -0
  37. data/etc/presentations/potential/web_dev.deck +4 -0
  38. data/etc/presentations/potential/web_development.deck +10 -0
  39. data/etc/presentations/potential/wiki.deck +45 -0
  40. data/etc/presentations/presentations.deck +24 -0
  41. data/etc/presentations/rails_development.deck +29 -0
  42. data/etc/presentations/search_key_shortcuts.deck +37 -0
  43. data/etc/presentations/simplest_possible_ui.deck +37 -0
  44. data/etc/presentations/svg.deck +5 -0
  45. data/etc/presentations/testing.deck +28 -0
  46. data/etc/presentations/the_end.deck +13 -0
  47. data/etc/presentations/type_something_and_double_click.deck +57 -0
  48. data/etc/presentations/type_the_acronym.deck +144 -0
  49. data/etc/presentations/web_browser.deck +56 -0
  50. data/etc/presentations/xiki_command.deck +20 -0
  51. data/etc/presentations/xiki_url.deck +14 -0
  52. data/etc/shark.icns +0 -0
  53. data/etc/shark_script.icns +0 -0
  54. data/etc/snippets/html.notes +7 -0
  55. data/etc/snippets/notes.notes +20 -0
  56. data/etc/snippets/rb.notes +38 -0
  57. data/etc/templates/menu_template.menu +2 -0
  58. data/etc/templates/menu_template.rb +8 -0
  59. data/etc/templates/template.rb +5 -0
  60. data/etc/themes/Dark_Metal.notes +28 -0
  61. data/etc/themes/Orange_Path.notes +15 -0
  62. data/etc/themes/Shiny_Blue.notes +27 -0
  63. data/etc/themes/Shiny_Green.notes +27 -0
  64. data/etc/wrappers/wrapper.js +17 -0
  65. data/etc/wrappers/wrapper.py +20 -0
  66. data/etc/wrappers/wrapper.rb +25 -0
  67. data/lib/block.rb +72 -0
  68. data/lib/bookmarks.rb +352 -0
  69. data/lib/buffers.rb +170 -0
  70. data/lib/clipboard.rb +333 -0
  71. data/lib/code.rb +860 -0
  72. data/lib/code_tree.rb +476 -0
  73. data/lib/color.rb +274 -0
  74. data/lib/console.rb +557 -0
  75. data/lib/control_lock.rb +9 -0
  76. data/lib/control_tab.rb +176 -0
  77. data/lib/core_ext.rb +31 -0
  78. data/lib/cursor.rb +111 -0
  79. data/lib/deletes.rb +65 -0
  80. data/lib/diff_log.rb +297 -0
  81. data/lib/effects.rb +145 -0
  82. data/lib/environment.rb +5 -0
  83. data/lib/file_tree.rb +1875 -0
  84. data/lib/files.rb +334 -0
  85. data/lib/hide.rb +259 -0
  86. data/lib/history.rb +286 -0
  87. data/lib/image.rb +51 -0
  88. data/lib/incrementer.rb +15 -0
  89. data/lib/insert.rb +7 -0
  90. data/lib/irc.rb +22 -0
  91. data/lib/key_bindings.rb +658 -0
  92. data/lib/keys.rb +754 -0
  93. data/lib/launcher.rb +1351 -0
  94. data/lib/line.rb +429 -0
  95. data/lib/links.rb +6 -0
  96. data/lib/location.rb +175 -0
  97. data/lib/macros.rb +48 -0
  98. data/lib/man.rb +19 -0
  99. data/lib/menu.rb +708 -0
  100. data/lib/merb.rb +259 -0
  101. data/lib/message.rb +5 -0
  102. data/lib/meths.rb +56 -0
  103. data/lib/mode.rb +34 -0
  104. data/lib/move.rb +248 -0
  105. data/lib/notes.rb +1000 -0
  106. data/lib/numbers.rb +45 -0
  107. data/lib/ol.rb +203 -0
  108. data/lib/ol_helper.rb +44 -0
  109. data/lib/overlay.rb +167 -0
  110. data/lib/pause_means_space.rb +68 -0
  111. data/lib/php.rb +22 -0
  112. data/lib/projects.rb +21 -0
  113. data/lib/relinquish_exception.rb +2 -0
  114. data/lib/remote.rb +206 -0
  115. data/lib/requirer.rb +46 -0
  116. data/lib/rest_tree.rb +108 -0
  117. data/lib/ruby.rb +57 -0
  118. data/lib/ruby_console.rb +165 -0
  119. data/lib/search.rb +1572 -0
  120. data/lib/search_term.rb +40 -0
  121. data/lib/snippet.rb +68 -0
  122. data/lib/specs.rb +229 -0
  123. data/lib/styles.rb +274 -0
  124. data/lib/svn.rb +682 -0
  125. data/lib/text_util.rb +110 -0
  126. data/lib/tree.rb +1871 -0
  127. data/lib/tree_cursor.rb +87 -0
  128. data/lib/trouble_shooting.rb +27 -0
  129. data/lib/url_tree.rb +11 -0
  130. data/lib/view.rb +1474 -0
  131. data/lib/window.rb +133 -0
  132. data/lib/xiki.rb +404 -0
  133. data/menus/accounts.rb +5 -0
  134. data/menus/address_book.rb +21 -0
  135. data/menus/agenda.rb +28 -0
  136. data/menus/all.rb +5 -0
  137. data/menus/amazon.rb +16 -0
  138. data/menus/app.rb +16 -0
  139. data/menus/applescript.rb +46 -0
  140. data/menus/as.rb +15 -0
  141. data/menus/bookmarklet.rb +63 -0
  142. data/menus/bootstrap.rb +568 -0
  143. data/menus/browse.rb +13 -0
  144. data/menus/browser.rb +78 -0
  145. data/menus/cassandra_db.rb +36 -0
  146. data/menus/chmod.rb +27 -0
  147. data/menus/classes.rb +5 -0
  148. data/menus/coffee_script.rb +35 -0
  149. data/menus/computer.rb +24 -0
  150. data/menus/contacts.rb +5 -0
  151. data/menus/cookies.rb +25 -0
  152. data/menus/couch.rb +184 -0
  153. data/menus/crop.rb +45 -0
  154. data/menus/css.rb +55 -0
  155. data/menus/current.rb +5 -0
  156. data/menus/db.rb +12 -0
  157. data/menus/deck.rb +219 -0
  158. data/menus/dictionary.rb +9 -0
  159. data/menus/dir.rb +8 -0
  160. data/menus/disk.rb +5 -0
  161. data/menus/do.rb +13 -0
  162. data/menus/docs.rb +58 -0
  163. data/menus/dotsies.rb +107 -0
  164. data/menus/edited.rb +18 -0
  165. data/menus/emacs.rb +17 -0
  166. data/menus/enter.rb +13 -0
  167. data/menus/eval.rb +17 -0
  168. data/menus/executable.rb +16 -0
  169. data/menus/filter.rb +46 -0
  170. data/menus/firefox.rb +607 -0
  171. data/menus/foo.rb +30 -0
  172. data/menus/french.rb +7 -0
  173. data/menus/git.rb +185 -0
  174. data/menus/gito.rb +785 -0
  175. data/menus/google.rb +35 -0
  176. data/menus/google_images.rb +11 -0
  177. data/menus/google_patents.rb +10 -0
  178. data/menus/gutenberg.rb +13 -0
  179. data/menus/head.rb +10 -0
  180. data/menus/headings.rb +39 -0
  181. data/menus/html.rb +61 -0
  182. data/menus/icon.rb +40 -0
  183. data/menus/images.menu +2 -0
  184. data/menus/img.rb +15 -0
  185. data/menus/info.rb +9 -0
  186. data/menus/ip.rb +10 -0
  187. data/menus/iterm.rb +36 -0
  188. data/menus/itunes.rb +78 -0
  189. data/menus/javascript.rb +74 -0
  190. data/menus/layout.rb +18 -0
  191. data/menus/local_storage.rb +67 -0
  192. data/menus/ls.rb +19 -0
  193. data/menus/mac.rb +87 -0
  194. data/menus/maps.rb +18 -0
  195. data/menus/matches.rb +18 -0
  196. data/menus/memcache.rb +117 -0
  197. data/menus/mkdir.rb +23 -0
  198. data/menus/mongo.rb +83 -0
  199. data/menus/mysql.rb +294 -0
  200. data/menus/node.rb +88 -0
  201. data/menus/open.rb +19 -0
  202. data/menus/outline.rb +24 -0
  203. data/menus/piano.rb +746 -0
  204. data/menus/postgres.rb +34 -0
  205. data/menus/pre.rb +5 -0
  206. data/menus/python.rb +39 -0
  207. data/menus/rails.rb +160 -0
  208. data/menus/rake.rb +12 -0
  209. data/menus/redmine.rb +168 -0
  210. data/menus/riak_tree.rb +204 -0
  211. data/menus/rss.rb +15 -0
  212. data/menus/safari.rb +11 -0
  213. data/menus/sass.rb +15 -0
  214. data/menus/say.rb +6 -0
  215. data/menus/scale.rb +49 -0
  216. data/menus/serve.rb +78 -0
  217. data/menus/shuffle.rb +24 -0
  218. data/menus/spanish.rb +7 -0
  219. data/menus/standalone.rb +57 -0
  220. data/menus/tail.rb +41 -0
  221. data/menus/technologies.rb +19 -0
  222. data/menus/themes.rb +32 -0
  223. data/menus/thesaurus.rb +13 -0
  224. data/menus/to.rb +24 -0
  225. data/menus/twitter.rb +57 -0
  226. data/menus/wikipedia.rb +34 -0
  227. data/menus/words.rb +11 -0
  228. data/spec/code_tree_spec.rb +59 -0
  229. data/spec/diff_log_spec.rb +40 -0
  230. data/spec/file_tree_spec.rb +102 -0
  231. data/spec/keys_spec.rb +24 -0
  232. data/spec/line_spec.rb +68 -0
  233. data/spec/menu_spec.rb +50 -0
  234. data/spec/ol_spec.rb +98 -0
  235. data/spec/remote_spec.rb +43 -0
  236. data/spec/search_spec.rb +162 -0
  237. data/spec/text_util_spec.rb +119 -0
  238. data/spec/tree_cursor_spec.rb +91 -0
  239. data/spec/tree_spec.rb +955 -0
  240. data/tests/console_test.rb +11 -0
  241. data/tests/couch_db_test.rb +12 -0
  242. data/tests/diff_log_test.rb +43 -0
  243. data/tests/el_mixin.rb +16 -0
  244. data/tests/git_test.rb +95 -0
  245. data/tests/keys_test.rb +19 -0
  246. data/tests/line_test.rb +38 -0
  247. data/tests/merb_test.rb +11 -0
  248. data/tests/redmine_test.rb +50 -0
  249. data/tests/remote_test.rb +31 -0
  250. data/tests/rest_tree_test.rb +70 -0
  251. data/xiki.gemspec +37 -0
  252. metadata +332 -0
@@ -0,0 +1,15 @@
1
+ # Gets mp3 url's from an rss feed
2
+ class Rss
3
+ def self.menu rss=nil
4
+ # If no rss passed, tell them to provide one
5
+ if rss.nil?
6
+ return "- rss url - <put url here>"
7
+ end
8
+
9
+ # rss passed, so get result and pull out url's
10
+ xml = Net::HTTP.get URI.parse(rss.sub(/.+?http/,'http'))
11
+ urls = []
12
+ xml.scan(/http:\/\/[\w.\/-]+\.mp3/) {|m| urls << m}
13
+ urls.uniq.join("\n")
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ class Safari
2
+ def self.reload
3
+
4
+ $el.do_applescript %`
5
+ tell application "Safari"
6
+ do JavaScript "window.location.reload();" in the first document
7
+ end tell
8
+ `
9
+
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ class Sass
2
+ def self.menu *args
3
+ txt = ENV['txt']
4
+ File.open("/tmp/tmp.sass", "w") { |f| f << txt }
5
+ css = `sass /tmp/tmp.sass`
6
+
7
+ css.gsub!("\n", '\n')
8
+ css.gsub!('"', '\"')
9
+ code = "$('head').append(\"<style>#{css}</style>\")"
10
+
11
+ Firefox.run code
12
+
13
+ ".flash - Loaded in browser!"
14
+ end
15
+ end
@@ -0,0 +1,6 @@
1
+ class Say
2
+ def self.menu *args
3
+ txt = args.join('/').gsub('"', '\"')
4
+ $el.do_applescript "say \"#{txt}\""
5
+ end
6
+ end
@@ -0,0 +1,49 @@
1
+ class Scale
2
+
3
+ def self.menu percent=nil, save=nil
4
+
5
+ dir = Tree.dir :file=>"foo.png"
6
+
7
+ tmp_dir = "/tmp/scale"
8
+ Dir.mkdir tmp_dir if ! File.exists? tmp_dir
9
+
10
+ # If nothing, show percent options
11
+
12
+ return "
13
+ - 25%/
14
+ - 50%/
15
+ - 75%/
16
+ - 150%/
17
+ - 64x64/
18
+ - 128x128/
19
+ " if ! percent
20
+
21
+ dir, file = File.dirname(dir), File.basename(dir)
22
+ dest = file.sub '.', "_#{percent.sub('%', '')}."
23
+
24
+ # If just percent, so resize into tmp dir and show
25
+
26
+ if save.nil?
27
+ dest = "#{tmp_dir}/#{dest}"
28
+ Console.sync %`convert "#{file}" -resize #{percent} "#{dest}"`, :dir=>dir
29
+ Image.>> dest, "_"
30
+ # Line.previous
31
+ return
32
+ end
33
+
34
+ # Image clicked on, so resize to destination
35
+
36
+ Console.sync %`convert "#{file}" -resize #{percent} "#{dest}"`, :dir=>dir
37
+ Line.previous
38
+ Tree.to_parent
39
+ Tree.kill_under
40
+ indent = Line.indent Line.value(0)
41
+ Line.next
42
+ View.<< "#{indent}- #{dest}\n", :dont_move=>1
43
+
44
+ Effects.glow :fade_in=>1
45
+
46
+ nil
47
+
48
+ end
49
+ end
@@ -0,0 +1,78 @@
1
+ class Serve
2
+ def self.menu *args
3
+
4
+ children = Tree.children(:string=>1)
5
+ children = children.unindent if children
6
+
7
+ trunk = Xiki.trunk
8
+
9
+ # If no children and no parents, say how to use it.
10
+ if children.blank? && trunk.length == 1
11
+ return "
12
+ > How to use
13
+ | To serve a menu in the browser, put a menu under or above, like one of these:
14
+ |
15
+ | serve/
16
+ | - dogs/
17
+ | - cats/
18
+ |
19
+ | animals/
20
+ | @serve
21
+ "
22
+ end
23
+
24
+
25
+ if children.blank?
26
+ file = File.expand_path "~/menus/#{trunk[0]}.menu"
27
+ else
28
+ file = "/tmp/tmp.menu"
29
+ File.open(file, "w") { |f| f << children }
30
+ end
31
+
32
+ code = self.wrap_controller file
33
+ Node.run_controller code
34
+
35
+ ".flash - showing in browser!"
36
+ end
37
+
38
+ def self.wrap_controller file
39
+ %`
40
+ var http = require('http');
41
+ var Xiki = require('#{Xiki.dir}etc/js/xiki.js');
42
+ var fs = require('fs');
43
+ http.createServer(function(req, res) {
44
+
45
+ url = decodeURI(req.url);
46
+ console.log('processing request: ' + url);
47
+
48
+
49
+ // If requesting js, just return it
50
+ if(url.match(/^\\/js\\//)){
51
+ res.writeHead(200, {'Content-Type': 'application/x-javascript'});
52
+ var js = fs.readFileSync('#{Xiki.dir}etc/js/'+url.replace(/.+\\//, ''), 'utf8');
53
+ res.end(js);
54
+ return;
55
+ }
56
+
57
+ tree = fs.readFileSync(#{file.inspect}, 'utf8');
58
+
59
+ if(req.headers['user-agent'] && ! req.headers['x-requested-with']){
60
+
61
+ res.writeHead(200, {'Content-Type': 'text/html'});
62
+ res.end(Xiki.render_mobile_ajax());
63
+
64
+ }else{
65
+ res.writeHead(200, {'Content-Type': 'text/plain'});
66
+ console.log("tree:", tree);
67
+ items = Xiki.children(tree, url);
68
+ console.log("items:", items);
69
+ res.end(items);
70
+ }
71
+
72
+
73
+ }).listen(8161, '127.0.0.1');
74
+ console.log('Server running at http://127.0.0.1:8161/');
75
+ `.unindent
76
+ end
77
+
78
+ end
@@ -0,0 +1,24 @@
1
+ class Shuffle
2
+ def self.menu *args
3
+
4
+ message = "| This menu shuffles the siblings that follow it."
5
+ return message if args.any?
6
+
7
+ orig = Location.new
8
+
9
+ ignore, ignore2, left, right = Tree.sibling_bounds
10
+
11
+ return message if left == right
12
+
13
+ txt = View.txt left, right
14
+ View.delete left, right
15
+
16
+ Line.next
17
+
18
+ Code.randomize_lines txt
19
+
20
+ orig.go
21
+
22
+ nil
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ class Spanish
2
+ def self.menu txt=nil
3
+ return "| Type something here to translate from spanish" if txt.nil?
4
+
5
+ Browser.url "http://translate.google.com/#es|en|#{URI.encode ENV['txt'].gsub(' ', '+')}"
6
+ end
7
+ end
@@ -0,0 +1,57 @@
1
+ class Standalone
2
+ def self.menu *args
3
+ children = Tree.children(:string=>1)
4
+ children = children.unindent if children
5
+
6
+ trunk = Xiki.trunk
7
+
8
+ # If no children and no parents, say how to use it.
9
+ if children.blank? && trunk.length == 1
10
+ return "
11
+ > How to use
12
+ | To make a stand-alone jquery mobile page and show in the browser,
13
+ | put a menu under or above, like one of these:
14
+ |
15
+ | standalone/
16
+ | - dogs/
17
+ | - cats/
18
+ |
19
+ | animals/
20
+ | @standalone
21
+ "
22
+ end
23
+
24
+ menu = "untitled"
25
+
26
+ if children.blank?
27
+ file = File.expand_path "~/menus/#{trunk[0]}.menu"
28
+ menu = trunk[0]
29
+ children = File.read file
30
+ end
31
+
32
+ # Write file to tmp
33
+ File.open("/tmp/#{menu}.html", "w") { |f| f << self.wrap_standalone(children) }
34
+
35
+ Firefox.url "file:///tmp/untitled.html"
36
+
37
+ ".flash - showing in browser!"
38
+ end
39
+
40
+ def self.wrap_standalone children
41
+ %`
42
+ <head>
43
+ <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
44
+ <script src="file://#{Xiki.dir}etc/js/xiki.js"></script>
45
+ <script src="file://#{Xiki.dir}etc/js/menu1.js"></script>
46
+ <script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
47
+ <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
48
+ </head>
49
+ <body>
50
+ <div data-xiki="menu">\n#{children}
51
+ </div>
52
+ </body>
53
+ `.unindent
54
+
55
+ end
56
+
57
+ end
@@ -0,0 +1,41 @@
1
+ class Tail
2
+ # def self.menu *args
3
+
4
+ def self.ongoing
5
+ dir = Tree.dir :file=>1
6
+ Console.run "tail -f \"#{dir}\""
7
+ end
8
+
9
+ def self.in
10
+ dir = Tree.dir :file=>1
11
+ Tree.quote `tail "#{dir}"`
12
+ end
13
+
14
+ def self.menu_before *args
15
+ # Don't do anything unless it's just numeric args
16
+ return nil if args.length != 1 || args[0] !~ /^\d+$/
17
+
18
+ dir = Tree.dir :file=>1
19
+
20
+ count = args[0].to_i
21
+ Tree.quote `tail -n #{count} "#{dir}"`
22
+ end
23
+
24
+ def self.menu
25
+ "
26
+ - .in/
27
+ - 3/
28
+ - .ongoing/
29
+ - .docs/
30
+ > Shows the first 10 lines inline
31
+ << in/
32
+
33
+ > Show N lines inline
34
+ << 3/
35
+
36
+ > Opens a shell and keeps showing updates
37
+ << ongoing/
38
+ "
39
+ end
40
+
41
+ end
@@ -0,0 +1,19 @@
1
+ class Technologies
2
+ def self.menu topic=nil, heading=nil, *content
3
+
4
+ content = content.any? ? content.join("/") : nil
5
+
6
+ # If no topic, just show all dirs
7
+
8
+ if topic.nil?
9
+ entries = Dir.new(Bookmarks["$te"]).entries
10
+ entries = entries.select{|o| o =~ /^\w/}
11
+ return entries.map{|o| "#{o}/"}
12
+ end
13
+
14
+ # If just topic, list all headings
15
+
16
+ Notes.drill "$te/#{topic}/#{topic}.notes", heading, content
17
+
18
+ end
19
+ end
@@ -0,0 +1,32 @@
1
+ class Themes
2
+ def self.menu *args
3
+
4
+ # If nothing passed, show options
5
+
6
+ if args.empty?
7
+ path = "#{Xiki.dir}etc/themes/"
8
+
9
+ themes = Dir.new(path).entries.select{|o| o =~ /^\w/}
10
+
11
+ return "
12
+ | Click one of these to change how the window dividers
13
+ | look (aka the emacs mode line).
14
+ #{themes.map{|o| "- #{o[/\w+/].gsub('_', ' ')}/\n"}.join()}
15
+ "
16
+ end
17
+
18
+ # Theme name passed, so use it
19
+
20
+ self.use args[0]
21
+ end
22
+
23
+ def self.use name
24
+ path = "#{Xiki.dir}etc/themes/#{TextUtil.title_case name, :underscores=>1}.notes"
25
+ return "| Theme doesn't exist" if ! File.exists? path
26
+
27
+ load path
28
+
29
+ nil
30
+ end
31
+
32
+ end
@@ -0,0 +1,13 @@
1
+ # - @http://thesaurus.com/browse/<here>
2
+
3
+ class Thesaurus
4
+ # self.add :paren=>"th" do # - (th): thesaurus.com
5
+ def self.menu word=nil
6
+ return View.prompt('Type a word to look up') if word.nil?
7
+
8
+ word = word.sub(/^\s+/, '').gsub('"', '%22').gsub(':', '%3A').gsub(' ', '%20')
9
+ # Browser.url "http://en.wiktionary.org/wiki/Wikisaurus:#{word}"
10
+ $el.browse_url "http://thesaurus.reference.com/browse/#{word}"
11
+ nil
12
+ end
13
+ end
@@ -0,0 +1,24 @@
1
+ class To
2
+ def self.menu
3
+ %`
4
+ > Summary
5
+ | Keys shortcuts that start with "to+" (ctrl-t) such as to+end.
6
+ |
7
+ - frequent/
8
+ > Jumping cursor around
9
+ | to+row - jump to line
10
+ | to+axis - beginning of line
11
+ | to+end - end of line
12
+ |
13
+ | to+previous - beginning of previous paragraph
14
+ | to+next - beginning of next paragraph
15
+ |
16
+ | to+highest - beginning of file
17
+ | to+lowest - end of file
18
+ |
19
+ - others/
20
+ | to+backward - backward one word
21
+ | to+foreward - foreward one word
22
+ `
23
+ end
24
+ end
@@ -0,0 +1,57 @@
1
+ require 'net/http'
2
+ require 'timeout'
3
+
4
+ class Twitter
5
+
6
+ CODE_SAMPLES = %q<
7
+ # C-. on this
8
+ - Twitter.menu
9
+ >
10
+
11
+ def self.post_or_list
12
+ if Keys.prefix_u? # If U prefix, just list
13
+ $el.shell_command("twitter timeline")
14
+ else # Otherwise, post
15
+ self.post
16
+ end
17
+ end
18
+
19
+ def self.list options={}
20
+ View.handle_bar
21
+ Console.run "twitter timeline", :buffer => "*twitter timeline"
22
+ Styles.define :twitter_name, :fg => '99f'
23
+ Styles.define :twitter_date, :fg => 'ddd'
24
+ Styles.apply '^\\(-- .+\\)\\( at .+\\)', nil, :twitter_name, :twitter_date
25
+ View.to_top
26
+ $el.kill_line
27
+ View.previous
28
+ end
29
+
30
+ def self.tree options={}
31
+ txt = nil
32
+ begin
33
+ timeout(3) do
34
+ txt = Net::HTTP.get URI.parse("http://twitter.com/statuses/friends_timeline/13453802.atom")
35
+ end
36
+ rescue Exception => e
37
+ return puts("- Timed out!")
38
+ end
39
+
40
+ txt.scan( /<title>(.+)<\/title>/ ).each do |t|
41
+ puts "- #{t}"
42
+ end
43
+ View.wrap :off
44
+ ""
45
+ end
46
+
47
+ def self.post message
48
+ puts $el.shell_command_to_string("twitter post \"#{message}\"")
49
+ end
50
+
51
+ def self.menu options={}
52
+ puts "+ in tree: .tree/"
53
+ puts "- async: .list"
54
+ puts "- post: .post 'foo'"
55
+ end
56
+
57
+ end