hotuta
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    UberEATS全店舗マップの開発と運用 #roppongirb === スライドの全ページスクロール閲覧便利リンク: https://hackmd.io/p/S1yw7_4aN?print-pdf#/ --- ### UberEATS全店舗マップの開発と運用 [Roppongi.rb #10 "夜のLT会"](https://roppongirb.connpass.com/event/129603/) [#roppongirb](https://search.yahoo.co.jp/realtime/search?p=%23roppongirb) 堀田純平(hotuta) [@hotu_ta](https://twitter.com/hotu_ta) <!-- - UberEATS全店舗マップの舞台裏ということで発表します - ほったです。ほったじゅんぺいです。 - よろしくお願いします! - なお、スライドは公開済みで、ハッシュタグをつけてスライドに関するリンクをツイートをしましたのでご確認ください! --> --- ## 自己紹介 :busts_in_silhouette: :thought_balloon: - フルネーム: 堀田 純平(ほった じゅんぺい) - Twitter: [@hotu_ta](https://twitter.com/hotu_ta) - GitHub ID: [hotuta](<https://github.com/hotuta>) - ホームページ: https://hotuta.github.io - 好きなプログラミング言語: [Ruby](https://www.ruby-lang.org/) - 好きなエディタ: [RubyMine](https://www.jetbrains.com/ruby/) - **嫌いなプログラミング言語: [P言語 (PHP, Python)](https://twitter.com/hotu_ta/status/670420676960874496) ※開発経験あり** <!-- - Hottaです。Hotta Jumpeiです。 - プログラミング言語 [Ruby](https://www.ruby-lang.org/)が大好きで、[P言語]((https://twitter.com/hotu_ta/status/670420676960874496))が大嫌いです。 - 好きなエディタはRubyMineです。 - 自己紹介は時間の都合上、割愛させていただきます。 MEMO: 秒 --> --- ## 宣伝 - [こうして僕は無職になった(前編)](https://note.mu/hotuta/n/n7979daa5e2c7) - 新卒入社10日目で解雇された情報です。 - おかげさまで、文章が非常に読みにくい、日本語がクソ下手と大好評をいただいております🙇 - 自称東大卒なので、お察しください😭 <!-- - 自己紹介を割愛した分、宣伝を少しさせていただきたいです。 - 実は、新卒入社して10日目で解雇されました。 - 気になる方はリンクより記事をご確認ください。 --> --- ## 目次 - 第1章 [UberEATS全店舗マップ](https://redcycle.hatenablog.com/entry/2017/12/23/111116)とは? - 第2章 [UberEATS全店舗マップ](https://redcycle.hatenablog.com/entry/2017/12/23/111116)の開発関連 - 第3章 [UberEATS全店舗マップ](https://redcycle.hatenablog.com/entry/2017/12/23/111116)の運用関連 - 第4章 [UberEATS全店舗マップ](https://redcycle.hatenablog.com/entry/2017/12/23/111116)のソースコードをチラ見せ❤️ - 社会貢献をされたい方募集のお知らせ - さいごに <!-- - 目次はこれらの通りです - それでは、これらをお送りします --> --- **⚠注意: このスライドは、知的好奇心を満たすことを目的としています。** **筆者はいかなる責任も負いません。** **このスライドは、サイト運営者に対して警告および対策としての機能も有します。** <!-- - なお、このスライドは、知的好奇心を満たすことを目的としており、自分はいかなる責任を負いません。 - また、このスライドは、サイト運営者に対して警告および対策をしていただくことも目的です。 MEMO: 秒 --> --- ### 第1章 [UberEATS全店舗マップ](https://redcycle.hatenablog.com/entry/2017/12/23/111116)とは? <!-- - まず、[UberEATS全店舗マップ](https://redcycle.hatenablog.com/entry/2017/12/23/111116)とは?簡単に説明させていただきます! --> --- #### [UberEATS全店舗マップ](https://redcycle.hatenablog.com/entry/2017/12/23/111116) - UberEATS配達員向けの地図 - UberEATS加盟店が地図で可視化されて、歩合制であるUberEATS配達員が稼ぐのをサポート - 無償提供 - UberEATS配達員への社会貢献を担っている(が、開発する気力がなくて更新停止中😭) <!-- - [UberEATS全店舗マップ](https://redcycle.hatenablog.com/entry/2017/12/23/111116)とは、UberEATSの配達員の方々に向けて公開している地図で、歩合制であるUberEATS配達員の方々から活用していただいています。 --> --- ## 第2章 [UberEATS全店舗マップ](https://redcycle.hatenablog.com/entry/2017/12/23/111116)の開発関連 --- ### 仕組み - Rails APIモードでサクッと作ったアプリケーションをHeroku上で定期実行 --- ### 流れ - UberEATS本家の非公式APIを叩いて位置座標データ付き店舗情報を取得 - GoogleマイマップをCapybara(Selenium)を使って強引に地図情報を自動更新 --- #### 使用したライブラリ ```ruby gem 'capybara' gem 'selenium-webdriver' gem 'chromedriver-helper' gem 'rest-client' gem 'parallel' gem 'archive-zip' gem 'activerecord-import' gem 'clockwork' ``` <!-- - --> --- ## 第3章 [UberEATS全店舗マップ](https://redcycle.hatenablog.com/entry/2017/12/23/111116)の運用関連 <!-- - --> --- ### 運用活用ツール - Heroku - Googleマイマップ --- ### Heroku - PaaS - UberEATS本家の非公式APIを叩いて情報取得とGoogleマイマップの更新で利用 - 無料だと、PostgreSQLは1万レコードまで - UberEATSの各エリア毎の全店舗合計数が1万店舗を突破していないことを確認(数ヶ月前の話) --- ### 運用方法 - [Clockwork](<https://github.com/Rykian/clockwork>)を使って定期実行…? ```ruby require 'clockwork' require './config/boot' require './config/environment' module Clockwork handler do |job| puts "Running #{job}" end # MEMO: タイムゾーン対応が必要😭 # TODO: Heroku標準のスケジューラーで定期実行を検討 # TODO: rakeファイルを作る ``` --- ## 余談: Clockwork vs Heroku Scheduler --- ### Clockwork - クレジットカード登録無しで使える👍 - 細かいカスタマイズで、定期実行をすることが出来る👍 - 定期実行に関する調整をするには、コードを修正する必要あり😭 - タイムゾーン問題に悩む😭 --- ### Heroku Scheduler - Heroku本家お墨付きで、タイムゾーンに悩まなくて良い(が、時間表示が[GMT](https://ja.wikipedia.org/wiki/%E3%82%B0%E3%83%AA%E3%83%8B%E3%83%83%E3%82%B8%E6%A8%99%E6%BA%96%E6%99%82)はどうにかして欲しい) - スマホからでも管理者画面から定期実行に関する調整が出来る👍 - クレジットカードの登録が必要😭 - 10分に1度が最短、融通面がネック😭 --- ## Googleマイマップ - 天下のGoogle様が無料で提供して、運用してくださっている🙇 - Capybara(Selenium)を使ってユーザーっぽい振る舞いで強引に自動更新 - 地球が滅びない限り、閲覧出来なくなることはないはず --- ## 第4章 [UberEATS全店舗マップ](https://redcycle.hatenablog.com/entry/2017/12/23/111116)のソースコードをチラ見せ❤️ --- ```ruby class Store < ApplicationRecord require 'csv' @session = Capybara::Session.new(:chrome) @coordinates = [] class << self ``` --- ```ruby def upload_kmz(map_url) @session.visit map_url # YAMLファイルにCookie情報をエクスポート # File.open('./yaml.dump', 'w') {|f| f.write(YAML.dump(@session.driver.browser.manage.all_cookies))} YAML.load(Base64.strict_decode64(ENV['YAML_DUMP'])).each do |d| @session.driver.browser.manage.add_cookie d end @session.visit map_url ``` --- ### 社会貢献をされたい方募集のお知らせ - 自分と準委任契約を通して、UberEATS配達員の方々へ貢献したい方、1名様限定で絶賛募集中!!! --- ### 条件(1) - 技術力にあまり自信がない方 - 自分はRubyコミュニティへの貢献を意識しているため、技術力に自信がある方はお断りさせていただいています🙇 - Linux環境が快適に動く環境を自分で用意出来る方(MacBookが理想) - Windowsにこだわる方は、お断りさせていただきます🙇 --- ### 条件(2) - 下記のツールが好きな方、好きで無くてもアレルギーがない方 - 利用するツール: Twitter, RubyMine, Discord, G suite(Googleカレンダー) - 時給は要相談(最低でも時給換算1,500円以上は支払うというプライドあり) - 勤務場所、時間は自由 - 納期なし(なるはやタスク) --- ### 応募方法など - 応募方法: Twitterのリプライ(@hotu_taへ)のみ - 応募締め切り: 2019年5月31日(日本時間) - 厳正なる審査後、契約の相談のご連絡: Twitterのリプライで、6月中に連絡予定 - 契約方法: TwitterのDM上で、クラウドサインを通して準委任契約の締結となる予定です🙇 --- ### さいごに - Ruby最高! - Capybara(Selenium)も最高! - Herokuは良い - Googleマイマップも最高

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully