Skip to content

Instantly share code, notes, and snippets.

const myArray = Array.from({length: 10}, (e, i)=> i)
doWork(
doSomethingWith,
myArray,
logToConsole
)
//Die Funktion, die das Ganze abarbeitet
async function doWork(doSomething, anArray, aCallback) {
@SMoni
SMoni / Copy-Dependencies.ps1
Last active June 30, 2022 18:49
Copy all npm-packages for production into the dist-folder
Clear-Host
Set-Location $PSScriptRoot
$main = {
npm list --prod |
Select-Object -Skip 1 | # First line is the project itself
Get-Dependency |
Sort-Object |
Get-Unique |
@SMoni
SMoni / do_magic.py
Created December 26, 2022 13:49
What will this method do...
def do_magic(decimal_num:int):
if decimal_num < 2:
return decimal_num
result = 0
square_num = 2
while square_num < decimal_num:
square_num *= 2
@SMoni
SMoni / createEnumaration.js
Last active December 31, 2022 10:04
Simple function to create an enumeration (sort of), in which the key and the value match.
'use strict';
const createEnumeration = (...keys) =>
keys.reduce(
(result, key) => Object.assign(result, { [key]: key }),
{}
);
const myEnum = createEnumeration(
'first',
public Guid combineThose(Guid[] IDs_) {
const int length = 16;
return IDs_.Aggregate(Guid.Empty, (Accumulate, Current) => {
var result = new byte[length];
var asByteArrayAccumulate = Accumulate.ToByteArray();
var asByteArrayCurrent = Current.ToByteArray();