Skip to content

Instantly share code, notes, and snippets.

Error24: not enough hours in the day

Peter Banjo iampeterbanjo

Error24: not enough hours in the day
Block or report user

Report or block iampeterbanjo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
iampeterbanjo / tsconfig.json
Created Oct 21, 2019
tsconfig that supports src/@types folder
View tsconfig.json
"compilerOptions": {
"outDir": "build",
"rootDir": "src",
/* Basic Options */
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"lib": ["es2015"] /* Specify library files to be included in the compilation. */,
"allowJs": false /* Allow javascript files to be compiled. */,
// "checkJs": true, /* Report errors in .js files. */
View vscode-settings-font.json
"editor.fontFamily": "Cascadia Code, Droid Sans Mono Dotted for Powerline"
View hapi-doorkeeper-issue.ts
// plugin.ts
import bell from '@hapi/bell';
import cookie from '@hapi/cookie';
import doorkeeper from 'hapi-doorkeeper';
import utils from '../utils';
const {
vars: {
iampeterbanjo / ts-models.ts
Last active Sep 12, 2019
How to model types in Typescript and Mongoose
View ts-models.ts
Lets have type models in Typescript and keep it simple
- borrows from
- validation is useful when parsing data from external APIs
- avoids typegoose, class-validator, class-transform in favour of stable features
import * as mongoose from 'mongoose';
import { Document, Model, Schema, model } from "mongoose";
import jointz, { ExtractResultType } from "jointz";

NestJS notes

In a larger application, it makes sense to organize your application into multiple modules that split up your code into features and related capabilities.

To define a module, you have to register all of the

  • Services that will be instantiated by the Nest.js injector as Providers
  • Controllers that will require the Providers as Controllers
  • Controllers exported by another module as imports

Providers can be injected into:


Note: for Jest to detect a memory leak and throw an error both arguments are required i.e. detectLeaks and logHeapUsage.

10:45 nestjs-cats (master) ✗ yarn test --detectLeaks --logHeapUsage
yarn run v1.17.3
$ jest --detectLeaks --logHeapUsage
 PASS  src/auth/auth.controller.spec.ts (61 MB heap size)
 PASS  src/cats/cats.service.spec.ts (61 MB heap size)
 PASS  src/app.controller.spec.ts (61 MB heap size)
 FAIL  src/cats/cats.controller.spec.ts
View new-character.js
let character = {};
updateCharacter = (path, value) => {
character[path] = value;
const Character = function() {
this.moves = [];
this.firstName = ''
this.lastName = ''
View transducer-data-processing.js
(function() {
console.log('Hello from the snippet');
const user = {
name: 'Cassie Cage'
const exampleTarget = {
firstname: 'Cassie',
surname: 'Cage',
iampeterbanjo / pull-data-processing.js
Created May 31, 2019
Pull data processing pipeline
View pull-data-processing.js
* Prototype of a data processing pipeline
* that uses strings as an example.
* the idea is to be fault tolerant by processing
* each word and so allow filtering of bad data
* instead of a batch processing approach
* which can cause the pipeline to halt on errors
* without any good data make it through to
* completion.
iampeterbanjo /
Created May 30, 2018
AWS change user password using CLI
# Step 1: Get a session token for the desired user:
aws cognito-idp admin-initiate-auth --user-pool-id %USER POOL ID% --client-id %APP CLIENT ID% --auth-flow ADMIN_NO_SRP_AUTH --auth-parameters USERNAME=%USERS USERNAME%,PASSWORD=%USERS CURRENT PASSWORD%
# Step 2: Issue the challenge response:
aws cognito-idp admin-respond-to-auth-challenge --user-pool-id %USER POOL ID% --client-id %CLIENT ID% --challenge-name NEW_PASSWORD_REQUIRED --challenge-responses NEW_PASSWORD=%DESIRED PASSWORD%,USERNAME=%USERS USERNAME% --session %SESSION KEY FROM PREVIOUS COMMAND with ""%
You can’t perform that action at this time.