2015-06-01ãã1ã¶æéã®è¨äºä¸è¦§
ãããã [4] pry(main)> "1\n2\n3\n4".split => ["1", "2", "3", "4"] !? [5] pry(main)> "1\n2\n3\n4".split(nil) => ["1", "2", "3", "4"] [6] pry(main)> "1\n2\n3\n4".split(' ') => ["1", "2", "3", "4"] instance method String#split nilã' 'ãä¸ãâ¦
Railsã§æ¡ä»¶ã«ä¸è´ããã¬ã³ã¼ãã1000件ã¥ã¤åå¾ãã¦å¦çãããã¤ãªãã ã£ã çµè« #find_each find_each - ãªãã¡ã¬ã³ã¹ - - Railsããã¥ã¡ã³ã ä»çµã¿ã¨ãããã¾ ã½ã¼ã¹ rails/railsgithub.com 詳ããèªãã§ãªããã©ãprimary_keyã§sortãããã¨offsetã¨limâ¦
ãããããã¤ã§ãã å®å®ãã¥ã¼ã¸ã¢ã ãï¼´ï½ ï¼®ï¼±ï¼ãã³ãã¥ã¼ï¼ã æ±äº¬ãã¼ã ã·ãã£www.tokyo-dome.co.jp ã©ãã§è¦ããã® æ°´éæ©ã«ããTenQã¨ããæ½è¨ã§è¦ããã äºç´ãã¦ãã£ãã»ããè¯ãã ããããäºç´ã§ããã http://www.tokyo-dome.co.jp/tenq/ticket/â¦
ãã®ãããªHashã®ãªããããkeyã:targetã§ããè¦ç´ ãå帰çã«åå¾ãããã {a: {b: {c: {d: {e: {target: :f}}}}}, f: [:g, :h, {target: [:i]}], j: {target: nil}} ãããã¦ã¿ã å帰çã«åå¾ãããã®ã§å帰çã«åå¾ããã # keyãæã£ã¦ãè¦ç´ ãå帰çã«â¦
çµè« Order.select("date(created_at) as ordered_date, sum(price) as total_price").group("date(created_at)") 説æ Rails Guidesã¨ããç´ æ´ãããè³æããããããã§ç´¹ä»ããã¦ããã Ruby on Rails ã¬ã¤ãï¼ä½ç³»çã« Rails ãå¦ã¼ãrailsguides.jp
ãã: ã¹ãã¼ãå¹¹äºãã/ ã¯ã¼ãã³ã®ãããããã㼠飲ã¿ä¼ã®è¦ä»¶ãæ¸ãã¦ããã¨ãè¤æ°ã®ãåºããææ¡ãæ¥ãã®ã§ãä¸çªæ°ã«å ¥ã£ãåºãäºç´ããäºãã§ããã å°ãªãã¨ãèªåããåºã«é£çµ¡ãåãããå§åçã«å¹çãè¯ãç¨åº¦ã®é度ã¨ä»¶æ°ã®ææ¡ãè²°ããã ã¡ãªã¿â¦
çµè« awkã§ã§ãã $ awk '{print FILENAME $0}' ./target_directory/* filename_a 1 filename_a 2 filename_a 3 filename_b 1 filename_b 2 filename_b 3 filename_c 1 filename_c 2 filename_c 3 説æ FILENAMEã§ç¾å¨èªã¿è¾¼ãã§ãããã¡ã¤ã«å $0ã§èªã¿è¾¼ãâ¦
æ¨æºã©ã¤ãã©ãªã«ããã class Tempfile Rubyist Magazine - æ¨æºæ·»ä»ã©ã¤ãã©ãªç´¹ä» ã第 15 åã tmpdir, tempfile
ãããã Net::SFTP.start('host', 'username', :password => 'password', :port => port) do |sftp| # ... end åè: net-ssh/net-sftpgithub.com
åããããã©ããã¦ã³ãã¼ãæ°ã¯net-sftpããã³ããã ã£ãã net-sftp | RubyGems.org | your community gem host ãã³ããã®æ§åã§ãã search | RubyGems.org | your community gem host
çµè« cat ~/.ssh/config | awk '/xxx-xxx-01/ { print ; getline; print }' ã¨ããããåºæ¥ã 注æç¹: getlineã¯è²ã 注æç¹ãããããã ï¼ææ¡ãã¦ãªãï¼ http://gauc.no-ip.org/awk-users-jp/blis.cgi/DoukakuAWK_074 説æ ãããããã¡ã¤ã«ã§ãHostã«å¯¾å¿â¦
çµè« ãã $(NF-n) 説æ awk '{print $1}' # å·¦ãã1çªç®ã®ãã£ã¼ã«ããprint awk '{print $NF}' # ä¸çªå³ã®ãã£ã¼ã«ããprint awk '{print $(NF-1)}' # å³ããnçªç®ã®ãã£ã¼ã«ããprint NFã«ãã£ã¼ã«ãæ°ãå ¥ã£ã¦ããã®ã§ãããã使ã
çµè« ãã®ãããªæ¹æ³ãGithubãæä¾ãã¦ããUIã§å®ç¾ããæ¹æ³ã¯ãªã(ãã¶ã) 代ããã«è¨±å¯ããã人以å¤ãpull-requestããã¼ã¸ãããæ¤ç¥ã§ããæ¹æ³ãèãã¦ã¿ãã æ³å®ãã¦ããç¶æ³ Githubã使ã£ã¦ãã¼ã ã§ã³ã³ãã³ããä½ã£ã¦ããå ´åã«ã ãã¨ã³ã¸ãã¢ä»¥å¤â¦
çµè« find .ã§å ¨ãã¡ã¤ã«åãåå¾ãã¦æ£è¦è¡¨ç¾ã§æ¢ã $ find . -type f | awk -F / '{print $NF}' | awk '!/^[a-zA-Z0-9._-]+$/' has_space_file_name 2.png has_ampersand_file&name.jpg æ¥æ¬èªã®ãã¡ã¤ã«å.txt 説æ find . -type f | # å ¨ãã¡ã¤ã«åãåâ¦
çµè« # Rails.cache.read ã®å®ç¾©ãã¡ã¤ã«ãéããã # 以ä¸ãå®è¡ããã¨ãããããã«atomãç«ã¡ä¸ãã pry(main)> `atom #{Rails.cache.method(:read).source_location.first}` 解説 ããã¡ã½ãããã©ã®ãã¡ã¤ã«ã«å®ç¾©ããã¦ãããå¾ã #methodã§Methodãªãâ¦
çµæ ãããªã£ã ãããã 解説 ã¢ããªãèµ·åããã¨ãã«Dockã«ç½®ãã ã·ã§ã¼ãã«ãããã¯ãªãã¯ããããã¦ã¯ãããªã ãã¦ã¹ã使ãã¨å¹çãæªããAlfredãªã©ã§ãã¼ãã¼ãããèµ·åãããã é·æçã«è¦ã¦å¹çãæªãæ¹æ³ï¼ãã¦ã¹ã«ããæä½ï¼ãçæçã«ã¿ã¦å¹çâ¦
å ¥åä¾ $ input.txt a2 a3 b1 b2 b3 c1 c2 c3 åºæ¬çãªã㤠æ£è¦è¡¨ç¾ã«ä¸è´ããè¡ã ããå¦çãã $ awk '/a/' input.txt a1 a2 a3 è¤æ°ã®ãã¿ã¼ã³ã®çµåã or $ awk '/a/ || /b/' input.txt a1 a2 a3 b1 b2 b3 and $ awk '/a/ && /1/' input.txt a1 ãã®ä» nâ¦
çµè« ãã£ã¦ãï¼ãã¶ãï¼ èª¿ã¹æ¹ é©å½ãªClassãä½ã£ã¦è©ä¾¡ãã¦ã¿ãã ãããæ»ãå¤ã®#inspectãªããããªããã¨æã£ã¦ãããããã確ããããã > class AnyClass ; end #=> nil > AnyClass #=> AnyClass #inspectãä¸æ¸ããå®è¡ãããã#callerãåãåºããâ¦
çµè« recipeã§ãããã - type: homebrew_tap name: peco/peco 使ç¨ä¾ - type: homebrew_tap name: peco/peco - type: package name: peco ããã«è¼ã£ã¦ã serverkit/serverkit-homebrewgithub.com ãããã¾ ããããbrew tapã£ã¦? ããã¯ä¾¿å©ï¼Homebrewã«è¿½â¦
çµè« ã¢ãã«ã®ã¯ã©ã¹åãå ¥ãã¦Enter irb(main):012:0> Message => Message(id: integer, body: string, created_at: datetime, updated_at: datetime) ä½è« ã©ããã¦è¦ãããã ã£ãã 確ããã#inspectã®çµæã表示ããã¦ããã ããªã irb(main):013:0> Mesâ¦
çµè« ãã®WorkFlow使ãã°ãããã https://github.com/franzheidl/alfred-workflows/tree/master/open-with-atom Alfred PowerPackãè²·ãå¿ è¦ãããã 使ãæ¹ Alfredãèµ·å ã¹ãã¼ã¹ã§Open File...ã¢ã¼ãã«ãã¦ãéããããã£ã¬ã¯ããªãæ¢ã éããããã£ã¬â¦
OS Xï¼ãã¼ãã¼ãã·ã§ã¼ãã«ãã - Apple ãµãã¼ãsupport.apple.com é¢å¸ããæã«ããoption + command + é»æºãã¿ã³ã§ã¹ãªã¼ãããã使ããªããªãã
ããæ¹ ããããè²·ã£ã¦ãã ç®ãå ¨é¨ãã å®ãååã«å²ã å·å庫ã«ãã¾ã ã§ããããã ãããå·ããã¦ããã£ã±ãããå³ã§ãããããã ä»ãè¿æã®ã¹ã¼ãã¼ã§ããããã²ã¨ãµãè²·ã£ãã138åã ã£ããã³ã¹ãããã©ã¼ãã³ã¹ããªããªãã§ããã ä½è« èªåã¯çãâ¦
çµè« Chromeã®å ´å: æ¤ç´¢çµæç»é¢ã表示ãããç¶æ ã§ãtabã¾ãã¯âãæ¼ãã¨ã«ã¼ã½ã«ãã§ã¦ããã®ã§ãéããããµã¤ãã«ã«ã¼ã½ã«ãåããã¦Enterããã¨éãã â, âã§ã«ã¼ã½ã«ãä¸ä¸ãããããã®ã§ãå¥ã«ä¸çªä¸ä»¥å¤ã®ãµã¤ããéããã safariã§ã大ä½ã«ããããªâ¦
...ããæ¹æ³ãã©å¿ãããã ãã $ source .zshrc
çµè« Alfredã®custom searchæ©è½ã使ãã°ã§ããã Alfred Preferencesã®custom searchã«https://www.google.co.jp/search?q=site%3Ahttp%3A%2F%2Fshinya131-note.hatenablog.jp%2F+{query}ã¿ããã«ç»é²ãã¦ãã¼ã¯ã¼ããè¨å®ããã°ãAlfredãããã¼ã¯ã¼ã + â¦
çµè« serverkitã®ä½è ã§ããr7kamuraããã®ãªãã¸ããªã«ããã¬ã·ããã¨ã¦ãåèã«ãªãã®ã§ãã¨ã«ããè¿·ã£ãããããã¿ã¦ããã r7kamura/dotfilesgithub.com ãã®ä»ã¡ã¢ ã¡ãªã¿ã«ç§ã¯ãã®ãããªç¨éã§serverkitã使ã£ã¦ããã è¤æ°å°ããMacã®ç°å¢ãserverktâ¦
ããã¼ãã©ã¯ã¼ãã«ä¸äºä½åéè¡ã®æ å ±ãé£æºãããããå¥ç´è çªå·ã£ã¦ã©ãã§ç¢ºèªã§ããã® çµè« SMBCãã¤ã¬ã¯ããã確èªã§ããã ãã ãã¹ããã©çã§ã¯ãªã PCãã©ã¦ã¶çã®ãµã¤ããããã確èªã§ããªãï¼ããããï¼ ããããã¼ã¸ãããã°ã¤ã³ãã¦ãç»é²æ å ±ãâ¦
ããããã㨠ååOSãçµäºããæã«ç«ã¡ä¸ãã¦ããã¢ããªããèµ·åæã«åæã«ç«ã¡ä¸ããã â ãããã æ¯åå¿ ã使ãã¢ããªã¯èªåã§ç«ã¡ä¸ããããã«ãããã ãããã ååOSãçµäºããæã«ç«ã¡ä¸ãã¦ããã¢ããªãåæã«ç«ã¡ä¸ãããªãããã«ããæ¹æ³ ãã®ãâ¦
çµè« Webä¸ã§å¤§ããªã«ã¬ã³ãã¼ãæ¢ãã¦ãã¦ãWebã¯ãªããã¨ãã¦è¡¨ç¤ºããã°åºæ¥ãã 解説 Macã«ã¤ãã¦ããDashboardã¨ããæ©è½ã便å©ã ç¹ã«ã«ã³ã¬ã ã¼ãä¾¿å© ã§ããæ¨æºã®ã«ã¬ã³ãã¼ã¯ãµã¤ãºãå°ããããã£ã¨å¤§ãã表示ãããã Webã¯ãªããæ©è½ã§åºæ¥ã Safâ¦