query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Create the profile's line chart within the given drawing area | createLineChart() {
const popupWidth = this.profileDiv.clientWidth
const popupHeight = this.profileDiv.clientHeight
// Set the dimensions of the canvas / graph
const margin = { top: 10, right: 20, bottom: 40, left: 50 }
if (this.props.popupType === "modal") {
margin.left = 70
margin.bott... | [
"drawLineChart(){\n\t\tlet crimeRatesPerYearAndPerCrimeType = this.createCrimeRateData();\n\t\tthis.createLineChart(crimeRatesPerYearAndPerCrimeType);\n\t}",
"function drawPopulationLineOnChart() {\r\n // define line generator for main data lines plotted on chart.\r\n aleph.mainline = d3\r\n .line()\r\n .... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
makeSoapRequiredFields Function make the fields that are required in the SOAP request to Metapack | function makeSoapRequiredData()
{
try
{
//passing the values to floats inorder to make the calculations
dimension1 = parseFloat(dimension1);
dimension2 = parseFloat(dimension2);
dimension3 = parseFloat(dimension3);
//get the max dimension
maxDimension = Math.max(dimension1,dimension2,dimensio... | [
"setRequiredFields(requiredFields){this._requiredFields=collectionToArray(requiredFields);return this;}",
"function checkForRequiredFields(req, res, next) {\n const params = { ...req.body };\n\n // Create new Mongose document with the parameters passed in the req.body\n new this.Model(params).validate((error) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This express middleware loads the file content (or generates the humans.txt content, depending on its use). Once done, it will always serve the same file from the memory. To avoid this behavior and serve the content dynamically, pass the 'dynamic: true' parameter in the middleware options. | function middleware(config, opts) {
// TODO: 'opts.dynamic'
async function getContent() {
let content = '';
if (config) {
if (typeof config === 'string') {
// Config is file path
content = fs.readFileSync(config, 'utf8');
} else {
// Config is humans.txt as an object
... | [
"function serveFile(req, res, filepath, next) {\n fs.readFile(filepath, function(error, content) {\n if (error) next(error);\n\n // Send Content\n else {\n // Set MIME type correctly.\n var ext = path.extname(filepath);\n if (ext in MIME_MAP) type = MIME_MAP[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Emit events asynchronously since they should not change the promise state. | function emitAsync(args){
setTimeout(function(){
emit.apply(evented, args);
}, 0);
} | [
"function async_event() {\n const ee = new EventEmitter();\n \n ee.on('event', async function() {\n await delay(10);\n // Writing to stderr to avoid buffering.\n console.error('Hello Event!')\n })\n\n ee.on('end', function() {\n console.error('End event...')\n })\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all possible values for aesthetic a. | function allValues (a) {
function hasAesthetic (layer) { return a in layer.mappings; }
function vals (layer) {
function v (d) { return layer.dataValues(d, a); }
return _.flatten(_.map(layer.statistic.compute(data), v));
}
return _.uniq(_.fl... | [
"function getAttributeValues(a) {\r\n let selectedAttribute = a.value;\r\n var valueSet = new Set();\r\n\r\n for (key in jsonDict) {\r\n let cityObj = jsonDict[key].CityObjects, obj;\r\n for (obj in cityObj) {\r\n if (cityObj[obj].attributes) {\r\n let attrib = cityO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Highlight a range, even if it spans multiple elements | highlightRange(range) {
let span = document.createElement('span');
span.classList.add(SELECTED_CLS);
let spans = [span];
// If the selection starts and ends in different containers
if (range.startContainer !== range.endContainer) {
let startRange = new Range();
let startSpan = span.clon... | [
"function highlightRange(start_index, end_index, label, color){\r\n var content = document.getElementById(\"content\");\r\n var str = content.innerHTML;\r\n if(start_index == null || end_index == null) return;\r\n\r\n highlightContent = str.slice(start_index, end_index + 1);\r\n str = str.slice(0, st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GENERATE COUNTRY CHECBOX LIST | function generateCountryCheckBoxList(zone) {
let div_start = '<div class="form-check form-check-inline">';
let div_end = '</div>';
let html = '';
getCountryRefList(zone).forEach(function(country) {
if (country.img.length>0) {
let input = '<input class="form-check-input" type="checkbox" name="countr... | [
"function generateListOfCountries() {\n\tvar onecollength = Math.ceil((countrylist.length)/3);\n\tfor (var i = 0; i < onecollength; i++) {\n\t\tvar col = document.getElementById(\"firstcol\");\t\t\t\n\t\tvar checkbox;\n\t\tvar label;\n\t\tvar br = document.createElement(\"br\");\n\t\t//if (i<=countrylist.length) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates all indicator input fields with the calculated value based on the values in the input entry fields in the form. | function updateIndicators()
{
$( 'input[name="indicator"]' ).each( function( index )
{
var indicatorId = $( this ).attr( 'indicatorid' );
var formula = dhis2.de.indicatorFormulas[indicatorId];
if ( isDefined( formula ) )
{
var expression = generateExpre... | [
"function updateInputFields() {\n let results = getResults();\n for (let i = 0; i < inputs.length; i++) {\n if (!inputs[i].locked) {\n inputs[i].value = results[i];\n document.getElementById(\"input\" + i).value = results[i];\n }\n }\n sumBonus();\n total();\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks whether the given literal conforms to the [InsertReplaceEdit](InsertReplaceEdit) interface. | function is(value) {
var candidate = value;
return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
} | [
"function is(value) {\n var candidate = value;\n return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);\n }",
"editLiteral(node, event) {\n event.stopPropagation();\n this.clearSelection(); // if we're editing, clear the selection\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
item hover value populates through hover in inventory menu | function itemHoverVal0() {
itemHoverVal = 0; //assign value to hover state.
} | [
"_onHover(menuID, itemID) {\n this._dbus.emit_signal('OnHover', GLib.Variant.new('(is)', [menuID, itemID]));\n }",
"displayToolTip(item) {\n console.log(\"Hovering Over Item: \", item.name);\n }",
"onHover(part) {\n this.props.actions.equipment().then(equip => {\n if (equip[part]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
LINESTATION METHOD / Create a new entry in the DB | insertLineStation(station, line){
return new Promise(function(resolve, reject){
models.LineStation.create({
id_line: line[0].id_line,
id_station: station[0].id_station
}).then(function(linestation){
resolve(linestation)
})
... | [
"function newOpportunityLineItem(opportunityExternalId,pricebookentryId,quantity,unitPrice,success,error) {\n\tconsole.log(\"NEW OPPTY LINE ITEM\");\n\tconsole.log(opportunityExternalId);\n\tconsole.log(pricebookentryId);\n\tconsole.log(quantity);\n\tconsole.log(unitPrice);\n\n\n\tpg.connect(process.env.DATABASE_UR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve a `ParseSpan` from `start` to the current position (or to `artificialEndIndex` if provided). | span(start, artificialEndIndex) {
let endIndex = this.currentEndIndex;
if (artificialEndIndex !== undefined && artificialEndIndex > this.currentEndIndex) {
endIndex = artificialEndIndex;
}
return new ParseSpan(start, endIndex);
} | [
"span(start, artificialEndIndex) {\n let endIndex = this.currentEndIndex;\n if (artificialEndIndex !== undefined && artificialEndIndex > this.currentEndIndex) {\n endIndex = artificialEndIndex;\n }\n // In some unusual parsing scenarios (like when certain tokens are missing an... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that checks infront of mario for a pipe | function isPipe(){
return isMatch(pipe, getPipe());
} | [
"function checkIfOnPipe() {\n for (var i = 0; i < pipes.length; i++) {\n var pipe = pipes[i];\n if (mario.x + 32 >= pipe.x && mario.x + 32 <= pipe.x + 60)\n return true;\n\n if (mario.x >= pipe.x && mario.x <= pipe.x + 60)\n return true;\n }\n return false;\n}",
"checkPipePosition() {\n\t\tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The display mode to use. Defaults to 'block'. The other sane alternatives are 'inline' and 'flex'. displayMode: 'block', | get displayMode() {
return this.__displayMode || 'block';
} | [
"get displayMode() {\n return this.isntNullOrUndefined(this.__displayMode) ?\n this.__displayMode : 'block';\n }",
"get display() {\n return this._hidden ? 'none' : 'flex';\n }",
"static get layoutOptions() {\n return {\n childDisplay: 'inline',\n sizing: null\n };\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Skips past all initial meta, whitespace & comment tokens. Stops on first tag token (which must be type openTag) | function skipMeta() {
_log("Moving to root tag openening tagname...");
while (!isOpenTag(tokenIt.token)) {
var moved = TokenUtils.moveNextToken(tokenIt);
if (!moved) {
return false;
}
_logt();
... | [
"function tokenSkip() {\n return undefined;\n }",
"function skipTagTokens(tagName, tokens, i, skippedTokens) {\n // number of tokens of this type on the [fictional] stack\n var stackCount = 1;\n\n while (i < tokens.length && stackCount > 0) {\n var token = tokens[i];\n\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
renderTemperatues calls th temperature conversions and renders the response as HTML | function renderTemperature(weatherResponse){
let currentTempFar = convertToFarenheight(weatherResponse.main.temp);
let feelsLikeTempFar = convertToFarenheight(weatherResponse.main.feels_like);
let tempMinFar = convertToFarenheight(weatherResponse.main.temp_min);
let tempMaxFar = convertToFarenheight(wea... | [
"function getTemperature(tempUnits){\n $.getJSON(api, function(data){\n if (tempUnits ==\"celsius\"){\n var tempSulfix = \"C\";\n var temp = (data.current.temp_c);\n var feelslike = (data.current.feelslike_c);\n }\n else if (tempUn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add all of tElements first, then loop through and add any oElements not in tElements or 50/50 chance. This destroys 'creation order' of the nodes/connections but doesn't matter | function addElements(tElements, oElements, addHandler) {
tIndexes = {};
_.forEach(tElements, function(element) {
addHandler(element);
});
_.forEach(oElements, function(element) {
var i = tIndexes[element.id];
// not found, then just push it in
if (... | [
"AddRange(elements) {\n this._elements.push(...elements);\n }",
"function removeUnmangedNodes() {\n let nodesBeforeBlazeUpdate = [];\n let nodesAfterBlazeUpdate = [];\n\t\n for (let node of instance.tinySelectedElem.childNodes) {\n nodesBeforeBlaze... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Cancels the running coroutine at next chance available. Throws exception inside the running with the message 'Coroutine cancelled' | function cancel () {
const e = new Error('Coroutine canceled.');
e.cause = 'canceled';
this.resume(e);
} | [
"function cancelDamageState()\n{\n damageState = false;\n StopCoroutine(\"damageWait\");\n}",
"cancelShot () {\n if (!this.runner) return\n this.runner.cancel()\n this.cleanupRunShot()\n }",
"cancel() {\n let taskInstance = this._taskInstance;\n taskInstance.proceed.call(\n taskInstan... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
to delete attached file in editmulti timesheet page... | function doMultiDeleteFile()
{
if(confirm("Do you want to delete attached file for this Timesheets?"))
{
var form=form=document.sheet;
var val=Number(form.rowcou.value);
getMultiTimeDataFile(val);
form.action="edittimemulti.php";
form.acctype.value="filedelete";
form.submit();
}
} | [
"function deleteAttachment() {\r\n\tsimpleDialog(langOD27, langOD28,null,null,null,langCancel,\r\n\t\t\"$('#div_attach_upload_link').show();$('#div_attach_download_link').hide();$('#edoc_id').val('');enableAttachImgOption(0);\",langDelete);\r\n}",
"function debugDelete() {\n\t\t\tvar filename = document.getElemen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end of file// start of file IO > Export > SVG Font Converting a Glyphr Studio Project to XML in a SVG Font format. | function ioSVG_exportSVGfont() {
// debug('\n ioSVG_exportSVGfont - Start');
var ps = _GP.projectsettings;
var md = _GP.metadata;
var family = md.font_family;
var familyid = family.replace(/ /g, '_');
var timestamp = genDateStampSuffix();
var timeoutput = timestamp.split('-');
timeoutput[0] = timeoutput... | [
"function exportSVG() {\n world.export();\n }",
"function SaveAsSVG(document, newname)\r{\r var targetFolder = Folder(STYLE_FABRIC_EXPORT_PATH);\r\r if (! targetFolder.exists) {\r // geef een melding en \r throw(\"Onderstaande folder niet gevonden, is de netwerkverbinding gemaakt? \\n\\n\" +\r ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate the total duration of all events in a list | function calculateDuration(eventList) {
//var earliestEventTime = eventList[0].normalStartTime;
return _.reduce(eventList, function(sum, next) { return sum += next.processTime; }, 0);
//+ earliestEventTime;
} | [
"function calculateDuration(eventList) {\n return _.reduce(eventList, function(sum, next) { return sum += next.duration }, 0)\n}",
"function calculateSimpleDuration(eventList) {\n return _.reduce(eventList, function(sum, next) { return sum += next.duration; }, 0);\n}",
"function calculateDurationForEvents(eve... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
increases gifts and cars when the player reaches the shop | reachedShop () {
this.gifts += 1;
if (this.gifts % 3 === 0) {
this.cars += 1;
setTimeout(this.createEnemies.bind(this), 500, 1);
this.speed += 0.3;
audio.src = 'sounds/smw_1-up.wav';
audio.play();
} else {
audio.src =... | [
"function buyRockets() {\n if (cheese > autoRockets.rocket.price) {\n autoRockets.rocket.quantity++;\n cheese -= autoRockets.rocket.price;\n update();\n\n // console.log(\"you have a Truck\")\n } else {\n alert(\"You need more Doge\");\n }\n}",
"function buyWagon() {\n if (Game.copper >= wago... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds correct number to a right hand side element. | function appendNumberToRightElement(element) {
let current_text = element.textContent;
let child_text_element = element.children.namedItem("headline-text");
let current_element_number = parseInt(element.getAttribute("num")) + 1; // index by 1
child_text_element.innerHTML =
current_text +
'<span style="f... | [
"function updateRight() {\n var rightCount = $(\"#rightScore\").html();\n rightCount++;\n $(\"#rightScore\").html(rightCount);\n}",
"function rightAdder() {\r\n rightN++;\r\n right.innerHTML = rightN;\r\n totalN = rightN + incorrectN;\r\n total.innerHTML = totalN;\r\n scoreFinder();\r\n}",
"ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles upload of a library. | async function handleUpload(req, res) {
function fail(code, message) {
res.status(code).json({ error: message })
cleanFiles(req.files)
}
if (token !== null) {
const userToken = req.get('Auth-Token')
if (userToken != token) {
return fail(403, 'Authorization failed... | [
"function swift_container_main_lib_upload(token){\n console.log(\"Uploading Main Library Files\");\n res1.write(\"Uploading Main Library Files<br>\");\n //upload to swift container\n fs.createReadStream('public/uploads/'+mainLibFileName).pipe(request.put({\n url: swift_url+'/scripts/'+mainLibFile... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get inline physical location | getPhysicalPositionInline(inline, index, moveNextLine) {
let element = undefined;
element = this.getElementBox(inline, index, moveNextLine).element;
let lineWidget = undefined;
if (isNullOrUndefined(element) || isNullOrUndefined(element.line)) {
if (inline instanceof FieldEle... | [
"get imageLocation() {\n return this.getStringAttribute('image_location');\n }",
"function getObjLoc(obj){\r\n\tif (obj)\r\n\t\treturn \"(\"+obj.offsetLeft+\",\"+obj.offsetTop+\",\"+obj.clientWidth+\"w,\"+obj.clientHeight+\"h)\";\r\n\telse\r\n\t\treturn obj;\r\n}",
"getPartLocation(){\n let vie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Expression functions may be used in filter and bind queries Creates a function that takes a solution and compares a given node with the binding of a given variable from that solution. | function exprEquals(varName, node) {
return function(sol) {
return node.equals(sol[var2Attr(varName)]);
}
} | [
"function exprEquals(varName, node) {\r\n return function(sol) {\r\n return node.equals(sol[var2Attr(varName)]);\r\n }\r\n}",
"equalityConditions(dbPath, f = identity) {\n return {\n [this.path]: value => ({ [dbPath]: { $eq: f(value) } }),\n [`${this.path}_not`]: value => ({ [dbPath]: { ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function: move to first row of DynamicTable parameters: return: | function dap_firstRow()
{
this.saveData(this.getCurrentRow());
if (this.DynamicTable.firstRow() == true)
{
var boolflag = this.DataSource[this.getRecordIndex(
this.getCurrentRow())][this.DataSource[0].length-1];
this.DynamicTable.disableRow(this.getCurrentRow(),
(boolflag == constLoadStatus)||(boolflag =... | [
"first(){this._focusRowByIndex(0)}",
"insertRowBefore() {\n this.insertRow();\n }",
"function moveToNextTableRow(pTableInFocus) {\n var tableInFocus;\n var tableRows;\n var maxRowIndex;\n var tableCells;\n \n if (justDoIt == true) { \n \n if (pTableInFocus != null) {\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets all pending state, including all attached before, beforeEach, after, afterEach, tests, describes, etc. If a test run is already in progress, an error will be thrown. | reset() {
if (this.currentRun) {
throw new Error("Can't reset if a test run is already in progress!");
}
this.resetRunResults();
this.testRunCancelled = false;
this.testQueueStack = [];
for (const type of QueueStackTypes) {
this.queueStacks[type].r... | [
"function resetTestState() {\n errors.splice(0, errors.length);\n testIsDone = false;\n}",
"reset() {\n this.logVerbose(`Resetting test \"${this.name}\".`);\n this.attempted = false;\n this.skipped = false;\n this.success = null;\n this.aborted = null;\n this.failed = n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
nGrams return an object, where the labels are tokens which can be found in the textStr. To each token the function assigns a chain of NGramNode objects of length n (including the main node), leading forward and backward. The ?, !. . characters are treated as sentence delimeters and remo ved. At the sentence boundaries ... | function nGrams (textStr, n) {
var ngrams = Object()
// replace !s and ?s with dots, then split by dots
var sents = textStr.replace(/[!?]/g, '.').split('.')
var sent_tokens = [] // list of tokens for each sentence
var wordTotal = 0
for (var s in sents) {
sent_tokens[s] = tokenize(sents... | [
"function nGramsWords(sentence, n) {\n var words = sentence.split(/\\W+/);\n var total = words.length - n;\n var grams = [];\n for(var i = 0; i <= total; i++) {\n var seq = '';\n for (var j = i; j < i + n; j++) {\n seq += words[j] + ' ';\n }\n grams.push(seq);\n }\n return grams;\n}",
"stat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
constructor for the UICanvas class | function UICanvas(uicanvas, mainFunction) {
//get the canvas the UI will be drawn to and its context
this.parentCanvas = uicanvas;
this.drawCanvas = uicanvas.getContext('2d');
//grab our tileset
this.tileset = document.getElementById('tileset1');
this.buttonImages = document.getElementById('button-images')... | [
"function Canvas () {\n\t// Define state\n\tvar me = this;\n\tthis.type = 'canvas';\n\t\n\tthis.height = 0;\n\tthis.width = 0;\n\tthis.colour = jin.Colour.BLACK;\n\tthis.alpha = 1;\n\tthis.fullScreen = false;\n\tthis.overflow = false;\n\tthis.canvasBase = null;\n\t\n\tthis.rendered = false;\n\tthis.canvasEl = false... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the line number of the start of the visual line that the given line number is part of. | function visualLineNo(doc, lineN) {
var line = getLine(doc, lineN), vis = visualLine(line);
if (line == vis) { return lineN }
return lineNo(vis)
} | [
"function visualLineNo(doc, lineN) { // 5801\n var line = getLine(doc, lineN), vis = visualLine(line); // 5802\n if (line == vis) return lineN; ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
END fnEditComic third party barcode scanner | function fnScanBarcode() {
console.log("fnScanBarcode is running");
//user presses button, turns on camera to scan barcode
//barcode is scanned and passed to the input field
//when they save comic, that data in new input
//is bundled withou our comic data and... | [
"function scanBarcode() {\n radlib.connect(updateTable, dumpLog, {connection:\"CAMERA\"});\n}",
"function EfwServerBarcode() {\n}",
"function ManualBarcodeEntry() {\n var text = document.getElementById(\"txt_input\").value;\n JsBarcode(\"#code128\", text);\n printDivInPopUp();\n}",
"function drawBa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes raw image data and turns it into an Image object Does so by resizing, turning to greyscale, and quantizing brightness Options prescaled: If true, skips the scale step recycle: An Image object that can have its data overwritten (to reduce garbage collector usage) | static fromRawData(data, opts) {
return new Promise(function (resolve, reject) {
let pipeline;
if (opts.prescaled) {
pipeline = sharp(data)
.greyscale();
} else {
pipeline = sharp(data)
.resize(gridSize, ... | [
"function filterGrayscale(imgData){\n\tvar gs = new Uint8ClampedArray(imgData.width * imgData.height);\n\tfor (var i = 0; i < imgData.data.length; i += 4){\n\t\tvar pos = i / 4;\n\t\tvar y = Math.floor(pos / canvas.width);\n\t\tvar x = pos - y * canvas.width;\n\t\t\n\t\tgs[pos] = 0.299 * imgData.data[i] + 0.587 * i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an allocator for a temporary variable. A variable declaration is added to the statements the first time the allocator is invoked. | function temporaryAllocator(statements,name){var temp=null;return function(){if(!temp){statements.push(new DeclareVarStmt(TEMPORARY_NAME,undefined,DYNAMIC_TYPE));temp=variable(name);}return temp;};} | [
"function temporaryAllocator(statements,name){var temp=null;return function(){if(!temp){statements.push(new DeclareVarStmt(TEMPORARY_NAME,undefined,DYNAMIC_TYPE));temp=variable(name)}return temp}}",
"function temporaryAllocator(statements, name) {\n var temp = null;\n return function () {\n if (!... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
utilizing the token data provided to gather the tweets from the requested site | function getTweetData(token, screen_name) {
return new Promise(function(resolve, reject) {
console.log(token);
var twitterDataReq = https.request({
method: 'GET',
host: 'api.twitter.com',
path: '/1.1/statuses/user_timeline.json?screen_name=' + screen_name,
... | [
"search(token) {\n this.client.get('search/tweets', { q: token, count: 100, result_type: 'mixed' }, /** callback( err, tweets, response )**/ );\n }",
"function pullTweet() {\n\tclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n\t\tif (!error) {\n \t\tfor (var i = 0; i < ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
console.log(makeItBig([1,3,5,5])); Challenge 2 Print Low, Return High Create a function that takes in an array of numbers. The function should print the lowest value in the array, and return the highest value in the array. | function printLowReturnHigh(arr) {
var lowest = arr[0];
var hightest = arr[0];
for(var i = 0; i < arr.length; i++) {
if(lowest > arr[i]) {
lowest = arr[i];
}
if(hightest < arr[i]) {
hightest = arr[i];
}
}
console.log(lowest);
return hightes... | [
"function printLowReturnHigh(array) {\n var lowest = array[0];\n var highest = array[0];\n\n for (var i = 1; i < array.length; i++) {\n if (array[i] < lowest) {\n lowest = array[i]; \n } else if (array[i] > highest) {\n highest = array[i]; \n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Max files upload limit | function limitUpload() {
$('#multiUpload').find('input[data-maxfiles]').on('change', function() {
var max = $(this).attr('data-maxfiles');
if (this.files.length > max) {
MechAlert.no('Максимальна кількість файлів для одночасного завантаження: ' + max);
this.value = '';
... | [
"function maxFilesLimit() {\n if (opt.uploadedFiles >= opt.maxfiles) {\n return true;\n } else {\n return false;\n }\n }",
"function getMaxFilesCount() {\n return maxFilesCount;\n }",
"get UploadTooManyFiles(){\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hides the popup for a given step | function hidePopup(step) {
if (step.tether) {
step.tether.disable();
}
step.popup[0].style.setProperty('display', 'none', 'important');
} | [
"hide() {\n const currentStep = this.getCurrentStep();\n\n if (currentStep) {\n return currentStep.hide();\n }\n }",
"hide() {\n const currentStep = this.getCurrentStep();\n if (currentStep) {\n return currentStep.hide();\n }\n }",
"deactivateSteps() {\n const steps = this.g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copy properties from source to target (recursively allows extension of Objects and Arrays). Scalar values in the target are overwritten. If target is undefined, an object of the appropriate type will be created (and returned). We recursively copy all child properties of plain Objects in the source so that namespace lik... | function deepExtend(target, source) {
if (!(source instanceof Object)) {
return source;
}
switch (source.constructor) {
case Date:
// Treat Dates like scalars; if the target date object had any child
// properties - they will be lost!
var dateValue = source;
return new Date(dateVa... | [
"function deepExtend(target, source) {\n if (!(source instanceof Object)) {\n return source;\n }\n\n switch (source.constructor) {\n case Date:\n // Treat Dates like scalars; if the target date object had any child\n // propert... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: millisToDateUS(millis) Handles the US conversion of milliseconds to date. Parameters: millis A string of milliseconds. Page Actions: See millisToDateHandler(). Called when the client's default date format is set to mm/dd/yyyy. | function millisToDateUS(millis) {
var datetime = new Date(millis);
var theyear=datetime.getFullYear();
var themonth=datetime.getMonth()+1;
var theday=datetime.getDate();
dateString = (themonth+"/"+theday+"/"+theyear);
return dateString;
} | [
"function millisToDateHandler(millis) {\r\n\tvar dateString;\r\n\tif (clientDateFormat == 'dd/mm/yyyy') {\r\n\t\tdateString = millisToDateUN(millis) \r\n\t} else {\r\n\t\tdateString = millisToDateUS(millis);\r\n\t}\r\n\treturn dateString;\r\n}",
"function millisToDateUN(millis) {\r\n\tvar datetime = new Date(mill... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reference to the Module Button container element, if present | get moduleButtonContainerEl() {
return this.element[0].querySelector('.module-nav-section.module-btn');
} | [
"get moduleButtonEl() {\n return this.moduleButtonContainerEl.querySelector('button');\n }",
"get buttonContainer() {}",
"get moduleButtonAPI() {\n return this.moduleButtonEl ? $(this.moduleButtonEl).data('button') : undefined;\n }",
"get moduleButtonIconEl() {\n return this.moduleButtonEl?.querySe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getModel returns the most recent instance of the p5.Model. We cache the model in the class instance so that it can be called in each render cycle without any performance overhead | getModel() {
return this.model;
} | [
"getModel() {\n }",
"getModel() {\r\n return this.model;\r\n }",
"model() {\n return internal(this).model;\n }",
"get model() {\n return this._model;\n }",
"function model(){\n return this._model;\n }",
"getModel (type) {\n if (!type) type = this.visualT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
included tests.js inside hp15c.js and exported start_tests() | run_test() { start_tests(); } | [
"function startTests() {\n _qunit.default.start();\n }",
"async runTests() {\n for (let file of this.testFiles) {\n console.log(chalk.gray(`--- ${file.shortName}`));\n const beforeEaches = [];\n\n global.render = render;//jsdom\n\n global.beforeEach = (fn) => {\n beforeEaches.pus... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function reads incoming light_ID data | function onLightCharacteristicRead(data, isNotification) {
if (isNotification) {
//console.log('idCharacteristic notification value: ', data.readInt8(0));
light_id = data.readInt8(0);
light_update();
} else {
//console.log('idCharacteristic read response value: ', data.readInt8(0));
light_id = d... | [
"@route(GET, '/hue/light/:id')\n onGetLightInfo(request, response, light_id) {\n return this.service_.getLightById(light_id).then(light => {\n if (!light)\n throw new Error('Invalid light supplied');\n\n response.end(JSON.stringify({\n id: light.getId(),\n name: light.getName(),\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
client no longer belongs to a classroom; unassign classroomid and permissions | function leaveClassroom(id) {
delete clients[id].classroomid;
delete clients[id].permissions;
} | [
"function exitClassroomClient(id) {\n\tvar classroomid = clients[id].classroomid;\n\t// you can only remove the student from the classroom if the classroom exists\n\tif (classroomid && classrooms[classroomid]) {\n\t\tdelete classrooms[classroomid].clients[id];\n\t}\n}",
"function exitClassroomStudent(id) {\n\t// ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clean phone number from any alphabet | function cleanPhoneNum()
{
var v = phoneNum.value.replace(/\D+/gi, "");
if(v.length>10)
v=v.substring(0,10);
if(v.length>3)
{
v = v.substring(0, 3)+ "-" + v.substring(3);
}
if(v.length>7)
{
v = v.substring(0, 7)+ "-" + v.substring(7);
}
phoneNum.v... | [
"function reformat_phone(str) {\n return str.replaceAll(/[^0-9]/g, \"\");\n}",
"function sanitizePhone(phone) {\r\n // remove international code\r\n if (phone.substring(0, 2) == \"1-\") {\r\n phone = phone.substring(2, phone.length);\r\n }\r\n //strip anything that's not a number\r\n phon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replaces the current selection with the given set of layers. | function setSelection(context, layers) {
context.document.currentPage().changeSelectionBySelectingLayers(null);
layers.forEach(function (l) {
return l.select_byExpandingSelection_(true, true);
});
} | [
"function setSelectedLayers( layerIndexesOrNames ) {\r\t// first select the first one\r\tsetSelectedLayer( layerIndexesOrNames[0] );\r\r\t// then add to the selection\r\tfor ( var i = 1; i < layerIndexesOrNames.length; i++) {\r\t\taddSelectedLayer( layerIndexesOrNames[i] );\r\t}\r}",
"function setSelectedLayers( ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates the 27 cubes that make up the rubiks cube | function initCubes(){
for(var i = 0; i<numCubes; i++){
for(var j = 0; j<rubikSize*rubikSize; j++){
for(var k = 0; k<rubikSize; k++){
var newCube = cubeModel();
newCube.scale(0.25, 0.25, 0.25);
newCube.translate(cubeOffset[i%3], cubeOffset[j%3], cubeOffset[k%3]);
cubes.push(newCube);
poi... | [
"function initializeCubePieces() {\n\n\t//very center of cube\n\tallCubePieces.push(new cubePiece(pieceType.CENTER, xPos.MID, yPos.MID, zPos.MID, []));\n\n\t//middles of each side\n\tallCubePieces.push(new cubePiece(pieceType.MIDDLE, xPos.MID, \tyPos.MID, \t zPos.FRONT, [colors.W, sides.FRONT]));\n\tallCubePieces.p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
receive dat parameters via OSC (ie from ML agent or Processing) | function setDatParameter(params){
// console.log( Date(Date.now()) + " [via OSC] " + params[1] + "->" + params[2] + ": " + params[3] + " (for " + params[4] +")");
var data = { behaviour: params[1], name: params[2], value: params[3], target: params[4] };
sendDatOSC(data);
} | [
"function receiveOsc(address, value) { \n console.log(\"received OSC: \" + address + \", \" + value);\n if (address == '/showText') { //receive text to display\n textMessage = value[0];\n }\n if (address == '/enableText'){ //enable/disable text display\n if (value[0] == 1) {\n e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds the closest entity to another entity. | findClosestInRange(e,range){ // O(N^2)
let ents = util.findInRange(e,range);
if(ents.length < 1){return null;}
let min = util.distance(ents[0],e);
let ent = ents[0];
if(min < 0) min = -min;
for(let i=1;i<ents.length;i++){
let dist = util.distance(ents[i],e);
if(dist < 0) dist = -dist;
if(min >... | [
"function nearestEntity (type) {\n let id;\n let entity;\n let dist;\n let best = null;\n let bestDistance = null;\n for (id in bot.entities) {\n entity = bot.entities[id];\n if (type && entity.type !== type) continue;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates and returns an array with the ids of all the sites in the data array passed as a parameter | function getIDArray(data){
var ids = [];
for(var i in data){
var site = data[i];
ids.push(site.siteID);
}
return ids;
} | [
"function getCorrectData(sites){\r\n\tvar data = [];\r\n\t\r\n\tfor(var i in sites){\r\n\t\tvar id = Number(sites[i].siteID);\r\n\t\tvar lat = Number(sites[i].siteLat);\r\n\t\tvar lng = Number(sites[i].siteLong);\r\n\t\tvar name = sites[i].siteName;\r\n\t\t\r\n\t\tdata.push({siteID: id, siteLat: lat, siteLong: lng,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
mouseover function for getting MP info | function mpMouseover() {
// Get mouse positions from the main canvas.
var mousePos = d3.mouse(this)
// Pick the colour from the mouse position.
context_hidden.save()
var col = context_hidden.getImageData(mousePos[0] * ratio, mousePos[1] * ratio, 1, 1)
.data
c... | [
"function mpMouseover() {\n // Get mouse positions from the main canvas.\n var mousePos = d3.mouse(this)\n // Get the data from our map!\n if (typeof (transform) !== \"undefined\") {\n var nodeData = quadtree.find((mousePos[0] - margin.left - transform[\"x\"]) / transform[\"k\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to generate a YouTube video to be displayed on the page | generateVideo( video ) {
// Add video for trailer to page by embedding it
const showVideo = document.getElementById( "movieTrailer" );
const youtube = showVideo;
const videoId = video;
// Find YouTube thumbnail using given id
const img = document.createElement( "img" );
... | [
"function makeYoutube() {\n\n var toAdd = {_page: vm.pageId, type: \"YOUTUBE\", width: \"100%\", url: \"\", order: 0};\n\n navigate(toAdd);\n\n }",
"async function makeVideo(id){\n const videoUrl = `https://www.youtube.com/embed/${id}`\n\n const video = `<iframe class=\"embed-re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
separate terms from wildcard since we handle them differently | static isTerm(term) {
return term.termType !== undefined && term.termType !== 'Wildcard';
} | [
"function processWildcard()\n{\n\tif( this.value.length > 0)\n\t{\n\t\tif( this.value.substr(this.value.length - 1,1) == '*' )\n\t\t{\n\t\t\taddCriteria(this, this.value);\n\t\t}\n\t\telse\n\t\t{\n\t\t\taddCriteria(this, this.value + '*');\n\t\t}\n\t}\n}",
"function searchTerm(terms,fin)\n{\n var parts = terms... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format the response from SLPDB into an object. | async formatToRestObject (slpDBFormat) {
// console.log(`slpDBFormat.data: ${JSON.stringify(slpDBFormat.data, null, 2)}`)
const transaction = slpDBFormat.data.u.length
? slpDBFormat.data.u[0]
: slpDBFormat.data.c[0]
// const inputs = transaction.in
// const outputs = transaction.out
c... | [
"async formatToRestObject (slpDBFormat) {\n _this.BigNumber.set({ DECIMAL_PLACES: 8 })\n\n // console.log(`slpDBFormat.data: ${JSON.stringify(slpDBFormat.data, null, 2)}`)\n\n const transaction = slpDBFormat.data.u.length\n ? slpDBFormat.data.u[0]\n : slpDBFormat.data.c[0]\n\n // const inputs ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper to build before and after body lines | function getBeforeAfterBodyLines(callback) {
return pushOrConcat([], splitNewlines(callback));
} | [
"function getBeforeAfterBodyLines(callback){return pushOrConcat([],splitNewlines(callback));}",
"function getBeforeAfterBodyLines(callback) {\n return pushOrConcat([], splitNewlines(callback));\n }",
"function getBeforeAfterBodyLines(callback) {\n \treturn pushOrConcat([], splitNewlines(callback)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
install Bundler 1.17.3 (or thereabouts) Ruby 2.6 is first major Ruby to ship with bundle, but it also ships with incompatible 1.17.2 version that must be upgraded to 1.17.3 for some test environments/suites to function correctly. | async function installBundler(rubyVersion) {
core.startGroup(`Install bundler`)
const rubyBinPath = `${rubyPath(rubyVersion)}/bin`
if (!fs.existsSync(`${rubyBinPath}/bundle`)) {
await gemInstall('bundler', '~> 1.17.3', rubyBinPath)
}
else {
await execute('bundle --version').then(res => { bundleVersi... | [
"async function installBundler(rubyVersion) {\n core.startGroup(`Install bundler`)\n\n const rubyBinPath = `${rubyPath(rubyVersion)}/bin`\n\n if (!fs.existsSync(`${rubyBinPath}/bundle`)) {\n await exec.exec('gem', ['install', 'bundler', '-v', '~> 1', '--no-document', '--bindir', rubyBinPath])\n }\n\n core.e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates Google Maps map and plots GROW sensor markers on map | function initMap(data) {
// Create the map centered on the United Kingdom.
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: {lat: 55.3781, lng: 3.4360},
mapTypeId: 'terrain'
});
// Image to use for map pinpoint icon
var image = {
url: ... | [
"function plotLocations() {\n mapProp = {\n center:new google.maps.LatLng(37.7600, -122.4167),\n zoom:12,\n mapTypeId:google.maps.MapTypeId.ROADMAP\n };\n map = new google.maps.Map(document.getElementById(\"googleMap\"),mapProp);\n geocoder = new google.maps.Geocoder();\n infoWindow = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Task 7 calculate the Harmonized Sales Tax (HST) for a value in cents. Return the value of a purchase with HST (13%) added to cents arguments. `cents` a Number of cents. If cents is missing (undefined/null) assume 0. If the cost in cents is exactly 75 cents, apply no HST on the purchase. Throw away any fractional cents,... | function addHST(cents) {
cents = cents || 0;
if (cents === 75) {
return cents;
}
cents = cents + (cents * 13) / 100;
return Math.floor(cents);
} | [
"function fmtHertz(cents, decimalPlaces, trailingZeros) {\n if (trailingZeros) { return cents.toFixed(decimalPlaces) + \"Hz\"; }\n else { return +cents.toFixed(decimalPlaces) + \"Hz\"; }\n}",
"function exactChange(cents) {\n let x = cents;\n let o = x % 5;\n let f = 0;\n let t = 0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Switches between two styles depending on a condition | function toggleStyle(classList, condition, trueStyle, falseStyle) {
if (condition) {
classList.remove(falseStyle);
classList.add(trueStyle);
} else {
classList.remove(trueStyle);
classList.add(falseStyle);
}
} | [
"function StyleLogic() {\n }",
"switchStyle(style) {\n const saved = this._style;\n this._style = style;\n return saved;\n }",
"calcStyle() {\n this.style = '';\n if ( this.percent > 0 ) this.style = 'gain';\n if ( this.percent < 0 ) this.style = 'loss';\n }",
"function Styl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
opens the modal that allows a user to sign up | function openSignUpModal() {
$('#sign-up-modal').modal();
} | [
"function signup() {\n $('#signup').modal('show');\n}",
"function showModal() {\n setVisible(true);\n setSignUp(false);\n }",
"function createAccountClick() {\n $(\"#modal\").modal({backdrop: 'static', keyboard: true});\n $(\"#modal\").modal(\"show\");\n }",
"signUp() {\n const p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Internal global with common properties and Sentry extensions The code below for 'isGlobalObj' and 'GLOBAL_OBJ' was copied from corejs before modification corejs has the following licence: Copyright (c) 20142022 Denis Pushkarev Permission is hereby granted, free of charge, to any person obtaining a copy of this software... | function isGlobalObj(obj) {
return obj && obj.Math == Math ? obj : undefined;
} | [
"function isGlobalObj(obj) {\n return obj && obj.Math == Math ? obj : undefined;\n}",
"function isGlobalObj(obj) {\n return obj && obj.Math == Math ? obj : undefined;\n }",
"function $rt_getGlobal(obj, propStr)\n{\n // Try reading this as a normal property\n try\n {\n return $rt_getPropCach... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Construct a new tear off request message. | function TearOffMessage(item, node, clientX, clientY) {
_super.call(this, 'tear-off-request');
this._item = item;
this._node = node;
this._clientX = clientX;
this._clientY = clientY;
} | [
"destroy() {\n this.bus.removeEventListener(\n 'message',\n this[privateMethods.onReceiveMessage],\n );\n this.actions.length = 0;\n this.target = null;\n }",
"function ReleaseAddressRequest() {\n _classCallCheck(this, ReleaseAddressRequest);\n\n ReleaseAddressRequest.initialize(this)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function clickmovetake will click if possible the Countryless button | function clickmovetake(ctrname){
try{
if(Territori[ctrname].jugador==Jugador['jugador'+Turn.turn]){
document.getElementById(ctrname+'less').click();
}
}
catch (err){}
} | [
"manageClick(){\n\t\tif(game.state === 'menu'){\n\t\t\tgraphics.drawPlayerSelection()\n\t\t\tsetTimeout(() => {\n\t\t\t\tgame.state = 'playerSelection'\n\t\t\t},50)\n\t\t}\n\n\t\tif(game.state === 'playerSelection'){\n\t\t\tgame.launch()\n\t\t}\n\t}",
"click_TVShows_Menu(){\n this.TVShows_Menu.waitForExist... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ChordLengthParameterize : Assign parameter values to digitized points using relative distances between points. | function ChordLengthParameterize(d, first, last)
{
var i;
var u = []; /* Parameterization */
u[0] = 0.0;
for (i = first + 1; i <= last; i++)
{
u[i - first] = u[i - first - 1] + VDist(d[i], d[i - 1]);
}
for (i = first + 1; i <= last; i++)
{
u[i - first] = u[i - first] / u[last - firs... | [
"function ChordLengthParameterize(d, first, last)\n // Vector2\t*d;\t\t\t/* Array of digitized points */\n // int\t\tfirst, last;\t\t/* Indices defining region\t*/\n {\n //var u;\t\t\t/* Parameterization\t\t*/\n\n var u = new Array(last - first + 1);\n\n u[0] = 0.0;\n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
posts first element in pointQueue array to sns instance, chaining on a tail call to repeat the process (via setTimeout) once a response returns | pointQueueIdleDispatch(publisher, snsInstance, pointQueue)
{
if(pointQueue.length > 0)
{
var point = pointQueue.shift();
var params = publisher.getMessageParameters(point);
/*
sns.publish(params, function(err, data) {
if (err) console.log(err, err.stack... | [
"pointQueueIdleDispatch(publisher, sqsInstance, pointQueue)\n {\n\n if(pointQueue.length > 0)\n {\n var point = pointQueue.shift();\n\n var params = publisher.getMessageParameters(point);\n\n sqsInstance.sendMessage(params, function(err, data)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Operation: $pop Removes the first or last item of an array. | function arrayPop(doc, field, firstLast) {
// Requires(doc != undefined)
// Requires(field != undefined)
// Requires(firstLast == -1 OR firstLast == 1)
var navResult = navigateTo(doc, field, false);
doc = navResult[0];
fiel... | [
"function pop(array) {\n var newLength = array.length - 1;\n var lastElement;\n\n if (array.length === 0) {\n return undefined;\n }\n\n lastElement = array[newLength];\n array.length = newLength;\n return lastElement;\n}",
"function applyPop(array) {\n\t// create a popped variable\n\tlet popped;\n\t// a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The only reason to tick Thing directly is convenient logging. | tick() {
console.debug(`Ticking <${this.uuid}>`, this);
this.ticks_epoch += 1;
} | [
"function Tick() {\n\t\tthrow \"Tick cannot be instantiated.\";\n\t}",
"function tick() {\n\n }",
"tick() {\n this.setBeatNum(this.beatNum + 1);\n console.log(\"tick...\");\n }",
"function tick(brane){\n if(brane.tick){\n brane.state = brane.tick(brane.state);\n }\n}",
"tick... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets the font attributes of checked elements | getSelectedFontElementAttributes() {
// gotofont
// getCheckElementFontObject
const findIfHasSelectChoice = (element) => {
let hasSelectChoice = false;
_.each(Object.keys(element.document_field_choices), eachIndex => {
if (element.document_field_choices[eachIndex].val === 'inputFieldValu... | [
"get fontStyle() {}",
"function changeElementsFont(font) {\n console.log(\"entered changeElementsFont with \"+font);\n \n //check Header Tags checkbox -- h4-cb\n if(document.getElementById(\"h4-cb\").checked) {\n $(\"h1, h2, h3, h4, h5, h6\").css('font-family',font);\n $(\"#fontDIVh3\").... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
benchmark construct piston and see how long it takes to resolve, displace each point randomly have it construct many pistons | makePiston(startID) {
let randomPoint = (oldID) => {
let stringID = oldID.toString();
let x = Math.floor(Math.random() * 100);
let y = Math.floor(Math.random() * 100);
//console.log(intID);
return new Point({x, y}, this.solver, stringID)
}
let intID = (startID === undefined) ? this.state.ID... | [
"function points() {\n for (var i = 0; i < 1000; i++) {\n allPoints.push(middlePointF(allPoints[allPoints.length - 1], randomVert()))\n }\n}",
"function observeConstruction(n, p, k) {\n if (arguments.length < 3) k = 1;\n for (var i = 0, sum = 0; i < k; ++i) {\n var a = d3.range(n).map(function() { retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Execute import of the layer without statistics and mapping of the layer. It is useful mainly for uploading the layers which should be used as analytical units. | importLayerWithoutMapping(request, response) {
logger.info('LayerImporterController#importLayerWithoutMapping Body: ', request.body);
this.getImportInputs(request).then(inputs => {
this._layerImporter.importLayerWithoutMapping(inputs);
response.send(this._layerImporter.getCurrentImporterTask());
}).catch(e... | [
"importLayer(request, response) {\n\t\tlogger.info('LayerImporterController#importLayer');\n\n\t\tthis.getImportInputs(request).then(inputs => {\n\t\t\tthis._layerImporter.importLayer(inputs);\n\t\t\tresponse.send(this._layerImporter.getCurrentImporterTask());\n\t\t}).catch(error => {\n\t\t\tresponse.send({\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Form to create new card with word and definition | function NewCardForm({ handleCreate }) {
const currentUser = useContext(UserContext);
const [formData, setFormData] = useState({ word: '', defn: '' });
function handleChange(evt) {
let { name, value } = evt.target;
setFormData((oldformData) => ({ ...oldformData, [name]: value }));
}
return (
<Fo... | [
"function generateCard() {\r\n var inputs = getInputs();\r\n var occasion = inputs['occasion'];\r\n var name = htmlEntities(inputs['name']);\r\n \r\n // Add the title.\r\n var cardTitle = makeCardTitle(occasion, name);\r\n $('.cardTitle').html(addToDiv(cardTitle));\r\n \r\n // Add the message.\r\n var mes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when game end dialog close reset game | function handleGameEndDialogClose() {
setGameEndDialogOpen(false);
setCurrentRound(1);
setScore(0);
} | [
"function newGame() {\r\n endModal.close();\r\n resetGame();\r\n }",
"endGame() {\n if (this.game) {\n this.game = null\n\n this.status = \"IN_MENU\"\n this.sendLobbyUpdateToAll()\n }\n }",
"function endGame() {\n clearInterval(scorePanel.intervalManager);\n showCongratulationModa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the add button is clicked this will call all of the validator functions to make sure everything is good to go. It will then submit the new or edited client. | function addButtonClicked () {
if (!validateName()) return;
if (!validatePhone()) return;
if (!validateZip()) return;
var newClient = {
name: $("#name").val(),
company: $("#company").val(),
email: $("#email").val(),
phone: parseInt($("#phone").val()),
addr1: $("#addr1").val(),
addr2: ... | [
"function add(){\n $(\"#client-form\").submit(function( event ) {\n event.preventDefault();\n $(\"#save-client\").html(\"<img src='/img/content/loading.gif' width='25' />\"+BowsManager.copies.loading);\n var params = $(\"#client-form\").serializeForm();\n $.ajax({\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates sublevel choices with step selected from step modal | function UpdateChoiceStep() {
var sublevel = document.getElementById("hdnModalStepSublevelToUpdate").value;
var choice = document.getElementById("hdnModalStepChoiceToUpdate").value;
var slctAllSteps = document.getElementById("slctAllSteps");
var option = slctAllSteps.options[slctAllSteps.selectedIndex]... | [
"function updateSteps(){\n StepsSrv.getSteps($scope.experimentId)\n .then(\n function(success){\n vm.steps = orderBy(success.data.steps, 'name', false);\n vm.selectedStep = vm.steps[0];\n },\n function(error){\n vm.error = error.data;\n });\n }",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Append a new page to the already visible pieces. Used in infinite scroll mode. | function appendPage() {
if (currentPage+1 >= nbPages) return;
var end = $("#pieces-end")[0];
var rect = end.getBoundingClientRect();
if (rect.top < $(window).height()) {
// Spinning icon is visible, append next page.
displayPieces(currentPage+1);
}
} | [
"function appendPages() {\n page.appendChild(gridPage);\n gridPage.appendChild(leftPage);\n gridPage.appendChild(rightPage);\n rightPage.appendChild(rightTopPage);\n rightPage.appendChild(rightBottomPage);\n}",
"function append_page(current_pages, page) {\n for (var i=0; i<current_pages.length; i++) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
let the mouse click on shape canvas | function clickShape() {
idName('shape-layer').style.pointerEvents = 'auto';
className('upper-canvas')[0].style.pointerEvents = 'auto';
idName('paint-layer').style.pointerEvents = 'none';
} | [
"function canvasClick(e) {\n\tblockus.mouseClicked();\n}",
"function mouseShape()\n {\n fill(106,90,205);\n circle(mouseShapeX, mouseShapeY, 35);\n }",
"handleContextClick(args){\n if(this.shapeSelectionEnabled) {\n this.selectShape(args);\n }\n }",
"handleCanvasClick(e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set Master Seed This is the user's primary (private key) seed. | setMasterSeed (state, _seed) {
/* Update master seed. */
state.masterSeed = _seed
} | [
"if (\n seed === '' &&\n (!rawKeys.master || (!rawKeys.master.xpriv && !rawKeys.master.xpub))\n ) {\n throw new Error('Missing Master Key')\n }",
"function setSeed(newSeed) {\n seed = newSeed;\n }",
"function setSeed() {\n // cleanup ...\n var arg2 = process.argv[2];\n if (arg2) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================================// spawnNewBossBullet() ================================// spawns a new boss "bullet" when called, and pushes it into the enemy array | function spawnNewBossBullet() {
for (let e = enemies.length; e >= enemies.length - 1; e--) {
if (enemies[e] instanceof Boss) {
let bossX = enemies[e].x;
let bossY = enemies[e].y;
let bossSize = enemies[e].size;
let bossBullet = new BossBullet(bossBulletImg[int(random(bossBulletImg.length))... | [
"function spawnNewBoss() {\n //announce that the boss is on its way\n bossHello.play();\n // start timer for the boss bullets\n resetBossBulletTimer(bossBulletInterval);\n //create boss & unshift\n let boss = new Boss(random(0, width), random(0, cockpitVerticalMask), width * .5 / 100, 1);\n enemies.unshift(b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setup a listener to get user input for the number of angles | function getAngles() {
var newAngle = prompt("Enter the number of angles to sweep out the surface:", angles);
console.log(typeof newAngle);
newAngle = parseInt(newAngle);
console.log(typeof newAngle);
if (newAngle != null && newAngle >= 4) {
angles = newAngle;
draw();
}
} | [
"function initWindowListeners() {\n document.getElementById(\"slider\").addEventListener(\"input\", function(e) {\n lightAngle = document.getElementById(\"slider\").value;\n })\n}",
"function setAngleToConvert() {\n //angle is the integer version of the text inside the input that called this functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Numbers need emit methods because they also take type args | emitNumber(ctx, arg) {
return Number(arg);
} | [
"function _BinaryNumberExpressionEmitter() {\n}",
"function _NumberLiteralExpressionEmitter() {\n}",
"function Num() {}",
"function Numbers() {}",
"function NumberType() {\n}",
"function _IntegerLiteralExpressionEmitter() {\n}",
"function Num(x){\n this.value = x;\n }",
"function IntegerType() {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search user moves by door id (terminal) and user id | function search_user_moves(user,door){
$("#users-result-list").hide();
$("#users-message").hide();
$.ajax({
url: app_url + "doors/doors/searchEventByUsersAndAccess",
type: "POST",
data: {'user_id': user, 'door_name': door},
dataType: "json",
... | [
"function travel(user,destinationID){\n // Check if move is valid.\n // If the player is adventuring, they can't move.\n if(user.local.isAdventuring){\n return console.log(user.local.characterName + \" is unable to move: adventuring.\");\n }\n // Find the room the user is in.\n var currRoom = getUserRoomRe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When a key is pressed, play the assigned sound | function playSoundKey(e) {
var code = e.keyCode;
playSound(code);
} | [
"function keyPressed () {\n if (key === '1') {\n sound1.play();\n } else if (key === '2') {\n sound2.play();\n } else if (key === '3') {\n sound3.play();\n } else if (key === '4') {\n sound4.play();\n } else if (key === '5') {\n sound5.play();\n }\n}",
"function playAudioKey(event) {\n swi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if the status of the mapper is idle | function idle(){
return M.status == 'idle';
} | [
"isIdle() {\n return this._isActiveIdlePeriod(0);\n }",
"function isIdle(request) {\n return request.kind === \"idle\";\n}",
"get idle ()\n {\n return this.waiting === this.entities.length;\n }",
"idleChecker() {\n this.idleTime += 1\n if (this.idleTime > MAX_IDLE_TIME && !this.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Seed a new cell at a random position. Return 0 if failed, ID of new cell otherwise. Try a specified number of times, then give up if grid is too full. The first cell will always be seeded at the midpoint of the grid. | seedCell( kind, max_attempts = 10000 ){
let p = this.C.midpoint
while( this.C.pixt( p ) != 0 && max_attempts-- > 0 ){
for( let i = 0 ; i < p.length ; i ++ ){
p[i] = this.C.ran(0,this.C.extents[i]-1)
}
}
if( this.C.pixt(p) != 0 ){
return 0 // failed
}
const newid = this.C.makeNewCellID( kind )
... | [
"seedRandomly() {\n for (let i = 0; i < this.count; i ++) {\n if (this.cells[i] === 0) {\n this.cells[i] = Math.random() < .1 ? 1 : 0;\n }\n }\n }",
"function seedBoard() {\n let result = iota(CELLS, BLANK, 0) // empty board\n const firstRow = REGION_CE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
let index = this.state.slideIndex; showSlides(index); next/prev controls | plusSlides(n){
showSlides(this.state.slideIndex)
} | [
"function currentSlide(n) { //aktuelle Seite\r\n showSlides(slideIndex= n);\r\n}",
"function currentSlide(n) {\n showSlides(slideIndex = n);\n }",
"function currentSlide(n) {\n // Set slideIndex based on dot clicked and display\n showSlides(slideIndex = n);\n}",
"function currentSlide(n) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
avg() should return an EmptySortedList exception if there are no elements should return the average of elements in the list | avg() {
if(this.items.length > 0)
return this.sum() / this.items.length
else
throw new Error('EmptySortedList')
} | [
"average() {\n if (this.length === 0) {\n throw new Error(\"EmptySortedList\")\n } else {\n return (this.items.reduce((prev, curr) => prev + curr)) / this.length;\n }\n }",
"function getAverage(list){\n return getSum(list)/list.length\n}",
"average() {\n // what is the average value... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
; public static const EMBEDDED_FOOTER:ToolbarSkin = | function EMBEDDED_FOOTER$static_(){ToolbarSkin.EMBEDDED_FOOTER=( new ToolbarSkin("embedded-footer"));} | [
"function FOOTER$static_(){ToolbarSkin.FOOTER=( new ToolbarSkin(\"footer\"));}",
"function EMBEDDED_FOOTER_GRID_100$static_(){ToolbarSkin.EMBEDDED_FOOTER_GRID_100=( new ToolbarSkin(\"embedded-footer-grid-100\"));}",
"function HEADER$static_(){ToolbarSkin.HEADER=( new ToolbarSkin(\"header\"));}",
"function WID... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will subtract a certain amount of Coin and send User BCH instead. username: who asks to withdraw BCH. toAddress: The address that the user input to receive BCH for this request. It is legacy format. coinAmount: Coin to subtract from the user's account For example: withdrawBCH('8','mhREfUGuqNTpQSuPVG234kt6... | function withdrawBCH(username, toAddress, coinAmount,callback) {
DBSERVICE.getUserByUsername(username, function (err1, data1) {
if (err1) {
return callback(err1);
}
else {
var newCoinValue = data1[0].coin - coinAmount;
var user = data1[0];
user... | [
"function transfer(username,to,amount,callback){\n hub.GetDepositAddress({userId: username, includeChecksum: true},(err,res)=>{\n\tif (err){\n\t console.log(\"FAILED TO GET BALANCE FOR THIS USER\")\n\t console.log(username)\n\t console.log(err)\n\t}else{\n\t hub.UserWithdraw({userId: username, payout... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Two way switch Extends mxShape. | function mxShapeElectricalTwoWaySwitch(bounds, fill, stroke, strokewidth)
{
mxShape.call(this);
this.bounds = bounds;
this.fill = fill;
this.stroke = stroke;
this.strokewidth = (strokewidth != null) ? strokewidth : 1;
} | [
"function mxShapeElectricalTwoPositionSwitch2(bounds, fill, stroke, strokewidth)\n{\n\tmxShape.call(this);\n\tthis.bounds = bounds;\n\tthis.fill = fill;\n\tthis.stroke = stroke;\n\tthis.strokewidth = (strokewidth != null) ? strokewidth : 1;\n}",
"function mxShapeElectricalManualSwitch2(bounds, fill, stroke, strok... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves and displays available webinars. | function loadWebinars() {
$.get('//www.zendesk.com/app/webinar/list')
.done(function(body) {
var content = body.map(getWebinarButton);
var $webinars = $('.available-webinars');
$webinars.html(content);
webutils.track('Demo - Lead - Gotowebinar - List shown');
})
.fa... | [
"function getDrivers() {\n $.get(\"/api/drivers\", renderDriverList);\n }",
"get webs() {\r\n return new Webs(this);\r\n }",
"function webScraper() {\n\tvar urlBase = 'http://inuti.karolinska.se'; //added to the relative paths scraped from the webpages\n\n\t//Counters for listitems\n\tvar numAcute... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
createTab(id, node, flags, tree): A method to create a hopscotch tab object and append it to 'tabs'. The only manditory parameter is 'id', but without a node this function is more or less useless. If the tab is lost (The user has not yet anchored the tab to the tree), the temporary tracking tree root can also be specif... | function createTab(id, node, flags, root) {
tabs[id] = {node: node, watching: node, flags: flags, root: root};
} | [
"function createTab() {\n const tab = document.createElement('main');\n tab.setAttribute('id', 'tab');\n return tab;\n}",
"createTabAfter({ state }, tabId) {\n // Get target tab\n const targetTab = state.tabsMap[tabId]\n if (!targetTab) return\n\n // Get index and parentId for new tab\n le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Serializes the default content type | serializeDefaultContentType(writer, extension, contentType) {
writer.writeStartElement(undefined, 'Default', undefined);
writer.writeAttributeString(undefined, 'Extension', undefined, extension);
writer.writeAttributeString(undefined, 'ContentType', undefined, contentType);
writer.writeE... | [
"_getFullContentType() {\n if (!this.contentType) {\n throw new Error('Content type not specified. When inheriting AbstractEnvelope be sure to override the contentType property.');\n }\n\n return this.contentType + this._serializer.contentTypeSuffix;\n }",
"get contentType() {\r\n return new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
alerts a list of people | function displayPeople(people) {
if (people.length > 1) {
alert(people.length + " results found:\n\n" + people.map(function (person) {
return person.firstName + " " + person.lastName + ":\n ID Number: " + person.id;
}).join("\n\n"));
} else if (people.length === 0) {
alert("No results found.");
... | [
"function displayPeople(people){\n\n let peopleList = people.map(function(person){return person.firstName + \" \" + person.lastName;});\n alert(\"We found the \" + people.length + \" people below. Please add another trait to your search string during your initial search to narrow down your results.\\n\" + peo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
24 Write a function called resetCounter that will reset the previuos function and return the number before reset and a string say that the counter reset Ex: counter() => 1 Ex: counter() => 2 Ex: counter() => 3 Ex: resetCounter() => 3 and the counter reset now Ex: counter() => 1 Ex: counter() => 2 Ex: resetCounter() => ... | function resetCounter() {
console.log(`${num} and the counter reset now`);
num = 1;
} | [
"function resetCounter() {\r\n let preCounter = --currentCounter;\r\n currentCounter = 0;\r\n return `${preCounter} and the counter reset now`;\r\n}",
"function resetCounter() {\n\tvar oldValue = counter.num;\n\tcounter.num = 0;\n\treturn oldValue;\n}",
"function resetCounter()\n{\n // var x=0;\nx=0;\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates the JSON 'task' which is used in the function addTask() for saving the data in the local storage | function gererateTaskObject() {
let title = document.getElementById("title").value;
let urgency = document.getElementById("urgency").value;
let importance = document.getElementById("importance").value;
let date = document.getElementById("date").value;
let discription = document.getElementById("descr... | [
"function createTask() {\n let task = {\n id: Date.now(),\n text: taskItem.value,\n done: false }\n let tasksArray = JSON.parse(localStorage.getItem('tasksArray'));\n tasksArray.push(task);\n pushToStorage(tasksArray);\n addTask(task);\n}",
"async function createTask() {\n let title = docum... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if area of rectangles is "almost equal" (with respect to some treshold) | function checkAreasRatio(rects, b, e, treshold){
if(rects.length < 3){
return false;
}
treshold = treshold || 0.15;
var ratio = rects[b+1].area/rects[b].area;
for(var i = 1; i < e-b; ++i){
if(Math.abs(rects[b+i+1].area/rects[b+i].area - ratio)/ratio > treshold || isPolyInPoly(rect... | [
"function doesRectfit(rect, area){\n return rect.left > area.left &&\n rect.right < area.right &&\n rect.top > area.top &&\n rect.bottom < area.bottom;\n }",
"function inRects() {\n //Each if represents one rectangle \n if (mouseX < coord1 + lenH \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method to decode FileRequestServlet response on the client side | function decodeFileRequest(data){
if(obfuscation==1){
var json = data;
json.content = decodeURIComponent(escape(window.atob(json.content)));
json.fileKey = decodeURIComponent(escape(window.atob(json.fileKey)));
return json;
}
else{
return data;
}
} | [
"_parseResponse(response){return new Promise((resolve,reject)=>{if(response){let responseHandler={\"text/plain\":r=>{r.text().then(text=>{resolve(text)}).catch(err=>{reject(err)})},\"text/html\":r=>{r.text().then(text=>{resolve(text)}).catch(err=>{reject(err)})},\"application/json\":r=>{r.json().then(function(json)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove a completed test from the list that we store in a scratch area of the spreadsheet. | function removeTestFromPendingList(test) {
var range = ss.getRangeByName(WPT_PENDING_TESTS);
var values = range.getValues();
for (var row = 0; row < values.length; row++)
if (values[row][0] == test.sheetName)
values[row] = ['', ''];
Logger.log('in removeTestFromPendingList, setting: '); Logger.... | [
"function removeCompleted(){\n return store.query({completed: true}).forEach(function(item){\n remove(item.summary).otherwise(saveError); //store.remove(item[store.idProperty])\n });\n }",
"function removeCompleted() {\n const activeList = bookMain.getActiveList();\n if(activeList\n &... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compare appDefId with current and legacy wix code app def ids needed for old automation site | function isLegacyWixCodeAppDefId(rendererModel, appDefId) {
return isGuid(appDefId) && !hasAppWithAppDefId(rendererModel.clientSpecMap, appDefId)
} | [
"function checkAppCofig()\r\n{\r\n var appDefinition = document.getElementById(\"appdef\");\r\n \r\n // Check if appObj is defined. If not try with a new hardcoded value\r\n if (typeof appObj === \"undefined\")\r\n {\r\n loadScript(\"./defs/app.json.js\", loadDefinitions);\r\n }\r\n else... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |