それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。

Rubyのサンプル集CheatSheetが面白い。

rubygems で使えるパッケージ cheatを試した。これが面白い。

専用コマンドで、Rubyの使い方を見ることが出来ます。

コマンドプロンプトから使えます。

サンプルコードが閲覧できて便利です。

簡単にRailsのリファレンスが引けます

rails_migrationsの使い方

$ cheat rails_migrations
rails_migrations:
  http://wiki.rubyonrails.com/rails/pages/UsingMigrations

  valid data types:
    :integer :float
    :datetime :date :timestamp :time
    :text :string
    :binary
    :boolean
  options:
    :null (boolean)
    :limit (integer)
    :default
    :precision (integer)
    :scale (integer)

  create the model       ./script/generate model model_name
  apply schema changes   rake db:migrate
  modify schema          ./script generate migration description_name

tidy の使用例を探してみた。

こんな風に、実例が出てくる。これってとても便利だったりする。特にインストールと使用例が便利です。
マニュアルで足りないときの補完にちょうど良いですね。

$ cheat tidy

tidy:
  Tidy Ruby Gem
   Tidy: http://tidy.sourceforge.net/
   Tidy-Ruby: http://rubyforge.org/projects/tidy/
  
  If you're experiencing a Segmentation Fault (Rails app could not start)
  see http://github.com/FireRabbit/tidy/tree
  
  List of Tidy-Ruby Options
  (中略..)
  Installation 
  ===========================================
  (中略..)
  Usage & Examples
  ===========================================
   require 'tidy'
  
  # This might be required if your app is crashing. 
  # This is only available in the forked tidy. 
  # see Installation above
  Tidy.fresh_tidy_version = true 
  
   Tidy.path = '/usr/lib/tidylib.so'
   html = '<html><title>title</title>Body</html>'
  
   Tidy.open(:show_warnings=>true) do |tidy|
      puts tidy.options.show_warnings # returns True
      xml = tidy.clean(html) # See note below
  
      puts tidy.errors # array
      puts tidy.diagnostics # array
      puts xml
    end
  (略..)

cheat の準備

gem install cheat

cheat の使い方を見る

cheat cheat 

cheat sheet の一覧を見る

cheat sheet | more
All Cheat Sheets:
  a2ps
  a2ps_page_size
  ack
  acts_as_authenticated
  acts_as_state_machine
(略)

たくさんあります。

CheatSheetの管理元

CheatSheetはWikiで管理されていて、編集に参加することが出来るようです。
$ command line ruby cheat sheets

現在閲覧できるCheatSheet一覧は次の通り

