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
/* global __dirname */ | |
var fs = require('fs'); | |
var files = fs.readdirSync(__dirname).filter(isAConfigFile); | |
var configs = files.map(file => require(__dirname + '/' + file)); | |
function isAConfigFile(filename) { | |
return filename.endsWith('-config.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
def render(s: String, mode: NameMode): String = | |
if (s.matches("\\d+")) { | |
return render(SafeLong(s.toInt), mode); | |
// The line below seems to compile. | |
} else if (s.charAt(0) == '-') { | |
"negative " + render(s.substring(1).toInt, mode) | |
} else if (s.length < 2) { | |
val c = s.charAt(0) | |
if (charIsAlpha(c)) { | |
onesForChar(c) |
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
var curry = require('lodash.curry'); | |
var counts = [9, 4, 4, 5, 49]; | |
var avgCount = mean(counts); | |
var deviations = counts.map(curry(bMinusA)(avgCount)); | |
var squaredDevs = deviations.map(square); | |
var variance = mean(squaredDevs); | |
var populationStdDev = Math.sqrt(variance); | |
console.log('avgCount', avgCount); | |
console.log('populationStdDev', populationStdDev); |
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
/* global __dirname, process */ | |
var fs = require('fs'); | |
var ndjson = require('ndjson'); | |
var through2 = require('through2'); | |
var callNextTick = require('call-next-tick'); | |
if (process.argv.length < 3) { | |
console.log( | |
'Usage: node tools/toolname.js <export something.ndjson> > new_file.ndjson' |
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
var hash = require('string-hash'); | |
function TrackingColors() { | |
var idsForColors = {}; | |
return { | |
getTrackingColorForId, | |
getIdForTrackingColor | |
}; | |
function getTrackingColorForId(id) { |
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
# Usage: ZEROES=9 make number-audio | |
# e.g. A million has six zeroes (3 * (1 + 1)). | |
# A billion has nine zeroes (3 * (2 + 1)). | |
# A trillion has 12 zeroes (3 * (3 + 1)). | |
number-audio: | |
rm -f output.wav | |
rm -f test-list.txt | |
echo "file static/one.wav\n" > test-list.txt | |
for i in {1..$(ZEROES)}; do printf "file 'static/zero.wav'\n" >> test-list.txt; done | |
ffmpeg -f concat -safe 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
var width = +window.innerWidth; | |
var height = +window.innerHeight; | |
svg.attr('width', width); | |
svg.attr('height', height); |
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
var names = []; var items = document.querySelectorAll('.game .title'); for (var i = 0; i < items.length; ++i) { names.push(items[i].textContent); } console.log(JSON.stringify(names, null, 2)); |
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
/* global process */ | |
// Exhaustively searches for islands in a minimum spanning tree. | |
var fs = require('fs'); | |
if (process.argv.length < 3) { | |
console.log('Usage: node tools/check-for-islands.js minimum-spanning-tree.json'); | |
} | |
var mst = JSON.parse(fs.readFileSync(process.argv[2])); |
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
var artistNodes = document.getElementsByClassName('CategoryTreeLabel'); | |
var nodeCount = artistNodes.length; | |
var names = []; | |
for (var i = 0; i < nodeCount; ++i) { | |
let name = artistNodes[i].textContent; | |
name = name.replace('(band) ', ''); | |
name = name.replace(' members', ''); | |
names.push(name); | |
} | |
console.log(JSON.stringify(names, null, 2)); |