Skip to content

Instantly share code, notes, and snippets.

Avatar

Renoir Boulanger renoirb

View GitHub Profile
@renoirb
renoirb / .editorconfig
Last active Apr 15, 2021
Type Guarded limited Map of named Data Transfer Object
View .editorconfig
# http://editorconfig.org
# Match with prettier.config.js AND .gitattributes
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
@renoirb
renoirb / README.md
Last active Feb 11, 2021
Chained Keyboard Key combination Event handler
View README.md
@renoirb
renoirb / config.ts
Created Jan 27, 2021
Convict example setup
View config.ts
// config.ts
import { join, resolve } from 'path'
import { default as convictFactory, Schema } from 'convict'
import dotenv from 'dotenv'
import { AppConfigSchema } from './types'
import { convict, maybeFilePath } from './utils'
@renoirb
renoirb / README.md
Last active Apr 21, 2021
Renoir's references to books and chapters
View README.md

ECMAScript

Async/Await

We should not forget await

Quoting [We should not forget the await (Exploring ECMASCript 2016-2017; 5.3.1 Don’t forget await][public-book-exploring2016-17-async-do-not-forget-await])

[out value] is set to a Promise, which is usually not what you want in async functions. await can even make sense if an async function doesn’t return anything.

@renoirb
renoirb / index.ts
Created Dec 3, 2020
TypeORM Only MySQL database handler
View index.ts
/**
* EXTRA:
* Étant donné que et que la question demande une "solution idiomatique" et
* que je crains que je n'ai aucune expérience avec les langages donnés et
* que je me sens limité à exprimer avec la bonne syntaxe ma réponse,
* j'ai décidé d'ajouter cet extra.
*
* Je me permet donc ici de fournir une version sommaire d'un gestionnaire de
* connection qui permet de supporter plus d'un vendeur.
*
@renoirb
renoirb / playing-with-mjs.patch
Last active Jun 5, 2020
Attempt at using an ESM/MJS in TypeScript
View playing-with-mjs.patch
From dd22508d45c9a839d26a090bba05e62abe41e492 Mon Sep 17 00:00:00 2001
From: Renoir Boulanger <contribs@renoirboulanger.com>
Date: Thu, 4 Jun 2020 10:25:15 -0400
Subject: [PATCH] Just-a-Demo
---
.gitignore | 2 ++
package.json | 39 +++++++++++++++++++++++++++++++++++++++
src/index.ts | 25 +++++++++++++++++++++++++
tsconfig.json | 14 ++++++++++++++
View tokenizer.ts
/* eslint-disable @typescript-eslint/ban-ts-ignore */
/**
* File: src/tokenizer.ts
*/
import co from 'co'
const TOKENIZER_END = Symbol('TOKENIZER_END')
@renoirb
renoirb / example.patch
Created Feb 28, 2020
Example using self-contained published package
View example.patch
From 4a22bd3338241b30edddb0bffab035b0b1ba3a99 Mon Sep 17 00:00:00 2001
From: Renoir Boulanger <hello@renoirboulanger.com>
Date: Fri, 28 Feb 2020 16:37:39 -0500
Subject: [PATCH] Example
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..239ecff
--- /dev/null
@renoirb
renoirb / post-rush-install.js
Last active Aug 29, 2019
rush post-rush-install script example
View post-rush-install.js
"use strict";
/**
* In order to run on Linux/Unix and Windows, we can't use `#!/usr/bin/env node` at the top.
*
* After `rush update`, copy files to the monorepo root.
* https://gist.github.com/renoirb/b23b2d60fbe1ca25950005bb4056458d#gistcomment-3012183
*/
const path = require("path");