2008-05-01ãã1ã¶æéã®è¨äºä¸è¦§
require 'net/http' require 'uri' def save_file(url) filename = File.basename(url) open(filename, 'wb') do |file| file.puts Net::HTTP.get_response(URI.parse(url)).body end end url = 'http://d.hatena.ne.jp/images/diary/g/gan2/gan2_p.gif' savâ¦
ãããããã«å¿ããªãã ãã¼ã¨ã¯æã£ã¦ãããã®ã® 以åããããªé¢¨ã«æã£ã¦ãã¦ãã°ããããããããµãã«ãªã£ã¦ããã®ã§ è¨æ¶ã«å®çããããã¨ãç¥ãã¤ã¤ã¡ããã¨æ¸ãã¦ããã åºæ¬ 以ä¸ã®2ã¤ãè¦ãã¦ããã°ã¾ã大ä¸å¤«ã æååããã¦ãã¨ã (UTF-8 ã®ãã¡ã¤â¦
d2.hatena.ne.jp ãããªã㦠æ®éã® d.hatena.ne.jp ã§ããããããæ©è½ãã使ããããã«ãªã£ã¦ãã¿ããã ããã®å ´ç·¨éã¢ã¼ããã®ãåçã»ååãªã©ãæ¿å ¥ããã使ããã 2æããããã使ããããã«ãªã£ã¦ãã¿ãã㧠ä»æ´æããããã©ã¾ãã¨ãããããã¹ããâ¦
主ã«ã¯ã¦ãªãã¤ã¯ã§æãã¦ããã ããã¦æãããåã®çµµã«å¯¾ããèãæ¹ãå¤ãã£ã¦ãããã¨ãã åã¯å°ããé ããçµµãæããã¨ã好ãã ã£ãã çµµãæãã¦ããã¨ãã®ä¸çªå¤ãè¨æ¶ã¯ ã¦ã«ãã©ãã³ããã¾ãæããªãã¦åã¹ããããã¦ããèªåã ã¦ã«ãã©ãã³ã®é¡ã¯â¦
ã¨ãããã CodeRepos ã«ã³ãããããã ãã©ã¦ã¶ããã¢ã¯ã»ã¹ããå ´åã¯ããããã©ããã Subversion ãããå ´åã¯ä»¥ä¸ã®ã³ãã³ãã§ã½ã¼ã¹ãæã£ã¦ããã¾ãã svn co http://svn.coderepos.org/share/lang/ruby/StarLife ç°¡åãªèª¬æã¨ã㦠README ã®å 容ãâ¦
Emacs ã§ã¯ãC-SPCãã§ãã¼ã¯ãã»ãããã¦ã以éãªã¼ã¸ã§ã³ãé¸æã§ããç¶æ ã«ãªãã sense-regionã使ãã¨ãC-SPCããæ¼ããã¨ã«ãªã¼ã¸ã§ã³ã®é¸æã¨ç©å½¢é¸æãåãæããããããã«ãªãã ãC-x rãã§ã¯ãããé常ã®ç©å½¢é¸æã ã¨ããªã¼ã¸ã§ã³ã®é¸æã¨è¦è¦çâ¦
æ®éã«é¢é£ä»ãããã¨ãåçããé¸ã°ãããã¨ã«ãªã æ¢ã«éãã¦ãããã¬ã¤ãªã¹ãã®å 容ãä¸æ¸ãããã¡ããã®ã§ ããã¬ã¤ãªã¹ãã«è¿½å ããé¸ã¶ã ã§ãããæ¡å¼µåãã¨ã«è¨å®ããªãã¡ããããªãã¦é¢åã ãªãã
æåã«ææ°ç(2008/05/11ç¾å¨)ã® 5.531 ãã¤ã³ã¹ãã¼ã«ãããã ãã© ã¢ãã³ã¹ãã³ã®ã¾ã¾ nfs ã®ãã©ã°ã¤ã³ãå ¥ãã㨠ã¹ã¯ãªããã¨ã©ã¼ã§ Winamp èªä½ãèµ·åããªããªãã¨ãã ã¨ã¦ããããããªãä¸å ·åãè¦ã¤ãã£ãã®ã§æ¶ãã(´ã»Ïã»ï½) èãã¨ããã«ããã¨â¦
xmpfilter ã便å©ãããã®ã§ããã£ã¦ã¿ãããrcodetools ã«å«ã¾ãã¦ãããã¨ãåãã£ãã rcodetoolsãè¦è¦ãã¯ãããã©ä½ãªã®ãã¯ããåãã£ã¦ãªãã ã¨ãããã gem ã§å ¥ãã¿ãããªã®ã§å ¥ãã¦ã¿ãã gem install rcodetoolsrcodetools ã«ã¯ Emacs ç¨ã®ã¤ã³â¦
Ruby 1.8.7ã®injectã¯Symbolãå¼æ°ã«åããã¨ãã§ãããã¤ã¾ããåè¨ã¯ãinject{|s,x| s+x}ããããinject(:+)ãã§ãããªã£ãã 1+2+3+4 # => 10 (1..4).inject(:+) # => 10 1*2*3*4 # => 24 (1..4).inject(:*) # => 24 ä»ã¯injectãããtapã ããã - http:â¦
ä»»æã®å¶æ°Nã®ãã¼ã ã®ç·å½ããæ¦ãæçæ¥æ°ï¼N-1æ¥ï¼ã§ è¡ãå ´åã®æ¥ç¨è¡¨ãï¼ã¤ä½æãã¦ãã ããã 解ã¯ã²ã¨ã¤ã§ã¯ãªãå ´åãããã¾ãã ãããä½åãããã°ãå ¨ã¦ã®å¯è½æ§ãæ±ãã¦ãã ããã ããã¯ãã¹ãã¼ãã¹ã±ã¸ã¥ã¼ãªã³ã°ã¨è¨ãåéã®åé¡ã§ã æ°å¦çâ¦
次ã®ãããªæ¸å¼ã§ä¸ããããããã¿ã ããããããã¾ãã (ãã¿ã ããã¯ã³ã¼ãä¸ã«åãè¾¼ãã§ããæ¨æºå ¥åã å¤é¨ãã¡ã¤ã«ããèªã¿è¾¼ãã§ããæ¸ããããæ¹æ³ã§ãã¾ãã¾ãã) A B C D E | | |-| | |-| | |-| | |-| |-| |-| |-| | |-| | | | ãã®ãã¿ã ããããâ¦
æ¥ä»ã®Rangeãé±ã«åãåºãã¹ã¯ãªãã - ã¯ãã¹ã«ã£ã#ãåãªãã«æ¸ãã¦ã¿ãã ãããªæãã§ããã®ããªï¼ gen-weeks.rb 2008/04/01 ãã 2008/04/21 ã¾ã§ã® Range ãé±ãã¨ã«åãã require 'date' def gen_weeks(range) weeks = [] week = [] range.each doâ¦