Skip to content

Instantly share code, notes, and snippets.

View abstractmachines's full-sized avatar
🤸

Amanda Falke abstractmachines

🤸
View GitHub Profile
@abstractmachines
abstractmachines / interactive-cli-rebase.md
Last active October 22, 2020 17:06
Interactive Rebase on CLI

Interactive rebase on the CLI

This workflow is outside of the "git pull -r origin branchName" workflow we use for rebases without merge commmits. This workflow is just to squash commits on a local/unshared branch. Keep in mind that "rewriting history can make teammates sad, angry or worse" standard warnings about rebasing.

  1. Choose the commit hash which will "choose everything AFTER this commit to rebase."
  2. Remember you're rebasing a branch against itself, not src/destination rebasing like normal rebasing workflow.
  3. git rebase -i hash123-everything-after-this-commit
  4. That'll send you into a screen that's a list of commits. Use rename, squash etc. then :x to save/exit...
@abstractmachines
abstractmachines / binary-tutorial.md
Last active September 20, 2020 00:11
Intro To Binary

WIP. This is a tutorial I'm writing which is in progress :) - Amanda

Intro to binary (and some computer architecture)

Intended audience(s) include:

  • Very early career engineers who don't have a 'math background' (yet!)
  • Junior developers and interns who want to "understand" rather than just "complete tutorials"
  • Web developers who didn't take CS courses, but still want to understand "how things work" "under the hood"
@abstractmachines
abstractmachines / git-workshop.md
Last active August 3, 2020 17:39
git workshop

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,

OR

  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.
@abstractmachines
abstractmachines / the-base-is-the-place-understanding-radix.md
Last active June 17, 2020 18:28
The Base Is The Place: A tutorial on radix for students of systems engineering

WIP

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.

@abstractmachines
abstractmachines / upgrade-repo-to-sagas.js
Last active March 22, 2020 21:15
Repo upgrading: Dummy sagas + test w/ thunks
/* 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 generator.next() { 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
abstractmachines / proptypes-static-default-more.md
Last active March 22, 2020 21:01
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
abstractmachines / set-map-iterator.js
Last active July 5, 2018 19:17
JavaScript Iterators: Sets and Maps
/* 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
abstractmachines / arrayiterator.js
Last active July 5, 2018 19:10
JavaScript Iterators : Arrays
/* 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
abstractmachines / Symbol.hasinstance.js
Last active February 23, 2018 23:09
Well Known Symbols : instanceof via custom Symbol.hasinstance
/* Well Known Symbols : Symbol.hasinstance
sources:
1 - https://www.keithcirkel.co.uk/metaprogramming-in-es6-symbols/
2 - http://exploringjs.com/es6/ch_symbols.html
3 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
4 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance
Well Known Symbols are Reflection via implementation in ES6.
Reflection in Metaprogramming: observing low level internals of a programming language/program.
@abstractmachines
abstractmachines / iterator-string-for-of-spread.js
Last active November 2, 2017 23:15
JavaScript Iterators: Strings, spread, and for of
/* 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.
Sources:
1 - Axel Rauschmeyer: http://exploringjs.com/es6/ch_iteration.html
2 - http://www.zsoltnagy.eu/es6-iterators-and-generators-in-practice/