Skip to content

Instantly share code, notes, and snippets.

View frank-dspeed's full-sized avatar
🇩🇪
I Engineer

Frank Lemanschik frank-dspeed

🇩🇪
I Engineer
View GitHub Profile
## Not Created issues
```js
const supportedPlatforms = /** @type {const} */ ({
"win32": "Windows",
"darwin": "Darwin",
"default": "Linux"
});
const me = supportPlatforms.default
@frank-dspeed
frank-dspeed / CONVERT_PDF_.md
Created April 11, 2022 06:22
Convert Unuseable PDF to usable

Creates a unprotected version of any PDF

ocrmypdf Kontoauszug_470898081500EUR_2020-01-31_KK_yyyyy.pdf out.pdf --force-ocr
@frank-dspeed
frank-dspeed / Stealify Lang ECMAScript Package Consumption via Wrapper Packages Pattern.md
Last active March 30, 2022 09:24
Stealify Lang ECMAScript Package Consumption via Wrapper Packages Pattern:

no matter what package and package manager for the code no matter if you consume the git source or the packaged version that gets distributed via other channels

./wrapper_module_name/<git_repo or node_modules/dependencie_name>
./wrapper_module_name/<optional other wrappers like eslint if needed>
./wrapper_module_name/main_or_module_name.js // Source of your wrapper maybe the only file with package.json if all goes well
./wrapper_module_name/main_or_module_name.d.ts // gets generated from the main of the wrapper that is defined in the package.json generated via tsconfig.json settings
./wrapper_module_name/tsconfig.json // contains fixes for the typescript consumption if needed
./wrapper_module_name/package.json // contains fixes for the consumption
./node_modules // contains the workspaces so the wrapper_module_name
@frank-dspeed
frank-dspeed / TypeScript_Blog_29.03.2022.md
Created March 29, 2022 04:49
Microsoft Typescript Blog.

29.03.2022 Typescript

I found out that Microsofts Typescript team is not able to implement a array for a function that implemented the same logic via a single string already this is something that takes a good dev less then a day to implement and then the testing and polishing starts.

That is a good indicator that the Dev Process of Typescript it self is Broken.

They got iteration planing evaluation loops that are longer then the code producing sprint loops.

while a good plan is great every plan fails partial and that is what we see here. It is missing the Build to Change Movement!

@frank-dspeed
frank-dspeed / Workspace_Package_Injection_Pattern.md
Last active March 25, 2022 06:08
Workspace Package Injection Pattern

Workspace Package Injection Pattern

This is a Pattern that Got discovered by Frank Lemanschik in 2021 It Defines a workflow where you clone a existing project into a pnpm workspace then you configure pnpm to overwrite packages you can create nested pnpm workspaces. This way you can use nativ import in your tests.

simply link the right collection of dependencies into the dependencie folder.

@frank-dspeed
frank-dspeed / Typescript 4.6 clearing the dust of the new resolve modes.md
Last active March 20, 2022 11:49
Typescript 4.6 clearing the dust of the new resolve modes

Final Gold Standard for typescript support

First rule is that you need to explicit create .d.ts .d.mts .d.cts alongside your .js files you should try to default to module esnext and you should set the package.json to contain only a main fild that points to a single entrypoint that exports everything from all other entrypoints. and then only the "type": fild to module the name fild should as convention have the same name as the main entrypoint file.

This way all resolve modes should work as long as you import the package by name and place it in node_modules or import it from any location via its relativ path

as rule of thumb i would always take the direct file import that keeps resolve problems to the bare minimum and is easy to archive

create wrapper packages to consume libs with the help of JSDOC Annotations. and try to move away from .ts mts and .cts extensions in your source

@frank-dspeed
frank-dspeed / rollup.build.js
Last active March 11, 2022 09:06
I got the case that i needed to run something after rollup -c without package.json see: https://github.com/rollup/rollup/issues/4441
import { rollup } from 'rollup';
/** @typedef {rollup.RollupOptions} RollupOptions */
const parseOptions = async (/** @type {RollupOptions[]} */ rollupOptions, commandOptions = { external: [], globals: {} }) => {
const loadConfigFile_js = await import('rollup/dist/shared/loadConfigFile.js');
const mergeOptions = await import('rollup/dist/shared/mergeOptions.js');
const warnings = loadConfigFile_js.batchWarnings();
try {
/** @type {RollupOptions[]} */
@frank-dspeed
frank-dspeed / gist:626a8653970b91f4c88f805869c6897f
Created March 7, 2022 10:54
Understand OS Level Virtualisation (Moby, Docker, chroot, jails, freebsd jails, libcontainer, container, docker, runc, podman)
## History 1991-2022
There where Computers that got more power then needed by a single Application(User) we tended to call them Servers.
1. We coded Scripts to setup user environments
- 1991 Microsoft(IBM) OS/2 with Multiuser Support.
2. We created tools with kernel support and extended the kernel to support User Space OS Level Isolation
3. We created OS and KERNEL as also CPU Support for Virtual Machines
4. We created a portable standard for it on linux (libcontainer) aka Docker now moby 2008 => 2013 first release
5. WASM 2015 got created by combining 2 browser interfaces for nativ bindings and will at the end replace containers thats 100% Garanteed! even the docker founder twittered about it
- https://twitter.com/solomonstre/status/1111004913222324225
@frank-dspeed
frank-dspeed / typescript-4.5-update-guide.md
Created February 22, 2022 07:19
Typescript 4.5+ Update Guide

New module resolution strategies

nodenext node12 do introduce some importent changes

exports: {
    ".": { 
 "types": ""
@frank-dspeed
frank-dspeed / Security-in-ECMAScript.md
Created February 13, 2022 14:56
How Javascript EcmaScript Security Audits Work.

How Javascript EcmaScript Security Audits Work.

the secret ingridients are

!global
!window
!globalThis
![NameOftheRealGlobal]
!this // outside class