├── .gitignore ├── Dockerfile ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── bin ├── .xsh ├── xiki ├── xikigem └── xsh ├── install_xsh ├── lib ├── xiki.rb └── xiki │ ├── core │ ├── block.rb │ ├── bookmarks.rb │ ├── buffers.rb │ ├── clipboard.rb │ ├── code.rb │ ├── code_tree.rb │ ├── color.rb │ ├── command.rb │ ├── command_suggester.rb │ ├── control_lock.rb │ ├── control_tab.rb │ ├── core_ext.rb │ ├── cursor.rb │ ├── deletes.rb │ ├── diff_log.rb │ ├── dirs.rb │ ├── effects.rb │ ├── environment.rb │ ├── expander.rb │ ├── file_tree.rb │ ├── files.rb │ ├── git.rb │ ├── grab.rb │ ├── hide.rb │ ├── hint.rb │ ├── history.rb │ ├── html.rb │ ├── image.rb │ ├── incrementer.rb │ ├── index.menu │ ├── insert.rb │ ├── invoker.rb │ ├── irc.rb │ ├── json.rb │ ├── key_shortcuts.rb │ ├── keys.rb │ ├── launcher.rb │ ├── line.rb │ ├── links.rb │ ├── location.rb │ ├── macros.rb │ ├── menu.rb │ ├── merb.rb │ ├── message.rb │ ├── meths.rb │ ├── mode.rb │ ├── move.rb │ ├── notes.rb │ ├── numbers.rb │ ├── ol.rb │ ├── ol_helper.rb │ ├── option_items.rb │ ├── options.rb │ ├── overlay.rb │ ├── path.rb │ ├── pattern.rb │ ├── pause_means_space.rb │ ├── php.rb │ ├── pre_pattern.rb │ ├── projects.rb │ ├── relinquish_exception.rb │ ├── remote.rb │ ├── requirer.rb │ ├── rest_tree.rb │ ├── ruby.rb │ ├── ruby_console.rb │ ├── search.rb │ ├── search_term.rb │ ├── setup_xsh.rb │ ├── shell.rb │ ├── snippet.rb │ ├── specs.rb │ ├── styles.rb │ ├── tasks.rb │ ├── text_util.rb │ ├── topic.rb │ ├── topic_expander.rb │ ├── tree.rb │ ├── tree_cursor.rb │ ├── url_tree.rb │ ├── view.rb │ ├── wikipedia.rb │ ├── window.rb │ ├── x.rb │ ├── xi.rb │ ├── xik.rb │ ├── xikihub_client.rb │ └── xsh.rb │ ├── handlers │ ├── bootstrap_handler.rb │ ├── coffee_handler.rb │ ├── conf_handler.rb │ ├── conf_loading_handler.rb │ ├── deck_handler.rb │ ├── dir_handler.rb │ ├── erb_handler.rb │ ├── html_handler.rb │ ├── index.menu │ ├── javascript_handler.rb │ ├── jpg_handler.rb │ ├── markdown_handler.rb │ ├── menu_handler.rb │ ├── notes_handler.rb │ ├── pgn_handler.rb │ ├── python_handler.rb │ ├── ruby_handler.rb │ ├── sh_handler.rb │ ├── steps_handler.rb │ ├── txt_handler.rb │ └── xiki_handler.rb │ ├── tools │ ├── accounts.rb │ ├── agenda.rb │ ├── applescript.rb │ ├── as.rb │ ├── bookmarklet.rb │ ├── browser.rb │ ├── canvas.menu │ ├── cassandra_db.rb │ ├── chgrp.menu │ ├── classes.rb │ ├── coffee_script.rb │ ├── conf.rb │ ├── contacts.rb │ ├── cookies.rb │ ├── count.menu │ ├── create.rb │ ├── crop.rb │ ├── current.rb │ ├── deck.rb │ ├── def.rb │ ├── diffs.menu │ ├── do.rb │ ├── docs.menu │ ├── edited.rb │ ├── emacs.rb │ ├── enter.rb │ ├── eval.rb │ ├── executable.rb │ ├── filter.rb │ ├── firefox.rb │ ├── frameworks.menu │ ├── french.rb │ ├── google.rb │ ├── google_patents.rb │ ├── grep.menu │ ├── gutenberg.rb │ ├── head.rb │ ├── headings.rb │ ├── hosts.menu │ ├── html5.menu │ ├── httpd.menu │ ├── icon.rb │ ├── images.menu │ ├── index.menu │ ├── info.rb │ ├── iterm.rb │ ├── javascript.rb │ ├── layout.rb │ ├── lighttp.menu │ ├── linebreaks.menu │ ├── list.menu │ ├── local_storage.rb │ ├── mac.rb │ ├── matches.rb │ ├── memcache.rb │ ├── music.menu │ ├── mysql.rb │ ├── node.rb │ ├── opacity.menu │ ├── open.rb │ ├── outline.rb │ ├── permissions.menu │ ├── postgres.rb │ ├── pre.rb │ ├── ps.menu │ ├── python.rb │ ├── qri.rb │ ├── rake.rb │ ├── random.menu │ ├── random_menu.rb │ ├── readme.rb │ ├── redis.menu │ ├── redmine.rb │ ├── riak_tree.rb │ ├── rss.rb │ ├── rsync.menu │ ├── safari.rb │ ├── sammiches.rb │ ├── sass.rb │ ├── say.rb │ ├── selenium_wrapper.rb │ ├── serve.rb │ ├── settings.menu │ ├── shell_commands.menu │ ├── size.menu │ ├── source.menu │ ├── spanish.rb │ ├── standalone.rb │ ├── steps.rb │ ├── synonyms.menu │ ├── technologies.rb │ ├── textile.rb │ ├── themes.rb │ ├── to.rb │ ├── twitter.rb │ ├── urls.menu │ ├── wiki.menu │ ├── wiki_syntax.menu │ └── words.rb │ └── vim │ ├── index.menu │ ├── line.rb │ └── tree.rb ├── misc ├── command │ ├── copy_xiki_command_to.rb │ ├── external_shell_examples.txt │ ├── external_shell_help.txt │ ├── external_shell_tutorial.txt │ ├── shell_please_move.txt │ ├── xiki_command.rb │ ├── xiki_process.rb │ └── xiki_wrapper ├── core_patterns.rb ├── default_home_xiki │ ├── bar.xiki │ ├── disk.xiki │ ├── examples.xiki │ ├── git.xiki │ ├── links.xiki │ ├── memorize.xiki │ ├── notes.xiki │ ├── search_for_notes.xiki │ ├── tutorial.xiki │ └── xsh.xiki ├── emacs │ ├── el4r │ │ ├── .el4rrc.rb │ │ ├── el4r-instance │ │ ├── el4r-sub.rb │ │ ├── el4r.el │ │ ├── init.rb │ │ └── stdlib.rb │ ├── libs │ │ ├── control-lock.el │ │ └── normal-escape.el │ ├── start_xiki.el │ ├── start_xiki_daemon.el │ ├── start_xiki_no_socket.el │ └── xsh.emacs ├── install │ ├── .xsh.default │ ├── el4r_setup.sh │ ├── install_source_dependency.sh │ ├── install_when_flag.rb │ └── save_config.rb ├── js │ ├── menu1.js │ └── xiki.js ├── libs │ └── session.rb ├── logo.png ├── old │ └── presentations │ │ ├── bootstrap.deck │ │ ├── databases.deck │ │ ├── diffs.deck │ │ ├── documentation.deck │ │ ├── effects.deck │ │ ├── face.deck │ │ ├── files.deck │ │ ├── icons.deck │ │ ├── images.deck │ │ ├── key_shortcuts.deck │ │ ├── macros.deck │ │ ├── menu_classes.deck │ │ ├── menu_directories.deck │ │ ├── notes.deck │ │ ├── other_languages.deck │ │ ├── other_wiki_syntaxes.deck │ │ ├── piano.deck │ │ ├── potential │ │ ├── diffs.deck │ │ ├── evolution.deck │ │ ├── intro.deck │ │ ├── intro1.deck │ │ ├── intro2.deck │ │ ├── make_mysql_menu.deck │ │ ├── ruby_development.deck │ │ ├── ui_prototyping.deck │ │ ├── web_dev.deck │ │ ├── web_development.deck │ │ └── wiki.deck │ │ ├── presentations.deck │ │ ├── rails_development.deck │ │ ├── search_key_shortcuts.deck │ │ ├── simplest_possible_ui.deck │ │ ├── svg.deck │ │ ├── testing.deck │ │ ├── the_end.deck │ │ ├── type_something_and_double_click.deck │ │ ├── type_the_acronym.deck │ │ ├── web_browser.deck │ │ ├── xiki_command.deck │ │ └── xiki_url.deck ├── shell_wrappers │ ├── docker.rb │ ├── foo.rb │ ├── git.rb │ └── rails.rb ├── snippets │ ├── html.xiki │ ├── notes.xiki │ └── rb.xiki ├── themes │ ├── Bottom_Bar_Items.xiki │ ├── Bottom_Bar_Styles.xiki │ ├── Default.xiki │ └── Rainbow_Fonts.xiki ├── vim │ ├── vim_status.notes │ └── xiki.vim ├── www │ ├── index.rb │ ├── public │ │ └── error.html │ ├── sinatra_control.rb │ └── xiki_web_server.rb └── xiki.org │ ├── demo.notes │ ├── demo2.notes │ ├── demo3.notes │ ├── demoN.notes │ └── xiki.org_bootstrap_source.notes ├── roots ├── active_links.rb ├── address_book.rb ├── all.rb ├── amazon.rb ├── animals.menu ├── animate.rb ├── apache.rb ├── apigee.menu ├── append.rb ├── applescript.rb ├── applications.rb ├── args.rb ├── bash.rb ├── beg.menu ├── black.menu ├── black.rb ├── blink.rb ├── bookmarks.rb ├── bootstrap.rb ├── brew.menu ├── browser │ ├── default.conf │ └── menu.menu ├── bullets.menu ├── calendar.rb ├── chmod.rb ├── chown.rb ├── chrome.rb ├── cla.rb ├── clojure │ ├── clojure_index.rb │ └── default.conf ├── close.rb ├── close_view.rb ├── code.rb ├── coffee.rb ├── computer.menu ├── conf │ └── conf_index.rb ├── copy.rb ├── couch.rb ├── cpu.menu ├── create_menus_manually.menu ├── cs.rb ├── css.rb ├── curl.menu ├── current.rb ├── d3.rb ├── databases.menu ├── date.rb ├── db.rb ├── dbs.rb ├── deck.menu ├── def.rb ├── defs.rb ├── deploy_el4r_gem.menu ├── deploy_xiki_gem.menu ├── des.rb ├── desktop_image.rb ├── dictionary.rb ├── dimensions │ ├── default.conf │ ├── dimensions_index.menu │ └── dimensions_index.rb ├── dir.rb ├── directions.menu ├── directory.rb ├── docs.menu ├── dom.rb ├── dotsies.rb ├── echo.rb ├── edited.rb ├── edits.rb ├── effects.rb ├── elisp.rb ├── emacs │ ├── index.menu │ └── index.rb ├── emacs_config_tweaks │ ├── index.menu │ └── index.rb ├── emacs_setup │ └── initrb_default.txt ├── encoding.rb ├── example.rb ├── expanders.rb ├── f.xiki ├── face │ ├── face_index.menu │ └── face_index.rb ├── facts.rb ├── faq.menu ├── files.rb ├── filter.rb ├── font.menu ├── fontawesome.menu ├── foo.menu ├── gem.rb ├── gems.menu ├── git.rb ├── git_docs │ ├── index.menu │ └── index.rb ├── google.rb ├── google_images.rb ├── haml.rb ├── handlers.rb ├── help.rb ├── help_topics.menu ├── highlight.rb ├── history.rb ├── homebrew.menu ├── http.rb ├── i.xiki ├── ids.rb ├── img.rb ├── includes.rb ├── interactions.rb ├── ip.rb ├── itunes.rb ├── javascript.rb ├── jekyll.menu ├── js.rb ├── jso.rb ├── jump_to_dir.rb ├── keys.rb ├── kill.rb ├── l.menu ├── last.rb ├── length.rb ├── links.rb ├── ln.menu ├── log.rb ├── lorem_ipsum.menu ├── ls.rb ├── mail │ ├── default.conf │ ├── mail_index.rb │ └── oauth2.py ├── man.rb ├── map.rb ├── markdown.rb ├── markers.rb ├── memorize.rb ├── mkdir.rb ├── models.rb ├── mongo.rb ├── mysql │ ├── default.conf │ └── mysql_index.rb ├── nav_history.rb ├── network.menu ├── node.rb ├── node_js.menu ├── note_markers.rb ├── notes.rb ├── ok.rb ├── options.rb ├── os.rb ├── os_path.rb ├── overflow.rb ├── parse.rb ├── path.menu ├── piano.rb ├── ports.menu ├── preferences.menu ├── processes.menu ├── questions.rb ├── quick_topics.rb ├── quit.menu ├── r.rb ├── rails.rb ├── rbenv.rb ├── recent.rb ├── reload.rb ├── rename.rb ├── replace.menu ├── rethinkdb │ ├── default.conf │ └── rethinkdb_index.rb ├── revert.rb ├── ri.rb ├── ruby.rb ├── ruby_load_path.rb ├── rvm.menu ├── sample_menus │ ├── sample_menus_index.menu │ └── sample_menus_index.rb ├── save.rb ├── save_as.rb ├── save_command.rb ├── save_without_diff.rb ├── scale.rb ├── scroll_bars.menu ├── search.rb ├── searches.rb ├── searching.rb ├── shell.menu ├── shoes │ ├── shoes_index.menu │ └── shoes_index.rb ├── shuffle.rb ├── sinatra.rb ├── snippet.rb ├── source.rb ├── specials.rb ├── stop.rb ├── styles.rb ├── substitute.rb ├── svg.rb ├── svg_edit.menu ├── svg_icons.menu ├── tab_width.rb ├── tabs.rb ├── tail.rb ├── tests.menu ├── themes.rb ├── threejs.rb ├── tile_settings.rb ├── time.rb ├── timer.rb ├── tweet.rb ├── tweets.rb ├── unsaved.rb ├── version.menu ├── views.rb ├── web │ ├── docs.menu │ ├── index.menu │ └── index.rb ├── web_development.menu ├── web_sample_menus.erb ├── web_thesaurus.rb ├── white.menu ├── wikipedia.menu ├── wp.rb ├── xiki.rb ├── xiki_path.rb ├── xiki_tests.rb ├── xikistrap.rb ├── xsh.menu ├── xsh │ └── default.conf ├── youtube.rb └── zsh.rb ├── spec ├── code_tree_spec.rb ├── command_spec.rb ├── conf_handler_spec.rb ├── conf_loading_handler_spec.rb ├── diff_log_spec.rb ├── expander_spec.rb ├── file_tree_spec.rb ├── fixtures │ └── menu │ │ ├── aftershave.rb │ │ ├── beef.rb │ │ ├── beeff.menu │ │ ├── beeff.rb │ │ ├── beefm.rb │ │ ├── clam.rb │ │ ├── clam_soup.rb │ │ ├── constable.rb │ │ ├── ddm │ │ └── index.menu │ │ ├── ddt │ │ ├── a.txt │ │ └── b.txt │ │ ├── di │ │ ├── index.menu │ │ └── index.txt │ │ ├── didi │ │ ├── a │ │ │ └── index.rb │ │ └── index.rb │ │ ├── dm │ │ └── a.menu │ │ ├── dmr │ │ ├── a │ │ │ ├── aa.menu │ │ │ └── ab.rb │ │ ├── b.menu │ │ └── c.rb │ │ ├── dni │ │ └── index.notes │ │ ├── dotty.rb │ │ ├── dr │ │ ├── a.rb │ │ └── b.rb │ │ ├── drdr.rb │ │ ├── drdr │ │ ├── a.rb │ │ └── a │ │ │ └── b.rb │ │ ├── drdrred_herring │ │ ├── dt │ │ ├── a.txt │ │ └── b.txt │ │ ├── embassy.menu │ │ ├── film.menu │ │ ├── film.rb │ │ ├── hidein.rb │ │ ├── hideout.rb │ │ ├── index.menu │ │ ├── mentor.rb │ │ ├── menuless.rb │ │ ├── menuless_object.rb │ │ ├── menulessob.rb │ │ ├── mr.menu │ │ ├── mr.rb │ │ ├── mrd.menu │ │ ├── mrd.rb │ │ ├── poro.rb │ │ ├── rs.rb │ │ └── ti │ │ └── index.txt ├── git_spec.rb ├── html_spec.rb ├── invoker_spec.rb ├── keys_spec.rb ├── line_spec.rb ├── memorize_spec.rb ├── notes_spec.rb ├── ol_spec.rb ├── path_spec.rb ├── remote_spec.rb ├── rest_tree_spec.rb ├── search_spec.rb ├── spec_helper.rb ├── text_util_spec.rb ├── tree_cursor_spec.rb ├── tree_spec.rb ├── xi_spec.rb └── xik_spec.rb ├── tests ├── console_test.rb ├── diff_log_test.rb ├── el_mixin.rb ├── keys_test.rb ├── line_test.rb ├── merb_test.rb ├── redmine_test.rb ├── remote_test.rb └── rest_tree_test.rb └── xiki.gemspec /.gitignore: -------------------------------------------------------------------------------- 1 | Gemfile.lock 2 | *.gem 3 | *.rbc 4 | .bundle 5 | .config 6 | coverage 7 | InstalledFiles 8 | lib/bundler/man 9 | pkg 10 | rdoc 11 | spec/reports 12 | test/tmp 13 | test/version_tmp 14 | tmp 15 | 16 | # YARD artifacts 17 | .yardoc 18 | _yardoc 19 | doc/ 20 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential 5 | RUN apt-get install -y emacs 6 | 7 | # Ruby 8 | RUN apt-get install -y ruby 9 | 10 | # Git 11 | RUN apt-get install -y git 12 | 13 | RUN apt-get install -y curl 14 | 15 | COPY . /xiki/ 16 | RUN /xiki/bin/xsh --install 17 | 18 | WORKDIR /root 19 | 20 | CMD ["bash", "/xiki/bin/xsh"] 21 | 22 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | 2 | # Xiki is temporarily not set up to be used as a gem. Just download it 3 | # and run bin/xsh directly. 4 | # 5 | # Eventually xiki will be installable as a gem, so you can use xiki classes 6 | # from ruby code, including using xiki as a rails plugin. 7 | # 8 | # It's unclear as of yet whether the gem install should put the xsh command 9 | # into the path. 10 | 11 | 12 | # source 'https://rubygems.org' 13 | # 14 | # gemspec 15 | 16 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'rake' 2 | require 'rspec/core/rake_task' 3 | 4 | desc "Run tests" 5 | task :default => [:spec] 6 | 7 | desc "About Xiki" 8 | task :about do 9 | 10 | puts "Xiki expands your command line! Xiki makes the command line" 11 | puts "friendlier and more powerful." 12 | puts "" 13 | puts "You use Xiki Shell (xsh) to use Xiki from command line:" 14 | puts "" 15 | puts " $ xsh" 16 | puts "" 17 | puts "See http://xiki.com for info." 18 | puts "" 19 | 20 | end 21 | 22 | RSpec::Core::RakeTask.new(:spec) do |t| 23 | end 24 | 25 | 26 | -------------------------------------------------------------------------------- /bin/xiki: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts "The 'xiki' command is temporarily disabled in this version. Use the 'xsh' command instead!" 4 | 5 | ## 6 | ## > Summary 7 | ## This is the "xiki" shell command. It exposes xiki menus. 8 | ## 9 | ## > Example usage 10 | ## $ xiki ip 11 | ## 111.1.1.111 12 | ## 13 | ## This will be invoked by the "xiki" wrapper gem files create 14 | ## when you install xiki as a gem. 15 | ## 16 | ## Or, if you installed xiki from 17 | ## source (github), this file gets copied into /usr/local/bin/ 18 | ## or a similar path by the copy_xiki_command_to.rb the project 19 | ## README file tells you to run. 20 | ## 21 | # 22 | #require 'rubygems' 23 | # 24 | ## Generate with correct path (see below) 25 | #xiki_dir = File.expand_path "#{File.dirname(__FILE__)}/.." 26 | # 27 | #$:.unshift "#{xiki_dir}/lib" #.sub(/\/$/, '') 28 | # 29 | #require "xiki/core/ol" 30 | #require "xiki/core/core_ext" 31 | # 32 | #$:.unshift "#{xiki_dir}/misc/command" 33 | # 34 | #require "xiki_command.rb" 35 | # 36 | #result = XikiCommand.run 37 | #puts result if result != "" 38 | # 39 | #exit 0 40 | -------------------------------------------------------------------------------- /bin/xikigem: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | mkdir -p ~/.xiki/misc/gems/ 4 | export GEM_HOME=~/.xiki/misc/gems/ 5 | export GEM_PATH= 6 | 7 | # xikigem install foo, so delegate to gem install... 8 | 9 | if [ "$1" = "install" ]; then 10 | echo Temporarily setting \$GEM_HOME to \~/.xiki/misc/gems/... 11 | echo 12 | gem install "$2" 13 | xsh --reload 14 | exit 15 | fi 16 | 17 | # xikigem uninstall foo, so delegate to gem install... 18 | 19 | if [ "$1" = "uninstall" ]; then 20 | echo Temporarily setting \$GEM_HOME to \~/.xiki/misc/gems/... 21 | echo 22 | gem uninstall "$2" 23 | xsh --reload 24 | exit 25 | fi 26 | 27 | # xikigem list, so delegate to gem list... 28 | 29 | if [ "$1" = "list" ]; then 30 | echo Gems installed in \~/.xiki/misc/gems/: 31 | gem list 32 | echo 33 | echo Xiki also has access to the global gems you have installed. 34 | echo Run "$ xsh -gems" to see global gems and the above xiki-local 35 | echo gems together. 36 | echo 37 | exit 38 | fi 39 | 40 | 41 | -------------------------------------------------------------------------------- /install_xsh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is called from the one-line xsh installer: 3 | # $ curl -L https://raw.githubusercontent.com/trogdoro/xiki/master/install_xsh -o ~/install_xsh; bash ~/install_xsh 4 | # 5 | # It can also be invoked manually, like this: 6 | # $ bash ~/install_xsh 7 | # 8 | 9 | # Make dir if not there yet 10 | mkdir -p ~/xiki-project 11 | 12 | # Download xiki project into the dir 13 | curl -L https://github.com/trogdoro/xiki/archive/master.tar.gz | tar -xz -C ~/xiki-project --strip-components=1 14 | 15 | # Reload and start xsh (it will lock the user through the setup) 16 | ~/xiki-project/bin/xsh --reload 17 | 18 | # If token was passed, save to file 19 | 20 | if [ "$1" ]; then 21 | echo $1 > /tmp/xiki_temp_token 22 | fi 23 | 24 | ~/xiki-project/bin/xsh -xsh/setup 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /lib/xiki/core/control_lock.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | # Simple wrapper around control_lock.el to turn 3 | # it on and off (and handle the case where it's not) 4 | # installed. 5 | class ControlLock 6 | 7 | def self.toggle 8 | # if in noob mode, do nothing 9 | return if Keys.noob_mode 10 | 11 | # in the future use green box and "xsh > Ctrl+U enabled" to let them enable it 12 | 13 | $el.control_lock_enable 14 | end 15 | 16 | def self.disable 17 | $el.control_lock_enable if self.enabled? 18 | end 19 | 20 | def self.enabled? 21 | $el.boundp(:control_lock_mode_p) and $el.elvar.control_lock_mode_p 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /lib/xiki/core/dirs.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Dirs 3 | def self.commands 4 | @@commands ||= File.expand_path("~/xiki") 5 | end 6 | end 7 | end 8 | 9 | -------------------------------------------------------------------------------- /lib/xiki/core/environment.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Environment 3 | 4 | # Will return either :osx, :linux, :windows, or :unknown. 5 | # Environment.os 6 | def self.os 7 | 8 | return "osx" if RUBY_PLATFORM =~ /darwin/i 9 | return "linux" if RUBY_PLATFORM =~ /linux/i 10 | return "solaris" if RUBY_PLATFORM =~ /solaris/i 11 | return "windows" if RUBY_PLATFORM =~ /mswin/i 12 | 13 | :unknown 14 | end 15 | 16 | def self.xsh= val 17 | $el.elvar.environment_xsh = val 18 | end 19 | def self.xsh? 20 | return nil if ! $el.boundp(:environment_xsh) 21 | $el.elvar.environment_xsh 22 | end 23 | 24 | def self.current_emacs_path 25 | # This is only currently implemented for the mac. 26 | # Someone, make this work for Linux also. 27 | 28 | result = `ps -ef`[/ (\/.+\/(Aquamacs|Aquamacs Emacs|Emacs)\.app)/, 1] 29 | end 30 | 31 | def self.emacs 32 | $el 33 | end 34 | 35 | def self.gui_emacs 36 | @@gui_emacs ||= ($el && $el.display_graphic_p) 37 | end 38 | 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /lib/xiki/core/incrementer.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | # Helps you to insert "1", "2", "3".... Useful during macros. 3 | class Incrementer 4 | def self.start 5 | Clipboard['n'] = (Keys.prefix_n || 0).to_s 6 | end 7 | 8 | def self.increment 9 | Clipboard['n'] = Clipboard['n'].next 10 | end 11 | 12 | def self.enter 13 | self.increment if Keys.prefix_u 14 | View.insert Clipboard['n'] 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /lib/xiki/core/index.menu: -------------------------------------------------------------------------------- 1 | > Summary 2 | | Has the most important Xiki classes. 3 | -------------------------------------------------------------------------------- /lib/xiki/core/insert.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Insert 3 | 4 | def self.[] txt 5 | View.insert txt 6 | end 7 | 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /lib/xiki/core/irc.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Irc 3 | 4 | def self.menu 5 | " 6 | - .logon 7 | - room (o): /j merb 8 | - identify (o): /m nickserv IDENTIFY #{self.pw} 9 | " 10 | end 11 | 12 | def self.logon 13 | View.handle_bar 14 | $el.el4r_lisp_eval "(erc :server \"irc.freenode.net\" :nick \"#{@@username}\")" 15 | end 16 | 17 | def self.username= to; @@username = to; end 18 | def self.username; @@username; end 19 | 20 | def self.pw; @@pw; end 21 | def self.pw= to; @@pw = to; end 22 | 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /lib/xiki/core/json.rb: -------------------------------------------------------------------------------- 1 | class Json 2 | def self.extract_json_header txt 3 | 4 | header = "" 5 | 6 | # "{{" at beginning, so remove 1st and return no header... 7 | 8 | if txt =~ /\A\{\{/ 9 | txt.sub!(/./, '') 10 | return nil # No header exists 11 | end 12 | 13 | # No "{" at beginning, so return no header 14 | if txt !~ /\A\{/ 15 | return nil 16 | end 17 | 18 | # Single json line at top, so extract it as header 19 | if txt =~ /\A.+\}$/ 20 | return txt.slice! /.+$\n?/ 21 | end 22 | 23 | # Multi-line json header, so extract until 1st "}" on a line by itself 24 | txt.slice!(/.+?\n}$\n?/m) 25 | 26 | 27 | # return header == "" ? nil : header 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/xiki/core/links.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Links 3 | def self.open_first 4 | url = View.txt[/http:\/\/.+/] 5 | $el.browse_url url 6 | end 7 | 8 | def self.to_nth_file n 9 | items = Xiki["files/", :go=>1].split("\n") 10 | item = items[n-1].sub(/^\+ /, '') 11 | Xiki["files", [item]] 12 | end 13 | 14 | def self.show_in_nav target_file, target_quote 15 | View.open "%links" 16 | View.to_top 17 | Search.forward $el.regexp_quote(target_file) 18 | if target_quote 19 | Search.forward $el.regexp_quote(target_quote), :beginning=>1 20 | end 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/xiki/core/menu.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | module Menu 3 | 4 | def self.init 5 | 6 | return if ! $el 7 | 8 | Mode.define(:menu, ".menu") do 9 | Xiki::Notes.mode 10 | end 11 | Mode.define(:xiki, ".xiki") do 12 | Xiki::Notes.mode 13 | end 14 | 15 | end 16 | 17 | end 18 | 19 | Menu.init # Define mode 20 | end 21 | -------------------------------------------------------------------------------- /lib/xiki/core/message.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Message 3 | def self.<< txt 4 | View.message txt 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/xiki/core/mode.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | # Helps you define modes. 3 | # 4 | # Sample usage: 5 | # Mode.define(:deck, ".deck") do 6 | # Deck.apply_styles 7 | # end 8 | # 9 | class Mode 10 | 11 | def self.menu 12 | " 13 | - docs/ 14 | | Put @mode under a file to change the mode. 15 | " 16 | end 17 | 18 | # Easy way to define a mode 19 | def self.define name, extension, &block 20 | 21 | return if ! $el 22 | 23 | # Mode function 24 | $el.defun("#{name}_mode".to_sym, :interactive => "", :docstring => "Apply #{name} styles, etc") do 25 | $el.el4r_lisp_eval "(setq font-lock-defaults '(nil t))" 26 | block.call 27 | 28 | map_name = "#{name}_mode_map".to_sym 29 | $el.use_local_map $el.elvar.send(map_name) if $el.boundp(map_name) 30 | end 31 | 32 | # Associate with file extension 33 | $el.el4r_lisp_eval %Q<(add-to-list 'auto-mode-alist '("\\\\#{extension}\\\\'" . #{name}-mode))> 34 | 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/xiki/core/numbers.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Numbers 3 | def self.menu 4 | ['.sum_numbers_in_clipboard', 5 | '.sum_dollars_in_clipboard' 6 | ] 7 | end 8 | 9 | def self.sum_numbers txt 10 | numbers = txt.scan(/[\d.]+/) 11 | numbers.map!{|o| o.to_f} 12 | numbers.inject(0){|i, o| i + o} 13 | end 14 | 15 | def self.sum_numbers_in_clipboard 16 | self.sum_numbers Clipboard[0] 17 | end 18 | 19 | def self.sum_dollars txt 20 | numbers = txt.scan(/\$([\d.]+)/).map{|o| o.first} 21 | numbers.map!{|o| o.to_f} 22 | numbers.inject(0){|i, o| i + o} 23 | end 24 | 25 | def self.sum_dollars_in_clipboard 26 | self.sum_dollars Clipboard[0] 27 | end 28 | 29 | def self.enter_as_added 30 | txt = Clipboard[0] 31 | 32 | # If it has amount after " = ", make nure only they are added 33 | if txt =~ / = \$?\d/ 34 | txt.gsub! /.* = /, '' 35 | end 36 | 37 | # If it has dollars, just add dollars 38 | if txt =~ /\$\d/ 39 | View.insert self.sum_dollars(txt).to_s 40 | return 41 | end 42 | 43 | View.insert self.sum_numbers(txt).to_s 44 | 45 | end 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /lib/xiki/core/option_items.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class OptionItems 3 | 4 | # Makes copy of items, with tilde prepended (used for routing) 5 | def self.prepend_asterisk option_item 6 | 7 | # Put tilda before 1st item 8 | if option_item[0] 9 | option_item = option_item.dup # Don't affect original option 10 | option_item[0] = "* #{option_item[0]}" 11 | end 12 | 13 | option_item 14 | 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /lib/xiki/core/php.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Php 3 | def self.run 4 | # Get block contents 5 | txt, left, right = View.txt_per_prefix #:prefix=>Keys.prefix 6 | 7 | result = self.run_internal txt 8 | # Insert result at end of block 9 | orig = Location.new 10 | View.cursor = right 11 | Line.to_left 12 | View.insert result.gsub(/^/, ' ')+"\n" 13 | orig.go 14 | end 15 | 16 | def self.run_internal txt 17 | # Write to temp file 18 | File.open("/tmp/tmp.php", "w") { |f| f << "\n" } 19 | # Call js 20 | Shell.run "php -f /tmp/tmp.php", :sync=>true 21 | end 22 | 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /lib/xiki/core/pre_pattern.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | # Probably eventually merge this with Pattern 3 | # - Pattern may want to fire on these things, like we do... 4 | # - target view name 5 | # - target file name 6 | # - just the above things, and no pattern 7 | class PrePattern 8 | 9 | # Structure is something like... 10 | # :view=>{ 11 | # "*ol"=> 12 | @@defs ||= {} 13 | 14 | def self.defs 15 | @@defs 16 | end 17 | 18 | def self.expands? options 19 | Pattern.expands? options, @@defs 20 | end 21 | 22 | def self.expand options 23 | # This method shouldn't be called - expander will intercepted by Pattern called 24 | # So just delete this method? 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /lib/xiki/core/projects.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Projects 3 | def self.before_menu 4 | nil 5 | end 6 | def self.after_menu 7 | nil 8 | end 9 | 10 | def self.menu 11 | " 12 | - This will never be called, because of projects.menu... 13 | - Think again of ways for .menu and .rb to work together creating menus 14 | - api/ 15 | " 16 | end 17 | 18 | def self.default 19 | # If parent is dir, return it, else return first project 20 | dir = FileTree.handles?(Tree.path[-2]) ? "#{Dir.pwd}/" : self.default_project 21 | end 22 | 23 | def self.default_project 24 | txt = File.read(File.expand_path "~/.xiki/roots/projects.menu") rescue nil 25 | return nil if ! txt 26 | 27 | Line.without_label(:line=>txt[/.+/]) 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/xiki/core/relinquish_exception.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class RelinquishException < RuntimeError 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /lib/xiki/core/url_tree.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class UrlTree 3 | def self.handles? list 4 | list.first =~ /^http:\/\// ? 1 : nil 5 | end 6 | 7 | def self.launch options={} 8 | url = options[:path].join("") 9 | Keys.prefix_u ? $el.browse_url(url) : Firefox.url(url) 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/xiki/core/wikipedia.rb: -------------------------------------------------------------------------------- 1 | module Menu 2 | class Wikipedia 3 | 4 | def self.wp name=nil, options={} 5 | if name.nil? 6 | # TODO > how to deal with fact that history will have wp and wikipedia? - pass in list: 7 | # Maybe get the actual root pass it (wikipedia or wp) 8 | # How to get it? 9 | # Do: pass list into Launcher.last 10 | # Launcher.last(["wp", "wikipedia"], :exclude_path=>1) 11 | # or, just make it a regex? 12 | # And add ^...$ inside .last 13 | 14 | return ( 15 | Launcher.last("wp", :exclude_path=>1) + 16 | Launcher.last("wikipedia", :exclude_path=>1) 17 | ) 18 | 19 | end 20 | 21 | name = ::Xiki::TextUtil.title_case name if name !~ /^[A-Z]/ # Titlize if not already 22 | 23 | options[:no_slash] = 1 24 | ::Xiki::Firefox.url "http://en.wikipedia.org/wiki/#{name}" 25 | "<* opened in browser!" 26 | end 27 | end 28 | 29 | end 30 | -------------------------------------------------------------------------------- /lib/xiki/core/window.rb: -------------------------------------------------------------------------------- 1 | # Deprecated after Unified. 2 | 3 | module Xiki 4 | class Window 5 | 6 | # Move this into view.rb 7 | def self.visible choice=nil 8 | choices = { 9 | 'full'=>"(100 100)", 10 | 'high'=>"(85 70)", 11 | 'medium'=>"(70 55)", 12 | 'low'=>"(40 30)", 13 | } 14 | 15 | numbers = choices[choice] 16 | raise "<* '#{choice}' isn't a valid choice for View.visible!" if numbers.nil? 17 | 18 | $el.el4r_lisp_eval "(set-frame-parameter nil 'alpha '#{numbers})" # full visible 19 | View.kill :force_recent=>1 if View.name == "window/visible/" 20 | end 21 | 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/xiki/core/x.rb: -------------------------------------------------------------------------------- 1 | def X *args 2 | Xiki.expand *args 3 | end 4 | 5 | class X 6 | def self.sh command, options={} 7 | Xiki::Shell.sync command, options 8 | end 9 | 10 | def self.to_s 11 | %` 12 | | The X method is a convenience wrapper around Xiki.expand() 13 | | Example usage: 14 | =X "ip" 15 | ` 16 | end 17 | end 18 | 19 | -------------------------------------------------------------------------------- /lib/xiki/handlers/bootstrap_handler.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class BootstrapHandler 3 | 4 | def self.handle options 5 | source = options[:handlers]['bootstrap'] 6 | 7 | return if ! source || options[:output] || options[:halt] 8 | 9 | txt = File.read "#{options[:enclosing_source_dir]}#{source}" 10 | 11 | if options[:client] == "web" 12 | require "#{Xiki.dir}roots/bootstrap.rb" if ! defined? Xiki::Menu::Bootstrap 13 | txt = Xiki::Menu::Bootstrap.render txt 14 | end 15 | options[:output] = txt 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /lib/xiki/handlers/conf_loading_handler.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class ConfLoadingHandler 3 | def self.handle options 4 | 5 | # Always try loading options[:conf] (from /index.conf or ~/xiki/roots/conf/foo.conf... 6 | 7 | self.load_conf options # should we avoid loading conf when we're the conf? - probably doesn't matter, since conf/index.conf doesn't exist 8 | end 9 | 10 | # Populates options[:conf] based on /index.conf or ~/xiki/roots/conf/foo.conf. 11 | def self.load_conf options 12 | 13 | # Load user conf, if there is any... 14 | 15 | user_conf = File.expand_path "~/.xiki/roots/conf/#{options[:name]}.conf" 16 | if File.file? user_conf 17 | txt = File.read user_conf 18 | return options[:conf] = txt 19 | end 20 | 21 | # None found, so look for default.conf... 22 | 23 | default_conf = "#{options[:menufied]}/default.conf" 24 | 25 | if File.exists? default_conf 26 | txt = File.read default_conf 27 | return options[:conf] = txt 28 | end 29 | 30 | end 31 | 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/xiki/handlers/deck_handler.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class DeckHandler 3 | def self.handle options 4 | source = options[:handlers]['deck'] 5 | 6 | return if ! options[:handlers] || options[:output] || options[:halt] 7 | path = "#{options[:enclosing_source_dir]}#{source}" 8 | 9 | args = options[:args] 10 | 11 | options[:halt] = 1 # Just in case there's no output 12 | 13 | # /, so let drill show args... 14 | 15 | if ! args || options[:prefix] 16 | txt = Notes.drill path, *args||[] 17 | return options[:output] = "" if ! txt 18 | return options[:output] = txt.split("\n").uniq.join("\n") 19 | end 20 | 21 | # />heading, so let open and start... 22 | 23 | View.open path 24 | 25 | Deck.show_all 26 | 27 | heading = args.join '/' 28 | 29 | View.hide_others :all=>1 30 | 31 | Xiki["dimensions/presentation full/"] 32 | 33 | View.to_highest 34 | Search.forward "^#{$el.regexp_quote heading}$", :beginning=>1 35 | Deck.right_arrow :dont_move=>1 36 | 37 | options[:output] = "" 38 | 39 | end 40 | 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /lib/xiki/handlers/erb_handler.rb: -------------------------------------------------------------------------------- 1 | 2 | module Xiki 3 | class ErbHandler 4 | def self.handle options 5 | source = options[:handlers]['erb'] 6 | return if ! source || options[:output] || options[:halt] 7 | 8 | require 'erubis' 9 | 10 | txt = File.read "#{options[:enclosing_source_dir]}#{source}" 11 | 12 | # template = File.read("/tmp/sample_file.erb") 13 | template = Erubis::Eruby.new(txt) 14 | txt = template.result(options) 15 | 16 | options[:output] = txt 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /lib/xiki/handlers/html_handler.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class HtmlHandler 3 | def self.handle options 4 | 5 | source = options[:handlers]['html'] 6 | return if ! source || options[:output] || options[:halt] 7 | 8 | Browser.url "http://localhost:8163/#{options[:name]}/" 9 | 10 | View.flash "- showing in browser!" 11 | options[:output] = "" 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /lib/xiki/handlers/index.menu: -------------------------------------------------------------------------------- 1 | > Summary 2 | | Handlers are what Command.expand passes control to to run source files. 3 | | Source files have various extensions (.menu, .py, etc.) and there's 4 | | a handler for each extension. 5 | -------------------------------------------------------------------------------- /lib/xiki/handlers/jpg_handler.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class JpgHandler 3 | def self.handle options 4 | source = options[:handlers]['jpg'] 5 | return if ! source || options[:output] || options[:halt] 6 | 7 | path = "#{options[:enclosing_source_dir]}#{source}" 8 | 9 | options[:output] = "@file/#{path}" 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/xiki/handlers/markdown_handler.rb: -------------------------------------------------------------------------------- 1 | # gem 'redcarpet' 2 | # require 'redcarpet' 3 | 4 | module Xiki 5 | class MarkdownHandler 6 | def self.handle options 7 | source = options[:handlers]['markdown'] 8 | return if ! source || options[:output] || options[:halt] 9 | 10 | txt = options[:output] = File.read "#{options[:enclosing_source_dir]}#{source}" 11 | html = self.render txt 12 | 13 | Browser.html html 14 | 15 | options[:output] = "<* showing in browser!" 16 | end 17 | 18 | def self.render txt 19 | markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink=>true, :space_after_headers=>true) 20 | html = markdown.render txt 21 | html << Html.default_css 22 | 23 | html 24 | end 25 | 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /lib/xiki/handlers/sh_handler.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class ShHandler 3 | 4 | 5 | def self.handle options 6 | source = options[:handlers]['sh'] 7 | return if ! source || options[:output] || options[:halt] 8 | 9 | source = "#{options[:enclosing_source_dir]}#{source}" 10 | txt = File.read source 11 | 12 | txt = self.eval txt, options #.merge(:file=>source) 13 | options[:output] = txt 14 | end 15 | 16 | def self.eval txt, options={} 17 | 18 | args = options[:args] 19 | args = args ? args.map{|o| o.inspect}.join(" ") : "" 20 | 21 | txt = "ARGS=(#{args})\n"+txt.gsub(/^/, " ") 22 | 23 | txt = Shell.run "bash", :sync=>true, :stdin=>txt 24 | 25 | txt 26 | 27 | rescue Exception=>e 28 | return CodeTree.draw_exception e 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /lib/xiki/handlers/txt_handler.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class TxtHandler 3 | def self.handle options 4 | 5 | source = options[:handlers]['txt'] 6 | return if ! source || options[:output] || options[:halt] 7 | 8 | file = "#{options[:enclosing_source_dir]}#{source}" 9 | 10 | # /, so just show the contents... 11 | 12 | if ! options[:args] 13 | 14 | txt = File.read file 15 | 16 | if options[:client] =~ /^web\// 17 | txt = "
#{txt}
" 18 | return options[:output] = txt 19 | end 20 | 21 | return options[:output] = Tree.quote(txt, :char=>"|") 22 | end 23 | 24 | # An arg passed, so must want to save... 25 | 26 | # =commit/.txt > make it save upon launch 27 | 28 | File.open(file, "w") { |f| f << options[:args][0] } 29 | options[:output] = "<* saved" 30 | 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/xiki/handlers/xiki_handler.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class XikiHandler 3 | def self.handle options 4 | 5 | # Look at source file to see if it has >... headings... 6 | 7 | source_file = options[:handlers]['xiki'] 8 | return if ! source_file 9 | 10 | file = "#{options[:enclosing_source_dir]}#{source_file}" 11 | txt = File.read file, *Xiki::Files.encoding_binary 12 | # Probably save this into options, so we don't have to read it again in one of the other handlers (is there a convention for a key name for this?) 13 | 14 | txt.gsub! "\r\n", "\n" # In case dos linebreaks 15 | headings = txt.scan(/^>/) 16 | 17 | # >... at top and thereafter, so delegate to NotesHandler... 18 | 19 | return NotesHandler.handle(options) if headings.length > 0 && txt =~ /\A>/ #> ||| 20 | 21 | # No >..., so delegate to MenuHandler... 22 | 23 | MenuHandler.handle options 24 | 25 | end 26 | 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /lib/xiki/tools/accounts.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Accounts 3 | def self.menu *args 4 | Notes.drill '%accounts', *args 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/xiki/tools/agenda.rb: -------------------------------------------------------------------------------- 1 | require 'xiki/core/view' 2 | require 'xiki/core/line' 3 | require 'xiki/core/effects' 4 | 5 | 6 | module Xiki 7 | class Agenda 8 | 9 | def self.menu *lines 10 | t = Bookmarks['%links'] 11 | 12 | # If no line, display all of them 13 | if lines.empty? 14 | return IO.read(t).grep(/^> \d\d\d\d-\d\d-\d\d: /).sort.reverse.join("").gsub(/^> /, '- ') 15 | end 16 | 17 | line = Line.value 18 | 19 | # If line, jump to it in :t 20 | find = Line.value.sub /^[ -]+/, '' 21 | View.open t 22 | View.to_top 23 | Search.forward "^. #{$el.regexp_quote(find)}" 24 | Line.to_left 25 | View.recenter_top 26 | Effects.blink(:what=>:line) 27 | 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/xiki/tools/applescript.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Applescript 3 | 4 | # 5 | # Applescript.run 'tell application "iTunes" to playpause' 6 | # Applescript.run "playpause", :app=>"iTunes" 7 | # Applescript.run "get the name of every track of library playlist 1 as string", :app=>"iTunes", :delimiter=>"|" 8 | # 9 | def self.run command, options={} 10 | 11 | # If 2nd arg is string, assume "app", "command" 12 | if options.is_a?(String) 13 | options, command = {:app=>command}, options 14 | end 15 | 16 | extra = "set Applescript's text item delimiters to \"#{options[:delimiter]}\"\n" if options[:delimiter] 17 | 18 | # If 2nd arg passed, treat first as app 19 | if options[:app] 20 | 21 | txt = " 22 | tell application \"#{options[:app]}\" 23 | #{extra}#{command} 24 | end tell 25 | ".unindent 26 | 27 | return self.do_applescript txt 28 | end 29 | 30 | self.do_applescript "#{extra}#{command}" 31 | end 32 | 33 | def self.do_applescript txt 34 | txt = File.open("/tmp/applescript.txt", "w") { |f| f << txt } 35 | Shell.sync "osascript /tmp/applescript.txt" 36 | end 37 | 38 | 39 | 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/xiki/tools/as.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class As 3 | def self.menu 4 | %` 5 | > Summary 6 | | Keys shortcuts that start with "to+" (ctrl-t) such as to+end. 7 | | 8 | - frequent/ 9 | | as+clipboard: Copy (after doing Control-space on the other side) 10 | | as+kill: Cut (after doing Control-space on the other side) 11 | | as+bookmark: remember this file as a bookmark 12 | - others/ 13 | | TODO 14 | ` 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /lib/xiki/tools/cassandra_db.rb: -------------------------------------------------------------------------------- 1 | # gem 'cassandra' 2 | # require 'xiki/core/cassandra' 3 | 4 | # require 'xiki/core/launcher' 5 | 6 | module Xiki 7 | # Cassandras structure: 8 | # keyspace ->* table family ->* key (->* super column) ->* column 9 | class CassandraDb 10 | 11 | @@connections = {} 12 | 13 | def self.conn keyspace 14 | @@connections[keyspace] ||= Cassandra.new(keyspace, '127.0.0.1:9160') 15 | end 16 | 17 | def self.insert keyspace, column_family, key, columns 18 | conn = self.conn keyspace 19 | conn.insert column_family, key, columns 20 | end 21 | 22 | def self.get keyspace, column_family, key, columns=nil 23 | conn = self.conn keyspace 24 | conn.get column_family, key, columns 25 | end 26 | 27 | def self.menu 28 | " 29 | + .start/ 30 | - TODO: implement! 31 | + .statements/ 32 | CassandraDb.insert 'Animals', :Ant, 'Steve', {'bbbb' => 'bbb'} 33 | CassandraDb.get 'Animals', :Ant, 'Steve' 34 | " 35 | end 36 | 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lib/xiki/tools/chgrp.menu: -------------------------------------------------------------------------------- 1 | << chown/ 2 | -------------------------------------------------------------------------------- /lib/xiki/tools/classes.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Classes 3 | def self.menu *args 4 | Xiki["ruby/classes/#{args.join '/'}"] 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/xiki/tools/coffee_script.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class CoffeeScript 3 | 4 | # Called by keyboard shortcut 5 | def self.run_block 6 | Block.do_as_something do |txt| 7 | if Keys.prefix_u 8 | self.to_js(txt) 9 | else 10 | txt = "p = print = console.log\n\n#{txt}" 11 | self.execute(txt) 12 | end 13 | end 14 | end 15 | 16 | def self.execute txt 17 | Shell.sync 'coffee -s', :stdin=>txt 18 | end 19 | 20 | def self.to_js txt 21 | Shell.sync 'coffee -sc', :stdin=>txt 22 | end 23 | 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /lib/xiki/tools/contacts.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Contacts 3 | def self.menu *args 4 | Notes.drill '%c', *args 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/xiki/tools/cookies.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Cookies 3 | def self.menu key=nil, val=nil 4 | 5 | txt = Firefox.exec "document.cookie" 6 | 7 | return "- no cookies set!" if txt == '""' 8 | 9 | hash = txt.split('; ').inject({}) do |acc, e| 10 | k, v = e.match(/(.*?)=(.*)/)[1..2] 11 | acc[k] = v 12 | acc 13 | end 14 | 15 | # If no args, show all keys 16 | 17 | if key.nil? 18 | return hash.keys.sort.map{|k| "- #{k}/\n"}.join 19 | end 20 | 21 | # If just key, show its value 22 | if val.nil? 23 | return "| #{hash[key]}" 24 | end 25 | 26 | "<* updated!" 27 | 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/xiki/tools/count.menu: -------------------------------------------------------------------------------- 1 | > Count words in a string 2 | << words/ 3 | > Count matches of a pattern in a string 4 | << matches/ 5 | -------------------------------------------------------------------------------- /lib/xiki/tools/create.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | # Used by web interface when it creates a new menu? 3 | # It looks like the html form posts to it. 4 | class Create 5 | def self.menu name 6 | 7 | txt = File.read "/tmp/post_tmp" 8 | 9 | extension = txt =~ /^class / ? "rb" : "menu" 10 | file_path = File.expand_path("~/.xiki/roots/#{name}.#{extension}") 11 | File.open(file_path, "w") { |f| f << txt } 12 | 13 | require_menu file_path 14 | 15 | " 16 | > Your menu was saved! Now go to it: 17 | - #{name} 18 | " 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /lib/xiki/tools/crop.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Crop 3 | 4 | def self.menu coords=nil, save=nil 5 | 6 | dir = Tree.dir :file=>"foo.png" 7 | 8 | tmp_dir = "/tmp/crop" 9 | Dir.mkdir tmp_dir if ! File.exists? tmp_dir 10 | 11 | # If nothing, show coords options 12 | 13 | return " 14 | - 40x40+10+10/ 15 | - 200x200+100+100/ 16 | " if ! coords 17 | 18 | dir, file = File.dirname(dir), File.basename(dir) 19 | dest = file.sub '.', "_#{coords.sub('+', '_')}." 20 | 21 | # If just coords, so crop into tmp dir and show 22 | 23 | if save.nil? 24 | dest = "#{tmp_dir}/#{dest}" 25 | 26 | Shell.sync %`convert "#{file}" -crop #{coords} "#{dest}"`, :dir=>dir 27 | Image.>> dest, "_" 28 | return 29 | end 30 | 31 | # Image clicked on, so crop to destination 32 | 33 | Shell.sync %`convert "#{file}" -crop #{coords} "#{dest}"`, :dir=>dir 34 | Line.previous 35 | Tree.to_parent 36 | Tree.collapse 37 | indent = Line.indent Line.value(0) 38 | Line.next 39 | View.<< "#{indent}- #{dest}\n", :dont_move=>1 40 | 41 | Effects.glow :fade_in=>1 42 | 43 | nil 44 | 45 | end 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /lib/xiki/tools/current.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Current 3 | def self.menu *name 4 | Buffers.current *name 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/xiki/tools/def.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Def 3 | def self.menu *args 4 | Line.delete 5 | 6 | txt = %` 7 | def self. 8 | "hi" 9 | end 10 | `.unindent 11 | 12 | View.insert txt.gsub(/^/, ' '), :dont_move=>1 13 | Move.to_end 14 | # ControlLock.disable 15 | 16 | nil 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /lib/xiki/tools/diffs.menu: -------------------------------------------------------------------------------- 1 | << diff log/ 2 | << history/unsaved files/ 3 | -------------------------------------------------------------------------------- /lib/xiki/tools/do.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Do 3 | def self.menu 4 | %` 5 | > Summary 6 | | Keys shortcuts that start with "to+" (ctrl-t) such as to+end. 7 | | 8 | - frequent/ 9 | | do+tree: view an expanded tree of a directory 10 | - others/ 11 | | TODO 12 | ` 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /lib/xiki/tools/edited.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Edited 3 | def self.menu option=nil 4 | 5 | paths = Files.edited_array[0..300] 6 | 7 | # If "tree" option, show in tree form 8 | if option == "tree" 9 | txt = Tree.paths_to_tree paths 10 | txt.gsub! /^- \//, "- @/" 11 | return txt 12 | end 13 | 14 | # Else, show in array form 15 | 16 | paths.map!{|i| i.sub(/(.+\/)(.+)/, "- @\\1\n - \\2")} 17 | paths.join("\n") 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/xiki/tools/emacs.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Emacs 3 | def self.menu 4 | " 5 | - .version/ 6 | - .info pages/ 7 | - Keys/ 8 | - Prefix Keymaps/ 9 | - Keymaps/ 10 | - Prefix Keymaps/ 11 | " 12 | end 13 | 14 | def self.v22 15 | self.version_number(:major=>1) == "22" 16 | end 17 | 18 | def self.version_number options={} 19 | return $el.emacs_version[/[\d]+/] if options[:major] 20 | $el.emacs_version[/[\d.]+/] 21 | end 22 | 23 | def self.version 24 | Tree.quote $el.emacs_version 25 | end 26 | 27 | def self.info_pages name 28 | View.to_upper 29 | $el.info "(emacs)#{name}" 30 | nil 31 | end 32 | 33 | # Emacs.regexp_quote "hi?" 34 | # "hi\?" 35 | def self.regexp_quote txt # Escape regex 36 | $el.regexp_quote txt 37 | end 38 | 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /lib/xiki/tools/enter.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Enter 3 | def self.menu 4 | %` 5 | > Summary 6 | | Keys shortcuts that start with "to+" (ctrl-t) such as to+end. 7 | | 8 | - frequent/ 9 | | enter+clipboard: Paste 10 | - others/ 11 | | TODO 12 | ` 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /lib/xiki/tools/eval.rb: -------------------------------------------------------------------------------- 1 | # Supplanted by =code/ ? 2 | 3 | module Xiki 4 | class Eval 5 | def self.menu *args 6 | # If any args, just eval them 7 | if args.any? 8 | txt = ENV['txt'] 9 | 10 | cursor = View.cursor 11 | Tree.to_parent 12 | parent_line = View.line 13 | View.cursor = cursor 14 | 15 | txt, out, exception = Code.eval txt, View.file, parent_line+1 16 | 17 | return CodeTree.draw_exception exception, txt if exception 18 | return out.any? ? out : txt.to_s 19 | end 20 | 21 | " 22 | | # Put some ruby code here to eval it, such as: 23 | | p 1 + 2 24 | " 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /lib/xiki/tools/executable.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Executable 3 | def self.menu 4 | 5 | # If not nested, error 6 | return " 7 | | Put '@executable' under a menu then run it again. It should be under 8 | | the menu you want to create the executable for ou want to create the" 9 | 10 | trunk = Tree.path 11 | 12 | " 13 | - cake/ 14 | - chocolate/ 15 | " 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /lib/xiki/tools/filter.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Filter 3 | def self.menu filter=nil, *target 4 | 5 | # Get parent file path! 6 | # If none, assume current file 7 | 8 | # For now, just assume it's the current file 9 | 10 | # If nothing passed, tell them to add something 11 | return View.prompt "Type something to filter by" if ! filter 12 | 13 | return Tree.children(self.docs, target) if filter == "docs" 14 | 15 | if target.blank? # If just filter, show results 16 | return View.txt.grep(/#{filter}/i).join("").gsub(/^/, '| ') 17 | end 18 | 19 | # Navigated to a target 20 | 21 | target = Line.value 22 | target.sub! /^ *\| /, '' 23 | 24 | View.to_highest 25 | Search.forward "^#{target}$" 26 | 27 | Line.to_beginning 28 | nil 29 | end 30 | 31 | def self.docs 32 | " 33 | > Examples 34 | | Filter the whole file for the string 'tt' 35 | @filter/tt/ 36 | 37 | | Filter for NOT the string 'tt' 38 | @filter/!/tt/ 39 | 40 | | Filter children for the string 'tt' 41 | @filter/tt/ 42 | | Hat 43 | | Hatty 44 | " 45 | end 46 | 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /lib/xiki/tools/frameworks.menu: -------------------------------------------------------------------------------- 1 | << rails/ 2 | << sinatra/ 3 | << node/ 4 | -------------------------------------------------------------------------------- /lib/xiki/tools/french.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class French 3 | def self.menu txt=nil 4 | return "| Type something here to translate from french" if txt.nil? 5 | url = "http://translate.google.com/#fr|en|#{CGI.escape ENV['txt']}" 6 | Browser.url url 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /lib/xiki/tools/google.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Google 3 | 4 | def self.search txt, options={} 5 | txt = CGI.escape txt 6 | url = "http://www.google.com/search?q=#{txt}" 7 | 8 | options[:via_os] ? 9 | $el.browse_url(url) : 10 | Browser.url(url) 11 | 12 | nil 13 | end 14 | 15 | def self.maps txt 16 | txt = CGI.escape txt 17 | Browser.url "http://maps.google.com/maps?q=#{txt}" 18 | nil 19 | end 20 | 21 | 22 | 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /lib/xiki/tools/google_patents.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class GooglePatents 3 | def self.menu *args 4 | 5 | return View.prompt "Type something to google patent search for" if args.blank? 6 | txt = ENV['txt'] 7 | 8 | url = "https://www.google.com/search?tbm=pts&q=#{CGI.escape txt}" 9 | Browser.url url 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/xiki/tools/grep.menu: -------------------------------------------------------------------------------- 1 | > Grep a file 2 | @$ grep root /etc/group 3 | 4 | > Does not contain 5 | @$ grep -v root /etc/group 6 | 7 | > Regular expressions 8 | @$ egrep ro+t /etc/group 9 | 10 | > Docs 11 | @man/grep/ 12 | 13 | > For a menu, see also 14 | << filter/ 15 | -------------------------------------------------------------------------------- /lib/xiki/tools/gutenberg.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Gutenberg 3 | def self.menu *args 4 | arg = args.any? ? args.join("/") : nil 5 | 6 | return View.prompt('Type a search phrase') if arg.nil? 7 | 8 | arg.sub! /^\| ?/, '' 9 | return View.prompt "Type something to google gutenberg search for" if arg.nil? 10 | 11 | url = "http://www.gutenberg.org/ebooks/search.html/?format=html&default_prefix=all&sort_order=downloads&query=#{CGI.escape arg}" 12 | Browser.url url 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /lib/xiki/tools/head.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Head 3 | def self.menu *args 4 | 5 | count = args.shift if args[0] =~ /^\d+$/ 6 | 7 | dir = Tree.dir :file=>1 8 | Tree.quote `head #{count ? "-n #{count}" : ""} "#{dir}"` 9 | 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/xiki/tools/headings.rb: -------------------------------------------------------------------------------- 1 | require 'xiki/core/view' 2 | require 'xiki/core/line' 3 | require 'xiki/core/effects' 4 | 5 | module Xiki 6 | class Headings 7 | 8 | def self.menu target=nil, line=nil 9 | todo = Bookmarks['%links'] 10 | 11 | # If no target, tell them to enter one 12 | if target.nil? 13 | return View.prompt "Type a heading to search for" 14 | end 15 | 16 | # If no line, search for headings 17 | if line.nil? 18 | txt = IO.read(todo) 19 | sections = txt.split(/^> /, -1) 20 | sections = sections.select{|o| 21 | # Check just first line 22 | o[/.*/] =~ /#{Regexp.quote target}/i 23 | } 24 | return sections.map{|o| "> #{o.strip}\n\n"}.join("").gsub(/^/, '| ').gsub(/^\| $/, '|') 25 | end 26 | 27 | # Launched quoted line, so jump to it 28 | 29 | line = Line.value 30 | 31 | find = line.sub /^ \| /, '' 32 | View.open todo 33 | View.to_top 34 | Search.forward "^#{$el.regexp_quote(find)}$" 35 | Line.to_left 36 | View.recenter_top 37 | Effects.blink(:what=>:line) 38 | 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/xiki/tools/hosts.menu: -------------------------------------------------------------------------------- 1 | @/etc/ 2 | $ ls -l hosts 3 | - 1. make writable) % sudo chmod 777 hosts 4 | - 2. edit) hosts 5 | - 3. restore permissions) % sudo chmod 644 hosts 6 | -------------------------------------------------------------------------------- /lib/xiki/tools/html5.menu: -------------------------------------------------------------------------------- 1 | << canvas/ 2 | << svg/ 3 | << html/ 4 | << css/ 5 | -------------------------------------------------------------------------------- /lib/xiki/tools/httpd.menu: -------------------------------------------------------------------------------- 1 | << apache/ 2 | -------------------------------------------------------------------------------- /lib/xiki/tools/icon.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Icon 3 | def self.menu name=nil, choice=nil 4 | 5 | name = choice if name == "recent" && choice 6 | 7 | # If they picked recent/, just list icons 8 | 9 | return Launcher.last "", :omit=>'icon' if name == "recent" 10 | 11 | # If nothing, show main options 12 | 13 | if name.nil? 14 | 15 | return " 16 | > Summary 17 | | Makes an icon in the OS that opens a xiki menu. 18 | | Does this work currently? 19 | - type menu name here) 20 | - recent/ 21 | << see also) xiki/setup/install icon/ 22 | " 23 | end 24 | 25 | # Name passed so create menu 26 | 27 | dir = Tree.dir :or=>:desktop 28 | 29 | path = "#{dir}/#{name}.xiki" 30 | File.open(path, "w") { |f| f << "\n" } 31 | Files.open_in_window path 32 | 33 | "- created '#{name}' icon!" 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/xiki/tools/images.menu: -------------------------------------------------------------------------------- 1 | << google images/ 2 | << scale/ 3 | -------------------------------------------------------------------------------- /lib/xiki/tools/index.menu: -------------------------------------------------------------------------------- 1 | > Summary 2 | | These are older classes that were menus before the Unified refactor. 3 | | Many of them should be ported and moved into the menu dir: 4 | =%s/roots/ 5 | -------------------------------------------------------------------------------- /lib/xiki/tools/info.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Info 3 | def self.menu *args 4 | 5 | dir = Tree.dir :file=>1 6 | 7 | result = `ls -lah "#{dir}"` 8 | Tree.quote result 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/xiki/tools/iterm.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Iterm 3 | def self.menu *args 4 | 5 | # If no arg, prompt to type something 6 | 7 | return View.prompt "Type something to run in iTerm" if args.empty? 8 | 9 | txt = args.join('/') 10 | 11 | return self.command("activate") if txt == "start" 12 | return self.command("quit") if txt == "quit" 13 | 14 | self.run txt.sub(/^\| /, '') 15 | end 16 | 17 | def self.command txt 18 | Applescript.run %` 19 | #{txt} application "iTerm" 20 | ` 21 | return nil 22 | end 23 | 24 | def self.run txt, options={} 25 | txt.gsub! "\\", '\\\\\\' 26 | txt.gsub! '"', '\"' 27 | 28 | Applescript.run %` 29 | tell application "iTerm" 30 | #{options[:activate] ? 'activate' : ''} 31 | tell the first terminal 32 | tell the last session 33 | write text "#{txt}" 34 | end tell 35 | end tell 36 | end tell 37 | ` 38 | nil 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/xiki/tools/layout.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Layout 3 | def self.menu 4 | %` 5 | | Keys shortcuts that start with "to+" (ctrl-t) such as to+end. 6 | - frequent/ 7 | | layout+create: Create a new view 8 | | layout+hide: Hide this view 9 | | layout+next: Go to next view 10 | | layout+previous: Go to previous view 11 | | layout+kill: Close the current file 12 | - all/ 13 | | TODO 14 | | 15 | > See also 16 | << view/ 17 | ` 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/xiki/tools/lighttp.menu: -------------------------------------------------------------------------------- 1 | - install/ 2 | @% brew install lighttpd 3 | - hello world/ 4 | @/tmp/ 5 | - 1) Make config file 6 | - lighttpd.conf 7 | | server.document-root = "/tmp/light/" 8 | | 9 | | server.port = 3000 10 | | 11 | | mimetype.assign = ( 12 | | ".html" => "text/html", 13 | | ".txt" => "text/plain", 14 | | ".jpg" => "image/jpeg", 15 | | ".png" => "image/png" 16 | | ) 17 | | 18 | | index-file.names = ( "index.html" ) 19 | 20 | - 2) Make html file 21 | - light/ 22 | - index.html 23 | | heya
24 | 25 | - 3) Start server 26 | $ lighttpd -t -f lighttpd.conf 27 | % lighttpd -D -f lighttpd.conf 28 | 29 | - 4) Go to the url 30 | @http://localhost:3000/ 31 | -------------------------------------------------------------------------------- /lib/xiki/tools/linebreaks.menu: -------------------------------------------------------------------------------- 1 | << encoding/ 2 | -------------------------------------------------------------------------------- /lib/xiki/tools/list.menu: -------------------------------------------------------------------------------- 1 | << all/ 2 | -------------------------------------------------------------------------------- /lib/xiki/tools/matches.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Matches 3 | def self.menu *args 4 | 5 | # If no args, explain what it does 6 | 7 | if args.empty? 8 | return View.prompt "Count matches of what?" 9 | end 10 | 11 | # If only one arg, have them add some text 12 | 13 | if args.length == 1 14 | return Tree << "| Add some text here to matches the matches." 15 | end 16 | 17 | txt = ENV['txt'].scan(/#{args[0]}/i).length.to_s 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/xiki/tools/music.menu: -------------------------------------------------------------------------------- 1 | << piano/ 2 | -------------------------------------------------------------------------------- /lib/xiki/tools/node.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Node 3 | 4 | def self.run txt 5 | file = "/tmp/nodejs.js" 6 | txt = "function puts (txt){ return console.log(txt) }\n\n#{txt}" 7 | File.open(file, "w") { |f| f << txt } 8 | Shell["node #{file}"] 9 | end 10 | 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/xiki/tools/opacity.menu: -------------------------------------------------------------------------------- 1 | << view/opacity/ 2 | -------------------------------------------------------------------------------- /lib/xiki/tools/open.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Open 3 | def self.menu 4 | %` 5 | > Summary 6 | | Keys shortcuts that start with "to+" (ctrl-t) such as to+end. 7 | | 8 | - frequent/ 9 | > Jumping cursor around 10 | | open+bookmark: jump to a file 11 | | open+tree: view a tree of a directory 12 | | open+current: shows currently open files 13 | | open+edited: shows recently edited files 14 | | open+menu: opens view that lets you type a menu (type "-" to see all) 15 | | 16 | - others/ 17 | | open+history: shows recently viewed files 18 | ` 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /lib/xiki/tools/outline.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Outline 3 | def self.menu *target 4 | 5 | if target.blank? # If just filter, show results 6 | return View.txt.grep(/^> /).select{|o| o !~ /^> ?$/}.join("").gsub(/^/, '| ') 7 | end 8 | # Navigated to target text 9 | 10 | # Grab line manually, because input will have all lines grouped together 11 | # Should there be an option to have just 1 line passed in? 12 | # How would it work? 13 | # Something in the routing? 14 | target = Line.value 15 | target.sub! /^ *\| /, '' 16 | 17 | View.to_highest 18 | result = Search.forward "^#{target}$" 19 | 20 | View.recenter_top 21 | Line.to_beginning 22 | nil 23 | 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /lib/xiki/tools/permissions.menu: -------------------------------------------------------------------------------- 1 | << chmod/ 2 | << chown/ 3 | -------------------------------------------------------------------------------- /lib/xiki/tools/pre.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Pre 3 | def self.menu 4 | Browser.html "
#{ENV['txt']}
" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/xiki/tools/ps.menu: -------------------------------------------------------------------------------- 1 | << processes/ 2 | << kill/ 3 | -------------------------------------------------------------------------------- /lib/xiki/tools/python.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Python 3 | def self.menu 4 | " 5 | > Pass python code to run 6 | | print('hey') 7 | " 8 | end 9 | 10 | def self.menu_after txt, *args 11 | # Do nothing if .menu created output 12 | return nil if txt 13 | 14 | txt = ENV['txt'] 15 | return nil if txt.nil? 16 | 17 | txt = Python.run_internal txt 18 | txt 19 | end 20 | 21 | def self.run 22 | Block.do_as_something do |txt| 23 | result = self.run_internal txt 24 | end 25 | end 26 | 27 | def self.run_internal txt 28 | # Write to temp file 29 | File.open("/tmp/tmp.py", "w") { |f| f << txt } 30 | # Call js 31 | Shell.run "python /tmp/tmp.py", :sync=>true 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/xiki/tools/qri.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Qri 3 | def self.menu *txt 4 | txt = txt.any? ? txt.join('/') : nil 5 | 6 | return ".prompt Type a ruby method or class" if ! txt 7 | 8 | # Text passed, so look it up 9 | Tree.quote `qri -f plain "#{txt}"` 10 | 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /lib/xiki/tools/rake.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Rake 3 | def self.menu task=nil 4 | 5 | if task.nil? # If no task passed, show all 6 | txt = Shell.run 'rake -T', :sync=>true 7 | return "- Error: no rake file." if txt =~ /^No Rakefile found/ 8 | return txt.scan(/^rake ([\w:]+)/).join("\n") 9 | end 10 | 11 | Shell.run "rake #{task}" # If task passed, run it 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /lib/xiki/tools/random.menu: -------------------------------------------------------------------------------- 1 | << shuffle/ 2 | -------------------------------------------------------------------------------- /lib/xiki/tools/random_menu.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class RandomMenu 3 | def self.menu *args 4 | dirs = ["~/.xiki/roots/"] 5 | menus = [] 6 | dirs.each do |dir| 7 | menus += Dir.new(Bookmarks[dir]).entries.grep(/\A[^.]/) 8 | end 9 | 10 | menu = menus.sort_by{ rand }[0] 11 | menu.gsub '_', ' ' 12 | menu.sub! /\..*/, '' 13 | "@#{menu}/" 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /lib/xiki/tools/readme.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Readme 3 | def self.menu *args 4 | txt = File.read "#{Bookmarks["%xiki"]}README.md" 5 | Notes.from_markdown_format txt 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/xiki/tools/redis.menu: -------------------------------------------------------------------------------- 1 | - start/ 2 | @ % redis-server 3 | - docs/ 4 | > Hello World 5 | @ % redis-cli 6 | $ set counter 100 7 | $ redis-cli get counter 8 | @ % incr counter 9 | @ % incrby counter 10 10 | @ % get counter 11 | -------------------------------------------------------------------------------- /lib/xiki/tools/rss.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | # Gets mp3 url's from an rss feed 3 | class Rss 4 | def self.menu rss=nil 5 | # If no rss passed, tell them to provide one 6 | if rss.nil? 7 | return "- rss url - " 8 | end 9 | 10 | # rss passed, so get result and pull out url's 11 | xml = Net::HTTP.get URI.parse(rss.sub(/.+?http/,'http')) 12 | urls = [] 13 | xml.scan(/http:\/\/[\w.\/-]+\.mp3/) {|m| urls << m} 14 | urls.uniq.join("\n") 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /lib/xiki/tools/rsync.menu: -------------------------------------------------------------------------------- 1 | > Normal transfer 2 | $ rsync -vauz -e ssh --delete local_dir foo@foo.com:~ 3 | 4 | > Dry run (don't actually transfer) 5 | | add --dry-run parameter 6 | 7 | > Exclude certain dirs / files 8 | | --exclude=public/cache/* --exclude=wik.js --exclude=.git 9 | -------------------------------------------------------------------------------- /lib/xiki/tools/safari.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Safari 3 | def self.reload 4 | 5 | Applescript.run %` 6 | tell application "Safari" 7 | do JavaScript "window.location.reload();" in the first document 8 | end tell 9 | ` 10 | 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /lib/xiki/tools/sammiches.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Sammiches 3 | def self.menu 4 | " 5 | - meat/ 6 | - ham/ 7 | - .buy/ 8 | - philly/ 9 | - .buy/ 10 | - veggie/ 11 | - cucumber/ 12 | - .buy/ 13 | - bark/ 14 | - .buy/ 15 | - .checkout/ 16 | - cash/ 17 | - credit/ 18 | " 19 | end 20 | def self.buy category, item 21 | "- adding to cart #{item} #{category}" 22 | end 23 | 24 | def self.checkout kind 25 | "- checking out as #{kind}..." 26 | end 27 | 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/xiki/tools/sass.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Sass 3 | def self.menu *args 4 | txt = ENV['txt'] 5 | File.open("/tmp/tmp.sass", "w") { |f| f << txt } 6 | css = `sass /tmp/tmp.sass` 7 | 8 | css.gsub!("\n", '\n') 9 | css.gsub!('"', '\"') 10 | code = "$('head').append(\"\")" 11 | 12 | Firefox.exec code 13 | 14 | "<* Loaded in browser!" 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /lib/xiki/tools/say.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Say 3 | def self.menu *args 4 | txt = args.join('/').gsub('"', '\"') 5 | Applescript.run "say \"#{txt}\"" 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/xiki/tools/settings.menu: -------------------------------------------------------------------------------- 1 | > See 2 | << conf/ 3 | -------------------------------------------------------------------------------- /lib/xiki/tools/shell_commands.menu: -------------------------------------------------------------------------------- 1 | > See 2 | << console/ 3 | << xiki/setup/install command/ 4 | -------------------------------------------------------------------------------- /lib/xiki/tools/size.menu: -------------------------------------------------------------------------------- 1 | << @styles/font size/ 2 | -------------------------------------------------------------------------------- /lib/xiki/tools/source.menu: -------------------------------------------------------------------------------- 1 | > Xiki source 2 | << :xiki/ 3 | -------------------------------------------------------------------------------- /lib/xiki/tools/spanish.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Spanish 3 | def self.menu txt=nil 4 | return "| Type something here to translate from spanish" if txt.nil? 5 | 6 | Browser.url "http://translate.google.com/#es|en|#{URI.encode ENV['txt'].gsub(' ', '+')}" 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /lib/xiki/tools/steps.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Steps 3 | 4 | # Use notes styles for .steps files 5 | def self.init 6 | Mode.define(:steps, ".steps") do 7 | Notes.mode 8 | end 9 | end 10 | 11 | end 12 | Steps.init # Define mode 13 | end 14 | -------------------------------------------------------------------------------- /lib/xiki/tools/synonyms.menu: -------------------------------------------------------------------------------- 1 | << thesaurus/ 2 | -------------------------------------------------------------------------------- /lib/xiki/tools/technologies.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Technologies 3 | def self.menu topic=nil, *args 4 | 5 | heading, content = args.partition{|o| o !~ /^\|/} 6 | 7 | content = content.any? ? content.join("/") : nil 8 | heading = heading.any? ? heading.join("/") : nil 9 | 10 | # If no topic, just show all dirs 11 | 12 | if topic.nil? 13 | entries = Dir.new(Bookmarks["%te"]).entries 14 | entries = entries.select{|o| o =~ /^\w/} 15 | return entries.map{|o| "#{o}/"} 16 | end 17 | 18 | # If just topic, list all headings 19 | 20 | Notes.drill "%te/#{topic}/#{topic}.xiki", heading, content 21 | 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /lib/xiki/tools/textile.rb: -------------------------------------------------------------------------------- 1 | # gem 'RedCloth' 2 | # require 'redcloth' 3 | 4 | module Xiki 5 | class Textile 6 | 7 | def self.render txt 8 | 9 | html = RedCloth.new(txt).to_html 10 | html << Html.default_css 11 | 12 | html 13 | end 14 | 15 | def self.menu *args 16 | 17 | # If nothing passed, show example textile 18 | return " 19 | > Render the textile wiki format in the browser 20 | | h1. Heading 21 | | 22 | | h2. Small Heading 23 | | 24 | | * Bullet 25 | | ** Another 26 | | 27 | | A normal sentence. 28 | | 29 | | bc.. Code can be displayed 30 | | like this. 31 | " if args.blank? 32 | 33 | html = self.render(ENV['txt']) 34 | 35 | Browser.html html 36 | 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /lib/xiki/tools/to.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class To 3 | def self.menu 4 | %` 5 | > Summary 6 | | Keys shortcuts that start with "to+" (ctrl-t) such as to+end. 7 | | 8 | - frequent/ 9 | > Jumping cursor around 10 | | to+row - jump to line 11 | | to+axis - beginning of line 12 | | to+end - end of line 13 | | 14 | | to+previous - beginning of previous paragraph 15 | | to+next - beginning of next paragraph 16 | | 17 | | to+highest - beginning of file 18 | | to+lowest - end of file 19 | | 20 | - others/ 21 | | to+backward - backward one word 22 | | to+foreward - foreward one word 23 | ` 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /lib/xiki/tools/urls.menu: -------------------------------------------------------------------------------- 1 | << http/ 2 | -------------------------------------------------------------------------------- /lib/xiki/tools/wiki.menu: -------------------------------------------------------------------------------- 1 | > Wikipedia 2 | << wp/ 3 | 4 | > Xiki's wiki sytax 5 | << wiki syntax/ 6 | 7 | > Other wiki syntaxes 8 | << markdown/ 9 | << textile/ 10 | -------------------------------------------------------------------------------- /lib/xiki/tools/wiki_syntax.menu: -------------------------------------------------------------------------------- 1 | > Summary 2 | | Shows the syntaxes of Xiki's wiki format 3 | 4 | > For headings begin with a less than character 5 | >> For subheadings use more 6 | 7 | - For bullets 8 | - begin with spaces and hyphens 9 | 10 | | For grayed text, begin with a pipe 11 | |+ For green diffs, pipe plus 12 | |- For red diffs, pipe minus 13 | 14 | + For path style end with slash/ 15 | 16 | > See 17 | << markdown/ 18 | -------------------------------------------------------------------------------- /lib/xiki/tools/words.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Words 3 | def self.menu *args 4 | 5 | # If no args, explain what it does 6 | if args.empty? 7 | return View.prompt "Add some text to count the words." 8 | end 9 | 10 | txt = ENV['txt'].scan(/[a-z']+/i).length.to_s 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /lib/xiki/vim/index.menu: -------------------------------------------------------------------------------- 1 | > Summary 2 | | In-progress support for Vim. The current idea is that the classes will 3 | | loaded in Vim's ruby environment after the core classes, so that method 4 | | definitions in them will replace the default ones with vim-specific ones. 5 | | Possibly revisit this approach. 6 | -------------------------------------------------------------------------------- /lib/xiki/vim/line.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Line 3 | def self.number 4 | $curbuf.line_number 5 | end 6 | def self.value n=nil 7 | n = self.number if ! n 8 | $curbuf[n] 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/xiki/vim/tree.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Tree 3 | def self.<< txt 4 | line_number, line = Line.number, Line.value 5 | indent = line[/^ +/] 6 | txt.split("\n").each_with_index do |line, i| 7 | $curbuf.append(line_number + i, "#{indent} #{line}") 8 | end 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /misc/command/copy_xiki_command_to.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Used to "install" the 'xiki' shell command (copy it to 3 | # /usr/local/bin/) when installing Xiki manually from source 4 | # rather than as a gem. 5 | # 6 | dest = ARGV[0] 7 | 8 | if ! dest 9 | puts "Usage (run it from the xiki project dir):\n\n $ etc/command/copy_xiki_command_to.rb /usr/bin/xiki" 10 | exit 11 | end 12 | 13 | if dest !~ /xiki$/ 14 | puts "The path you pass should end with 'xiki'. Such as:\n\n $ etc/command/copy_xiki_command_to.rb /usr/bin/xiki" 15 | exit 16 | end 17 | 18 | puts "Putting the 'xiki' shell command at: 19 | 20 | #{dest} 21 | " 22 | 23 | source = "etc/command/xiki_wrapper" 24 | 25 | xiki_dir = Dir.pwd 26 | 27 | puts "" # Blank line 28 | 29 | txt = File.read source 30 | txt.sub! /\(xiki_dir\)/, xiki_dir 31 | 32 | File.open(dest, "w", 0755) { |f| f << txt } 33 | 34 | puts "Finished." 35 | -------------------------------------------------------------------------------- /misc/command/external_shell_tutorial.txt: -------------------------------------------------------------------------------- 1 | 2 | 1. Go to http://xiki.com/@xiki/tutorial in a web browser. 3 | 2. Type the commands into this terminal window. 4 | 5 | 6 | -------------------------------------------------------------------------------- /misc/command/shell_please_move.txt: -------------------------------------------------------------------------------- 1 | Please move or rename the ~/xiki dir first. Since 2 | ~/xiki will be the path of the dir where user 3 | customizations are stored. 4 | 5 | You can move it pretty much anywhere. Or use one or 6 | both of these to rename it: 7 | 8 | $ mv ~/xiki ~/xiki_src 9 | $ mkdir ~/xiki mv ~/xiki_src ~/xiki/src 10 | -------------------------------------------------------------------------------- /misc/command/xiki_wrapper: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | load "(xiki_dir)/bin/xiki" 3 | -------------------------------------------------------------------------------- /misc/default_home_xiki/memorize.xiki: -------------------------------------------------------------------------------- 1 | This file, memorize.xiki, is a place to put facts 2 | you want to memorize. 3 | 4 | -------------------------------------------------------------------------------- /misc/emacs/el4r/stdlib.rb: -------------------------------------------------------------------------------- 1 | 2 | # 3 | ## [2005/06/27] winconf-push 4 | @winconf_stack = [] 5 | defun(:winconf_push, :interactive=>true) do 6 | funcall(:message, "pushd winconf") 7 | @winconf_stack.push([current_window_configuration, point]) 8 | end 9 | 10 | # 11 | ## [2005/06/27] winconf-pop 12 | defun(:winconf_pop, :interactive=>true) do 13 | winconf, pt = @winconf_stack.pop 14 | if winconf 15 | set_window_configuration(winconf) 16 | goto_char pt 17 | funcall(:message, "popped winconf") 18 | else 19 | funcall(:message, "winconf_pop: winconf stack is empty") 20 | end 21 | end 22 | 23 | # 24 | ## [2005/06/27] winconf-command 25 | defun(:winconf_command, :interactive=>"P") do |arg| 26 | if arg 27 | winconf_push 28 | else 29 | winconf_pop 30 | end 31 | end 32 | 33 | # 34 | 35 | ## / Local Variables 36 | ## / eeb-defaults: (eeel4r ee-delimiter-hash nil t t) 37 | ## / End: 38 | -------------------------------------------------------------------------------- /misc/emacs/start_xiki_daemon.el: -------------------------------------------------------------------------------- 1 | ; Clear out scratch, otherwise it would flash first... 2 | 3 | (with-current-buffer "*scratch*" 4 | (erase-buffer)) 5 | 6 | ; It's our job to make this emacs ready for emacsclient sessions to join, so set up the hook, define variable, and load start_xiki.el in this dir... 7 | 8 | (add-hook 'after-make-frame-functions (lambda (frame) (interactive) 9 | 10 | (set-buffer "*scratch*") 11 | (run-with-idle-timer 0 nil (lambda () 12 | (el4r-ruby-eval "::Xiki::Xsh.run :args_via_daemon=>1") 13 | 14 | ;; Hack to simulate key press, since it seems to wait for one 15 | (setq unread-command-events (cons 2 unread-command-events)) 16 | 17 | )) 18 | 19 | nil 20 | 21 | )) 22 | 23 | (setq xiki-emacs-daemon t) 24 | 25 | ; Load start_xiki.el in this dir, which will start xiki... 26 | 27 | (load (replace-regexp-in-string "_daemon.el$" ".el" load-file-name)) 28 | -------------------------------------------------------------------------------- /misc/emacs/start_xiki_no_socket.el: -------------------------------------------------------------------------------- 1 | ; Just set a variable and load start_xiki.el in this dir... 2 | 3 | (setq xiki-no-socket t) 4 | (load (replace-regexp-in-string "_no_socket.el$" ".el" load-file-name)) 5 | (message "") ; Suppress message showing it loaded the above file 6 | -------------------------------------------------------------------------------- /misc/install/.xsh.default: -------------------------------------------------------------------------------- 1 | # Define some key shortcuts for quickly switching from your shell to xsh 2 | xiki_open_key="\C-o" # Ctrl+O to open in xsh 3 | xiki_search_key="\C-s" # Ctrl+S to search shared commands on XikiHub 4 | xiki_key="\C-x" # Ctrl+X to show a xiki files 5 | xiki_tasks_key="\C-t" # Ctrl+T to show the tasks dropdown 6 | xiki_go_key="\C-g" # Ctrl+G to grab commands between xsh and your shell 7 | xiki_reverse_key="\er" # Alt+R to search shell history 8 | 9 | -------------------------------------------------------------------------------- /misc/install/el4r_setup.sh: -------------------------------------------------------------------------------- 1 | cd `dirname \`gem contents --prefix trogdoro-el4r | grep setup.rb\`` 2 | ruby setup.rb 3 | cd bin/ 4 | ruby -S el4r-rctool -p 5 | ruby -S el4r-rctool -i 6 | -------------------------------------------------------------------------------- /misc/install/install_when_flag.rb: -------------------------------------------------------------------------------- 1 | path = File.expand_path __FILE__ 2 | path = File.dirname path 3 | 4 | require "#{path}/save_config.rb" 5 | 6 | Xiki::SaveConfig.save_config "/xiki", "some shell key shortcut remappings" 7 | 8 | 9 | -------------------------------------------------------------------------------- /misc/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trogdoro/xiki/be9b5eb87fb6eac11c70adbbb602bb71895834a8/misc/logo.png -------------------------------------------------------------------------------- /misc/old/presentations/bootstrap.deck: -------------------------------------------------------------------------------- 1 | > Demo 2 | 3 | bootstrap 4 | 5 | 6 | -------------------------------------------------------------------------------- /misc/old/presentations/databases.deck: -------------------------------------------------------------------------------- 1 | > Browse databases 2 | 3 | databases/ 4 | 5 | 6 | > Mysql 7 | 8 | - explore 9 | 10 | mysql/ 11 | 12 | 13 | > Mysql 14 | 15 | select * from 16 | 17 | 18 | 19 | > Mongo 20 | 21 | - explore 22 | 23 | mongo/ 24 | - collections/ 25 | + docs/ 26 | 27 | 28 | > Memcached 29 | 30 | - explore 31 | 32 | memcache/ 33 | 34 | 35 | > HTML5 local storage 36 | 37 | - explore 38 | 39 | local storage/ 40 | 41 | 42 | -------------------------------------------------------------------------------- /misc/old/presentations/diffs.deck: -------------------------------------------------------------------------------- 1 | > Difflog 2 | 3 | - Diffs of every change you make is saved 4 | 5 | - key: open+difflog 6 | 7 | 8 | > Edits to one file or dir 9 | 10 | - key: search+edits 11 | 12 | 13 | > Edits since backup 14 | 15 | - Make backup: as+version 16 | 17 | - key: do+compare+last 18 | 19 | 20 | > Diff of unsaved files 21 | 22 | - Show all changes not saved: open+not+saved 23 | 24 | -------------------------------------------------------------------------------- /misc/old/presentations/documentation.deck: -------------------------------------------------------------------------------- 1 | > Documentation is merged with menus 2 | 3 | - Example: 4 | piano/ 5 | 6 | 7 | > Docs for all of xiki 8 | 9 | docs/ 10 | 11 | 12 | > Docs for all of xiki 13 | 14 | http://xiki/docs 15 | -------------------------------------------------------------------------------- /misc/old/presentations/effects.deck: -------------------------------------------------------------------------------- 1 | > Demo menu 2 | 3 | effects/ 4 | 5 | 6 | -------------------------------------------------------------------------------- /misc/old/presentations/files.deck: -------------------------------------------------------------------------------- 1 | > Browse 2 | 3 | /tmp/ 4 | 5 | 6 | > Search 7 | 8 | /projects/xiki/ 9 | 10 | 11 | > Create file inline 12 | 13 | - Pretend like file exists 14 | 15 | /tmp/ 16 | bar.txt 17 | 18 | 19 | > Edit without opening 20 | 21 | /tmp/ 22 | foo.txt 23 | 24 | 25 | > Create files 26 | 27 | - Pretend like file and dir exist... 28 | 29 | /tmp/foo/ 30 | bar.txt 31 | 32 | 33 | > Copy files 34 | 35 | /tmp/foo/ 36 | bar.txt 37 | bee.txt 38 | 39 | 40 | > Rename files 41 | 42 | - Rename... 43 | 44 | /tmp/foo/ 45 | bar.txt 46 | bee.txt 47 | 48 | 49 | > Delete files 50 | 51 | - Delete... 52 | 53 | /tmp/foo/ 54 | bar.txt 55 | bee.txt 56 | 57 | 58 | > Mass operations 59 | 60 | - Mass rename... 61 | 62 | /tmp/foo/ 63 | bar.txt 64 | bee.txt 65 | 66 | 67 | > Mass operations 68 | 69 | - Mass delete... 70 | 71 | /tmp/foo/ 72 | bar.txt 73 | bee.txt 74 | 75 | 76 | > Remote files 77 | 78 | /xiki@xiki.org/ 79 | 80 | -------------------------------------------------------------------------------- /misc/old/presentations/icons.deck: -------------------------------------------------------------------------------- 1 | > Show opening an icon 2 | 3 | - Double-click a file to use a menu 4 | 5 | - /Users/craig/Desktop/ 6 | - paint.xiki 7 | | - colors/ 8 | | - red/ 9 | | - blue/ 10 | | - green/ 11 | | - sheen/ 12 | | - flat/ 13 | | - eggshell/ 14 | | - gloss/ 15 | 16 | 17 | > .xiki files in url's 18 | 19 | - Click on a link to run the menu 20 | 21 | http://mongo.org/mongo.xiki 22 | 23 | -------------------------------------------------------------------------------- /misc/old/presentations/images.deck: -------------------------------------------------------------------------------- 1 | > Navigating 2 | 3 | - /projects/xiki/etc/ 4 | + logo.png 5 | 6 | - Click the plus! 7 | 8 | 9 | > Doing stuff to images 10 | 11 | - /projects/xiki/etc/ 12 | + logo.png 13 | @scale/ 14 | 15 | 16 | > Using images in menus 17 | 18 | spectrum/ 19 | 20 | 21 | > Related demo 22 | 23 | /projects/xiki/etc/demos/ 24 | - svg.deck 25 | -------------------------------------------------------------------------------- /misc/old/presentations/key_shortcuts.deck: -------------------------------------------------------------------------------- 1 | > Define shortcuts 2 | 3 | Keys.Z { Line << "hey" } 4 | 5 | 6 | > Define shortcuts 7 | 8 | Keys.Z { Browser.url "http://xiki.org" } 9 | Keys.Z { Line.gsub!(/ +/, " ") } 10 | 11 | 12 | > Define shortcuts 13 | 14 | Keys.just_hi { Line << "hey there" } 15 | 16 | 17 | -------------------------------------------------------------------------------- /misc/old/presentations/macros.deck: -------------------------------------------------------------------------------- 1 | > One macro 2 | 3 | - as+job 4 | - do+job 5 | 6 | 4151112222 7 | 8 | 4151113333 9 | 10 | 11 | > Multiple lines 12 | 13 | - as+job 14 | - up+do+job 15 | 16 | tables/sharks/ 17 | 18 | 19 | -------------------------------------------------------------------------------- /misc/old/presentations/menu_classes.deck: -------------------------------------------------------------------------------- 1 | > Make a menu 2 | 3 | - Two types of "routing" 4 | - manual 5 | - .menu method 6 | 7 | 8 | > .menu method that handles params manually 9 | 10 | class Short 11 | def self.menu arg=nil 12 | if ! arg 13 | return " 14 | - a/ 15 | - b/ 16 | " 17 | end 18 | "- you said '#{arg}'" 19 | end 20 | end 21 | 22 | >> Demo it 23 | 24 | 25 | > .menu method that routes 26 | 27 | class Short 28 | def self.menu 29 | " 30 | - a/ 31 | - aa/ 32 | - .b/ 33 | " 34 | end 35 | def self.b arg=nil 36 | return "- something" if ! arg 37 | "- ((#{arg}))" 38 | end 39 | end 40 | 41 | >> Demo it 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /misc/old/presentations/menu_directories.deck: -------------------------------------------------------------------------------- 1 | > Dirs 2 | 3 | ~/menu/ 4 | /projects/xiki/menu/ 5 | 6 | 7 | > Dirs 8 | 9 | ~/menu/ 10 | /projects/xiki/menu/ 11 | 12 | - Home directory over-rides 13 | 14 | 15 | > Dirs 16 | 17 | ~/menu/ 18 | /projects/xiki/menu/ 19 | 20 | - Home directory over-rides 21 | - so you can customize 22 | 23 | 24 | > Show example 25 | 26 | - Example that over-rides... 27 | 28 | computer/ 29 | 30 | 31 | -------------------------------------------------------------------------------- /misc/old/presentations/notes.deck: -------------------------------------------------------------------------------- 1 | > Example of notes 2 | 3 | - Go to url that doesn't exist... 4 | 5 | http://xiki/store/ 6 | 7 | 8 | > Tech notes 9 | 10 | - Show ruby notes... 11 | 12 | 13 | > Notes with steps 14 | 15 | - Make notes with shell commands 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /misc/old/presentations/other_languages.deck: -------------------------------------------------------------------------------- 1 | > Javascript 2 | 3 | - do+as+javascript 4 | 5 | >> 6 | function hi(){ 7 | print("hey" + "you") 8 | } 9 | 10 | hi(); 11 | 12 | 13 | > Python 14 | 15 | - do+as+python 16 | 17 | >> 18 | class Pyth: 19 | def hi(self): 20 | print "hey" + "you" 21 | 22 | Pyth().hi() 23 | 24 | 25 | > Node 26 | 27 | node/ 28 | 29 | 30 | > Calling classes inline 31 | 32 | - Demo... 33 | 34 | - /projects/xiki_wrappers/ 35 | - shrimp.rb 36 | + shrimp.rb/ 37 | 38 | 39 | > Calling classes inline 40 | 41 | - Demo... 42 | 43 | - /projects/xiki_wrappers/ 44 | + crab.rb 45 | + crab.rb/ 46 | 47 | 48 | > Calling classes inline 49 | 50 | - Demo... 51 | 52 | - /projects/xiki_wrappers/ 53 | + clam.py 54 | + clam.py/ 55 | 56 | -------------------------------------------------------------------------------- /misc/old/presentations/other_wiki_syntaxes.deck: -------------------------------------------------------------------------------- 1 | > 2 | 3 | wiki/ 4 | 5 | -------------------------------------------------------------------------------- /misc/old/presentations/piano.deck: -------------------------------------------------------------------------------- 1 | > Explore the menu 2 | 3 | piano/ 4 | 5 | 6 | -------------------------------------------------------------------------------- /misc/old/presentations/potential/diffs.deck: -------------------------------------------------------------------------------- 1 | > Difflog 2 | 3 | - Diffs of every change you make is saved 4 | 5 | - key: open+difflog 6 | 7 | 8 | > Edits to one file or dir 9 | 10 | - key: search+edits 11 | 12 | 13 | > Diff with saved 14 | 15 | - key: do+compare+saved 16 | 17 | 18 | > Diff with git 19 | 20 | - key: do+compare+repository 21 | 22 | 23 | > Diff all unsaved files 24 | 25 | - key: open+not+saved 26 | 27 | 28 | > Edits since backup 29 | 30 | - Make backup: as+version 31 | 32 | - key: do+compare+last 33 | 34 | 35 | > Diff of unsaved files 36 | 37 | - Show all changes not saved: open+not+saved 38 | 39 | -------------------------------------------------------------------------------- /misc/old/presentations/potential/evolution.deck: -------------------------------------------------------------------------------- 1 | > How xiki started 2 | 3 | 4 | > Obvious Next steps 5 | 6 | - aren't obvious until you get to the previous step 7 | - but then are obvious 8 | 9 | 10 | > 11 | - 1) textual bullets (indent 2 spaces) 12 | - 2) files 13 | - 3) contents indented 2 spaces 14 | - 4) code 15 | - 2) output is indented 2 spaces 16 | - 5) mapping to classes / methods 17 | - 6) simpler path-like syntax 18 | - 7) if file isn't there, create it 19 | -------------------------------------------------------------------------------- /misc/old/presentations/potential/make_mysql_menu.deck: -------------------------------------------------------------------------------- 1 | > Summary 2 | - Make simple menu 3 | 4 | 5 | > Summary 6 | - Make simple menu 7 | - to access external tool 8 | 9 | 10 | > Summary 11 | - Make simple menu 12 | - to access external tool 13 | - mysql 14 | 15 | 16 | > List tables 17 | 18 | 19 | > 20 | - TODO 21 | - finish 22 | 23 | 24 | > Hints 25 | >> List tables 26 | tably 27 | 28 | /Users/craig/menu/ 29 | - tably.rb 30 | | class Tably 31 | | def self.menu name=nil 32 | | return `mysql dev -u root -e "show tables"` if ! name 33 | | `mysql dev -u root -e "select * from #{name}"` 34 | | end 35 | | end 36 | 37 | -------------------------------------------------------------------------------- /misc/old/presentations/potential/ruby_development.deck: -------------------------------------------------------------------------------- 1 | > Show eval'ing code 2 | 3 | 4 | > Show navigating files 5 | 6 | 7 | > Show running shell commands 8 | 9 | - using as+upper 10 | - do with manual rspec class for small project 11 | 12 | 13 | > Output log 14 | 15 | Ol.line 16 | 17 | 18 | -------------------------------------------------------------------------------- /misc/old/presentations/potential/ui_prototyping.deck: -------------------------------------------------------------------------------- 1 | > Type the interface 2 | 3 | - When your UI is just text 4 | - you can type the UI 5 | 6 | 7 | > Examples 8 | 9 | - Create an email UI... 10 | 11 | email/ 12 | 13 | 14 | > Stand-alone js component 15 | 16 | @standalone/ 17 | - Inbox/ 18 | - 4:02pm Steve, Hello/ 19 | - 10:31am Sam, Late for work/ 20 | - 10:03am Sam, Late for breakfast/ 21 | - Sent/ 22 | - 10:07am Sam, Get a poptart/ 23 | - Compose/ 24 | 25 | 26 | > Node.js server 27 | 28 | @serve/ 29 | - San Francisco/ 30 | - 415/ 31 | - 310/ 32 | - 510/ 33 | - Mountain View/ 34 | - 408/ 35 | - 650/ 36 | 37 | 38 | > Code 39 | - Add code later 40 | 41 | area codes/ 42 | - San Francisco/ 43 | - 94117/ 44 | - 94116/ 45 | - 94109/ 46 | - Mountain View/ 47 | - 94041/ 48 | - 94042/ 49 | 50 | 51 | -------------------------------------------------------------------------------- /misc/old/presentations/potential/web_dev.deck: -------------------------------------------------------------------------------- 1 | > already covered in main presentation? 2 | dom 3 | 4 | 5 | -------------------------------------------------------------------------------- /misc/old/presentations/potential/web_development.deck: -------------------------------------------------------------------------------- 1 | > Explore 2 | 3 | web development/ 4 | 5 | 6 | > Blink 7 | 8 | js/$('p').blink() 9 | 10 | 11 | -------------------------------------------------------------------------------- /misc/old/presentations/potential/wiki.deck: -------------------------------------------------------------------------------- 1 | > Wiki syntax 2 | 3 | - Format happens as you type 4 | 5 | 6 | > Wiki syntax 7 | 8 | - Format happens as you type 9 | - wysiwyg wiki 10 | 11 | 12 | > Syntaxes 13 | 14 | >> Subheadings 15 | 16 | - bullets 17 | - bullets 18 | 19 | Highlighting ~words~ 20 | 21 | 22 | > Syntaxes 23 | 24 | - exclamation at end! 25 | 26 | - label: hey 27 | 28 | google/ 29 | - label) hey 30 | 31 | 32 | > "Pretend like it's there" 33 | 34 | - like wiki's 35 | 36 | 37 | > "Pretend like it's there" 38 | 39 | - creating files and dirs 40 | 41 | 42 | > "Pretend like it's there" 43 | 44 | - creating db records and tables 45 | 46 | -------------------------------------------------------------------------------- /misc/old/presentations/presentations.deck: -------------------------------------------------------------------------------- 1 | > Make slides 2 | 3 | - /tmp/ 4 | - fake_presentation.notes 5 | 6 | - Create some slides... 7 | 8 | 9 | > Make slides 10 | 11 | - /tmp/ 12 | - fake_presentation.notes 13 | 14 | - key shortcuts: left and right arrow keys 15 | 16 | 17 | > Make bullets appear 18 | 19 | - /tmp/ 20 | - fake_presentation.notes 21 | 22 | - Create a few slides 23 | - with subtle differences 24 | 25 | -------------------------------------------------------------------------------- /misc/old/presentations/rails_development.deck: -------------------------------------------------------------------------------- 1 | > Generate app 2 | 3 | - Make app, generate scaffold, view page... 4 | 5 | /tmp/rails1/ 6 | @rails 7 | 8 | 9 | > Edit files 10 | 11 | - Show files... 12 | 13 | 14 | > Re-play requests 15 | 16 | - key: enter+last+visit 17 | 18 | visits/turtles/swim?a=aa&b=bb 19 | 20 | - replays request in browser 21 | 22 | 23 | > Re-play requests 24 | 25 | visits/turtles/swim?a=aa&b=bb 26 | 27 | - generate a test from the request 28 | 29 | 30 | -------------------------------------------------------------------------------- /misc/old/presentations/search_key_shortcuts.deck: -------------------------------------------------------------------------------- 1 | > Overview 2 | 3 | - Keyboard shortcuts to do during searches 4 | 5 | search+delete 6 | 7 | 8 | > Moving stuff around 9 | 10 | search+value 11 | search+pull 12 | search+enter 13 | 14 | 15 | > Remembering for later 16 | 17 | search+have+todo 18 | search+have+nav 19 | 20 | 21 | > Searching 22 | 23 | search+bookmark 24 | search+todo 25 | search+just+diffs 26 | just+todo 27 | 28 | 29 | > Selection 30 | 31 | search+word 32 | search+usurp 33 | search+yank 34 | search++ 35 | search+- 36 | 37 | 38 | -------------------------------------------------------------------------------- /misc/old/presentations/simplest_possible_ui.deck: -------------------------------------------------------------------------------- 1 | > Intro 2 | 3 | Xiki Screencast 4 | - Topic: Simplest possible user interface 5 | 6 | 7 | > Intro 8 | 9 | Xiki Screencast 10 | - Topic: Simplest possible user interface 11 | 12 | http://xiki.org 13 | - Like a shell terminal but better 14 | 15 | 16 | > Example 17 | 18 | 19 | 20 | > End 21 | 22 | 23 | 24 | > Hints 25 | >> Example 26 | 27 | class Clam 28 | def self.hi 29 | "heyy" 30 | end 31 | end 32 | 33 | Clam/ 34 | - .hi/ 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /misc/old/presentations/svg.deck: -------------------------------------------------------------------------------- 1 | > Demo 2 | 3 | svg 4 | 5 | 6 | -------------------------------------------------------------------------------- /misc/old/presentations/testing.deck: -------------------------------------------------------------------------------- 1 | > One-liner 2 | 3 | - Run in left bar: 4 | Foo.add(1, 2).should == 3 5 | 6 | >> 7 | class Foo 8 | def self.add a, b 9 | 3 10 | end 11 | end 12 | 13 | 14 | > Run in-place 15 | 16 | - key: do+as+test 17 | 18 | 19 | > Tests menus 20 | 21 | - explore, run, navigate... 22 | 23 | 24 | > Add to the left bar 25 | 26 | - key: as+todo 27 | 28 | 29 | -------------------------------------------------------------------------------- /misc/old/presentations/the_end.deck: -------------------------------------------------------------------------------- 1 | > The End 2 | 3 | - follow: twitter.com/xiki 4 | - will tweet about screencasts 5 | 6 | - If you liked presentation 7 | - Add comments on meetup.com page 8 | 9 | - Pair 10 | - Willing to meet and pair with anyone 11 | 12 | - Looking for other venus to present Xiki 13 | - Know of any? -------------------------------------------------------------------------------- /misc/old/presentations/type_something_and_double_click.deck: -------------------------------------------------------------------------------- 1 | > Just type something 2 | 3 | - Type anything, then double-click 4 | 5 | 6 | > Just type something 7 | 8 | - Type anything, then double-click 9 | 10 | mysql 11 | 12 | 13 | > Just type something 14 | 15 | - Type anything, then double-click 16 | 17 | - If not there 18 | 19 | 20 | > Just type something 21 | 22 | - Type anything, then double-click 23 | 24 | - If not there 25 | - may suggest where to go 26 | 27 | databases 28 | 29 | 30 | > Just type something 31 | 32 | - Type anything, then double-click 33 | 34 | - If not there 35 | - may suggest where to go 36 | 37 | images 38 | 39 | 40 | > Just type something 41 | 42 | - Type anything, then double-click 43 | 44 | - If not there 45 | - make it suggest where to go 46 | 47 | 48 | > Just type something 49 | 50 | - Type anything, then double-click 51 | 52 | - If not there 53 | - make it suggest where to go 54 | 55 | graphics 56 | 57 | 58 | -------------------------------------------------------------------------------- /misc/old/presentations/web_browser.deck: -------------------------------------------------------------------------------- 1 | > Run html 2 | 3 | html/ 4 | |
5 | |

