Skip to content

Instantly share code, notes, and snippets.

Toshiyuki Takahashi tototoshi

Block or report user

Report or block tototoshi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tototoshi / SplitTestPlugin.scala
Last active Nov 8, 2019
View SplitTestPlugin.scala
import sbt._
import Keys._
* テストをいい感じに分割して実行します。
* 分割にはテストクラス名のCRC32チェックサムを使っています。
* 例えば3分割したい時は
* > sbt 'splitTest 3 1'
* > sbt 'splitTest 3 2'
tototoshi / a.scala
Created Mar 30, 2018
shapless example (Show)
View a.scala
package com.example
import shapeless._
import shapeless.labelled.FieldType
trait Show[A] {
def show(a: A): String
object Show {
tototoshi / a.scala
Last active Aug 13, 2017
View a.scala
scala> import scala.collection.immutable.SortedSet
import scala.collection.immutable.SortedSet
scala> case class Hoge(i: Int)
defined class Hoge
scala> SortedSet(1, 2, 3, 4, 5)
res0: scala.collection.immutable.SortedSet[Int] = TreeSet(1, 2, 3, 4, 5)
scala> SortedSet(1, 2, 3, 4, 5).map(Hoge.apply)
View 00_Main.scala
package com.example
import java.time.LocalDateTime
case class UserName(
firs: String,
last: String
dir=${1:?directory is not specified}
cd $dir
tmpfile=$(mktemp "project/$$.sbt")
clean() {
rm -f $tmpfile
View ConnectionPool.scala
package models
import javax.inject.{Inject, Provider, Singleton}
import play.api.inject.{ApplicationLifecycle, Binding, Module}
import play.api.{Configuration, Environment, Logger}
import scalikejdbc.config.TypesafeConfigReader
import scalikejdbc.{Commons2ConnectionPoolFactory, ConnectionPool}
import scala.concurrent.{ExecutionContext, Future}
tototoshi / future.scala
Created Mar 26, 2015
Future.successful と Future.apply
View future.scala
import scala.concurrent.Future
// def successful[T](result: T): Future[T] を使った場合
// result を評価する時点でブロックされるので
// a b c の順に表示される
val f1 = Future.successful { Thread.sleep(1000); println("b") }
// def apply[T](body: ⇒ T)(implicit execctx: ExecutionContext): Future[T]
tototoshi / Test.scala
Last active Aug 29, 2015
scalacache bug?
View Test.scala
case class User(id: Int, name: String)
object Test {
import scalacache._
import memoization._
import redis._
implicit val scalaCache = ScalaCache(RedisCache("localhost", 6379))
tototoshi / a.sql
Created Jul 19, 2014
timestamp with time zone
View a.sql
example=# CREATE TABLE tstest (ts1 timestamp, ts2 timestamp with time zone);
example=# \d tstest;
Table "public.tstest"
Column | Type | Modifiers
ts1 | timestamp without time zone |
ts2 | timestamp with time zone |
example=# INSERT INTO tstest VALUES (current_timestamp, current_timestamp);
tototoshi / XHRImage.js.scala
Created Jun 28, 2014
Scala.js で xhr で画像をとってきて表示する
View XHRImage.js.scala
package com.github.tototoshi.gifplayer
import scala.scalajs.js
import js.annotation.JSExport
import org.scalajs.dom
object GIFPlayer extends js.JSApp {
def main(): Unit = {
You can’t perform that action at this time.