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
JSON_text | |
= ws value:value ws { return value; } | |
begin_array = ws "[" ws | |
begin_object = ws "{" ws | |
end_array = ws "]" ws | |
end_object = ws "}" ws | |
name_separator = ws ":" ws | |
value_separator = ws "," ws |
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 Observable(subscribe) { | |
this._subscribe = subscribe; | |
} | |
const of = (v) => new Observable(observer => { | |
return observer.next(v); | |
}); | |
Observable.prototype = { | |
map(f) { |
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 Main where | |
import Prelude | |
import Control.Monad.Eff (Eff) | |
import Data.Foldable (fold) | |
import TryPureScript (DOM, h1, h2, p, text, list, indent, link, render, code) | |
type Video = { name:: 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
/* | |
* Performs a exclusive waiting for the first to finish before subscribing to another observable. | |
* Observables that come in between subscriptions will be dropped on the floor. | |
* @returns {Observable} A exclusive observable with only the results that happen when subscribed. | |
*/ | |
observableProto.exclusive = function () { | |
var sources = this; | |
return new AnonymousObservable(function (observer) { | |
var hasCurrent = false, | |
isStopped = false, |
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
someObservable.retry(3) | |
consts tasks = | |
{ | |
....{....5......2.......3...} | |
............{......5............4....3} | |
............................................{5...2...4} | |
.....................................................{...5} | |
} |
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
/* | |
Bar Problem | |
N friends are playing a game. Each of them has a list of numbers in front of himself. | |
Each of N friends chooses a number from his list and reports it to the game administrator. Then the game administrator sorts the reported numbers and shouts the K-th largest number. | |
You want to know the count all possible numbers that the game administrator can shout. |
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://github.com/Netflix/falcor-path-utils/blob/master/lib/toTree.js | |
[ | |
["list",{from:0,to:9],["name","rating"]], | |
["list", "length"] | |
] | |
-> | |
{ |
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 cyclops.control.Unrestricted; | |
import io.reactivex.Observable; | |
public class ObservableInterpreter { | |
public static <R> Observable<R> interpret(Unrestricted<R> program){ | |
//walk the Free data structure and handle each command, |
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 Combinable<T> { | |
plus(T): T, | |
zero(): T | |
} | |
class Max implements Combinable<Max> { | |
private value: number | |
constructor(num: number) { | |
this.value = num; | |
} |