Skip to content

Instantly share code, notes, and snippets.

View masonkmeyer's full-sized avatar

Mason Meyer masonkmeyer

  • Salt Lake City, UT
View GitHub Profile
# syntax=docker/dockerfile:1.4
FROM golang:1.18.1 as builder
WORKDIR /src
COPY <<EOF main.go
package main
import (
"log"
@masonkmeyer
masonkmeyer / cp.ts
Last active August 16, 2017 12:53
cp with RxJS and TS
import * as rx from 'rxjs';
import * as fs from 'fs';
import * as path from 'path';
function cp(from: string, to: string) {
return stat(from)
.flatMap((s) => {
return s.isDirectory() ? copyDir(from, to) : copyFile(from, to)
})
}
@masonkmeyer
masonkmeyer / RegexValidators.ts
Created March 27, 2016 15:51
Use a regular expression to validate Angular2 controls.
import { AbstractControl } from 'angular2/common';
export class RegexValidators {
static pattern(pattern: RegExp) : (c: AbstractControl) => {[key: string]: any } {
return (control: AbstractControl): { [key: string]: any } => {
let v: string = control.value;
return pattern.test(v) ? null : { "pattern": { "requiredPattern": `^${pattern}$`, "actualValue": v } };
};
}
}