Skip to content

Instantly share code, notes, and snippets.

@stk132
stk132 / cv.md
Last active August 2, 2020 17:58
職務経歴書

プロフィール

  • 名前: 島袋拓也
  • 生年月日: 1986/09/25

転職ステータス

2020年11末〜12月初旬の退職を目処として、転職先を検討中

転職動機

@stk132
stk132 / readGZIP.scala
Last active April 14, 2020 18:54
scala2.12で呼び出し元でstream closedになるケース
def readGZIPFile[A](filePath: String, proc: String => Option[A]): Either[Throwable, Seq[A]] = {
val gs = new GZIPInputStream(new FileInputStream(filePath))
val ss = Source.fromInputStream(gs, "UTF-8")
try {
val ret = ss.getLines().flatMap(line => proc(line)).toSeq
Right(ret)
} catch {
case NonFatal(t) => Left(t)
} finally {
ss.close()
@stk132
stk132 / MySQLSyntaxSupport.scala
Created January 26, 2019 08:30
scalikejdbc back-quoted syntax
import scalikejdbc._
object MySQLSyntaxSupport {
implicit class RichInsertSQLBuilder(val self: InsertSQLBuilder) extends AnyVal {
def quotedNamedValues(columnsAndValues: (SQLSyntax, ParameterBinder)*): InsertSQLBuilder = {
val (cs, vs) = columnsAndValues.unzip
val quotedCs = cs.map {column => sqls"`$column`"}
val quotedColumnsAndValues = quotedCs zip vs
@stk132
stk132 / build.sbt
Created December 11, 2018 16:54
block.fmのトラックリストを取得するサンプル
import Dependencies._
lazy val root = (project in file(".")).
settings(
inThisBuild(List(
organization := "com.example",
scalaVersion := "2.12.5",
version := "0.1.0-SNAPSHOT"
)),
name := "Hello",
VUsers.N() // output "users"
VUsers.Name.N() // output "name"
VUsers.ID.N() // output "id"
VUsers.A("hoge").N() // output "hoge"
VUsers.A("hoge").Name.N() // output "hoge.name"
VUsers.A("hoge").ID.N() // output "hoge.id"
dbr.Select(VUsers.Name.N()).From(VUsers.N()).Load(&m)
package main
import "fmt"
var (
VUsers Users
)
func init() {
tsg -u username --pass=password -d database_name
var ret []string
sess.Select("id").From("users").Load(&ret)
これはテストなので、無視してください。
this is test. please ignore.