Skip to content

Instantly share code, notes, and snippets.

@klaasnotfound
klaasnotfound / exp-backoff-throttler.guard.ts
Created November 26, 2025 08:27
Exponential Backoff Guard in NestJS
import { ExecutionContext, Injectable } from '@nestjs/common';
import { ThrottlerGuard, ThrottlerLimitDetail, ThrottlerRequest } from '@nestjs/throttler';
type BlockEntry = {
minDuration: number;
blockDuration: number;
totalHits: number;
blockedUntil: number;
};

Keybase proof

I hereby claim:

  • I am klaasnotfound on github.
  • I am klaasnotfound (https://keybase.io/klaasnotfound) on keybase.
  • I have a public key ASArOBBvNMWKUIozH0DQg1IpWTCiaXiOpLXk2hwHR8_pCgo

To claim this, I am signing this object:

@klaasnotfound
klaasnotfound / base.html
Last active April 7, 2019 17:50
A minimal example for a base.html file that can be used with the modified Jekyll i18n plugin and performs a browser language-based redirect.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Simple Redirect Page</title>
</head>
<body>
<script>
var lang = navigator.language || navigator.userLanguage;
if (lang.indexOf('de') == 0)
@klaasnotfound
klaasnotfound / jekyll-multiple-languages-plugin.rb
Last active May 27, 2019 09:40
This is a modified version of the most popular Jekyll i18n plugin. It puts the default language in its own subfolder (like the other languages), uses a base.html file as the central index.html (for language-based redirects) and properly translates custom collection documents and links.
=begin
Jekyll Multiple Languages is an internationalization plugin for Jekyll. It
compiles your Jekyll site for one or more languages with a similar approach as
Rails does. The different sites will be stored in sub folders with the same name
as the language it contains.
Please visit https://github.com/screeninteraction/jekyll-multiple-languages-plugin
for more details.
package com.klaasnotfound.application;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
/**
* A convenience lifecycle handler that tracks whether the overall application is
* started, in the foreground, in the background or stopped and ignores transitions
* between individual activities.
package com.loclet.android.views;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ImageButton;
/**
* A simple extension of Android's ImageButton that automatically provides
* a "reasonable" appearance of the button in a pressed and disabled state.