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
/* This file contains 5 core meteor packages | |
* Base64 | |
* EJSON | |
* Tracker (formerly Deps) | |
* ReactiveDict | |
* ReactiveVar | |
* mrt:reactive-object | |
* http://stackoverflow.com/a/26996309/552203 | |
* Copyright: Dean Radcliffe | |
*/ |
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script> | |
<script src="https://cdn.rawgit.com/hermanbanken/f1af739c111f2f918406026705f53761/raw/c22eddb2c36c01a51c66740cf674093ba4bf8729/meteor-reactive-packages.js"></script> | |
<script> | |
var energyUse = ReactiveVar(0); | |
var energyAccumulate = ReactiveVar(0); | |
Tracker.autorun(() => { | |
// Do not register dependency on energyAccumulate | |
var prev = Tracker.nonreactive(() => energyAccumulate.get()); | |
// Registering dependency on energyUse | |
energyAccumulate.set(prev + energyUse.get()); |
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script> | |
<script src="https://cdn.rawgit.com/hermanbanken/f1af739c111f2f918406026705f53761/raw/c22eddb2c36c01a51c66740cf674093ba4bf8729/meteor-reactive-packages.js"></script> |
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 Rx = require("rx") | |
var test = require("qunitjs").test | |
/** stupid RxJS testing code **/ | |
function createMessage(expected, actual) { | |
return ['Expected: [' + expected.toString() + "]", "Actual: [" + actual.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
let observable: Observable<Bool> | |
////////// A | |
return observable.publish(obs => | |
Observable.merge( | |
obs.filter(v => v).doOnNext(":)"), | |
obs.filter(v =>!v).doOnNext(":(") | |
) | |
) |
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 Rx from 'rx'; | |
// ES6 source, compile with babel | |
// Usage: | |
// import hook from 'rx-debug' | |
// hook() | |
// Then: | |
// Observable.just(1).debug("your tag") | |
// You will observe subscriptions, nexts, error and completion. |
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 Rx from 'rx'; | |
var Observable = Rx.Observable, | |
observableProto = Observable.prototype; | |
export default function(){ | |
observableProto.collection = function(config) { | |
let root = this.share(), merge = [], latest = []; | |
if(config.merge) { |
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
package org.example.play | |
import play.api.libs.iteratee.{Concurrent, Enumerator, Execution, Iteratee} | |
import play.api.mvc.{RequestHeader, Result, WebSocket} | |
import rx.lang.scala.subjects.PublishSubject | |
import rx.lang.scala.{Observable, Subject, Subscription} | |
import scala.concurrent.Future | |
import scala.language.postfixOps |
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
package controllers | |
import org.specs2.mutable.Specification | |
import play.api.libs.functional.syntax._ | |
import play.api.libs.json._ | |
object JsonTest { | |
val json = Json.obj( | |
"foo" -> Json.obj("a" -> 1, "b" -> 0), | |
"barA" -> 0, |