This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Requires `inkscape` and `phantomjs` installed globally | |
* Handles @media print and @media all | |
*/ | |
/* global phantom */ | |
/* global jQuery */ | |
const TIMEOUT_MS = 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare class As<S extends string> { | |
private as: S; | |
} | |
type Email = string & As<'email'>; | |
type CustomerId = number & As<'customer-id'>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { chain, fromPairs, map, toPairs } from "ramda"; | |
export const flattenObj = (obj: {}) => { | |
// tslint:disable-next-line:no-any | |
const go = (objX: {}): any => | |
chain(([k, v]: [{}, {}]) => { | |
if (typeof v === "object") { | |
return map(([kX, vX]) => [`${k}.${kX}`, vX], go(v)); | |
} else { | |
return [[k, v]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A string guaranteed to have a length within the range [L,H) | |
*/ | |
export type WithinRangeString<L extends number, H extends number> = string & | |
IWithinRangeStringTag<L, H>; | |
function validateWithinRangeString<L extends number, H extends number>( | |
arg: string, | |
l: L, | |
h: H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A string guaranteed to have a length within the range [L,H) | |
*/ | |
export type WithinRangeString<L extends number, H extends number> = string & | |
IWithinRangeStringTag<L, H>; | |
function validateWithinRangeString<L extends number, H extends number>( | |
arg: string, | |
l: L, | |
h: H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const failCb = (ctx: IContextWithBindings, error: string) => ctx.done(error); | |
export function index(context: IContextWithBindings): void { | |
const fail = (ctx: IContextWithBindings, error: string, timeOut: number) => | |
setTimeout(failCb, timeOut, ctx, error); | |
const timeout = Math.pow(2, context.bindingData.dequeueCount) * 1000; | |
context.log("sleeping:" + timeout); | |
fail(context, "error", timeout); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<policies> | |
<inbound> | |
<base /> | |
<set-variable name="Channel" value=" | |
@{ | |
try { | |
var request = context.Request.Body.As<JObject>(); | |
return request["content"]["channel"].ToString(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected async findLastVersionByModelId<V>( | |
collectionName: string, | |
modelIdField: string, | |
modelIdValue: V | |
): Promise<Either<DocumentDb.QueryError, Option<TR>>> { | |
const errorOrMaybeDocument = await DocumentDbUtils.queryOneDocument( | |
this.dbClient, | |
this.collectionUri, | |
{ | |
parameters: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"authorization": { | |
"action": "Microsoft.Web/serverfarms/write", | |
"scope": "/subscriptions/XXXXXXXX/resourceGroups/agid-rg-test/providers/Microsoft.Web/serverfarms/agid-app-test" | |
}, | |
"channels": "Operation", | |
"correlationId": "XXX", | |
"eventDataId": "XXX", | |
"eventName": { | |
"value": "EndRequest", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function withDefault<T extends t.Any>( | |
type: T, | |
defaultValue: t.TypeOf<T> | |
): t.Type<any, t.TypeOf<T>> { | |
return new t.Type( | |
type.name, | |
(v: any): v is T => type.is(v), | |
(v: any, c: any) => type.validate(v !== undefined ? v : defaultValue, c), | |
(v: any) => type.serialize(v) | |
); |
OlderNewer