Skip to content

Instantly share code, notes, and snippets.

View jdoiwork's full-sized avatar
🏠
Working from home

Junichiro Doi jdoiwork

🏠
Working from home
View GitHub Profile
@jdoiwork
jdoiwork / rename-window-title.el
Created July 21, 2016 00:47
Emacsのウィンドウタイトル(frame-title)を変更する
;; Emacs の PIDとバッファー名を表示するようにする
;; https://www.emacswiki.org/emacs/FrameTitle
(setq-default frame-title-format (list (format "%x @ " (emacs-pid)) "%b"))
class App
def plus1(n)
n + 1
end
def double(n)
n * 2
end
def triple(n)
@jdoiwork
jdoiwork / list.rb
Last active April 27, 2016 04:00
List Monad Ruby
INFINITY_STACK = false
class List
private
def initialize()
@null = false
end
class NullList < List
@jdoiwork
jdoiwork / myMiddleware.hs
Created April 1, 2016 02:35
Network.Wai Middleware example
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Network.Wai
import Network.HTTP.Types
import Network.Wai.Handler.Warp (run)
import qualified Data.ByteString.Lazy as LBS(fromStrict)
import qualified Data.ByteString as SBS(ByteString)
@jdoiwork
jdoiwork / Blaze-ByteString-Builder-Example.hs
Created March 31, 2016 06:22
Blaze.ByteString.Builder and Writer Monad
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Blaze.ByteString.Builder (toLazyByteString, Builder)
import Blaze.ByteString.Builder.ByteString (fromByteString)
import Data.String (IsString)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Writer (execWriterT, execWriter, WriterT, Writer, MonadWriter, tell)
docker run -d -p 9200:9200 -p 9300:9300 --name jdoi-elasticsearch elasticsearch -Des.network.host=::0
class Nothing
constructor: () ->
bind: (f) ->
@
class Just
constructor: (b) ->
@just = b
bind: (f) ->
class Aaa
def hello
'a'
end
end
class Bbb
def hello
'b'
end
def λ (&block)
(lambda &block).curry
end
plus = λ {|x, y| x + y }
plus1 = plus[1]
three = plus1[2]
puts three
{-# LANGUAGE RecordWildCards #-}
module Handler.Hoge where
import Import
-- ...
data Person = Person
{ name :: Text