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

esaを支えたい技術

 esaを支えたい技術

Emacs Lisp and Elm may have some common syntax.

esa をネタに Emacs Lisp と Elm を無理やり繋げた発表をした
https://developer.feedforce.jp/entry/2019/07/01/140000

D6c5403c0b6ef2f9fd51910ea38323a3?s=128

Takashi Masuda

June 28, 2019
Tweet

More Decks by Takashi Masuda

Other Decks in Programming

Transcript

  1. ʓʓΛࢧ͍ٕ͑ͨज़ !NBTVUBLB

  2. ɹɹΛࢧ͍ٕ͑ͨज़ !NBTVUBLB ˜FTB--$

  3. ˜FTB--$

  4. ͍Α͍Α2JJUB5FBN͔ΒͷΠϯϙʔτ͕ ׬ྃ͠ɺFTBͷຊ֨Քಇ͕࢝·Γ·ͨ͠Ͷ

  5. ͦ͏͍͑͹ઌ݄͜ΜͳπʔϧΛ ࡞Γ·ͨ͠

  6. IUUQTNBTVUBLBOFUDIBMPXIUNM

  7. σϞ

  8. ػೳ w ʮ೚ҙͷΫΤϦͰFTBͷهࣄΛݕࡧ͠ɺΩϟο γϡϑΝΠϧʹॻ͖ग़ؔ͢਺ʯΛఆظతʹ࣮ߦ ͢Δ w FNBDTIFMNJOUFSGBDFܦ༝Ͱݕࡧ݁ՌΛߜΓࠐ Έͭͭɺϒϥ΢βͰૉૣ͘هࣄΛ։͘͜ͱ͕ग़ དྷΔ

  9. ݕࡧΫΤϦͷઃఆྫ (setq helm-esa-search-query (concat "watched:true kind:stock" " -in:Archived" " -category:Templates"

    " -in:\"esa ࿅श৔\"" " -in:\"(unsorted)\""))
  10. helm-esa-http-request request.el request--curl-callback request--curl-command async ~/.emacs/helm-esa success & finish? Emacs

    timer (default: Once an hour) next page?
  11. (defun helm-esa-http-request (&optional url) "Make a new HTTP request for

    create `helm-esa-file'. Use `helm-esa-get-url' if URL is nil." (unless url ;; 1st page (if (get-buffer helm-esa-work-buffer-name) (kill-buffer helm-esa-work-buffer-name)) (get-buffer-create helm-esa-work-buffer-name)) (helm-esa-http-debug-start) (request (if url url (helm-esa-get-url)) :headers `(("Authorization" . ,(concat "Bearer " helm-esa-access-token))) :parser 'json-read :success (cl-function (lambda (&key data response &allow-other-keys) (helm-esa-http-debug-finish-success (request-response-url response)) (let ((next-url)) (with-current-buffer (get-buffer helm-esa-work-buffer-name) (goto-char (point-max)) (helm-esa-insert-articles data) (setq next-url (helm-esa-next-url data)) (if next-url (helm-esa-http-request next-url) (write-region (point-min) (point-max) helm-esa-file)))))) :error (cl-function (lambda (&key error-thrown response &allow-other-keys) (helm-esa-http-debug-finish-error (request-response-url response) error- thrown))))) IUUQTHJUIVCDPNNBTVUBLBFNBDTIFMNFTB
  12. None
  13. IUUQTXXXBNB[PODPKQEQ#1'1(

  14. ωλΛܾΊ͔Ͷ͍ͯͨࠓ݄಄ʹͳ͔ͥ ʰجૅ͔ΒΘ͔Δ&MNʱΛखʹऔΓ·ͨ͠

  15. &MN w ڧྗͳ੩తܕγεςϜΛ࣋ͭؔ਺ܕݴޠ w +BWB4DSJQUʹίϯύΠϧ͢Δ͜ͱʹΑͬͯϒϥ΢ β্Ͱಈ࡞͢Δ w ॳ৺ऀֶ͕श͠΍͍͢͜ͱΛॏࢹ͓ͯ͠Γɺͱ ͯ΋γϯϓϧͳݴޠʹͳ͍ͬͯΔ ʰجૅ͔ΒΘ͔Δ&MNʱ1ΑΓൈਮ

  16. TZOUBYʢߏจʣ͕FNBDTMJTQ FMJTQ ͱࣅ͍ͯΔؾ͕

  17. ؔ਺ݺͼग़͠ (max 1 2) => 2 elisp -- ΧϯϚ ͸ෆཁ

    max 1 2 => 2 -- ΧοίͰׅΕΔ⭐ (max 1 2) => 2 Elm
  18. தஔԋࢉࢠ (1 + 2) => Invalid function: 1 (+ 1

    2) => 3 elisp 1 + 2 => 3 -- ؔ਺ͱͯ͠΋࢖͑Δ (+) 1 2 => 3 -- ઈରݟ΍͍͢⭐ ((+) 1 2) => 3 Elm
  19. MFUࣜ (let ((a 1) (b 2)) (max a b)) =>

    2 elisp -- ׬શʹҰக⭐ let a = 1 b = 2 in max a b => 2 Elm
  20. -JTUʢԋࢉࢠʣ (cons 3 '(2 1)) => (3 2 1) elisp

    -- ͜Ε·ͨಉ͡⭐ 3 :: [2, 1] => [3,2,1] Elm
  21. λϓϧ (cons 1 "a") => (1 . "a") elisp --

    ಉͩ͡⭐ (1, "a") => (1,"a") Elm
  22. FNBDTIFMNFTB

  23. FNBDTIFMNFTB

  24. ͳΔ΄Ͳʁ

  25. IFMNFTBFMͱಉ͜͡ͱ͕&MNͰ ࣮૷ग़དྷͨΓ͢Δʁ

  26. ͱΓ͋͑ͣࢼͯ͠Έͨ

  27. σϞ

  28. IUUQTHJUIVCDPNNBTVUBLBTBOECPYFMNFTB ݟӫ͑Λྑ͘͢ΔͨΊʹhtmlͱcssΛഈआ͠·ͨ͠ɻ esaͷօ͞Μ͝ΊΜͳ͍͞

  29. ग़དྷΔ͜ͱ w ݕࡧ͕Ͱ͖Δ w (&5WUFBNTUFBN@OBNFQPTUT w IFMNFTBFMͱಉ͡ w લ΍࣍ͷϖʔδʹਐΊΔ w

    ͦΕ͚ͩ
  30. ੍ݶࣄ߲ w 0"VUIͷ*NQMJDJU'MPXΛ࣮૷͍ͯ͠ͳ͍ͨ Ίɺ"DDFTT5PLFOϕλॻ͖

  31. ίʔυΛಡΉ https://github.com/masutaka/sandbox-elm-esa/blob/ master/src/Main.elm

  32. ·ͱΊ w ͦ΋ͦ΋&NBDTͷॲཧܥΛFMJTQ͔Β&MNʹมߋ ͢Δ͜ͱ͸ग़དྷͳ͍ w ؔ਺ܕݴޠͱࣅ͍ͯΔFMJTQͷ࣍ʹɺ&MNΛֶͿ ͱֶश͕௙Δ

  33. ͓ΘΓ