Skip to content

Instantly share code, notes, and snippets.

Avatar

Junichi Kato j5ik2o

View GitHub Profile
@j5ik2o
j5ik2o / gist:2970973
Last active March 9, 2023 02:41
ペアプロの心得
View gist:2970973

ペアプロの心得

休憩をとる

1.定期的に休憩をとっていますか? ペアプログラミングは、精神的な体力を消耗します。定期的に休憩をとってリフレッシュすることがとても大切です。

謙虚になる

2.「色々な実装方針がある」という認識がありますか?

View haskell-cheat-sheet.md
View ThreadState1.java
/*
* Copyright 2022 Junichi Kato
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@j5ik2o
j5ik2o / gist:5660744
Last active November 18, 2021 11:04
Scala 2.10 & SBT & JRebel & IntelliJ IDEAの環境構築方法
View gist:5660744

できること

  • JRebelを利用すると、アプリケーションの再起動なしで実行中のアプリケーションに加えた変更を即座に反映することができます(ホットリローディング)。まるでPHPのようにサクサク書けるッ!
  • Scala開発者にはライセンスが$0で提供されます。Javaで利用する場合は購入してね☆彡

前提

以下がインストールされているものとする。

@j5ik2o
j5ik2o / gist:1786414
Created February 10, 2012 04:00
git:masterからsvn:trunkに同期する方法
View gist:1786414
# 前提:クローンしたgitリポジトリに対してsvnリポジトリを設定して同期を行う。
# 設定ファイルを編集のが手間。
$ git clone ssh://localhsot/repos/app.git app
# .git/config にSVNのリポジトリの設定を追加する
[svn-remote "svn"]
url = http://junichi_kato@svn-server
fetch = project/app/trunk:refs/remotes/trunk
branches = project/app/branches/*:refs/remotes/*
View Money.scala
import java.util.Currency
final case class Money(amount: BigDecimal, currency: Currency)
object Money {
implicit object MoneyAdder extends Adder[Money] {
override type Output = Either[Exception, Money]
@j5ik2o
j5ik2o / gist:2996293
Created June 26, 2012 15:03
リトライハンドラー
View gist:2996293
case class RetryException(throwables: List[Throwable]) extends Exception(throwables.toString())
object RetryUtil {
import scala.util.control.Exception.allCatch
def retry[T](retryLimit: Int)(f: => T): T =
retry(retryLimit, 0, classOf[Throwable])(f)
View gist:38a7b8950b617dacad619c2f226e9a24

State Sourcing(CRUD)なら以下のようなイメージ。まぁ普通によく見るロジック。

class AddCartItemCommandProcessorOnSS(cartRepository: CartRepository) {

  def execute(cartId: CartId, itemId: ItemId, num: ItemNum): Unit = {
    // 最新の集約(グローバルなエンティティ)をストレージから取得する
    val cart = cartRepository.findById(cartId)
    // ロジック実行: 予算超過ならカートオブジェクトが商品の追加を拒否する! (1)
    val newCart = cart.addItem(itemId, num) 
View ToyVec.rs
pub struct ToyVec<T> {
elements: Box<[T]>,
len: usize,
}
pub struct Iter<'vec, T> {
// 参照型のフィールドにはライフタイム指定子
elements: &'vec Box<[T]>,
len: usize,
pos: usize,
View gist:e7d1916d32c05660738e54afbb0d004a

[info] Reapplying settings... [info] Set current project to reactive-aws-clients-project (in build file:/home/parallels/Sources/reactive-aws-clients/) WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.twitter.jvm.Hotspot (file:/home/parallels/.cache/coursier/v1/https/repo1.maven.org/maven2/com/twitter/util-jvm_2.12/20.3.0/util-jvm_2.12-20.3.0.jar) to field sun.management.ManagementFactoryHelper.jvm WARNING: Please consider reporting this to the maintainers of com.twitter.jvm.Hotspot WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release 2020-03-27 04:55:45.069-0700 info [finagle] Using bridged scheduler with 4 workers 2020-03-27 04:55:45.074-0700 info [finagle] Finagle version 20.3.0 (rev=e3fd6d1bd88c9ed7edeb98a6598e23800924c633) built at 20200308-110321 2020-03-27 04:55:45.740-0700 info [SonatypeService] sonatypeRepository : https: