As configured in my dotfiles.
start new:
tmux
start new with session name:
object Main { | |
def humming: Iterator[BigInt] = { | |
object ForwardReferenceable { | |
def output: Iterator[BigInt] = Iterator(BigInt(3), BigInt(4), BigInt(5)) ++ merged | |
val Seq(result, m2, m3, m5) = tee(output, 4) | |
val merged = merge(m2 map {_ * 2}, m3 map {_ * 3}, m5 map {_ * 5}) | |
} | |
Iterator(BigInt(1), BigInt(2)) ++ ForwardReferenceable.result | |
} | |
As configured in my dotfiles.
start new:
tmux
start new with session name:
def index(id:String) = Action { | |
getFirstData(id) | |
} | |
private def getFirstData(id:String) = { | |
Cache.get(id) match { | |
case Some(id2) => getSecondData(id2) | |
case None => NotFound | |
} | |
} | |
private def getSecondData(id2:String) = { |
"For comprehension" is a another syntaxe to use map
, flatMap
and withFilter
(or filter) methods.
yield
keyword is used to aggregate values in the resulting structure.
This composition can be used on any type implementing this methods, like List
, Option
, Future
...
// play-jsonをフツーのプロジェクトでも使いたいサンプル | |
name := "hello" | |
version := "1.0" | |
scalaVersion := "2.10.3" | |
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" |
#!/bin/bash | |
#################### | |
## リダイレクト先に「xargsにパイプを経由して渡した引数を含むファイル名」を設定するためのワンクッション | |
func() | |
{ | |
## コマンド及び引数の並び | |
# func <seed> | |
## 時間がかかる処理 |
Twitter API 1.1 の現行APIの制限 | |
(REST API v1.1 Limits per window by resource) | |
https://dev.twitter.com/docs/rate-limiting/1.1/limits | |
・15分辺り最大何回実行できるか | |
Timelines | |
GET statuses/mentions_timeline 15回 | |
GET statuses/user_timeline 180回/user, 300回/application |
Add config/puma.ruby | |
-------------------- | |
cd /home/redmine/redmine | |
sudo -u redmine -H curl --output config/puma.rb https://gist.github.com/thanhhh/5610668/raw/fdfe2a865c3a0afe912c8784c971ea7ca3e64cfd/puma.rb | |
Install Init Script | |
-------------------- | |
Download the init script (will be /etc/init.d/redmine): | |
import scala.slick.lifted._ | |
import java.util.Date | |
import org.joda.time.DateTime | |
import scala.slick.driver.{BasicDriver, BasicProfile} | |
import scala.slick.session.{PositionedResult, PositionedParameters} | |
import scala.language.implicitConversions | |
/** | |
* [[org.joda.time.DateTime]]を[[java.sql.Date]]にSlickにおいて暗黙変換して利用する | |
* |