6 | | Info 7 | |

8 | |

9 | | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 10 | |

11 | |
12 | 13 | html/ 14 | - div/ 15 | - h1/Info 16 | - p/lorem ipsum... 17 | 18 | 19 | > Run CSS 20 | 21 | css 22 | 23 | 24 | > Run javascript 25 | 26 | js/alert('hi') 27 | 28 | js/ 29 | | $('div').toggle(1000) // Type some javascript here (to run in the browser) 30 | 31 | 32 | > Dom 33 | 34 | dom 35 | 36 | 37 | > Id's 38 | 39 | html/ 40 | |
41 | |

42 | | Info 43 | |

44 | |

45 | | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 46 | |

47 | |
48 | 49 | blink/#head 50 | 51 | 52 | > Id's 53 | 54 | #head 55 | 56 | ids 57 | -------------------------------------------------------------------------------- /misc/old/presentations/xiki_command.deck: -------------------------------------------------------------------------------- 1 | > Demo 2 | 3 | - Demo in shell console... 4 | 5 | $ xiki 6 | 7 | 8 | > Implementation 9 | 10 | - Caches loaded classes for speed 11 | - Process 12 | - Pipes 13 | 14 | 15 | > Purpose 16 | 17 | - So Xiki menus can be used from other apps 18 | - Vim? 19 | - Sublime? 20 | - Rubymine? 21 | -------------------------------------------------------------------------------- /misc/old/presentations/xiki_url.deck: -------------------------------------------------------------------------------- 1 | > Demo 2 | 3 | - Demo in browser... 4 | 5 | http://xiki 6 | 7 | 8 | > Implementation 9 | 10 | - Shells out to xiki command, for speed 11 | - Apache virtual host 12 | - /etc/hosts 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/shell_wrappers/docker.rb: -------------------------------------------------------------------------------- 1 | shell_command = options[:shell_command] 2 | 3 | # $ docker, so just decorate the output... 4 | 5 | if shell_output = options[:shell_output] 6 | 7 | if shell_command == "docker help" 8 | shell_output.gsub! /^\| (\w)/, ": \\1" 9 | return 10 | end 11 | 12 | return shell_output.gsub! /^\|( +(images|ps) +)/, ":\\1" 13 | end 14 | 15 | item = args[0][/^\| (\w+)/, 1] 16 | 17 | # $ docker help, so invoke help... 18 | 19 | if shell_command == "docker help" 20 | return Shell.command("docker help #{item}").gsub(/^/, "| ") 21 | end 22 | 23 | # $ docker/: foo, so just run it 24 | 25 | if shell_command == "docker" && args.length == 1 26 | return Shell.command("docker #{item}").gsub(/^/, ": ") 27 | end 28 | 29 | -------------------------------------------------------------------------------- /misc/shell_wrappers/foo.rb: -------------------------------------------------------------------------------- 1 | # Let's say a command looks like this: 2 | # $ foo 3 | # : bar 4 | # : bah 5 | # 6 | # If a user expands bah, then the args variable will 7 | # contain [": bah"], so this block will be run: 8 | 9 | if args == [": bah"] 10 | # Just return a string, to insert it underneath. 11 | return ": ram\n: ewe" 12 | end 13 | 14 | # Then the command looks like this: 15 | # $ foo 16 | # : bar 17 | # : bah 18 | # : ram 19 | # : ewe 20 | # 21 | # If a user later expands ewe, args will contain 22 | # [": bah", ": ewe"]. 23 | 24 | if args == [": bah", ": ewe"] 25 | return ": what did you say?" 26 | end 27 | 28 | # Return something if they expanded any other item 29 | ": You expanded #{args[-1]}" 30 | -------------------------------------------------------------------------------- /misc/shell_wrappers/rails.rb: -------------------------------------------------------------------------------- 1 | command = options[:shell_command] 2 | 3 | return "<$ #{args.last}" if args.last =~ /^\$ / 4 | 5 | dir = options[:dir] 6 | 7 | if args[0] =~ /^: generate / 8 | return Shell.sync("rails generate", :dir=>dir).gsub(/^/, ': ') if ! args[1] 9 | if args[1] =~ /^: model/ 10 | return "+ examples/\n"+Shell.sync("rails generate model", :dir=>dir).gsub(/^/, ': ') if ! args[2] 11 | return "$ rails generate model foo name:string details:text quantity:integer price:decimal delivery:boolean purchased_at:datetime" if args[2] == "examples" 12 | end 13 | 14 | end 15 | 16 | ["console", "server", "dbconsole"].each do |arg| 17 | if args[1] =~ /^: #{arg} / 18 | Shell.async("rails #{arg}", :dir=>dir) 19 | return "" 20 | end 21 | end 22 | 23 | "- This line isn't recognized" 24 | -------------------------------------------------------------------------------- /misc/snippets/html.xiki: -------------------------------------------------------------------------------- 1 | jquery/ 2 | | 3 | mobile/ 4 | | 5 | | 6 | dotsies css/ 7 | | 8 | -------------------------------------------------------------------------------- /misc/snippets/notes.xiki: -------------------------------------------------------------------------------- 1 | - Wiki elements/ 2 | - Heading: 3 | | > Foo 4 | - Bullets: 5 | | - Foo 6 | | - bar 7 | - Shell commands/ 8 | - In current dir: 9 | | $ ls 10 | - In specific dir: 11 | | /tmp/ 12 | | $ ls 13 | > Async 14 | - In any visible shell: 15 | | % ls 16 | - Shell in specific dir: 17 | | /tmp/ 18 | | % ls 19 | - In iTerm: 20 | | & ls 21 | -------------------------------------------------------------------------------- /misc/snippets/rb.xiki: -------------------------------------------------------------------------------- 1 | - files/ 2 | - read/ 3 | | File.read "/tmp/t.txt" 4 | - write/ 5 | | File.open("/tmp/t.txt", "w") { |f| f << "abc" } 6 | - class/ 7 | | class Foo 8 | | def self.foo 9 | | "hi" 10 | | end 11 | | end 12 | - methods/ 13 | - instance/ 14 | | def foo 15 | | "hi" 16 | | end 17 | - class/ 18 | | def self.foo 19 | | "hi" 20 | | end 21 | - decisions/ 22 | - case/ 23 | | case a 24 | | when /^a-z*$/; puts "Lower case\n" 25 | | when /^A-Z*$/; puts "Upper case\n" 26 | | else; puts "Mixed case\n" 27 | | end 28 | - specs/ 29 | - describe/ 30 | | describe Line, "#foo" do 31 | | it "bars" do 32 | | 1.should == 2 33 | | end 34 | | end 35 | - it/ 36 | | it "bars" do 37 | | 1.should == 2 38 | | end 39 | -------------------------------------------------------------------------------- /misc/themes/Default.xiki: -------------------------------------------------------------------------------- 1 | module Xiki 2 | Themes.use 'Rainbow Fonts' 3 | Themes.use "Bottom Bar Items" # Long complicated elisp that draws text 4 | 5 | # Put this last, since it changes the bar, and will thus fix the control lock color 6 | Themes.use "Bottom Bar Styles" # Styles 7 | 8 | end 9 | 10 | $el.tool_bar_mode -1 if Xiki::Environment.gui_emacs 11 | 12 | $el.el4r_lisp_eval %` 13 | (progn 14 | (custom-set-variables 15 | '(tabbar-mode nil) ; No tabs 16 | ) 17 | (set-face-attribute 'region nil :background "#333333") ;; More mac-like selection color 18 | 19 | (setq-default 20 | frame-title-format 21 | '("%b")) 22 | (setq frame-title-format '("%b" )) 23 | ) 24 | ` 25 | -------------------------------------------------------------------------------- /misc/themes/Rainbow_Fonts.xiki: -------------------------------------------------------------------------------- 1 | module Xiki 2 | if Styles.dark_bg? 3 | Styles.define :link, :fg=>"#09c" 4 | Styles.define :font_lock_builtin_face, :fg=>'#77b' # purple 5 | Styles.define :font_lock_comment_face, :fg=>'#777' # gray 6 | Styles.define :font_lock_function_name_face, :fg=>'f50' # orange 7 | Styles.define :font_lock_type_face, :fg=>'0a1' # green 8 | Styles.define :font_lock_variable_name_face, :fg=>'cc0' # yellow 9 | 10 | Styles.define :font_lock_string_face, :fg=>'97f' # blueer purple 11 | Styles.define :font_lock_keyword_face, :fg=>'999' 12 | 13 | else 14 | Styles.define :font_lock_comment_face, :fg=>'aaa' # gray 15 | Styles.define :font_lock_function_name_face, :fg=>'f50' # orange 16 | Styles.define :font_lock_type_face, :fg=>'090', :bold=>nil # green 17 | Styles.define :font_lock_variable_name_face, :fg=>'00c', :bold=>1 # yellow 18 | Styles.define :font_lock_string_face, :fg=>'e10', :bold=>nil # red 19 | Styles.define :font_lock_keyword_face, :fg=>'888', :bold=>1 # blue 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /misc/vim/vim_status.notes: -------------------------------------------------------------------------------- 1 | > Try it out 2 | - 1) Add this line, and then restart vim 3 | ~/.vimrc 4 | | let $XIKI_DIR = "[xiki dir]" 5 | | source [xiki dir]/etc/vim/xiki.vim 6 | 7 | - 2) Type "ip" on a blank line and double-click on it 8 | 9 | 10 | > If your vim version doesn't have ruby enabled 11 | The standard macvim download has the ruby. Compile vim with the --enable-rubyinterp flag installed. 12 | 13 | 14 | > What's implemented 15 | Just double-clicking on one line and shelling out to 'xiki' 16 | and inserting the results 17 | 18 | 19 | > What needs to be implemented 20 | - Making this work for nested paths, like: 21 | docs/ 22 | - faq/ 23 | - It needs to climb the path and pass it in to the command 24 | - Making it collapse when the line underneath it is indented lower 25 | - Making it incrementally search after commands are inserted 26 | - is there a command in vim to read 1 char from the user? 27 | 28 | 29 | > Help out 30 | Join the xiki google group if you want to help implement this. 31 | 32 | If you're in the bay area, hit me up and we can meet at a coffee shop and pair on wraping it up! 33 | -------------------------------------------------------------------------------- /misc/vim/xiki.vim: -------------------------------------------------------------------------------- 1 | function! XikiLaunch() 2 | ruby << EOF 3 | 4 | xiki_dir = ENV['XIKI_DIR'] 5 | ['core/ol', 'vim/line', 'vim/tree'].each {|o| load "#{xiki_dir}/lib/xiki/#{o}.rb"} 6 | include Xiki 7 | 8 | line = Line.value 9 | next_line = Line.value 2 10 | 11 | indent = line[/^ +/] 12 | command = "xiki '#{line}'" 13 | result = `#{command}` 14 | Tree << result 15 | EOF 16 | endfunction 17 | 18 | imap <2-LeftMouse> :call XikiLaunch()i 19 | nmap <2-LeftMouse> :call XikiLaunch() 20 | imap :call XikiLaunch()i 21 | nmap :call XikiLaunch() 22 | imap :call XikiLaunch()i 23 | nmap :call XikiLaunch() 24 | 25 | -------------------------------------------------------------------------------- /misc/www/index.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | print "Content-type: text/html\n\n"; 4 | 5 | require "../../lib/xiki/ol.rb" 6 | require "web_server" 7 | require "cgi" 8 | WebServer.index 9 | -------------------------------------------------------------------------------- /misc/www/public/error.html: -------------------------------------------------------------------------------- 1 | 35 | 36 |
37 |

