I hereby claim:
- I am akiomik on github.
- I am akiomik (https://keybase.io/akiomik) on keybase.
- I have a public key ASDOSsrhwIXhzWFVQAIouvDYDHBGcISMBlECAzuazqcZfAo
To claim this, I am signing this object:
val NUM_LETTERS = 25 | |
implicit class RichChar(c: Char) { | |
def shiftLetter(i: Int): Char = { | |
if (c.isLetter) { | |
val (a, z) = if (c.isLower) ('a', 'z') else ('A', 'Z') | |
val n = i % NUM_LETTERS | |
(((c + n) % z % a) + a).toChar | |
} else { | |
c |
I hereby claim:
To claim this, I am signing this object:
*.scala diff=scala |
function zle-line-init zle-keymap-select { | |
vimode="${${KEYMAP/vicmd/NORMAL}/(main|viins)/INSERT}" | |
# update status line | |
if [ -n "$TMUX" ]; then | |
# tmux | |
if [ $vimode = "NORMAL" ]; then | |
statbg="colour236" | |
statfg="colour247" | |
statl1bg="colour240" |
case class Calc(f: Int => Int, g: Int => Int, i: Int = 1) {
def calc: Int = (f compose g)(i)
}
object Calc {
def apply(f: Int => Int, g: Int => Int): Calc = new Calc(f, g)
}
sukoというパズルの適当なソルバを書いたので簡単なベンチマークを取ってみた。
問題は2014/01/06のmetro紙より。
new scala.testing.Benchmark {
replicate' :: Int -> a -> [a] | |
replicate' n x | |
| n <= 0 = [] | |
| otherwise = x : replicate' (n - 1) x | |
take' :; Int -> [a] -> [a] | |
take' n _ | |
| n <= 0 = [] | |
take' _ [] = [] | |
take' n (x : xs) = x : take' (n - 1) xs |
brew install rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bashrc
echo 'eval "$(rbenv init -)"' >> .bashrc
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install -l # 入れれるバージョン
rbenv install 2.0.0-rc2
rbenv versions # バージョン確認
rbenv global 2.0.0-rc2 # rc2を適用
#!/bin/sh | |
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |