These macros are designed to provide a literal notation for [immutable-js][1] using [sweetjs][2].
The most interesting being the Map literal
var map = im{"foo": "bar", "baz": "quux"};
This compiles to the 2d array version of Immutable.Map.
// ES6 for loops | |
// ============= | |
// Things in ES6 can be "iterable". Arrays are iterable by default. | |
var fruits = ['Apple', 'Banana', 'Grape']; | |
for (var fruit of fruits) | |
console.log('Fruit: ' + fruit); |
These macros are designed to provide a literal notation for [immutable-js][1] using [sweetjs][2].
The most interesting being the Map literal
var map = im{"foo": "bar", "baz": "quux"};
This compiles to the 2d array version of Immutable.Map.
Original tweet size in JSON 2624 Msgpack = 1817 Gzip + Json = 1058 Gzip + Msgpack = 1116 LZ4 + Json = 1628 LZ4 + Msgpack = 1361 | |
Original tweet size in JSON 1863 Msgpack = 1443 Gzip + Json = 0783 Gzip + Msgpack = 0835 LZ4 + Json = 1153 LZ4 + Msgpack = 1040 | |
Original tweet size in JSON 2074 Msgpack = 1670 Gzip + Json = 0842 Gzip + Msgpack = 0894 LZ4 + Json = 1229 LZ4 + Msgpack = 1139 | |
Original tweet size in JSON 2025 Msgpack = 1617 Gzip + Json = 0845 Gzip + Msgpack = 0895 LZ4 + Json = 1238 LZ4 + Msgpack = 1143 | |
Original tweet size in JSON 2069 Msgpack = 1663 Gzip + Json = 0846 Gzip + Msgpack = 0901 LZ4 + Json = 1243 LZ4 + Msgpack = 1164 | |
Original tweet size in JSON 2035 Msgpack = 1634 Gzip + Json = 0852 Gzip + Msgpack = 0907 LZ4 + Json = 1247 LZ4 + Msgpack = 1167 | |
Original tweet size in JSON 1988 Msgpack = 1464 Gzip + Json = 0804 Gzip + Msgpack = 0862 LZ4 + Json = 1220 LZ4 + Msgpack = 1061 | |
Original tweet size in JSON 1910 Msgpack = 1502 Gzip + Json = 0775 Gzip + Msgpack = 0832 LZ4 + Json = 1154 LZ4 + Msgpack = 1060 |
// ES7 Observables + WHATWG Streams | |
// | |
// https://github.com/jhusain/asyncgenerator | |
// https://github.com/whatwg/streams | |
// | |
// Continuation from file: | |
// https://github.com/jhusain/asyncgenerator/blob/master/src/observable.js | |
Observable.fromStream = function(readable) { | |
return new Observable(function(generator) { |
(by @andrestaltz)
So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.
Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:
Rx.Observable.prototype.flatMapLatest(selector, [thisArg])
Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
/***************************************************************************** | |
This is the function doing all the heavy lifting. | |
It takes a function and returns a stream generated by feeding its output | |
back into itself as input. (It doesn't start consuming the stream.) | |
It's basically a pared-down version of Cycle.run that forgets about the | |
application architecture of separating out a pure main from the effectful | |
drivers and just resolves a single circularly dependent stream. The other | |
files just build up more API-compatible versions of Cycle.run from this. |
#grid { | |
border: 1px solid #000; | |
border-spacing:0; | |
} | |
#grid tr:nth-child(3) td, | |
#grid tr:nth-child(6) td { | |
border-bottom: 1px solid #000; | |
} |
var mqtt = require('mqtt') | |
// Make sure to change this to the IP address of your MQTT server | |
, host = '192.168.128.204' // or localhost | |
client = mqtt.createClient(1883, host, {keepalive: 10000}); | |
// Subscribe to the temperature topic | |
client.subscribe('temperature'); | |
// When a temperature is published, it will show up here | |
client.on('message', function (topic, message) { |