Upgrade to Pro — share decks privately, control downloads, hide ads and more …

20 Tools and Techniques that Make You More Prod...

20 Tools and Techniques that Make You More Productive

Yuki Nishijima

June 24, 2016
Tweet

More Decks by Yuki Nishijima

Other Decks in Programming

Transcript

  1.    5P P M T  B O

    E  5F D I O J R V F T  U I B U  . B L F  :P V  . P S F  $ S F B U J W F
  2. require "did_you_mean" "Yuki".starts_with?("Y") # => NoMethodError: undefined method `starts_with?’ for

    … # Did you mean? start_with? I S E E Y O U A R E T RY I N G T O C A L L A M E T H O D
  3.    5P P M T  B O

    E  5F D I O J R V F T  U I B U  . B L F  :P V  . P S F  $ S F B U J W F
  4. require 'did_you_mean/experimental' @full_name = "Yuki Nishijima" @full_anme.split(" ") # =>

    NoMethodError: undefined method `split' for nil:NilClass # Did you mean? @full_name Tip 1 / 20
  5. class User def iniialize(name, ...) ... end end User.new("Yuki Nishijima",

    ...) # => ArgumentError: wrong number of arguments … 5ZQP Tip 3 / 20
  6. require 'did_you_mean/experimental' class User def iniialize(name, ...) ... end end

    # => warning: iniialize might be misspelled, perhaps you meant initialize? User.new("Yuki Nishijima", ...) # => ArgumentError: wrong number of arguments … Tip 3 / 20
  7. $ bundle config --global jobs 1 $ time bundle …

    Bundle complete! 96 Gemfile dependencies, 228 gems now installed. real 2m53.697s user 0m14.158s sys 0m4.141s $ 3 min ! >= 1.8.0 Tip 4 / 20
  8. $ bundle config --global jobs 16 $ time bundle …

    Bundle complete! 96 Gemfile dependencies, 228 gems now installed. real 0m25.994s user 0m15.606s sys 0m6.555s $ 30 sec " >= 1.8.0 Tip 4 / 20 
  9. $ rails c Loading development environment (Rails 4.2.6) [1] pry(main)>

    app.get "/" Started GET "/" for 127.0.0.1 at 2016-06-12 22:19:21 +0000 Processing by ProductsController#index as HTML Product Load (1.0ms) SELECT "products".* FROM "products" LIMIT 25 OFFSET 0 Rendered products/index.html.haml within layouts/application (3.1ms) … Rendered shared/_head.html.haml (9.6ms) Rendered shared/_footer.html.haml (40.1ms) Completed 200 OK in 104ms (Views: 100.6ms | ActiveRecord: 1.0ms) => 200 [2] pry(main)> Tip 5 / 20
  10. git diff`TOFXDPNQBDUJPOIFVSJTUJD >= 2.9 Tip 8 / 20 git diff

    --compaction-heuristic git config --global diff.compactionHeuristic true PS
  11. $ mv path/to/old.rb path/to/new.rb $ mv path/to/{old,new}.rb # same as

    above $ cp path/to/org.rb path/to/new.rb $ cp path/to/{org,new}.rb # same as above Tip 9 / 20
  12. $ history 1039 git add ext/ 1040 gst 1041 git

    add . 1042 gst … 2029 git git git://git.git.git/git/git.git git 2030 more ~/.gitconfig 2031 more /etc/hosts 2032 gst 2033 cd ../did 2034 cd ../../did_you_mean 2035 gst 2036 history $ Tip 10 / 20
  13. $ history 1039 git add ext/ 1040 gst 1041 git

    add . 1042 gst … 2029 git git git://git.git.git/git/git.git git 2030 more ~/.gitconfig 2031 more /etc/hosts 2032 gst 2033 cd ../did 2034 cd ../../did_you_mean 2035 gst 2036 history $ Tip 10 / 20
  14. 2034 cd ../../did_you_mean 2035 rake test test:experimental test:accuracy benchmark:memory 2036

    history 2037 gst 2038 history vagrant@ubuntu-14:/GitHub/did_you_mean$ !2035 rake test test:experimental test:accuracy benchmark:memory /home/vagrant/.rbenv/versions/2.4.0-dev/bin/ruby -w -I"lib:test" -I"/home/ vagrant/.rbenv/versions/2.4.0-dev/lib/ruby/gems/2.4.0/gems/rake-11.1.2/lib" "/home/ vagrant/.rbenv/versions/2.4.0-dev/lib/ruby/gems/2.4.0/gems/rake-11.1.2/lib/rake/ rake_test_loader.rb" "test/core_ext/name_error_extension_test.rb" "test/edit_distance/ jaro_winkler_test.rb" "test/spell_checker_test.rb" "test/spell_checking/ class_name_test.rb" "test/spell_checking/method_name_test.rb" "test/spell_checking/ uncorrectable_name_test.rb" “test/spell_checking/variable_name_test.rb" … vagrant@ubuntu-14:/GitHub/did_you_mean$ Tip 11 / 20
  15. vagrant@ubuntu-14:/GitHub/did_you_mean$ !2035 rake test test:experimental test:accuracy benchmark:memory /home/vagrant/.rbenv/versions/2.4.0-dev/bin/ruby -w -I"lib:test"

    -I"/home/vagrant/.rbenv/ versions/2.4.0-dev/lib/ruby/gems/2.4.0/gems/rake-11.1.2/lib" "/home/vagrant/.rbenv/versions/ 2.4.0-dev/lib/ruby/gems/2.4.0/gems/rake-11.1.2/lib/rake/rake_test_loader.rb" "test/core_ext/ name_error_extension_test.rb" "test/edit_distance/jaro_winkler_test.rb" "test/ spell_checker_test.rb" "test/spell_checking/class_name_test.rb" "test/spell_checking/ method_name_test.rb" "test/spell_checking/uncorrectable_name_test.rb" “test/spell_checking/ variable_name_test.rb" … vagrant@ubuntu-14:/GitHub/did_you_mean$ !! rake test test:experimental test:accuracy benchmark:memory /home/vagrant/.rbenv/versions/2.4.0-dev/bin/ruby -w -I"lib:test" -I"/home/vagrant/.rbenv/ versions/2.4.0-dev/lib/ruby/gems/2.4.0/gems/rake-11.1.2/lib" "/home/vagrant/.rbenv/versions/ 2.4.0-dev/lib/ruby/gems/2.4.0/gems/rake-11.1.2/lib/rake/rake_test_loader.rb" "test/core_ext/ name_error_extension_test.rb" "test/edit_distance/jaro_winkler_test.rb" "test/ spell_checker_test.rb" "test/spell_checking/class_name_test.rb" "test/spell_checking/ method_name_test.rb" "test/spell_checking/uncorrectable_name_test.rb" “test/spell_checking/ variable_name_test.rb" … vagrant@ubuntu-14:/GitHub/did_you_mean$ Tip 12 / 20
  16. vagrant@ubuntu-14:/GitHub/did_you_mean$ tree lib/did_you_mean/spell_checkers/ lib/did_you_mean/spell_checkers/ |-- method_name_checker.rb |-- name_error_checkers | |--

    class_name_checker.rb | `-- variable_name_checker.rb |-- name_error_checkers.rb `-- null_checker.rb 1 directory, 5 files vagrant@ubuntu-14:/GitHub/did_you_mean$ Tip 14 / 20
  17. /GitHub/jruby$ tree -f core/src/ | grep RubyStruct | | |--

    core/src/main/java/org/jruby/RubyStruct.java # == find core/src/ -name "*RubyStruct*" Tip 14 / 20
  18. /GitHub/did_you_mean$ ag literal lib/ lib/did_you_mean/experimental/initializer_name_correction.rb 1:# -*- frozen-string-literal: true -*-

    lib/did_you_mean/formatter.rb 1:# -*- frozen-string-literal: true -*- lib/did_you_mean/spell_checker.rb 1:# -*- frozen-string-literal: true -*- lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb 1:# -*- frozen-string-literal: true -*- lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb 1:# -*- frozen-string-literal: true -*- lib/did_you_mean/verbose_formatter.rb 1:# -*- frozen-string-literal: true -*- Tip 15 / 20
  19. Tip 15 / 20 /GitHub/did_you_mean$ ag literal lib/ lib/did_you_mean/experimental/initializer_name_correction.rb 1:#

    -*- frozen-string-literal: true -*- lib/did_you_mean/formatter.rb 1:# -*- frozen-string-literal: true -*- lib/did_you_mean/spell_checker.rb 1:# -*- frozen-string-literal: true -*- lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb 1:# -*- frozen-string-literal: true -*- lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb 1:# -*- frozen-string-literal: true -*- lib/did_you_mean/verbose_formatter.rb 1:# -*- frozen-string-literal: true -*-     Y  G B T U F S  U I B O  a c k
  20. $ curl https://rubygems.org/api/v1/gems/did_you_mean.json {"name":"did_you_mean","downloads":284421,"version":"1.0.2","version_downloads": 2445,"platform":"ruby","authors":"Yuki Nishijima","info":"\"did you mean?\" experience in

    Ruby: the error message will tell you the right one when you misspelled something.","licenses":["MIT"],"metadata": {},"sha":"caa50332c6de39d5452f85f1efa9e9080d9073591edf7be8cb1b9b333a63fd6a","project_uri":"htt ps://rubygems.org/gems/did_you_mean","gem_uri":"https://rubygems.org/gems/ did_you_mean-1.0.2.gem","homepage_uri":"https://github.com/yuki24/ did_you_mean","wiki_uri":null,"documentation_uri":"http://www.rubydoc.info/gems/did_you_mean/ 1.0.2","mailing_list_uri":null,"source_code_uri":null,"bug_tracker_uri":null,"dependencies": {"development":[{"name":"bundler","requirements":"~\u003e 1.10"}, {"name":"minitest","requirements":"\u003e= 0"},{"name":"rake","requirements":"\u003e= 0"}],"runtime":[]}} Tip 16 / 20
  21. Tip 16 / 20 $ http https://rubygems.org/api/v1/gems/did_you_mean.json HTTP/1.1 200 OK

    … { "authors": "Yuki Nishijima", "bug_tracker_uri": null, "dependencies": { … }, "documentation_uri": "http://www.rubydoc.info/gems/did_you_mean/1.0.2", "downloads": 284423, "gem_uri": "https://rubygems.org/gems/did_you_mean-1.0.2.gem", "homepage_uri": "https://github.com/yuki24/did_you_mean", "info": "\"did you mean?\" experience in Ruby …”, "licenses": [ "MIT" ], "mailing_list_uri": null, "metadata": {}, "name": "did_you_mean", "platform": “ruby", …
  22. Tip 17 / 20 $ curl https://rubygems.org/api/v1/gems/did_you_mean.json | jq {

    "name": "did_you_mean", "downloads": 284426, "version": "1.0.2", "version_downloads": 2446, "platform": "ruby", "authors": "Yuki Nishijima", "info": "\"did you mean?\" experience in Ruby …”, "licenses": [ "MIT" ], "metadata": {}, "sha": "caa50332c6de39d5452f85f1efa9e9080d9073591edf7be8cb1b9b333a63fd6a", "project_uri": "https://rubygems.org/gems/did_you_mean", "gem_uri": "https://rubygems.org/gems/did_you_mean-1.0.2.gem", "homepage_uri": "https://github.com/yuki24/did_you_mean", "wiki_uri": null, "documentation_uri": "http://www.rubydoc.info/gems/did_you_mean/1.0.2", …
  23. Tip 17 / 20 $ curl https://rubygems.org/api/v1/gems/did_you_mean.json | jq .dependencies.development

    [ { "name": "bundler", "requirements": "~> 1.10" }, { "name": "minitest", "requirements": ">= 0" }, { "name": "rake", "requirements": ">= 0" } ]
  24. w  OVNCFS w  w $USM 3 w USFF

    w BH UIFTJMWFSTFBSDIFS w )551JF w KR w QZHNFOUJ[F w IUUQXXXFYQMBJOTIFMMDPN w 4IJGU*U w *OTUBODFWBSJBCMFDPSSFDUJPO w *OJUJBMJ[FSOBNFDPSSFDUJPO w ,FZ&SSPSOBNFDPSSFDUJPO w CVOEMFDPOpHHMPCBMKPCT/ w .BLFBSFRVFTUPOSBJMTDPOTPMF w 1PXFSBTTFSU w XBUDI w (JUEJGG w #SBDF&YQBOTJPO w IJTUPSZ