This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Blood | |
def initialize f, g | |
@blood = [f, g].sort | |
end | |
def type | |
case @blood | |
when %w(A A) then "A" | |
when %w(A O) then "A" | |
when %w(B B) then "B" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inp = <<INP | |
A:c,b,a | |
B:a,b,d | |
C:a,c,b | |
D:d,a,c | |
a:A,C,D | |
b:D,A,B | |
c:B,A,C | |
d:D,C,A | |
INP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
require 'spec_helper' | |
RSpec::Matchers.define :get do |first| | |
match do |actual| | |
actual.public_send(@second, *@args) == first | |
end | |
chain :by_call do |second, *args| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Extractable | |
module Initializer | |
def initialize *args | |
self.class.class_eval do | |
define_method(:extract) do |&block| | |
if block | |
block.(*args) | |
else | |
args | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad | |
import Control.Applicative | |
import Data.List | |
type Triple = (Int, Int, Int) | |
data Pat = Pat { | |
triple :: Triple, | |
mods :: [Int] | |
} deriving (Show) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Applicative | |
import Control.Monad | |
import Data.IntMap | |
diffRange :: IntMap Int -> Int -> Int -> Int | |
diffRange xs t d = l - h | |
where | |
h = xs ! (d) | |
l = xs ! (d + t) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Control.Concurrent | |
import Control.Concurrent.STM | |
import Control.Monad.IO.Class | |
import Data.Text.Lazy | |
import Web.Scotty | |
import Data.Aeson.Types |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Fruit = Apple | Lemon | Banana | |
data Beverage = Coffee | Tea | Beer | |
data Temperature = Hot | Cool | |
-{ | |
Food = { Food, Lemon, Curry } | |
Flavor = { Sweet, Sour, Spicy } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Monad | |
import Control.Concurrent | |
import Control.Concurrent.STM | |
-- STM (TVar [STM (TVar Int)]) | |
type Data = TVar Int | |
type DataList = TVar [STM Data] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XIM=fcitx | |
XIM_PROGRAM=/usr/bin/fcitx | |
XIM_ARGS="" | |
GTK_IM_MODULE=fcitx | |
QT_IM_MODULE=fcitx | |
DEPENDS="fcitx" |
OlderNewer