This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Running multiple validations asynchronously can present some interesting challenges, | |
* especially if the calling function should return a "result" type (or some other non-throwing value). | |
* There is even more complexity if you want to run the validations in sequence, | |
* and stop on the first failure. | |
* | |
* It is fairly easy to construct a meta function that executes the validators imperatively, | |
* but what if you want a more generic approach? | |
* This gist suggests a generic solution using generators, and slowly builds up the intuition | |
* until the final example shows a more realistic use case. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Hosted at: https://gist.github.com/ericyd/c36ff66a40c3b7ede7ac9dd95ae260af | |
* Usage: | |
* cd my-local-git-repo | |
* curl https://gist.githubusercontent.com/ericyd/c36ff66a40c3b7ede7ac9dd95ae260af/raw/git-stats.js > git-stats.js | |
* node git-stats.js | |
*/ | |
const { exec } = require('child_process') | |
const { promisify } = require('util') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User Registration | |
User enters phone number -> Send authentication SMS | |
Send authentication SMS | |
User taps authentication link -> Prove checks mobile identity | |
Prove checks mobile identity | |
User is valid -> Registration complete | |
User is invalid -> Error message | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cargo.toml | |
// =============== | |
// [package] | |
// name = "flow-field-1" | |
// version = "0.1.0" | |
// authors = ["ericyd <[email protected]>"] | |
// | |
// [dependencies] | |
// nannou = "0.13" | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is NOT a cryptographically strong UUID algorithm | |
* It is purely for quick-n-easy drag-n-drop scripting applications where | |
* data quality does not matter. | |
* | |
* For a proper UUID implementation, see | |
* https://github.com/uuidjs/uuid/blob/master/src/v4.js | |
*/ | |
const max = Math.pow(2, 8) - 1 | |
// this slick trick thanks to https://github.com/uuidjs/uuid/blob/e8cb0a03a5408415d1f93a1499d8cda47246adc7/src/bytesToUuid.js#L7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Basically, an experiment right now | |
*/ | |
bool const DEBUG_NEXT_VALUE = false; | |
bool const DEBUG_CALCULATE_NEXT_VALUES = false; | |
struct RGB | |
{ | |
double r; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Smart Deposits | |
First paycheck for employer -> Intro Carousel step 1 | |
Subsequent paychecks for employer -> Receipt View | |
First Time experience | |
Intro Carousel step 1 | |
Swipe to step 2 -> Intro Carousel step 2 | |
Continue -> Edit View |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh --login | |
LOG_FILE="$(pwd)/qa-setup-$(date +%Y-%m-%d_%H.%M.%S%Z).log" | |
############################# | |
# | |
# Utilities and setup | |
# | |
############################# | |
warnings="\n\nResources / References\n======================\n\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////// | |
// | |
// Examples | |
// | |
// Live examples: | |
// https://observablehq.com/@ericyd/rgb-factory | |
// | |
///////////////////////// | |
console.log(rgbFactory()(0)); // { r: 212, g: 90.00000000000004, b: 90 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
It is common to address two-dimensional array problems with nested arrays. | |
It works, but then you have all these nasty references like array[0][3]. | |
This class abstracts the element selection to a method which takes the x and y indices | |
as arguments. | |
If you wanted to go purely functional obviously you can, but this class demonstrates the idea. | |
*/ | |
class TwoDimensionalArray { |
NewerOlder