Skip to content

Instantly share code, notes, and snippets.

View Stwissel's full-sized avatar
💭
I may be slow to respond.

Stephan H. Wissel Stwissel

💭
I may be slow to respond.
View GitHub Profile
@Stwissel
Stwissel / index.html
Last active August 22, 2025 04:59
Mix of Grid and flexbox
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Grid + Flex Layout</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
display: grid;
grid-template-rows: auto 1fr auto;
@Stwissel
Stwissel / jwks2couch.mjs
Created July 30, 2025 10:37
Populate CouchDB's JWT keys from an IdP's JWKS URL
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
@Stwissel
Stwissel / Dockerfile
Last active May 4, 2024 18:22
Dev Container with docker-compose.yml
FROM mcr.microsoft.com/devcontainers/javascript-node:1-20-bullseye
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
@Stwissel
Stwissel / sinon.demo.spec.ts
Created July 31, 2023 19:46
SInon mocking NodeJS 18 fetch
import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import sinon from 'sinon';
import { afterEach } from 'mocha';
chai.use(chaiAsPromised);
const urlToResultMapping = new Map<string, any>();
@Stwissel
Stwissel / TestMain.java
Created July 10, 2023 17:10
Getting mvn and log4j2 to work nicely
package com.example.starter;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class TestMain {
@Stwissel
Stwissel / .mocharc.js
Last active June 4, 2023 09:38
TypeScript project setup
'use strict';
module.exports = {
spec: ['test/**/*.spec.ts'],
};
@Stwissel
Stwissel / index.css
Last active February 7, 2023 04:49
Simple CSS /JS for TOTP Demo site
html {
font-family: 'Futura', Roboto, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
margin: 0;
font-family: 'Futura', 'Jetbrains Mono', Roboto, 'Segoe UI', Tahoma, Geneva,
Verdana, sans-serif;
background: white;
}
@Stwissel
Stwissel / HttpServerTest.java
Created November 3, 2022 12:43
Sample JUnit5 test using the vert.x test extension to run asynchronous tests
package com.notessensei.demo;
import static org.junit.jupiter.api.Assertions.*;
import java.util.stream.Stream;
import com.hcl.tests.UnitTest;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
@Stwissel
Stwissel / Starter.java
Created August 3, 2022 04:06
Sidestart vert.x in its own thread and call an async operation in a sync block
package com.notessensei.legacy.sync_async;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicBoolean;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
import io.vertx.core.Promise;
import io.vertx.core.Vertx;
import io.vertx.core.eventbus.Message;
@Stwissel
Stwissel / couchDBStream.js
Created October 16, 2021 10:18
Streaming couchDB using NodeJS stream API and nano
const Nano = require("nano");
const { Writable, Transform } = require("stream");
const exportOneDb = (couchDBURL, resultCallback) => {
const nano = Nano(couchDBURL);
nano
.listAsStream({ include_docs: true })
.on("error", (e) => console.error("error", e))
.pipe(lineSplitter())
.pipe(jsonMaker())