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
(defn rand-name [] | |
(let [v [\a \e \i \o \u \y] | |
c [\h \j \k \l \m \n \p \r \s \t \v] | |
get-v #(v (rand-int (count v))) | |
get-c #(c (rand-int (count c)))] | |
(loop [s ""] | |
(let [len (count s) c_char (get-c) v_char (get-v) | |
double-v? (= 1 (rand-int 5))] | |
(if (or (>= len 10) (and (>= len 4) (= 1 (rand-int 2)))) | |
(capitalize s) |
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
const dropLeadingWeeks = (weeks) => { | |
let i = weeks.length; | |
for (;i != 0; i--) { | |
const week = weeks[i - 1]; | |
if (week.totalPoints != 0) break; | |
} | |
return weeks.slice(0, i); | |
}; |
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
/** | |
* @param {string} propName New property name for target | |
* @param {Object} target Target object | |
* @param {Object} changes Modified properties of target | |
* @param {Object} restOfProps | |
* @return {Promise} resolve({propName: {target}, ...restOfProps}) | |
*/ | |
function _mergePropChanges(propName, target, changes, ...restOfProps) { | |
return Promise.resolve(Object.assign({ | |
[propName]: Object.assign(target, changes) |