Skip to content

Instantly share code, notes, and snippets.

@tg44
tg44 / AdaptiveQueueSource.scala
Created April 29, 2021 10:17
AdaptiveQueueSource akka streams extension
package akka.streams
import akka.Done
import akka.stream.OverflowStrategies.{Backpressure, DropBuffer, DropHead, DropNew, DropTail, Fail}
import akka.stream.{
Attributes,
BufferOverflowException,
Outlet,
OverflowStrategy,
QueueOfferResult,
@tg44
tg44 / Bootstrap.scala
Last active May 11, 2021 14:45
Crowdin CDN from Play framework
import play.api.inject.Module
import helpers.{MessagesApiWithCrowdin, MessagesApiWithCrowdinProvider}
import play.api.i18n.{DefaultLangsProvider, Langs, MessagesApi}
import play.api.inject.Binding
import play.api._
//possibly some imports are missing
class AppStartModule extends Module {
override def bindings(environment: Environment, configuration: Configuration): Seq[Binding[_]] = {
Seq(
@tg44
tg44 / linkchecker.js
Created June 5, 2021 07:25
Vuepress broken link checker
const path = require( 'path' );
const express = require( 'express' );
const app = express();
const blc = () => {
let err = 0
const blc = require('broken-link-checker')
const siteChecker = new blc.SiteChecker({}, {
robots: function(robots, customData){},
@tg44
tg44 / mustacheSchema.test.ts
Last active February 23, 2023 15:07
JsonSchema generation from {{ mustache }} templates
import Ajv from "ajv";
import { describe, expect, test } from "@jest/globals";
import { schemaGenFromMustacheTemplate } from "./mustacheSchema";
interface TestGen {
name: string;
template: string;
schema: Record<string, any>;
expectedError: string | null;
}
@tg44
tg44 / code.gs
Last active January 3, 2026 12:12
Health -> GDocs apps script
// example sheet: https://docs.google.com/spreadsheets/d/18t70uIadx4muvnrMEzXDi2SeTwJsRs7QvdNq4k0v6mE/edit?usp=sharing
// shortcut: https://www.icloud.com/shortcuts/a0b98e0402bd44448ae2e4d8f69bc09d
// generate a random string here just in case
const API_KEY = "";
/**
* Entry point for POST requests
*/
function doPost(e) {