Skip to content

Instantly share code, notes, and snippets.

@tkfmst
tkfmst / ExampleTest.scala
Created August 29, 2022 10:35
test "complete-lastly" in asynchronous scalatest
package example
import org.scalatest.funspec.AsyncFunSpec
import org.scalatest.matchers.should.Matchers
import scala.concurrent.Future
// sbt.version=1.7.1
// ThisBuild / scalaVersion := "2.13.8"
// Test / fork := false,
// Test / parallelExecution := false,
@tkfmst
tkfmst / ExampleMonocle.scala
Created May 9, 2022 00:24
[scala] shapeless.lens & monocleお試し
package examplelens
import monocle.macros.GenLens
import monocle.syntax.all._
import shapeless.test.typed
object SampleMonocle {
println("run SampleMonocle")
val user = User.default
@tkfmst
tkfmst / add_separator.rs
Created January 7, 2022 11:52
rustで3桁区切りなど、文字列に区切り文字を入れる
#![allow(dead_code)]
fn add_separator(txt: &str, n: usize, separator: &str) -> String {
txt.chars()
.rev()
.collect::<Vec<char>>()
.chunks(n)
.map(|cs| cs.iter().collect::<String>())
.collect::<Vec<String>>()
.join(separator)