Skip to content

Instantly share code, notes, and snippets.

View j5ik2o's full-sized avatar

Junichi Kato j5ik2o

View GitHub Profile
package models
import org.joda.time.DateTime
import scalikejdbc.WrappedResultSet
import skinny.orm.{ Alias, SkinnyCRUDMapper }
case class User(
id: Option[Long] = None,
name: String,
email: String,
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: ArrayTest.scala
import scala.Predef$;
import scala.collection.mutable.ArrayOps;
import scala.runtime.BoxesRunTime;
public final class Main$
@j5ik2o
j5ik2o / angular2-bindings.md
Last active November 20, 2016 11:11
Bindings, obervables, and pipes - Angular2 Development with TypeScript

Bindings, obervables, and pipes

バインディングとオブザーバブルとパイプ

The goal of the the first four chapters was to jump-start application development with Angular.

最初の4つの章の目標は、Angularを使用してアプリケーション開発を開始することでした。

In those chapters we used property bindings, handled events, and applied directives without providing detailed explanations.

@j5ik2o
j5ik2o / UnicodeGenSupport.scala
Created October 7, 2016 00:05
サロゲート文字を含むユニコード文字を生成するジェネレータの例
import org.scalacheck.Gen
trait UnicodeGenSupport {
// 文字コード範囲
private val unicodeRange: Seq[Char] = Character.MIN_VALUE to Character.MAX_VALUE
// 上位サロゲート領域
private val unicodeHighSurrogatePlane: Seq[Char] = Character.MIN_HIGH_SURROGATE to Character.MAX_HIGH_SURROGATE
// 下位サロゲート領域
object Base {
sealed trait State extends FSMState
case object Stopped extends State {
override def identifier: String = "Stopped"
}
case object Started extends State {

自動販売機のシナリオ

  • 購入者は、自動販売機に、料金を投下し飲料を購入できる。
    • おつりがある場合は自動販売機から払い出される。
    • 飲料毎に料金が違うものとする。
    • 売り切れの飲料は購入できない。
  • 管理者は、自動販売機内の料金を回収できる。
  • 管理者は、自動販売機内の飲料在庫を確認できる。
  • 管理者は、自動販売機内の飲料在庫を追加できる。
  • 管理者は、自動販売機内の飲料に対して価格を設定できる。
import java.util.UUID
case class Dept(id: UUID, name: String) extends Entity[UUID]
case class ZipCode(first: String, second: String)
object ZipCode {
def fromString(value: String): ZipCode = {
val values = value.split("\\-")

ちょー稼ぐ!!!

import scala.scalajs.js
import scala.scalajs.js.JSApp
import scala.scalajs.js.annotation.JSExport

@JSExport
object Main extends JSApp {
  @JSExport
 override def main(): Unit = {
@j5ik2o
j5ik2o / git.md
Last active February 11, 2016 01:57

インタープリタをトランポリン化できていないが、だいたいやりたいことができた。

Free[Command, Unit]ですが、Unit以外を選択する場合ってどんなユースケースなんだろうか?

case class Money(amount: Long, currency: Currency) {

  def +(other: Money): Money = {
    require(currency == other.currency)
    copy(amount = this.amount + other.amount)
ebBundleTargetFiles in aws <<= Def.task {
val base = baseDirectory.value
val assemblyJarFile = (outputPath in assembly).value
Seq(
(base / "Dockerfile", "Dockerfile"),
(base / "Dockerrun.aws.json", "Dockerrun.aws.json"),
(assemblyJarFile, assemblyJarFile.name)
)
}