So what with my last computer dying, getting a new phone, trying to find a job, preparing to maybe move, and all the other nonsense going on, I haven't really blogged at all lately. Oh well.
My to-do list is gigantic, like a whole huge directory tree of several gigabytes full of unfinished stuff.
Somewhere in there, there's rewriting my entire website.
I've just switched from GoDaddy's hosting to my own VPS (a droplet), since GoDaddy's cost was going up by about 110%. This means I have a LOT more available to me, now. Not quite as much space, but I can run whatever I need to on my server now, so... I think it's time to finally update everything. I plan on leaving most things as just plain old static sites (because, let's be honest, no one cares how flashy this crap is if it takes a year to render it on an old phone). The blog might change a bit, though. I'm still using that same old script (based originally on BashBlog, heavily modified over the past almost-year). Nothing against that script, it does its job and everything, but a 1300-line shell script to basically turn Markdown into HTML is absurd -- ESPECIALLY since it doesn't include the parser.
Anyway, here are some notes from the NG-JS meetup a couple of weeks ago. They were lost on my old laptop, but the SATA-to-USB thingy came in the mail the other day, so I can finally just do something with these.
IT ALL MAKES SENSE NOW.
Promises are Observables. Promise++, specifically. Note that that means Observables are not Promises/A+ compliant. A Promise would be an Observable with one single emitted value. Our streams return many values.
Listening to streams is Subscribing. We return new streams, hence the term Immutability, which is regarding the original (unchanged, unchangeable) streams.
We do things like mapping, filtering, and scanning. Simple functions applied to streams that return new streams.
map(f) takes input stream, applies
f(), produces value on output stream.
If one creates what we will call a 'metastream' we're basically making a stream of POINTERS. WHY DOES THIS ALL MAKE PERFECT SENSE?!
RxJS has a
.flatMap() which is brilliant, it flattens said 'metastream' and emits on a trunk stream everything that would be emitted on the branch streams.
Okay, following the tutorial, I'm going to move these notes over to the actual rx-js/frp directory....
.startWith() that does EXACTLY what it sounds like. No matter the input stream, the output of
startWith(x) will have
x at the beginning.
It looks to me like everything about FRP makes a lot more sense if graphed/charted first. ASCII can work for this pretty well. Example:
streamyInput: -1---2---3---45-> inputStream: ----a----b--c---> dostuffThing: -----X-----X----> outputOfThat: ---------E----E-> streamPostWhat: ----Q---IDK----->
In Rx there's a
combineLatest() that takes two input streams and joins the two most recently emitted values from both streams, like:
A: ---a-------e----i-------> B: -----b--c----d------q---> //////combineLatest(f)////// -----AB--AC---EC-ED-ID--IQ->
Huh. I don't actually know why this isn't working, exactly.
OH WAIT DUH, I forgot jQuery. Thank goodness. I really was hoping I wasn't gonna have dumb problems. YAY THIS IS NICE!