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

Gem #wedding_s

Gem #wedding_s

Kei Shiratsuchi

October 21, 2013
Tweet

More Decks by Kei Shiratsuchi

Other Decks in Technology

Transcript

  1. (FN

  2. nokogiri require 'nokogiri' require 'open-uri' html = open('https://twitter.com/kei_s') doc =

    Nokogiri::HTML(html) doc.css('.tweet-text').each do |e| puts e.text end
  3. nokogiri ࣗ୐࡞ۀEBZ !FJLPN͋Γ͕ͱ͏͍͟͝·͢ʂ ఱؾྑ͍Ͱ͢ XJUIZVLBBUࡾܢԂ 4BOLFJFO(BSEFO <QJD>ŠIUUQTQBUIDPNQ). ே͝͸Μ͔ͬ͠Γ৯΂ͨ ͸ʔɺNBDͷPQFOίϚϯυͷBΦϓγϣϯศརͩͬͨ͠[TIͷิ׬ͰBQQΛީิʹͯ͠ WJNZUVUPSͳ͍ͷ

    4BJOU1FQTJͷCBOEDBNQͷΞϧόϜ͕͜ͱ͝ͱ͘ങ͑ͳͯ͘ࠔΔ !TIJSBZVDB͋ʔͬɺ͸͍ʜʂ !GSLPVU͸ʔ͍͋Γ͕ͱ͏ʂ·ͨͶʙ !GSLPVU͸͍͸ʔ͍ʂਲͬͯΔ͠ձ͍͍ͨͥʂ !GSLPVU΋࣌͠Ҏ߱ʹҿΜͰͨΒͥͻҿ΋͏ͥʙɻҿΊΔʁ !GSLPVU!TIJSBZVDB͍ΔΑ OHJOYXMVB΍ͬͯΈ͚ͨͲ͍͚Δ͔ͳ !TIJSBZVDBͳΜͱ ೋਓ͚ͯͬ͜͠͏͓ञҿΜͰ͓Ոʹؼ͖ͬͯͨΒɺਲͬͯΔײ͋Δͻͱ͕ɺʮ΋ʔɺࠃഁΕͯ
  4. (FN

  5. Gemfile # A sample Gemfile source "http://rubygems.org" gem "gems" gem

    "sqlite3" gem "sequel" gem "activerecord" gem "awesome_print" gem "tapp" gem "gnuplot"
  6. w geminaboxΛ࢖ͬͯϩʔΧϧϚγϯʹgemαʔόΛཱͯΔɻ w ϚϧνόΠτͷ໊લͷgemΛ࡞Δɻ۩ମతʹ͸gemspecϑΝΠϧ ͚ͩ࡞ͬͯϏϧυ͢Δɻ w bundleίϚϯυ͕ϚϧνόΠτ໊ͷgemΛ૝ఆͯ͠ͳ͍ͷͰϞϯ ΩʔύονΛ౰ͯΔɻ w GemfileΛinstance_eval͢Δࡍʹɺgemϝιουʹ౉Δจ

    ࣈྻΛforce_encoding(“UTF-8”) ͢Δɻ w gem αʔόʹґଘؔ܎ͷϦΫΤετΛ౤͛Δࡍʹ spec_file_name Λ URI.encode ͢Δɻ w gem ϥΠϒϥϦ͕ϚϧνόΠτ໊ͷ gem Λ૝ఆ͍ͯ͠ͳ͍ͷͰϞ ϯΩʔύονΛ౰ͯΔɻ w gem αʔό͔Βμ΢ϯϩʔυ͢ΔϦΫΤετΛ౤͛Δࡍʹ gem_file_name Λ URI.encode ͢Δɻ w geminabox ΋ϚϧνόΠτ໊ͷ gem Λ૝ఆ͍ͯ͠ͳ͍ͷͰϞϯΩ ʔύονΛ౰ͯΔɻ w ϦΫΤετΛ URI.decode ͯ͠ਖ਼͍͠ϑΝΠϧύεʹ͢Δɻ