Start the Xiki web interface!

38 | 39 |

40 | Type "xiki web/start" in your shell console. 41 |

42 |

43 | Or, if you have a Xiki-enabled text editor, 44 | type "web/start" on a blank line and double-click on it. 45 |

46 | 47 |
48 | -------------------------------------------------------------------------------- /misc/www/sinatra_control.rb: -------------------------------------------------------------------------------- 1 | require "/projects/xiki/lib/xiki/core/ol.rb" 2 | Ol() 3 | 4 | require 'rubygems' 5 | require 'daemons' 6 | 7 | # Temp 8 | 9 | pwd = Dir.pwd 10 | Ol "pwd", pwd 11 | Ol RUBY_VERSION 12 | 13 | result = Daemons.run_proc('xiki_web', {:dir_mode=>:normal, :dir=>"/tmp/", :log_output=>true}) do 14 | Dir.chdir(pwd) 15 | exec "ruby xiki_web_server.rb" 16 | end 17 | 18 | result 19 | -------------------------------------------------------------------------------- /misc/xiki.org/demo.notes: -------------------------------------------------------------------------------- 1 | $ cat foo.txt 2 | | Run shell commands 3 | 4 | /tmp/ 5 | - Navigate_files.txt 6 | 7 | puts "Eval" + " code" 8 | Eval code 9 | 10 | tables/ 11 | - my_table/ 12 | | id description 13 | | 1 Browse databases 14 | -------------------------------------------------------------------------------- /misc/xiki.org/demo2.notes: -------------------------------------------------------------------------------- 1 | > Headings 2 | - bullet 3 | - points 4 | 5 | 6 | > Notes about commands 7 | $ df 8 | | /dev/disk1 42% / 9 | - notes about output: 10 | | /dev/disk2 96% /vol/Reef 11 | -------------------------------------------------------------------------------- /misc/xiki.org/demo3.notes: -------------------------------------------------------------------------------- 1 | foo/ 2 | | There's no "foo" menu yet. 3 | | Create it? You can start by 4 | | adding items right here, or 5 | | you can create a class. 6 | <= @menu/create/here/ 7 | <= @menu/create/class/ 8 | <= @menu/install/gem/ 9 | -------------------------------------------------------------------------------- /roots/address_book.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class AddressBook 3 | def self.names 4 | names = Applescript.run "get the name of every person as string", :app=>"address book", :delimiter=>"|" 5 | names.sub! /\A"/, '' 6 | names.sub! /"\z/, '' 7 | names.split "|" 8 | end 9 | 10 | def self.menu key=nil 11 | return self.names.map{|o| "#{o}/"} if key.nil? 12 | 13 | # Clean up a bit 14 | # Broken by crap implementation of (do-applescript in emacs 23 that returns fucking "true" instead of the data) 15 | # Emacs 22 implementation returned data structure as text - is there a way to force that in applescript? 16 | txt = Applescript.run "get vcard of people whose name is \"#{key}\"", :delimiter=>"|", :app=>"address book" 17 | 18 | txt.gsub! /, /, "\n" 19 | txt.gsub! /:/, ": " 20 | txt = txt.split("\n").select{|o| o !~ /^"\}|missing value|END: VCARD|VERSION: 3.0|BEGIN: VCARD/}.join("\n") 21 | txt.sub!(/^PRODID:.+\n/, "") 22 | txt.gsub! /^/, "| " 23 | txt.gsub! /;+/, " " 24 | txt.gsub!(/ +$/, "") 25 | 26 | txt 27 | end 28 | 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /roots/all.rb: -------------------------------------------------------------------------------- 1 | all = Xiki::Command.completions 2 | all.map{|o| "<< #{o}/\n"}.join("") 3 | -------------------------------------------------------------------------------- /roots/amazon.rb: -------------------------------------------------------------------------------- 1 | line = args[0] 2 | 3 | # If no arg, prompt to type something 4 | 5 | return "=prompt/Type something to search on amazon" if ! line 6 | 7 | # If arg, look it up 8 | 9 | line = CGI.escape line 10 | 11 | Firefox.url "http://www.amazon.com/s?field-keywords=#{line}" 12 | nil 13 | -------------------------------------------------------------------------------- /roots/animals.menu: -------------------------------------------------------------------------------- 1 | - pets/ 2 | - dogs/ 3 | - labs/ 4 | > Summary 5 | Super nice. Tongue usually hangs out. Long hair. 6 | 7 | Enjoy fetching things. Pretty much anything will do. 8 | - pit bulls/ 9 | =bootstrap/ 10 | - project name/Pit Bulls 11 | - hero/ 12 | - h1/Pit Bulls 13 | - p/The best dog you'll ever own, that could kill you. 14 | - row/ 15 | - span6/ 16 | - h1/ 17 | - Facts 18 | - p/This is some stuff. 19 | - span6/ 20 | - h1 icon/random 21 | - p/dolor sit lorem... 22 | - cats/ 23 | - persian/ 24 | | meow 25 | - siamese/ 26 | | meow 27 | - wild/ 28 | - lions/ 29 | | growl 30 | - tigers/ 31 | | growl 32 | - bears/ 33 | | oh my 34 | - bugs/ 35 | - spiders/ 36 | | go web 37 | -------------------------------------------------------------------------------- /roots/apache.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Apache 3 | MENU = %` 4 | - .restart/ 5 | - .control/ 6 | - .restart/ 7 | - stop/ 8 | ! Shell.run "sudo apachectl stop", :dir=>"/etc/apache2/" 9 | - start/ 10 | ! Shell.run "sudo apachectl start", :dir=>"/etc/apache2/" 11 | - conf/ 12 | @/etc/apache2/ 13 | + other/ 14 | + httpd.conf 15 | - logs/ 16 | =/var/log/apache2/ 17 | % tail -f error_log 18 | % tail -f access_log 19 | ` 20 | 21 | def self.restart 22 | Shell.run "sudo apachectl restart", :dir=>"/etc/apache2/" 23 | 24 | # "- restarting!" 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /roots/append.rb: -------------------------------------------------------------------------------- 1 | Applescript.exec("Firefox", "activate") if Keys.prefix_u 2 | 3 | return " 4 | |

Type html here

5 | |

To append to the browser

6 | " if args.blank? 7 | 8 | return "=beg/quoted/" if args[0] !~ /\n/ 9 | 10 | Firefox.append args[0] 11 | -------------------------------------------------------------------------------- /roots/applications.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Shows each OS X app, and lets you launch them. 3 | # 4 | class Applications 5 | def self.menu name=nil 6 | 7 | if ! name 8 | txt = Dir.new("/Applications/").entries.select{|o| o =~ /\.app$/}.map{|o| "#{o[/(.+)\.app$/, 1]}/"} 9 | return txt 10 | end 11 | 12 | Shell.sync "open \"/Applications/#{name}.app\"" 13 | nil 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /roots/bash.rb: -------------------------------------------------------------------------------- 1 | # /, so tell them to run stuff 2 | 3 | if args == [] 4 | return " 5 | | # Put some bash code here to run it 6 | | echo 'something' 7 | | echo 'something else' 8 | " 9 | end 10 | 11 | # tasks+, so show items 12 | 13 | return " 14 | * run as script 15 | * run in bash 16 | " if task == [] 17 | 18 | return DiffLog.quit_and_run args[0] if task == ["run in bash"] 19 | 20 | txt = args[0] 21 | txt.gsub!(/^\$ /, '') 22 | 23 | if task == ["run as script"] 24 | # Save to script and run 25 | File.open("/tmp/tmp.bash", "w") { |f| f << txt } 26 | DiffLog.quit_and_run "bash /tmp/tmp.bash" 27 | end 28 | 29 | # /code, so run it 30 | 31 | File.open("/tmp/bash.sh", "w") { |f| f << txt } 32 | txt = Shell.command "bash /tmp/bash.sh"#, :stdin=>"foo" 33 | Tree.quote txt 34 | 35 | -------------------------------------------------------------------------------- /roots/black.menu: -------------------------------------------------------------------------------- 1 | ! Xiki["themes/Dark Black BG/"] 2 | ! nil 3 | -------------------------------------------------------------------------------- /roots/black.rb: -------------------------------------------------------------------------------- 1 | Xiki["themes/list/Dark Black BG/"] 2 | nil 3 | -------------------------------------------------------------------------------- /roots/blink.rb: -------------------------------------------------------------------------------- 1 | # Doesn't add jquery - borrow from @dom 2 | 3 | return "=prompt/type a jquery selector here" if args.empty? 4 | 5 | selector = args.join("/").sub(/^\| /, '') 6 | Firefox.blink selector 7 | -------------------------------------------------------------------------------- /roots/brew.menu: -------------------------------------------------------------------------------- 1 | - before each use/ 2 | =% brew update 3 | - refetch if problems/ 4 | =/usr/local/ 5 | % git fetch origin 6 | % git reset --hard origin/master 7 | - doctor, to detect problems/ 8 | =% brew doctor 9 | - install/ 10 | =% brew install coffeescript 11 | - list/ 12 | ! Tree.quote Shell.sync "brew list" 13 | - setup/ 14 | - make sure things are ok/ 15 | =% brew doctor 16 | - files/ 17 | =/usr/local/Cellar/ 18 | =notes/ 19 | -------------------------------------------------------------------------------- /roots/browser/default.conf: -------------------------------------------------------------------------------- 1 | | Web browser to use. Optionally change "firefox" to "chrome". 2 | browser: firefox 3 | -------------------------------------------------------------------------------- /roots/browser/menu.menu: -------------------------------------------------------------------------------- 1 | - url/ 2 | ! return " Keys 19 | | do+load+browser: Reload the browser. 20 | | 21 | > See 22 | | Many things have yet to be pulled out of firefox.rb and made generic. 23 | << firefox/ 24 | -------------------------------------------------------------------------------- /roots/chmod.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Chmod 3 | def self.menu mode=nil 4 | 5 | path = Tree.closest_dir yield[:ancestors] 6 | 7 | return "| Nest this menu under a file, like...\n|\n| /tmp/\n| @chmod/" if ! path 8 | 9 | if ! mode 10 | base_10_number = File.stat(path).mode rescue 33188 11 | Ol "base_10_number", base_10_number 12 | mode = sprintf("%o", base_10_number)[/...$/] 13 | return " 14 | - executable) 755/ 15 | - normal) 644/ 16 | - only owner) 600/ 17 | - unrestricted) 777/ 18 | - original) #{mode}/ 19 | " 20 | end 21 | 22 | # Arg passed, so do chmod 23 | 24 | command = "chmod #{mode} \"#{path}\"" 25 | if ! File.writable? path 26 | command = "sudo #{command}" 27 | Shell.run command, :dir=>path 28 | return 29 | end 30 | 31 | Shell.sync command, :dir=>path 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /roots/chown.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Chown 3 | def self.menu user_group=nil 4 | 5 | path = Tree.file :require=>1 6 | 7 | if ! user_group 8 | 9 | user = Etc.getpwuid(File.stat(path).uid).name 10 | group = Etc.getgrgid(File.stat(path).gid).name 11 | user_group = "#{user}:#{group}" 12 | 13 | default_user = `id -un`.strip 14 | default_group = `id -gn`.strip 15 | 16 | return " 17 | - original) #{user_group}/ 18 | > Suggestions 19 | - #{default_user}:#{default_group}/ 20 | - root:wheel/ 21 | " 22 | end 23 | 24 | # Arg passed, so do chown 25 | 26 | command = "chown #{user_group} \"#{path}\"" 27 | command = "sudo #{command}" # Trickier with user, so just always sudo for now 28 | 29 | Shell.run command, :dir=>path 30 | 31 | end 32 | 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /roots/cla.rb: -------------------------------------------------------------------------------- 1 | class Cla 2 | def self.menu *args 3 | Line.delete 4 | 5 | txt = " 6 | class 7 | def self.hi 8 | \"hi\" 9 | end 10 | end 11 | ".unindent 12 | 13 | View.insert txt, :dont_move=>1 14 | Move.to_end 15 | ControlLock.disable 16 | 17 | nil 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /roots/clojure/default.conf: -------------------------------------------------------------------------------- 1 | > Clojure jar 2 | 3 | 4 | > Put your remote repl paths here 5 | foo.com:8001 6 | -------------------------------------------------------------------------------- /roots/close.rb: -------------------------------------------------------------------------------- 1 | View.kill 2 | -------------------------------------------------------------------------------- /roots/close_view.rb: -------------------------------------------------------------------------------- 1 | View.kill 2 | -------------------------------------------------------------------------------- /roots/code.rb: -------------------------------------------------------------------------------- 1 | Xiki["ruby/", options] 2 | -------------------------------------------------------------------------------- /roots/coffee.rb: -------------------------------------------------------------------------------- 1 | # Handle tasks 2 | 3 | return "* compile" if task == [] 4 | if task == ["compile"] 5 | return Tree.quote Shell.command "coffee -c --stdio", :stdin=>args[0] 6 | end 7 | 8 | # /, so show message... 9 | 10 | return " 11 | | # Type some coffeescript here 12 | | console.log 'hi' 13 | " if args == [] 14 | 15 | # /code, so execute it... 16 | 17 | # If coffeescript not installed, give them "gem install" command... 18 | 19 | return " 20 | > First install coffeescript 21 | % gem install coffeescript 22 | " if `which coffee` == "" 23 | 24 | Tree.quote CoffeeHandler.eval args[0] 25 | 26 | -------------------------------------------------------------------------------- /roots/computer.menu: -------------------------------------------------------------------------------- 1 | = ip/ 2 | = disk/ 3 | = cpu/ 4 | = processes/ 5 | = network/ 6 | -------------------------------------------------------------------------------- /roots/copy.rb: -------------------------------------------------------------------------------- 1 | Xiki["`rename/", options.merge(:copy=>1)] 2 | -------------------------------------------------------------------------------- /roots/cpu.menu: -------------------------------------------------------------------------------- 1 | - processes taking up cpu/ 2 | ! Tree.quote `ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10` 3 | -------------------------------------------------------------------------------- /roots/cs.rb: -------------------------------------------------------------------------------- 1 | return " 2 | | # Type some coffeescript here, to run in the browser 3 | | alert 'hi' 4 | 5 | > See 6 | << coffee/ 7 | " if args.empty? 8 | 9 | return "=beg/quoted/" if args[0] !~ /\n/ 10 | 11 | txt = CoffeeScript.to_js args[0] 12 | Browser.js txt 13 | 14 | "<* ran in browser!" 15 | -------------------------------------------------------------------------------- /roots/curl.menu: -------------------------------------------------------------------------------- 1 | - headers/ 2 | =$ curl -i http://google.com 3 | | only headers 4 | =$ curl -I http://google.com 5 | - write to a file/ 6 | =$ curl http://www.yahoo.com -o y.txt 7 | | Use file from url as filename 8 | =$ curl http://www.yahoo.com -O 9 | - browser useragent/ 10 | =$ curl -A "Mozilla/5.0" http://microsoft.com 11 | - more/ 12 | - Chrome 12 in OSX 10.6/ 13 | =$ curl -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30" http://microsoft.com 14 | - iPhone/ 15 | =$ curl -A "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5" http://www.apple.com 16 | - IE 7/ 17 | =$ curl -A "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" http://www.apple.com 18 | =google/"curl -A" useragent 19 | -------------------------------------------------------------------------------- /roots/current.rb: -------------------------------------------------------------------------------- 1 | class Current 2 | def self.menu *name 3 | return "<< views/" 4 | Buffers.current *name 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /roots/databases.menu: -------------------------------------------------------------------------------- 1 | << mysql/ 2 | << memcache/ 3 | << mongodb/ 4 | << couch/ 5 | << riak/ 6 | << local storage/ 7 | -------------------------------------------------------------------------------- /roots/date.rb: -------------------------------------------------------------------------------- 1 | module Menu 2 | class Date 3 | 4 | MENU = %` 5 | - .short/ 6 | - see/ 7 | =calendar/ 8 | =time/ 9 | ` 10 | 11 | def self.menu_after out, *args 12 | 13 | if args == [] 14 | return "#{::Time.now.strftime("%B %-m, %Y")}\n#{out}" 15 | end 16 | 17 | # /..., so prepend time to top 18 | 19 | nil 20 | end 21 | 22 | def self.short 23 | "#{::Time.now.strftime("%Y-%m-%d")}" 24 | end 25 | 26 | 27 | end 28 | end 29 | 30 | 31 | # - local/ 32 | # ! Time.now.strftime("%l:%M:%S %p %Z") 33 | # - time zone/ 34 | # ! zone = args[0] 35 | # ! if ! zone 36 | # ! return ActiveSupport::TimeZone.us_zones.map(&:name).map{|o| "- #{o}/\n"}.join('') 37 | # ! end 38 | # ! 39 | # ! zone.sub! /^\| /, '' 40 | # ! t = Time.now.in_time_zone ActiveSupport::TimeZone.new(zone) 41 | # ! t.strftime("%l:%M:%S %p %Z") 42 | # - city/ 43 | # @google/what time is it in Chicago? 44 | -------------------------------------------------------------------------------- /roots/db.rb: -------------------------------------------------------------------------------- 1 | require "#{Xiki.dir}roots/couch.rb" 2 | 3 | class Db 4 | def self.create db 5 | Couch.create db 6 | end 7 | 8 | def self.menu db=nil, *args 9 | # If no args, output list 10 | return Couch.databases if db.nil? 11 | 12 | return Couch.docs db, *args 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /roots/dbs.rb: -------------------------------------------------------------------------------- 1 | Xiki['.mysql/dbs', args] 2 | -------------------------------------------------------------------------------- /roots/deck.menu: -------------------------------------------------------------------------------- 1 | - enable arrow keys/ 2 | ! Deck.enable_arrow_keys 3 | - docs/ 4 | - summary/ 5 | | Create a file with a ".deck" extension to create a lightweight 6 | | presentation. The left and right arrow keys will go back and forth 7 | | between the "slides". 8 | | 9 | | Make .deck files just like you make .xiki files, with sections divided 10 | | by headings ("> foo" lines). The sections behave like slides. Only one 11 | | section is shown at a time. 12 | - keys/ 13 | | Use these keys to go back and forth between slides: 14 | | - right+arrow+key: show next slide (hiding everything else) 15 | | - left+arrow+key: show next slide 16 | | - custom+reminder: jump to corresponding heading at end 17 | - hints/ 18 | | To create and show hints that correspond to a section, create a section 19 | | near the bottom of the file with the same heading but starting with 20 | | ">>" instead of ">" 21 | | 22 | | Then, type custom+reminder to jump back and forth. 23 | - to enable the deck keys in a .xiki file/ 24 | - type: do+keys+deck 25 | - or use) @deck/enable arrow keys/ 26 | -------------------------------------------------------------------------------- /roots/def.rb: -------------------------------------------------------------------------------- 1 | class Def 2 | def self.menu *args 3 | 4 | options = yield 5 | options[:no_slash] = 1 6 | Line.delete 7 | 8 | txt = %` 9 | def self. 10 | "hi" 11 | end 12 | `.unindent 13 | 14 | View.insert txt.gsub(/^/, ' '), :dont_move=>1 15 | Move.to_end 16 | 17 | "" 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /roots/deploy_el4r_gem.menu: -------------------------------------------------------------------------------- 1 | - rubygems.org page/ 2 | @http://rubygems.org/gems/trogdoro-el4r 3 | - 1. update version/ 4 | @/projects/trogdoro-el4r/ 5 | $ git stash 6 | - trogdoro-el4r.gemspec 7 | | version: 1.0. 8 | | date: 2012- 9 | - 2. build and deploy/ 10 | @/projects/trogdoro-el4r/ 11 | $ gem build trogdoro-el4r.gemspec 12 | % gem push trogdoro-el4r-1. 13 | $ git stash pop 14 | -------------------------------------------------------------------------------- /roots/deploy_xiki_gem.menu: -------------------------------------------------------------------------------- 1 | - gemcutter page/ 2 | @http://gemcutter.org/gems/xiki 3 | - 1. update version/ 4 | =%xiki/ 5 | $ git stash 6 | - xiki.gemspec 7 | | s.version = "0. 8 | | s.date = " 9 | | s.add_dependency('trogdoro-el4r', [">= 1.0. 10 | - 2. build and deploy/ 11 | =%xiki/ 12 | $ gem build xiki.gemspec 13 | % gem push xiki-0. 14 | $ git stash pop 15 | -------------------------------------------------------------------------------- /roots/des.rb: -------------------------------------------------------------------------------- 1 | class Des 2 | def self.menu *args 3 | 4 | options = yield 5 | options[:no_slash] = 1 6 | Line.delete 7 | 8 | txt = %` 9 | describe __, "#__" do 10 | it "__" do 11 | 1.should == 2 12 | end 13 | end 14 | `.unindent 15 | 16 | View.insert txt.gsub(/^/, ' '), :dont_move=>1 17 | Move.to_end 18 | 19 | nil 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /roots/desktop_image.rb: -------------------------------------------------------------------------------- 1 | # /, so give example... 2 | 3 | if args == [] 4 | return ' 5 | > Edit this svg and expand to set your desktop image 6 | | 7 | | 8 | | 9 | ' 10 | end 11 | 12 | # /svg code, so set it to desktop... 13 | txt = ' 14 | 15 | 16 | 17 | ' 18 | txt = args[0] 19 | 20 | xml = %` 21 | 22 | 23 | #{txt} 24 | 25 | `.strip 26 | 27 | tmp_path = "/tmp/tmp.svg" 28 | File.open(tmp_path, "w") { |f| f << xml } 29 | 30 | png = "/tmp/desktop#{rand 99999}.png" 31 | 32 | `convert #{tmp_path} #{png}` 33 | 34 | Applescript.run %` 35 | tell application "System Events" to set picture of every desktop to "#{png}" 36 | `.strip 37 | 38 | "<* set desktop" 39 | -------------------------------------------------------------------------------- /roots/dictionary.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Dictionary 3 | def self.menu word=nil 4 | return View.prompt('Type a word to look up') if word.nil? 5 | 6 | word = word.sub(/^\s+/, '').gsub('"', '%22').gsub(':', '%3A').gsub(' ', '%20') 7 | $el.browse_url "http://dictionary.reference.com/browse/#{word}" 8 | nil 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /roots/dimensions/default.conf: -------------------------------------------------------------------------------- 1 | > Custom dimensions 2 | Make your own items for the @dimensions menu. Use the same 3 | name as existing ones to over-ride. 4 | - bottom/ 5 | ! View.dimensions_set 0, 602, 146, 53 6 | - right/ 7 | ! View.dimensions_set 573, 22, 119, 57 8 | -------------------------------------------------------------------------------- /roots/dimensions/dimensions_index.menu: -------------------------------------------------------------------------------- 1 | + full 2 | ! # Normal 3 | ! View.dimensions_full 4 | + small 5 | ! View.dimensions_set 100, 22, 60, 20 6 | ! Styles.default_font_size 7 | ! nil 8 | + new window 9 | ! $el.new_frame 10 | ! X"themes/list/Default" 11 | ! View.dimensions_set 100, 22, 60, 20 12 | ! #Cursor.white 13 | + current/ 14 | ! " 15 | ! ! Styles.font_size #{Styles.get_font_size} 16 | ! ! View.dimensions_set #{$el.frame_parameter(nil, :left)}, #{$el.frame_parameter(nil, :top)}, #{View.frame_width}, #{View.frame_height} 17 | ! " 18 | -------------------------------------------------------------------------------- /roots/dir.rb: -------------------------------------------------------------------------------- 1 | "=" + Xiki.dir 2 | -------------------------------------------------------------------------------- /roots/directions.menu: -------------------------------------------------------------------------------- 1 | | 1. Change the above text. 2 | | 2. Double-click on the text to create the file, 3 | | thus creating the menu. 4 | | 3. Double-click on "fooo/" above to collapse, 5 | | then double-click again to expand your new menu. 6 | | Now you can type "fooo" on any blank line and 7 | | double-click it! 8 | -------------------------------------------------------------------------------- /roots/directory.rb: -------------------------------------------------------------------------------- 1 | Xiki.dir 2 | -------------------------------------------------------------------------------- /roots/docs.menu: -------------------------------------------------------------------------------- 1 | << help/ 2 | -------------------------------------------------------------------------------- /roots/echo.rb: -------------------------------------------------------------------------------- 1 | ancestors = options[:ancestors] 2 | menu_steps = ancestors && ancestors[-1] == "menu steps/" 3 | ancestors.pop if menu_steps 4 | 5 | options[:no_slash] = 1 6 | 7 | # / and no ancestors, so display message... 8 | 9 | if ! ancestors && args == [] 10 | return %` 11 | : The 'echo' menu is just for experimenting with how 12 | : paths work. Put some stuff underneath and expand them 13 | : to see the path. You'll see the value that's passed 14 | : into menus as the "path" variable. 15 | - a/ 16 | - b/ 17 | : 18 | <= options/ 19 | <= source/ 20 | ` 21 | end 22 | 23 | # =echo/foo, so use foo as the path... 24 | 25 | path = args.any? ? 26 | args.inspect : 27 | options[:ancestors].inspect 28 | 29 | # ancestors/=echo, so use ancestors... 30 | 31 | "| #{path}" 32 | -------------------------------------------------------------------------------- /roots/edited.rb: -------------------------------------------------------------------------------- 1 | # /, so show the list... 2 | 3 | files = DiffLog.file_list :tree_format=>1 4 | return "- No files edited recently in xsh" if files == [] 5 | 6 | txt = files.join "\n" 7 | -------------------------------------------------------------------------------- /roots/edits.rb: -------------------------------------------------------------------------------- 1 | class Edits 2 | def self.menu *args 3 | DiffLog.diffs *args 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /roots/effects.rb: -------------------------------------------------------------------------------- 1 | Xiki[Xiki::Effects, args, options] 2 | -------------------------------------------------------------------------------- /roots/elisp.rb: -------------------------------------------------------------------------------- 1 | # ~ or ~ manual, so handle 2 | 3 | return "* manual" if task == [] 4 | if task == ["manual"] 5 | $el.info "elisp" 6 | return "" 7 | end 8 | 9 | # /, so give sample lisp... 10 | 11 | return " 12 | | ; Provide some elisp to eval, like this 13 | | (set 'a 2) 14 | | (+ 1 a) 15 | " if args == [] 16 | 17 | # /code, so eval it... 18 | 19 | # Try inspecting by default 20 | result = $el.eval $el.read "(progn #{args[0]})" 21 | 22 | return if ! result 23 | 24 | result = $el.pp_to_string result 25 | 26 | Tree.quote result.to_s 27 | -------------------------------------------------------------------------------- /roots/emacs/index.menu: -------------------------------------------------------------------------------- 1 | - version/ 2 | ! Tree.quote $el.emacs_version 3 | - .info pages/ 4 | - Keys/ 5 | - Prefix Keymaps/ 6 | - Keymaps/ 7 | - Prefix Keymaps/ 8 | - modes/ 9 | ! Tree.quote $el.pp_to_string($el.elvar.auto_mode_alist) 10 | - lisp load-path dirs/ 11 | ! $el.elvar.load_path.to_a.map{|o| "=#{FileTree.add_slash_maybe o}\n"}.join('') 12 | -------------------------------------------------------------------------------- /roots/emacs/index.rb: -------------------------------------------------------------------------------- 1 | module Foo 2 | class Emacs 3 | def self.info_pages name 4 | View.to_upper 5 | $el.info "(emacs)#{name}" 6 | nil 7 | end 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /roots/emacs_config_tweaks/index.rb: -------------------------------------------------------------------------------- 1 | class EmacsConfigTweaks 2 | def self.menu_after output, item=nil, content=nil 3 | 4 | return if ! content # Do nothing unless content 5 | 6 | # /foo/|(content, so add it to .emacs... 7 | 8 | content = Tree.txt 9 | 10 | txt = File.read(File.expand_path("~/.emacs"), *Files.encoding_binary) 11 | 12 | # If already in .emacs, just say so... 13 | 14 | snippet_to_search_for = content.dup 15 | snippet_to_search_for.sub!(/\A;.+\n/, '') # Ignore comment 16 | if txt =~ /#{Regexp.escape snippet_to_search_for}/ 17 | return "- It appears part of this is already in your .emacs!" 18 | end 19 | 20 | # Add to the end of .emacs... 21 | 22 | txt.strip! 23 | txt << "\n\n#{content}" 24 | 25 | File.open(File.expand_path("~/.emacs"), "w") { |f| f << txt } 26 | 27 | # # If it was the "control lock" item, copy config file over as well 28 | # if item == "control lock" 29 | # emacs_d = File.expand_path("~/.emacs.d") 30 | # Dir.mkdir(emacs_d) if ! File.exists?(emacs_d) 31 | # FileUtils.cp "#{Xiki.dir}menu/emacs_config_tweaks/control-lock.el", emacs_d 32 | # end 33 | 34 | "<* added this to your .emacs!" 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /roots/emacs_setup/initrb_default.txt: -------------------------------------------------------------------------------- 1 | $LOAD_PATH << "{{xiki_dir}}lib/" 2 | require 'xiki' 3 | Xiki.init 4 | Xiki::KeyShortcuts.keys # Use default key shortcuts 5 | Xiki::Themes.use "Default" # Use xiki theme 6 | 7 | # Alternate configuration to just map Control+Return 8 | # (Comment out the KeyShortcuts.keys line above) 9 | # Xiki::KeyShortcuts.map_control_return 10 | 11 | -------------------------------------------------------------------------------- /roots/encoding.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Encoding 3 | MENU = " 4 | - .dos/ 5 | - .raw unix/ 6 | - .iso unix/ 7 | - .utf8/ 8 | - see/ 9 | <@ specials/ 10 | " 11 | 12 | def self.menu_after out, *args 13 | return if args.any? 14 | "- current: #{$el.elvar.buffer_file_coding_system.to_s}\n#{out}" 15 | end 16 | 17 | def self.dos 18 | $el.set_buffer_file_coding_system :dos 19 | "<* updated!" 20 | end 21 | 22 | def self.raw_unix 23 | $el.set_buffer_file_coding_system :unix 24 | "<* updated!" 25 | end 26 | 27 | def self.iso_unix 28 | $el.set_buffer_file_coding_system :iso_latin_1_unix 29 | "<* updated!" 30 | end 31 | 32 | def self.utf8 33 | $el.set_buffer_file_coding_system :mule_utf_8_unix 34 | "<* updated!" 35 | end 36 | 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /roots/example.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | # Wraps @eval, because "example" looks more appropriate 3 | # in some cases, like: 4 | # 5 | # foo/docs/counting/ 6 | # @example/ 7 | # | p "123" 8 | class Example 9 | def self.menu *args 10 | return "=beg/neighbors/" if args[-1] !~ /\n/ 11 | txt, out, exception = Code.eval args[-1].gsub(/^\| ?/, ''), :pretty_exception=>1 12 | return exception if exception 13 | Tree.quote out || txt 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /roots/expanders.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Expanders 3 | 4 | def self.menu *args 5 | 6 | # Grab parent subpath to parse and pre-expand 7 | 8 | options = yield 9 | ancestors = options[:ancestors] 10 | menu_steps = ancestors[-1] == "menu steps/" 11 | ancestors.pop if menu_steps 12 | 13 | path = ancestors.any? ? ancestors : options[:path] 14 | 15 | expanders_result = Expander.expanders path 16 | 17 | txt = self.ap expanders_result 18 | txt.gsub! /^ /, "" 19 | txt.sub! "[\n [", "[[" 20 | txt = Tree.quote txt, :char=>"|" 21 | 22 | txt 23 | end 24 | 25 | def self.ap txt 26 | txt = txt.ai 27 | txt.sub! /\A{\n/, '' 28 | txt.sub! /\n}\z/, '' 29 | txt 30 | end 31 | 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /roots/f.xiki: -------------------------------------------------------------------------------- 1 | << files/ 2 | -------------------------------------------------------------------------------- /roots/face/face_index.menu: -------------------------------------------------------------------------------- 1 | + complexion/ 2 | + light 3 | + medium 4 | + dark 5 | + eyes/ 6 | + brown 7 | + blue 8 | + hair/ 9 | + conservative 10 | + futuristic 11 | + unicorn 12 | + reset 13 | -------------------------------------------------------------------------------- /roots/face/face_index.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Face 3 | def self.menu part, value=nil 4 | txt = File.read("/tmp/face.yml") rescue "" 5 | hash = YAML::load(txt) || {} 6 | 7 | hash[part] = value if value 8 | hash = {} if part == "reset" 9 | File.open("/tmp/face.yml", "w") { |f| f << hash.to_yaml } 10 | 11 | html = " 12 | 13 | 14 | ".unindent 15 | hash.keys.sort.each{|key| html << " \n"} 16 | html << "" 17 | 18 | Browser.html html 19 | "" 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /roots/facts.rb: -------------------------------------------------------------------------------- 1 | Xiki["memorize", args, options] 2 | -------------------------------------------------------------------------------- /roots/faq.menu: -------------------------------------------------------------------------------- 1 | : What key shortcuts are like Ctrl+A, Ctrl+E and Ctrl+K in bash? 2 | | ^A ^A : Beginning of line 3 | | ^E ^E : End of line 4 | | ^K ^K : Kill line 5 | | 6 | : If the alt or option key is configured in your terminal... 7 | | You can do Alt+A, Alt+E, and Alt+K ("option" instead of "alt" 8 | | on the mac). 9 | | 10 | | You may need to configure your keyboard preferences in your 11 | | console app to make alt (or option) behave in the standard way. 12 | | The preference will be called something like "make alt behave 13 | | like escape+". 14 | | 15 | | 16 | : Why aren't there more questions in this faq? 17 | | It's a work in progress. More will be added later! 18 | | 19 | : How can I contribute to this faq? 20 | | Edit /roots/faq.menu, commit, and send a pull 21 | | request. 22 | | 23 | : What are the next steps for this readme file, to make it more accessible? 24 | | 1. Mirror to a markdown file 25 | | 2. Link to it from the README, so it'll be more visible 26 | | - https://help.github.com/articles/relative-links-in-readmes 27 | | 28 | -------------------------------------------------------------------------------- /roots/filter.rb: -------------------------------------------------------------------------------- 1 | # First, maybe find code that does "##" 2 | # and use =f instead? 3 | # (Make launcher use @f as special case if file tree.) 4 | class Filter 5 | def self.menu *args 6 | options = yield 7 | ancestors = options[:ancestors] 8 | 9 | # Stitch our args onto the ancestor before calling! 10 | ancestors[-1] << "#{args[1..-1].join('/')}/" if args.length > 1 11 | 12 | txt = Expander.expand ancestors 13 | 14 | return txt if args.length > 1 # If there were args, just echo through (filtering happened at higher level 15 | 16 | txt = txt.split("\n").select{|o| 17 | o.sub(/\A[ +-]+/, '') =~ /#{args[0]}/ || 18 | o =~ /#{args[0]}/i 19 | }.join("\n") 20 | 21 | txt 22 | 23 | # TODO > handle multiple filter args? 24 | 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /roots/font.menu: -------------------------------------------------------------------------------- 1 | << styles/ 2 | -------------------------------------------------------------------------------- /roots/foo.menu: -------------------------------------------------------------------------------- 1 | bar 2 | -------------------------------------------------------------------------------- /roots/gems.menu: -------------------------------------------------------------------------------- 1 | << gem/ 2 | -------------------------------------------------------------------------------- /roots/git_docs/index.rb: -------------------------------------------------------------------------------- 1 | class GitDocs 2 | def self.menu_after output, *args 3 | return if output # If menu outputted something do nothing 4 | 5 | # Menu didn't output, so we need to show manual entry 6 | command = args[-1] 7 | 8 | # Prepend"git-" (except for gitweb command) 9 | command = "git-#{command}" if ! ["gitweb", "gitk"].member? command 10 | 11 | txt = Shell.sync "man #{command}", :clean=>1 12 | 13 | txt.sub! /\n\n\n+/, "\n\n" # Remove first group of multiple linebreaks 14 | 15 | yield[:no_search] = 1 16 | Tree.quote txt 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /roots/google.rb: -------------------------------------------------------------------------------- 1 | require "cgi" 2 | 3 | module Xiki::Menu 4 | class Google 5 | def self.menu *args 6 | 7 | if args.empty? # If no path, pull from history 8 | return " 1 ? 14 | args.join("/") : args[0] 15 | 16 | if txt =~ /\n/ 17 | 18 | # Multi-line, so convert to single line... 19 | 20 | txt.gsub!("\n", " ") 21 | 22 | elsif txt =~ /^:/ 23 | txt.sub! /^: /, '' 24 | 25 | elsif Line !~ /google\// 26 | 27 | # Words not quoted (and not single "google/foo" line) so grab siblings... 28 | 29 | txt = Tree.siblings.join(" ") 30 | 31 | end 32 | 33 | Xiki::Google.search txt, :via_os=>(Keys.prefix_u ? nil : 1) 34 | 35 | nil 36 | end 37 | 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /roots/google_images.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class GoogleImages 3 | def self.menu *txt 4 | return View.prompt "Type something to google image search for" if txt.blank? 5 | txt = txt.join('/') 6 | txt = CGI.escape txt 7 | url = "https://www.google.com/search?tbm=isch&q=#{txt}" 8 | 9 | # If up+..., just return url 10 | return "@ #{url}" if Keys.up? 11 | 12 | Firefox.url url 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /roots/haml.rb: -------------------------------------------------------------------------------- 1 | module Xiki::Menu 2 | class Haml 3 | def self.menu *args 4 | 5 | return " 6 | > Type some HAML here to run it in your browser 7 | | %h1 Example 8 | | %table{style: 'width:100%;'} 9 | | %tr 10 | | %td Stuff in 11 | | %td Table cells 12 | " if args == [] 13 | 14 | txt = args[0] 15 | return "=beg/quoted/" if txt !~ /\n/ 16 | 17 | 18 | File.open("/tmp/tmp.haml", "w") { |f| f << txt } 19 | output = Shell.sync "haml /tmp/tmp.haml /tmp/tmp.html" 20 | 21 | if output.any? 22 | return Tree.quote output 23 | end 24 | 25 | File.open("/tmp/tmp.html", "a") { |f| f << Xiki::Html.default_css } 26 | 27 | # Then load in browser (or reload) 28 | Firefox.value('document.location.toString()') == "file:///tmp/tmp.html" ? 29 | Firefox.reload : 30 | $el.browse_url("file:///tmp/tmp.html") 31 | 32 | "<* Loaded in browser!" 33 | end 34 | end; end 35 | -------------------------------------------------------------------------------- /roots/handlers.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Handlers 3 | 4 | def self.menu *args 5 | 6 | # Grab parent subpath to parse and pre-expand 7 | 8 | options = yield 9 | ancestors = options[:ancestors] 10 | 11 | raise ": Nest this under another menu.\n<< all handlers/" if ! ancestors 12 | 13 | menu_steps = ancestors[-1] == "menu steps/" 14 | ancestors.pop if menu_steps 15 | 16 | path = ancestors.any? ? ancestors : options[:path] 17 | 18 | 19 | options_result = Expander.expanders path 20 | 21 | if options_result[:menufied] 22 | Command.climb_sources options_result 23 | end 24 | 25 | 26 | options_result_orig = options_result.dup 27 | 28 | Command.determine_handlers options_result 29 | 30 | options_result_orig.keys.each{|k| options_result.delete k} 31 | 32 | txt = self.ap options_result 33 | txt.gsub! /^ /, "" 34 | txt.sub! "[\n [", "[[" 35 | txt = Tree.quote txt, :char=>"|" 36 | 37 | txt << "<< all handlers/\n" 38 | 39 | txt 40 | 41 | end 42 | 43 | def self.ap txt 44 | txt = txt.ai 45 | txt.sub! /\A{\n/, '' 46 | txt.sub! /\n}\z/, '' 47 | txt 48 | end 49 | 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /roots/help.rb: -------------------------------------------------------------------------------- 1 | module Menu 2 | class Help 3 | 4 | def self.menu_after txt, *args 5 | options = yield 6 | options[:hotkey] = nil 7 | txt 8 | end 9 | 10 | MENU = %` 11 | | Welcome to xsh (Xiki Shell)! 12 | | 13 | | For the tutorial, type Ctrl+Q then "xsh --tutorial". 14 | | 15 | | For help with command line args, type Ctrl+Q to quit, then type 16 | | "xsh --help" back in your normal shell. Or expand it right here 17 | | (move your arrow keys to the following line and press Ctrl+O): 18 | | 19 | $ xsh --help 20 | | 21 | | Connecting with people 22 | - chat room/ 23 | | Jump into the Xiki chat room to get help, chat about, 24 | | Xiki or propose a command! 25 | | 26 | = http://webchat.freenode.net/?channels=xiki 27 | - mailing list/ 28 | | Join the mailing list to get help via email. 29 | | 30 | = http://groups.google.com/group/xiki/ 31 | 32 | ` 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /roots/help_topics.menu: -------------------------------------------------------------------------------- 1 | + external shell keyboard shortcuts/ 2 | | See 3 | = ~/.xsh 4 | 5 | | See 6 | << help/ 7 | 8 | |?Note: This menu is in progress, and is unfinished. 9 | | Edit xiki/roots/help_topics.menu to contribute! 10 | -------------------------------------------------------------------------------- /roots/highlight.rb: -------------------------------------------------------------------------------- 1 | class Highlight 2 | MENU = " 3 | - .all/ 4 | - .show/ 5 | " 6 | 7 | def self.all 8 | hash = Xiki::Color.all_marks_hash 9 | 10 | if hash.empty? # If no marks found, just say so 11 | return "- no marks found!" 12 | end 13 | 14 | keys = hash.keys.sort.reverse 15 | 16 | txt = "" 17 | last_file = nil 18 | keys.each do |key| 19 | file, line = hash[key] 20 | if last_file == file # If same file as last, just add line 21 | txt << " : #{line}" 22 | else # Else, show file and line 23 | txt << "= #{file.sub /(.+\/)/, "\\1\n - "}\n : #{line}" 24 | end 25 | 26 | last_file = file 27 | end 28 | 29 | Tree.<< txt, :no_search=>1 30 | 31 | # Apply colors... 32 | 33 | keys.each do |key| 34 | Move.to_quote 35 | over = $el.make_overlay(Line.left+Line.indent.length, Line.right+1) 36 | $el.overlay_put over, :face, hash[key] 37 | end 38 | 39 | Tree.to_parent :prefix=>:u 40 | Move.to_quote 41 | 42 | "" 43 | end 44 | 45 | end 46 | 47 | -------------------------------------------------------------------------------- /roots/history.rb: -------------------------------------------------------------------------------- 1 | log_file = File.expand_path("~/.xiki/misc/logs/topic_log.xiki") 2 | 3 | # ~, so show options 4 | 5 | option_item = task 6 | 7 | return "* edit" if option_item == [] 8 | if option_item == ["edit"] 9 | return View.open log_file 10 | end 11 | 12 | 13 | # /, so list history 14 | 15 | txt = File.read log_file 16 | txt.split("\n").reverse.uniq.map{|o| "= #{o}"}.join("\n") 17 | -------------------------------------------------------------------------------- /roots/homebrew.menu: -------------------------------------------------------------------------------- 1 | << brew/ 2 | -------------------------------------------------------------------------------- /roots/http.rb: -------------------------------------------------------------------------------- 1 | # It's a url (1st args is blank), so delegate to http://... passing "~ source"... 2 | 3 | # Construct url 4 | url = "http:/#{args.join("/")}" 5 | 6 | Xiki[url, :task=>["source"]] 7 | 8 | 9 | # cla## Http 10 | # def self.menu *args 11 | # yield[:dont_log] = 1 12 | # url = args.blank? ? nil : args.join('/') 13 | # 14 | # # If as+open, just jump to the log 15 | # return View.open Launcher.log_file if Keys.open? 16 | # 17 | # # If no url's, list them all... 18 | # 19 | # if url.blank? 20 | # txt = Launcher.last "http", :exclude_path=>1 21 | # txt.gsub! /^- /, '<< ' 22 | # return txt 23 | # end 24 | # 25 | # Keys.prefix == :u ? $el.browse_url(url) : Firefox.url(url) 26 | # nil 27 | # end 28 | # end 29 | -------------------------------------------------------------------------------- /roots/i.xiki: -------------------------------------------------------------------------------- 1 | ! View.layout_todo_and_nav 2 | -------------------------------------------------------------------------------- /roots/ids.rb: -------------------------------------------------------------------------------- 1 | class Ids 2 | def self.menu *args 3 | 4 | 5 | options = yield 6 | 7 | Ol() 8 | 9 | # If just "ids/", list all... 10 | 11 | if args.blank? 12 | js = %` 13 | var result=""; 14 | $('*[id]').each(function(i, e){ 15 | var id = $(e).attr('id'); 16 | result += "+ #"+id+"/\\n"; 17 | }) 18 | return result; 19 | `.unindent 20 | 21 | Ol.a js 22 | result = Browser.js js 23 | return " 24 | > No id attributes found in page! 25 | | Maybe try listing by classes: 26 | << css/list/ 27 | " if result == '""' 28 | return result 29 | end 30 | 31 | # Id passed so just navigate to it... 32 | 33 | Ol "args", args # => ["#hi", "new text\n"] 34 | # => ["#hi"] 35 | 36 | # return "todo" 37 | Xiki["dom/", args, options] 38 | 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /roots/img.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Img 3 | def self.menu *args 4 | Ol "args", args 5 | 6 | path = args.join('/') 7 | 8 | column = Line.indent.length 9 | Line.sub! /^([ +-]*).*/, "\\1" 10 | Move.to_end 11 | 12 | at = column > 0 ? "=" : "" 13 | Ol() 14 | Image.<< path, "#{at}img/#{path}" 15 | Ol() 16 | Ol "column", column 17 | Move.to_column column+1 18 | # Move.to_column column 19 | nil 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /roots/includes.rb: -------------------------------------------------------------------------------- 1 | Browser.js("$.makeArray( $('script[src]').map(function(i, o){return '@'+$(o).attr('src')}) ).join('\\n')") 2 | -------------------------------------------------------------------------------- /roots/interactions.rb: -------------------------------------------------------------------------------- 1 | dir = File.expand_path '~/.xiki/interactions' 2 | 3 | file = "#{dir}/#{(args[0]||"").gsub ' ', '_'}.xiki" 4 | 5 | if task == [] 6 | return "* save as command/" 7 | elsif task == ["save as command"] 8 | options[:nest] = 1 9 | options[:no_task] = 1 10 | options[:line_found] = 2 11 | return "| Give your command a name\nfoo" 12 | elsif task && task[0] == "save as command" 13 | name = task[1].gsub('_', ' ') 14 | txt = File.read file 15 | commands_dir = File.expand_path("~/.xiki/roots/") 16 | FileUtils.mkdir_p commands_dir 17 | File.open("#{commands_dir}/#{name}.xiki", "w") { |f| f << txt } 18 | return "<* - saved ~/.xiki/roots/#{name}.xiki" 19 | end 20 | 21 | # /, so read in dir, but order by date... 22 | 23 | if args == [] 24 | 25 | return ": task unimplemented yet...\n* new" if options[:task] 26 | 27 | files = Dir.entries(dir).select{|o| o !~ /^\./}.sort_by{ |x| File.stat("#{dir}/#{x}").mtime }.reverse 28 | return files.map{|o| "+ #{o.sub(/\.xiki$/, '').gsub('_', ' ')}\n"}.join 29 | end 30 | 31 | # /foo/:contents, so navigate to it... 32 | 33 | View.open file 34 | 35 | "" 36 | -------------------------------------------------------------------------------- /roots/ip.rb: -------------------------------------------------------------------------------- 1 | # return "127.3.3.7" # Hard-coded IP, for when demoing 2 | 3 | return if args.any? 4 | 5 | inet = `ifconfig`.split("\n").grep(/\binet\b/) 6 | 7 | return "| #{inet[0][/[\d.]+/]}" if inet.length < 2 8 | inet[1][/[\d.]+/] 9 | -------------------------------------------------------------------------------- /roots/javascript.rb: -------------------------------------------------------------------------------- 1 | # /, so show message... 2 | 3 | if args == [] 4 | return " 5 | | // Type some javascript here (to evaluate) 6 | | return 1 + 2 7 | " 8 | end 9 | 10 | # /code, so eval it... 11 | 12 | txt = args[0] 13 | 14 | txt = "print = p = console.log;\n#{txt}" 15 | 16 | Tree.quote JavascriptHandler.eval(txt) 17 | -------------------------------------------------------------------------------- /roots/jekyll.menu: -------------------------------------------------------------------------------- 1 | - create/ 2 | @/tmp/ 3 | $ jekyll new myblog 4 | - view/ 5 | - localhost/ 6 | @/tmp/myblog/ 7 | % jekyll serve -w 8 | @http://localhost:4000/ 9 | - files/ 10 | | This is an alternative to starting the server, but the relative 11 | | links won't work when viewing the files directly. 12 | @/tmp/myblog/ 13 | $ jekyll build 14 | @file:///tmp/myblog/_site/index.html 15 | - new post/ 16 | ! %` 17 | ! @/tmp/myblog/ 18 | ! - _posts/ 19 | ! - {date}-hi-again.markdown 20 | ! | --- 21 | ! | title: "Hi Again" 22 | ! | date: {date} 23 | ! | layout: post 24 | ! | --- 25 | ! | This page is simple. 26 | ! `.gsub("{date}", Time.now.strftime("%Y-%m-%d")) 27 | -------------------------------------------------------------------------------- /roots/js.rb: -------------------------------------------------------------------------------- 1 | # /, so show sample... 2 | 3 | return "| $('h1').toggle(1000) // Type some javascript here (to run in the browser)" if args == [] 4 | 5 | # /~, so handle options... 6 | 7 | return "* show output" if task == [] 8 | 9 | txt = args[-1] 10 | txt.sub! /\A: /, '' 11 | 12 | # Prepend assigning it to a variable, so it can be run again 13 | txt = "window.xl = function(){ eval(#{txt.inspect}) }; 14 | 15 | #{txt}" 16 | 17 | if task == ["show output"] || txt =~ /^return / 18 | 19 | txt = "\n#{txt.strip}" 20 | txt.sub!(/.*\n/m, "\\0return ") if txt !~ /^ *return\b/ 21 | txt << "\n" 22 | txt.sub!(/\A\n/, "") 23 | 24 | result = Browser.js txt 25 | 26 | return Tree.pipe result 27 | end 28 | 29 | 30 | n = Keys.prefix_n || 1 31 | n.times do 32 | Browser.js txt 33 | end 34 | 35 | nil 36 | -------------------------------------------------------------------------------- /roots/jso.rb: -------------------------------------------------------------------------------- 1 | 2 | return " 3 | - Old > use instead: 4 | = js 5 | | return 1 + 2 6 | " 7 | 8 | 9 | 10 | Applescript.exec("Firefox", "activate") if Keys.prefix_u 11 | 12 | return " 13 | > Type a js expression here (to grab from the browser) 14 | | document.title 15 | " if args.blank? 16 | 17 | txt = args[0] 18 | return "=beg/quoted/" if txt !~ /\n/ 19 | 20 | txt = args[0] 21 | 22 | Tree.quote Firefox.exec txt 23 | -------------------------------------------------------------------------------- /roots/jump_to_dir.rb: -------------------------------------------------------------------------------- 1 | # /, so list all dirs 2 | 3 | links = Notes.extract_links :limit=>2000 4 | 5 | links.map!{|o| "= #{File.dirname o[0]}/\n"} 6 | links.uniq! 7 | links.join 8 | 9 | -------------------------------------------------------------------------------- /roots/keys.rb: -------------------------------------------------------------------------------- 1 | # The "keys" command. Just a thin wrapper around Keys.menu_expander. 2 | txt = Keys.menu_expander args, options 3 | -------------------------------------------------------------------------------- /roots/l.menu: -------------------------------------------------------------------------------- 1 | << links/ 2 | -------------------------------------------------------------------------------- /roots/last.rb: -------------------------------------------------------------------------------- 1 | Launcher.last options[:path] 2 | -------------------------------------------------------------------------------- /roots/length.rb: -------------------------------------------------------------------------------- 1 | return "=prompt/type a jquery selector here" if args.empty? 2 | 3 | selector = args.join "/" 4 | 5 | selector = "$(\"#{selector}\").length" 6 | Firefox.exec selector 7 | -------------------------------------------------------------------------------- /roots/ln.menu: -------------------------------------------------------------------------------- 1 | > Make soft link 2 | $ ln -s /dir/file new_file 3 | -------------------------------------------------------------------------------- /roots/log.rb: -------------------------------------------------------------------------------- 1 | Launcher.log 2 | -------------------------------------------------------------------------------- /roots/lorem_ipsum.menu: -------------------------------------------------------------------------------- 1 | - all/ 2 | | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 3 | - individual sentences/ 4 | - Lorem ipsum.../ 5 | | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 6 | - Ut enim.../ 7 | | Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 8 | - Duis aute.../ 9 | | Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 10 | - Excepteur sint/ 11 | | Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 12 | -------------------------------------------------------------------------------- /roots/ls.rb: -------------------------------------------------------------------------------- 1 | class Ls 2 | def self.docs 3 | " 4 | > Summary 5 | | Simple wrapper around the 'ls' shell command. Can be used in trees. 6 | 7 | > Example usage 8 | @/tmp/ 9 | @ls 10 | " 11 | end 12 | 13 | def self.menu *args 14 | options = yield 15 | dir = options[:dir] 16 | 17 | return self.docs if args == ['docs'] 18 | 19 | # path = Tree.file :require=>1 20 | txt = Shell.sync "ls -Alh", :dir=>dir 21 | # txt = Shell.sync "ls -Alh \"#{path}\"", :dir=>dir 22 | txt.sub! /\Atotal.+\n/, '' 23 | Tree.quote txt 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /roots/mail/default.conf: -------------------------------------------------------------------------------- 1 | - from/ 2 | foo@bar.com 3 | - client id/ 4 | 7777777-samplesamplesamplesample.apps.googleusercontent.com 5 | - client secret/ 6 | tNsamplesamplesamplesample_E5 7 | - access token/ 8 | ya29.1.samplesamplesamplesamplesamplesamplesamplesample-samplesample 9 | - refresh token/ 10 | 1/samplesamplesamplesamplesamplesample 11 | -------------------------------------------------------------------------------- /roots/man.rb: -------------------------------------------------------------------------------- 1 | class Man 2 | def self.menu command=nil 3 | if command == nil 4 | return " 5 | | Type a command to show its man page: 6 | - example: ls 7 | - last used: @last/man/ 8 | " 9 | end 10 | 11 | `man #{command} | col -x -b`.gsub(/^/, '| ').gsub(/^\| $/, '|') 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /roots/map.rb: -------------------------------------------------------------------------------- 1 | # If no arg, prompt to type something... 2 | 3 | txt = args.join(" ") 4 | return "=prompt/Type something to search on google maps" if ! txt.any? 5 | 6 | # If arg, look it up... 7 | 8 | txt.sub!(/ \(.+\)/, '') # Remove paren groups, like (16th street) 9 | 10 | txt = CGI.escape txt 11 | 12 | url = "http://maps.google.com/maps?q=#{txt.gsub "\n", ", "}" 13 | 14 | # Task to just show the url 15 | 16 | if task = options[:task] 17 | return "* url" if task == [] 18 | options[:no_slash] = 1 19 | return "= #{url}" 20 | end 21 | 22 | 23 | # /open (as+open), so just show url (google fucks it up in the browser)... 24 | return "= #{url}" if options[:prefix] == "open" 25 | 26 | Browser.url url, :os_open=>1 27 | 28 | nil 29 | -------------------------------------------------------------------------------- /roots/markers.rb: -------------------------------------------------------------------------------- 1 | # /, so list labels from current file 2 | 3 | file = options[:dir].sub(/\/$/, '') 4 | 5 | if args == [] 6 | labels = Notes.extract_markers :file=>file, :limit=>100, :indent=>" " 7 | labels = labels.split("\n", -1).uniq.join("\n") 8 | options[:omit_slashes] = 1 9 | return labels 10 | end 11 | 12 | # ~ option, so maybe navigate 13 | 14 | return "* navigate\n* run" if task == [] 15 | 16 | 17 | # /label, so open the file and navigate to it 18 | 19 | View.open file 20 | View.to_top 21 | Notes.jump_to_label args[0] 22 | Line.next 23 | 24 | return "" if task == ["navigate"] 25 | 26 | Tree.collapse 27 | Launcher.launch 28 | 29 | "" 30 | -------------------------------------------------------------------------------- /roots/mkdir.rb: -------------------------------------------------------------------------------- 1 | class Mkdir 2 | 3 | def self.menu 4 | 5 | dir = Tree.closest_dir yield[:ancestors] 6 | 7 | return " 8 | > Usage 9 | | Nest =mkdir under a dir path to create the dir, like this: 10 | | 11 | | - /tmp/newdir/ 12 | | - =mkdir 13 | | 14 | " if ! dir 15 | 16 | return View.flash("- Already exists: #{dir}") if File.exists?(dir) 17 | 18 | `mkdir -p "#{dir}"` 19 | 20 | return View.flash "- Created: #{dir}", :times=>3 21 | end 22 | 23 | end 24 | -------------------------------------------------------------------------------- /roots/mysql/default.conf: -------------------------------------------------------------------------------- 1 | > The db to use when none is specified 2 | - default db/ 3 | foo 4 | - user/ 5 | root 6 | #- password/ 7 | # p@ssw0rd 8 | # - host/ 9 | # localhost 10 | -------------------------------------------------------------------------------- /roots/nav_history.rb: -------------------------------------------------------------------------------- 1 | txt = Search.launched *args 2 | 3 | # If /, tell them they can pass a bookmark. 4 | 5 | txt = "| Pass a bookmark to narrow down\n#{txt}" if args == [] 6 | 7 | txt 8 | -------------------------------------------------------------------------------- /roots/network.menu: -------------------------------------------------------------------------------- 1 | = ip/ 2 | = curl/ 3 | = ports/ 4 | + pairing location/ 5 | ! `scselect pairing` 6 | -------------------------------------------------------------------------------- /roots/node_js.menu: -------------------------------------------------------------------------------- 1 | << node/ 2 | -------------------------------------------------------------------------------- /roots/note_markers.rb: -------------------------------------------------------------------------------- 1 | # No path, so show all labels from :t... 2 | 3 | prefix = Keys.prefix 4 | 5 | if args == [] 6 | 7 | # Get latest "notes.notes" and "links.notes" contents... 8 | 9 | todo = Notes.extract_markers :file=>"%n", :limit=>100 10 | 11 | # Remove dups 12 | todo = todo.split("\n", -1).uniq.join("\n") 13 | 14 | txt = todo 15 | 16 | options[:hotkey] = 1 17 | options[:omit_slashes] = 1 18 | 19 | return txt 20 | end 21 | 22 | # Item passed, so navigate or open... 23 | 24 | task = options[:task] 25 | 26 | # Root task, so show items... 27 | 28 | return "* navigate\n* run" if task == [] 29 | 30 | # Open or run, so navigate to it... 31 | 32 | View.kill if ! task && View.name == "run labels/" 33 | 34 | # files/..., so pull it off 35 | launch_options = {} 36 | if args.length == 2 and args[0] == "files" 37 | args.shift 38 | launch_options[:bookmark] = "%links" 39 | end 40 | 41 | launch_options[:label] = args[0] 42 | launch_options[:go] = 1 if task == ["navigate"] 43 | 44 | Launcher.do_last_launch launch_options 45 | -------------------------------------------------------------------------------- /roots/ok.rb: -------------------------------------------------------------------------------- 1 | # At left margin, so close this view 2 | 3 | if Line.indent == "" 4 | View.close 5 | end 6 | 7 | # Indented under something, so jump to parent and collapse 8 | 9 | # Go to parent 10 | Tree.to_parent 11 | 12 | # Collapse 13 | Tree.collapse 14 | 15 | 16 | # "* task", so collapse 17 | if Line.value =~ /^ *\*/ 18 | 19 | indent = Line.indent 20 | 21 | # Delete option item 22 | Line.delete 23 | # "~ option item" at left margin, so leave cursor there 24 | if indent == "" 25 | View >> "\n" 26 | else 27 | Line.previous 28 | end 29 | end 30 | 31 | 32 | "" 33 | -------------------------------------------------------------------------------- /roots/options.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Options 3 | 4 | def self.menu *args 5 | 6 | # Grab parent subpath to parse and pre-expand... 7 | 8 | options = yield 9 | 10 | ancestors = options[:ancestors] 11 | menu_steps = ancestors.any? && ancestors[-1] == "menu steps/" 12 | ancestors.pop if menu_steps 13 | 14 | # Normally, this is more complicated than just using this menu 15 | 16 | 17 | path = ancestors.any? ? ancestors : options[:path] 18 | 19 | options_result = Expander.expanders path 20 | 21 | if options_result[:menufied] 22 | Command.climb_sources options_result 23 | end 24 | 25 | options_propigate = options.dup 26 | options_result = options.merge! options_result # Merge in original options, so editor and prefix vars etc vars are there (might cause problems?) 27 | 28 | # /, so show options_result... 29 | 30 | txt = TextUtil.ap options_result 31 | txt = Tree.quote txt, :char=>"|" 32 | 33 | txt 34 | 35 | end 36 | 37 | def self.yaml txt 38 | txt = txt.to_yaml 39 | txt.sub! /\A--- \n/, '' 40 | txt.gsub!(/ $/, '') 41 | txt 42 | end 43 | 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /roots/os.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Shows your operating system and version. 3 | # 4 | 5 | # /etc/os-release exists, so use it (probably linux)... 6 | 7 | if txt = File.read("/etc/os-release") rescue nil 8 | return Tree.pipe txt[/.+\n.+\n/] # Show the 1st 2 lines 9 | end 10 | 11 | # sw_vers command exists, so use it (probably mac)... 12 | 13 | if txt = Shell.command("sw_vers", :raise_error=>1) rescue nil 14 | return Tree.pipe txt[/.+\n.+\n/] # Show the 1st 2 lines 15 | end 16 | 17 | " 18 | | Sorry, your OS was unrecognized, because neither 19 | | the /etc/os-release file nor the 'sw_vers' shell 20 | | command could be found to give clues about your 21 | | OS and its version. 22 | | 23 | " 24 | -------------------------------------------------------------------------------- /roots/os_path.rb: -------------------------------------------------------------------------------- 1 | ENV['PATH']. 2 | split(":"). 3 | map{|o| "=#{FileTree.add_slash_maybe o}"}. 4 | join("\n") 5 | -------------------------------------------------------------------------------- /roots/overflow.rb: -------------------------------------------------------------------------------- 1 | txt = args.join("/").strip 2 | 3 | # If no arg, prompt to type something 4 | 5 | return "=prompt/Type something to search on stack overflow" if txt.blank? 6 | 7 | 8 | # Words not quoted, so grab siblings (if it's not on the same line)... 9 | 10 | if txt !~ /\n/ && txt !~ /^:/ && Line !~ /google\// 11 | txt = Tree.siblings.join(" ") 12 | end 13 | 14 | txt.sub! /^: /, '' 15 | txt.gsub! "\n", ' ' 16 | 17 | 18 | 19 | # If arg, look it up 20 | 21 | txt = CGI.escape txt 22 | 23 | Browser.url "http://stackoverflow.com/search?q=#{txt}" 24 | nil 25 | -------------------------------------------------------------------------------- /roots/parse.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Parse 3 | 4 | def self.menu *args 5 | 6 | # Grab parent subpath to parse and pre-expand 7 | 8 | options = yield 9 | ancestors = options[:ancestors] 10 | menu_steps = ancestors[-1] == "menu steps/" 11 | ancestors.pop if menu_steps 12 | 13 | path = ancestors.any? ? ancestors : options[:path] 14 | 15 | parse_result = Expander.parse path 16 | 17 | txt = self.ap parse_result 18 | txt.gsub! /^ /, "" 19 | txt.sub! "[\n [", "[[" 20 | txt = Tree.quote txt, :char=>"|" 21 | 22 | txt 23 | end 24 | 25 | def self.ap txt 26 | txt = txt.ai 27 | txt.sub! /\A{\n/, '' 28 | txt.sub! /\n}\z/, '' 29 | txt 30 | end 31 | 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /roots/path.menu: -------------------------------------------------------------------------------- 1 | << os path/ 2 | << echo/ 3 | << menu path/ 4 | << ruby load path/ 5 | << emacs/lisp load-path dirs/ 6 | -------------------------------------------------------------------------------- /roots/ports.menu: -------------------------------------------------------------------------------- 1 | - all ports/ 2 | ! Tree.quote `lsof -i | grep LISTEN` 3 | - single port/ 4 | ! return "=prompt/Type a port" if args.empty? 5 | ! Tree.quote `lsof -i :#{args[0]}` 6 | - all connections/ 7 | ! Tree.quote `netstat -p tcp` 8 | - examples/ 9 | - processes listening on a port/ 10 | =$ lsof -i :8161 | grep LISTEN -------------------------------------------------------------------------------- /roots/preferences.menu: -------------------------------------------------------------------------------- 1 | << conf/ 2 | -------------------------------------------------------------------------------- /roots/processes.menu: -------------------------------------------------------------------------------- 1 | - all/ 2 | ! Tree.quote `ps -eo pcpu,pid,user,args | sort -k 1 -r` 3 | - Mac Activity Monitor/ 4 | @app/Utilities/Activity Monitor 5 | << cpu/ 6 | << kill/ 7 | -------------------------------------------------------------------------------- /roots/questions.rb: -------------------------------------------------------------------------------- 1 | Xiki[:memorize, args, options] 2 | -------------------------------------------------------------------------------- /roots/quick_topics.rb: -------------------------------------------------------------------------------- 1 | # /, so return favorite topics... 2 | 3 | if args == [] 4 | 5 | return "* edit" if task == [] 6 | return View.open("~/.xiki/misc/favorite/topics.xiki") if task == ["edit"] 7 | 8 | file = File.expand_path "~/.xiki/misc/favorite/topics.xiki" 9 | txt = File.read(file) rescue nil 10 | 11 | if txt 12 | options[:hotkey] = 1 13 | end 14 | 15 | txt ||= "<* - No favorites yet!" 16 | return txt 17 | end 18 | 19 | 20 | # /topic, so replace parent and expand... 21 | 22 | "<< #{args[0]}" 23 | 24 | -------------------------------------------------------------------------------- /roots/quit.menu: -------------------------------------------------------------------------------- 1 | << unsaved/just quit 2 | -------------------------------------------------------------------------------- /roots/recent.rb: -------------------------------------------------------------------------------- 1 | # Read list from the file 2 | 3 | file = File.expand_path "~/.xiki/misc/logs/opened_files_log.xiki" 4 | txt = File.read file 5 | 6 | txt = txt.split("\n").reverse 7 | 8 | # Don't do this, since recently-opened ones would be after them all 9 | # Prepend currently open, since they'll be in the right order? 10 | #txt = Buffers.list.map{|b| $el.buffer_file_name(b)}.compact + txt 11 | # Is there an elisp event for switching to a view? 12 | # - maybe use that instead? 13 | 14 | txt = txt.uniq.join("\n") 15 | txt.gsub!(/(.+)\/(.+)/, "= \\1/\n - \\2") 16 | 17 | txt 18 | 19 | -------------------------------------------------------------------------------- /roots/reload.rb: -------------------------------------------------------------------------------- 1 | Tree.<< "| Reloaded.", :no_slash=>1 2 | $el.el4r_kill_and_restart 3 | -------------------------------------------------------------------------------- /roots/rethinkdb/default.conf: -------------------------------------------------------------------------------- 1 | host/ 2 | localhost 3 | port/ 4 | 28015 5 | default database/ 6 | test 7 | # auth key/ 8 | # foo 9 | # (the authentication key > default none) 10 | -------------------------------------------------------------------------------- /roots/revert.rb: -------------------------------------------------------------------------------- 1 | Files.revert 2 | 3 | -------------------------------------------------------------------------------- /roots/ruby_load_path.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH.map{|o| "=#{o}/\n"}.join("") 2 | 3 | -------------------------------------------------------------------------------- /roots/rvm.menu: -------------------------------------------------------------------------------- 1 | - list/ 2 | =$ rvm list 3 | =$ rvm gemset list 4 | - install versions/ 5 | - update cache of versions/ 6 | =% rvm get stable 7 | - list/ 8 | =$ rvm list known_strings 9 | =$ rvm list known 10 | - install/ 11 | =% rvm install 1.9.3-p484 12 | - set default/ 13 | =% rvm --default use system 14 | =% rvm --default use 1.8.7 15 | =% rvm --default use 1.9.3 16 | -------------------------------------------------------------------------------- /roots/save.rb: -------------------------------------------------------------------------------- 1 | DiffLog.save 2 | 3 | "" 4 | -------------------------------------------------------------------------------- /roots/save_as.rb: -------------------------------------------------------------------------------- 1 | # /, so show options 2 | 3 | if args == [] 4 | 5 | name = options[:save_as_name] || "" 6 | txt = " 7 | | #{name} 8 | - interaction 9 | - in current directory 10 | - more/ 11 | " 12 | return txt 13 | end 14 | 15 | if args == ["more"] 16 | return " 17 | - in other directory 18 | - note 19 | - command 20 | - task? 21 | " 22 | end 23 | 24 | name = Tree.siblings[0].sub(/^\| /, '') 25 | 26 | dir = {"interaction"=>"~/.xiki/interactions/", "more/note"=>"~/xiki/", "more/command"=>"~/.xiki/roots/"}[args.join('/')] 27 | dir = File.expand_path dir 28 | 29 | FileUtils.mkdir_p dir # Make sure it exists 30 | file = "#{dir}/#{name}" 31 | 32 | file = Files.unique_name file # Don't conflict with any existing file 33 | 34 | # Close this tile first > so it'll go back to the right place... 35 | 36 | buffer_to_save = $el.elvar.buffer_to_save 37 | View.kill # Close the menu tile and jump back to the original buffer 38 | View.to_buffer buffer_to_save 39 | 40 | $el.write_file file 41 | 42 | "" 43 | -------------------------------------------------------------------------------- /roots/save_command.rb: -------------------------------------------------------------------------------- 1 | Xiki::Command.as_command 2 | 3 | 4 | nil 5 | -------------------------------------------------------------------------------- /roots/save_without_diff.rb: -------------------------------------------------------------------------------- 1 | DiffLog.save :no_diffs=>1 2 | 3 | "" 4 | -------------------------------------------------------------------------------- /roots/scroll_bars.menu: -------------------------------------------------------------------------------- 1 | << window/scroll bars/ 2 | -------------------------------------------------------------------------------- /roots/search.rb: -------------------------------------------------------------------------------- 1 | XikihubClient.search options 2 | 3 | 4 | -------------------------------------------------------------------------------- /roots/searches.rb: -------------------------------------------------------------------------------- 1 | log_file = File.expand_path("~/.xiki/misc/logs/search_log.xiki") 2 | 3 | # /, so list history 4 | 5 | txt = File.read log_file 6 | txt.split("\n").reverse.uniq.map{|o| "= #{o}"}.join("\n") 7 | -------------------------------------------------------------------------------- /roots/searching.rb: -------------------------------------------------------------------------------- 1 | Xiki[Xiki::Search, args, options] 2 | -------------------------------------------------------------------------------- /roots/shell.menu: -------------------------------------------------------------------------------- 1 | - current/ 2 | ! Shell.current *args 3 | - history/ 4 | ! Shell.history *args 5 | - all/ 6 | ! Shell.all *args 7 | -------------------------------------------------------------------------------- /roots/shoes/shoes_index.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Shoes 3 | def self.menu *args 4 | # txt = ENV['txt'] 5 | txt = args[0] 6 | 7 | app = "/Applications/Shoes.app/Contents/MacOS/shoes" 8 | 9 | return " 10 | > Shoes isn't installed 11 | <@ shoes/docs/install shoes/ 12 | " if ! File.exists? app 13 | 14 | File.open("/tmp/shoes.rb", "w") { |f| f << txt } 15 | 16 | `#{app} /tmp/shoes.rb` 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /roots/shuffle.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Shuffle 3 | def self.menu *args 4 | 5 | message = "| This menu shuffles the siblings that follow it." 6 | return message if args == [] 7 | 8 | orig = Location.new 9 | 10 | left, ignore, ignore2, right = Tree.sibling_bounds 11 | 12 | return message if left == right 13 | 14 | txt = View.delete left, right 15 | 16 | Code.randomize_lines txt 17 | 18 | orig.go 19 | View.deselect 20 | 21 | nil 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /roots/source.rb: -------------------------------------------------------------------------------- 1 | class Source 2 | def self.menu *args 3 | 4 | path = yield[:ancestors] 5 | return " 6 | : Nest this under a menu name, like this: 7 | =ip/ 8 | =source/ 9 | : 10 | <= options/ 11 | <= echo/ 12 | " if ! path 13 | 14 | options = Expander.expanders path 15 | return "- no sources found!" if !options[:sources] 16 | 17 | Command.climb_sources options 18 | sources = options[:sources] 19 | 20 | result = "=#{options[:menufied].sub /(.+\/).+/, "\\1"}\n" 21 | 22 | sources.each_with_index do |l, i| 23 | l.reverse.each do |file| 24 | result << " #{' ' * i}+ #{file}\n" 25 | end 26 | end 27 | 28 | result 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /roots/specials.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Specials 3 | MENU = " 4 | - see/ 5 | - keys/ 6 | > Find next special char in this view 7 | - search+just+special 8 | <@ encoding/ 9 | @ascii/ 10 | " 11 | 12 | def self.menu_after output, *args 13 | 14 | return if args != [] 15 | 16 | # /, so add output... 17 | 18 | options = yield 19 | ancestors = options[:ancestors] 20 | Ol "ancestors", ancestors 21 | return "no ancestor???" if true#__________ 22 | 23 | dir = Tree.dir :file=>1 24 | Ol "dir", dir 25 | 26 | txt = dir 27 | # txt = `od -ct uC #{dir}`.gsub(/^/, '| ') 28 | 29 | "#{txt}#{output}" 30 | rescue RuntimeError=>e 31 | raise e if e.message !~ /This menu must be nested/ # Only handle if it's the complaining about not nesting under a dir 32 | 33 | "#{e.message}\n#{output}" 34 | 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /roots/stop.rb: -------------------------------------------------------------------------------- 1 | # Change this code to something useful 2 | Xiki.kill 3 | 4 | " 5 | - Stopped the xsh daemon. 6 | | The next time you start xsh, it'll reload everything 7 | | (and thus take slightly longer). 8 | " 9 | -------------------------------------------------------------------------------- /roots/styles.rb: -------------------------------------------------------------------------------- 1 | module Xiki::Menu 2 | class Styles 3 | 4 | MENU = ' 5 | - .font size/ 6 | - .list faces/ 7 | - api/ 8 | - summary/ 9 | | You can change the color and font of text using the Styles class. 10 | | You define styles, then make them apply to the text that matches 11 | | regular expression. 12 | - define/ 13 | =Styles.red :bg => "7d7" 14 | - apply/ 15 | =Styles.apply "apply", :red 16 | - define more complex font/ 17 | | Stylesblueish 18 | | :fg => "99e", 19 | | :face => "verdana", 20 | | :size => 90, 21 | | :bold => true 22 | - see/ 23 | | For styling a specific block of text. Location-based, not regular 24 | | expression based. 25 | <<< =overlay/ 26 | - see/ 27 | <<< =css/list/ 28 | <<< =themes/ 29 | ' 30 | 31 | def self.font_size size=nil 32 | ::Styles.font_size size 33 | end 34 | 35 | def self.list_faces 36 | ::Styles.list_faces 37 | end 38 | 39 | end; end 40 | -------------------------------------------------------------------------------- /roots/substitute.rb: -------------------------------------------------------------------------------- 1 | class Substitute 2 | MENU_HIDDEN = %` 3 | + .docs/ 4 | ` 5 | 6 | # If store values 7 | def self.menu *args 8 | 9 | # /, so show current clipboard values... 10 | if args.empty? 11 | return "#{Clipboard[1].gsub(/\A|\n/, "\\0|-")}\n#{Clipboard[2].gsub(/\A|\n/, "\\0|+")}" 12 | end 13 | 14 | # /|-..., so save into clipboards... 15 | 16 | txt = Tree.quoted 17 | 18 | a = txt.scan(/^-(.*)/).join("\n") 19 | b = txt.scan(/^\+(.*)/).join("\n") 20 | 21 | Clipboard[1], Clipboard[2] = a, b 22 | 23 | "<* Now do do+1 to search and substitute!" 24 | 25 | rescue 26 | " 27 | > Error 28 | | Do as+1 and as+2 first. 29 | " 30 | end 31 | 32 | def self.docs 33 | %` 34 | | Shortcuts for setting the "1" and "2" clipboards, so you can 35 | | subsequently do do+1 to search and substitute. 36 | | 37 | | Example: 38 | =substitute/ 39 | |-foo 40 | |+bar 41 | ` 42 | end 43 | 44 | end 45 | -------------------------------------------------------------------------------- /roots/svg_edit.menu: -------------------------------------------------------------------------------- 1 | - app/ 2 | @http://svg-edit.googlecode.com/svn/branches/2.6/editor/svg-editor.html 3 | - actions/ 4 | - grab source/ 5 | - indented/ 6 | @jso/ 7 | | svgEditor.canvas.svgCanvasToString() 8 | @/tmp/tmp.svg 9 | - raw/ 10 | @jso/ 11 | | $('
').append($('#svgcontent').clone()).html(); 12 | @/tmp/tmp.svg 13 | - links/ 14 | - sites that have it embedded/ 15 | - http://projectsesame.appspot.com/newinstructions 16 | - http://golem.ph.utexas.edu/~distler/blog/archives/002168.html 17 | -------------------------------------------------------------------------------- /roots/tab_width.rb: -------------------------------------------------------------------------------- 1 | class TabWidth 2 | def self.menu *args 3 | return " 4 | > Make tabs be this many spaces 5 | - 2/ 6 | - 4/ 7 | - 8/ 8 | - 12/ 9 | - 16/ 10 | - 24/ 11 | " if args.empty? 12 | 13 | View.tab_width args[0].to_i 14 | # $el.elvar.tab_width = args[0].to_i 15 | nil 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /roots/tabs.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Tabs 3 | def self.menu *args 4 | 5 | # If no args, show option that toggles... 6 | 7 | return $el.elvar.tabbar_mode ? "- hide/" : "- show/" if args.empty? 8 | 9 | # Hidden "toggle" option 10 | 11 | if args == ['toggle'] 12 | $el.customize_set_variable :tabbar_mode, ! $el.elvar.tabbar_mode 13 | return "<* toggled" 14 | end 15 | 16 | # Option was passed in, so do it... 17 | 18 | turn_on = args == ['show'] 19 | 20 | $el.customize_set_variable :tabbar_mode, turn_on 21 | 22 | new_menu_item = turn_on ? "hide/" : "show/" 23 | Tree.replace_item new_menu_item 24 | Effects.glow :fade_in=>1 25 | 26 | nil 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /roots/tail.rb: -------------------------------------------------------------------------------- 1 | class Tail 2 | 3 | def self.ongoing 4 | dir = Tree.dir :file=>1 5 | Shell.run "tail -f \"#{dir}\"" 6 | end 7 | 8 | def self.dir 9 | dir = Tree.dir :file=>1 10 | Tree.quote `tail "#{dir}"` 11 | end 12 | 13 | def self.menu_before *args 14 | # Don't do anything unless it's just numeric args 15 | return nil if args.length != 1 || args[0] !~ /^\d+$/ 16 | 17 | dir = Tree.dir :file=>1 18 | 19 | count = args[0].to_i 20 | Tree.quote `tail -n #{count} "#{dir}"` 21 | end 22 | 23 | MENU = " 24 | - .ongoing/ 25 | - 3/ 26 | - .dir/ 27 | - .docs/ 28 | > Shows the first 10 lines inline 29 | << in/ 30 | 31 | > Show N lines inline 32 | << 3/ 33 | 34 | > Opens a shell and keeps showing updates 35 | << ongoing/ 36 | " 37 | 38 | end 39 | -------------------------------------------------------------------------------- /roots/tests.menu: -------------------------------------------------------------------------------- 1 | << xiki project/tests 2 | -------------------------------------------------------------------------------- /roots/themes.rb: -------------------------------------------------------------------------------- 1 | module Xiki::Menu 2 | class Themes 3 | 4 | def self.menu name=nil 5 | # /list/, so list themes... 6 | 7 | if ! name 8 | path = "#{Xiki.dir}misc/themes/" 9 | themes = Dir.new(path).entries.select{|o| o =~ /^\w/} 10 | return themes.map{|o| "- #{o[/\w+/].gsub('_', ' ')}\n"}.join() 11 | end 12 | 13 | # /list/name, so use or navigate to theme... 14 | 15 | options = yield 16 | return "* activate\n* source" if options[:task] == [] 17 | 18 | if options[:task] == ["source"] || Keys.open? # If as+open, just navigate to it 19 | path = "#{Xiki.dir}misc/themes/#{TextUtil.title_case name, :underscores=>1}.xiki" 20 | View.open path 21 | return 22 | end 23 | 24 | ::Xiki::Themes.use name 25 | Styles.reload_styles 26 | 27 | "<* activated!" 28 | end 29 | 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /roots/time.rb: -------------------------------------------------------------------------------- 1 | module Menu 2 | class Time 3 | 4 | MENU = %` 5 | - .time zones/ 6 | - see/ 7 | =date/ 8 | =calendar/ 9 | =timer/ 10 | ` 11 | 12 | def self.menu_after out, *args 13 | if args == [] 14 | time = ::Time.now.strftime("%-l:%M:%S%P") 15 | return "#{time}\n#{out}" 16 | end 17 | 18 | # /..., so prepend time to top 19 | 20 | nil 21 | end 22 | 23 | def self.time_zones name=nil 24 | ['active_support', 'active_support/time', 'active_support/time_with_zone'].each{|o| require o} 25 | 26 | require 'active_support' 27 | require 'active_support/time' 28 | require 'active_support/time_with_zone' 29 | 30 | # /, so return list of time zones 31 | 32 | return ActiveSupport::TimeZone.us_zones.map{|o| "#{o.name}/".sub(" (US & Canada)", '')} if ! name 33 | 34 | ActiveSupport::TimeZone.us_zones.each do |o| 35 | if o.name.sub(" (US & Canada)", '') == name 36 | return "#{o.now.strftime('%-l:%M:%S%P')}" 37 | end 38 | end 39 | 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /roots/timer.rb: -------------------------------------------------------------------------------- 1 | class Timer 2 | def self.menu started=nil 3 | 4 | # If no time passed, just output current 5 | 6 | if ! started 7 | return "- started: " + Time.now.strftime("%I:%M:%S%p/").downcase 8 | end 9 | 10 | elapsed = Time.now - Time.parse(started) 11 | elapsed = elapsed.to_i 12 | seconds = (elapsed % 60).to_s 13 | elapsed = "#{elapsed / 60}:#{seconds.sub /^.$/, "0\\0"}" 14 | 15 | "| #{elapsed} elapsed" 16 | 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /roots/version.menu: -------------------------------------------------------------------------------- 1 | - xiki/ 2 | ! File.open("#{Xiki.dir}xiki.gemspec").grep(/^ *s\.version/)[0][/\d[\d.\w]*/] 3 | - editor/ 4 | ! Tree.pipe $el.emacs_version 5 | - =ruby/version/ 6 | - =os/ 7 | -------------------------------------------------------------------------------- /roots/views.rb: -------------------------------------------------------------------------------- 1 | Buffers.current *args, &proc{options} 2 | -------------------------------------------------------------------------------- /roots/web_development.menu: -------------------------------------------------------------------------------- 1 | - frameworks/ 2 | @rails/ 3 | @sinatra/ 4 | @node/ 5 | - menus/ 6 | @html/ 7 | @js/ 8 | @css/ 9 | @dom/ 10 | @append/ 11 | @blink/ 12 | @click/ 13 | -------------------------------------------------------------------------------- /roots/web_thesaurus.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class WebThesaurus 3 | def self.menu word=nil 4 | return View.prompt('Type a word to look up') if word.nil? 5 | 6 | word.strip! 7 | word.sub! /^: /, '' 8 | word.gsub! /\n/, ' ' 9 | word = CGI.escape word 10 | 11 | $el.browse_url "http://thesaurus.reference.com/browse/#{word}" 12 | nil 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /roots/white.menu: -------------------------------------------------------------------------------- 1 | ! Xiki["themes/White BG/"] 2 | ! nil 3 | -------------------------------------------------------------------------------- /roots/wikipedia.menu: -------------------------------------------------------------------------------- 1 | << wp/ 2 | -------------------------------------------------------------------------------- /roots/wp.rb: -------------------------------------------------------------------------------- 1 | # /, so show message... 2 | 3 | return " #{page.title}\n#{page.content}" 31 | -------------------------------------------------------------------------------- /roots/xiki_path.rb: -------------------------------------------------------------------------------- 1 | class XikiPath 2 | def self.menu *args 3 | dirs = Xiki.xiki_path_dirs 4 | dirs.map{|o| "= #{o.sub /\/*$/, '/'}"}.join("\n") 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /roots/xiki_tests.rb: -------------------------------------------------------------------------------- 1 | Xiki.tests(*args) {options} 2 | -------------------------------------------------------------------------------- /roots/xikistrap.rb: -------------------------------------------------------------------------------- 1 | class Xikistrap < Xiki::Menu::Bootstrap 2 | 3 | # Use our own version of the menu with "@xikistrap/" in it instead 4 | # of the superclass', which has "@bootstrap/" in it. 5 | MENU = self.menu_constant 6 | 7 | # Over-ride .render to the xiki logo before delegating to the 8 | # super's .render. 9 | def self.render txt 10 | navbar = %` 11 | - navbar/ 12 | | 13 | | 14 | - style/ 15 | | body { 16 | | background-color: #eee; 17 | | } 18 | `.unindent 19 | 20 | txt = "#{navbar}\n#{txt}" 21 | 22 | super txt 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /roots/xsh.menu: -------------------------------------------------------------------------------- 1 | | Here are the conf settings for how xsh works: 2 | =conf/ 3 | -------------------------------------------------------------------------------- /roots/xsh/default.conf: -------------------------------------------------------------------------------- 1 | # If set to "advanced", more key shortcuts are shown when you type 2 | # Ctrl+K. # Set to false if you want to go back to showing fewer 3 | # key shortcuts (noob mode). 4 | # Possible values: noob, advanced 5 | key shortcuts: noob 6 | 7 | 8 | # If set to "show", pop up a tip about the key shortcuts that can be 9 | # used to execute shell commands (Ctrl+X and Ctrl+G). Also explain that 10 | # typing Return just inserts a linebreak rather than runs the command. 11 | # Possible values: show, hide 12 | shell prompt keys tip: show 13 | 14 | -------------------------------------------------------------------------------- /roots/youtube.rb: -------------------------------------------------------------------------------- 1 | module Xiki 2 | class Youtube 3 | MENU = " 4 | | Put words here to search on youtube 5 | - url with start time/ 6 | =http://www.youtube.com/watch?v=XkYcWzBCEb8#t=2m51s 7 | | Or, with end time: 8 | =http://www.youtube.com/v/bUR_eUVcABg?start=15&end=20&version=3&autoplay=1 9 | - use dotsies in transcript/ 10 | =css/ 11 | | .caption-line-text{ 12 | | font-family: dotsies; 13 | | padding-left: 1px; 14 | | } 15 | | .caption-line-highlight{ 16 | | font-family: dotsies; 17 | | padding-left: 1px; 18 | | font-weight: normal; 19 | | } 20 | =notes/ 21 | " 22 | 23 | def self.menu_after output, *args 24 | return output if output 25 | 26 | txt = args[0] 27 | 28 | txt.strip! 29 | txt.sub! /^: /, '' 30 | txt.gsub! /\n/, ' ' 31 | txt = CGI.escape txt 32 | 33 | Ol "txt", txt 34 | 35 | # "todo" 36 | Browser.url "http://www.youtube.com/results?search_query=#{txt}" 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /roots/zsh.rb: -------------------------------------------------------------------------------- 1 | # /, so tell them to run stuff 2 | 3 | if args == [] 4 | return " 5 | | # Put some zsh code here to run it 6 | | echo 'something' 7 | | echo 'something else' 8 | " 9 | end 10 | 11 | # tasks+, so show items 12 | 13 | return "* exit and run" if task == [] 14 | 15 | return DiffLog.quit_and_run args[0] if task == ["exit and run"] 16 | 17 | # /code, so run it 18 | 19 | txt = args[0] 20 | File.open("/tmp/zsh.sh", "w") { |f| f << txt } 21 | txt = Shell.command "zsh /tmp/zsh.sh"#, :stdin=>"foo" 22 | Tree.quote txt 23 | 24 | -------------------------------------------------------------------------------- /spec/conf_handler_spec.rb: -------------------------------------------------------------------------------- 1 | $:.unshift "spec/" 2 | 3 | require './spec/spec_helper' 4 | 5 | require 'xiki/handlers/conf_handler' 6 | 7 | %w"xiki/core/tree".each {|o| require o} 8 | 9 | # No longer used - Xik.new now is used instead 10 | 11 | -------------------------------------------------------------------------------- /spec/fixtures/menu/aftershave.rb: -------------------------------------------------------------------------------- 1 | class Aftershave 2 | def self.menu_after *args 3 | " 4 | - hi from .menu_after 5 | " 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/fixtures/menu/beef.rb: -------------------------------------------------------------------------------- 1 | class Beef 2 | MENU = 3 | " 4 | > From MENU constante 5 | - con1/ 6 | - con2/ 7 | - conb/ 8 | - whatever/ 9 | " 10 | def self.menu_before *args 11 | "lika tolya beefo: #{args.inspect}" 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/fixtures/menu/beeff.menu: -------------------------------------------------------------------------------- 1 | - foo/ 2 | - new menu/ 3 | -------------------------------------------------------------------------------- /spec/fixtures/menu/beeff.rb: -------------------------------------------------------------------------------- 1 | class Beeff 2 | def self.menu_before *args 3 | "lika tolya befo: #{args.inspect}" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/fixtures/menu/beefm.rb: -------------------------------------------------------------------------------- 1 | class Beefm 2 | def self.menu *args 3 | " 4 | - moo/ 5 | " 6 | end 7 | def self.menu_before *args 8 | "lika tolya befo: #{args.inspect}" 9 | nil 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/fixtures/menu/clam.rb: -------------------------------------------------------------------------------- 1 | class Clam 2 | def self.menu 3 | " 4 | - r1/ 5 | - r11/ 6 | " 7 | end 8 | end 9 | "stuff at end" 10 | -------------------------------------------------------------------------------- /spec/fixtures/menu/clam_soup.rb: -------------------------------------------------------------------------------- 1 | class ClamSoup 2 | def self.menu 3 | " 4 | - r1/ 5 | - r11/ 6 | " 7 | end 8 | end 9 | "stuff at end" 10 | -------------------------------------------------------------------------------- /spec/fixtures/menu/constable.rb: -------------------------------------------------------------------------------- 1 | class Constable 2 | MENU = 3 | " 4 | > From MENU constante 5 | - con1/ 6 | - con2/ 7 | - .conm/ 8 | - conb/ 9 | - whatever/ 10 | " 11 | def self.conm 12 | "- hi from self.conm" 13 | end 14 | def self.menu *args 15 | "- hi from self.menu" 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /spec/fixtures/menu/ddm/index.menu: -------------------------------------------------------------------------------- 1 | > Important options 2 | - a/ 3 | - b/ 4 | -------------------------------------------------------------------------------- /spec/fixtures/menu/ddt/a.txt: -------------------------------------------------------------------------------- 1 | aaaaa 2 | -------------------------------------------------------------------------------- /spec/fixtures/menu/ddt/b.txt: -------------------------------------------------------------------------------- 1 | bbbbb 2 | -------------------------------------------------------------------------------- /spec/fixtures/menu/di/index.menu: -------------------------------------------------------------------------------- 1 | - foo/ 2 | - new menu/ 3 | -------------------------------------------------------------------------------- /spec/fixtures/menu/di/index.txt: -------------------------------------------------------------------------------- 1 | Hey from index 2 | -------------------------------------------------------------------------------- /spec/fixtures/menu/didi/a/index.rb: -------------------------------------------------------------------------------- 1 | class DidiAIndex 2 | def self.menu 3 | " 4 | - foo/ 5 | - new menu/ 6 | " 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/fixtures/menu/didi/index.rb: -------------------------------------------------------------------------------- 1 | class DidiIndex 2 | def self.menu 3 | " 4 | - foo/ 5 | - new menu/ 6 | " 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/fixtures/menu/dm/a.menu: -------------------------------------------------------------------------------- 1 | - foo/ 2 | - new menu/ 3 | -------------------------------------------------------------------------------- /spec/fixtures/menu/dmr/a/aa.menu: -------------------------------------------------------------------------------- 1 | - m1/ 2 | - m11/ 3 | -------------------------------------------------------------------------------- /spec/fixtures/menu/dmr/a/ab.rb: -------------------------------------------------------------------------------- 1 | class R 2 | def self.menu 3 | " 4 | - r1/ 5 | - r11/ 6 | " 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/fixtures/menu/dmr/b.menu: -------------------------------------------------------------------------------- 1 | - m1/ 2 | - m11/ 3 | -------------------------------------------------------------------------------- /spec/fixtures/menu/dmr/c.rb: -------------------------------------------------------------------------------- 1 | class C 2 | def self.menu 3 | " 4 | - r1/ 5 | - r11/ 6 | " 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/fixtures/menu/dni/index.notes: -------------------------------------------------------------------------------- 1 | > Hello from dni 2 | Hiya 3 | -------------------------------------------------------------------------------- /spec/fixtures/menu/dotty.rb: -------------------------------------------------------------------------------- 1 | class Dotty 2 | MENU = 3 | " 4 | > From MENU constant 5 | - .methane/ 6 | - .methlab/ 7 | - menu param/ 8 | - another 9 | - .nested dots/ 10 | - .dotted/ 11 | - plain 12 | - sub dots/ 13 | - .dotted/ 14 | - plain 15 | - normal/ 16 | - .params with dots/ 17 | " 18 | def self.methane 19 | "- hi from self.methane" 20 | end 21 | def self.methlab *args 22 | "- hi from self.methlab: #{args.inspect}" 23 | end 24 | def self.params_with_dots *args 25 | return ".normalparam" if args.blank? 26 | "you passed me: #{args.inspect}" 27 | end 28 | 29 | def self.dotted *args 30 | "dot: #{args}" 31 | end 32 | 33 | 34 | def self.menu *args 35 | "- in last case, fall back to .menu" 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /spec/fixtures/menu/dr/a.rb: -------------------------------------------------------------------------------- 1 | class A 2 | def self.menu 3 | " 4 | - r1/ 5 | - r11/ 6 | " 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/fixtures/menu/dr/b.rb: -------------------------------------------------------------------------------- 1 | class B 2 | def self.menu 3 | " 4 | - r1/ 5 | - r11/ 6 | " 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/fixtures/menu/drdr.rb: -------------------------------------------------------------------------------- 1 | " 2 | > from drdr code 3 | - a/ 4 | " 5 | -------------------------------------------------------------------------------- /spec/fixtures/menu/drdr/a.rb: -------------------------------------------------------------------------------- 1 | " 2 | > Stuff in a 3 | - b/ 4 | " 5 | -------------------------------------------------------------------------------- /spec/fixtures/menu/drdr/a/b.rb: -------------------------------------------------------------------------------- 1 | # class DrdrAB 2 | # def self.menu 3 | # " 4 | # - foo/ 5 | # - new menu/ 6 | # " 7 | # end 8 | # end 9 | " 10 | > Welcome 11 | | Welcome to b! 12 | | This is te end of the road. 13 | " 14 | -------------------------------------------------------------------------------- /spec/fixtures/menu/drdrred_herring: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /spec/fixtures/menu/dt/a.txt: -------------------------------------------------------------------------------- 1 | aaaaa 2 | -------------------------------------------------------------------------------- /spec/fixtures/menu/dt/b.txt: -------------------------------------------------------------------------------- 1 | bbbbb 2 | -------------------------------------------------------------------------------- /spec/fixtures/menu/embassy.menu: -------------------------------------------------------------------------------- 1 | - yell/ 2 | ! "ah" * 5 3 | - calculate/ 4 | ! a = 2 5 | ! a ** 3 6 | -------------------------------------------------------------------------------- /spec/fixtures/menu/film.menu: -------------------------------------------------------------------------------- 1 | - drama/ 2 | - Blade Runner/ 3 | -------------------------------------------------------------------------------- /spec/fixtures/menu/film.rb: -------------------------------------------------------------------------------- 1 | class Film 2 | def self.menu *args 3 | "- hey from self.menu #{args}" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/fixtures/menu/hidein.rb: -------------------------------------------------------------------------------- 1 | class Hidein 2 | 3 | MENU_HIDDEN = " 4 | - .bar/ 5 | " 6 | # Not sure if this matters 7 | def self.menu *args 8 | " 9 | - foo #{args} 10 | | Also try the hidden 'bar' item 11 | " 12 | end 13 | def self.bar *args 14 | "Rose-anne" 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/fixtures/menu/hideout.rb: -------------------------------------------------------------------------------- 1 | class Hideout 2 | # Not sure if this matters 3 | MENU = " 4 | - fooc/ 5 | > ooooo 6 | | Also try the hidden 'bar' item 7 | " 8 | MENU_HIDDEN = " 9 | - .bar/ 10 | " 11 | def self.bar *args 12 | "Roseanne" 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /spec/fixtures/menu/index.menu: -------------------------------------------------------------------------------- 1 | > Demo menus: 2 | | Simple menus to toy around with basic use cases 3 | 4 | > Basics 5 | >> .menu method 6 | - mentor/ 7 | >> MENU constant 8 | - constable/ 9 | >> .menu file 10 | - film/ 11 | >> dotifying (routing) 12 | - dotty/ 13 | 14 | > Advanced 15 | >> .menu_hidden 16 | | With self.menu, and MENU... 17 | - hidein/ 18 | - hideout/ 19 | >> .menu_before 20 | | Also with menu method and file... 21 | - beef/ 22 | - beefm/ 23 | - beeff/ 24 | >> embedded !... code 25 | - embassy/ 26 | 27 | > Menuless Mode 28 | >> all methods are fair game 29 | - menuless/ 30 | >> instance methods 31 | - todo! 32 | - menuless object/ 33 | -------------------------------------------------------------------------------- /spec/fixtures/menu/mentor.rb: -------------------------------------------------------------------------------- 1 | class Mentor 2 | def self.menu *args 3 | "- hey from self.menu - #{args}" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/fixtures/menu/menuless.rb: -------------------------------------------------------------------------------- 1 | class Menuless 2 | def self.aa *args 3 | "yaaa: #{args}" 4 | end 5 | def self.bb 6 | "yabbbba" 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/fixtures/menu/menuless_object.rb: -------------------------------------------------------------------------------- 1 | class MenulessObject 2 | def aaa *args 3 | "yaaa: #{args}" 4 | end 5 | def bbb 6 | "yabbbba" 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/fixtures/menu/menulessob.rb: -------------------------------------------------------------------------------- 1 | class Menulessob 2 | def aaa *args 3 | "yaaa instance: #{args}" 4 | end 5 | def bbb 6 | "yabbbba instance" 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/fixtures/menu/mr.menu: -------------------------------------------------------------------------------- 1 | - foo/ 2 | - new menu/ 3 | -------------------------------------------------------------------------------- /spec/fixtures/menu/mr.rb: -------------------------------------------------------------------------------- 1 | class Mr 2 | def self.menu 3 | " 4 | - foo/ 5 | - new menu/ 6 | " 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/fixtures/menu/mrd.menu: -------------------------------------------------------------------------------- 1 | - foo/ 2 | - new menu/ 3 | -------------------------------------------------------------------------------- /spec/fixtures/menu/mrd.rb: -------------------------------------------------------------------------------- 1 | class Mrd 2 | def self.menu 3 | " 4 | - foo/ 5 | - new menu/ 6 | " 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/fixtures/menu/poro.rb: -------------------------------------------------------------------------------- 1 | class Poro 2 | def self.aa *args 3 | "x #{args}" 4 | end 5 | def self.bb 6 | "bbbbbbb" 7 | end 8 | def self.set_z arg=nil 9 | return "sample" if !arg 10 | @z = arg 11 | "- set it to #{arg}!" 12 | end 13 | def self.get_z 14 | @z 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/fixtures/menu/rs.rb: -------------------------------------------------------------------------------- 1 | sum = 1 + 2 2 | "hello menu world: #{sum}" 3 | -------------------------------------------------------------------------------- /spec/fixtures/menu/ti/index.txt: -------------------------------------------------------------------------------- 1 | Just some *index* 2 | text for you. 3 | -------------------------------------------------------------------------------- /spec/html_spec.rb: -------------------------------------------------------------------------------- 1 | $:.unshift "spec/" 2 | module Xiki; end 3 | require 'xiki/core/tree' 4 | require 'xiki/core/html' 5 | require './spec/spec_helper' 6 | 7 | describe Html, "#to_html_tags" do 8 | it "handles one tag" do 9 | Html.to_html_tags(" 10 | p/ 11 | hi 12 | ".unindent).should == " 13 |