$ cheat sheets
All Cheat Sheets:
  a2ps
  a2ps_page_size
  ack
  acts_as_authenticated
  acts_as_state_machine
  acts_as_taggable_on
  address
  administrateme
  agile
  alias
  amazon_conditions
  ambition
  android
  ansi
  apache
  apache2
  apache_regex
  aptitude
  arel_expressions
  arel_predications
  ar_i18n
  arspy
  arts
  aruba
  as3_formulas
  ascii
  asdf
  assert
  assert_block
  assert_difference
  assert_dom_equal
  assert_dom_not_equal
  assert_equal
  assert_generates
  assert_have_selector
  assert_in_delta
  assert_instance_of
  assertions
  assert_kind_of
  assert_match
  assert_nil
  assert_no_difference
  assert_no_match
  assert_no_tag
  assert_not_equal
  assert_nothing_raised
  assert_nothing_thrown
  assert_not_nil
  assert_not_same
  assert_operator
  assert_raise
  assert_raises
  assert_recognizes
  assert_redirected_to
  assert_respond_to
  assert_response
  assert_routing
  assert_same
  assert_select
  assert_send
  assert_tag
  assert_template
  assert_throws
  assert_valid
  association_methods
  asunit
  auth
  authorizenet
  autotest
  averylongnamethatwecanfind
  awesome
  awk
  bacon
  balloon
  bartleby
  bash
  bash_complete
  bashhistory
  bash_param
  bash_scripting
  batman
  belongs_to
  benchmark
  beyondtheurinal
  blender
  blogs
  blow
  blueprint
  bm
  boost_test
  borg
  box_chars
  boyfriend
  bpd
  braid
  brcbrcbrc
  bruce_schneier_facts
  bsd_license
  bug
  bzr
  callbacks
  canvas
  capazon
  cap_bare
  cap_deploy
  capistrano
  cascading
  ccrb
  centos_clone
  cformats
  chase
  chat
  cheat
  cheatcheatit
  cheat_el
  cheats
  cheat_sheets_om
  chmod
  chocolate
  chrome
  chuck_norris_facts
  clojure
  cocoaerrors
  coding
  colored
  commands
  compass
  compass_wordpress
  conkeror
  console
  convert_odt_pdf
  cool_options
  couchdb
  cpio
  cron
  cryptsetup
  css3_selectors
  css_at_rules
  css_boxing
  css_media
  css_selectors
  cucumber
  cuke4duke
  curl
  cut
  damon
  darcs
  darcs_record
  database_yml
  datamapper
  date
  date_info
  death
  deb_packages
  declarative_authorization
  default_passwords
  delete_me
  dell_linux_bios_update
  deprec
  deprec2
  deprecated
  dexagogo_form_validation
  diakonos
  ditto
  ditz
  dollar
  dom
  doom
  dpkg
  dragon_warrior
  drush
  dsvn
  du
  dvtm
  ec2
  ecb
  eclim
  ed
  eg
  elad
  emacs
  emacs_basics
  emacs_psvn
  emacs_slime
  emacs_tips
  enumerable
  environments
  erb
  erl
  erlang
  e_text_editor
  euca2ools
  exceptions
  factory_girl
  faker
  faster_csv
  fbgraph
  fela
  ffi
  ffmpeg
  fidic
  file_test
  final_fantasy_6
  finance
  find
  finder
  firebug
  firefox_lockdown
  firephp
  fish
  flashen
  flickrurl
  fm
  foo
  form_for
  freebsd
  ftp
  gadding
  galician_stew
  gazpacho
  gcc
  gem
  gemfile
  gemfile
  gems
  ghi
  girlfriend
  gist_vim
  git
  git_add_i
  git_buildpackage
  git_collaboration
  gitignore
  gitosis
  git_remote_branch
  git_submodule
  gitsvn
  git_textmate_bundles
  git_usage
  gjs
  globals
  gmail
  gnome_terminals_4_rails
  gnupg
  google
  gpg
  gpl
  gpl_short
  grails
  greader
  greek_alphabet
  grep
  groovy_sql
  gruff
  gslice
  gsub
  gtd
  guitar
  haiku
  haml
  has_and_belongs_to_many
  hash
  has_many
  has_one
  have_tag
  helm
  help
  heroku
  hg
  highline
  history
  hitch
  hobo
  hobo_template
  hot_chocolate
  how_to_make_english_muffins
  how_to_make_flour_tortillas
  hpricot
  htaccess4
  html
  http
  http_status_codes
  hub
  husband
  iana_port_list
  iconv
  illinois
  il_screen
  imagemagick_geometry
  install_cucumber_gem
  install_rspec_rails
  install_rspec_rails114
  into_the_code
  io
  iomodes
  iphone
  ipod_touch
  irb
  irc
  jasmine
  java
  jedit_ruby_editor_plugin
  jquery
  karma
  kbkbkkbkbkbkbkbkkb
  kde_session
  kenzu_ryu
  kernel_update
  kill
  konami_code
  ksdhfv
  leopard
  less
  lesscss
  lgpl
  life
  lift
  lighthouse
  link_to_remote
  linux
  linux_ext_monitor
  linux_history
  linux_network_boot
  linux_nic
  ln
  logging
  lorem
  lorem_ipsum
  lorum
  lose_weight
  lotus_domino_url
  ls
  lsof
  lucene_query_syntax
  lvm
  mac_gem_install_mysql
  mac_glyphs
  mac_shortcuts
  magit
  mail
  makaveli
  markaby
  markdown
  marsmission
  matchy
  mate
  matz_bot
  mechanize
  mencoder
  merb
  mercurial
  metaprogramming
  method_lister
  microformats_helper
  migrations
  military_alphabet
  minitest
  misc
  mite
  mit_license
  mktime
  mocha
  mod_rewrite
  mogitblame
  moneta
  mongo
  mount_dd_image
  mount_lvm
  mplayer
  mustache
  mutt_gmail
  mysql
  mysql_delete
  mysql_insert
  mysql_move
  mysql_select
  mysql_update
  named_scope
  nanoc
  nc
  nerd_tree
  netbeans
  netstat
  nginx
  nibblenuts
  nils
  nmap
  nokogiri
  nonsense
  notify
  nslog
  number_lines
  obj_c
  objc_formats
  odbc
  okay
  omlinux
  oneline
  oop
  opensc
  open_solaris
  openssl
  oracle
  orgmode
  orgmode_agenda_views
  orgmode_archiving
  orgmode_cal_diary
  orgmode_completion
  orgmode_dynamic_blocks
  orgmode_exporting_publishing
  orgmode_filter_and_sparse_trees
  orgmode_getting_started
  orgmode_latex_mode
  orgmode_links
  orgmode_motion
  orgmode_structure_editing
  orgmode_tables
  orgmode_tags
  orgmode_timestamps
  orgmode_todo_and_checkboxes
  orgmode_visibility_cycling
  osxbash
  osx_emacskeys
  pack
  pairing
  palm_webos
  passenger
  password
  paste
  pastie_vim
  pdf
  perforce
  perl
  perldoc
  perl_replace
  permalink_fu
  permissions
  phonetic
  piston
  plugins
  poker
  police
  port
  postgis
  postgres
  predefined_variables
  prim
  prototype
  python_doctest
  python_web
  queriac
  r4fy
  rack
  rack_profiler
  radrails
  radrails_rhtml
  radrails_ruby
  rails
  rails_checklist
  rails_configuration
  rails_console
  rails_conventions
  rails_data_types
  rails_date_formats
  rails_edge
  rails_environment
  rails_helpers
  rails_keywords
  rails_migrations
  rails_plugin_creation
  rails_plugin_creation_detailed_example
  rails_rake_tasks
  rails_relationships
  rails_request_object
  rails_reserved_words
  rails_review
  rails_routes
  rails_svn
  rails_tasks
  rails_tips
  rails_to_s
  rails_vim
  raise_rescue
  rake
  ratpoison
  rcov
  rdebug
  rdf
  rdiff_backup_restore
  rdoc
  readline
  readme
  recursive
  redirect
  redis
  regelwerk
  regex
  regex_lib
  regexp
  remarkable
  remind_commands
  resource_controller
  rest
  rexml
  rgit
  rinari
  rjs
  rkj
  rm
  robotlegs
  roo
  rope
  rpm
  rpm2cpio
  rspec
  rspec_formats
  rspec_on_rails_matchers
  rspec_should
  rspec_shoulda
  rsync
  rtorrent
  ruby
  ruby1line
  ruby_about_com_example
  ruby_arrays
  ruby_comments
  rubydebug
  ruby_globals
  rubyio
  ruby_kernel_test
  ruby_keywords
  ruby_license
  ruby_main
  ruby_mode_strings
  ruby_naming
  ruby_one_liners
  ruby_percent
  ruby_predef
  rubyprof
  ruby_string
  ruby_tools
  runescape
  rvm
  rzyncbackup
  s3sync
  saf
  sake
  sass
  scaffold_resource
  scala
  scili
  scp
  scrapi
  screen
  sed
  sed_delete
  sed_numbering
  sed_print
  sed_spacing
  select_box
  selenium
  selenium_on_rails
  sem
  semweb
  sendmail
  sen_test_assertions
  seo
  sequel
  servers
  seven_dwarves
  sex
  sh
  sheets
  shoes
  shoulda
  simpletest
  sinatra
  site
  sketch
  slicehost
  smalltalk
  sness
  solaris_smf
  sort
  spc
  spirit_of_the_game
  spock
  sprintf
  sql
  sql_alter
  sqld4r
  sqlite
  sqlite_console
  sre
  ssh
  sshkeys
  status_codes
  sti
  strftime
  string
  string_template
  string_unpack
  strptime
  styleguide
  sudo
  sun_ilom
  sunspot
  svn
  svnmerge
  swfobject
  symlink
  syntax
  tar
  taxes
  tempfile
  terminal
  terminal_escapes
  tes
  test
  test1001
  test2
  test3
  teste
  testing
  test_spec
  test_spec_rails
  testtesttest
  test_unit
  textadept
  textile
  textmate
  textmate_rails
  textmate_ruby
  textorize
  tgd
  the_game
  the_irs
  this
  thor
  tidy
  tinyos
  tld
  tmux
  todoist
  toggle_fold_fix
  to_i
  triforce
  tung
  tunneling
  tweet_im
  twitterrific
  ubuntu
  ubyubyuby
  undo_tree
  unicode
  unix
  unpack
  unzip
  uri
  user
  validations
  vi
  vim
  vim2
  vimdiff
  vim_folding
  vim_goodies
  vs2005
  w3m
  watir
  watir_ie
  webrat
  websphere
  wife
  win32_sc
  wmii3
  word
  wordpress
  words_with_friends
  wxd
  xargs
  xcode
  xfbml
  xmonad
  xmpp
  xpath
  xpath_result_type
  xrandr
  xslt
  yaml
  yard
  yas_ruby_snippet
  yboss
  yeah
  yui
  yuiconnect
  yuidom
  yuievent
  yuifonts
  yui_fonts
  yuiglobal
  yuigrids
  yui_grids
  yuilang
  yum_upgrade
  zeiten
  zentest
  zsh
  zsh_array
  zsh_bang
  zsh_case
  zsh_ftp
  zsh_glob
  zsh_if
  zsh_keys
  zsh_loop
  zsh_modifiers
  zsh_param
  zsh_process
  zsh_ranges
  zsh_rename
  zsh_startup
  ztd
  zz_reuse_00
  zzz000reuse
  zzz001reuse
  zzz002delete
  zz_z003delete
  zzz_reuse_00
  zzz_reuse_01
  zzz_reuse_02