query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
applyOffset Description: offset 'selector' the difference between src and target, return the result
static applyOffset(src, target, selector) { const rv = JSON.parse(JSON.stringify(selector)); rv.staff += target.staff - src.staff; rv.measure += target.measure - src.measure; rv.voice += target.voice - src.voice; rv.note += target.staff - src.staff; return rv; }
[ "function updateOffset(category,offset) {\n\n}", "function getTargetOffsets(target,hostOffsets,position){var placement=position.split(' ')[0];// Get target node sizes\nvar targetRect=getOuterSizes(target);// Add position, width and height to our offsets object\nvar targetOffsets={width:targetRect.width,height:tar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the month of the start of the current quarter.
static getQuarterStartMonth () { let nowMonth = new Date().getMonth(); var quarterStartMonth = 0; if(nowMonth<3){ quarterStartMonth = 0; } if(2<nowMonth && nowMonth<6){ quarterStartMonth = 3; } if(5<nowMonth && nowMonth<9){ ...
[ "function getQuarterStartDate() {\n var currentDate = new Date();\n var quater = Math.floor((currentDate.getMonth()) / 3) + 1;\n var startDate;\n var fullYear = currentDate.getFullYear();\n switch (quater) {\n case 1:\n startDate = new Date(fullYear, 00, 01);\n break;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test that we are using hasOwnProperty or a properly guarding dict for NounTag so that if someone created a tag called "watch" and then deleted it, we don't end up exposing the watch function as the tag. Strictly speaking, this does not really belong here, but it's a matched set with the previous test.
function test_nountag_does_not_think_it_has_watch_tag_when_it_does_not() { Assert.equal(TagNoun.fromJSON("watch"), undefined); }
[ "function checkTag( object, tag ) {\n\n\t\t\tif ( object.hasOwnProperty( tag ) ) {\n\n\t\t\t\tconsole.log( \"WARNING: \" + tag + \" already exists for \" + object + \" and has been overwritten.\" )\n\n\t\t\t} else {\n\n\t\t\t\tobject[ tag ] = {};\n\n\t\t\t}\n\n\t\t}", "hasTag(tag) {\n return !!(tag in this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Modal to add the sliding
displayModal() { $("#modal-sliding").openModal(); }
[ "function modalAnimation() {}", "function modal_show(){\n $(\"#edit-album\").slideDown()\n $(\"#show-album-details-id\").slideUp()\n }", "function revealModal() {\n var slider = {\n origin : \"left\",\n distance : \"40px\",\n duration : 600,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_selectionHandler. Internal method used as a callback for imgAreaSelect when selection is enabled. This, in turn, will call the specified userland callback, indicated by this.config.onSelection. The user callback should expect up to four arguments: profile_metadata for this selection (an array of zero or more objects) ...
function _selectionHandler(t, c) { var $this = $(t).closest('.hm-container').parent(); var $cfg = $this.data('heatmap').config; if ($cfg.onReady.state != loadStates.READY) return true; var $ctx = $($this).data('ctx'); var start_x = Math.min(c.x1, c.x2) - $ctx.heatmap_bbox[0]; var end_x = Math.max(c.x1, c....
[ "processUserSelect(ev) {\n var canvasXY = this.convertToCanvasCoordinates(ev.clientX, ev.clientY);\n var hs = this.getColor(canvasXY.x, canvasXY.y);\n this.onColorSelect(hs);\n }", "function selectHandler() {\n\t\t\tvar selectedItem = chart\n\t\t\t\t\t.getSelection()[0];\n\t\t\tconsole\n\t\t\t\t\t.log(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sync all viewports based on active layer's viewport
function syncViewports(layers, activeLayer) { // If we intend to keep the viewport's scale, translation and rotation in sync, // loop through the layers layers.forEach(function (layer) { // Don't do anything to the active layer // Don't do anything if this layer has no viewport if (layer === activeLay...
[ "function syncViewports (layers, activeLayer) {\n // If we intend to keep the viewport's scale, translation and rotation in sync,\n // loop through the layers\n layers.forEach((layer) => {\n // Don't do anything to the active layer\n // Don't do anything if this layer has no viewport\n if (layer === act...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the specified entity matches the current nav item.
function isCurrentNavItem(entity) { if (!entity) { return false; } var currentItem = spNavService.getCurrentItem(); return (currentItem && currentItem.id === entity.id()); }
[ "isCurrentItem(item) {\r\n var _a, _b;\r\n if (!this.currentItem || !this.currentItem.value) {\r\n return false;\r\n }\r\n return ((_a = this.currentItem) === null || _a === void 0 ? void 0 : _a.value) === (item === null || item === void 0 ? void 0 : item[(_b = this.currentIte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Expands the preload in the specified traversal direction ("previousSibling"/"nextSibling") consuming rows that are further than farOffRemoval from the viewport. For efficiency it it returns an array of nodes to be deleted rather than deleting them itself.
function removePreloadDistantNodes(preload, traversal, trashBin){ var toDelete = [], reclaimedHeight = 0, count = 0, preloadNode = preload.node, row, nextRow = preloadNode[traversal], preloadTraversal = traversal.replace("Sibling", ""), // Don't merge preloads if there are fewer than 3; there...
[ "removeNextSibling() {\n var siblings = this._containers.top();\n\n if (siblings && Array.isArray(siblings)) {\n // top index is a number because top container is an array\n var index = this._indexes.top();\n\n if (siblings.length > index + 1) {\n return siblings.splice(index + 1, 1)[0];...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fill the HTML tablejeopardy with the categories & cells for questions. The should be filled w/a , and a for each category The should be filled w/NUM_QUESTIONS_PER_CAT s, each with a question for each category in a (initally, just show a "?" where the question/answer would go.)
function fillTable(categories) { let titles = categories.map((title) => { return title.title; }); //create title/headers $("thead").add("tr"); for (let i = 0; i < NUM_CATEGORIES; i++) { const catHeader = document.createElement("th"); catHeader.innerText = titles[i]; $("thead").append(catHe...
[ "function fillTable() {\n const $table = $('<table>');\n const $thead = $('<thead>');\n const $trHead = $('<tr>');\n //add category titles to the header row - flip all to uppercase\n for (let i = 0; i < NUM_CATEGORIES; i++) {\n let titleUpperCase = categories[i].title.toUpperCase();\n $trHead.append($('<...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is called when the Delete Collection button is clickde.
function deleteCollection() { // If an operation is in progress, usually involving the server, don't do it. if (processing) { return false; } if (currentCollection == null) { alert("Please select a collection first."); return false; } // If photo happens to be growing, cut it short. snapImageToLandi...
[ "deleteNewCollection() {\n this.props.handleDelete(this.props.collection);\n }", "'click #delete'(event, instance) {\n \tPrimary.remove(this._id)\n }", "function clickedDelete()\n{\n\t//we don't have anything to delete since these \n\t//are connections on the server.\n}", "delete() {\n deleteList...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function fo remove last number
function deleteLast(numStr) { if (numStr.length == 1) { return ""; } else { numStr = numStr.slice(0, -1); return numStr; } }
[ "function removeLastNum(){\n pinChecker.value = pinChecker.value.slice(0,-1);\n }", "function removeLastNumber() {\n removeLastDigitFromCurrentNumber();\n updateBottomDisplay();\n}", "function deleteOne(num) {\n str = num.toString()\n return str.substring(0, str.length -1);\n}", "function rem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes a world, converts its contents to characters, and prints it. print([[0,1,0], [0,0,1], [1,1,1]]) =>
function print(world) { // console.log("world: ", world) var matrix = world.map(v => v.map(nToChar)), str = matrixToString(matrix) console.log(str, '\n---') }
[ "function displayWorld(){\n\t\t\tvar output = '';\n\t\t\tfor(var i=0; i<world.length; i++){\n\t\t\t\toutput += \"\\n<div class='row'>\";\n\t\t\t\tfor(var j=0; j<world[i].length; j++){\n\t\t\t\t\tif(world[i][j] == 2){\n\t\t\t\t\t\toutput += \"<div class='brick'></div>\";\n\t\t\t\t\t}\n\t\t\t\t\telse if(world[i][j] =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the presigned url for a file and call makeS3Request to upload the file
async function uploadFileToS3(file, getSignedUrl) { try { const {fileUrl, signedRequestUrl} = await getSignedUrl(file) const url = await makeS3Request(fileUrl, signedRequestUrl, file) return url } catch (e) { return alert('Could not upload file.') } }
[ "function uploadToS3(file, target, url)\n{ \n showUploadName(file.name, target);\n var xhr = createCORSRequest('PUT', url);\n if (!xhr) \n {\n //setProgress(0, 'CORS not supported');\n }\n else\n {\n xhr.onload = function() \n {\n if(xhr.status == 200)\n {\n $(target).attr('s3_ur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle change by lookup selection
function handleLookupChange(e, selectedRows) { var record = selectedRows[0].data; var args = { label: $input.val(), // SoHo puts desired label into input field value: Utils.getNestedValue(record, lookupOptions.valueField), value2: lookupOptions.value2Field ? Utils.g...
[ "function handleSelectionChange() {\n\t\t\tjq.on( 'sui:change', function() {\n\n\t\t\t\t// We need to re-populateList to handle dynamic select options added via JS/ajax.\n\t\t\t\tpopulateList();\n\t\t\t\titems.find( 'li' ).not( '.optgroup-label' ).on( 'click', function onItemClick( ev ) {\n\t\t\t\t\tvar opt = $( ev...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compare user input to machine alphabet and change scores
function amIRight(event){ var pressedKey = event.keyCode; // this is what you presed: ASCII number var pressedChar = String.fromCharCode(pressedKey); //that is what you converted from ASCII to character historyChar.push(pressedChar); // history update if( pre...
[ "function scoreText(input) {\n var score = 0\n\n for (var i = 0; i < input.length; i++) {\n score += alphabetBuffer.indexOf(input[i]) > -1\n }\n\n return score / input.length\n}", "function evaluateUserInput(letter) {\n // if the chosen key by the user equals the ranom comptuter choice.\n if(letter =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Downloads a file from S3
downloadFile(bucket, fileNameToDownload, fileNameToSaveAs) { return new Promise((resolve, reject) => { var download = this.client.downloadFile({ localFile: fileNameToSaveAs, s3Params: { Bucket: bucket, Key: fileNameToDownload } }); download.on('error', ...
[ "async function downloadFile(s3Object) {\n const getParams = {Bucket: bucketName, Key: s3Object.Key};\n const fileWriteStream = fs.createWriteStream(path.join(cryptoFolder, s3Object.Key));\n return new Promise((resolve, reject) => {\n s3.getObject(getParams).createReadStream()\n .on('end', ()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a state, returns all ancestor states which are sticky. Walks up the view's state's ancestry tree and locates each ancestor state which is marked as sticky. Returns an array populated with only those ancestor sticky states.
function getStickyStateStack(state) { var stack = []; if (!state) return stack; do { if (state.sticky) stack.push(state); state = state.parent; } while (state); stack.reverse(); return stack; }
[ "function getStickyStateStack(state) {\n var stack = [];\n if (!state) return stack;\n do {\n if (state.sticky) stack.push(state);\n state = state.parent;\n } while (state);\n stack.reverse();\n return stack;\n }", "function getOverlappingStickies(stickyElement) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse conte of a line Sanitize content: rips off empty spaces, new lines, double quotes
function parseLine(line) { return line.replace(/\s+|\"/g, '') }
[ "function sanitize(line) {\r\n // remove comments\r\n var no_comments = line.replace(/^(.*?);.*/, \"$1\");\r\n \r\n // trim line\r\n return no_comments.replace(/^\\s+/, \"\").replace(/\\s+$/, \"\");\r\n }", "function parseLine (line){ \n if(line.indexOf(\"#\") !== -1){\n\t\t//comment\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove all of the given files from the /tmp directory
function _deleteTmpFiles(files, done) { var keys; if (files) { keys = Object.keys(files); } if (keys && keys.length) { fs.unlink(files[keys[0]].path, function(err) { delete files[keys[0]]; if (err) { done(err); ...
[ "_cleanUpTempFiles() {\r\n while (this.tmpFiles.length > 0) {\r\n try {\r\n fs.unlinkSync(this.tmpFiles.pop());\r\n } catch (err) {\r\n /* keep going */\r\n }\r\n }\r\n }", "function deleteTempFiles() {\n const path = './';\n let re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exactly like pipeline, except that the input is specified as a single function to invoke on N different inputs (rather than N functions). "args" must have the following fields: funcasynchronous function to invoke on each input value inputsarray of input values
function forEachPipeline(args, callback) { mod_assert.equal(typeof (args), 'object', '"args" must be an object'); mod_assert.equal(typeof (args['func']), 'function', '"args.func" must be specified and must be a function'); mod_assert.ok(Array.isArray(args['inputs']), '"args.inputs" must be specified and...
[ "function forEachPipeline(args, callback) {\n\t mod_assert.equal(typeof (args), 'object', '\"args\" must be an object');\n\t mod_assert.equal(typeof (args['func']), 'function',\n\t\t\t'\"args.func\" must be specified and must be a function');\n\t mod_assert.ok(Array.isArray(args['inputs']),\n\t\t\t'\"args....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is called if a VAC is detected and the user wishes to go on to calculate IVAC. This will add the columns temperature and WBC necessary to calculate IVAC
function addIVACCols() { var vaeDay = 0; //the day of the VAE occurance var totDay = 0; //total days on the table //set the GLOBAL var IVACCols = true so that the code will not add the fio2 and PEEP columns more than once IVACCols = true; direction = "Now that a VAC determination has been made, enter yes (...
[ "function calculateAddedVoc(options) {\n var passengerVehicles = options.trafficAffected.passengerVehicles;\n var singleTrucks = options.trafficAffected.singleTrucks;\n var comboTrucks = options.trafficAffected.comboTrucks;\n var totalAffected = options.trafficAffected.passengerVehicles + options.traffi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a stream that emits objects that are partially uploaded. __Arguments__ `bucketName` _string_: name of the bucket `prefix` _string_: prefix of the object names that are partially uploaded (optional, default `''`) `recursive` _bool_: directory style listing when false, recursive listing when true (optional, defau...
listIncompleteUploads(bucket, prefix, recursive) { if (prefix === undefined) { prefix = '' } if (recursive === undefined) { recursive = false } if (!isValidBucketName(bucket)) { throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucket) } if (!isValidPrefix(p...
[ "listIncompleteUploads(bucket, prefix, recursive) {\n if (prefix === undefined) prefix = ''\n if (recursive === undefined) recursive = false\n if (!isValidBucketName(bucket)) {\n throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucket)\n }\n if (!isValidPrefix(prefix)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to remove algorithm from list when completed
function removeFromExec(algorithm, n){ var linearResult = ['not-found', 'undefined']; var binaryResult = ['not-found', 'undefined']; if(linear.found == true){ linearResult = ['found', linear.i]; } if(binary.found == true){ binaryResult = ['found', binary.i]; } if(opts.keepSteps){ var fi...
[ "removeFinished() {\n Downloads.getList(Downloads.ALL)\n .then(list => list.removeFinished())\n .catch(Cu.reportError);\n }", "doPendingRemoves() {\n if (this.pendingRemoves) {\n for (let i = 0; i < this.elements.size(); i++) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function returns the air density in kg/m^3 when given the alt. in meters
function getDensity (alt) { if (alt <= 0) { return 1.22500000} else if (alt <= 500 ) { return 1.16730000; } else if (alt <= 1000) { return 1.11170000; } else if (alt <= 1500) { return 1.05810000; } else if (alt <= 2000) { return 1.00660000; } else if (alt <= 2500) { return 0.956...
[ "function calcDensityAlt(baro, fieldElev, temp) {\n console.log(\"Baro: \" + baro + \" - Elev: \" + fieldElev + \" - Temp: \" + temp);\n\n\n\n // Need to calculate density altitude\n // Pressure altitude = (29.92 - current altimeter) x 1,000 + field elevation in feet\n // Let’s say our c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the number of URL segments in an array of routes Example: ['/api/test', /\/api\/post[09]/, '/users/:id/details`] > 7
function getNumberOfArrayUrlSegments(routesArray) { return routesArray.reduce((accNumSegments, currentRoute) => { // array members can be a RegEx -> convert them toString return accNumSegments + utils.getNumberOfUrlSegments(currentRoute.toString()); }, 0); }
[ "function getNumberOfArrayUrlSegments(routesArray) {\n return routesArray.reduce((accNumSegments, currentRoute) => {\n // array members can be a RegEx -> convert them toString\n return accNumSegments + getNumberOfUrlSegments(currentRoute.toString());\n }, 0);\n }", "function getNumberOfUrlSegment...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For the ease of processing, the internal presentation of completion rules is quite different from user input.
autocompleteNormalizeRules() { // supplement with important information including // option arity and sibling const rawRules = this._completionRules; const { options } = this; const args = this._args; const normalizedRules = { options: {}, args: [] }; options.forEac...
[ "function showCompletionOfTags () {\n\t//show completion\n\tvar completion_str = \"<b class='req_title' >Requirements:</b>\";\n\t\n\tif ( problem_requirements_arr [ 'grammar' ] == 1 ) completion_str += \"\\n\\t<b class='check' >→<b class='req' >Grammar</b>: <b class='check' >√</b>\";\n\telse if ( problem_requiremen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
"commit" function will be called to forcefully update the data to the LMS.
function commit() { //Before calling any LMS function, we will always check for the API. API = GetAPI(); if( API != null ) { //LMS commit function is called. API.LMSCommit(""); } }
[ "async commit() {}", "function commit() {\n var self = this;\n\n self._commit.apply(self, arguments);\n}", "commit() {\n this.commitCrudStores();\n }", "function doLMSCommit() {\r\n\r\n\tif (api != null && api != undefined) {\r\n\t//alert(\"cmiscript - doLMSCommit - api found\");\r\n\t\tapi.LMSSetValue(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addRemoveControlPoints() Description: By listening to the change in number of control points option in the HTML file, this function adds or removes the control points slider. To do so, it uses the createElement function of the document object. It generates an explanation for the control points in the form of Bez(i,j) x...
function addRemoveControlPoints() { let doc = document.getElementById("control_points"); doc.innerHTML = ""; for (let i = 0; i < noControlPoints[0]; i++) { for (let j = 0; j < noControlPoints[1]; j++) { for (let k = 0; k < 3; k++) { //[1] let text = docume...
[ "function createSequenceControls(map, attributes){\n $('#slider').append('<input class=\"range-slider\" type=\"range\">');\n \n \n $('.range-slider').attr({\n max: 9,\n min: 0,\n value: 0,\n step: 1\n });\n \n $('#slider').append('<button class=\"skip\" id=\"reverse\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
request add new player profile at Storage
addNewProfile(player) { const response = { status: false, message: 'Error', }; if (this.isCorrectUserData(player)) { const isSuccess = this.store.addNewProfile(player); if (isSuccess) { response.status = true; response.message = "Profile successfully added"; ...
[ "function addProfile(profile) {\r\n let store = browser.storage.local.get({\r\n profiles: []\r\n });\r\n store.then(function(results) {\r\n var profiles = results.profiles;\r\n profiles.push(profile);\r\n let store = browser.storage.local.set({\r\n profiles\r\n });\r\n store.then(null, onE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Approve a transaction with certain order_id | transaction_id which gets challenge status from Fraud Detection System
approve(transactionId) { this.apiUrl = this.parent.apiConfig.getCoreApiBaseUrl() + '/' + transactionId + '/approve'; return this.parent.httpClient.request({ requestUrl: this.apiUrl, httpMethod: 'post', serverKey: this.parent.apiConfig.get().serverKey, requ...
[ "approve(id, payload) {\n return this.request.put(`/transaction/approve-withdraw-request/${id}`, payload);\n }", "async function approveOrder(req,res){\n if(req.user.user=='shopkeeper'){\n const shopkeeper= await ShopkeeperModel.findById(req.user._id);\n const myRep= shopkeeper.representative...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Class: mxLine Extends to implement a horizontal line shape. This shape is registered under in . Constructor: mxLine Constructs a new line shape. Parameters: bounds that defines the bounds. This is stored in . stroke String that defines the stroke color. Default is 'black'. This is stored in . strokewidth Optional integ...
function mxLine(bounds, stroke, strokewidth) { this.bounds = bounds; this.stroke = stroke; this.strokewidth = (strokewidth != null) ? strokewidth : 1; }
[ "function mxLine(bounds, stroke, strokewidth)\n{\n\tmxShape.call(this);\n\tthis.bounds = bounds;\n\tthis.stroke = stroke;\n\tthis.strokewidth = (strokewidth != null) ? strokewidth : 1;\n}", "function mxShapeMockupLineChart(bounds, fill, stroke, strokewidth)\n{\n\tmxShape.call(this);\n\tthis.bounds = bounds;\n\tth...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset error status on an array of page elements.
function resetErrors(elements) { for ( var i = 0; i < elements.length; i++) { resetError($(elements[i])); } }
[ "function resetErrors()\n{\n\tunMarkErrorAll();\n\terrors = null;\n\terrors = new Array();\n\terrorCount = 0;\n}", "function resetErrors(elements)\n\t{\n\t\tfor(var i = 0; i < elements.length; i++)\n\t\t{\n\t\t\tresetError($(elements[i]));\n\t\t}\n\t}", "reset() {\n this.pagesAsArray.forEach((page) => {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Switch between portlets selection and portlet preview/results display.
function selectPortlets(isSave) { if (!isSave) { updatePortletConfiguration(); $("#portlets-display").hide(); $("#portlets-configure").show(); portletConfigurationActive = true; updatePortletsToolbar(1); } else { // If we want to save the configuration, show the corresponding div, and make a call /...
[ "function onPortletShow(reload){\r\n\tif(reload){\r\n\t\treloadAll();\r\n\t}\r\n}", "function switchPreview() {\r\n\tif(!isPreview()) {showPreview();}\r\n\telse {hidePreview();}\r\n}", "function displayModelsPane() {\n focusOnPane(\"choose-models-pane\");\n}", "function showPlanSelectionPanel(option) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds cryptic message that describes word to firebase
function addDesc(desc){ if(desc !== ""){ //console.log("Here"); firebaseObj.ref().update({answerDescription: desc}); } else{ alert("You have to cryptically describe your word!"); } }
[ "function addWord(word,def,example){\r\n\tvar newWord = allWords.push();\r\n\tvar path = newWord.toString();\r\n\tconsole.log(path);\r\n\tnewWord.update({\r\n\t word: word,\r\n\t def: def,\r\n\t example: example,\r\n\t path: path,\r\n\t timeStamp: Firebase.ServerValue.TIMESTAMP\r\n\t});\r\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Binds a the certain context or the active one to the target function and then returns the target
bind(context, target) { if (typeof target === 'function') { // eslint-disable-next-line @typescript-eslint/no-this-alias const manager = this; const contextWrapper = function (...args) { return manager.with(context, () => target.apply(this, args)); ...
[ "bind(context, target) {\n // if no specific context to propagate is given, we use the current one\n if (context === undefined) {\n context = this.active();\n }\n if (typeof target === 'function') {\n return this._bindFunction(context, target);\n }\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the attack time (in msec)
get attackTime() { return this._attackTime; }
[ "function getAttackTime() {\n //TODO: Make this generic - pass in the APS as an argument\n return Math.round((1 / heroBaseStats.aps) * 1000);\n }", "function GetTimeFromAttacker(attackinfo) {\r\n\treturn attackinfo.split(\"*\")[0];\r\n}", "initialAttackTime () {\n return this.attackTime\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Record the useragent and other info in the blockchain for security / auditing / etc Returns a Promise that resolves to null only once access has been recorded
async function recordAccess(req) { let data = { 'ip': req.ip, 'ua': req.get('User-Agent'), 'url': req.originalUrl, }; await fabric.recordAccess(data); }
[ "async checkGrantAccessAndQuerySessionInfo() {\n let requestAccessResult = \"\";\n await this.requestAccess().then((result)=>{requestAccessResult=result});\n\n let accessGranted = JSON.parse(requestAccessResult);\n \n // check if user is logged in CortexUI\n if (\"error\" in ac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the ChangeSetUpdate for Updates of entities of the given entity type
update(entityName, updates) { updates = Array.isArray(updates) ? updates : updates ? [updates] : []; return { entityName, op: ChangeSetOperation.Update, entities: updates }; }
[ "function setEntityType() {\n var new_type = $(this).attr('label')\n var edits = [];\n $(\".entity.ui-selected\").each(function() {\n var eid = this.id;\n edits.push({action:'change_entity_type', id:eid, old_type:entities[eid].type, new_type:new_type});\n });\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move a value to our new field and then remove the original field by Nulling it
moveMaterialSchemaValue(fieldName, newField, oldField) { this.fields[fieldName].attributes[newField] = this.fields[fieldName].attributes[oldField]; // Copy the oldField value to the newField value this.fields[fieldName].attributes[oldField] = null; // And now remove the oldField by Nulling }
[ "function resetField(obj, val) {\n\t\tobj.val(val);\n\t}", "replaceField(field, value) {\n const building = Object.assign({}, this.state.building);\n building[field] = value;\n this.setState({\n building,\n unsavedChanges: true\n });\n }", "unsetValue() {\n this.value = null;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the side next to a given side in the counterclockwise direction.
function getNextSideCounterClockwise(side) { switch (side) { case 'Top': return 'Left'; case 'Left': return 'Bottom'; case 'Bottom': return 'Right'; case 'Right': return 'Top'; default: return assertNever(side); } }
[ "function getNextSideClockwise(side) {\n switch (side) {\n case 'Top': return 'Right';\n case 'Right': return 'Bottom';\n case 'Bottom': return 'Left';\n case 'Left': return 'Top';\n default: return assertNever(side);\n }\n}", "getSide() {\n if (this.turnCounter < 10) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to handle when an appointment is clicked
function appointmentClicked(id) { const url = baseURL + '/appointment/' + id; // set the global appointment id so that it can be used when updating appointmentId = id; $('#appointments li').removeClass('selected'); $('#'+id).addClass('selected'); // clear existing appointment dialog values clearAppointm...
[ "onClick () {\n\t\tAppointmentActions.updateSelectedAppointment(this.props.appointment);\n\t}", "function clickAppointment(){\n\n\t//removes other highlighted appontments\n\t$('div').removeClass('selectedAppCSS')\n\n\t//change background color\n //selected appointment of the form app \"employeeId:${tutor.employee...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for setting active discussion counter for Active discussion tab
function setActiveDiscussionsCounter() { // firstly we check if info about counter is present in main data and it's greater than 1 // if this conditions is true we decrement active discussion counter by 1 // in other case we assign 0 or undefined to counter variable var counter = (chatData.msgs_count &&...
[ "function SetCommentsCount() {\n\n var $commentTabs = $('#commentStatus');\n\n if (typeof($commentTabs[0]) !== 'undefined') {\n\n $.get(index + 'count_comments', function(data) {\n\n var $comStates = $commentTabs.find('[data-status]'),\n $count = JSON.parse(data);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a restaurant review.
static createRestaurantReview(data, callback) { fetch(DBHelper.DATABASE_URL + '/reviews', { method: 'POST', body: JSON.stringify(data) }).then((response) => { callback(null, response); }).catch(error => { // Got an error from server. callback(error, null); }); }
[ "static addRestaurantReview(review) {\n return fetch(DBHelper.DATABASE_URL + '/reviews/', {\n method: 'POST',\n body: JSON.stringify(review)\n });\n }", "function addReviewToRestaurant(review) {\n var url = baserUrl + 'AddReviewToRestaurant';\n var deferred = $q.defer();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update markers according to the given events.
function updateMarkers(events) { // Clear all labels and markers. for (var i in labels) { labels[i].setMap(null); } labels = []; for (var i in markers) { markers[i].setMap(null); } markers = []; // Add markers for the given events eventMarkerMap = {}; for (var i in events) { var event = events[i]; ev...
[ "function updateMarkers(event) {\n\n\t\t\tif (markers) {\n\n\t\t\t\t// Clicked so update\n\t\t\t\tif (event) {\n\n\t\t\t\t\t// Change to the correct slide\n\t\t\t\t\tchange.call(this, event, { slide: markerButtons.index(this) });\n\t\t\t\t}\n\n\t\t\t\telse {\n\n\t\t\t\t\t// Highlight the right marker\n\t\t\t\t\tmar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply a command to an array of target layers
function applyCommandToEachLayer(func, targetLayers) { var args = utils.toArray(arguments).slice(2); return targetLayers.reduce(function(memo, lyr) { var result = func.apply(null, [lyr].concat(args)); if (utils.isArray(result)) { // some commands return an array of layers memo = memo.concat(...
[ "setTargets(targets) {\n for (let i = 0; i < targets.length; i++) {\n this.setTarget(\n targets[i].row,\n targets[i].column,\n targets[i].color,\n targets[i].shape\n );\n }\n }", "function rd_BatchLayerConverter_doIt(cmdIndex)\r\n\t{\r\n\t\tvar comp = app.project.activ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
display plaintext in the mainTV
function displayPlaintext(text,loc=mainTV) { htmldata = '<div class="plaintext">' + text + '</div>'; loc.innerHTML += htmldata; MathJax.Hub.Queue(["Typeset",MathJax.Hub]); }
[ "function displayHelperPlaintext(text) {\n\tloc = document.getElementById(\"helperTV\");\n\t\n\thtmldata = '<div class=\"plaintext\">' + text + '</div>';\n\t\n\tloc.innerHTML += htmldata;\n\tMathJax.Hub.Queue([\"Typeset\",MathJax.Hub]);\n}", "showText(currentText) {\n console.log(currentText)\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gradient helper function for the min and max operations.
function gradForMinAndMax(dy, y, xOrig, origAxes, permutedAxes) { if (y.rank < xOrig.rank) { y = y.reshape(axis_util.expandShapeToKeepDim(y.shape, origAxes)); } if (dy.rank < xOrig.rank) { dy = dy.reshape(axis_util.expandShapeToKeepDim(dy.shape, origAxes)); } return { $x: fun...
[ "function gradForMinAndMax(dy, y, xOrig, origAxes) {\n if (y.rank < xOrig.rank) {\n y = reshape(y, expandShapeToKeepDim(y.shape, origAxes));\n }\n if (dy.rank < xOrig.rank) {\n dy = reshape(dy, expandShapeToKeepDim(dy.shape, origAxes));\n }\n return {\n x: () => {\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `GeoRestrictionProperty`
function CfnDistribution_GeoRestrictionPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); errors.collect(cdk.propertyValidator('locations', cdk.listValidator(cdk.validateString))(properties.locations)); ...
[ "function CfnGeoMatchSet_GeoMatchConstraintPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CONCATENATED MODULE: ./src/cluster/components/K8s/Deployments/Deployments.jsx / Copyright 2019 Gravitational, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or...
function Deployments(props) { var deployments = props.deployments, namespace = props.namespace, onFetch = props.onFetch; deployments = deployments.filter(function (item) { return item.namespace === namespace; }); deployments = Object(lodash["sortBy"])(deployments, ['created']).reverse(); retur...
[ "async default(inputs = {}) {\n // use the inputs param to get component configuration from users of your component\n\n // Show status...\n this.cli.status('Showing you around')\n\n await sleep(2000)\n\n // Show a nicely formatted log statement...\n this.cli.log('this is a log statement')\n\n a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Created By: Kelsey C. Justis Date: 11282016 Purpose: This preflow action initializes the TLType and TLDescription property values if the values have not already been set. User Story: US601.
function preFlowAction$SelectTLType() { /* retrieve data */ var locationAddress = pega.ui.ClientCache.find('pyWorkPage.BCU.SelectedUnitPage.LocationAddress'); var TLTypeValue = locationAddress.get('TLType') ? locationAddress.get('TLType').getValue(): ""; /* Check if the TLType property exists in memory with a ...
[ "function postFlowAction$SelectTLType() {\n /* retrieve data */\n var locationAddress = pega.ui.ClientCache.find('pyWorkPage.BCU.SelectedUnitPage.LocationAddress');\n var TLTypeValue = locationAddress.get('TLType').getValue();\n var TLDescValue = locationAddress.get('TLDescription').getValue();\n\n /* validate...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return A blackjack player has a cash balance and a strategy. The game interacts with the player, which causes the game to progress.
function Player(strategy) { var balance = 0; var name = "Player"; this.chooseBet = function(game) { var amount = strategy.chooseBet(this, game); var bet = new Bet(amount); this.changeBalance(amount * -1); return bet; }; this.choosePlay = function(hand, dealerCard, validPlays, game) { r...
[ "function blackjack() {\n const standard_deck = [ // a not so standard deck, simplified\n 2,3,4,5,6,7,8,9,10,10,10,10,11\n ];\n\n function playGame() { // We need to create a blackjack environment\n const action_history = [];\n\n const deck = shuffleArray([ // 4 'decks' combined for each sui...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::IoTEvents::DetectorModel` resource
function cfnDetectorModelPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnDetectorModelPropsValidator(properties).assertSuccess(); return { DetectorModelDefinition: cfnDetectorModelDetectorModelDefinitionPropertyToCloudFormation(properties.de...
[ "renderProperties(x) { return ui.divText(`Properties for ${x.name}`); }", "properties() {\n return this.display.show(\n this._section(\n Text(`Properties accessible from ${this.getSignature()}`),\n this._renderProperties(2, this.metadata.allProperties())\n )\n );\n }", "function c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set readNextInput if some time passes (user tends to hold the bend in place without flatening first)
function removeReadNextInput() { readNextInput = true; clearInterval(readNextInputTimer); }
[ "_read(size) {\n if (this.inputs.length != 0) {\n // remove the first input, and push that on the next event loop\n let input = this.inputs[0];\n this.inputs = this.inputs.slice(1);\n // have to send with a newline\n setImmediate(() => this.push(`${input}\\n`));\n }\n }", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
==================== Search All Products ==================== Returns a Promise containing an array that has all of the products in the catalog. The Promise will resolve in 1000ms after the function has executed.
function searchAllProducts(){ var promise = new Promise(function(resolve, reject) { setTimeout(function(){ resolve(catalog); },1000); }); return promise; }
[ "function searchAllProducts() {\n var promise = new Promise(function (resolve, reject) {\n\n setTimeout(function () {\n resolve(catalog);\n }, 1000);\n\n });\n return promise;\n }", "static async getProducts(searchTerm) {\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw shed info called from forEach statement
function drawShedInfo(item, index) { var xoffset; var pattern014 = [0, 1, 4]; var pattern0124 = [0, 1, 2, 4]; var pattern0134 = [0, 1, 3, 4]; use_plyr_bg_color(); xoffset = index * 100; ctx.moveTo(xoffset, 0); ctx.lineTo(xoffset, 100); ctx.stroke()...
[ "drawStationaryElements() {\n this.level.wallElements.forEach(row => {\n return row.forEach(el => {\n if (el !== undefined) {\n this.ctx.fillStyle = 'black';\n this.ctx.fillRect(\n Math.round(el.x),\n Math.round(el.y),\n this.level.scale,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
array of rows, each row is array of cells (board[y][x]) makeBoard: create inJS board structure: board = array of rows, each row is array of cells (board[y][x])
function makeBoard() { // Game mechanics code -- to keep track of the game state for (let row = 0; row < HEIGHT; row++) { let currentRow = []; for (let columns = 0; columns < WIDTH; columns++) { currentRow.push(null); } board.push(currentRow); } }
[ "function makeBoard() {\n // TODO: set \"board\" to empty HEIGHT x WIDTH matrix array <--done\n for (let y = 0; y < height; y++) {\n let row = createBoardRow();\n board.push(row);\n }\n}", "function makeBoard() {\n // TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n board = []...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the given expression contains a 'super' keyword
function expressionContainsSuperKeyword(expression, typescript) { if (isSuperExpression(expression, typescript)) return true; else if (typescript.isPropertyAccessExpression(expression)) { return expressionContainsSuperKeyword(expression.expression, typescript) || expressionContainsSuperKeyword(e...
[ "static isSuperExpression(node) {\r\n return node.getKind() === typescript_1.SyntaxKind.SuperKeyword;\r\n }", "function isSuperExpression(node, typescript) {\n return node.kind === typescript.SyntaxKind.SuperKeyword;\n}", "function isSuperProperty(node){var kind=node.kind;return(kind===194/* Proper...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
chatSlimScroll Directive for slim scroll for small chat
function chatSlimScroll($timeout) { return { restrict: 'A', link: function(scope, element) { $timeout(function(){ element.slimscroll({ height: '234px', railOpacity: 0.4 }); }); } }; }
[ "function chatSlimScroll ($timeout) {\n return {\n restrict: 'A',\n link: function (scope, element) {\n $timeout(function () {\n element.slimscroll({\n height: '234px',\n railOpacity: 0.4\n });\n\n });\n }\n };\n}", "function chatSlimScroll($timeout) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `OriginGroupsProperty`
function CfnDistribution_OriginGroupsPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); errors.collect(cdk.propertyValidator('items', cdk.listValidator(CfnDistribution_OriginGroupPropertyValidator))(prop...
[ "function CfnDistribution_OriginGroupMemberPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('originId', cdk.requiredValidator)(properties.originId));\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns activity bubbles built for every commit of the specified project
function getActivityBubbles(){ var commits = getCommits(); var activityBubbles = new Array(); $.each(commits, function(index) { if(this.committer != null){ activityBubbles.push(createActivityBubble(this)); } }); activityBubbles = getBubblesProductivityIndex(activityBubbles); return activityBubbles; }
[ "function getCommits(project, callback) {\n LOG(project, \"getting project commits...\");\n child_process.exec(\"git log --format=\\\"%at %H\\\"\", { \n cwd: project.path,\n maxBuffer: 1024 * 1024 * 20, // 20mb should be enough\n }, \n (error, cout, cerr) => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get notifications from via the API
function getNotificationsFromAPI () { contentDiv = document.createElement('div') const options = `page_size=30&ordering=-pubdate&Authorization=${token}` const target = `${baseUrl}/api/notifications/?${options}` // TODO use fetch instead const xhr = new XMLHttpRequest() xhr.open('GET', target, true) xhr.on...
[ "function getNotifications(){\n fetch(notificationsURL,{\n headers: {'Authorization': 'Bearer ' + token}\n }).then(res => res.json()).then((data) => {\n displayNotifications(data)\n })\n}", "async getAllNotification() {\n const response = await axiosInstance.get('/acting-officers')\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function basically does all the math required to calculate what the new position for both handles should be when they are both being dragged and a move event occurs. This is more complicated than dragging a single handle because in that case, we can (more or less) just move the handle directly underneath the move ...
function calculateProportionalPositionsWhenDraggingBothHandles( // We need these source positions to determine how far we should move the handles sourceXPositionForDragInClientCoordinates, sourceFirstHandlePositionAsProprtion, sourceSecondHandlePositionAsProprtion, newXPositionInClientCoordinates, containerBoun...
[ "function positionDragHandle(d) {\n\t\tvar mx = d3.mouse(svg[0][0])[0];\n\t\tvar my = d3.mouse(svg[0][0])[1];\n\t\tvar cx = d[xProperty];\n\t\tvar cy = d[yProperty];\n\n\t\tvar yl = (cy-my);\n\t\tvar xl = (mx-cx);\n\t\tvar al = Math.sqrt(xl*xl + yl*yl);\n\t\tvar arad = Math.asin(xl/al);\n\t\tvar aDeg = toDegrees(ar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
;; camDebug(string...) ;; ;; Pretty debug prints a wrapper around ```debug()```. ;; Prints a function call stack and the argument message, ;; prefixed with "DEBUG". Only use this function to indicate ;; actual bugs in the scenario script, because game shouldn't ;; print things when nothing is broken. If you want to kee...
function camDebug() { __camGenericDebug("DEBUG", arguments.callee.caller.name, arguments, true, __camBacktrace()); }
[ "function debug() {\n \n}", "function camTrace()\n{\n\tif (!__camCheatMode)\n\t{\n\t\treturn;\n\t}\n\t__camGenericDebug(\"TRACE\",\n\t arguments.callee.caller.name,\n\t arguments);\n}", "function debug()\n {\n \n if(!Story.options.debugging)\n return;\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit Stop downloading and perform cleanup
function exit() { stopDownloading(); setData = {}; downloadedPhotos = {}; window.close(); }
[ "stopDownload() {\n\t\tif(this.downloadInProgress && !this.pendingQuit) {\n\t\t\tthis.extpipeObj.Quit();\n\t\t}\n\t}", "function stopDownload() {\n if (manifestId !== null && isDownloading()) {\n for (var i = 0, ln = _streams.length; i < ln; i++) {\n _streams[i].stopOfflineStreamP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new room with a unique string, join user to room, update user object. Sends the new room id back to the client.
function createNewRoom() { // Generate room id. const newID = uuidv4().substring(0, 8); // Join room socket.join(newID); // Update corressponding object in usersArray updateUserRoom(socket, newID); // Send room data to socket io.to(socket.id).emit("roomData", { roomI...
[ "async function createNewRoom(username, roomName, id) {\n console.log(\"CREATING A NEW ROOM\");\n const newUser = new User(username, roomName, id);\n\n const newRoom = new Room({\n hostId: id,\n roomName: roomName,\n })\n\n newRoom.addUser(newUser)\n\n return Room.create(newRoom).the...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given to pattern, determine longer (more strokes) and return quadruple with sorted patterns and their stroke numbers [k1,k2,n,m] where n >= m and they denote the of strokes of k1 and k2
function getLargerAndSize(pattern1, pattern2) { var l1 = pattern1.length; var l2 = pattern2.length; // definitions as in paper // i.e. n is larger var n = l1; var m = l2; var k1 = pattern1; var k2 = pattern2; if(l1 < l2) { m = l1; n = l2; k1 = pattern2; k2 = ...
[ "function pattern(n){\n var output = '';\n var space = '';\n\n for (var i = 0; i < n - 1; i++) {\n space += ' ';\n }\n\n for (var i = 1; i <= n; i++) {\n if (i === n) {\n output += collect(n);\n\n for (var j = n - 1; j >= 1; j--) {\n if (String(j).length === 2) {\n let temp = St...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mostrar todos los autos que tenemos
function mostrarAutos(autos) { //Elimina el HTML previo limpiarHTML(); autos.forEach((auto) => { const { marca, modelo, year, puertas, transmision, precio, color, sexo, } = auto; const autoHTML = document.createElement("p"); autoHTML.textContent = ` ...
[ "function mostrarAutos(autos) {\n for(let i = 0 ; i < numAutos ; i++){\n console.log( `El auto ${i+1} es de Marca ${autos[i].marca}, su modelo es ${autos[i].modelo} y su año es ${autos[i].annio}`);\n }\n \n}", "function mostrarAutos(autos){\n\n limpiarHTML();\n\n autos.forEach( auto => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CHALLENGE 1 Given an integer n, find the minimal k such that k = m! (where m! = 1 2 ... m) for some integer m; k >= n. In other words, find the smallest factorial which is not less than n. Example For n = 17, the output should be leastFactorial(n) = 24. 17 < 24 = 4! = 1 2 3 4, while 3! = 1 2 3 = 6 < 17). SOLUTION 1: st...
function leastFactorial(n) { }
[ "function leastFactorial(n) {\n let fact = 1;\n for (let i = 1; i <= 5; i++) {\n fact *= i;\n if (fact >= n) {\n return fact;\n }\n }\n}", "function leastFactorial(n) {\n let num = 1,\n i = 2\n while(true){\n if(num>=n)return num\n num *= i\n i++\n }\n}", "function leastFacto...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a CompositionSection resource
static get __resourceType() { return 'CompositionSection'; }
[ "function Section(){}", "constructor() { \n \n Section.initialize(this);\n }", "function SectionWidget(attention) {\n this.attention_ = attention;\n this.cls_ = [];\n }", "createSection(sectionName, sectionId) {\n\n let builder = this.builderDictionary[sectionId].builder;\n let c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
recursive solution Check if tree s & t are mirroring each other
function isMirror(s, t) { if (!s && !t) { return true; // Both nodes are null, ok } if (!s || !t || s.val !== t.val) { return false; // Found a mismatch } // Compare the left subtree of `s` with the right subtree of `t` // and the right subtree of `s` with the left subtree of `t` return isMirror(s...
[ "function isMirror(s, t) {\n if (!s && !t) {\n return true; // Both nodes are null, ok\n }\n if (!s || !t || s.data !== t.data) {\n return false; // Found a mismatch\n }\n // Compare the left subtree of `s` with the right subtree of `t`\n // and the ri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sorts the annotations pagewise. This is necessary since the annotation arrays of the sites must be extended and it makes sense to do this update in one step.
sortPageWise(annotations) { let pageAnnots = {}; for (let annot of annotations) { if (!pageAnnots[annot.page]) pageAnnots[annot.page] = []; pageAnnots[annot.page].push(annot); } return pageAnnots; }
[ "function annotationSort(annotations) {\n return annotations.sort(function (annot1, annot2) {\n //sort by paragraph (uri)\n if (annot1.uri > annot2.uri) return -1;\n if (annot1.uri < annot2.uri) return 1;\n //then sort by location in paragraph (offset)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Verify a signed commit
async function verify ({ dir, gitdir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(dir, '.git'), fs: _fs, ref, publicKeys, openpgp }) { const fs = new FileSystem(_fs); const oid = await GitRefManager.resolve({ fs, gitdir, ref }); const { type, object } = await GitObjectManager.read({ fs, gitdir, ...
[ "isValidCommit(commit) {\n return ChainUtil.verifySignature(\n commit.publicKey,\n commit.signature,\n commit.blockHash\n );\n }", "async function verify ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref,\n publicKeys,\n openpgp\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pushes the updates stored in pushTable to the cells.
function pushUpdates() { T.URFlag = T.URTypes.PUSHUPDATES; var fillerArray = []; var largest = 0; for(var i = 0; i<=T.pushTable.length; i++) { fillerArray[i] = []; if(T.pushTable[i]===undefined) ; //just need an empty array if undefined else { ...
[ "Update() {\n for (var i = 0; i < this.cellCount; i++) {\n this.cells[i].Update();\n }\n }", "pushDown(workbook, sheet, tables, currentRow, numRows) {\n var self = this;\n\n var mergeCells = sheet.find(\"mergeCells\");\n\n // Update merged cells below this row\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set to 0PI range
function toZeroPIRange(angle) { angle = angle % (2 * Math.PI); if (angle > Math.PI) { angle = 2 * Math.PI - angle; } return angle; }
[ "function toZeroPIRange(angle) {\n angle = angle % (2 * PI);\n if (angle > PI) {\n angle = 2 * PI - angle;\n }\n return angle;\n }", "static get QUARTER_PI () { return Math.PI / 4 }", "function pi_value() {\n\treturn (Math.PI);\n}", "function b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rebuilds the dialog body when the airport is changed.
onAirportChange() { this._buildDialogBody(); }
[ "onAirportChange() {\n this.tutorial_update_content();\n }", "updateAirportDetails() {\n\t\tconst airport = this.getDisplayedAirport()\n\t\tif (airport) {\n\t\t\tthis.infoPanelAirport.innerText = getAirportName(airport)\n\t\t\tthis.infoPanelCityState.innerText = airport.city\n\t\t\tthis.infoPanelRunways...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to get Item from local storage. Parse the json string and convert it to object. While serializing the date property will be stored as string , dateConvertor convert the date string to date object while parsing the json string.
function getItem(key) { return JSON.parse(localStorage.getItem(key), dateConvertor("dueDate","taskDate")); }
[ "function readLocalStorageKeyConvertToObject (key){\n let value_deserialize = JSON.parse(window.localStorage.getItem(key));\n console.log(value_deserialize);\n return value_deserialize;\n}", "function ReadObjectFromStorage(name_to_read)\n{\n return JSON.parse(localStorage.getItem(name_to_read)); \n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get remote session descriptor
getRemoteSessionDescriptor() { return this.peerConnection.remoteDescription }
[ "getLocalSessionDescriptor() {\n return this.peerConnection.localDescription\n }", "getLocalSessionDescription() {\n this.logger.debug(\"SessionDescriptionHandler.getLocalSessionDescription\");\n if (this._peerConnection === undefined) {\n return Promise.reject(new Error(\"Peer connec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rotate the cubes based on random values for player 1
function roll(dice) { let xValue = getRandom(max,min); let yValue = getRandom(max,min); dice.css('-webkit-transform', 'rotateX('+xValue+'deg) rotateY('+yValue+'deg)'); Resultplayer1(xValue,yValue); display(); }
[ "rotate_u() {\n var cubies = this.cubies.map(c => c.copy()); // Creates a deep copy of this.cubies\n let rot = quat_1.default.fromAxisAngle(vec3_1.default.up, -Math.PI / 2);\n this.apply_rotation(cubies.filter(c => c.position.y == 1), rot);\n return new CubeState(cubies);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter geojson data according to a town name Naivasha
function filterByTown(feature){ // if (feature.properties.const_nam == 'Naivasha') return true; // return feature.properties.const_nam == 'Naivasha'?true:false; return true; }
[ "function filterData(borough) {\r\n\treturn (borough == \"nyc\") ? filteredData = allData\r\n\t: (borough == \"Statenisland\") ? allData.filter((d) => d.borough == \"Staten Island\")\r\n\t: filteredData = allData.filter((d) => d.borough == borough);\r\n}", "filterPlaces(places) {\n return places.results.filter...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets a preprocess function for every generated namespace.x binding. This can be called multiple times for the same binding, and the preprocess functions will be chained. If the binding has a custom getNamespacedHandler method, make sure that it's set before this function is used.
function setDefaultNamespacedBindingPreprocessor(namespace, preprocessFn) { var handler = ko.getBindingHandler(namespace); if (handler) { var previousHandlerFn = handler.getNamespacedHandler || defaultGetNamespacedHandler; handler.getNamespacedHandler = function() { ...
[ "function setDefaultNamespacedBindingPreprocessor(namespace, preprocessFn) {\n var handler = ko.getBindingHandler(namespace);\n if (handler) {\n var previousHandlerFn = handler.getNamespacedHandler || defaultGetNamespacedHandler;\n handler.getNamespacedHandler = function() {\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funkcija za formiranje select taga za dijagnoze
function formirajSelectDijagnoze(callback) { $.get({ url : 'dijagnoza/getDijagnoza', success : function(dijagnoze) { //formiranje select html taga selectHtml = '<select id="diagnozaType" class="form-control" required><option value=-1>Odaberite dijagnozu</option>'; dijagnoze.forEac...
[ "function formirajSelectDijagnoze(callback)\n{\n\t$.get({\n\t\turl : 'dijagnoza/getDijagnoza',\n\t\tsuccess : function(dijagnoze) \n\t\t{\n\t\t\t//formiranje select html taga\n\t\t\tselectHtml = '<select id=\"diagnozaType\" class=\"form-control\" required><option value=-1>Odaberite dijagnozu</option>';\n\t\t\t\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
==================================================================== [GGTRCC_RenderBattingByYear] For the rendering of batting by year for player stats
function GGTRCC_RenderBattingByYear (aPLSO) { var lRet=""; lRet += "<span class='GadgetStatsHeading'>Batting By Year</span>"; lRet += "<table width='100%' cellSpacing='0' cellPadding='0' border='0'>"; lRet += "<thead>"; lRet += "<tr class=\"GadgetBatsHeader\">"; lRet += "<th>&nbsp;</th>";...
[ "function GGTRCC_RenderBattingHighlightsByYear (aPLSO)\r\n{\r\n\tvar lRet=\"\";\r\n\t\r\n\t//\r\n\t// Are there any highlights to render?\r\n\t//\r\n\tif (!aPLSO.HasBattingHighlights())\r\n\t{\r\n\t\treturn (lRet);\r\n\t}\r\n\t\r\n\tlRet += \"<span class='GadgetStatsHeading'>Batting Highlights By Year</span>\";\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setups the letters available section of the screen with the list of letters that can be used
function setupLettersAvailable() { //Create <li> var li = document.createElement('li'); li.textContent = ""; //clear the LI when starting/restarting clearLiFromList(); //append the LI back onto the DOM lettersLeft.appendChild(li); for (var index = 0; index < lettersToUse.length; index++)...
[ "function setLetterKeyboard(lettersDisplayed) {\n\tconst letterKeyboard = document.getElementById(\"letterKeyboard\");\n\t// Clear keyboard\n\tletterKeyboard.innerHTML = \"\";\n\n\tconst alphabetAsCharArray = alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');\n\n\t// Construct keyboard button for each character of ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is to check if the user has enough money to buy the item
function checkBuy() { if (money <= 99) { $('#alerts').append("<br />You do not have enough" + "<br />" + "money to buy this item <br />"); } else { buyItem(); } }
[ "function makePurchase (priceOfItem){\n if ( priceOfItem <= user.total){\n user.total -= priceOfItem\n } else if (priceOfItem > user.total){\n return \"not enough funds\"\n } \n}", "function check_payable(item) {\n if (update_cost(item.id) > currency) {\n window.confirm(\"Deine Tokens reichen ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the path to a function's test file
function testFilePath(funcName) { return path.join(testFolder, `${funcName.replace(/.*\//g, '')}.js`); }
[ "function getTestFilePath()\r{\r\treturn getProjectPath() + \"TestFiles/test_01.js\";\r}", "function actualTestFile(testFile) {\n var t = testFile;\n t = \"./tests/e2e/tests/\" + t;\n t += \".js\";\n return t;\n}", "function testFilePath(filename) {\n return path.join(__dirname, filename);\n}", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Once message is received, play the audio
function playAudioFromMessage() { if (!audioMessageAsBase64) { return; } else { var finalAudio = new Audio('data:audio/ogg;base64,' + audioMessageAsBase64) finalAudio.play(); } }
[ "playSound() {\n if (this.playSound) {\n IncomingMessageAudio.play();\n }\n }", "async chat_play() {\n await this.mpd.play();\n }", "function play_chat_sound() {\r\n audio.play();\r\n}", "function playNewMessageAudio() {\n (new Audio('https://notificationsounds.com/soundfiles/8b16e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function does an API call to delete posts InitializeRows handles appending all of our constructed post HTML inside blogContainer
function initializeRows() { blogContainer.empty(); var postsToAdd = []; for (var i = 0; i < posts.length; i++) { postsToAdd.push(createNewRow(posts[i])); } blogContainer.append(postsToAdd); }
[ "function initializeRows() {\n blogContainer.empty();\n var postsToAdd = [];\n for (var i = 0; i < posts.length; i++) {\n postsToAdd.push(createNewRow(posts[i]));\n }\n blogContainer.append(postsToAdd);\n }", "function initializeRows() {\n blogContainer.empty();\n var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the value of a word in the selected mad lib using setState
updateWord(key, value) { const updatedMadLib = this.state.selectedMadLib; const changedWord = updatedMadLib.words.find((word) => { return word.key === key }); changedWord.value = value; this.setState({selectedMadLib: updatedMadLib}); }
[ "onWordSelect(word) {\n\t\t// remove the whitespace at the end of the string\n\t\t// concat the selected word with a leading & trailing whitespace\n\t\tthis.setState(prevState => ({\n\t\t\tvalue: prevState.value.replace(/ +$/g,\"\") + ' ' + word + ' ',\n\t\t\tword: word\n\t\t}));\n\t}", "changeWord() {\n var r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new purchase order for given purchaseOrderId,productId
function createPurchaseOrder(purchaseOrderId,productId) { var headerData = { "PURCHASEORDERID" : [purchaseOrderId], "HISTORY.CREATEDAT" :["2014-03-03"], "LIFECYCLESTATUS" : ["L"] }; var itemData = { "PURCHASEORDERID" : [purchaseOrderId], "PURCHASEORDERITEM" : ["1010"], "PRODU...
[ "static createInstance(orderId) {\n return new Order({orderId});\n }", "async createOrder(ctx, customer, orderNumber, productId, orderCreateDate, quantity, payload) {\r\n console.log(`Creating order for customer: ${customer} with PID ${productId}`);\r\n const ORG = this.utils.determineOrg(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Append multiple selected poets to search input box. Attribution:
function appendPoetNameToInput(poetsInput, selectedPoet){ if (!($(poetsInput).val())) { $("#poets").val(selectedPoet); } else { $(poetsInput).val($(poetsInput).val() + ", " + selectedPoet); enableCheckbox(); } }
[ "function enableGetSelectedPoetFromList() {\n $(\"#poet-list\").change(function() {\n let selectedPoet = $(\"#poet-list option:selected\").text();\n if ($(\".js-poet-search-form\").hasClass(\"hidden\")) {togglePoetSearchVisbility()};\n appendPoetNameToInput(\"#poets\", selectedPoet);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hancdle the ranimation directive el : the element to process value: the directive value
function processAnimate( element, value ){ var Component = this.constructor; if(_.isExpr(value)){ value = value.get(this); } value = value.trim(); var composites = value.split(";"), composite, context = this, seeds = [], seed, destroies = [], destroy, command, param , current = 0, tmp,...
[ "function processAnimate( element, value ){\n value = value.trim();\n\n var composites = value.split(\";\"), \n composite, context = this, seeds = [], seed, destroies = [], destroy,\n command, param , current = 0, tmp, animator, self = this;\n\n function reset( type ){\n seed && seeds.push( seed )\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ static function to create a new Transport from a connected Ledger device discoverable via U2F (browser support)
static async open(_, _openTimeout = 5000) { return new TransportU2F(); }
[ "static async open(device) {\n await device.open();\n\n if (device.configuration === null) {\n await device.selectConfiguration(configurationValue);\n }\n\n await gracefullyResetDevice(device);\n const iface = device.configurations[0].interfaces.find(({\n alternates\n }) => alternates.so...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper to get a typed SimpleDbStore for the mutations object store.
function mutationsStore(txn) { return IndexedDbPersistence.getStore(txn, DbMutationBatch.store); }
[ "function mutationsStore(txn) {\n return SimpleDb.getStore(txn, DbMutationBatch.store);\n}", "function mutationsStore(txn) {\n return IndexedDbPersistence.getStore(txn, DbMutationBatch.store);\n}", "function mutationsStore(txn) {\n return getStore(txn, DbMutationBatch.store);\n}", "function mutations...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start timer to change visible view
_startTimer() { this._stopTimer(); const registry = storage.getRegistry(this._instance); const config = registry.config; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const timeout = config.ui.viewUpdateDelay; if (!timeout) { this...
[ "startVisibilityTimer() {\n this.visibleTimer = this.visibleDuration;\n }", "_changeVisibleView() {\n\t if (this._view !== this._visibleView) {\n\t this._visibleView = this._view;\n\t this._stopTimer();\n\t this._triggerChange(true);\n\t return true;\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that updates the transition arrows between states at time n and states at time n+1. arrows are scaled in width based on the probability of transition times the probability of state n arrows are grouped in color based on source state (colors from d3 category10 colors) gets the data from the model uses svg/d3 el...
function updateArrows(current_state){ var this_chart = chart[current_state] //clears the svg so that we can draw new arrows clearArrows(current_state); //gets the data from the model about the current states var points = model.get_cur...
[ "function drawTransitions () {\n let transitions = [];\n transitionSource.forEach(function (t) {\n let transition = {};\n inoutData.concat(counterData).forEach(function (c) {\n if (c['name'] === t[0]) {\n transition['x1'] = c['x'];\n transition['y1'] = c['y'];\n }\n if (c['name'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
You are given an array of nonnegative integers, your task is to complete the series from 0 to the highest number in the array. If the numbers in the sequence provided are not in order you should order them, but if a value repeats, then you must return a sequence with only one item, and the value of that item must be 0....
function completeSeries(arr) { let output = []; const max = Math.max(...arr); const set = [...new Set(arr)]; if (set.length !== arr.length) { return [0]; } else { let i = 0; while (i <= max) { output.push(i); i++; } return output; } }
[ "function maxSequence(arr) {\n if (arr.every(n => n < 0)) {return 0;}\n\n let maxSum = arr[0];\n let currentSum = maxSum;\n\n for (let i = 1; i < arr.length; i++) {\n currentSum = Math.max(currentSum + arr[i], arr[i]);\n maxSum = Math.max(maxSum, currentSum);\n }\n\n return maxSum;\n}", "function extr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function will create a sorted Array, that holds all the words from all the documents all together as Terms Object
function createGeneralTermsObjectsArray(filesInSource) { let generalWordsArray = new Array(); for (let i = 0; i < filesInSource.length; i++) { if (i === 0) generalWordsArray = createInitializedTermsArray(filesInSource[i]); else generalWordsArray = generalWordsArray.concat( createInitiali...
[ "function getTermsSorted() {\n // let terms = Object.keys(getIndex(IDX_TERMS_BY_ANCHOR)).sort(strComparator);\n let _byAnchor = getIndex(IDX_TERMS_BY_ANCHOR);\n let terms = Object.keys(_byAnchor).sort((left, right) => right.length - left.length);\n let result = [];\n for (let i = 0, len = terms.lengt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update and show all possible moves based on a specific grid
updateMoves(grid) { let downward = this.get_piece(grid).team == Const.TEAM.B; this.moves = this.get_piece(grid).getPossibleMoves(this, this.chessboard, grid, downward); if ((!this.white_king_moved && grid == this.king_grid[Const.TEAM.W]) || (!this.black_king_moved && grid == this.king_grid[Const.TEAM.B])) { ...
[ "updateMoves(grid) {\n\t\t// let downward = this.get_piece(grid).team == Const.TEAM.B;\n\t\tthis.moves = this.get_piece(grid).getPossibleMoves(this, this.chessboard, grid, this.downward);\n\n\t\tif ((!this.white_king_moved && grid == this.king_grid[Const.TEAM.W]) ||\n\t\t\t(!this.black_king_moved && grid == this.ki...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the provided object implements the AsyncIterator protocol via
function isAsyncIterable(maybeAsyncIterable) { return typeof (maybeAsyncIterable === null || maybeAsyncIterable === void 0 ? void 0 : maybeAsyncIterable[_symbols.SYMBOL_ASYNC_ITERATOR]) === 'function'; }
[ "function isAsyncIterable(maybeAsyncIterable) {\n if (maybeAsyncIterable == null || _typeof$4(maybeAsyncIterable) !== 'object') {\n return false;\n }\n\n return typeof maybeAsyncIterable[SYMBOL_ASYNC_ITERATOR] === 'function';\n}", "function isAsyncIterable(data) {\n return data && data[Symbol.asyncIterator...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether the information descibes a full replacement event.
function isFull(event) { let candidate = event; return candidate !== undefined && candidate !== null && typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined; }
[ "oldEnoughToDR() {\r\n return !this.fixed && this.posUpdateTime != null && getTimeInServerRefFrame().diff(this.posUpdateTime) > deadReckonTimeMS;\r\n }", "_isReplacementMsg(pub) {\n return pub.head && pub.head.replace;\n }", "checkTimeout() {\n const eventTimeout = params_1.RingerParams.params.re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }