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

社内システムを楽しくする 3つのコツ #charity_lt_kansai

yusuke
October 12, 2018

社内システムを楽しくする 3つのコツ #charity_lt_kansai

Web Audio API
Giphy API
Web Notification API
を使って社内システムを実用的に楽しくした話です。

yusuke

October 12, 2018
Tweet

More Decks by yusuke

Other Decks in Technology

Transcript

  1. ʢαϜϥΠζϜʣࣾ಺γεςϜͷ՝୊ • ຯؾͳ͍σβΠϯ : Bootstrapؙग़͠ • ࡶͳ࡞Γɺ༷ʑͳʮӡ༻ͰΧόʔʯ • ʮ͜͜͸ߋ৽ͨ͠ΒUndoग़དྷͳ͍ͷͰؾΛ͚ͭͯʯ •

    ʮ͜ͷϘλϯԡ͢ͱ2෼͘Β͍଴ͨ͞ΕΔ͚Ͳɺ଴ͬͯʯ • ʮ଴ͬͯΔؒʹೋ౓ԡ͢͠ΔͱԿ͔ྑ͘ͳ͍͜ͱ͕ى͖Δʯ • ʮॲཧ͕׬͔ྃͨ͠Ͳ͏͔͸ը໘࠶ϩʔυͯ֬͠ೝͯ͠Ͷʯ
  2. ԻΛग़͢ - Web Audio API (1/2) <audio id="coinsound" preload="auto"> <source

    src="/sounds/smb_coin.wav" type="audio/wav"> </audio> <form action="./ProcessCommand" method="POST" onsubmit="return confirmWithSound('ாථΛෳ੡ͯ͠ྑ͍Ͱ͔͢ʁ', 'powerup')" style="display:inline"
  3. ԻΛग़͢ - Web Audio API (2/2) function confirmWithSound(message, effectName){ if

    (confirm(message)) { const soundEffect = document.getElementById(effectName); soundEffect.play(); const d1 = new Date(); while (true) { const d2 = new Date(); if (d2 - d1 > (soundEffect.duration * 1000)) { break; } } return true; } return false; }
  4. Giphy4Jͱ͸ • Java / Kotlin͔Β؆୯ɺܕ҆શʹGiphy APIΛ࢖͑Δ Javaίʔυྫ) class Giphy4JExample{ public

    static void main(String... args){ String apiKey = "myapikey"; Giphy4J giphy4j = new Giphy4J(apiKey); List<Gif> gifs = giphy4j.search("sponge bob"); } }
  5. Giphy4Jར༻ྫ Kotlinίʔυྫ) fun main(args: Array<String>) { val giphy4K = Giphy4K("apikey")

    val gifs = giphy4K.random(tag = "sponge bob") // ࢦఆͨ͠ΩʔϫʔυͷϧʔϓಈըͷURL println(gifs.images.looping.mp4) }
  6. Push.jsར༻Πϝʔδ <script src="./js/push.js"></script> <script> let ϝοηʔδ = "௨஌͢Δϝοηʔδ" Push.create("Yabumi", {

    body: ϝοηʔδ, icon: 'https://' + location.host + '/images/icon.png', timeout: 4000, onClick: function () { window.focus(); this.close(); } }); </script> • ஫)SafariͰ͸ΞΠίϯ͸දࣔ͞Εͳ͍ ஫)4ඵఔ౓ͰOS͕ফͯ͠͠·͏ɻ4ඵҎ্දࣔ ͠ଓ͚Δ௨஌͸࡞Εͳͦ͞͏ɻ
  7. Nginxͷઃఆ server { listen 80; server_name localhost; location / {

    proxy_set_header X-Forwarded-Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_http_version 1.1; # to proxy WebSockets in nginx proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_pass_header Sec-Websocket-Extensions; proxy_pass http://backend:8080; } }ç WebSocketͷϓϩΩγʹඞཁ