Skip to content

Instantly share code, notes, and snippets.

@mtmtcode
Created August 22, 2013 11:25
Show Gist options
  • Save mtmtcode/6306039 to your computer and use it in GitHub Desktop.
Save mtmtcode/6306039 to your computer and use it in GitHub Desktop.
naruto.el Herokuデビュー
web: tar xzf emacs.tar.gz && ln -s $PWD/emacs /tmp/emacs; emacs/bin/emacs --daemon --load start-elnode.el
;;; start-elnode.el
(setq package-archives '(("marmalade" . "http://marmalade-repo.org/packages/")))
(package-initialize)
(package-refresh-contents)
(package-install 'dash)
(package-install 'elnode)
(load-file "naruto.el")
(defun handler (httpcon)
"Demonstration function"
(elnode-http-start httpcon "200"
'("Content-type" . "text/html")
`("Server" . ,(concat "GNU Emacs " emacs-version)))
(elnode-http-return httpcon (format "<html><body><pre>%s</pre></body></html>" (naruto "Heroku'(へろく)は2007年創業のアメリカ合衆国の企業。また、同社が開発と運営を行っているPaaSの名称でもある。2010年にはセールスフォース・ドットコムに買収された。"))))
(elnode-start
'handler
:port (string-to-number (or (getenv "PORT") "8080"))
:host "0.0.0.0")
(while t (accept-process-output nil 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment