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 MAX_TIMEOUT = 2147483647; | |
class ChunkedTimeout { | |
private handle: number | undefined; | |
constructor(private callback?: () => void, private msLeft: number = 0) { | |
this.next(); | |
} | |
public clear() { | |
this.msLeft = 0; | |
if (this.handle) { |
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 comixify = (s, next = {}) => s | |
.split("") | |
.map(c => { | |
if (!/^[A-HJ-Z]$/i.test(c)) return c; | |
const C = c.toUpperCase(); | |
return (next[C] = !next[C]) ? C : c.toLowerCase(); | |
}) | |
.join(""); | |
const comixifyAll = (lines, next = {}) => lines.map(line => comixify(line, next)).join("\n\n"); |
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
{ | |
"swagger": "2.0", | |
"info": | |
{ | |
"title": "PhyloPic", | |
"description": "PhyloPic is a database of free silhouette images of life forms, available for reuse under a Public Domain or Creative Commons license.", | |
"termsOfService": "http://phylopic.org/terms/", | |
"contact": | |
{ | |
"name": "Mike Keesey", |
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
Show hidden characters
{ | |
"adjacent-overload-signatures": true, | |
"align": false, | |
"arrow-parens": false, | |
"class-name": true, | |
"comment-format": | |
[ | |
true, | |
"check-space" | |
], |
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
export function levenshtein(a: string, b: string): number | |
{ | |
const an = a ? a.length : 0; | |
const bn = b ? b.length : 0; | |
if (an === 0) | |
{ | |
return bn; | |
} | |
if (bn === 0) | |
{ |
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 module node_neo4j { | |
export interface PropertyContainer | |
{ | |
// The URL of this property container. | |
self: string; | |
// Whether this property container exists in (has been persisted to) the Neo4j database. | |
exists: boolean; | |
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
module Newtonsoft.Json | |
{ | |
export function deserialize(o: any): any | |
{ | |
const dict: { [$id: string]: Object } = {}; | |
function _deserialize(o: any): any | |
{ | |
if (typeof o === "object" && o !== null) | |
{ | |
let $id: string; |
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
var CHANCE_OF_LIGHTNING = 1 / 100; // Tweak this. | |
var TOTAL_FRAMES = 4; // Include 'still' frame and lightning frames. | |
this.stop(); | |
this.addEventListener('tick', function() | |
{ | |
if (Math.random() < CHANCE_OF_LIGHTNING) | |
{ | |
this.gotoAndStop(Math.floor(Math.random() * (TOTAL_FRAMES - 1)) + 1); | |
} |
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
interface Oboe | |
{ | |
(url: string): Oboe.Call; | |
doDelete(url: string): Oboe.Call; | |
doDelete(request: Oboe.Request): Oboe.Call; | |
doGet(url: string): Oboe.Call; | |
doGet(request: Oboe.Request): Oboe.Call; | |
doPatch(url: string, body: any): Oboe.Call; | |
doPatch(request: Oboe.BodyRequest): Oboe.Call; | |
doPost(url: string, body: any): Oboe.Call; |
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
module aop | |
{ | |
export function after<R>( | |
f: (...args: any[]) => R, | |
advice: (result: R, ...args: any[]) => any | |
): (...args: any[]) => R | |
{ | |
return function() | |
{ | |
var result = f.apply(this, arguments), |
NewerOlder