Skip to content

Instantly share code, notes, and snippets.

View acutmore's full-sized avatar

Ashley Claymore acutmore

View GitHub Profile
@acutmore
acutmore / index.ts
Last active September 21, 2019 09:04
code mod to update dependency injection annotations at YouView
/// <reference types="node" />
import { mod } from "riceburn";
import { TypescriptMod } from "riceburn/lib/interfaces";
import ts = require("typescript");
import cp = require("child_process");
import fs = require("fs");
const glob = require("glob");
import { getServiceDescription } from "../phoenix/tools/webpack/hatch/typescript-dependency-annotations/tsc-dep-annotations";
const { log } = console;
@acutmore
acutmore / chaos-promise.ts
Last active April 7, 2019 12:10
Promise Implementation where callbacks resolve in random order - To help catch race conditions
const OriginalPromise = Promise;
const enum State {
PENDING,
RESOLVED,
REJECTED
}
const emptyFn = () => {};
const FUDGE_FACTOR_MS = 100;
@acutmore
acutmore / proxy.js
Created September 7, 2016 17:24
Basic es5 proxy
console.clear();
function isFunction(o){
return typeof o === (typeof isFunction);
}
/**
* Wraps up an object replacing methods with an interceptor
* @param obj - the obj to wrap
* @param interceptor {(obj, methodName, args) => any}