Skip to content

Instantly share code, notes, and snippets.

View satosystems's full-sized avatar

Satoshi Ogata satosystems

View GitHub Profile
todo :: Widget ()
todo = do
section ! id "todoapp" $ do
nelem "header" ! id "header"
section ! id "main" $ do
ul ! id "todo-list" $ noHtml
footer ! id "footer" $ do
span ! id "todo-count" $ noHtml
ul ! id "filters" $ noHtml
$ mkdir haste
$ cd haste
$ cabal sandbox init
$ cabal update
$ cabal install cabal-install
$ export PATH=$PATH:.cabal-sandbox/bin
$ cabal install haste-compiler
$ haste-boot
@satosystems
satosystems / file0.txt
Last active September 21, 2015 15:09
HomeBrew で古いバージョンをインストールするもうひとつの方法 ref: http://qiita.com/satosystems/items/8587527b185a91abfb37
$ bundle exec rails s
/Users/ogata/.rvm/gems/ruby-2.1.5/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require': This installation of RMagick was configured with ImageMagick 6.9.0 but ImageMagick 6.9.1-1 is in use. (RuntimeError)
-- Aeson は ByteString から生成するのでこのプラグマを使用する
{-# LANGUAGE OverloadedStrings #-}
-- Data.Aeson.TH を利用するとはかどるのでこのプラグマを使用する
{-# LANGUAGE TemplateHaskell #-}
import Data.Aeson (decode, encode)
import Data.Aeson.TH (deriveJSON, defaultOptions, Options(..))
import Data.Char (toLower)
data Foo a = Foo { fooId :: a } deriving (Show, Read, Eq)
@satosystems
satosystems / file0.txt
Created April 28, 2015 13:16
TextMate 2 設定メモ(空白可視化編) ref: http://qiita.com/satosystems/items/feeab668f7367c8a3531
$ mkdir -p ~/Library/Application\ Support/Avian/Bundles
$ cd ~/Library/Application\ Support/Avian/Bundles
$ git clone https://github.com/mads379/Whitespace.tmbundle.git
@satosystems
satosystems / SystemIoTempTest2.hs
Created April 17, 2015 10:02
Haskell でテンポラリファイルを扱う方法 ref: http://qiita.com/satosystems/items/c5504ef759f18e1e4232
import qualified GHC.IO.Handle as GIH
import qualified System.Directory as SD
import qualified System.IO.Temp as SIT
main :: IO ()
main = do
(path, handle) <- SIT.openTempFile "/tmp" "hoge.txt"
putStrLn $ "path: '" ++ path ++ "'"
putStrLn $ "handle: '" ++ show handle ++ "'"
GIH.hShow handle >>= \x -> putStrLn $ "hShow: '" ++ x ++ "'"
@satosystems
satosystems / SystemIoTempTest1.hs
Last active August 29, 2015 14:19
Haskell でテンポラリディレクトリを扱う方法 ref: http://qiita.com/satosystems/items/ea965b63e1fc269fc74d
import qualified System.Directory as SD
import qualified System.IO.Temp as SIT
tempFile :: String -> String
tempFile path = path ++ "/" ++ "hoge.txt"
withSystemTempDir :: FilePath -> IO String
withSystemTempDir path = do
putStrLn $ "path: '" ++ path ++ "'"
isDirExist <- SD.doesDirectoryExist path
@satosystems
satosystems / Session.hs
Created April 17, 2015 05:41
Haskell hspec で状態を引き回したい ref: http://qiita.com/satosystems/items/0ff85881edeffe4a904b
import System.Random
import Test.Hspec
-- | セッションが保持されるファイル名。
path :: String
path = "Session.txt"
-- | テストで使用するテンポラリファイル名。
tmp :: String
tmp = "Session.tmp"
import Test.Hspec
hello :: String -> String
hello name = "hello, " ++ name
specHello :: Spec
specHello = do
describe "hello" $ do
it "standard" $
hello "world" `shouldBe` "hello, world"
$ defaults write com.apple.spotlight CalculationEnabled -boolean false
$ killall Spotlight
$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist