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

Rubyで日本四大祭の一つを楽しんだ。

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

 Rubyで日本四大祭の一つを楽しんだ。

Hiroshima Ruby Conference 2016 でRubyで日本四大祭の一つを楽しんだことについて発表しました。

Avatar for 北䑓如法

北䑓如法

March 05, 2016
Tweet

More Decks by 北䑓如法

Other Decks in Technology

Transcript

  1. The fourth festival — Bals Fest όϧεࡇ ▸ ༵ۚϩʔυSHOW!Ͱʰఱۭͷ৓ϥϐϡλʱ์ૹ ▸

    ΫϥΠϚοΫε໓ͼͷढจʮόϧεʯ ▸ ಉ࣌ʹTwitterͰօҰ੪ʹʮόϧεʯͱπΠʔτ ▸ …ͱ͍͏೔ຊʹ఻ΘΔ͓ࡇ ▸ TwitterͷετϨεςετͷ໾ׂ΋୲͏
  2. Used rubygems ࢖༻ͨ͠gem ▸ twitter ▸ user_stream (ࠓ͸ twitter gem

    ͕͋Ε͹ཁ Βͳ͍) ▸ foreman, doting, color_echo
  3. ࣗ෼ͳΓʹ޻෉ͨ͠ͱ͜Ζ RT΍@΍URL͖ͭπΠʔτʹ͸൓Ԡ͠ͳ͍Α͏ʹ if text !~ /^RT / and text !~

    /@/ and text !~ /http/ and text =~ /όϧε/ if bals_density_high?(text) puts CE.fg(:green).get("@#{user.screen_name}: #{text}") @client.update("@#{status.user.screen_name} " + random_message, in_reply_to @client.favorite(status.id) end
  4. ࣗ෼ͳΓʹ޻෉ͨ͠ͱ͜Ζ ʮφΠεόϧεʯҎ֎ͷϝοηʔδ΋ ▸ ഑ྻͷ .sample ศརͩͳ ▸ จࣈྻʹ͔͚ࢉͰ͖Δͷศརͩͳ def random_message

    array = ['φΠεόϧε', ‘͜Ε͸͍͍όϧε', ‘͍͍όϧεͰͨ͠Αʙ', 'ϥϐϡλѪͷ͋;ΕΔόϧεͰͨ͠Ͷ', 'ૉ੖Β͍͠όϧε'] array.sample + '!' * rand(1..10) end
  5. ࣗ෼ͳΓʹ޻෉ͨ͠ͱ͜Ζ ʮόϧεʯີ౓ͷߴ͍πΠʔτ͚ͩʹ ▸ ൒֯จࣈΛ࡟আ ▸ όϧεີ౓ͷ௿͍πΠʔτ͸ແࢹ (ʮόϧε͍ͬͯ͏ ͷ͕ྲྀߦ͍ͬͯΔΒ͍͠ʯͱ͔͸εϧʔ͍ͨ͠) def bals_density_high?

    str return false if str.length == 0 s = str.gsub(/([[:ascii:]]|[[:punct:]])/,'') t = s.gsub(/όϧε/,'') t.length.to_f / s.length.to_f < 0.5 end