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 process = ... | |
var timeout = ... | |
var tcs = new TaskCompletionSource<object>(); | |
process.Exited += delegate { | |
tcs.SetResult(null); | |
}; | |
if (await Task.WhenAny(tcs.Task, Task.Delay(timeout)) != tcs.Task) | |
{ | |
process.Kill(); | |
} |
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
vladima@vladima-HP:~/Sources/git/TypeScript$ node --version | |
v7.6.0 | |
vladima@vladima-HP:~/Sources/git/TypeScript$ node -e "console.log(process.versions.v8)" | |
5.5.372.40 | |
vladima@vladima-HP:~/Sources/git/TypeScript$ node built/local/tsc.js -p src/server/ --noEmit --diagnostics | |
Files: 99 | |
Lines: 120541 | |
Nodes: 579310 | |
Identifiers: 213907 | |
Symbols: 118481 |
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 foo(t: any) { | |
var $isMobile = t.mobile() !== null; | |
if ( | |
// Apple iOS 3.2-5.1 - Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3), iPad 3 (5.1), original iPhone (3.1), iPhone 3 (3.2), 3GS (4.3), 4 (4.3 / 5.0), and 4S (5.1) | |
t.os('iOS') && t.version('iPad')>=4.3 || | |
t.os('iOS') && t.version('iPhone')>=3.1 || | |
t.os('iOS') && t.version('iPod')>=3.1 || | |
// Android 2.1-2.3 - Tested on the HTC Incredible (2.2), original Droid (2.2), HTC Aria (2.1), Google Nexus S (2.3). Functional on 1.5 & 1.6 but performance may be sluggish, tested on Google G1 (1.5) | |
// Android 3.1 (Honeycomb) - Tested on the Samsung Galaxy Tab 10.1 and Motorola XOOM |
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
class UnmanagedMemoryWriter: Stream | |
{ | |
private static T NotImplemented<T>() | |
{ | |
throw new NotImplementedException(); | |
} | |
private UnmanagedMemoryWriter() | |
{ | |
} |
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 function defineCore(name: string, deps: string[], f: (require, exports,...deps: string[]) => void); | |
function define(name: string, deps: string[], f: (require, exports,...deps: string[]) => void) { | |
defineCore(name, deps, (require, exports, deps) => { | |
require(name); | |
f(require, exports, deps); | |
}) | |
} |
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
define(["require", "exports"], function (require, exports) { | |
"use strict"; | |
exports.x = 12; | |
require("./a"); | |
}); |
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 * as ts from "typescript"; | |
const fileName = "test.ts"; | |
const program = ts.createProgram([fileName], {}); | |
const typeChecker = program.getTypeChecker(); | |
const file = program.getSourceFile(fileName); | |
// use getSignatureFromDeclaration | |
{ | |
const ctorDecl = ts.forEachChild(file, function find(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
import * as ts from "typescript"; | |
// Note: this uses ts.formatting which is part of the typescript 1.4 package but is not currently | |
// exposed in the public typescript.d.ts. The typings should be exposed in the next release. | |
function format(text: string) { | |
let options = getDefaultOptions(); | |
// Parse the source text | |
let sourceFile = ts.createSourceFile("file.ts", text, ts.ScriptTarget.Latest, /*setParentPointers*/ true); |
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
"use strict"; | |
var ts = require('typescript'); | |
console.log(ts.SyntaxKind.CallExpression); |
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 {Observable} from "rxjs/rx"; | |
Observable | |
.of(1) | |
.catch(e => Observable.of("error")) | |
.map(x => x.toFixed()); |
NewerOlder