Skip to content

Instantly share code, notes, and snippets.

View bvandenbon's full-sized avatar

Bram Vandenbon bvandenbon

View GitHub Profile
@bvandenbon
bvandenbon / nest.microservice.tcpclient.ts
Last active January 30, 2021 15:03
A Client to connect from a legacy NodeJS application (in typescript) to a NestJS Microserviceof type Transport.TCP.
import { Socket, SocketConnectOpts } from "net";
import { PromiseSocket } from "promise-socket"
export class NestTCPMicroserviceClient {
private options: SocketConnectOpts;
private socket$: PromiseSocket<Socket>;
constructor(private host: string, private port: number) {
this.options = { host: this.host, port: this.port };
}

To install dependencies of the above script:

npm install yaml

Usage:

parameters:   <inputdir> <outputfile> [--help]
  --help         generates this message.
  <inputdir>     a directory containing individual yml files in a swagger structure.

a directory containing the merged swagger yml files.

@bvandenbon
bvandenbon / redirect-locale.html
Last active November 16, 2022 23:26
a landing page in html+js, which detects language (possibly cached) and redirects.
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
//////////////
/// CONFIG ///
//////////////
var defaultLocale = 'en';
@bvandenbon
bvandenbon / secondstotime.pipe.ts
Last active July 15, 2019 15:17
SecondsToTimePipe
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'secondsToTime'
})
export class SecondsToTimePipe implements PipeTransform {
static factors = {
year: 31557600,
month: 2629746,
day: 86400,
@bvandenbon
bvandenbon / zbaduk.json
Created May 17, 2019 12:13
An example file for a JSON based file format for SGF.
{
"rootProperties": {
"st": 4,
"gm": 1,
"sz": 19
},
"next": [{
"moveProperties": {
"b": { "c": "pp"
}
@bvandenbon
bvandenbon / cookieservice.service.ts
Last active December 4, 2020 10:29
CookieService
import { Injectable } from '@angular/core';
@Injectable()
export class CookieService {
constructor() {
}
set(key: string, value: string): void;
set(key: string, value: string, expires: Date): void;