Skip to content

Instantly share code, notes, and snippets.


Amanda Falke abstractmachines

View GitHub Profile
View transducers.js
/** Implementing transformations (like map and filter) with reducers. **/
// take all evens, multiply by 2, log that.
const arr = ['1', '2', '3', '4', '5', '6']
console.log('Chaining map and filter.')
abstractmachines / promiseunderthehood.js
Created Oct 26, 2017
Dave's pwomise. Remember that the catch is not implemented correctly, recall the tree structure of Promise.
View promiseunderthehood.js
class Pwomise {
constructor (fn) {
fn(this._resolve.bind(this), this._reject.bind(this))
this._thens = []
this._catches = []
_resolve (value) {
while (this._thens.length > 0) {
abstractmachines / iterator-string-for-of-spread.js
Last active Nov 2, 2017
JavaScript Iterators: Strings, spread, and for of
View iterator-string-for-of-spread.js
/* JavaScript Iterators
Strings as data source; for of and spread operator as data consumers
Strings can be consumed as iterables using the spread operator.
Note that strings will be parsed according to code points, not by character,
and so num characters parsed will be somewhat nondeterministic.
1 - Axel Rauschmeyer:
2 -
abstractmachines / Symbol.hasinstance.js
Last active Feb 23, 2018
Well Known Symbols : instanceof via custom Symbol.hasinstance
View Symbol.hasinstance.js
/* Well Known Symbols : Symbol.hasinstance
1 -
2 -
3 -
4 -
Well Known Symbols are Reflection via implementation in ES6.
Reflection in Metaprogramming: observing low level internals of a programming language/program.
abstractmachines / arrayiterator.js
Last active Jul 5, 2018
JavaScript Iterators : Arrays
View arrayiterator.js
/* JavaScript Iterators
An Iterator Object is a data structure that has a .next() method that can be called repeatedly.
Iterators use the Well Known Symbol called Symbol.iterator.
(The Iterable Object has an Iterator pointer for indexing.)
The Iterator object has two properties, value and done (boolean). Iteration will continue so
long as done is falsey. Once done is truthy, iteration stops.
Just like C++ iterators for C++ data structures, JavaScript iterators iterate through an entire
abstractmachines / set-map-iterator.js
Last active Jul 5, 2018
JavaScript Iterators: Sets and Maps
View set-map-iterator.js
/* JavaScript Iterators
Sets and Maps
Sets and Maps can be made Iterable/Iterator by using the methods .entries(), .keys(),
values(), and/or via for of construct.
A Set is a unique (non repeated) version of a Bag data structure. Characteristic equation
is contains() or has().
A Map (in JS) is a key-value pair data structure, unordered (in order of insertion).
abstractmachines /
Last active Mar 22, 2020
React for C/C++ developers: PropTypes (Static, default, and more)

React PropTypes: Static, Default, and what it all means

You may have seen a couple of different ways to handle React PropTypes.

  • You've seen declarations of propTypes/PropTypes including "static proptypes" and "default proptypes."
  • You've seen declarations of propTypes/PropTypes inside or outside of the class.

Default PropTypes

  • These set a default value for PropTypes.
  • Recall also that you can simply use initialization in the component itself (in the inherent little "constructor" that React functional components tend to have, e.g.
abstractmachines / upgrade-repo-to-sagas.js
Last active Mar 22, 2020
Repo upgrading: Dummy sagas + test w/ thunks
View upgrade-repo-to-sagas.js
/* To upgrade a repo from using only thunks, to using sagas and thunks,
1. Create a dummy saga
2. Add in Saga middleware to store configuration, and start/run sagas from store config
3. Test sagas (generators with { value: someValue, done: false } until { ... done: true }
4. Since thunks and sagas can live together in the same repo, you can now move forward with handling async side effects
with new code by using sagas (and being able to test them), and slowly migrate your legacy thunks over to sagas over time.
// 1. rootSaga.js
abstractmachines /
Last active Jun 17, 2020
The Base Is The Place: A tutorial on radix for students of systems engineering


The Base Is The Place: Understanding Radix

How to understand radix: A tutorial for students of systems engineering

Radix : Number of unique digits that exists in a system.

Binary "base 2" : the number 2 is 0010

Note the binary number 0010. Binary is read RTL or right-to-left.


git Workshop

Motivation for this workshop

The majority of blogs and documentation about git are one of two things:

  1. technically correct while being very difficult for newbies to digest,


  1. technically incorrect "guides" which help people learn, but miss many CS fundamentals and details and/or advise learners to "avoid/ignore" "advanced" features which software engineers use daily on the job.