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
import axios from 'axios'; | |
export const experimentsInterceptor = () => { | |
const getExperiments = () => { | |
const [, params] = window.location.search.split('?'); | |
const experiments = params.split('ex.'); | |
const values = experiments.reduce((tally, item) => { | |
if (item.match(/^[A-Z][A-Z][A-Z]\d\d/)) { | |
const newItem = item.replace('&', ''); |
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/bash | |
MSG_FILE=$1 | |
FILE_CONTENT="$(cat $MSG_FILE)" | |
# Initialize constants here | |
red='\033[0;31m' | |
green='\033[0;32m' | |
yellow='\033[0;33m' | |
no_color='\033[0m' |
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
// Array Chunking | |
/* | |
Produces an output of an array with nested arrays of n given size | |
chunk([1,2,3,4,5], 2) ===> [ [1,2], [3,4], [5 ] | |
*/ | |
function chunk(arr, size) { | |
const chunked = []; | |
let index = 0; |
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
/* | |
Suppose we have some input data describing a graph of relationships between parents and children over multiple | |
generations. The data is formatted as a list of (parent, child) pairs, where each individual is assigned a unique | |
integer identifier. | |
For example, in this diagram, 3 is a child of 1 and 2, and 5 is a child of 4: | |
1 2 4 | |
\ / / \ | |
3 5 8 |