Skip to content

Instantly share code, notes, and snippets.

View gilad905's full-sized avatar

Gilad Mayani gilad905

View GitHub Profile
function waitFor(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function eventOrTimeout() {
let [evResolve, evReject] = [];
const evPromise = new Promise((res, rej) => [evResolve, evReject] = [res, rej]);
someElement.on('someEvent', function(event) {
if (event.someCondition)
evResolve(event.someValue);
@gilad905
gilad905 / gist:bd30b5c3e5dd8c0165fc47c173ac0a54
Last active August 22, 2017 15:17
Ant Queen of the Hill Contest - Debugging Tools

Ant Queen of the Hill Contest - Debugging Tools

Some handy functions that you can use for better debugging your answers.

Paste these into the developer tools' console before starting a game (once, not for each game).

// Pauses the game (just like hitting the 'pause' button)
console.pause = function() {

console.log("PAUSE");