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
exception ErrorB; | |
exception ErrorA; | |
exception ExceptionWithStackTrace(exn, string); | |
let raise_trace = (exc: exn) => { | |
let stackTrace: string = [%bs.raw {|new Error().stack|}]; | |
raise(ExceptionWithStackTrace(exc, stackTrace)); | |
}; |
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
/* @flow */ | |
import { MongoClient } from "mongodb"; | |
import * as md5 from "md5"; | |
const streamToObservable = require("stream-to-observable"); | |
const LOCAL_MONGO_URL = "mongodb://localhost:32768/peardeck"; | |
const mongoUrl = PRODUCTION_MONGO_URL; | |
import { Observable } from "rxjs"; |
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
/* @flow */ | |
type A = { a: string; } | |
var a = { a: 'a', b: 'b' }; | |
function f(a: A) { | |
return { ...a, sum: 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
type A = { a: string; } | |
var a = { a: 'a', b: 'b' }; | |
function f(a: A) { | |
return { ...a, sum: 0 }; | |
} | |
function g<T extends A >(a: T): T&{sum:number} { | |
return { ...a, sum: 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
import Date exposing (Date) | |
type alias Model = | |
{ mediaUrl : String | |
, description : String | |
, currentUser : User | |
, comments : List MediaComment | |
} | |
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
// https://raw.githubusercontent.com/flowtype/flow-typed/master/definitions/npm/underscore_v1.x.x/flow_v0.13.x-/underscore_v1.x.x.js | |
// type definitions for (some of) underscore | |
declare module "underscore" { | |
declare interface Collection<T> {} | |
declare interface Dictionary<T> extends Collection<T> { | |
[index: string]: T; | |
} |
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
return (new Proxy( a, { | |
get: function(target, name, receiver) { | |
if ( target[name] !== undefined || name === 'window' || name === 'children') | |
return target[name]; | |
else | |
{ | |
debugger; | |
console.log(name); | |
} | |
}, |
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
type Base = { | |
common: string; | |
} | |
type A = Base & { | |
type: 'a' | |
} | |
type B = Base & { | |
type: 'b' |
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 configureInterpolateDebugging($provide) { | |
$provide.decorator("$interpolate", function($delegate){ | |
var interpolateWrap = function(){ | |
var interpolationFn = $delegate.apply(this, arguments); | |
if (interpolationFn) { | |
return interpolationFnWrap(interpolationFn, arguments); | |
} | |
}; |
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
/* @flow */ | |
type BookComment = { kind: 'book', url: string, created: Date, bookOrSomething: string } | |
type AudioComment = { kind: 'audio', url: string, created: Date, audioOrSomething: string } | |
type MediaComment = | |
BookComment | |
| AudioComment; | |
var comments : MediaComment[] = [ | |
{ kind: 'book', url: 'b', created: new Date(), bookOrSomething: 'book' }, |