Skip to content

Instantly share code, notes, and snippets.

View 9point6's full-sized avatar
🤔
Who actually reads this?

John Sanderson 9point6

🤔
Who actually reads this?
View GitHub Profile
{
init: function(elevators, floors) {
function getLeastBusyElevator(elevators) {
return elevators.reduce(function (currentLeast, thisElevator) {
if (thisElevator.destinationQueue.length < currentLeast.destinationQueue.length &&
thisElevator.loadFactor() < 0.75
) {
return thisElevator;
} else {
return currentLeast;
@9point6
9point6 / gc-parser.js
Last active October 27, 2016 10:10
(A quick and dirty) Node V8 GC trace parser.
'use strict';
const Promise = require('bluebird');
const _ = require('lodash');
const path = require('path');
const fs = Promise.promisifyAll(require('fs'));
const DEBUG = true;
const FILENAME = './gc';
const RUBBISH_THRESHOLD = 5;
const ALPHA_REGEX = /^[a-zA-Z\s]+$/;