Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Yuto MIZUSHIRI mizukmb

🏠
Working from home
  • Yayoi Co., Ltd.
  • Aichi, Japan
  • Twitter @mizukmb
View GitHub Profile
@mizukmb
mizukmb / rightshift.json
Created Jul 28, 2017
right_shift to _ (under bar) in Karabiner-Elements
View rightshift.json
{
"description": "右シフトをアンダーバーにする",
"manipulators": [
{
"from": {
"key_code": "right_shift",
"modifiers": {
"optional": [
"any"
]
@mizukmb
mizukmb / vimode.json
Created Jul 28, 2017
vi mode (opt + hjkl) in Karabiner-Elements
View vimode.json
{
"description": "vi mode (opt + hjkl)",
"manipulators": [
{
"from": {
"key_code": "h",
"modifiers": {
"mandatory": [
"left_option"
],
View vector.hs
data Vector a = Vector a a a deriving (Show)
vplus :: (Num a) => Vector a -> Vector a -> Vector a
(Vector i j k) `vplus` (Vector l m n) = Vector (i+l) (j+m) (k+n)
dotProd :: (Num a) => Vector a -> Vector a -> a
(Vector i j k) `dotProd` (Vector l m n) = i*l + j*m + k*n
vmult :: (Num a) => Vector a -> a -> Vector a
(Vector i j k) `vmult` m = Vector (i*m) (j*m) (j*m)
View person.hs
-- data Person = Person String String Int Float String String deriving (Show)
-- レコード構文
-- ex.)
-- *Main> let guy = Person "Buddy" "Finklestein" 43 184.2 "526-2928" "Chocolate"
-- *Main> flavor guy
-- "Chocolate"
-- *Main> :t flavor
-- flavor :: Person -> String
data Person = Person {
firstName :: String,
View Shapes.hs
module Shapes (Point, Shape, area, nudge, baseCircle, baseRect) where
-- data Shape = Circle Float Float Float |
-- Rectangle Float Float Float Float
-- data Shape = Circle Float Float Float |
-- Rectangle Float Float Float Float
-- deriving (Show)
data Point = Point Float Float deriving (Show)
data Shape = Circle Point Float | Rectangle Point Point deriving (Show)
-- area :: Shape -> Float
View curry.hs
-- 引数の数字が 100 よりも大きいか返す関数
-- -> 数字の比較
-- -> 100よりも大きいか
gt100 :: Int -> Ordering
-- compare 1 2
-- compare 100 x
gt100 = compare 100
View fib.hs
fib :: Int -> Int
-- Pattern match
-- fib 0 = 0
-- fib 1 = 1
--
-- fib n = fib (n-1) + fib (n-2)
-- Guard
fib n
View gist:e51219e8b47a5a49e78dd364017c8e9e
### Keybase proof
I hereby claim:
* I am mizukmb on github.
* I am mizukmb (https://keybase.io/mizukmb) on keybase.
* I have a public key ASDIJCpIGZGau3t-dTFB0lNkkojZRJDQPogWkwlShZ39uQo
To claim this, I am signing this object:
View fizzbuzz.hs
fizzBuzz :: Integer -> String
fizzBuzz 0 = "0"
fizzBuzz fz
| fz `mod` 15 == 0 = "FizzBuzz"
| fz `mod` 3 == 0 = "Fizz"
| fz `mod` 5 == 0 = "Buzz"
| otherwise = show fz
View purelisp.rb
module MS
def print(token)
case token
when MAtom
token.token
when Array
"( #{token.map{ |t| print(t) }.join(' ')} )"
else
raise 'Syntax Error!!'
end