query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
this variable will keep track of when and if the mouse is within one of the canvas(es) this event handler will register in which box is the mouse
function mouseoverhandler(event) { mouseIn = event.target.id; //console.log("the mouse is over canvas:: " + mouseIn); }
[ "function mouseMoved(){\r\n\tonRect1 = rectX1 < mouseX && // checks if x pos is true\r\n\t\tmouseX < (rectX1 + rectW) && // checks if width of rect is true\r\n\t\trectY1 < mouseY && // checks if y pos of rect is true\r\n\t\tmouseY < (rectY1 + rectH); // checks if height of rect is true\r\n\r\n\tonRect2...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether labels are associated with this layer.
get hasLabels() { return this._hasLabels; }
[ "function isObligatoryLabel(label){\t\r\n\treturn obligatoryDataElementsLabel.includes(label);\r\n}", "labeled() {\n return getLabels(this.grid);\n }", "placeholderHidden() {\n return !!(this.labels.length > 0 || this.value);\n }", "drawLayerLabels() {\n let row = 0;\n // Iterate t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the plugin was added successfully, false otherwise.
loadAndAdd(pluginName) { try { const plugin = this.loadPlugin(pluginName); this.log.debug(pluginName + " loaded correctly."); this.addPlugin(plugin); return true; } catch (e) { this.log.warn(e); this.log.warn(`Failed to initialize p...
[ "function registerPlugin (aPlugin)\n //--------------------------------------------------------------------\n {\n checkParam (aPlugin, \"object\");\n checkParam (aPlugin.id, \"string\");\n\n if (aPlugin.type === \"view\")\n {\n boc.ait.registerView (aPlugin);\n }\n else\n {\n checkP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the default charset for a MIME type.
function charset(mimeType) { const entry = mimeTypes[mimeType]; if (entry && entry.charset) { return entry.charset; } if (Str.begins(mimeType, "text")) { return "UTF-8"; } return void(0); }
[ "function charset(type) {\n const m = EXTRACT_TYPE_REGEXP.exec(type);\n if (!m) {\n return;\n }\n const [match] = m;\n const mime = deps_ts_1.db[match.toLowerCase()];\n if (mime && mime.charset) {\n return mime.charset;\n }\n if (TEXT_TYP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the hunk exactly fits on the provided location
function hunkFits(hunk, toPos) { for (var j = 0; j < hunk.lines.length; j++) { var line = hunk.lines[j], operation = line.length > 0 ? line[0] : ' ', content = line.length > 0 ? line.substr(1) : line; if (operation === ' ' || operation === '-') { // Context sanit...
[ "function checkCollision(location, collisionDistance) {\n //first have to project...\n var locationProj = getScreenCoords(location);\n if (!locationProj)\n return true;\n\n var hitTestResult = ge.getView().hitTest(locationProj[0], ge.UNITS_PIXELS, locationProj[1], ge.UNITS_PIXELS, ge.HIT_TEST_BUI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FETCHING DATA AND GENERATING HREF VALUES FOR LINKS generates a random href value for a link dependng on the list of tilde boxes
function link_random_tildebox() { fetchJSONFile( tildeboxlist_urls , function(data) { var urls = normalize_tilde_urls( obj_values(data) ); document.getElementById('random_tildebox').href = random_item(urls); }); }
[ "function link_users() {\n fetchJSONFile( userlist_url,\n function(users) {\n\n var user_url = users[user()].homepage,\n urls = normalized_user_urls(obj_values(users)),\n\n random_user_link = document.getElementById('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check telephonesArray hide telephone's btns if telephones are empty show telephone's btns if telephones have at least one telephone
function displayTelephoneBtns() { if (telephonesArray.telephones.length > 0) { updateTelephoneBtn.style.display = "inline-block"; deleteTelephoneBtn.style.display = "inline-block"; } else { updateTelephoneBtn.style.display = "none"; deleteTelephoneBtn.style.display = "none"; ...
[ "function onLoad() {\n for(var i=0;i<contacts.length;i++) {\n if(i<=9) {\n contacts[i].style.display = \"\";\n }\n else\n {\n contacts[i].style.display = \"none\";\n }\n }\n}", "function noPhoneNumber(input) {\n let output = [];\n for (let i = 0; i ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
really only used for testing purposes, to masquerade as a normal piped stream. do not use in general; use .with() and .pipeline() above instead.
pipe(out) { return reduce(((x, y) => x.pipe(y)), this.streams[0], this.streams.slice(1)).pipe(out); }
[ "function pipeAndWrap (res, stream) {\n res.on('close', function () { stream.emit('close') })\n stream.httpVersion = res.httpVersion\n stream.headers = res.headers\n stream.trailers = res.trailers\n stream.setTimeout = res.setTimeout.bind(res)\n stream.method = res.method\n stream.url = res.url\n stream.sta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mark the transaction to be ignored.
ignore() { this._transaction.setForceIgnore(true) }
[ "skipTransaction(transaction, reason) {\n transaction.skip = true;\n\n this.ensureTransactionErrors(transaction);\n if (reason) {\n transaction.errors.push({ severity: 'warning', message: reason });\n }\n\n if (!transaction.test) {\n transaction.test = this.createTest(transaction);\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add or remove accessories to match the available appliances
async addRemoveAccessories(appliances) { // Update the configuration schema await this.schema.setAppliances(appliances); // Add a Homebridge accessory for each new appliance let newAccessories = []; appliances.forEach(ha => { // Select a constructor for this applianc...
[ "async updateAppliances() {\n while (true) {\n try {\n await this.homeconnect.waitUntilAuthorised();\n let appliances = await this.homeconnect.getAppliances();\n this.log.debug('Found ' + appliances.length + ' appliances');\n await this.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
para publicar en facebook
function facebook(cancion, artista) { fb.publish({ message : "Voté en www.laquesigue.com para que Kurt Dyer toque "+cancion+".", picture : "http://www.laquesigue.com/images/album.png", link : "http://www.laquesigue.com", name : "La Que Sigue", description : "Vota en www.laquesigue.com ...
[ "function publishStory() {\n FB.ui({\n method: 'feed',\n name: 'Test',\n caption: 'Restaurant',\n description: 'Tasty restaurant',\n link: 'http://apps.facebook.com/mobile-start/',\n picture: 'http://www.facebookmobileweb.com/hackbook/img/facebook_icon_large.png',\n actions: [{ name: 'Get Star...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper method that finds the stack that includes a given number
find_stack_by_contents(num){ for (let i = 0; i < this.board.length; i++){ if (this.board[i].current_set.includes(num)){ return this.board[i] } } }
[ "findNodePos(number) {\n for (let layer = 0; layer < this.nodes.length; layer++) {\n for (let node = 0; node < this.nodes[layer].length; node++) {\n if (this.nodes[layer][node].number === number) return [layer, node];\n }\n }\n return false;\n }", "findNode(number) {\n for (let layer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an XML element, adds it to another element, and returns the created element
function addAndReturnElement(elNameToAdd, nameSpace, xmlElement, preserveSpaces) { var elToAdd = document.createElementNS(nameSpace, elNameToAdd); if (preserveSpaces) Utils.setPreserveSpace(elToAdd); xmlElement.appendChild(elToAdd); return elToAdd; }
[ "function addElement(doc, parent, name, text) {\n\tvar e = doc.createElement(name);\n\tvar txt = doc.createTextNode(text);\n\t\n\te.appendChild(txt);\n\tparent.appendChild(e);\n\t\n\treturn e;\n}", "function addElement(prevElement, element, attribute, attrValue) {\n if (prevElement != \"\") {\n prevEle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setCorrelation() Sets the correlation to use for dequeuing messages.
setCorrelation() { errors.throwNotImplemented("setting correlation (dequeue options)"); }
[ "setTransformation() {\n errors.throwNotImplemented(\"setting transformation (dequeue options)\");\n }", "function set_remix (value)\n {\n remix = value;\n modify();\n }", "function CorrelationPlotter(options) {\n options = options || {};\n var that = this,\n nod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exercise A Write a function which takes one of these objects and puts them into an array which is sorted from most popular to least popular. For example, in Group B, the most popular dessert is "pie", so it should be first in the array. For "ties", the order doesn't matter. HINT: You'll need to do this in 2 steps: Firs...
function sortDessertsByPopularity(dessertObject) { let dessertArray = Object.values(dessertObject) let countObject = {} dessertArray.forEach((dessert) =>{ countObject[dessert] = 0 }) dessertArray.forEach((dessert) =>{ countObject[dessert] = countObject[dessert] + 1 }) console.log('this is the co...
[ "function sortGroceries() {\n let categories = Array.from(new Set(groceryList.map((grocery) => grocery.category))).sort();\n let tempgroceryList = [];\n categories.forEach((category) => {\n let currentCategoryItems = groceryList.filter((grocery) => grocery.category == category);\n currentCate...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
l10n dictionary functions fetch an l10n object, warn if not found, apply `args' if possible
function getL10nData(key, args, fallback) { var data = gL10nData[key]; if (!data) { console.warn('#' + key + ' is undefined.'); if (!fallback) { return null; } data = fallback; } /** This is where l10n expressions should be processed. * The plan is to support C-sty...
[ "function gettext(msgid) {\n if (bundle) {\n if (typeof bundle[msgid] === \"string\") {\n return bundle[msgid];\n }\n console.warn(\"[i18n]\", bundle_path, msgid, undefined);\n }\n return msgid;\n}", "function getStringBasedOnLocale(langDictKey, stringKey, obj) {\n return substitute(langDi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: Refactor to have less duplicated code / Similar to factResponse(), but supports returning facts for multiple numbers in order support making batch requests
function factsResponse(fact, req, res, nums) { var useJson = req.params.json !== undefined || (req.header("Content-Type") || "").indexOf("application/json") !== -1; var factsObj = {}; _.each(nums, function (num) { const type = req.params.type || "trivia"; var factObj = fact.getFact({ number: num, ...
[ "function getFavoriteFact(number) {\n const resp = axios.get(`${BASE_URL}/${number}?json`);\n return resp;\n}", "function getFacts() {\n API.getCountryFacts(country).then((res) => {\n setFacts(res.data);\n });\n }", "static get mapResults () {\n return response => {\n const results = A...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::S3::AccessPoint.VpcConfiguration` resource
function cfnAccessPointVpcConfigurationPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnAccessPoint_VpcConfigurationPropertyValidator(properties).assertSuccess(); return { VpcId: cdk.stringToCloudFormation(properties.vpcId), }; }
[ "function cfnAccessPointObjectLambdaConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAccessPoint_ObjectLambdaConfigurationPropertyValidator(properties).assertSuccess();\n return {\n AllowedFeatures: cdk.listMapper(cdk.st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an initial array for the reservations.
function resetReservations(){ reservationsJSONarr = {}; for(var part in progressData){ var segments = progressData[part].segments; newReservePart(part, segments); } //"part" that holds data for whole segments newReservePart("allsegm", segments); }
[ "function newReservePart(part, segments){\n \n reservationsJSONarr[part] = { \n removed: false, \n reserved: false,\n segments: {} };\n \n for(var segm in segments){\n \n var jCell = { isReserved: false };\n \n reservationsJSONarr[part].segments[segm] = jCell...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement the function getLocationName that Accepts a location and available transports in an array e.g:["Tower Bridge", "tube", "river boat"] Returns the name of the location e.g: "Tower Bridge"
function getLocationName() {}
[ "function getLocationByName(locations, name) {\n return locations.filter(location => location.name === name)[0];\n}", "function getLocation(name){\n var location = _.detect(locations, function(location){\n return name.match(location.re);\n });\n return location ? location.address : '';\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize the pusher which will run the modal
initPusher () { if (this.hasAttribute('pusher')) { var pusher = this.getAttribute('pusher'); this.pusher = pusher; } }
[ "getAndSetModalOnUI() {\n this.modalOnUI = document.getElementById(\"iovon-hybrid-modal\");\n }", "function firstTimePushSetup() {\n // Start fetching the channel ID (it will arrive in the callback).\n chrome.pushMessaging.getChannelId(true, channelIdCallback);\n // chrome.app.window.create('index.ht...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Global configuration handlers / Configure the GPT library for the current page this method is pushed onto the googletag command queue and run when the library is available
function setup(gptConfig) { const nonPersonalized = config('nonPersonalized') ? 1 : 0; googletag.pubads().addEventListener('slotRenderEnded', onRenderEnded); enableCompanions(gptConfig); setRenderingMode(gptConfig); setPageTargeting(targeting.get()); setPageCollapseEmpty(); if (gptConfig.hasOwnProperty('enableL...
[ "function onReady(slotMethods, event) {\n\tconst slot = event.detail.slot;\n\t/* istanbul ignore else */\n\tif (slot.server === 'gpt') {\n\t\tslot.gpt = {};\n\n\t\t// extend the slot with gpt methods\n\t\tutils.extend(slot, slotMethods);\n\n\t\t// setup the gpt configuration the ad\n\t\tgoogletag.cmd.push(() => {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save takes an item, if there is no data in the database then it stores that single item. If there is data then it adds the new item to the exisiting data
save(item){ //if there is no data if(!this.data){ this.data = [item]; //create newData to store let newData = JSON.stringify(item); //pass in newData this.storage.set('todos', newData); } else { //if there is data, then push the new data this.data.push(item); le...
[ "function saveData(route, item){\r\n\t\t// save model with \"all\" data\r\n\t\tvar insertData, collection;\r\n\t\tif(monitor[route][item]){\r\n\t\t\tmonitor[route][item](function(err,data){\r\n\t\t\t\tif(err){\r\n\t\t\t\t\tconsole.error(\"err in saveData() : \", data);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removes all nodes from options
function clearNodeOptions() { var startList = document.getElementById("selectStart"); var goalList = document.getElementById("selectGoal"); let length = startList.length; for (i = length - 1; i >= 1; i--) { startList.removeChild(startList.childNodes[i]); goalList.removeChild(goalList.childNodes[i]); ...
[ "unsetNodes(editor, props) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (!Array.isArray(props)) {\n props = [props];\n }\n\n var obj = {};\n\n for (var key of props) {\n obj[key] = null;\n }\n\n Transforms.setNodes(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sort the objects in the array by age
function byAge(arr){ return arr.sort((a, b) => a.age - b.age) }
[ "function SortByAge() {\n player = players.sort(function (a, b) {\n return b.age - a.age\n });\n}", "function SortByNamexOlderThan(age) {\n let choosenPlayers = []\n for (const player of players) {\n if (player.age >= age) {\n let sortedAwards = player.awards\n sortedAwards.sort((award1, award...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at Tests the getCalendarInfo function with a diverse set of arguments.
function checkCalendarInfo(info, expected) { Object.getPrototypeOf(info); Object.prototype; info.firstDayOfWeek; expected.firstDayOfWeek; info.minDays; expected.minDays; info.weekendStart; expected.weekendStart; info.weekendEnd; expected.weekendEnd; info.calendar; expected.calendar; info.local...
[ "function getCalanders() {\n var response = Calendar.CalendarList.list();\n for(i = 0 ; i<response.items.length ; i++){\n Logger.log(\"(\" + response.items[i].summary + ')' + response.items[i].id);\n }\n}", "function igcal_getCalendarById(id, e)\r\n{\r\n\tvar o,i1=-2;\r\n\tif(e!=null)\r\n\t{\r\n\t\twhile(tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts the code of a global error validation from the specified request.
function extractGlobalErrorCode(request) { var error = JSON.parse(request.responseText); if (error.ValidationErrors == undefined) return ""; var verrors = error.ValidationErrors; if (verrors.globalError != undefined) return verrors.globalError.cod...
[ "function get_code(req, res) {\n\t\tif (req._client_event === true && req.body) {\n\t\t\treturn !isNaN(req.body.http_code) ? Number(req.body.http_code) : 500;\n\t\t} else {\n\t\t\treturn t.ot_misc.get_code(res);\t\t\t\t\t\t\t\t// normal requests end up here\n\t\t}\n\t}", "function getValidHttpErrorCode (err) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Executes query from HTTP GET request on database table SENSOR
function handleGet(connection,req,res) { // Fetch parameter to limit result set rows var limit = ('undefined' === typeof req.params.limit) ? 20: req.params.limit; // Limit result set to maximum 1000 rows if (limit > 1000){limit = 1000;} // Construct query var query = 'SELECT SENS_Ruid,SENS_Ite...
[ "function dataDayTemp(){\napp.get('/api/statisticsByDay/Temp', (req, res)=>{\n let sql = \"SELECT * FROM SensorTemp WHERE Date = '\"+valueDate+\"';SELECT MAX(Temp) FROM SensorTemp WHERE Date = '\"+valueDate+\"';SELECT MIN(Temp) FROM SensorTemp WHERE Date = '\"+valueDate+\"';SELECT SUM(Temp) FROM SensorTemp WHERE D...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function displays a message when there are no items in checkout
function displayEmpty() { checkoutContainer.empty(); var messageH2 = $("<h2>"); messageH2.css({ "text-align": "center", "margin-top": "50px" }); messageH2.html("No purchases yet , navigate <a href='/view_products'>here</a> if you wish to purchase a product."); checkoutContainer.append(mess...
[ "function showEmptyWarning() {\n\tif(!$(\"ul\").has(\"li\").length) {\n\t\t$('#emptyWarning').show();\n\t\t$('#emptyWarning').html(\"<p>No items.</p>\");\n\t\t$('#clearTasks').hide();\n\t\t} else {\n\t\t\t$('#emptyWarning').hide();\n\t\t}\n}", "function displayEmpty() {\n productContainer.empty();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A reed solomon errorcorrecting encoding constructor is created by passing as Galois Field with of size equal to the number of code words (symbols) in the alphabet (the number of values in each element of arrays that are encoded/decoded).
function ReedSolomonEncoder(field){this.field=field;this.cachedGenerators=[];this.cachedGenerators.push(new GenericGFPoly(field,Int32Array.from([1])));}
[ "function encoderSolution(raw, coded_words) {\n mapping = {}\n ans = []\n var uniqueRaw = Array.from(new Set(raw));\n for (i=0; i<uniqueRaw.length; i++) {\n mapping[uniqueRaw[i]] = coded_words[i]\n }\n for (i of raw) {\n ans.push(mapping[i]);\n }\n return ans\n}", "function RomanNumeralEncoder(){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Select a message for display by header. Attempt to select the message right now. If we were unable to find it, update our saved selection to want to display the message. Threads are expanded to find the header.
selectMessage(aMsgHdr, aForceSelect) { let viewIndex = this.view.getViewIndexForMsgHdr(aMsgHdr, aForceSelect); if (viewIndex != nsMsgViewIndex_None) { this._savedSelection = null; this.selectViewIndex(viewIndex); } else { this._savedSelection = { messages: [{ messageId: aMsgHdr.mes...
[ "selectMessages(aMessages, aForceSelect, aDoNotNeedToFindAll) {\n let treeSelection = this.treeSelection; // potentially magic getter\n let foundAll = true;\n if (treeSelection) {\n let minRow = null,\n maxRow = null;\n\n treeSelection.selectEventsSuppressed = true;\n treeSelection.cl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
to show all reviews for one particular hotel given hotelID
retrieveReviewsForHotelById(id){ return axios.get(`${CONST_API_URL}/showReviewForHotel/${id}`) }
[ "static showCachedReviews(id) {\n \n return RestaurantDBHelper.openDatabase().then(function(db) {\n if (!db ) return;\n \n var index = db.transaction('reviews')\n .objectStore('reviews');\n return index.getAll().then((allReviews) => {\n // Filter reviews to have only given id\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save items in the interface of a nwjs app to a png file. Usage var SaveToPNG=require('nwjstopng').Save; var InterfaceObject=document.getElementById('idofobject'); var NameWithoutExtension="./results/picofidofobject"; SaveToPNG(InterfaceObject, NameWithoutExtension) Limitations: This will only save what is visible on th...
function CaptureAndSave(InterfaceObject, NameWithoutExtension) { var gui = require('nw.gui'); var win = gui.Window.get(); var fs = require('fs'); function CaptureRegion(rect, callback, format) { win.capturePage(function(data) { var img = new Image(); img.onload = function() { var canvas = docume...
[ "saveToPNG() {\n this.downloadEl.download = 'pattar.png';\n this.downloadEl.href = this.renderCanvas.toDataURL(\"image/png\").replace(\"image/png\", \"image/octet-stream\");\n this.downloadEl.click();\n }", "save() {\n for (let id in this.windows_) {\n let elem = th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a cached tile or request a new one if not in cache
_requestTile(quadcode, layer) { var tile = this._tileCache.getTile(quadcode); if (!tile) { // Set up a brand new tile tile = this._createTile(quadcode, layer); // Add tile to cache, though it won't be ready yet as the data is being // requested from various places asynchronously ...
[ "get(url) {\n const cached = splunkd.cached.cache[url];\n\n if (cached) {\n return cached;\n }\n\n const result = splunkd.cached.cache[url] = splunkd.get(url);\n return result;\n }", "async function networkFirst(req) {\n const cache = a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update tables ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Initialize the `vm info` DataTable and set up an automatic reload
function initVMInfoDataTable() { var path = window.location.pathname; path = path.substr(0, path.indexOf("/vms")); var vmDataTable = $('#vms-dataTable').DataTable({ "ajax": function( data, callback, settings) { updateJSON(path+'/vms/info.json', function(vmsData) { // dis...
[ "function initVMTopDataTable() {\n var path = window.location.pathname;\n path = path.substr(0, path.indexOf(\"/vms\"));\n\n var vmDataTable = $('#vms-dataTable').DataTable({\n \"ajax\": function(data, callback, settings) {\n updateJSON(path+'/vms/top.json', function(vmsData) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Locates the next tNode (child, sibling or parent).
function traverseNextElement(tNode) { if (tNode.child) { return tNode.child; } else if (tNode.next) { return tNode.next; } else if (tNode.parent) { return tNode.parent.next || null; } return null; }
[ "function next () {\r\n return this.siblings()[this.position() + 1]\r\n}", "next() {\n let tmp = this.currentNode.next();\n\n if (!tmp.done) {\n this.currentNode = tmp.value;\n this.ptree();\n }\n\n return tmp;\n }", "function getNextSibling(node, tag){\n\tif (!tag) tag = node.nodeName;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
console.log(whoIsTheGrandParent(tree2, 8));// should return 3 console.log(whoIsTheGrandParent(tree2, 4));// should return 1 console.log(whoIsTheGrandParent(tree2, 33));// should return 1 console.log(whoIsTheGrandParent(tree2, 5));// should return 1 console.log(whoIsTheGrandParent(tree2, 2)); // should return undefined
function whoIsTheParent(tree, target) { let parentValue = tree['value']; let children = tree['children']; for(let child of children){ if(child['value']===target){ return parentValue }else { if(child['children'].length!==0){ if(whoIsTheParent(child,targ...
[ "isParent(valueParent, valueChild) {\n //2 same values return false\n if(valueParent === valueChild) return false;\n //Get the node object corresponding to our values\n let [existChild, nodeChild, nodeChildDirectParent, ] = this.find(valueChild);\n let [existParent, nodeParent, , ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates N spheres of radius R. When initializing, it is not smart to initialize positions and velocities randomly! Particles might be too close to each other, and this will lead to very large accelerations. current Algorithm: Generate a uniform grid, that is based on the radius, so that spheres of radius R can be put...
function generateNSpheres(N, R) { var r_margin= R * 1.2 var D = 2 * R ; var d_margin = 2 * R * 1.5 ; // 50% margin between 2 objects var elem_on_one_line = parseInt(1 / d_margin); var maxIndex = elem_on_one_line ** 2; const spheres = new Array(); if (maxIndex < N) { throw new Error...
[ "function SphereParticleEmitter(/**\n * The radius of the emission sphere.\n */radius,/**\n * The range of emission [0-1] 0 Surface only, 1 Entire Radius.\n */radiusRange,/**\n * How much to randomize the particle direction [0-1].\n */directionRandomizer){if(radius===...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserdrop_index.
visitDrop_index(ctx) { return this.visitChildren(ctx); }
[ "visitDrop_index_partition(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitDrop_procedure(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitDrop_table(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitDel_stmt(ctx) {\r\n console.log(\"visitSivisitDel_stmt\");\r\n return { ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[UNSUBSCRIBE Frame]( `id` is MANDATORY. It is preferable to unsubscribe from a subscription by calling `unsubscribe()` directly on the object returned by `client.subscribe()`: var subscription = client.subscribe(destination, onmessage); ... subscription.unsubscribe(headers);
unsubscribe(id, headers = {}) { delete this.subscriptions[id]; headers.id = id; return this._transmit("UNSUBSCRIBE", headers); }
[ "function unsubscribe() {\n getSubscription().then(subscription => {\n return subscription.unsubscribe()\n .then(() => {\n console.log('Unsubscribed ', subscription.endpoint)\n return fetch('http://localhost:4040/unregister', \n {\n method: 'POST',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a join function by a predicate that tests possible base paths from an iterator. The `predicate` is of the form: ``` function(filename, uri, base, i, next):string|null ``` Given the uri and base it should either return: an absolute path success a call to `next(null)` as failure a call to `next(absolute)` where ab...
function createJoinForPredicate(/** predicate A function that tests values */ predicate, /** Optional name for the resulting join function */ name) { /** * A factory for a join function with logging. */ function join(/** The current file being processed */ filename, /** An options hash */ options) { c...
[ "function join_end(xs, end) /* (xs : list<string>, end : string) -> string */ {\n if (xs == null) {\n return \"\";\n }\n else {\n return ((joinsep(xs, end)) + end);\n }\n}", "function getResource(map, base, internal, path, callback, addLineHints) {\n\t\tvar\n\t\t\treduced = reduce(map, path),\n\t\t\tre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the permission for a user on a layer
userPermissionRemove( { commit, dispatch, rootState, rootGetters }, { id, userId } ) { dispatch('sync/start', `layersUserPermissionRemove`, { root: true }) return rootState.api .removeLayerPermissionsForUser(id, userId) .then(p => { const permissions = p.data disp...
[ "groupPermissionRemove(\n { commit, dispatch, rootState, rootGetters },\n { id, groupId }\n ) {\n dispatch('sync/start', `layersGroupPermissionRemove`, {\n root: true\n })\n return rootState.api\n .removeLayerPermissionsForGroup(id, groupId)\n .then(p => {\n const permissions =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update a changelog with any commits made since the last release. Commits for PRs that are already included in the changelog are omitted.
async function updateChangelog({ changelogContent, currentVersion, repoUrl, isReleaseCandidate, projectRootDirectory, }) { if (isReleaseCandidate && !currentVersion) { throw new Error(`A version must be specified if 'isReleaseCandidate' is set.`); } const changelog = parse_changelog_1.parseChangelog...
[ "async function update_changelog() {\n let options = {\n remote: \"origin\",\n commitLimit: 10000,\n backfillLimit: 10000,\n tagPrefix: \"\",\n sortCommits: \"relevance\",\n appendGitLog: \"\",\n appendGitTag: \"\",\n latestVersion: NEW_VERSION,\n };\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
play the targeted video (and hide the poster frame)
function videoPlay($wrapper) { var $iframe = $wrapper.find('.js-videoIframe'); var src = $iframe.data('src'); // hide poster $wrapper.addClass('videoWrapperActive'); // add iframe src in, starting the video $iframe.attr('src', src); }
[ "function swapvideo() {\r\n//swap the poster image\r\n$('#playvideo').attr('poster', poster);\r\n//swap the core html\r\n$('#playvideo').html('<source src=\"'+src+'\" type=\"video/mp4\"/>' +\r\n'<p><br><br>' +'Your browser does not support the HTML 5 video. ' +\r\n'<a href=\"'+src+'\"> ' +'Try downloading the video...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start of use strict / Add to Cart Sticky
function add_cart_sticky(){ if($('.sticky-addcart').length > 0){ $('.sticky-addcart').each(function(){ var self = $(this); var cart = self.prev().find('form.cart'); var st = $(window).scrollTop(); var ot = cart.offset().top; ...
[ "addToCart() {\n const requestConfig = {};\n requestConfig.data = {\n quantity: this.installDetails.parentProductQuantity,\n product: {\n code: this.installDetails.code,\n },\n additionalAttributes: {\n entry: [{\n key: 'installedEntry',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes one document from collection
static async deleteOne(doc) { try { const modelName = this.name.toLowerCase(); return db .collection(modelName) .doc(doc[".key"]) .remove(); } catch (error) { console.log("Error occured while performing operation", error); } }
[ "deleteDoc(doc) {\n this.docs.delete(doc.getIdentifier());\n }", "remove({ Meteor }, { _id }) {\n Meteor.call(\n 'documents.remove',\n {\n _id,\n }, (error) => {\n if (error) {\n Bert.alert(error.reason, 'danger');\n } else {\n Bert.alert('Documen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a guest by calling enterGuest, and close the dialog.
function addGuest() { enterGuest(); dialog.dialog("close"); // This probably doesn't belong here, but it seems to work. It prevents the following: fill out form, click review, click add guest, menu is still showing. Which is not a real big problem, since clicking will not attend stil...
[ "function addNewGuest() {\n text = input.value;\n if (dataValidation['inputCheck']()) {\n if (dataValidation['existCheck']()) {\n console.log(logTxt['exsistCheckError']);\n dataValidation['exists']();\n } else {\n dataValidation['correct']();\n console...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IF food >= 1, decrement food ELSE isHealthy = false
eat() { if (this.food >= 1) { this.food -= 1 } else { this.isHealthy = false } }
[ "function upkeep() {\n\t\tif (state.food > 0) {\n\t\t\tstate.food--;\n\t\t} else {\n\t\t\tstate.health--;\n\t\t}\n\t}", "function eatFood() {\n if (snake.position = food) {\n snake.length =+ 1;\n }\n }", "hunt() {\n this.food += 2\n }", "function checkFood(food){\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an array of KalturaBaseEntry objects by a commaseparated list of ids.
static getByIds(entryIds){ let kparams = {}; kparams.entryIds = entryIds; return new kaltura.RequestBuilder('baseentry', 'getByIds', kparams); }
[ "function entriesBulk(entries, har_id) {\n let entries_bulk = [];\n \n entries.forEach(entry => {\n let new_entry = {\n har_id,\n startedDateTime: entry.startedDateTime,\n serverIPAddress: entry.serverIPAddress,\n timings_wait: entry.timings_wait,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends a signin API call and handles the results.
static sign_in(callback = null) { // Hide the inputs window.UI.hide("authenticate-inputs"); // Change the output message this.output("Hold on - Signing you in..."); // Send the API call window.API.send("authenticate", "signin", { name: window.UI.find("authenti...
[ "function signin(){\n var payload = {\n \"username\": username.value,\n \"password\": password.value\n };\n\n send_post_request(window.location.origin + '/api/rest-auth/login/', payload, function (data, status){\n\n if (status == 200 || status == 201){\n signin_message.inner...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
console.log(twoItemArr([1,2,3,4,5,6])); Given a base and an exponent, create a function to find the power Time: O(n) Space: O(1)
function findPower(base,exponent){ let result = 1; function findHelper(i){ if(i > exponent){ return; } result *= base; findHelper(i + 1); } findHelper(1); return result; }
[ "function myPow(base, exp) {\n var num = 1;\n for (var i = 0; i < exp; i++) {\n num *= base;\n }\n return num;\n}", "function pow (baseNum, power){\n var answer = 1;\n\n for(var i = 0; i < (power) ; i++){\n answer *= multiply(baseNum, 1);\n console.log(answer);\n }\n console.log(answe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
jshint browser: true, devel: true, globalstrict: true ========== EVERY UNIT ========== This file includes the construction of any unit, that is any moving entity. There is another kind of entity which is not covered here: A building. Units and buildings are rather distinct, so that this approach makes sense. Examples f...
function unit(descr, image, names, icon, stats, color, ability, flying) { // Common inherited setup logic from Entity this.setup(descr); this.sprite = image[0]; this.sprite_normal = image[0]; this.sprite_corpse = image[1]; this.sprite_attack = image[2]; this.sprite_gold = image[3]; thi...
[ "function Game_UnitTS() {\n this.initialize.apply(this, arguments);\n}", "constructor(name, pixelWidth, pixelHeight, pixelOffsetX, pixelOffsetY, sight, hitPoints, cost,\n spriteImages, defaults, radius, range, moveSpeed, interactSpeed, firePower, builtFrom, weaponType) {\n super(name, pixelWidth, pixelHe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copyright (c) 2015present, Facebook, Inc. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. strict Produces a new schema given an existing schema and a document which may contain GraphQL type extensions and definitions. The original schema will remai...
function extendSchema(schema, documentAST, options) { !Object(_type_schema__WEBPACK_IMPORTED_MODULE_7__["isSchema"])(schema) ? Object(_jsutils_invariant__WEBPACK_IMPORTED_MODULE_0__["default"])(0, 'Must provide valid GraphQLSchema') : void 0; !(documentAST && documentAST.kind === _language_kinds__WEBPACK_IMPORTED_M...
[ "function convertFromSchema(schema, options) {\n\tschema = convertSchema(schema, options);\n\n\tschema['$schema'] = 'http://json-schema.org/draft-04/schema#';\n\n\treturn schema;\n}", "function schemaToModel(schema, obj) {\n if (schema == null) {\n return;\n }\n if (schema.type === \"object\" || s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds all of the dice that are threes to the box for threes, when the checkbox is checked, so long as the user has not done so already. If the user has already added a score value, the AddAlert() function is called to let them know they can't do that.
function AddThrees(){ checkCtrl = document.getElementById("keepThrees"); boxCtrl = document.getElementById("ThreesValue"); NumberCheck = 3; UpperCheck(); }
[ "function addScore() {\n if (streak > 17) {\n $(\"#scoreMultiplier\").text(\"10\");\n scoreAninmation();\n score = score + 10;\n }\n else if (streak > 5) {\n $(\"#scoreMultiplier\").text(\"5\");\n scoreAninmation();\n score = sco...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event Manage Modal !
function eventManageModal(num) { var newurl = "https://findmy.city/manage_event.php?mode=modal&e_id=" + num; var options = { url: newurl, title: 'Manage Event', size: 'xl', subtitle: '' }; eModal.ajax(options); }
[ "onCreateEventClick() {\n set(this, 'showCreateEventModal', true);\n }", "function fnBindEventDataTableControls() {\n jQuery('.btnDelete').on('click', function (event) {\n event.preventDefault();\n var arrayRowId = this.id.split('-');\n var id = arrayRowId[1];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
submits the form data to the Firebase mailing list
handleFormSubmit() { let newEntry = { "first": this.state.first, "last": this.state.last, "email": this.state.email, "interest": this.state.interest }; let newUidRef = this.props.mlRef.push(); /* send data to Firebase mailing list. entry stored at auto generated UID */ let p1 = n...
[ "function submitFlare() {\n var ticket = $(\"#ticket_num\").val();\n if (ticket == \"\") ticket = \"0\";\n\n var email = $(\"#email\").val();\n var regex = /\\S+@\\S+\\.\\S+/; // string - @ - string - . - string\n if ( !regex.test(email) ) {\n $(\"#flare_description\").html(\"Please enter a valid email ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isHandComplete checks if the hand is complete. the complete state is met when the second to last player folded or timed out, or once everyone has shown in showdown. replaces: checkForNextHand
isHandComplete(lineup, dealer, state) { const activePlayers = activeLineup(lineup, dealer, state, this.rc); const allInPlayerCount = this.countAllIn(lineup); if (state === 'showdown') { if (checkForReceipt(lineup, Type.SHOW, this.rc)) { return (activePlayers.length === 0 && allInPlayerCount ==...
[ "function checkHand(current_hand) {\n let trump_count = 0;\n let queen_count = 0;\n let jack_count = 0;\n let total_points = 0;\n\n // Searching for all the trump, queens, and jacks (while adding up point total as well)\n for(let i = 0; i < current_hand.length; i++) {\n if(current_hand[i].c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the item from the form and add it to an array (this.state.itemArr).
onButtonClick(evt){ evt.preventDefault(); var form = ReactDOM.findDOMNode(this.refs.inputForm.textInput); var item = form.value; //create a new array instead of pushing to the old one! var updatedArr = this.state.itemArr.concat(item); this.setState({itemArr: updatedArr}); console.log(this.st...
[ "addItem(item) {\n let newItem = { ...item, id: uuidv4() }; //taking the existing item with only name and id coming from the form and adding an id field\n this.setState(state => ({\n items: [...state.items, newItem] //spread operator syntax, it sets items to be all the existing state items plus the new i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`_readEntity` reads an IRI, prefixed name, blank node, or variable
_readEntity(token, quantifier) { let value; switch (token.type) { // Read a relative or absolute IRI case 'IRI': case 'typeIRI': const iri = this._resolveIRI(token.value); if (iri === null) return this._error('Invalid IRI', token); value = this._namedNode(iri); ...
[ "renderEntity(entity) {\n switch (entity.type) {\n case (\"Directive\"):\n this.directiveEntity(entity);\n break;\n case (\"Author\"):\n this.authorEntity(entity);\n break;\n case (\"TagOption\"):\n th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if all the numbers in numbers array are divisible by three use array method (every)
function checkEvery(arr) { return arr.every(v => v % 3 == 0 ) }
[ "function multiplesOfThree(arr) {\n return filter(arr, function(elem) {\n return elem % 3 === 0;\n });\n}", "function divisible(arr) {\n\tlet sum = 0;\n\tlet prod = 1;\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tsum += arr[i];\n\t\tprod *= arr[i];\n\t}\n\n\tif (prod % sum === 0) {\n\t\treturn true;\t\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get data from a spreadsheet return call to respfn with array of arranges
function board_getDataRangesFromSheet(spreadsheetId,ranges,respfn) { gapi.client.sheets.spreadsheets.values.batchGet({ spreadsheetId: spreadsheetId, ranges: ranges, }).then(function(response) { if (response.status!=200) { board_error("ERROR A - response " + response.status); return; }; respfn(response...
[ "function gspread_query(range, spreadsheet_id, api_key) {\n api_key = api_key || \"AIzaSyApJBfnH0j3TSugzEABiMFkI_tU_XXeGzg\"\n spreadsheet_id = spreadsheet_id || \"1P0m6nu4CoXVD3nHrCgfm0pEvSpEkLsErjJxTLJLFjp8\"\n range = range || \"Checklists!A1\"\n url = \"https://sheets.googleapis.com/v4/spreadsheets/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
drawGroups: Make a group based on each recession in recessions.csv Bind the recession dates to div.rBox
function drawGroups(){ d3.select('div.viz') //.append('g').attr('id','recessions') .selectAll('div') .data(rec) .enter() .append('div') .attr('class','rBox'); }//CLOSE drawGroups
[ "createGroups() {\n\t\tlet heightScale = d3.scaleLinear().domain([0, 100]).range([0, this.height - this.barGroupHeight]);\n\t\tlet widthScale = d3.scaleLinear().domain([0, 100]).range([0, this.width]);\n\t\tlet invWidth = 1.0 / this.totalBars;\n\n\t\tthis.svg.selectAll(\"g\").remove();\n\t\tlet bargroupsgroup = thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
opponentTurn() Processes opponent's move
function opponentTurn(){ if(matchProceed) { attack(enemyP, playerC); } else { checkGame(); console.log("Game is over."); } opponentLock = false; }
[ "function playerTurn() {\n setMessage(turn + \"'s turn\");\n }", "turnEnd() {\n logger.debug(this.events.turnEnd);\n const isClickedPlayersTurn = this.gameInstance.isPlayersTurn(this.playerID);\n if (!isClickedPlayersTurn) {\n this.emitToAllInGame(this.events.gameDetails, this.gameInstance);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SETS LOCATE STRING ON INIT
function setLocateValues() { if (!locateString && userConfig.locateString) { locateString = userConfig.locateString; } }
[ "function replaceS() {\n strings[string.indexOf(\"words\")] = \"string\";\n}", "function indexOfReplacementStart(syntaxes, str, offset) {\n var syntax;\n var idx = str.length;\n for (var i in syntaxes) {\n var j = str.indexOf(syntaxes[i].open, offset);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate the polygons for Constituency
function genPolys() { for (var i = 0; i < consts.length; i++) { if (!consts[i].name || !dataLookup[consts[i].name] || !dataLookup[consts[i].name].screwedness) { continue; } if (!parseFloat(dataLookup[consts[i].name].screwedness)) { continue; } var coords = []; for (var j = 0; j < consts[i].g...
[ "function genpoly()\n\t\t{\n\t\t\tfind_coordinates(420,0,820,230,numberOfDivsion,1); \n\t\t\t//console.log(\"****************\");\n\t\t\tfind_coordinates(0,230,420,460,numberOfDivsion,0);\n\t\t\tdraw_polygon(m_context);\n\t\t\t//render(mycanvas_context);\n\t\t\tpush_into_stack();\n\t\t\tempty();\n\t\t\t//console.lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save rectangle to text
function recExport(rect) { return [rect.totext, rect.program, rect.height, 'Rectangle', rect.layer]; }
[ "function drawText() {\n push();\n textAlign(CENTER);\n fill(this.color);\n textSize(this.size);\n text(this.txt, this.x, this.y);\n pop();\n}", "saveRectangularFace() {\n this.clearHighlights();\n d3.selectAll('#grid .point-path').remove();\n\n // infer 4 corners of the rectangle based...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make getAllEventByYear filter by year
static async getAllEventsByYear(req, res, next) { try { const { page, size } = req.query; const { limit, offset } = getPagination(page, size); // Year let data = await event.findAndCountAll({ where: { dateEvent: { [Op.between]: [moment().startOf("year"), moment...
[ "function filterYear(data) {\n let filteredData = data.filter(function(d, i) {\n return data[i].year === \"1980\";\n });\n data = filteredData;\n return data;\n }", "function filterByDebut (year) {\n let arr = []\n for (const i of players)\n {\n if (i.debut == yea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the `ChangeElement` currently being tracked given a metadata key, or `undefined` if not found.
getTrackedElement(key) { const memberRevision = this.getSourceMembers()[key]; if (memberRevision) { return RemoteSourceTrackingService.convertRevisionToChange(key, memberRevision); } }
[ "get changeKey()\n\t{\n\t\treturn this._changeKey;\n\t}", "getEntry(t, e) {\n this.assertNotApplied();\n const n = this.changes.get(e);\n return void 0 !== n ? Ks.resolve(n.document) : this.getFromCache(t, e);\n }", "getTag(key) {\n return __awaiter(this, void 0, void 0, function* () {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to set head background color
function headBG() { let headBG = document.getElementById('headBG').value; let thList = document.querySelectorAll('th'); for (let th of thList) { th.style.backgroundColor = headBG; } }
[ "function changeHeadingBg(color){\r\n document.getElementById(\"heading\").style.background = color;\r\n }", "function h1Correct(){\r\n\t\t\th1.style.background = correctColor;\r\n\t\t}", "function changeColor(bottle, color) {\n bottle.attr('style', 'background-color: ' + color);\n }", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is called to drag an object (= slider div)
function dragstart(element) { dragobject = element; dragx = posx - dragobject.offsetLeft + new_slider_pos; }
[ "function Dragon() {\n}", "function mouseDragged(){\n if(dist(mouseX,mouseY,ball.x,ball.y) <= 1.5*ball.r){\n\tball.drag();\n }\n//use the slider control\n if(dist(mouseX,mouseY,slider.x,slider.y) <= 30){\n \tslider.drag();\n slider.control();\n }\n}", "function handleSliderDrag(event){\n\t\t\n\t\tvar di...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns height in ft inches
getHeight() { let original = this.height; //in decimetres let meters = original / 10; let feet = Math.floor(meters * 3.28084); //rounds down to the nearest foot let inches = (meters * 3.28084 - feet) * 12; //takes the remainder of the foot and converts it to inches let inchesRounded = Math.roun...
[ "function getHeightInInches(sideInput){\n return storeInputValues(sideInput, 'getHeightInInch');\n }", "function calculateHeight() {\n\t\treturn (val / capacity) * bottleHeight;\n\t}", "function getHeight() {\n return 2;\n }", "get height() {\n // spec says it is a string\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
look up key codes, ex: 73 => '1'
function mapKey(key) { if (key == 73) { return "1"; } else if (key == 79) { return "2"; } else if (key == 80) { return "3"; } else { return 'Error(mapKey): No key match!' } }
[ "function keyLookup(key) {\n if (key == 'i') {\n return 73\n } else if (key == 'o') {\n return 79\n } else if (key == 'p') {\n return 80\n } else {\n return 'Error(keyLookup): No key match!'\n }\n}", "function getCodeFromKey(key) {\r\n //Constants for key\r\n if (key == STUDENT_INBOX_KEY) r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ExamDB is a file with all the exams for one DB
function ExamDB(_fname){ this.fname = _fname || ""; // the ".edb" suffix is NOT part of this field! this.exams = []; // list of exams in this DB this.questions = []; // a pool of all the questions for this set of exams this.addExam(); this.addQuestion(); return this; }
[ "leerDb() {\n try {\n const informacion = fs.readFileSync(this.pathDb, {\n encoding: 'utf8'\n });\n const { historial } = JSON.parse(informacion);\n return this.historial = historial;\n }\n catch (e) {\n console.error(`Error a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if cookie exists containing access token, add this to the header of each request
function setHeaderWithToken() { var cookie = $.cookie("accessToken"); $(document).ajaxSend(function (event, jqxhr, settings) { jqxhr.setRequestHeader('Authorization', 'bearer ' + cookie); }); }
[ "function attachToken(request) {\r\n var token = getToken();\r\n if (token) {\r\n request.headers = request.headers || {};\r\n request.headers['x-access-token'] = token;\r\n }\r\n return request;\r\n }", "function loadToken() {\n var tokenCookie = \"staticReader\";\n var t_value = documen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copyright (c)2014 Jerry Gable ( Except where otherwise noted, this work is licensed under a Creative Commons AttributionNonCommercial 4.0 International License. this function inserts the prediction in the table and draws it on the map
function insertPredictionResults (predData) { var tmpID = nextPredictionID; nextPredictionID++; // increment before in case one of the below fails. We don't want to repeat. dbg(1, "Starting Table Insertion"); insertPredictionInTable(tmpID, predData); // only show the first 12 altitude pro...
[ "async function draw_prediction(batch, predictions, labels,num_of_pics,start_index){\r\n\tvar guess_accuracy=0;\r\n\tvar drawing_place = document.getElementById(\"show_predictions\");\r\n\tvar tot_accuracy = document.createElement(\"h5\");\r\n\ttot_accuracy.setAttribute(\"id\",\"tot_accuracy\");\r\n\ttot_accuracy.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get element "reward" Display text dependant on number of clicks
function displayReward () { var reward = document.getElementById('reward') if (clicks <= 50) { reward.textContent = "You couldn't even beat my grandma."; } else if (clicks >= 51 && clicks <= 100) { reward.textContent = "Good... Not great."; } else if (clicks >= 101 && clicks <= 150) { ...
[ "function chanceUpdateOnUI() {\n let chanceUpdateElement = document.getElementsByClassName(\"chance\")[0];\n chanceUpdateElement.innerHTML = \"Player \" + (chance === 0 ? \"X\" : \"O\");\n}", "get horseProfile_Career_Good() {return browser.element(\"//android.view.ViewGroup[11]/android.view.ViewGroup/android.vi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
string formatting function replaces FlowFmt constant
function flowFmt(num){ // --- set number of decimal places for reporting flow values if ( FlowUnits == MGD || FlowUnits == CMS ) { return num.toFixed(3).padStart(9); } else { return num.toFixed(2).padStart(9); } }
[ "function SysFmtStringInSet() {}", "function format(str, formats) {\n\tlet cachedFormats = formats;\n\n\tif (!Ember.isArray(cachedFormats) || arguments.length > 2) {\n\t\tcachedFormats = new Array(arguments.length - 1);\n\n\t\tfor (let i = 1, l = arguments.length; i < l; i++) {\n\t\t\tcachedFormats[i - 1] = argum...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end addWord_cb checkClickLocation(e) This function is called by the event listener when the user clicks on anything. It is used to close the suggestion div if the user clicks anywhere that's not inside the suggestion div. It just checks to see if the name of what the user clicks on is not "suggestions" then hides the d...
function checkClickLocation(e) { if(spellingSuggestionsDiv) { // Bah. There's got to be a better way to deal with this, but the click // on a word to get suggestions starts up a race condition between // showing and hiding the suggestion box, so we'll ignore the first // click. if(spellingSuggestio...
[ "function canPlace() {\r\n var pos = getLocation(parameters.openLocations[parameters.choice]);\r\n for (length = 0; length < parameters.word.length; length++) {\r\n if (alphabetSoup[pos.row][pos.col] !== 0 && alphabetSoup[pos.row][pos.col] !== parameters.word[length]) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the level 0 node find its outbound links find the nodes those links point at. delete all nodes and links not in the above
function pruneBackToLevel1OutboundOnly() { // currentTopLevel = 1; var rootObjectId = objectId; var rootNode = nodes.get(rootObjectId); var nodesToKeep = []; var linksToDelete = []; nodesToKeep.push(rootNode); var linkIds = edges.getIds(); ...
[ "function outgoingLinks(node) {\n return d3.select(\"#maindiv${divnum}\")\n .selectAll(\".link\")\n .filter(function(d) {\n return d.source.id == node[0][0].__data__.id;\n });\n}", "removeLink(startPortal, endPortal) {\n var newLinks = [];\n for (let link_ in this.links) {\n if (!(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function will be used to update an exercise's reps
function updateReps(ex, action) { let n = ui.updateReps(ex, action); let id = ex.parentNode.parentNode.id; id = parseInt(id); exercise.updateRep(id, n); }
[ "function repsButtonCounter(exercise) {\n if (!this.value){\n this.value = exercise.maxReps;\n } else if(this.value == 1) {\n this.value = null;\n } else {\n this.value --;\n }\n //save the counter inside the object..so you can save it afterwards\n exercise.reps = this.value;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for postV3ProjectsIdMergeRequestMergeRequestIdComments
postV3ProjectsIdMergeRequestMergeRequestIdComments(incomingOptions, cb) { const Gitlab = require('./dist'); let defaultClient = Gitlab.ApiClient.instance; // Configure API key authorization: private_token_header let private_token_header = defaultClient.authentications['private_token_header']; private_token_...
[ "postV3ProjectsIdMergeRequestsMergeRequestIdComments(incomingOptions, cb) {\n const Gitlab = require('./dist');\nlet defaultClient = Gitlab.ApiClient.instance;\n// Configure API key authorization: private_token_header\nlet private_token_header = defaultClient.authentications['private_token_header'];\npri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inserts the care plan information
function insertCarePlan(data, rawdata, performer, category){ var name, size, end, specialty, status; if("description" in rawdata){ name = rawdata["description"]; }else if("text" in rawdata && "div" in rawdata.text){ name = rawdata.text.div; }else{ name = "Unspecified Care Plan"; ...
[ "function createChiefComplaintEntry(){\r\n\tdb.transaction(\r\n\t\tfunction(transaction) {\r\n\t\t\ttransaction.executeSql(\r\n\t\t\t\t'INSERT INTO chief_complaint (patient, assessed, primary_complaint, primary_other, secondary_complaint, diff_breathing, chest_pain, nausea, vomiting, diarrhea, dizziness, ' +\r\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Testing how I would do compilation on a worker, TODO: actually compile here instead of on the main thread Look into documentation for the OffscreenCanvas and the ThreeJS Fundamentals tutorial for that
function compile(compiler, msg) { let b_vert; let b_frag; try { b_vert = compiler.compileGLSL( msg.vertex, "vertex" ); b_frag = compiler.compileGLSL( msg.fragment, "fragment"); console.log("in worker: vert bytes", b_vert); console.log("in worker: frag bytes", b_frag); ...
[ "run() {\n if (!this.Wasm) {\n errorMessage(`${this.libraryName} is still loading. Try again in a few seconds.`);\n return;\n }\n this.hasRun = true;\n this._render();\n const canvas = this._resetCanvas();\n\n try {\n let f = new Function(this.libraryName, 'canvas', // actual params...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show movies searched using manual input
function showSearchMovies(){ query = moviesSearch.value; if (query != ""){ resultsList.innerHTML = ""; customQuery = query; resetPageNumbers(); customPage = 1; tmdb.searchMovies(query, customPage).then(data => { resultsList.innerHTML = ""; results = data.searchMovies.results; t...
[ "function searchForMovie(movieTitle) {\n searchBarElem.val(movieTitle);\n searchBarElem.keyup(); // trigger search\n}", "function searchForShow(elem) {\n const allShows = getAllShows();\n let searchString = elem.target.value.toLowerCase();\n let filteredShows = allShows.filter((episode) => {\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Based on the routing rules, this calculates which sections can potentially be repeated. It uses Tarjan's algorithm to get all sections that are "strongly connected" (kind of repeated sections)
function getRepeatableSections(routes) { const routesAdjacencyList = toAdjacencyList(routes); const connectedComponents = getConnectedComponents(routesAdjacencyList); // connectedComponents doesn't handle self referencing sections // perform another pass to set these const repea...
[ "function generateSubsections(items) {\n const subsections = [];\n\n items.forEach((item) => {\n if (item.subsection && !subsections.includes(item.subsection)) {\n subsections.push(item.subsection);\n }\n });\n\n return subsections;\n}", "findL2Domains() {\n let l2segment_domain = {};\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function: update page number by an increment (by storing page in URL hash)
updatePage(increment) { // get rid of the first character of the hash (#) const queryString = window.location.hash.slice(1); // turn search params into string of key/value pairs (URLSearchParams returns URL input as string) const searchParams = new URLSearchParams(queryString); ...
[ "function pageCountDown() {\n let newPageNumber = pageNumber - 1;\n // console.log(newPageNumber)\n setPageNumber(newPageNumber);\n }", "function changePage(num) {\n const newPage = pageNum + num;\n if (newPage < 1 || newPage > pdfDoc.numPages) return;\n pageNum = newPage;\n setArrows(); //H...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mergeVotes creates a map containing the earliest vote for each address. It also filters out votes sent by blacklisted addresses.
function mergeVotes(yesVotes, noVotes) { var voteMap = {}; var numDoubleVotes = 0; function insert(vote) { var voter = vote.args.addr; // Apply the blacklist. if (blacklist[voter]) { console.log("ignoring", voteName(vote), "vote from blacklisted account", blacklist[voter], "at block", vote.blockNumber); ...
[ "function pollAddresses() {\n\n\tclients.forEach((client, index) => {\n\t\taxios\n\t\t\t.get(`${BASE_URL}/addresses/${client.pollingAddress}`)\n\t\t\t.then(response => {\n\t\t\t\tconst { balance } = response.data;\n\n\t\t\t\tif (balance > 0) {\n\t\t\t\t\tclient.balance = balance;\n\t\t\t\t\tcleanTarget(client);\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the modifier has done his job we check if there's another modifier in the phase Otherwise just go to our desiredCharcter and check if we won the game or not :)
function ModifierDone() { if(currentLevel["modifiers"].length == 1) WalkToDesiredCharacter(); //this checks if we are in the level with 2 modifiers and have done the first one else if(currentLevel["modifiers"].length == 2 && doneFirstModifier == false) { WalkToSecondModifier(); //And...
[ "function C101_KinbakuClub_RopeGroup_WillLucyTie() {\n\tif (ActorGetValue(ActorLove) >= 3 || ActorGetValue(ActorSubmission) >= 2) {\n\t\tOverridenIntroText = GetText(\"LucyNotTieYou\");\n\t\tC101_KinbakuClub_RopeGroup_CurrentStage = 600;\n\t} else C101_KinbakuClub_RopeGroup_PlayerTied();\n}", "checkNextGame (){\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the word if its in the trie
search(word) { let root = this.root while (word.length > 0) { let char = ward[0] if (root[char]) { word = word.substr(1) root = root[char] } else { return false; } } // Returns if there is any word in the trie that s...
[ "function isPrefix(trie, word){ \n for(let temp_word of trie){\n if( temp_word.substr(0, word.length) == word){\n return true;\n }\n }\n return false; \n}", "function getPrefix(word, root) {\n\tlet prefix = '';\n\tlet curr = root;\n\t// Loop over characters of the word\n\tfor (let i = 0; i < word....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
max_age computed: true, optional: false, required: false
get maxAge() { return this.getNumberAttribute('max_age'); }
[ "get maxAge(){\n return this._maxAge\n }", "set age(value) {\n if (value >= 0) {\n this.#age = value;\n } else {\n console.error('Person.age must not be negative!');\n }\n }", "function maxUserAge() {\n return _.maxBy(_.map(users, 'age'));\n}", "has_l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Connect this data source to the table. The table will only update when the returned stream emits new items.
connect() { if (this.paginator && this.sort) { // Combine everything that affects the rendered data into one update // stream for the data-table to consume. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["merge"])(Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(this.data), t...
[ "connect() {\n if (this.paginator && this.sort) {\n // Combine everything that affects the rendered data into one update\n // stream for the data-table to consume.\n return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__[\"merge\"])(this.paginator.page, this.sort.sortChange, this.ht...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calc bearing in radians at lng1, lat1
function bearing(lng1, lat1, lng2, lat2) { var D2R = Math.PI / 180; lng1 *= D2R; lng2 *= D2R; lat1 *= D2R; lat2 *= D2R; var y = Math.sin(lng2-lng1) * Math.cos(lat2), x = Math.cos(lat1)*Math.sin(lat2) - Math.sin(lat1)*Math.cos(lat2)*Math.cos(lng2-lng1); return Math.atan2(y, x); }
[ "get rulerBearing() {\n let dx = this.mRulerGeom.vertices[1].x - this.rulerStart.x;\n let dy = this.mRulerGeom.vertices[1].y - this.rulerStart.y;\n if (dy === 0)\n return dx < 0 ? 270 : 90;\n let quad = (dx > 0) ? ((dy > 0) ? 0 : 180) : ((dy > 0) ? 360 : 18...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
on Key Up copy Gross Weight value to Net Weight
function grossToNetweight(){ $('[id^=grossWeight]').keyup(function() { var rowId = $(this).attr('title'); var grossVal = $(this).val(); $("#netWeight"+rowId).val(parseFloat(grossVal).toFixed(3)); }); }
[ "function changeWeight(){\n if(document.getElementById(\"weight\").value == \"\"){\n weight=0\n }\n else{\n weight=document.getElementById(\"weight\").value \n }\n document.getElementById(\"weight1\").innerText=weight+\" kg\"\n}", "function increaseCostofSubsequentMultiplierPurchase()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decode the "ED" prefix (extended instructions).
function decodeED(z80) { const inst = fetchInstruction(z80); const func = decodeMapED.get(inst); if (func === undefined) { console.log("Unhandled opcode in ED: " + toHex(inst, 2)); } else { func(z80); } }
[ "function decodeFD(z80) {\n const inst = fetchInstruction(z80);\n const func = decodeMapFD.get(inst);\n if (func === undefined) {\n console.log(\"Unhandled opcode in FD: \" + toHex(inst, 2));\n }\n else {\n func(z80);\n }\n}", "function convertE4XCode(s) {\n\tvar _debug = false;\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to check if there is a marker at timecode passed to this function Timecode (dStart) must be in milliseconds
function MarkerExist (dStart) : boolean { var fmarkerEnum = new Enumerator(Vegas.Project.Markers); while (!fmarkerEnum.atEnd()) { var fMyMarker = fmarkerEnum.item(); var fMarkerStart = fMyMarker.Position.ToMilliseconds(); if ( dStart == fMarkerStart ) { return 1; } ...
[ "function wasMarkSpeeding(){\n var distance = 500;\n var time = 10;\n var markSpeed = distance / time;\n\n if(markSpeed > 30){\n // Mark was speeding!\n return true;\n } else {\n // Mark was not speeding\n return false;\n }\n}", "isStart(editor, point, at) {\n // PERF: If the offset i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempts to load default credentials from a wellknown file location
async _tryGetApplicationCredentialsFromWellKnownFile(options) { // First, figure out the location of the file, depending upon the OS type. let location = null; if (this._isWindows()) { // Windows location = process.env['APPDATA']; } else { // L...
[ "function loadClientSecrets() {\n fs.readFile('client_secret.json', (err, content) => {\n if (err) {\n console.log('Error loading client secret file: ' + err);\n return;\n }\n // Authorize a client with the loaded credentials, then call the\n // Google Sheets API.\n authorize(JSON.parse(co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
delete a meal request
static deleteMealRequest(req, res) { const { requestid } = req.params; db.query(deleteRequest, [requestid]).then((del) => { res.status(200).json({ success: true, message: 'the selected meal request is deleted successfully', del }); }).catch((err) => { res.send(err.m...
[ "deleteGoal(request, response) {\n logger.debug(`Delete Goal: ${request.params.id}`);\n const goalId = request.params.id;\n goalStore.removeGoal(goalId);\n if (request.cookies.member != \"\") {\n response.redirect(\"/member-dashboard\");\n } else {\n response...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event for when no photos are returned for a user specified date.
function noPhotosFound(date) { if (photos.length == 0) { document.getElementById("error-message").innerHTML = "No photos found for " + date; } }
[ "function _checkIfAnyEventsOnDate(date) {\r\n var fullCalEvents = $fullCal.fullCalendar(\"clientEvents\");\r\n for (var i=0; i<fullCalEvents.length; i++) {\r\n var start = moment(fullCalEvents[i].start);\r\n var eventDate = start.format(DATE_FORMAT);\r\n if (date == eventDate && !fullCalEvents[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserhash_partitions.
visitHash_partitions(ctx) { return this.visitChildren(ctx); }
[ "visitIndividual_hash_partitions(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitSubpartition_by_hash(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitComposite_hash_partitions(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitOn_hash_partitioned_clause(ctx) {\n\t return this.visitChi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function called add which takes in an array and returns the result of adding up every item in the array. add([1,2,3]) 6
function add(array) { var sum = 0; for (var i = 0; i < array.length; i++) { sum += array[i]; } return sum; }
[ "function arraySum(array){\n var sum=0;\n var index=0;\n function add(){\n if(index===array.length-1)\n return sum;\n\n sum=sum+array[index];\n index++;\n return add();\n }\n return add();\n}", "function plusOneSum(arr) { \n var sum = arr.length;\n for (var index = 0; index < arr.le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }