Skip to content

Instantly share code, notes, and snippets.

View unicornware's full-sized avatar
🔥
getting busy with the keyboard

Lex unicornware

🔥
getting busy with the keyboard
View GitHub Profile
@unicornware
unicornware / each.matcher.ts
Last active January 15, 2022 06:02
Chai Custom Matchers (TypeScript)
/**
* @file Custom Matchers - each
* @module tests/config/matchers/each
*/
/**
* Wraps each item in an array in a {@link chai.Assertion}.
*
* [1]: https://www.chaijs.com/api
* [2]: https://www.chaijs.com/api/plugins
@unicornware
unicornware / csurf.middleware.ts
Created January 15, 2022 05:51
NestJS - CsurfMiddleware
import { OrUndefined } from '@flex-development/tutils'
import { Injectable, NestMiddleware } from '@nestjs/common'
import { ENV } from '@sneusers/config/configuration'
import csurf, { CookieOptions } from 'csurf'
import { NextFunction, Request, Response } from 'express'
/**
* @file Middleware - CsurfMiddleware
* @module middleware/CsurfMiddleware
* @see https://github.com/expressjs/csurf
@unicornware
unicornware / cookie-parser.middleware.ts
Last active January 15, 2022 05:31
NestJS - CookieParserMiddleware
@unicornware
unicornware / index.ts
Created January 3, 2022 07:40
usePixiTicker
/**
* @file Hook Entry Point - usePixiTicker
* @module ui/hooks/usePixiTicker
*/
export { default as usePixiTicker } from './use-pixi-ticker'
export * from './use-pixi-ticker.types'
@unicornware
unicornware / Brewfile
Last active May 5, 2022 04:18
Brewfile
# REFERENCES:
#
# - https://pumpingco.de/blog/brewfile
# - https://medium.com/@satorusasozaki/automate-mac-os-x-configuration-by-using-brewfile-58a78ce5cc53
# Specify --cask arguments
cask_args appdir: '/Applications' fontdir: '~/Library/Fonts'
# Add additional repositories not in the official homebrew formulae
tap 'dopplerhq/cli'
@unicornware
unicornware / value-object.model.ts
Created January 1, 2022 03:37
ValueObject model
import type { ObjectPlain } from '@flex-development/tutils'
import isNIL from '@flex-development/tutils/guards/is-nil.guard'
import { shallowEqual } from 'shallow-equal-object'
/**
* @file Models - ValueObject
* @module models/ValueObject
*/
/**
@unicornware
unicornware / .env.esm
Last active December 26, 2021 08:43
Custom ESM Configuration ([email protected])
# Environment Variables - NODE_OPTIONS - Use ESM syntax
if [ -f "$PWD/node_modules/ts-node/esm.mjs" ]; then
# Ignore warnings
NODE_NO_WARNINGS=1
# Import JSON modules
JSON_MODULES='--experimental-json-modules'
# Use custom ESM loader
LOADER="--loader $PWD/tools/loaders/esm.mjs"
import type { ValidationArguments } from 'class-validator'
import merge from 'lodash.merge'
import TestSubject from '../is-strong-password.constraint'
/**
* @file Unit Tests - IsStrongPasswordConstraint
* @module constraints/tests/IsStrongPasswordConstraint
*/
describe('unit:constraints/IsStrongPasswordConstraint', () => {
@unicornware
unicornware / app.module.ts
Last active May 13, 2021 14:35
NestJS - ParseQueryPipe
import { Module } from '@nestjs/common'
import type { ConfigModuleOptions } from '@nestjs/config'
import { ConfigModule } from '@nestjs/config'
import { APP_FILTER, APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core'
import configuration from './config/configuration'
import { AllExceptionsFilter } from './lib/filters'
import { PageviewInterceptor } from './lib/interceptors'
import { ParseQueryPipe } from './lib/pipes'
import { UsersModule } from './subdomains'
@unicornware
unicornware / .commitlintrc.ts
Last active October 11, 2021 05:40
Commitlint Configuration
import type { UserConfig } from '@commitlint/types'
import workspaces from './tools/helpers/workspaces'
/**
* @file Commitlint Configuration
* @see https://commitlint.js.org/#/guides-local-setup
* @see https://commitlint.js.org/#/reference-configuration
*/
const config: UserConfig = {