Skip to content

Instantly share code, notes, and snippets.


Tane Piper tanepiper

View GitHub Profile
View breadcrumb.integration.spec.ts
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { Component, Injectable, Input, OnDestroy } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { ActivatedRouteSnapshot, NavigationEnd, Route, Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { Subject } from 'rxjs';
import { filter, map, takeUntil, tap } from 'rxjs/operators';
interface Breadcrumb {
View router-test.ts
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { BreadcrumbComponent } from './breadcrumb.component';
import { RouterTestingModule } from '@angular/router/testing';
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { By } from '@angular/platform-browser';
import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('BreadcrumbComponent', () => {
View rxjs-web-serial.html
<!DOCTYPE html>
<button class="start">Start Serial Request</button>
<button class="send">Send Signal</button>
<script src=""></script>
#!/usr/bin/env python
Video Transcoder Daemon
@author Tane Piper
The Transcoder Daemon is an application that runs as a background process
on a unix server. Using, it acts as a web application listening on
a set port. It takes incoming /queue requests which contain POST information.
The simple queue, just takes in a filename for input and output and some
quality information.
View umd.html
<!DOCTYPE html>
<title>UMD RxJS Ninja</title>
<script src=""></script>
View replay-control-value-changes.ts
export class ReplayControlValueChanges<T> extends Observable<T> {
constructor(control: AbstractControl | AbstractControlDirective) {
super(subscriber => {
if (!control.valueChanges) {
throw new Error('Control does not have valueChanges');
tanepiper / validation.ts
Created Feb 10, 2020 — forked from busypeoples/validation.ts
Validation in TS (version 2)
View validation.ts
type ValidationResult<T, U> = Partial<{ [Key in keyof T]: U }>;
type Validation<T, U> = (fields: T) => ValidationResult<T, U>;
const validate = <T, U = boolean | string>(
validations: Validation<T, U>[],
fields: T
): ValidationResult<T, U> =>
.map(validation => validation(fields))
.reduce((acc, a) => Object.assign(acc, a), {});
tanepiper / tuples.ts
Created Sep 21, 2018 — forked from hmil/tuples.ts
Well-typed variable-length tuples in TypeScript
View tuples.ts
* Arbitrary-length tuples
* =======================
* Working with tuples of unknown length in TypeScript is a pain. Most library authors fall back on enumerating all possible
* tuple lengths up to a threshold (see an example here )
* In this gist, I'm attempting to leverage recursion to provide support for arbitrary length tuples. This has the potential
* to make some kinds of declarative APIs nicer and enhance type inference in some cases.
* This example shows how to take a variable-length tuple as an input, transform each of its types and use the resulting
View tuple-utils.ts
export namespace TupleUtils {
* Get type of first element
* @example `First<[0, 1, 2]>` → `0`
export type First<Tuple extends [any, ...any[]]> = Tuple[0]
* Get type of last element


Run task npm:install:app after this

cd env/api && npm install --silent