Skip to content

Instantly share code, notes, and snippets.

@nemoinho
nemoinho / nemoinho.setxkbmap
Last active August 27, 2024 00:17
My fixes for the german keyboard layout on Comexr-Laptops
// My fixes for the german keyboard layout
// Put this at: /usr/share/X11/xkb/symbols/nemoinho
// And apply via: setxkbmap nemoinho
// Thanks to: https://niklasfasching.de/posts/custom-keyboard-layou
default
xkb_symbols "nemoinho" {
include "de(basic)"
key <AE12> {[ dead_acute, dead_grave, apostrophe ]};
@nemoinho
nemoinho / .inputrc
Created May 27, 2024 20:50
My inputrc for macos
# HOME (fn+left)
"\e[H": beginning-of-line
"\e[1~": beginning-of-line
# END (fn+right)
"\e[F": end-of-line
"\e[4~": end-of-line
# Alt+right
"\e\e[C": forward-word
# Alt+left
"\e\e[D": backward-word

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) {