Skip to content

Instantly share code, notes, and snippets.

View lambdabaa's full-sized avatar
🏠
Working from home

Gareth Ari Aye lambdabaa

🏠
Working from home
View GitHub Profile
@lambdabaa
lambdabaa / gist:4004776
Created November 2, 2012 22:33
ClassDojo Coding Challenge: Finding the Minimum Weight Path Through a Matrix

Finding the Minimum Weight Path Through a Matrix

Consider a matrix of integers (ie [[3, 1, 4], [1, 5, 9], [2, 6, 5]]). For a better visual, we can draw this matrix like so:

| 3 1 4 |
| 1 5 9 |
| 2 6 5 |

@lambdabaa
lambdabaa / calendar_resource_api.js
Last active December 16, 2015 16:19
Super awesome cal sync interface
/**
* Called when we get events for the first time or when we get a delta.
* @param {Calendar.ResourceType} resourceType
* @param {Calendar.Resource.Authorizer} authorizer
* @param {Function} cb Will get called with Array.<Calendar.Resource>
*/
on = function(resourceType, authorizer, cb);
/**
+ if (!this.envQueue[envId]) {
+ return console.log(
+ 'Attempting to log an test event for the environment: "' + envId +
+ '" but it does not exist. stack: \n' + (new Error()).stack
+ );
+ }
gareth@albi:~/Documents/gaia$ tools/ci/unit/travis.sh
Preparing test environment
==========================
Downloading and installing closure linter
[sudo] password for gareth:
Downloading Firefox
Downloading & installing node dependencies
Downloading xulrunner-sdk and making profile for testing (more than 5 minutes)
Starting test-agent-server and waiting for server to start on port 8789
64) [communications] Render contacts list Facebook Contacts List "after each" hook:
Error: Error: expected false to be true (http://test-agent.gaiamobile.org:8080/common/test/helper.js?time=1367261559833:30)
at onerror (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4959)
/**
* @param {MouseEvent} evt A click event on an hour element.
*/
_onHourClick: function(evt) {
/** @type {Element} */
var el = evt.target;
/** @type {DOMTokenList} */
var tokens = el.classList;
@lambdabaa
lambdabaa / gist:5538043
Created May 8, 2013 03:47
./build.sh error (after ./config.sh hamachi)
out/host/linux-x86/obj/EXECUTABLES/openssl_intermediates/enc.o: In function `enc_main':
/home/gareth/Documents/B2G/external/openssl/apps/enc.c:479: undefined reference to `BIO_f_zlib'
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/openssl_intermediates/openssl] Error 1
make: *** Waiting for unfinished jobs....
host StaticLib: libnativehelper (out/host/linux-x86/obj/STATIC_LIBRARIES/libnativehelper_intermediates/libnativehelper.a)
INSTALL include/asm (32 files)
make[1]: Leaving directory `/home/gareth/Documents/B2G/kernel'
/home/gareth/Documents/gaia/tools/test-agent/node_modules/test-agent/lib/test-agent/mocha/reporter.js:138
return this.proxy.respond([data.event, data.data]);
^
TypeError: Cannot call method 'respond' of null
at Object.respond (/home/gareth/Documents/gaia/tools/test-agent/node_modules/test-agent/lib/test-agent/mocha/reporter.js:138:23)
at Object._onTestData (/home/gareth/Documents/gaia/tools/test-agent/node_modules/test-agent/lib/test-agent/common/mocha-test-events.js:95:21)
at /home/gareth/Documents/gaia/tools/test-agent/node_modules/test-agent/lib/test-agent/responder.js:156:20
at Array.forEach (native)
at Object.emit (/home/gareth/Documents/gaia/tools/test-agent/node_modules/test-agent/lib/test-agent/responder.js:155:19)
at Object._captureEmit (/home/gareth/Documents/gaia/tools/test-agent/node_modules/test-agent/lib/node/server/event-mirror.js:137:30)
*** BEFORE ***
/**
* @return {number} Amount of time in ms until the end of the hour.
*/
_millisUntilHour: function() {
var date = new Date();
var millis = 1000 * (
60 * (60 - date.getMinutes()) +
(60 - date.getSeconds())
@lambdabaa
lambdabaa / gist:5571837
Created May 13, 2013 21:53
Breakage in master
1) [calendar] db #open on version change #setupDefaults "before each" hook:
Error: TypeError: Calendar.Presets is undefined (http://calendar.gaiamobile.org:8080/js/db.js?time=1368481936224:308)
at onerror (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4959)