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
// some experiments with combinations and deduping | |
// I think clippy has some good recommendations - I wrote this while learning Rust so it's rough | |
fn main() { | |
let arr = vec![vec![1, 1, 1], vec![2, 2, 2], vec![3, 3, 3], vec![4, 4, 4]]; | |
let mut indices = arr.iter().map(|ref _x| 0).collect(); | |
let mut paths: Vec<Vec<usize>> = vec![]; | |
let paths = find_combinations(&arr, &mut indices, 0, &mut paths); | |
let paths_dedupe1 = dedupe(&paths, &mut vec![]); |
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
/** | |
* Takes a date object and returns a string in the form YYYY-MM-DD | |
* e.g. formatDate(newDate()) should return 2017-02-17 for February 17, 2017. | |
* | |
* @param {date} d the date object to be formatted | |
*/ | |
function formatDate (d = new Date()) { | |
// explain: | |
// | YYYY format | add leading 0 to Jan-Sep | month is 0-indexed | add leading 0 to days 1-9 | day of month | |
return `${d.getFullYear() }-${ d.getMonth() < 9 ? '0' : '' }${ d.getMonth() + 1 }-${ d.getDate() < 10 ? '0' : '' }${ d.getDate()}`; |
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
/************************ | |
search.js | |
************************/ | |
// an example of how to implement fuse.js with a web worker | |
var searchWorker; // initialized in document ready function | |
if(typeof(Worker) !== "undefined") { | |
if(typeof(searchWorker) == "undefined") { | |
searchWorker = new Worker('/scripts/searchWorker.js'); | |
} |
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
add = Proc.new{|a| a + 2} | |
times = Proc.new{|a| a * 2} | |
def compose2(f, g) | |
Proc.new {|*x| f.call(g.call(*x))} | |
end | |
def compose(*x) | |
x.reduce { |all, a| compose2(all, a) } | |
end |
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
require 'ostruct' | |
# Recursively return OpenStructs from a hash or nested hash | |
# Handles array of hashes too | |
# Returns primitives when they are neither Hash nor Array | |
def ostructify(thing, camelize: false, snakify: false) | |
if thing.class == Hash | |
thing.reduce(OpenStruct.new) do |ostruct, (key, value)| | |
key = camelize ? camelize(key) : key | |
key = snakify ? snakify(key) : key |
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 { |
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
#!/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
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
/* | |
Basically, an experiment right now | |
*/ | |
bool const DEBUG_NEXT_VALUE = false; | |
bool const DEBUG_CALCULATE_NEXT_VALUES = false; | |
struct RGB | |
{ | |
double r; |
OlderNewer