This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { z } from 'zod' | |
const emptyStringToUndefined = z.literal('').transform(() => undefined) | |
/** | |
* Provide a schema and get a schema that is optional and empty strings are transformed to `undefined`. | |
* When someone removes his input of this field, the then empty string is transformed to `undefined`. | |
* | |
* Example: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"https://www.typescriptlang.org/play?target=7#code/JYOwLgpgTgZghgYwgAgMJysg3gWAFDLLAAmAXMiAK4C2ARtANz6HUD2xEANuQM5hSgA5sgA+FSp074AvvnwJWIPsgQYAjOXSYxVScgC82ImWRqANMjYduyAEQBBW8ll4FSsCowAmTRlHi9Q10pV0VlVSgAZl9tAM4DIxJySIsrLnJbVCcXeTCPCJ5yAAotf2CASgBtAF0EyojzTygvCwjI6rk8Tgh8jB4AdWAwAAtWSjAAOQkbLRq6jrx8AHol5AB3IeHkADoYYE5ITCLoKFYoDIAVAE8ABxQAcmD7oh4KVg84Hh5gQRA4Wm6yDArCBtweWnu21s5XkfUGIzGk2mCQKu32hyKEQMAD4msgAIT6ILTGGLPArdabHZ7A7QZAAamQHD2ICEoLuyCKw0QAGsrhYeHBqCgbqcARBqMhOMAeShKN8QMJbJ9obCoANNoipoEmjw0bSoEVMRhyuQscBXqV9LisYTiZJykwyRSNiMdlAIMRKEg1RqEeNtfFDKiPV6kAAeWbVbFGxAIVomnGc5gErEAfmQceQ5Eq2zzcYTUAW5QsNVJy1Wrq2u04cDAAFk4DdffDRgHkcG+jW642bsbMNbU34M3McxFqo78EA" | |
interface Car { | |
id: number; | |
model: string | null | |
} | |
const car1: Car | null = { id: 1, model: "A" } | |
const car2: Car | null = null | |
const car3: Car | null = { id: 3, model: "C" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div className="flex w-1/6> | |
<p className="transform rotate-180 text-center" style={{ writingMode: 'vertical-rl' }}> | |
Text | |
</p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper method to create an OAuth2 access token via MockMvc. | |
* Result is a string that can be used in another mvc request. | |
* Example: | |
* <p> | |
* MvcResult result = mvc.perform(get("/user/" + userToSearch.getUsername() + "/role") | |
* .header("Authorization", "Bearer " + accessToken)) | |
* .andExpect(status().isOk()) | |
* .andReturn(); | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class Permutations { | |
public static void main(final String[] args) { | |
// Permutations of the numbers 0 to 3 to get all possible combinations. | |
// For 4 numbers the result should be 4! = 24 different combinations | |
// like 1-2-3-4, 1-2-4-3, 1-3-2-4, 1-3-4-2, etc. | |
Collection<List<Integer>> permutations = new Permutations() | |
.generatePermutationsWithoutRepetition(new HashSet<>(Arrays.asList(0, 1, 2, 3))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Use IntelliSense to learn about possible attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Launch Program", | |
"program": "${file}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ | |
"key": "ctrl+shift+f", | |
"command": "editor.action.formatDocument", | |
"when": "editorTextFocus && !editorReadonly" | |
}, | |
{ | |
"key": "shift+alt+f", | |
"command": "-editor.action.formatDocument", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// general | |
"telemetry.enableTelemetry": false, | |
"workbench.settings.editor": "json", | |
"workbench.startupEditor": "newUntitledFile", | |
"workbench.editor.restoreViewState": false, | |
"workbench.colorTheme": "One Dark Theme", | |
"workbench.iconTheme": "vscode-icons", | |
"workbench.settings.useSplitJSON": true, | |
"window.zoomLevel": 0, |