Skip to content

Instantly share code, notes, and snippets.

View ryugate's full-sized avatar

SEKI Takashi ryugate

  • 04:53 (UTC +09:00)
View GitHub Profile
@ryugate
ryugate / リトライ処理
Last active April 27, 2017 06:52
Scalaで、Streamを使って、簡易的なリトライ処理を書いてみた
import scala.util.{Try, Random}
def retryLoop[A](count:Int, interval:Int)(f: =>A) = {
def sleep:A = {
println(s"wait:$interval[ms]")
throw new Exception
}
def retryStream:Stream[Try[A]] = Try(f) #:: Try(sleep) #:: retryStream
@ryugate
ryugate / gist:1042118
Created June 23, 2011 07:58
1ヶ月に金土日が5回ある月を確認する
import java.util.Calendar
/**
* 指定した年(デフォルトは今年)以降で、
* 指定した月の一覧(デフォルトは1,3,5,7,8,10,12月)の中で
* 1ヶ月に金土日が5回ある月を保持するストリームを返す関数
* 例)fiveTimesWeekend().take(10).toList
*
*/
/**
https://github.com/jberkel/android-plugin/raw/master/script/create_project
をobjectに定義した
https://gist.github.com/486306
にさらに、
・スクリプト起動に変更
・sbt-android-pluginのバージョンを0.5.1に変更
・scalatestのバージョンを1.2に変更
・デフォルトレイアウトの main.xml を作成
・デフォルト値の変更