Skip to content

Instantly share code, notes, and snippets.

@xgrommx
xgrommx / waitUntil.js
Last active August 29, 2015 14:25 — forked from plemarquand/waitUntil.js
Bacon.waitUntil
/**
* Waits until the supplied stream emits a value, and then
* continues by emitting the last value emitted on the target.
* Useful when you want to gate on an event emitter.
*/
Bacon.Observable.prototype.waitUntil = function(item) {
// Cache the last value to come out of the source.
let last;
const unsub = this.onValue(x => last = x);
@xgrommx
xgrommx / plugin.toObservable.js
Last active August 29, 2015 14:25 — forked from getify/plugin.toObservable.js
adapting an ASQ instance to an observable
ASQ.extend("toObservable",function __build__(api,internals){
return function __toObsv__() {
return Rx.Observable.create(function(observer) {
api.val(function(msg){
observer.onNext(msg);
return ASQ.messages.apply(酶,arguments);
});
});
};
});
@xgrommx
xgrommx / router.js
Last active August 29, 2015 14:26 — forked from axefrog/router.js
Simple router driver for Cycle.js utilising Router5 for routing functionality and adapting some of the code from VisionMedia's Page.js for automatic link click intercepting
'use strict';
import {Router5, RouteNode} from 'router5';
import logger from '../logger';
// The set of valid sink functions includes synchronous state-affecting router functions that do not require a callback
// and which do not have a significant return value other than the router object itself.
const validSinkFuncs = ['add','addNode','canActivate','deregisterComponent','navigate','registerComponent','setOption','start','stop'];
function validateAndRemapSinkArgument(arg) {
@xgrommx
xgrommx / rxandroid-tuts.md
Last active August 28, 2015 19:51 — forked from plastiv/rxandroid-tuts.md
Links for android developers
@xgrommx
xgrommx / reactjs-conf-2015-notes.md
Last active September 15, 2016 09:22 — forked from prestonparris/reactjs-conf-2015-notes.md
Notes from the 2015 React.js Conference

Reactjs conf 2015 Notes

  • react native announced

    • Allows you to use react style javascript to target native ios and android, native views, live reloading
    • intro pt1
    • intro pt2
    • facebook groups app uses react native with graphql and relay
  • realtime page tweaking

    • rethink best practices and workflows
  • inmutability is a good idea

@xgrommx
xgrommx / README.md
Last active September 21, 2015 02:00 — forked from mbostock/.block
SVG feGaussianBlur

A demonstration of SVG's Gaussian blur filter effect: the svg:feGaussianBlur element.

Image source: GitHub's octodex.

@xgrommx
xgrommx / fuzzysearch.js
Created September 27, 2015 20:21 — forked from brenapp/fuzzysearch.js
A very basic Fuzzy Search in 66 bytes
/* Fuzzy Search in JavaScript in 66 bytes by SpeedyNinja
Creates a Regex of the Form x.*y.*z.* for query xyz and tests it against the list of terms
*/
f=t=>s=>t.filter(x=>eval("/"+s.replace(/./,"$&.*")+"/gi").test(x))
/*
Usage:
var search = f(["list", "of", "search", "terms"])
search("er") -> ["search", "terms"]
^ ^ ^^
@xgrommx
xgrommx / group_by.clj
Created October 7, 2015 03:07 — forked from fxposter/group_by.clj
group-by as a transducer
(defn group-by [f]
(fn [rf]
(let [groupped-value (volatile! (transient {}))]
(fn
([] (rf))
([result]
(rf (rf result (persistent! @groupped-value))))
([result input]
(let [key (f input)]
(vswap! groupped-value assoc! key (conj (get @groupped-value key []) input))
@xgrommx
xgrommx / Combinators.js
Created October 16, 2015 15:06
ES6 Combinators
// 位h.(h h)
let U = f => f(f)
// (位 x. x x) (位 x. x x)
let 惟 = _ => (x => x (x)) (x => x (x))
// 位f.(位x.f (位v.((x x) v))) (位x.f (位v.((x x) v)))
let Z = f => (x => f(y => x(x)(y)))
(x => f(y => x(x)(y)))