query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
fillTableData_CurrentRowElement : Fills the current Element value in Table Cell | function fillTableData_CurrentRowElement(currentRowElementsArray, currentIndex, currentElement) {
if (currentElement != undefined && currentElement != null) {
currentRowElementsArray[currentIndex].innerHTML = currentElement;
} else {
currentRowElementsArray[currentIndex].inne... | [
"function changeCurrentCell(tableRow) {\n tableRow.focus();\n tableRow.style.backgroundColor = \"#cbcbcb\";\n for (var i = 0 ; i < data.length; i++){\n if (currentRow != i){\n var deselectedRow = tableRows[i];\n if (deselectedRow ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method will set a simple value (ignoring type) with the given solrPropName in the solrRecord to the vprPropName field in the vprRecord. It verifies the existence of the field before attempting to set the solr value. solrRecord: The SOLR record that is being updated. solrPropName: The name of the SOLR property fiel... | function setSimpleFromSimple(solrRecord, solrPropName, vprRecord, vprPropName) {
if ((_.isObject(solrRecord)) && (_.isObject(vprRecord)) && (vprRecord[vprPropName] !== undefined) && (vprRecord[vprPropName] !== null)) {
solrRecord[solrPropName] = vprRecord[vprPropName];
}
} | [
"function setSimpleFromSimple(solrRecord, solrPropName, vprRecord, vprPropName) {\n if ((_.isObject(solrRecord)) && (_.isObject(vprRecord)) && (vprRecord[vprPropName] !== undefined) && (vprRecord[vprPropName] !== null)) {\n solrRecord[solrPropName] = vprRecord[vprPropName];\n }\n}",
"function setStri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the count of Creeps in the current room, grouped by roles | function creepsInRoom(room) {
"use strict";
const creepsInRoom = room.find(FIND_MY_CREEPS);
const count = {}
for (let role of roles) {
count[role] = _.sum(creepsInRoom, c => c.memory.role == role);
}
return count;
} | [
"roleCount(room) {\n var roleCount = Object.values(Game.creeps).reduce((obj, creep) => {\n if(creep.memory.origin == room.name || creep.memory.shardWide) {\n obj[creep.memory.role]++;\n if(creep.memory.working) { obj['Working']++; }\n else { obj['Slacki... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
I just create our initial table all one of em | function setupTable(tx) {
tx.executeSql("CREATE TABLE IF NOT EXISTS setting(id INTEGER PRIMARY KEY,theme)");
tx.executeSql("CREATE TABLE IF NOT EXISTS levels(id INTEGER PRIMARY KEY,board_row_size INTEGER,board_col_size INTEGER,floor_details,tile_details,powerup_details,max_moves,completed,help_used INTEGER)");
... | [
"createTable(name, cols, constraints) {\n var table = new Table(name, cols, this);\n //this.tables[name] = table;\n this.query(CREATE_TABLE(name, cols,constraints))\n .then(() => table.emit(\"ready\"));\n return table;\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the global variables for sorting samples by name. | function set_sorted_names() {
// Before going on, create a separate list that has the
// sample ids sorted by name.
names_to_ids = {};
for (var id in proj.samples) {
names_to_ids[proj.samples[id].name] = id;
}
console.log(names_to_ids);
sorted_names = Object.keys(names_to_ids).sort();
console.log(so... | [
"function setGlobalVariables() {\n // generate variable names from the title of the document \n title = title.toLowerCase();\n var var1 = title + \"_eateryList\";\n var var2 = title + \"_donts\";\n // set the global varibles \n eateryList = window[var1];\n donts = window[var2];\n filteredLis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Highlight the path from a given node back to the central node. | function traceBack(node) {
if (node !== window.selectedNode) {
window.selectedNode = node;
resetProperties();
window.tracenodes = getTraceBackNodes(node);
window.traceedges = getTraceBackEdges(window.tracenodes);
// Color nodes yellow
const modnodes = window.tracenodes.map(i => nodes.get(i));
... | [
"function highlightPath(root, node, undo) {\n var n = node;\n var css;\n while (n !== root) {\n if (undo) {\n n.edgeToParent().removeClass(\"blueline\");\n\t } else {\n n.edgeToParent().addClass(\"blueline\");\n\t }\n n = n.parent();\n }\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~Functional program 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~8 / 4. Power of Two | power() {
var n = process.argv[2]
power = 1;
for (var i = 0; i < n; i++) {
console.log("2^" + i + " = " + power)
power = power * 2;
}
} | [
"function iGotThePower(n1,n2){\n console.log(Math.pow(n1,n2))\n}",
"function twoNumPower(n1,n2) {\n console.log(Math.pow(n1,n2);\n}",
"function secondPowerOfSum ( number1, number2 ){\n console.log( ( number1 + number2 ) ** 2 );\n}",
"function pow2(x, power, modulo) {\n let res = x;\n while (power--... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========== ATTRIBUTES ========== allocated_storage computed: true, optional: false, required: false | get allocatedStorage() {
return this.getNumberAttribute('allocated_storage');
} | [
"GetAllocatedSize() { return this.AllocatedSize; }",
"getStorageSize() {\r\n return this.storageSize;\r\n }",
"memory() {\r\n let size = 0;\r\n\r\n for (const item of this.spkeys) size += getValueSize(item);\r\n\r\n for (const item of this.data) size += getValueSize(item);\r\n\r\n return {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts data/metadata from pdf format. | async function extractPDFFile(input, output) {
let pdf = await pdfjsLib.getDocument({
data: input.array
});
// pdf files can have embedded properties; extract those
const meta = await pdf.getMetadata();
if (meta.info) {
if (meta.info.Author) {
output.author = meta.info.... | [
"_get_doc() {\n pdfjs.getDocument(this.source)\n .then((doc) => {\n this.num_pages = doc.numPages;\n this.doc = doc;\n this.doc.getMetadata()\n .then((metadata) => {\n this.push({\n numPages: this.num_pages,\n metadata: metadata\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
does the chain group have any readytoexecute scripts? | function check_chain_group_scripts_ready(chain_group) {
var any_scripts_ready = false;
for (var i=0; i<chain_group.scripts.length; i++) {
if (chain_group.scripts[i].ready && chain_group.scripts[i].exec_trigger) {
any_scripts_ready = true;
chain_group.scripts[i].exec_trigger();
chain_group.scripts[i].... | [
"function check_chain_group_scripts_ready(chain_group) {\n var any_scripts_ready = false;\n for (var i = 0; i < chain_group.scripts.length; i++) {\n if (chain_group.scripts[i].ready && chain_group.scripts[i].exec_trigger) {\n any_scripts_ready = true;\n chain_g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If serviceMap was loaded in the past this function updates the Consts>ServiceMap with the data before sending service request | function updateServiceMap() {
var serviceMapName = SUConsts[getServicesKey()].serviceMap.name;
var lastUpdateData = localStorage.getItem(lastUpdateDataPrefix + serviceMapName);
if (lastUpdateData && typeof lastUpdateData === 'string' && lastUpdateData.length > 0) {
setServiceData(se... | [
"onMapUpdated() {\n if (this.controller.isInitialized()) {\n this.refresh().then();\n }\n }",
"function parseServiceMap(responseJson) {\n if (!responseJson.services) {\n return;\n }\n var constsKey = getServicesKey();\n\n var length = responseJson... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parse the file system tree of repo visit the current folder segregate files and folder links recursively parse child folders create folder structure in local machine as available on repo | async function parseTree({ url, currPath, page }) {
console.log(`creating/recreating path: ${currPath}`);
await page.goto(url);
resolveFolder(currPath);
await page.waitForSelector(".Box-row");
const itemRows = await page.$$(".Box-row");
const folders = [];
// potential parallel spot
for (let i = 0; i <... | [
"function buildFolderStructure() {\n var path, current, child;\n $.each(g_files, function (name, file) {\n current = g_folders[g_homeFolderName];\n if (file['path'] == undefined || file.path == '/') {\n addToFolder(g_folders[g_homeFolderName], file);\n } else {\n pat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Actions: filterByTags function narrowing down search within category using filters | async function filterByTags() {
tags = agent.parameters.tag;
let request = {
method: 'POST',
headers: { 'x-access-token': token },
redirect: 'follow'
}
if (token === "" || typeof token === 'undefined') {
addAgentMessage("Sorry I cannot perform that. Please login first... | [
"function filterTags() {\n \n var selectedTagNames = _.chain(vm.tagCategories)\n .map(function(category) { return category.tags; })\n .flattenDeep()\n .filter(function(tag) { return tag.isSelected === true; })\n .map(function(tag) { return tag.name; })\n .value();\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If both skills in a new connection are acro, the user must be prompted for the type of the connection (indirect or direct). Function builds this prompt and pushes the view. Params: the skill being connected, the index of the stack being added to (if any) Post: the view stack is updated Sources referenced: | function promptForConnectionType(skill, stackIndex) {
var container = document.createElement("div");
var prompt = document.createElement("h3");
prompt.textContent = "Is your connection indirect or direct?";
container.appendChild(prompt);
var explanation = document.createElement("p");
explanati... | [
"function rewriteStack(stackIndex) {\n var stackDiv = document.getElementById(\"skills\").children[stackIndex];\n var stackText = stackDiv.children[1];\n stackText.textContent = \"\";\n var skills = routine.stacks[stackIndex].skills;\n \n for (var i = 0; i < skills.length; i++) {\n if (i > ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
render 3 products (images) | function renderTheProducts() {
leftProduct.renderProduct(leftProductImgElem, leftProductH2Elem);
centerProduct.renderProduct(centerProductImgElem, centerProductH2Elem);
rightProduct.renderProduct(rightProductImgElem, rightProductH2Elem);
} | [
"function renderProduct() {\n productGenerator();\n var productOne = selectedProductArray[0];\n var productTwo = selectedProductArray[1];\n var productThree = selectedProductArray[2];\n\n productImgOneEl.src = productsArray[productOne].src;\n productImgOneEl.alt = productsArray[productOne].name;\n productsAr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds missing json format at the beginning or moves it to the first position. The scan will use the first report format and to download other report formats it's required to get the job uuid from the json report. | function ensureJsonReportAtBeginning(reportFormats) {
if (!reportFormats.includes('json')) {
reportFormats.unshift('json');
}
if (reportFormats[0] !== 'json') {
const index = reportFormats.findIndex((item) => item === 'json');
reportFormats.splice(index, 1);
reportFormats.uns... | [
"overwriteJsonReport() {\n outputJsonSync(this.jsonReportFile, this.customJsonReport, { overwrite: true, spaces: 2, EOL: '\\r\\n' });\n }",
"function jsonformat(inputjson) {\r\n\r\n //create new list for final json output\r\n var outputjson = [];\r\n //loop for all issues\r\n //console.log(i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
long takes a short description and turns it into a full API object. | function long(obj) {
const [kind] = Object.keys(obj);
const tx = kinds[kind];
if (tx === undefined) {
throw new Error(`unknown kind: ${kind}`);
}
return tx(obj[kind]);
} | [
"shortDescription() {\n const shortDesc = this.description.length > 200 ? this.description.substring(0 ,200) + '...' : this.description;\n return shortDesc;\n }",
"getShortDescription(description) {\n var scope = this;\n var descriptionRender = scope.getFieldValue(scope._vfsFiel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return true when annotations are actively being fetched. | function isFetchingAnnotations(state) {
return state.activity.activeAnnotationFetches > 0;
} | [
"get fetching(): boolean {\n\t\treturn this._fetching.get();\n\t}",
"function isFetching() {\n return config.get().fetching;\n}",
"_canFetch() {\n let now = Date.now();\n let elapsed = Math.floor( ( now - this.last ) / 1000 );\n let delay = this._options.fetchDelay | 0;\n\n if ( this.fet... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
analyze the frames of the stack | analyzeFrames(frames) {
return frames.map((frame) => {
const result = /(?:\n|^)\s*(?:at)?\s*([^\(\[]+)(?:\[([^\]]+)\])?\s*\(([^\):]+):?([^\):]+)?:?([0-9]+)?\)/gi.exec(frame);
if (result) {
return {
fn: result[1] ? result[1].trim() : null,
... | [
"function prepareStackInfo() {\n \tvar stackInfo = [];\n \tframeInfo = [];\n \t\n \tfor (var i=callStackDepth-1; i >= 0; i--) {\n \t\t\n \t\tvar frameInfo = {};\n \t\tframeInfo.callFrameId = \"stack:\"+i;\n \t\tframeInfo.functionName = callStack[i].name;\n \t\tframeInfo.location = {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
push first and last name into this searchData array | function createSearchData() {
employees.forEach((employee) => {
searchData.push(`${employee.name.first.toLowerCase()} ${employee.name.last.toLowerCase()}`)
})
console.log(searchData);
} | [
"function buildSearchArray() {\n $students.each(function () {\n searchArray.push({\n student: this,\n name: $(this).find('h3').html().toLowerCase()\n });\n })\n }",
"search(input) {\n let tempData = this.contactInfo;\n if (input.le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Note that the fog layer and piece layers technically iterate over the same content, and could thus be created at the same time (in fact, they used to be a part of the same layer), but this efficiency isn't worth the understandability/refactorability of having them be two seperate loops. Either way it's constant time (u... | _setupFogLayer() {
logDebug('Setting up fog layer', 'ViewController');
let ret = new Konva.Layer();
for (let rank = 1; rank <= 8; rank++) {
for (let file of 'abcdefgh') {
let square = file + rank;
let squareContent = this._model.contentAtSquare(square);
if (squareContent != null && squareContent.va... | [
"updateFogOfWar() {\n const fogOfWar = this.map.getFogOfWar();\n const tiles = fogOfWar.getMatrix();\n let cache = this.cache.fogOfWar;\n if (!cache) {\n cache = {};\n cache.color = '0x001A45';\n cache.mapWidth = tiles.length - 1;\n cache.mapHeight = tiles[0].length - 1;\n cache... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Input: User name Action: Checks if the user is a store manager, and if so returns all the store's reports | function getReportsManagerReport(userName, callable){
console.log("(model/store.js) Started getReportsManagerReport()");
user.getStoresManagerByUsername(userName, function(err, docs){
if(docs.StoresManager.length > 0) {
store.find({StoreID: {"$in": docs.StoresManager}}, "Reports", function (... | [
"async function getAllReportsManagers() {\n const reportsManagers = db.Account.find(\n { role: { $in: [\"Admin\", \"ReportsManager\"] } },\n { firstName: 1, lastName: 1 }\n );\n return reportsManagers;\n}",
"function viewAllEmployeesByManager() {\n inquirer\n .prompt({\n name: \"managerAction\",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getTypeArity returns the number of generic type parameters the given symbol has. If the symbol is not a type the result is null. | getTypeArity(staticSymbol) {
// If the file is a factory/ngsummary file, don't resolve the symbol as doing so would
// cause the metadata for an factory/ngsummary file to be loaded which doesn't exist.
// All references to generated classes must include the correct arity whenever
// gene... | [
"getGenericArityOfClass(clazz) {\n const dtsDeclaration = this.getDtsDeclaration(clazz);\n if (dtsDeclaration && ts.isClassDeclaration(dtsDeclaration)) {\n return dtsDeclaration.typeParameters ? dtsDeclaration.typeParameters.length : 0;\n }\n return null;\n }",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Restore the element to a closed state | function cleanElement() {
element.removeClass('_md-active');
element.attr('aria-hidden', 'true');
element[0].style.display = 'none';
announceClosed(opts);
if (!opts.$destroy && opts.restoreFocus) {
opts.target.focus();
}
} | [
"_setClosedState () {\n this.toggleElement.setAttribute('aria-expanded', 'false')\n this.targetElement.setAttribute('hidden', '')\n\n this.isOpen = false\n }",
"function restoreOriginalState()\n\t\t{\n\t\t\t// discard the stalker and all its weird inline styles\n\t\t\tme.jElement.detach(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find a hit note for a given column and time. | function findNoteFor(notes, time, column) {
// 1. Calculate offset for time
// 2. Calculate offset for time-50ms and time+50ms
// 3. Return *earliest* note filtered for in that range with matching column
return notes.filter((note) => {
if (note.col !== column) {
return false;
}
return (time +... | [
"findNoteAtPos(x, y) {\n if (!this.notes) {\n return null;\n }\n // TODO: can be likely optimized\n // a beat is mostly vertically aligned, we could sort the note bounds by Y\n // and then do a binary search on the Y-axis.\n for (let n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function that will check if a ship has been sunk after each hit. | function checkShipSunk(shipState, shipType) {
if (!shipState[shipType].health.includes(0)) {
loopEachShipSquare(shipState, shipType, (element) => {
element.classList.add('sunk');
})
let shipName = shipType.substr(4);
let attacker = (state.turn === 1) ? 'You' : 'Skyn... | [
"checkShipSunk(c) {\n for (let i = 0; i < this.ships.length; i++) {\n if (this.ships[i].isHit(c)) {\n return this.ships[i].isSunk();\n }\n }\n return false;\n }",
"function isSunk(ship) {\n\t// Return whether or not a ship has been sunk\n\tfor (i = 0; i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a to element. aMessage [array|object] Array: All messages in the array will be added | function addMessage(scope, aMessage, element) {
var messages = aMessage;
if(!angular.isArray(messages) && typeof aMessage === "object")
{
messages = [aMessage];
}
var len = messages.length;
//isma, TODO, this can be greatly optimized if we cache elements too
for(var i =... | [
"function addMessage(element, message){\n var messageElement = document.createElement(\"li\");\n messageElement.textContent = message;\n element.appendChild(messageElement);\n}",
"function addToMessageQueue(element)\n{\n messageQueue[messageQueue.length] = element;\n if(messageQueue.length == 1) function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse all input and return last object. | parseall() {
let obj = this.parse();
while (!this.done()) obj = this.parse();
return obj;
} | [
"endParsing() {\n\n\t\t// Skip ending whitespace\n\t\tthis.skipWhitespace();\n\n\t\t// Check for container to select it as the value\n\t\tif (this.container) {\n\t\t\tthis.value = this.container;\n\t\t}\n\n\t\t// Validate parser state\n\t\tif (this.chunk[this.index] || this.stack.length) {\n\t\t\tthis.stopParsing()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts a custom cursor (url or base64) to url format | function cursorUrl(val){
if(!val) return 'auto';
if(val.match(/[^a-z0-9+\/=]/i)) return "url("+val+") 16 16, auto";
return "url('data:image/cursor;base64,"+val+"') 16 16, auto";
} | [
"function mrDefaultFromCursor (cursor) {\n try {\n return JSON.parse(utf8.decode(base64.decode(cursor)))\n } catch (e) {\n return {}\n }\n}",
"function esc_url_raw( $url, $protocols = null ) {\n return esc_url( $url, $protocols, 'db' );\n }",
"function cursorToOffset(cursor) {\n\t return parse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updates the age boxes when someone clicks on a seat checkbox | updateAgeField(event) {
let checkbox = event.target;
/* if a box is checked, add an adult ticket */
if (checkbox.checked == true) {
bookingTempStore.childAdultRetiree[1]++;
} else { /* if the box is unchecked, subtract a ticket from adult, child, or retiree as applicable */
if (bookingTempSt... | [
"function UpdateAgeOption(current) {\n let array = that.age_map.get(current.value);\n\n if (current.checked == true) {\n array[1] = 1;\n that.checkCount++;\n } else if (current.checked == false && that.checkCount > 1) {\n array[1] = 0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply the given transaction to produce a new state. | apply(tr) {
return this.applyTransaction(tr).state;
} | [
"function applyTransaction(history, state, tr, options) {\n var historyTr = tr.getMeta(historyKey),\n rebased;\n\n if (historyTr) {\n return historyTr.historyState;\n }\n\n if (tr.getMeta(closeHistoryKey)) {\n history = new HistoryState(history.done, history.undone, null, 0);\n }\n\n var appended =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
As informacoes do appointmente serao recebidas no parametro do handle handle tarefa que sera executada quando esse processo for executado | async handle({ data }) {
const { appointment } = data; // estaremos desestruturando o appointment que esta dentro de data
await Mail.sendMail({
to: `${appointment.provider.name} <${appointment.provider.email}>`, // dados do destinatario do email primeiro parametro nome, segundo email entre os sinais <>
... | [
"function bookAppointment(handlerInput) {\n return new Promise(((resolve, reject) => {\n const sessionAttributes = handlerInput.attributesManager.getSessionAttributes();\n const requestAttributes = handlerInput.attributesManager.getRequestAttributes();\n\n try {\n const appointmentData = sessionAttri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the filter panel's HTML structure in 'filterBuilder' mode. | createBuilderHTMLStructure() {
const that = this,
context = that.context,
filterBuilder = document.createElement('smart-filter-builder'),
dataField = context.dataField,
dataType = context.filterType === 'numeric' ? 'number' : context.filterType;
that.filt... | [
"createBuilderHTMLStructure() {\n const that = this,\n context = that.context,\n filterBuilder = document.createElement('jqx-filter-builder'),\n dataField = context.dataField,\n dataType = context.filterType === 'numeric' ? 'number' : context.filterType;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setup the IPR section based on data from the SetupSidebar This is called from the setupDocument() function | function setupIPR(tcshortname, dociprmode) {
var iprname;
var iprurl;
switch(dociprmode) {
case "na":
iprname = 'Non-Assertion';
iprurl = 'https://www.oasis-open.org/policies-guidelines/ipr#Non-Assertion-Mode';
break;
case "rflt":
iprname = 'RF on Limited Terms';
iprurl = 'https://www.o... | [
"function initSideInfo() {\r\n\tvar mySide = document.getElementById(\"side_info\").appendChild(document.createElement('div'));\r\n\tmySide.id='myside';\r\n\t//if notes on\r\n\t//do notes \r\n\tinitNotes();\r\n\t\r\n\t//if certian pages\r\n\t//do harvest info\r\n\t\r\n\t//do options\r\n}",
"_initSections() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to hightlight which results button has been clicked on | function hightlightSelectedButton(buttonId) {
var buttons = document.getElementsByClassName("results-button");
var i;
for (i = 0; i < buttons.length; i++) {
if (debug) {
console.log(buttons[i])
}
id = buttons[i].id
classNames = buttons[i].className.split(" ");
... | [
"function displayMovieInfo() {\n // Only run code if the current element has the \"movie-btn\" class\n if (this.classList.contains(\"movie-btn\")) {\n // Set the movie search to the button id that we set earlier \n var movie = event.target.getAttribute(\"id\");\n getButtonData(movie);\n }\n // display ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends a HelpIntent to Alexa | sendHelpIntent() {
let helpIntent = HelpIntent;
if (this.sessionAttributes) {
helpIntent.session.attributes = this.sessionAttributes;
}
let self = this;
return this._sendIntent(helpIntent);
} | [
"@Launch\n @Intent('AMAZON.HelpIntent', 'Unhandled')\n help() {\n return ask(\n <speak>\n This Alexa skill provides you with the daily wisdom by reading \n tweets from the real Donald Trump. Ask me for some wisdom now.\n </speak>)\n .reprom... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
tryPlaceWord(...) tries all possible directions and all possible starting grid positions in the grid. The actual check of a (position , direction) tuple defers to tryPosition( ... ). | function tryPlaceWord(word, grid) {
let candidateDirections = shuffleArr(directions);
for (let k = 0; k < candidateDirections.length; k++) {
let direction = candidateDirections[k];
let positions = shuffleArr(range(0, grid.cellsCount));
for (let posIdx = 0; posIdx < positions.length; posIdx++) {
l... | [
"placeWord(word, grid) {\n console.log(\"place\", this.props.difficulty);\n var isValidPlacement = false; // Is the word able to be placed at this direction & starting position?\n var direction = 0;\n var startingPosition = { x: 0, y: 0 };\n\n while (!isValidPlacement) {\n direction = this.gener... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialzes vertex number 'num'. Initially, all vertices are colored "white", have no parent, and are not walls They are also "infinitley" away from the source, as they haven't been discovered | constructor(num) {
this.num = num;
// All vertices are
this.distance = Number.MAX_SAFE_INTEGER;
// Initially, all vertices are white
this.color = "w";
this.parent = null;
this.isWall = false;
} | [
"setNumVertices(v){\n const num = Number(v)\n if(this.state.activeProperty === \"Cycle\"){\n this.updateVertexEdgeBounds(num, this.state.numE, true, this.state.activeProperty)\n } else if (this.state.activeProperty === \"Connected\"){\n this.updateVertexEdgeBounds(num, thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setting up KWlistchoosing on SETTINGSview (select2) | function setSettingsLoadedKW() {
logger.debug("setSettingsLoadedKW");
$("#KW-selector").select2({
placeholder: i18n.__('select2-kw-add-ph')
});
$('#KW-selector').on("select2:select", function (e) {
//NEEDSTOBECHANGED save project to temp here
// -> is saved in another onClick lis... | [
"function toggle_setting_choices() {\n\tElement.hide('devices_box');\n\tElement.hide('plugins_box');\n\tElement.show('workbox');\n}",
"function setFoodTypesSelected(foodTypeList) {\n $(\"#FoodTypeSelect\").val(foodTypeList).trigger(\"chosen:updated\");\n}",
"function buildKeywordLists()\n {\n $(\"#... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds html code to the empty app_list div | function addHTML() {
let listItems = '';
list.forEach(elm => {
if (elm[1] == 'noCheck') {
listItems += `<div class="app_list_item"><button class="check_button">✓</button><p class="app_list_item_name">${elm[0]}</p><button class="minus_button">-</button></div>`;
} else {
... | [
"function core__appstore__addapp (App, list) {\n list.append('<li id=\"core__appstore__list__li__'+App.name+'\"><div class=\"core__applist__list__name\">'+App.name+'</div><div class=\"core__applist__list__description\">'+App.description+'</div></li>');\n$('#core__appstore__list__li__'+App.name).click(function ()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
searches for user in database by discordId | async findUser(discordId) {
return UserModel.findOne({ discordId: discordId });
} | [
"findUserForId(id) {\n for (var i = 0; i < this.users.length; i++) {\n if (this.users[i]._id === id) {\n return this.users[i];\n }\n }\n // // user not found\n // console.log('Error: user not found in function ctr.findUserForId(id)');\n }",
"asyn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This returns the optimal value | activate() {
console.log(`${this.name} returns ${this.optimalValue}`);
return this.optimalValue;
} | [
"function minimaxValue(state) { ... }",
"minimizeCost(){\n\t\tvar minCost = Infinity;\n\t\tvar ret = 0;\n\t\tfor(let node of this.notEvaluated){\n\t\t\tvar cost = this.goToCost[node] + level.costToGoal[node];\n\t\t\tif(cost <= minCost){\n\t\t\t\tminCost = cost;\n\t\t\t\tret = node;\n\t\t\t}\n\t\t}\n\t\treturn ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
iterates through each category to render each item | function Items() {
const categories = Object.keys(ORDER);
return categories.map((category) => renderItems(ORDER[category]));
} | [
"function categoryList() {\n for (let i = 0; i < list.length; i++) {\n renderCategory(list[i]);\n }\n }",
"render(listCategories) {\n for (const category of listCategories) {\n const divCategory = document.createElement('div');\n divCategory.classList.add('... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method for getting all office in the database. | allData() {
const sql = 'SELECT * FROM office';
return this.db.many(sql);
} | [
"function getAllOffices() {\n\t\t$scope.allOffices = model.office.query();\n\t\tconsole.log('got all offices');\n\t}",
"async getAllOffices(req, res) {\n try {\n const findOffice = officeQueries.selectAll;\n let fetchOfficeQuery = [];\n fetchOfficeQuery = await connect.query(findOffice);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process POST request Create a new collection | static async post(request, reply) {
let collection = await Collection.create(request.payload);
return reply(collection).code(201);
} | [
"async postCollection (req, res, next) {\n try {\n this.database.createDatabase(req.body.collection);\n }\n catch (error) {\n return this.errorResponse(res, error, 400);\n }\n return res.json({ success: true });\n }",
"function createCollection () {\n\t/*\t\t\t\n\tFirst, we specify the p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unselect the sites of node | function unselectAllSites(node) {
if (!node._private.data.sites)
return;
node._private.data.sites.forEach(function(site){
site.selected = false;
});
} | [
"deselectAll() {\n\n\t\t\tvar nodes = this.nodes;\n\t\t\tfor (var i = 0; i < nodes.length; ++i) {\n\t\t\t\tvar node = nodes[i];\n\t\t\t\tnode.deselect();\n\t\t\t}\n\n\n\t\t}",
"function unselectNode() {\n if(selectedNode == null) return;\n nodeDefaultStyle(selectedNode);\n selectedNode = null;\n}",
"un... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a set of distinct indexes on interval [0, size) using the double hashing technique For generating efficiently distinct indexes we rehash after detecting a cycle by changing slightly the seed. It has the effect of generating faster distinct indexes without loosing entirely the utility of the double hashing. For... | getDistinctIndexes(element, size, number, seed) {
if (seed === undefined) {
seed = getDefaultSeed();
}
let n = 0;
const indexes = new Set();
let hashes = this.hashTwice(element, seed);
// let cycle = 0
while(indexes.size < number){
const in... | [
"function getDistinctIndices(element, size, number, seed) {\n if (seed === undefined) {\n seed = getDefaultSeed();\n }\n function getDistinctIndicesBis(n, elem, size, count, indexes) {\n if (indexes === void 0) { indexes = []; }\n if (indexes.length === count) {\n return ind... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Private helper method for retrieving request options. | __getRequestOptions(path, host_name, api_key) {
return {
hostname: host_name,
path: path,
method: 'GET',
headers: {
'Content-Type': 'application/json',
'api_key': api_key,
'Accept': 'application/json'
... | [
"function getOptions(request) {\n\n // Helper function to see if a string starts with a given string.\n var startsWith = function(source, str) {\n return (source.match(\"^\"+str) == str);\n };\n\n // Retrieves the HTTP status code from the request path.\n var getStatus = function(u) {\n var status = pars... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mark the event, chain of events and the array of events as marked. It also marks the internal properties as sent | function yellMarkEventsAsSent(events) {
// Completely mark an event and its properties as sent
function markAsCompleteSent(event) {
var yprops = event.getProps();
for (var key in yprops) {
var varObj = yprops[key].varObj;
event.propertyMarkAsSent(varObj);
}
event.markAsSent();
}
// Handle it differ... | [
"function markAsCompleteSent(event) {\n\t\tvar yprops = event.getProps();\n\t\tfor (var key in yprops) {\n\t\t\tvar varObj = yprops[key].varObj;\n\t\t\tevent.propertyMarkAsSent(varObj);\n\t\t}\n\t\tevent.markAsSent();\n\t}",
"set events(events) {\n this.privateEvents = {\n ...this.privateEvents,\n ..... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saving cities to local storage | function saveCity() {
localStorage.setItem("lscity", JSON.stringify(cities));
} | [
"function saveCities() {\n localStorage.setItem(\"savedCities\", JSON.stringify(savedCities));\n}",
"function saveCities () {\n\t\tif ('localStorage' in window) {\n\t\t\tlocalStorage.setItem('cityData', JSON.stringify(cities));\n\t\t}\n\t}",
"function saveCities() {\n var str = JSON.stringify(cities);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create Sales Orders distributed randomly across a time period | function replicateTimeBasedSalesOrders(aStartDate, aEndDate, aNoRec) {
var alpha = 0;
var thetaArray = [];
var i = 0;
var randNo = 0;
var body = '';
var j;
var noRecords = aNoRec;
var calc;
var tempthetaArray, startDay, startMonth, startYear, StartDateStr, BATCHSIZE;
//Calculate... | [
"generateOrders(count = this.INITIAL_ORDERS) {\n const orders = [];\n\n times(count, (idx) => {\n const tradingDay = sample(this.tradingDays),\n time = tradingDay + (random(540, 960) * MINUTES), // random time during market hours\n pos = this.getRandomPositionF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
mixin copy all properties from inProps (et al) to inObj | function mixin(inObj/*, inProps, inMoreProps, ...*/) {
var obj = inObj || {};
for (var i = 1; i < arguments.length; i++) {
var p = arguments[i];
try {
for (var n in p) {
copyProperty(n, p, obj);
}
} catch(x) {
}
}
return obj;
} | [
"function mixin(inObj/*, inProps, inMoreProps, ...*/) {\n var obj = inObj || {};\n for (var i = 1; i < arguments.length; i++) {\n var p = arguments[i];\n try {\n for (var n in p) {\n copyProperty(n, p, obj);\n }\n } catch(x) {\n }\n }\n return obj;\n}",
"_addPropsToObject(props) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates wizard according to layout | function generateWizard(listLayout){
let wizard;
if(listLayout === true){
wizard = {
"title": "Welcome to the Wizard",
"description": "Please fill things in as you wish",
"showSteps": false,
"showProgressBar": false
};
}else{
wizard = {... | [
"function generateTabs ( ) {\n var btn_lbl_next = $('.text-next').length ? $('.text-next').text() : \"Next\";\n var btn_lbl_back = $('.text-back').length ? $('.text-back').text() : \"Back\";\n $('.wizard').each(function ( mi ) {\n\n $_this = $(this);\n\n var ele_li = \"\";\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transform the points in a dataset inplace; don't clean up corrupted shapes | function transformPoints(dataset, f) {
if (dataset.arcs) {
dataset.arcs.transformPoints(f);
}
dataset.layers.forEach(function(lyr) {
if (layerHasPoints(lyr)) {
transformPointsInLayer(lyr, f);
}
});
} | [
"transformInPlace(transform) {\n const data = this._data;\n const nDouble = this.float64Length;\n const coffs = transform.matrix.coffs;\n const origin = transform.origin;\n const x0 = origin.x;\n const y0 = origin.y;\n const z0 = origin.z;\n let x = 0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates a book card div the DOM node that we can append to a book list | function makeBookCard(book) {
const div = document.createElement("div");
div.className = "card";
const img = document.createElement("img");
img.src = book.img;
const h3 = document.createElement("h3");
h3.textContent = book.title;
const p = document.createElement("p");
p.textContent = book.author;
... | [
"function createBookCover(book) {\n let bookItem = document.createElement('div');\n bookItem.innerHTML = `\n <div class=\"book book--176\">\n <div class=\"book-progress book__progress\">\n <i class=\"book-progress__status-icon fa\" id=\"fa-icon\"></i>\n <div class=\"book-progre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
positioning exitRoom, clearnCanvas and colour selector element dynamically | function positionButtonsInCanvasResponsively() {
$(".leaveRoom").css({
// "position": "relative",
position: "absolute",
// "display": "block",
bottom: "0",
left:
document.getElementsByClassName("whiteboard")[0].offsetLeft -
document.getElementsByClassName("whiteboard")[0].offsetWidth /... | [
"function buildGameCanvas() {\r\n canvasContainer = new createjs.Container();\r\n popupContainer = new createjs.Container();\r\n mainContainer = new createjs.Container();\r\n selectContainer = new createjs.Container();\r\n gameContainer = new createjs.Container();\r\n linesContainer = new createjs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
HELPER METHOD CREATE MultiContactInfoEditor widget Maps single value field with a type from the options in p8uiCreateTypeValueMultiEditor | function mapSingleTypedValuesFields(options) {
var valueFields = new Array();
if(options.typeField != null) {
var valueField = {};
valueField.value = options.typeField;
valueField.customValueField = options.customValueField;
valueField.types = options.types;
valueField.title = $.i18n(options.i180n... | [
"function mapSingleTypedValuesFields(options) {\n var valueFields = [];\n var valueField;\n \n if (options.typeField !== null) {\n valueField = {};\n valueField.value = options.typeField;\n valueField.customValueField = options.customValueField;\n valueField.types = options.types;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Functions that help for the scheduling algos Get the first arrived Job that is in the queue (FCFS) | getFirstCome() {
var lowestTime = this.queue[0].getArrivalTime();
var jobFinal = this.queue[0];
for(var i=0; i<this.queue.length; i++) {
var job = this.queue[i];
if(lowestTime > job.getArrivalTime()) {
lowestTime = job.getArrivalTime();
job... | [
"getShortestJobFirst(currentClockTick) {\n var jobFinal = this.getFirstCome();\n var shortestJob = jobFinal.getBurstsRemaining();\n for(var i=0; i < this.queue.length; i++) {\n var job = this.queue[i];\n if(job.getArrivalTime() <= currentClockTick) {\n if(jo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add animation class to h2Content | function h2ContentAnimation() {
h2Content.classList.add('heading-content-animation')
} | [
"function h1ContentAnimation() {\n h1Content.classList.add('heading-content-animation')\n}",
"function addClass() {\n heading.className = \"subheading\";\n}",
"function animationLogo() {\n logo.classList.add('logo-animate');\n}",
"function animateHeader(){\n var elements = wquery.$('.container h2');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Workaround for incompatibility between Karma & gulp callbacks. See for some related discussion. | function newKarmaCallback(done) {
return function (exitCode) {
if (exitCode) {
done(new Error('Karma tests failed with exit code ' + exitCode));
} else {
if (argv.browserstack) {
process.exit(0);
} else {
done();
}
}
}
} | [
"function karmaClean(done) {\r\n //You can use multiple globbing patterns as you would with `gulp.src`\r\n //If you are using del 2.0 or above, return its promise\r\n return del(['.karma'],done);\r\n}",
"function karmaBrowserifast() {\n var log, watch;\n\n /**\n * Whenever a test or one of its ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
constructor representing a catch clause scope | function CatchScope(outer, cc) {
Scope.call(this, outer, [cc.param]);
} | [
"function Serializer$CatchStatement$E() {\n}",
"function CatchStatement() {\n}",
"catch( fn ) {\n\t\tthis.catchFn = fn;\n\t\treturn( this );\n\t}",
"function Cloner$CatchStatement$E() {\n}",
"function visitCatchClause(node){var savedEnclosingBlockScopedContainer=enclosingBlockScopedContainer;enclosingBlockS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generates a fake auth token with random value passes back username/provider | function getFakeToken(userName, authProviderName) {
return {
token: {
token: misc_1.getRandomUUID(8),
timeout: getRandomInt(300, 600),
userName,
authProviderName
}
};
} | [
"generateAccessToken() {\n return Muni.randomHash();\n }",
"function randomUserToken() {\n return randomAlphaNumCharsOfLength(8) + \"-\" + \n randomAlphaNumCharsOfLength(4) + \"-\" + \n randomAlphaNumCharsOfLength(4) + \"-\" + \n randomAlphaNumCharsOfLength(4) + \"-\" + \n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace blank Roff lines with empty requests. | fixBlankLines(){
const settingName = "language-roff.blankLineReplacement";
const replacement = atom.config.get(settingName) || ".";
this.replace(/^[ \t]*$/gm, match => {
const {range, replace} = match;
const {scopes} = ed.scopeDescriptorForBufferPosition(range.start);
if(-1 === scopes.indexOf("comment... | [
"function removeBlankLines(doc)\r\n{\r\n var list = $x('.//br[@clear=\"all\"]', doc);\r\n for (var x=0, limit=list.snapshotLength; x<limit; ++x) {\r\n var br = list.snapshotItem(x);\r\n br.parentNode.removeChild(br);\r\n }\r\n}",
"function stripBlankLines(text) {\n return text.split(EOL).f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update list to show pay rates entered | function updateList()
{
var newPay = form.newpayrate.value;
// check valid input
reg = /[0-9]+(\.[0-9][0-9]?)?/;
if (!newPay.match(reg))
{
alert("Please enter a valid number with up to 2 decimal places");
form.newpayrate.focus();
}
else
{
// Enter pay onto list
var opti... | [
"function exhange_rate_update()\n{\n\n rate_value = format_currency_value($(\"#exhange_rate\").val());\n $(\"#exhange_rate\").val(rate_value);\n $.each(transactions_array, function()\n {\n this.update_zl(rate_value);\n } \n );\n update_transaction_summary();\n}",
"addList() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Moves the car up | goUp() {
if (this.y < 0) {
this.y = 800 + this.width * 5;
this.carMadeIt = true;
//5% chance of turning right
if (Math.floor((Math.random() * probability)) == 1) {
this.turnRight = true;
}
} else {
this.carMadeIt = false;
}
if (this.carMadeIt) {
this.... | [
"moveUp() {\n this.shiftY = -8;\n this.moving = MoveState.UP;\n }",
"moveUp() {\n if (this.y > 12) {\n this.y -= 8;\n }\n }",
"function moveMyCarUp(){ //THIS FUNCTION IS NOT USED IN THIS GAME\r\n\tcurrPosMyCarY -= 40;\r\n\tif(currPosMyCarY>=0){ \r\n\tMyCar.style.top ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine the number of subsets we need and store it in a global js variable. | function determineNumberOfSubsets()
{
var subsetstorun = 0;
for (i = 1; i <= GLOBAL.NumOfSubsets; i = i + 1)
{
if( ! isSubsetEmpty(i) && GLOBAL.CurrentSubsetIDs[i] == null)
{
subsetstorun ++ ;
}
}
STATE.QueryRequestCounter = subsetstorun;
} | [
"function expCountSubsetsOfSet(n) {\n if (n === 0) return 1\n else return expCountSubsetsOfSet(n - 1) + expCountSubsetsOfSet(n - 1)\n}",
"function subsets(array) {\n\n}",
"constructor() {\n this.subsets = [];\n }",
"function setSegCount(){\t\n\tvar totCount = 0;\n\t$('#parentSCatDiv strong').each(fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Response the user plus Token | function sendToken(user, res, token) {
res.json({ firstName: user.email, token: token });
} | [
"getToken() {\n\t\treturn this._post(\"/api/user/token\");\n\t}",
"function response(res) {\n\t\t\tif (res.data.token) {\n\t\t\t\tauth.saveToken(res.data.token);\n\t\t\t}\n\t\t\treturn res;\n\t\t}",
"function showToken(response){\n console.log(response);\n}",
"function respondToken(req, res) {\n\n var tok... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
isStateCode (STRING s [, BOOLEAN emptyOK]) Return true if s is a valid U.S. Postal Code (abbreviation for state). For explanation of optional argument emptyOK, see comments of function isInteger. | function isStateCode(s)
{ if (isEmpty(s))
if (isStateCode.arguments.length == 1) return defaultEmptyOK;
else return (isStateCode.arguments[1] == true);
return ( (USStateCodes.indexOf(s) != -1) &&
(s.indexOf(USStateCodeDelimiter) == -1) )
} | [
"function checkstate(postcode, state){\r\n var x=postcode.split(\"\");\r\n x=x[0];\r\n var result = 0;\r\n switch(state){\r\n case \"vic\":\r\n if(x!=3&&x!=8)\r\n result=1;\r\n break;\r\n case \"nsw\":\r\n if(x!=1&&x!=2)\r\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create folder if no exist, to store category output json | function createFolder(){
var pathName = 'category_output';
mkdirp(pathName, function(err) {
//console.log('ok');
});
} | [
"function createCategory(req, res) {\n let dirCategory = path.join(pathDir, sanitizeInput(req.params.category));\n mkdirp(dirCategory, (err) => {\n if (err) {\n res.status(500).send(err);\n return;\n }\n\n restListCategories(req, res);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Class i3Canvas SVG BackGround Rect Root Node Main (nodes, edges) | function canvas() {
// func: Initialize
this.Init = function (rootname) {
// The Basic SVG
this.svg = d3.select(rootname).append("svg");
// this.svg.attr("class", this.canvas_style);
this.svg
.attr("width", this.attr_svgW)
.... | [
"function writeBgNE() {\n\t\tif (this.bgForm == ROUNDRECT) {\n\t\t\tvar rect = document.createElement(\"v:roundrect\");\n\t\t\trect.setAttribute(\"id\", this.rectid);\n\t\t\trect.setAttribute(\"arcSize\", this.roundCornerPercentage);\n\t\t\tvar elem = document.getElementById(this.id).appendChild(rect);\n\t\t\telem.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a render for a div object with the state variables passed in, and calls handleClick method from BodyContent component | render (){
return(
<div class={this.state.classes} id={this.state.id} onClick= {() => this.props.handleClick(this.props.id, this.state.classes)}>{this.state.content}</div>
);
} | [
"render (){\n const App = (<div id=\"bodyContainer\">\n <div id=\"Header\"><h3>Russ Websites</h3></div>\n <Card classes={this.state.item1} handleClick={this.handleClick} id=\"item1\" pname=\"Why Your Website Matters\" content={pageContent.WhyContent()} />\n <Card classes={this.state.item2} handleC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set the slider boundaries we will translate it horizontally in landscape mode vertically in portrait mode | setBoundaries() {
if(window.innerWidth >= window.innerHeight) {
// landscape
this.boundaries = {
max: -1 * this.options.element.clientWidth + window.innerWidth,
min: 0,
sliderSize: this.options.element.clientWidth,
referentS... | [
"function setBoundaries() {\n var u0 = Number(speedSlider.value);\n for (var x = 0; x < xdim; x++) {\n setEquil(x, 0, u0, 0, 1);\n setEquil(x, ydim - 1, u0, 0, 1);\n }\n for (var y = 1; y < ydim - 1; y++) {\n setEquil(0, y, u0, 0, 1);\n setEquil(xdim - 1, y, u0, 0, 1);\n }\n}",
"handleBoundaries(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to increment lap time | function incrementLapTime() {
//Check clock is running
if(running === 1) {
setTimeout(function() {
lapTime++;
let mins = Math.floor(lapTime / 10 / 60);
if(mins <= 9) {
mins = "0" + mins;
lapMins.innerHTML = mins;
}
... | [
"function incrementLap() {\n lapsCompleted += 1 \n}",
"function incrementLaps(){\n lapsCompleted = lapsCompleted + 1\n}",
"function incrementLaps() {\n lapsCompleted += 1\n}",
"function lapTimer (state /*: State */) /*: State */ {\n let timer /*: Timer */ = state.timer\n const now = state.time && s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get effective configuration schema. | getConfigurationSchema() {
return configurationSchema;
} | [
"get currentSchema() {\n if (this._impl)\n return this._impl.getCurrentSchema();\n return undefined;\n }",
"schema() {\n return this._schema;\n }",
"static get schema () { return schema }",
"static get schema() {\n\t\tif (this._SCHEMA) {\n\t\t\treturn this._SCHEMA;\n\t\t}\n\n\t\tconst pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Press the A button | *pressButtonA() {
yield this.sendEvent({ type: 0x01, code: 0x130, value: 1 });
} | [
"function pressA() {\n\tif(cursor) {\n\t\t// Do nothing\n\t}\n\telse if($(\"#refresh.selected\").length) { // Refresh the news if selected\n\t\tloadNews(\"refresh\");\n\t}\n\telse if($(\".selected.outer\").length) { // If a tab is selected\n\t\toffTab(); // See comments at function\n\t}\n\telse if($(\"#survey.selec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds and returns a Tile Object with the supplied letter | function _createTile(letter) {
return _.find(letterDistribution, function(tile) {
return tile.letter === letter;
});
} | [
"findTile() {\n this._tile = -1;\n var tile = this._grid.getTile(this._gridLoc.x, this._gridLoc.y);\n for (var t = 0; t < TILE_LETTERS.length; t++) {\n if (TILE_LETTERS[t] == tile) {\n this._tile = t;\n break;\n }\n }\n if (this._tile == -1) {\n throw \"Tile is not a vali... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Closure that defines the LayoutManager component. | function LayoutManager() {
/**
* Layout Manager Constructor:
*
* Each Calendar view is expected to create an instance and overload its render method.
*/
} | [
"createLayout() { }",
"function EBX_LayoutManager() {}",
"function EBX_LayoutManager() {\n}",
"function Layout() {return;}",
"function LayoutManager(chart) {\r\n\r\n\t\tthis._topOccupied = 0;\r\n\t\tthis._bottomOccupied = 0;\r\n\t\tthis._leftOccupied = 0;\r\n\t\tthis._rightOccupied = 0;\r\n\t\tthis.chart = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
= Description The +drawRect+ method refreshes the dimensions of the view. It needs to be called to affect changes in the rect. It enables the drawn flag. = Returns +self+ | drawRect() {
if (this.isNullOrUndefined(this.rect)) {
if (this.drawn === false) {
this._updateZIndex();
}
this.drawn = true;
return this;
}
else {
if (!this.rect.isValid || !this.parent) {
!this.rect.isValid && console.error('HView#drawRect; invalid rect:', this... | [
"updateRect() {\n this.rect.reset(this.x, this.y, this.width, this.height);\n }",
"redraw() {\n\t\tif (this.isActive() && this._canvasLayer) this._canvasLayer.needRedraw();\n\t}",
"function redraw(){\n\t\t\tcbGraphics.graphics\n\t\t\t.clear();\n\n\t\t\tif(options.strokeStyle > 0)\n\t\t\t{\n\t\t\t\tcbG... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
removes a list item at a given index | removeListItem(index) {
this.listItems.splice(index, 1);
} | [
"removeFrom(index) {\n if (index > 0 && index > this.size)\n return -1;\n else {\n var curr, prev, it = 0;\n curr = this.head;\n prev = curr;\n\n // deleting first element \n if (index === 0) {\n this.head = curr.next;\n } else {\n // iterate over the list to t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiate an instance of DiskSubHeader using the contents of the supplied buffer. | static fromBuffer (buffer) {
return new DiskSubHeader({
startDate: buffer.slice(0, 8).readFloatLE(),
startTime: buffer.slice(8, 16).readDoubleLE(),
endTime: buffer.slice(16, 24).readDoubleLE(),
lapCount: buffer.slice(24, 28).readInt32LE(),
recordCount: buffer.slice(28, 32).readInt32LE(... | [
"static fromBuffer (buffer) {\n if (buffer.length !== SIZE_IN_BYTES) {\n throw new RangeError(`Buffer length for VarHeader needs to be ${SIZE_IN_BYTES}, supplied ${buffer.length}`)\n }\n\n return new VarHeader({\n type: buffer.slice(0, 4).readInt32LE(),\n offset: buffer.slice(4, 8).readInt32... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the `UrlTree` with the redirection applied. Lazy modules are loaded along the way. | function applyRedirects(moduleInjector,configLoader,urlSerializer,urlTree,config){return new ApplyRedirects(moduleInjector,configLoader,urlSerializer,urlTree,config).apply();} | [
"function applyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config) {\n return new router_ApplyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config).apply();\n}",
"function applyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config) {\n return new Ap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is executed when the user presses the Replay chart button. It just loads the Google Chart Api and calls the viewChart function after it is loaded. | function loadReplayChart() {
row = $(this).closest("tr");
google.load('visualization', '1', {"callback" : replayChart, packages: ['corechart']});
} | [
"function renderChart(){\n\tgoogle.charts.load('current', {'packages':['corechart']});\n\tgoogle.charts.setOnLoadCallback(drawJoinChart);\n\tgoogle.charts.setOnLoadCallback(drawJoinEventChart);\n\tgoogle.charts.setOnLoadCallback(drawStarChart);\n\tgoogle.charts.setOnLoadCallback(drawStarEventChart);\n}",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
8081 designers are prioritizing work [priority] this evening _designer with [years of experience] are choosing work[priority] over anything else today _designers in [city] are prioritizing work[priority] tonight | function data_worklate(){
let counter1 = 0;
let counter2 = 0;
let res="";
sunsetStr.push("8081 designers are prioritizing work this evening.");
for (let i = 0; i < aiga.length; i++) {
if (aiga[i].city.toLowerCase().includes(citydata) && aiga[i].priority.includes("Work")) {
counte... | [
"function drupalOrgIssuePriority(priority) {\n switch (priority) {\n case '400':\n return 'Critical';\n case '300':\n return 'Major';\n case '200':\n return 'Normal';\n case '100':\n return 'Minor';\n }\n}",
"new_str_for_prio (priority, task_str = this.task_str) {\n if (pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle blur from the value. Calls complete on the editor and sets the state. | handleBlur() {
this.editor().complete();
this.setState({ editing: false });
} | [
"handleValueBlur() {\n this._valid = !(this.required && !this.value);\n this.interactingState.leave();\n if (!this._valid) {\n this.classList.remove('slds-has-error');\n }\n }",
"handleBlur() {\n if (this.editable) {\n this.setEditMode(false);\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Onchange Hashvalue Change In TextField | handleChangehashEvent(event) {
this.setState({ newhashtag: event.target.value });
} | [
"function hashchanged(){\n processNotes();\n }",
"function HashChangeEventInit() {\n}",
"_onChange() {\n this.set('_inputValue', this.get('value'));\n }",
"onFnaFieldValueChanged(value) {}",
"function OnAddress_Change( e , type )\r\n{\r\n Alloy.Globals.ShedModeShedPosition[\"ADDRESS\"] = $.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transition and remove items and labels related to week overview | removeWeekOverview () {
this.items
.selectAll ('.item-block-week')
.selectAll ('.item-block-rect')
.transition ()
.duration (this.settings.transition_duration)
.ease (d3.easeLinear)
.style ('opacity', 0)
.attr ('x', (d, i) => {
return i % 2 === 0 ? -this.settings.wi... | [
"removeWeekOverview() {\n this.items.selectAll('.item-block-week').selectAll('.item-block-rect')\n .transition()\n .duration(this.settings.transition_duration)\n .ease(d3.easeLinear)\n .style('opacity', 0)\n .attr('x', (d, i) => {\n return (i % 2 === 0) ? -this.settings.width / 3 ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Animate answer to textArea | function animateText(textArea, text, duaration){
$("#next").hide();
textArea.value = "";
var length = text.length;
var index = 0;
intervalId = window.setInterval(function(){
if ( index >= length ){
window.clearInterval(intervalId);
$("#next").show();
}... | [
"function displayAnswerInputFieldWithAnimation(){\n //callback function that marks the content of the corresponding HTML element\n setTimeout(function () {\n $(\"#answerButtonContainer\").html(`<input id=\"answer\" class=\"rounded animated tada\"><br>`);\n },9000);\n }",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates property accessors for registered properties, sets up element styling, and ensures any superclasses are also finalized. Returns true if the element was finalized. | static finalize() {
if (this.hasOwnProperty(finalized)) {
return false;
}
this[finalized] = true;
const superCtor = Object.getPrototypeOf(this);
superCtor.finalize();
if (superCtor._initializers !== void 0) {
this._initializers = [...superCtor._initializers];
}
this.elementPr... | [
"static finalize() {\n if (Object.prototype.hasOwnProperty.call(this, finalized)) {\n return false;\n }\n this[finalized] = true;\n // finalize any superclasses\n const superCtor = Object.getPrototypeOf(this);\n superCtor.finalize();\n this.elementStyles = this.finalizeStyles(this.styles);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build select box style and class name | build_select_box() {
this.select_box.className = this.options.select_box_class_name;
this.select_box.style.position = 'absolute';
this.select_box.style.left = '0';
this.select_box.style.top = '0';
this.select_box.style.width = '0';
this.select_box.... | [
"function _selectTag() {\n var html = '<select name=\"style\" tabIndex=\"1\">';\n html += _.map(editor.opts.imageMediaStyles, function(style) {\n var label = style.charAt(0).toUpperCase() + style.substring(1).replace(/_/, ' ');\n return '<option value=\"'+ style +'\">'+ label +'</option>';\n }).j... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
count the value of player cards and add to player result area | function countResultPlayer () {
playerResult = 0;
for (let i = 0; i < playerCardsTable.length; i++) {
playerResult += playerCardsTable[i].value
}
getPlayerResultArea().innerHTML = `${playerResult}`;
} | [
"function getCount(){\ncardCounts = [{'name':'-1', 'value':0}, {'name': '0', 'value':0}, {'name':'1', 'value':0}];\ndiscard.forEach(function(card) {\n val = countValues[card];\n val = parseInt(val);\n cardCounts[val+1].value++;\n})\n}",
"function count_players_played(player){return cardPile[player].suite}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
merge sort implementation data: an array of Objects on_field: the field to sort on in Objects order: 0 ascending, 1 descending | function g_merge(left, right, on_field, order)
{
var result = [];
var val, val_r, obj, obj_r;
while((left.length > 0) && (right.length > 0))
{
obj = left[0];
obj_r = right[0];
val = obj.computed[on_field] === undefined ?
obj[on_field] : obj.computed[on_field];
val_r = obj... | [
"function g_msort(array, on_field, order)\r\n{\r\n if(array.length < 2)\r\n return array;\r\n var middle = Math.ceil(array.length/2);\r\n return g_merge(g_msort(array.slice(0, middle), on_field, order),\r\n g_msort(array.slice(middle), on_field, order),\r\n on_field, order);\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Combine parts for complete files | function combine_parts(list)
{
var li;
for(li=0; li<list.length; li++) {
if(list[li].parts!=list[li].total)
continue;
var obj=list[li];
var sub_code;
printf("File complete: %s (%u parts)\r\n", obj.name, obj.parts);
file = new File(system.temp_dir + "binary.tmp");
if(!file.open("w+b")) {
printf("!ER... | [
"function combineFiles(err, data){\r\n fs.appendFile('catalog/catalog.txt', data, (err) => {\r\n if (err) throw err;\r\n console.log('The data was appended to file!');\r\n }); \r\n }",
"function combineFiles(files) {\n\t\tvar thang;\n\n\t\tif (files.length === 1) {\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Configure asset after upload or URL passed in. | newAssetConfigure() {
let values = {
source: this.shadowRoot.querySelector("#url").value
};
// we have no clue what this is.. let's try and guess..
var type = window.HaxStore.guessGizmoType(values);
let haxElements = window.HaxStore.guessGizmo(type, values);
// see if we got anything
i... | [
"newAssetConfigure() {\n let values = {\n source: this.shadowRoot.querySelector(\"#url\").value,\n title: this.shadowRoot.querySelector(\"#url\").value,\n };\n HAXStore.insertLogicFromValues(values, this);\n }",
"function makeInitialModifications(asset, url) {\n // If this asset always want... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks if the trump suit bid is valid | isTrumpSuitBidValid(bidAmount, bidSuit) {
// if the player passes - the pass button is the sixth button
if (bidSuit === 6) {
return 'pass';
}
//if the player tries to bid
if (bidAmount < this.highestBid) {
return false;
}
if (bidAmount === this.highestBid && bidSuit <= this.tru... | [
"function checkBusted() {\r\n var player = game.players[game.current_player_index];\r\n var dealer = game.players[game.players.length - 1];\r\n // check blackjack on the first hand\r\n if (player.cards.length == 2 && player.sum == 11 && player.sum_Ace == 21) {\r\n checkEndGame();\r\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
global createNS / exported ShapeGroupData | function ShapeGroupData() {
this.it = [];
this.prevViewData = [];
this.gr = createNS('g');
} | [
"function ShapeGroupData(){this.it=[];this.prevViewData=[];this.gr=createNS('g');}",
"function ShapeGroupData() {\r\n this.it = [];\r\n this.prevViewData = [];\r\n this.gr = createNS('g');\r\n}",
"function ShapeGroupData() {\n this.it = [];\n this.prevViewData = [];\n this.gr = createNS('g');\n}",
"init... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
queries the database at the supplied location for the requested query | function queryDatabase(path, request) {
$.get(path, request, function (information) {
if (information.errno === undefined) {
//we only want the first result so if there are more only grab the first
var info = information[0] === undefined ? information : information[0];
... | [
"function Query () {}",
"function executeQuery(){\r\n\treadRequest(urlBuilder.getSearchURL());\r\n}",
"function runQuery() {\n var chunkWriter = getChunkWriter(QUERY_RESULTS_SHEET);\n runSqlQuery(getProjectId(), readQuery(), chunkWriter);\n}",
"function queryLocation() {\n connection.query(\"SELECT * F... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return an array of unsaved children, which are either Parse Objects or Files. If it encounters any dirty Objects without Ids, it will throw an exception. | function unsavedChildren(obj, allowDeepUnsaved) {
var encountered = {
objects: {},
files: []
};
var identifier = obj.className + ':' + obj._getId();
encountered.objects[identifier] = obj.dirty() ? obj : true;
var attributes = obj.attributes;
for (var attr in attributes) {
if (typeof att... | [
"function unsavedChildren(obj, allowDeepUnsaved) {\n var encountered = {\n objects: {},\n files: []\n };\n var identifier = obj.className + ':' + obj._getId();\n encountered.objects[identifier] = obj.dirty() ? obj : true;\n var attributes = obj.attributes;\n for (var attr in attributes) {\n if ((0, _... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handleSocketDataResponse([ServerCommsObject] dataArray) Called by ServerComms.js file upon receiving data from the server. If server returns valid data, do something with the state as appropriate to the object type. If server returns objects with null state, then server has no state and this panel should initialize the... | function handleSocketDataResponse(dataArray)
{
if(dataArray == null)
{
alert("null dataArray in handleSocketDataResponse");
return;
}
var undefinedItemsToUpdate = [];
for(var i in dataArray)
{
if(dataArray[i].value != undefined)
{
if((typeof set... | [
"function onUpdateSlideDataSocket(data) {\n console.log('Received socket with data…', data)\n processServerData(data)\n\n // Restart polling. We only use polling when we don’t hear from the server via\n // websockets, and since we just heard from them…\n resetPolling()\n}",
"function handleSocketMessage(data... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function for movePlayer to make sure a move is permitted before allowing the player to enter the square. | function checkPermittedMove(direction) {
var targetSquare = null;
mapWidth = mapLocations[currentLocation][0][1].length;
mapHeight = mapLocations[currentLocation][0].length;
switch (direction) {
case "up":
// Make sure player isn't already at the top of the map, but let them move if ... | [
"move (x, y) {\n\t\t// Convert the input coords to array coords\n\t\tvar arr_x = Math.floor((x)/70);\n\t\tvar arr_y = Math.floor((y)/70);\n\t\tvar new_square = this.board.get_square(arr_x, arr_y);\n\n\t\t// Check to see if the square clicked is 1 space up, down, left, or right.\n\t\tif(Math.abs(arr_x - this.square.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a random id that mimics a guid. | static createGuid() {
return Math.random().toString(36).substring(2, 15) +
Math.random().toString(36).substring(2, 15);
} | [
"function makeGuid() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c){\n var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);\n return v.toString(16);\n });\n}",
"function generateId() {\n return Math.floor(Math.random() * Date.now())\n}",
"function guid() {\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |