This file contains hidden or 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
getOpportunityData: function () { | |
return getDateFilter('Opportunity') | |
.then(function(dateFilterQuery) { | |
createNewAPIQuery('Opportunity'); | |
dateFilter = ''; | |
if (apiQuery != undefined) { | |
let timestamp = parseTimestamp(apiQuery[0].timestamp); | |
dateFilter = '?filter[created_after]=' + timestamp; | |
} |
This file contains hidden or 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
function(){ | |
// prevent double callbacks | |
if (sent) return; | |
var args = Array.prototype.slice.call(arguments); | |
debug('sending ack %j', args); | |
self.packet({ | |
id: id, | |
type: hasBin(args) ? parser.BINARY_ACK : parser.ACK, | |
data: args |
This file contains hidden or 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
function Cell(val) { | |
this.empty = false; | |
this.value = val; | |
} | |
Cell.prototype.reset = function () { | |
this.empty = true; | |
this.value = null; | |
}; | |
var grid = [] |
This file contains hidden or 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
// entities = { next: linkedListItem, size: numberOfItems } | |
// linkedListItem = { isDeleted: true/false, next: linkedListItem } | |
var cur = entities; | |
for (var i = 0; i < entities.size; i++) { | |
if (cur.next.value < 0) { | |
cur.next = cur.next.next; | |
// bug is that we increase i AND decrease entities.size, which | |
// causes us to approach the end of the loop from both sides | |
entities.size--; |
This file contains hidden or 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
function testKick(kickArr, matrix) { | |
let ptr = 0; | |
let numTests = 0; | |
let aLen = kickArr.length; | |
outer: while (ptr < aLen) { | |
numTests = kickArr[ptr++]; | |
while (numTests-- > 0) { | |
if (matrix.has(kickArr[ptr++])) { | |
if (kickArr[ptr] <= ptr) { return 0; } |
This file contains hidden or 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
'use strict'; | |
var WINDOW = Math.pow(2,11)-1; | |
function time() { | |
var hrtime = process.hrtime(); | |
return (hrtime[0] * 1e3) + ((hrtime[1] / 1e6)|0); | |
} | |
function setPedanticInterval(cb, ival) { |
This file contains hidden or 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
const Promise = require("bluebird"); | |
const fs = Promise.promisifyAll(require('fs')) | |
function getNumbers() { | |
var fileNumbers = []; | |
for(var n = 0; n < 10; n++){ | |
fileNumbers.push(n); | |
} | |
return fileNumbers; | |
} |
This file contains hidden or 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
const Promise = require("bluebird"); | |
const fs = Promise.promisifyAll(require('fs')) | |
const getNumbers = () => new Promise((resolve, reject) => { | |
var fileNumbers = []; | |
for(var n = 0; n < 10; n++){ | |
fileNumbers.push(n); | |
} | |
resolve(fileNumbers); | |
}); |
This file contains hidden or 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
function validate(schema) { | |
return function (req, res, next) { | |
// assuming joi callback style validation | |
schema.validate(req.params, schema, function (err, coercedParams) { | |
if (err) { next(err); return; } // if you want to handle errors with middleware | |
// if (err) { req.params = null; req.validationError = err; } // if you want to handle it in your route | |
else { req.params = coercedParams; } // replacing req.params with the validated/coerced version | |
next(); | |
}); | |
}; |
This file contains hidden or 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
;wumpus 1.0 | |
;myndzi - 6/5/2006 | |
on *:text:!wumpus:*:wump $nick $fulladdress | |
on me:*:join:#wumpus:%wumpuscid = $cid | |
on *:start:wumplisten | cave1 | |
alias wumplisten { | |
if ($sock(wumpus_l)) sockclose wumpus_l | |
socklisten -dp 0.0.0.0 wumpus_l 2421 |
NewerOlder