Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Enable css dark-mode in firefox on Linux

Go to about:config and add the property: ui.systemUsesDarkTheme=1

@nemoinho
nemoinho / dummy.ts
Created June 18, 2021 09:06
Branding and DTOs in typescript
declare const ___brand: unique symbol;
type Branded<A, B> = A & { readonly [___brand]: B };
type UID = Branded<number, User>;
interface User {
id: UID;
name: string;
lastLogin: Date;

Error in Spring Cloud + Logback

Spring Cloud program uses logback error

Let me start with the conclusion

For Spring Cloud programs that do not use Spring Cloud Context, it is best to disable Spring Cloud Context, because if it is not disabled, it will cause some configuration loading errors. Disable method: add in the main SpringBoot function System.setProperty("spring.cloud.bootstrap.enabled", "false");

@nemoinho
nemoinho / Struktur.md
Last active August 3, 2020 22:55
Orderstruktur-Beispiel einer React-Anwendung
root/
├─ assets/
│  └─ favicon.ico
└─ src/
   ├─ App.js
   ├─ services/
   │  └─ play─client/
   │     ├─ PlayClient.js
 │ ├─ PlayLocalStorageClient.js
@nemoinho
nemoinho / EqualsAndHashCodeDemo.java
Last active February 25, 2021 23:21
`equals()` and `hasCode()` are special in functions and their contract is easy to violate as this example shows.
import java.util.HashSet;
import java.util.Set;
import lombok.Data;
/**
* This is a simple demo how to implement equals and hashcode wrong, just because we don't understand it good enough
* It's is a very common mistake and easy to make wrong when you use lombok.
*/
@Data
@nemoinho
nemoinho / example.js
Created June 7, 2020 14:52
Wie funktioniert ein Datum in JSON
/**
* Wir haben ein Datum, welches wir z.B. im localStorage speichern wollen und später wieder brauchen.
* Damit wir sehen was jeweils ausgegeben wird logge ich die Resultate via console.log und schreibe
* als Kommentar dazu, welche Ausgabe ich etwa erwarte
*/
const someDate = new Date();
console.log(someDate); // Ausgabe: Ein Datumsobjekt, zu sehen ist dessen String-Representation
const dateString = someDate.toString();
@nemoinho
nemoinho / naiveDiff.js
Created May 16, 2020 02:33
A simple and naive implementation of diff
function naiveDiff(aIn, bIn, options) {
const rawA = aIn + '' === aIn ? aIn.split('') : aIn;
const rawB = bIn + '' === bIn ? bIn.split('') : bIn;
let a = rawA;
let b = rawB;
if (options.trim) {
a = a.map(s => s.trim());
b = b.map(s => s.trim());
}
if (options.skipEmpty) {

Hello, AsciiDoc!

An introduction to AsciiDoc.

First Section

  • item 1

  • item 2

@nemoinho
nemoinho / Software-Quotes.adoc
Last active December 8, 2023 10:17
Qutes regarding software-development

I have yet to see any problem, however complicated, which, when you looked at it in the right way, did not become still more complicated

— Poul Anderson
Anderson's Law

Over the last several decades we’ve seen a whole range of ideas regarding the architecture of systems. These include:

— Uncle Bob
Clean Architecture