Skip to content

Instantly share code, notes, and snippets.

View tjarvstrand's full-sized avatar

Thomas Järvstrand tjarvstrand

  • Järvstrand Konsult AB
  • Stockholm, Sweden
View GitHub Profile
@tjarvstrand
tjarvstrand / Middleware.scala
Created July 25, 2023 12:39
zio-telemetry middleware
import io.opentelemetry.api.baggage.Baggage
import io.opentelemetry.api.baggage.propagation.W3CBaggagePropagator
import io.opentelemetry.context.propagation.TextMapGetter
import io.wolverinebeach.zio.telemetry.Tracing
import zio.Trace
import zio.ZIO
import zio.ZIOAspect
import zio.http.*
import java.lang
CREATE TABLE IF NOT EXISTS event_user_invitation (
event_id TEXT NOT NULL REFERENCES event(id) ON DELETE CASCADE,
invited_user_id TEXT NOT NULL REFERENCES user$(id) ON DELETE CASCADE,
invited_group_id TEXT REFERENCES friend_group(id) ON DELETE CASCADE,
inviting_user_id TEXT NOT NULL REFERENCES user$(id) ON DELETE CASCADE,
created_at TIMESTAMP NOT NULL,
PRIMARY KEY (event_id, invited_user_id, inviting_user_id)
);
CREATE TABLE IF NOT EXISTS event_group_invitation (
package com.example
import akka.http.scaladsl.model.Uri
import enumeratum.{Circe => Enumeratum}
import enumeratum.Enum
import enumeratum.EnumEntry
import io.circe._
import io.circe.generic.extras.auto._
import io.circe.generic.extras.Configuration
import io.circe.generic.extras.semiauto.deriveConfiguredCodec
import akka.http.scaladsl.model.Uri
import enumeratum.Enum
import enumeratum.EnumEntry
import java.time.ZonedDateTime
object Activity {
sealed abstract class Type extends EnumEntry.Lowercase
object Type extends Enum[Type] {
case object Post extends Type
@tjarvstrand
tjarvstrand / waitForKeyElements.js
Created December 14, 2020 10:37
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
{
"locale": "en_US",
"host": "scrive.com",
"oauth": {
"path": "/oauth",
"consumerKey": "a161ca06b725b647_7930",
"consumerSecret": "b5c4ea2323f00772",
"privileges": [
"DOC_CREATE",