Skip to content

Instantly share code, notes, and snippets.

View medfreeman's full-sized avatar

Mehdi Lahlou medfreeman

  • Geneva, Switzerland
View GitHub Profile
@medfreeman
medfreeman / MacOS-Multi-Version-Go-With-Homebrew.md
Created May 10, 2024 14:45 — forked from BigOokie/MacOS-Multi-Version-Go-With-Homebrew.md
Manage multiple versins of Go on MacOS with Homebrew

This process would likely apply to other Homebrew formula also.

First search for your desired package:

brew search go

You should get a list of results that include the below. Not "go" is very unspecific so you may get a lot of results:

@medfreeman
medfreeman / package.json
Created August 19, 2022 00:49
Default base node.js package.json
{
"name": "$GITHUB_REPOSITORY_NAME",
"description": "$GITHUB_REPOSITORY_DESCRIPTION",
"keywords": [
"nodejs",
"esm"
],
"version": "1.0.0",
"license": "$GITHUB_REPOSITORY_LICENSE",
"author": "$AUTHOR",
@medfreeman
medfreeman / default.code-workspace
Created August 18, 2022 23:51
Default workspace file for VSCode in js/ts projects
{
"extensions": {
"recommendations": [
"bierner.github-markdown-preview",
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"mrmlnc.vscode-json5"
]
},
@medfreeman
medfreeman / README.md
Last active August 19, 2022 00:23
Default README (w/ replaceable placeholders)

$GITHUB_REPOSITORY_NAME

All Contributors License Last Commit Stars Forks

🎩 Features

# http://editorconfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_style = space
@medfreeman
medfreeman / sequence.ts
Created July 14, 2020 10:47
Generator sequence in typescript
export function* sequence<T extends readonly unknown[] = readonly unknown[]>(
sagas: readonly ((...args: T) => Generator<unknown, void>)[],
args: T
) {
for (const saga of sagas) {
yield* saga(...args);
}
}
@medfreeman
medfreeman / Dockerfile
Last active September 6, 2023 20:32
docker / mongo replicaSet
ARG MONGO_VERSION
FROM mongo:${MONGO_VERSION}
RUN mkdir -p /data/keyfile
RUN openssl rand -base64 741 > /data/keyfile/keyfile
RUN chown -R mongodb:mongodb /data/keyfile
RUN chmod 600 /data/keyfile/keyfile
diff --git a/node_modules/@types/koa-compose/index.d.ts b/node_modules/@types/koa-compose/index.d.ts
index 3658a8f..c216d3a 100644
--- a/node_modules/@types/koa-compose/index.d.ts
+++ b/node_modules/@types/koa-compose/index.d.ts
@@ -50,7 +50,7 @@ declare function compose<T1, U1, T2, U2, T3, U3, T4, U4, T5, U5, T6, U6, T7, U7,
declare function compose<T>(middleware: Array<compose.Middleware<T>>): compose.ComposedMiddleware<T>;
declare namespace compose {
- type Middleware<T> = (context: T, next: () => Promise<any>) => any;
+ type Middleware<T, U = any> = (this: U, context: T, next: () => Promise<any>) => any;
diff --git a/node_modules/@types/koa/index.d.ts b/node_modules/@types/koa/index.d.ts
index df6d5f8..64557e0 100644
--- a/node_modules/@types/koa/index.d.ts
+++ b/node_modules/@types/koa/index.d.ts
@@ -310,7 +310,7 @@ declare interface ContextDelegatedResponse {
/**
* Get/Set response body.
*/
- body: any;
+ body: unknown;
@medfreeman
medfreeman / 30-seconds-of-code.d.ts
Created September 4, 2019 16:06
30-seconds-of-code `isEmpty`function typescript definition
declare module '30-seconds-of-code' {
// tslint:disable-next-line: no-any
export function isEmpty<T extends any, P extends string>(
value: T
): T extends object ? (P extends keyof T ? false : true) : T extends string ? boolean : true;
}