Skip to content

Instantly share code, notes, and snippets.

View bjesuiter's full-sized avatar

Benjamin Jesuiter bjesuiter

View GitHub Profile
@bjesuiter
bjesuiter / publish.yaml
Last active October 21, 2024 19:13
Deno Snippets
# .github/workflows/publish.yaml
name: Publish
on:
push:
# Pattern matched against refs/tags
tags:
- '*'
jobs:
@bjesuiter
bjesuiter / docker-cheatsheet.sh
Created October 6, 2024 17:31
Docker Cheatsheet
#!/bin/bash
# Run an image one-off
@bjesuiter
bjesuiter / precise-float-math.ts
Last active September 9, 2024 12:37
JS/TS Tricks
/**
* Basic Problem: JS Floating Point Math is highly inaccurate.
* Found this thread: https://stackoverflow.com/questions/11832914/how-to-round-to-at-most-2-decimal-places-if-necessary
*
* Best solution: Use a library with correct implementation of floating point math.
*
* - mathjs (CAUTION: not math.js!): https://www.npmjs.com/package/mathjs
* - is basically complete, but is FAT: 732 kB, 188 kB minified
* - see https://bundlephobia.com/package/[email protected]
*
@bjesuiter
bjesuiter / extract-files.sh
Last active October 6, 2024 17:40
Docker Tipps
#!/usr/bin/env bash
# docker run \
# --name ${container_name} \
# ${image} \
# ${cmd}
# docker cp ${container_name}:${path_to_copy} ${output_dir}
@bjesuiter
bjesuiter / mit.md
Created March 29, 2024 11:19
my-license.md

MIT License

Copyright (c) 2023 Benjamin Jesuiter (CodeMonument)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@bjesuiter
bjesuiter / convert-doc-to-pdf.applescript
Last active March 26, 2024 22:56
AppleScript Snippets
# Credits for this script to ALYB at https://forum.keyboardmaestro.com/t/applescript-save-microsoft-word-doc-x-document-to-pdf/20614
tell application "Finder"
set input to selection
end tell
tell application id "com.microsoft.Word"
activate
set view type of view of active window to draft view
@bjesuiter
bjesuiter / gist:015782a048ce674e509e82c23bbd2294
Last active November 20, 2023 16:20
Meine Lieblings-Softwareentwicklungs-Kurse / My favorite software development courses
Angular (Maximilian Schwarzmüller ): https://www.udemy.com/course/the-complete-guide-to-angular-2/
CSS (Josh W. Comeau): https://css-for-js.dev/
React (Josh W. Comeau): https://www.joyofreact.com/
Algortihms (ThePrimeagen): https://frontendmasters.com/courses/algorithms/
HTML (SelfHTML): https://wiki.selfhtml.org/wiki/Wie_fange_ich_an%3F
Go Basics (GoByExample): https://gobyexample.com/
[credential "helperselector"]
selected = wincred
[credential]
helper = wincred
autoDetectTimeout = -1
[user]
email = [email protected]
name = My Name
[pull]
ff = only
// Use this official regex: ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
// See here: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
const regex =
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
const SemVer = z.string().regex(regex);