14 | hi 15 |

16 | ".unindent 17 | end 18 | 19 | it "handles single with no contents" do 20 | Html.to_html_tags(" 21 | p/ 22 | ".unindent).should == " 23 |

24 |

25 | ".unindent 26 | end 27 | 28 | it "doesn't confuse comments" do 29 | Html.to_html_tags(" 30 | p/ 31 | /* hey */ 32 | ".unindent).should == " 33 |

34 | /* hey */ 35 |

36 | ".unindent 37 | end 38 | 39 | it "adds closing tags to html" do 40 | Html.to_html_tags(" 41 |

42 | hi 43 | ".unindent).should == " 44 |

45 | hi 46 |

47 | ".unindent 48 | end 49 | 50 | it "doesn't close comment tags" do 51 | Html.to_html_tags(" 52 | 53 | hi 54 | ".unindent).should == " 55 | 56 | hi 57 | ".unindent 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /spec/rest_tree_spec.rb: -------------------------------------------------------------------------------- 1 | $:.unshift "spec/" 2 | require './spec/spec_helper' 3 | 4 | require 'xiki/core/tree' 5 | require 'xiki/core/rest_tree' 6 | 7 | describe RestTree, "#comment_embedded_menu" do 8 | 9 | it "returns unaltered when no comment" do 10 | RestTree.comment_embedded_menu("foo", "foo").should == nil 11 | end 12 | 13 | it "uses a menu" do 14 | txt = " 15 | Hey 16 | 20 | " 21 | RestTree.comment_embedded_menu(txt, "").should == "+ foo/\n+ bar/\n" 22 | end 23 | 24 | it "uses menu when path" do 25 | txt = " 26 | Hey 27 | 32 | " 33 | RestTree.comment_embedded_menu(txt, "xiki://localhost/foo").should == "- XX\n" 34 | end 35 | 36 | end 37 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rr' 2 | require 'awesome_print' 3 | 4 | XIKI_SERVER_MODE = false if ! defined?(XIKI_SERVER_MODE) 5 | 6 | %w"xiki/core/core_ext xiki/core/ol".each {|o| require o} 7 | 8 | # RSpec::Runner.configure do |config| 9 | RSpec.configure do |config| 10 | config.mock_with :rr 11 | config.expect_with(:rspec) { |c| c.syntax = :should } 12 | end 13 | 14 | module Xiki 15 | def self.dir 16 | File.expand_path("#{File.dirname(__FILE__)}/..") + "/" 17 | end 18 | end 19 | 20 | def stub_menu_path_dirs 21 | xiki_dir = Xiki.dir 22 | 23 | list = ["#{xiki_dir}spec/fixtures/menu", "#{xiki_dir}commands"] 24 | stub(Xiki).xiki_path_dirs {list} 25 | end 26 | 27 | 28 | # Put this here until we can put it in a better place 29 | # - Maybe so it'll be used by main xiki and conf 30 | AwesomePrint.defaults = { 31 | :indent => -2, # left-align hash keys 32 | :index => false, 33 | :multiline => true, 34 | } 35 | 36 | include Xiki # Allows all specs to use classes in the Xiki module without "Xiki::" 37 | -------------------------------------------------------------------------------- /tests/console_test.rb: -------------------------------------------------------------------------------- 1 | require 'test/unit' 2 | $:.unshift File.expand_path("..") 3 | require 'console' 4 | require 'ol' 5 | class CodeTreeTest < Test::Unit::TestCase 6 | 7 | def test_extract_method 8 | assert_equal("ssh foo@foo.org", Shell.ssh_line("/foo@foo.org/")) 9 | assert_equal("ssh -p 1234 foo@foo.org", Shell.ssh_line("foo@foo.org:1234")) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /tests/el_mixin.rb: -------------------------------------------------------------------------------- 1 | class Elvar 2 | def method_missing(func, *args, &block) 3 | # Do nothing 4 | print "B" 5 | end 6 | end 7 | 8 | module ElMixin 9 | def elvar 10 | Elvar.new 11 | end 12 | def method_missing(func, *args, &block) 13 | # Do nothing 14 | print "B" 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /tests/keys_test.rb: -------------------------------------------------------------------------------- 1 | require 'test/unit' 2 | $:.unshift "../" 3 | require 'ol' 4 | require 'core_ext' 5 | require 'yaml' 6 | require 'keys' 7 | 8 | class GitTest < Test::Unit::TestCase 9 | 10 | def test_words_to_letters 11 | assert_equal "TE", Keys.words_to_letters("to_end") 12 | end 13 | 14 | def test_status_to_hash 15 | assert_equal "C-t C-e", Keys.translate_keys("TE") 16 | assert_equal "M-t C-e", Keys.translate_keys("_TE") 17 | end 18 | 19 | end 20 | -------------------------------------------------------------------------------- /tests/line_test.rb: -------------------------------------------------------------------------------- 1 | require 'test/unit' 2 | $:.unshift "../" 3 | require 'line' 4 | require 'core_ext' 5 | 6 | class LineTest < Test::Unit::TestCase 7 | 8 | def test_normal 9 | assert_equal "you", Line.without_label(:line=>"- hey: you") 10 | end 11 | 12 | def test_just_bullet 13 | assert_equal "you", Line.without_label(:line=>"- you") 14 | end 15 | 16 | def test_blank 17 | assert_equal "", Line.without_label(:line=>"- hey: ") 18 | end 19 | 20 | def test_with_indent 21 | assert_equal "you", Line.without_label(:line=>" - hey: you") 22 | assert_equal "", Line.without_label(:line=>" - hey: ") 23 | assert_equal "you", Line.without_label(:line=>" - you") 24 | end 25 | 26 | def test_leave_indent 27 | assert_equal " you", Line.without_label(:line=>" - hey: you", :leave_indent=>true) 28 | assert_equal " ", Line.without_label(:line=>" - hey: ", :leave_indent=>true) 29 | end 30 | 31 | # Make sure it doesn't mess up the string 32 | def test_side_effects 33 | before = " - label: hey1" 34 | Line.without_label(:line=>before) 35 | assert_equal " - label: hey1", before 36 | end 37 | 38 | end 39 | -------------------------------------------------------------------------------- /tests/merb_test.rb: -------------------------------------------------------------------------------- 1 | require 'test/unit' 2 | $:.unshift "../" 3 | require 'merb' 4 | require 'core_ext' 5 | 6 | class MerbTest < Test::Unit::TestCase 7 | 8 | def test_name_from_dir 9 | assert_equal "you", Merb.name_from_dir("/hey/you") 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /tests/redmine_test.rb: -------------------------------------------------------------------------------- 1 | require 'test/unit' 2 | $:.unshift "../" 3 | require 'redmine' 4 | require 'core_ext' 5 | 6 | class RedmineTest < Test::Unit::TestCase 7 | 8 | # Should correctly format simple diff 9 | def test_redmine_to_xiki 10 | before = 11 | "#Dev Team Todo 12 | ##h2 13 | * Ad 14 | * 70 15 | ** Make them show 16 | ".unindent 17 | 18 | after = 19 | "| Dev Team Todo 20 | || h2 21 | - Ad 22 | - 70 23 | - Make them show 24 | ".unindent 25 | 26 | assert_equal(after, Redmine.redmine_to_xiki(before)) 27 | end 28 | 29 | # Should correctly format simple diff 30 | def test_xiki_to_redmine 31 | before = 32 | "| Dev Team Todo 33 | || h2 34 | - Ad 35 | - 70 36 | - Make them show 37 | ".unindent 38 | 39 | after = 40 | "#Dev Team Todo 41 | ##h2 42 | * Ad 43 | * 70 44 | ** Make them show 45 | ".unindent 46 | 47 | assert_equal(after, Redmine.xiki_to_redmine(before)) 48 | end 49 | 50 | end 51 | -------------------------------------------------------------------------------- /tests/remote_test.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'test/unit' 3 | $:.unshift "../" 4 | require 'remote' 5 | 6 | class RemoteTest < Test::Unit::TestCase 7 | 8 | def test_split_root 9 | assert_equal(['user', 'foo.com', '2122', '/var/main'], Remote.split_root('user@foo.com:2122/var/main')) 10 | assert_equal(['user', 'foo.com', '2122', '/'], Remote.split_root('user@foo.com:2122/')) 11 | assert_equal(['user', 'foo.com', '2122', '/'], Remote.split_root('user@foo.com:2122')) 12 | end 13 | 14 | def test_sort 15 | txt = "ajax/ 16 | apcx.orig 17 | css/ 18 | f.wav 19 | ".gsub(/^ +/, '') 20 | 21 | expected = ["ajax/", "css/", "apcx.orig", "f.wav"] 22 | assert_equal(expected, Remote.sort(txt)) 23 | end 24 | 25 | def test_split_root 26 | assert_equal(["xiki", "xiki.org", "222", "/tmp"], Remote.split_root("xiki@xiki.org:222/tmp/")) 27 | assert_equal(["xiki", "xiki.org", "22", "/tmp"], Remote.split_root("xiki@xiki.org/tmp/")) 28 | assert_equal(["xiki", "xiki.org", "22", "/tmp"], Remote.split_root("/xiki@xiki.org/tmp/")) 29 | end 30 | 31 | end 32 | --------------------------------------------------------------------------------