View PatternGuard.hs
import Data.List
main = IO ()
main = do
f ["one"]
f ["one", "two", "three"]
f ["ein", "zwei", "drei"]
f []
f :: [String] -> IO ()
View runwithstdin.hs
import Control.Exception
import GHC.IO.Handle
import System.IO
import System.IO.Temp
main :: IO ()
main = do
runWithStdin "Ornette Coleman Trio\nAt the Golden Circle Stockholm" $ do
getLine >>= putStrLn
getLine >>= putStrLn
View a.hs
import System.IO
import System.IO.Temp
main :: IO ()
main = do
withSystemTempFile "uuu" $ \path handle -> do
hPutStrLn handle "hello\nbye"
hClose handle
handle' <- openFile path ReadMode
go handle' stdout
View interactiveProcess.hs
import System.Process
import System.IO
main :: IO ()
main = do
(Just hi, Just ho, _, ph) <- createProcess (proc "ruby" ["-e", "f = gets; puts f "]) { std_in = CreatePipe, std_out = CreatePipe }
hPutStrLn hi "foobar"
hGetLine ho >>= print
View post-checkout
#! /usr/bin/env ruby
class String
# colorization
def colorize(color_code)
"\e[#{color_code}m#{self}\e[0m"
end
def red
colorize(31)
View cabal-sandbox-user-install.sh
#! /bin/sh
# Original idea came from http://maoe.hatenadiary.jp/entry/2014/12/25/064900
hash $1 2>/dev/null || {
cabal get $1
r=`ls | grep $1 | head -1`
cd $r
cabal sandbox init
cabal install -j --bindir ~/.cabal/bin --datadir ~/.cabal/share
View gist:6bff3cdd25263487c471
ubuntu@box69:~/hi$ hpc-coveralls spec --display-report -p --exclude-dir=test
{"source_files":[{"coverage":[null,null,null,null,null,null,null,null,null,null,null,null,0,null,null,null,2,null,null,0,0,0,0,0,null,null,0,0,0,0,0,null,null,0,0,0],"name":"dist/build/autogen/Paths_hi.hs","source":"module Paths_hi (\n version,\n getBinDir, getLibDir, getDataDir, getLibexecDir,\n getDataFileName, getSysconfDir\n ) where\n\nimpor
t qualified Control.Exception as Exception\nimport Data.Version (Version(..))\nimport System.Environment (getEnv)\nimport Prelude\n\ncatchIO :: IO a -> (Exception.IOException -> IO a) -> IO a\ncatchIO = Exception.catch\n\n\nversion :: Version\nversion = Version {versionBranch = [1,0,0,0], versionTags = []}\nbindir, libdir, datadir, libexecdir, sysconfdir
:: FilePath\n\nbindir = \"/home/ubuntu/hi/.cabal-sandbox/bin\"\nlibdir = \"/home/ubuntu/hi/.cabal-sandbox/lib/x86_64-lin
View guess.hs
import Control.Applicative
import Control.Exception
import System.Random
import Text.Read
main :: IO ()
main = go
go :: IO ()
go = do
View config.rb
module Api
def self.config
@@_config ||= OpenStruct.new
end
def self.configure
yield self.config
end
end
View tft2014.md

% Tools for trade 2014 % fujimura

OS and Application

  • MacBook Pro 15inch
  • Mac OS X
  • Terminal.app
  • MacVim.app