Skip to content

Instantly share code, notes, and snippets.

View bbangert's full-sized avatar
🦊
Numb Numb

Ben Bangert bbangert

🦊
Numb Numb
View GitHub Profile
import { OnApplicationBootstrap, UseGuards } from '@nestjs/common';
import {
SubscribeMessage,
WebSocketGateway,
WebSocketServer,
} from '@nestjs/websockets';
import { Server } from 'ws';
import { JwtWsAuthGuard } from '../auth/jwt-auth-ws.guard';
@bbangert
bbangert / customer.adapter.ts
Created September 3, 2020 19:00
Customized message dispatch/handler for NestJS WS
import { WsAdapter } from '@nestjs/platform-ws';
import { MessageMappingProperties } from '@nestjs/websockets';
import { EMPTY as empty, Observable } from 'rxjs';
export class CustomWsAdapter extends WsAdapter {
public bindMessageHandler(
buffer: any,
handlers: MessageMappingProperties[],
transform: (data: any) => Observable<any>,
): Observable<any> {
# Current test
assert.isTrue(
stripeHelper.customer.calledOnceWith({
uid: reqOpts.query.uid,
email: reqOpts.query.email,
}),
'customer not called as expected'
);
# Better test because we see the difference in calls, vs "Expected 'true' got 'false'" above
create
definer = root@`%` procedure emailRecord_5_explain(IN inEmail varchar(255) CHARACTER SET utf8 COLLATE utf8_bin)
BEGIN
SELECT
a.uid,
a.email,
a.normalizedEmail,
a.emailVerified,
a.emailCode,
a.kA,
import { AuthBaseModel } from './auth-base';
import { Emails } from './emails';
export class Account extends AuthBaseModel {
public static tableName = 'accounts';
public static idColumn = 'uid';
protected uuidFields = ['uid'];
@bbangert
bbangert / launch.json
Created September 29, 2019 21:31
auth-server launch
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Local Tests",
@bbangert
bbangert / tasks.json
Created September 29, 2019 21:30
auth-server tasks
{
"version": "2.0.0",
"tasks": [
{
"label": "Current AuthServer Local Test",
"type": "shell",
"command": "./scripts/mocha-coverage.js",
"args": [
"-R",
"dot",
@bbangert
bbangert / tasks.json
Created September 29, 2019 21:29
event broker tasks
{
"version": "2.0.0",
"tasks": [
{
"label": "tsc-watch",
"command": "npm",
"args": ["run", "watch"],
"type": "shell",
"isBackground": true,
"group": "build",
apiVersion: apps/v1
kind: Deployment
metadata:
name: unifi-video-deployment
spec:
replicas: 1
selector:
matchLabels:
app: unifi-video
template:
apiVersion: apps/v1
kind: Deployment
metadata:
name: unifi-controller-deployment
spec:
replicas: 1
selector:
matchLabels:
app: unifi-controller
template: