Skip to content

Instantly share code, notes, and snippets.

View mcav's full-sized avatar

Marcus Cavanaugh mcav

View GitHub Profile
/**
* @typedef ReviewEntry
* @param {string} id
* @param {number} rating
* @param {string} review
* @param {number} timestamp
*/
/**
* @typedef PaginatedReviews
### Keybase proof
I hereby claim:
* I am mcav on github.
* I am mcav (https://keybase.io/mcav) on keybase.
* I have a public key whose fingerprint is 3C25 D972 472B AC3A DBE5 50A7 57DE D586 0DCB 9121
To claim this, I am signing this object:
#!/bin/bash
# cpulimit must be installed...
# - homebrew: "brew install cpulimit"
# - make from https://github.com/opsengine/cpulimit
CPULIMIT_BIN=cpulimit
# The CPU percentage may be, e.g. 800 for an 8-core machine.
# See the docs for `cpulimit`.
PERCENT_CPU=50
@mcav
mcav / keybase.md
Created April 21, 2015 23:01
keybase.md

Keybase proof

I hereby claim:

  • I am mcav on github.
  • I am mcav (https://keybase.io/mcav) on keybase.
  • I have a public key whose fingerprint is 899A 69AF 882F F002 44FE 33A7 9CEF B7B2 BC1D ADC0

To claim this, I am signing this object:

@mcav
mcav / multimethod.js
Created November 30, 2014 03:13
Dead-simple Clojure-style multimethods for JavaScript. Public Domain.
/**
* Dead-simple multimethods for JavaScript.
*
* Usage:
*
* var count = multimethod([
* String, function(self) {
* return self.length;
* },
* Number, function(self) {
'use strict';
define(function(require) {
/**
* The AlarmDatabase stores a list of alarms in IndexedDB. All
* mutation operations return Promises, for easy chaining and state
* management. This module returns the one-and-only instance of
* AlarmDatabase.
*/
function AlarmDatabase(dbName, storeName, version) {
/**
* Ensure that local-only folders live in a reasonable place in the
* folder hierarchy by moving them if necessary.
*
* We proactively create local-only folders at the root level before
* we synchronize with the server; if possible, we want these
* folders to reside as siblings to other system-level folders on
* the account. This is called at the end of syncFolderList, after
* we have learned about all existing server folders.
*/
addAlert: function(alert) {
var testOpts = alert.testOpts || {};
if (this.alerts.length) {
this.removeCurrentAlert();
}
this.alerts.unshift(alert);
this.grabScreenLock();
addAlert: function(alert) {
var testOpts = alert.testOpts || {};
if (this.alerts.length) {
this.removeCurrentAlert();
}
this.alerts.unshift(alert);
this._screenLock = this._screenLock || navigator.requestWakeLock('screen');
@mcav
mcav / test.js
Created February 25, 2014 23:54
GELAM Test Thought Experiment
/**
* This is a sketch of one alternative implementation of the GELAM
* test harness. At a high level, it does three things:
*
* 1. It still uses the ArbPL/Loggest framework of loggers and
* expectations (mocked out below with slightly different naming).
*
* 2. It replaces the serial "test step" framework with a flow based
* on Promises.
*