This file contains hidden or 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 initConcatFriction(Rx) { | |
| Rx.Observable.prototype.concatFriction = function (u, xS, yS, vS, aS) { | |
| if (typeof xS !== 'function') | |
| xS = function (m) { return m.x; }; | |
| if (typeof yS !== 'function') | |
| yS = function (m) { return m.y; }; | |
| if (typeof vS !== 'function') | |
| vS = function (m) { return m.velocity; }; | |
| if (typeof aS !== 'function') |
This file contains hidden or 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
| rx = require 'rx' | |
| _ = require 'underscore' | |
| Observable = rx.Observable | |
| Observable::sort = (sorter) -> | |
| source = @ | |
| Observable.createWithDisposable (observer) -> | |
| list = []; | |
| source.map((val) -> |
This file contains hidden or 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
| /* | |
| * Copyright (c) 2013 the original author or authors | |
| * | |
| * Permission is hereby granted to use, modify, and distribute this file | |
| * in accordance with the terms of the license agreement accompanying it. | |
| */ | |
| package org.tinytlf.observables | |
| { | |
| import asx.array.flatten; | |
| import asx.fn.args; |
This file contains hidden or 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
| /* | |
| Observable.mappend maps a value through a selector and returns | |
| a unique Array of the input values and the result(s). | |
| Use mappend when you'd rather not create anonymous value types | |
| just to track the IObservable stream inputs. Takes advantage of | |
| JS's ability to apply an Array as function arguments, giving the | |
| benefit of more readable JS methods. | |
| Pros: |
This file contains hidden or 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 | |
| { | |
| import asx.fn.K; | |
| import asx.fn._; | |
| import asx.fn.args; | |
| import asx.fn.getProperty; | |
| import asx.fn.noop; | |
| import asx.fn.partial; | |
| import asx.fn.sequence; | |
| import asx.number.mul; |
This file contains hidden or 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 concatMany(enumerable:IEnumerable, selector:Function):IObservable { | |
| return Observable.createWithCancelable(function(observer:IObserver):ICancelable { | |
| const iterator:IEnumerator = enumerable.getEnumerator(); | |
| const subscriptions:CompositeCancelable = new CompositeCancelable(); | |
| var schedule:Function = function():void { | |
| subscriptions.add(Scheduler.scheduleRecursive(Scheduler.defaultScheduler, function(reschedule:Function):void { | |
| schedule = reschedule; |
This file contains hidden or 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.tinytlf.fn | |
| { | |
| import raix.interactive.toEnumerable; | |
| /** | |
| * @author ptaylor | |
| */ | |
| public function pipe(...functions):Function { | |
| return function(...args):* { | |
| return toEnumerable(functions).reduce(args, function(args:Array, func:Function):Array { |
This file contains hidden or 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
| merge = [].concat | |
| expand = (fn, context) -> (args) -> fn.apply context, args.slice 0, fn.length | |
| obs1 = Rx.Observable.returnValue(1) | |
| obs2 = Rx.Observable.returnValue(2) | |
| obs3 = Rx.Observable.returnValue(3) | |
| combined = obs1.combineLatest(obs2, merge).combineLatest(obs3, merge) | |
| combined.subscribe expand (o1, o2, o3) -> o1 + o2 + o3 |
This file contains hidden or 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
| fs = require 'fs' | |
| path = require 'path' | |
| {exec} = require 'child_process' | |
| # Make sure we have our dependencies | |
| try | |
| colors = require 'colors' | |
| coffee = require 'coffee-script' | |
| browserify = require 'browserify' | |
| catch error |
This file contains hidden or 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 OnlineConcaveMinima | |
| values = [] | |
| indices = [0] | |
| finished = 0 | |
| matrix = (i, j) -> 0 | |
| base = 0 | |
| tentative = 0 | |