Skip to content

Instantly share code, notes, and snippets.

View mtgto's full-sized avatar

Satoshi Goto mtgto

  • Japan
  • 14:09 (UTC +09:00)
  • X @mtgto
View GitHub Profile
@mtgto
mtgto / serve.mjs
Last active August 25, 2023 03:10
Hot reload and do incremental builds with `esbuild`
/*
* Change from https://gist.github.com/unki2aut/4ac81c33be2e8f121e80a26eba1735d7
* - Use top level await (Node.js v14.8.0+)
* - To use top level await, you need to write a script as ES Modules
* - Set chokidar options to avoid duplicate building
* - Define NODE_ENV (For React)
* - Add API proxy setting by using proxy-middleware
*/
import chokidar from "chokidar";
import esbuild from "esbuild";
import java.util.Random
object HelloWorld extends App {
println(randomString(748171626L) +" "+ randomString(31718954746L))
println(randomString2(748171626L) +" "+ randomString2(31718954746L))
def randomString(i :Long) :String = {
val rand = new Random(i)
val sb = new StringBuilder()
rs(rand.nextInt(27))