Skip to content

Instantly share code, notes, and snippets.

View armueller's full-sized avatar

Austin Mueller armueller

View GitHub Profile
@armueller
armueller / Car.spec.ts
Last active March 10, 2021 16:30
Typeguard Transparency Helper Example
import { isType } from './typeguardHelper';
import { Car, carRuleSet, Engine, engineRuleSet, Wheel, wheelRuleSet } from './Car';
const mockEngine: Engine = {
cylinders: 8,
maxSpeed: 7400,
fuelType: 'diesel'
};
const mockWheel: Wheel = {
@armueller
armueller / important-bits.html
Created May 23, 2018 23:34
Dynamic table with sorting with Angular 5 Material (the important bits)
<mat-table #table [dataSource]="dataSource" matSort (matSortChange)="onSortData($event)">
<!-- Address Column -->
<ng-container matColumnDef="address">
<mat-header-cell class="table-address-column" *matHeaderCellDef mat-sort-header> Address </mat-header-cell>
<mat-cell class="table-address-column" *matCellDef="let element"> {{element.address}} </mat-cell>
</ng-container>
<!-- Beds Column -->
<ng-container matColumnDef="beds">
<mat-header-cell *matHeaderCellDef mat-sort-header> Beds </mat-header-cell>
@armueller
armueller / MonetaryInputControl.js
Last active August 29, 2015 14:06
AngularJS snippet of a auto-formatted monetary input field. http://jsfiddle.net/armueller/sg8p1cfv/27/
function MonetaryInputCtrl($scope, $timeout) {
$scope.updated = true;
$scope.value = '$0.00';
$scope.$watch('value', function (value) {
$timeout(function () {
if (!$scope.updated) {
if (!value.match(/\$[0-9]+\.[0-9]?[0-9]?[0-9]$/g)) {
value = '$0.00';
}
console.log("update = " + $scope.updated + " : " + value);