Skip to content

Instantly share code, notes, and snippets.

View japgolly's full-sized avatar

David Barri japgolly

View GitHub Profile

Dear Mum,

I'm sorry I missed your funeral. You know me — I would've spoken my truth authentically from my soul. I'd've spoken about good and bad, of pain and of love. The guests would've been furious at me. I'll visit your resting place in private one day.

So much of who I am, who I've become, who I continue to choose to be, is with deep thanks to you. You planted some of the most precious seeds in the garden of my child's soul. On good days, I love who I am. Many of the things I love about myself, and choose to pass onto my own children, are gifts I received from you, and have nurtured ever since.

I remember our long walks to Nana's. Long walks became a big habit in my life: meditative, calming and restorative — healing. And all those little blackbeetles we saved together, that taught me profound empathy for not just life itself, but especially for forms of life weaker than we are: the relatively powerless. Those little beings are insignificant to us, and yet we have the ability to completely change their

japgolly / stateful_spa.scala
Last active September 20, 2022 11:20
Stateful SPA
// Overview of how this works:
// 1. Initialisation data is used to create an instance of LoadedRoot.
// 2. LoadedRoot contains a component which is the virtual top-level component.
// It uses the initialisation data and can be sure that it won't change (a guarantee you don't have with component props).
// It's the only component to have state.
// The state can applies to the entire SPA, all routes.
// It gets told by the router which page to render.
// It can house logic that applies when certain pages change to certain other pages.
// 3. LoadedRoot is passed to Routes.routerConfig.
// Routes.routerConfig creates a config that sends all routes to the LoadedRoot component, using the Page & RouterCtl as props.
japgolly / DND.scala
Created August 11, 2014 07:56
Drag-and-Drop using scalajs-react
import org.scalajs.dom
import org.scalajs.dom.console
import scala.scalajs.js
import scalaz.{Equal, State, StateT}
import scalaz.std.option.optionEqual
import scalaz.std.tuple.tuple2Equal
import scalaz.syntax.bind._
import scalaz.effect.IO
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.ReactVDom._
japgolly /
Last active April 26, 2022 02:55
Scala 2.13 migration notes


addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.13")
import scalafix.sbt.ScalafixPlugin.autoImport.{scalafixDependencies, scalafixSemanticdb}

scalafixDependencies in ThisBuild += "org.scala-lang.modules" %% "scala-collection-migrations" % "2.1.4",
japgolly /
Created July 25, 2021 05:48 — forked from madkoding/
Pairing bluetooth devices (keyboard or mouse) in dual boot with Linux Ubuntu and Windows 10

1) Pair ALL bluetooth devices in linux (it is to have the files you will need to edit later)

2) Pair ALL bluetooth devices in Windows 10. If you know how, get the MAC address id from your bluethooth keyboard, we will need it later

3) Reboot and go back to Linux

4) Install chntpw package, this is needed to read the registry keys from Wintendo

sudo apt-get install chntpw
japgolly / gist:94242805800d8dc17c4eef55ec1550d6
Last active September 12, 2020 10:05
3x 21/8 + 18/8
|C c c c c c c |c c c c c c c |c c c c c c c |c c c c c cc c |
| s s| s s| s s| s |
|k k kk k k k kk k k |k k kk k k k kk k k |k k kk k k k kk k k |k k kk k k k kk k |
japgolly /
Created April 11, 2020 02:57
--- base-db/src/main/java/org/postgresql/jdbc/
+++ base-db/src/main/java/org/postgresql/jdbc/
@@ -88,11 +88,11 @@
{"bit", Oid.BIT, Types.BIT, "java.lang.Boolean", Oid.BIT_ARRAY},
{"date", Oid.DATE, Types.DATE, "java.sql.Date", Oid.DATE_ARRAY},
{"time", Oid.TIME, Types.TIME, "java.sql.Time", Oid.TIME_ARRAY},
{"timetz", Oid.TIMETZ, Types.TIME, "java.sql.Time", Oid.TIMETZ_ARRAY},
{"timestamp", Oid.TIMESTAMP, Types.TIMESTAMP, "java.sql.Timestamp", Oid.TIMESTAMP_ARRAY},
- {"timestamptz", Oid.TIMESTAMPTZ, Types.TIMESTAMP, "java.sql.Timestamp",
+ {"timestamptz", Oid.TIMESTAMPTZ, Types.TIMESTAMP_WITH_TIMEZONE, "java.sql.Timestamp",
japgolly / 0.deps.gv.svg
Last active April 2, 2020 23:40
My Scala libraries & the status of their upgrade to Scala 2.13
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
japgolly / aws-ecs-taskdef.json
Created November 11, 2019 05:23
node_exporter errors
"ipcMode": null,
"executionRoleArn": null,
"containerDefinitions": [
"dnsSearchDomains": null,
"logConfiguration": null,
"entryPoint": null,
"portMappings": [
japgolly / copy.sbt
Last active October 1, 2019 12:22
Scala.JS & SBT
// Assumptions:
// 1. You have one or more Scala.JS modules named jsModule1, jsModule2, ...
// 2. You have a web-serving (or otherwise JVM) module that will serve the JS assets
// The only "webby"/JS plugin I use apart from Scala.JS itself, is xsbt-web-plugin,
// and even that, only on my pre-http4s projects.
// xsbt-web-plugin allows me to quickly stop/start a servlet container from SBT.
// The snippet below is for "webappPostProcess" which is an xsbt-web-plugin task but
// if you aren't using it, you can just create a task with the same content and make
// "package" depend on it.