query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
assign a handler to all number input that rounds value to the nearest multiplier of a step value and fires calculations when a score value is changed in a number type input field
function scoreChangeHandlerSprout(minScore, maxScore, step) { $('input[type=number]').change(function () { var value = $(this).val(); // round the value to the closest step multiplication integer value = (Math.round((Math.round(value)) / step)) * step; // mak...
[ "function scoreChangeHandler(minScore, highScore, step) {\r\n $('input[type=number]').change(function () {\r\n var value = $(this).val();\r\n \r\n // round the value to the closest step multiplication integer\r\n value = (Math.round((Math.round(value)) / step)) * step;\r\n \r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
copies a json of the `activeEncounter` to clipboard
copyActiveDataToClipboard() { const { activeData } = this.state; const cleanData = encounterDataUtils.formatEncounterData(activeData); NotificationManager.info('Copied Current Data', undefined, 1000); copyToClipboard(JSON.stringify(cleanData)); }
[ "function copy_json() {\n\tdocument.getElementById(\"json_box\").select();\n\tdocument.execCommand(\"copy\");\n}", "copyDataListToClipboard() {\n const { dataList } = this.state;\n const cleanList = encounterDataUtils.formatEncounterList(dataList);\n NotificationManager.info('Copied All Data', undefined,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This functions allows the agent to subscribe to conversation. convState is the conversation state for which should be subscribed agentOnly if set it will only subscribe to conversation in which the agent is or which are suitable for his skills
async subscribeToConversations(convState = 'OPEN', agentOnly = true) { if (!this.isConnected) return; return await this.myAgent.subscribeExConversations({ 'convState': [convState] }); }
[ "function changeVoiceState(voice_channel, text_channel, nextState) {\n var result = false\n if (typeof(nextState) === 'boolean'){\n var target_room = ROOMS.find((room) => room.channelID === voice_channel && room.cmdChannelID === text_channel)\n if (target_room != undefined){\n target_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates 4 bindings if changed, then returns whether any was updated.
function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) { const different = bindingUpdated2(lView, bindingIndex, exp1, exp2); return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different; }
[ "function updateBindings() {\n // if any binding changes, loop over all bindings again to see if the changed made\n // any changes to other bindings. Similar to Angular.js dirty checking method.\n var changed = true;\n \n while (changed) {\n changed = false;\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle checkbox label clicks to get around issue with rich message content. When the label text itself is clicked, the checkbox should toggle. When the field associated with the checkbox is clicked, the checkbox should be checked regardless of state. Clicking links or buttons in rich content should do nothing to the st...
function handleCheckboxLabelClick(checkboxId, event) { var checkbox = jQuery("#" + checkboxId); if (!checkbox.prop("disabled")) { if (jQuery(event.target).is("input, select, textarea, option")) { if (!checkbox.prop("checked")) { checkbox.prop("checked", true); ...
[ "function clickedOnCheckboxLabel(data) {\n\tif (!viewModel.recordingTimeoutHandle()) // only allow toggling of checkbox if currently not recording\n\t{\n\t\tdata.isChecked(!data.isChecked());\n\t}\n}", "function NLCheckboxOnClick(span)\n{\n var origSpanClass = span.className;\n\tvar inpt = null;\n\n\t// Find t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds internal classes to be able to provide customizable selectors keeping the link with the style sheet.
function addInternalSelectors(){ //adding internal class names to void problem with common ones $(options.sectionSelector).each(function(){ $(this).addClass(SECTION); }); $(options.slideSelector).each(function(){ $(this).addClass(SLIDE); ...
[ "addCss() {\n const me = this,\n owner = me.owner,\n inputEl = owner.getInputEl(),\n labelEl = owner.getLabelEl();\n\n owner .addCls(me.ownerCls);\n inputEl.cls.push(me.inputCls);\n labelEl.cls.push(me.labelCls);\n }", "function addCs...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
classify first player poses
function classifyPose() { if (pose) { let inputs = []; for (let i = 0; i < pose.keypoints.length; i++) { let x = pose.keypoints[i].position.x; let y = pose.keypoints[i].position.y; inputs.push(x); inputs.push(y); } brain.classify(inputs, gotPlayerResult); } else { setTime...
[ "function classifyOtherPlayerPose() {\n if (otherPlayerPose) {\n let inputs = [];\n for (let i = 0; i < otherPlayerPose.keypoints.length; i++) {\n let x = otherPlayerPose.keypoints[i].position.x;\n let y = otherPlayerPose.keypoints[i].position.y;\n inputs.push(x);\n inputs.push(y);\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if a named prepared statement is created with empty query text the backend will send an emptyQuery message but not a command complete message since we pipeline sync immediately after execute we don't need to do anything here unless we have rows specified, in which case we did not pipeline the intial sync call
handleEmptyQuery(connection) { if (this.rows) { connection.sync() } }
[ "function canCreateBlankQuery() {\n return (currentQueryIndex == pastQueries.length -1 &&\n lastResult.query.trim() === pastQueries[pastQueries.length-1].query.trim() &&\n lastResult.status != newQueryTemplate.status &&\n !cwQueryService.executingQuery.busy);\n }", "_prepare() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Description : Master DataCheck
function Master_DataCheck(){ if(LINE_PART.bindcolval == "" ) { alert("Project 누락"); return false; } if(LINE_PART.index != 3) { if( PROJECT.index == 0 ) { alert("물류비 부담 누락"); return false; } } if(strim(ETD_DT.Text) == "" ) { alert("반출일자 누락"); return false; } if(strim(txt_o...
[ "function setCheckData() {\n\t\t\t // When dataprovider value is changed\n\t\t\t if ($scope.model.valuelistID) {\n\t\t\t\t \n\t\t\t\t // if dataprovider is undefined uncheck all \n\t\t\t\t if ($scope.model.dataProviderID == null || $scope.model.dataProviderID == '' || $scope.model.dataProviderID == undefined) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get background colors for the 3 nutrients accordingly to the theme chosen from css variables
function getNutrientBackgroundColors() { let carbsColor = getComputedStyle(document.body).getPropertyValue('--carbs-color'); let fatColor = getComputedStyle(document.body).getPropertyValue('--fat-color'); let proteinColor = getComputedStyle(document.body).getPropertyValue('--protein-color'); return [carbsColor,...
[ "getBackgroundStyle(childs) {\n\n if (!isArray(childs) || childs.length === 0) {\n return 'transparent';\n }\n\n let colors = A(A(childs).getEach('color'));\n colors = colors.uniq(); // every color only once!\n colors = colors.sort(); // assure color-order always the same\n colors = colors.fi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a function to serve the CSS file
function style(req, res) { console.log("router.style() -> CSS Request URL: " + req.url) console.log("router.style() -> CSS Request Method: " + req.method) if (req.url.indexOf(".css") !== -1) { console.log(" - inside style route"); renderer.css("main", res); res.end(); } }
[ "function handleCSS(response){\n\tfs.readFile(\"a3.css\", function(err, data) {\n\t\tif(err){\n\t\t\tresponse.writeHead(404);\n\t\t\tresponse.end();\n\t\t}\n\t\telse{\n\t\t\tresponse.writeHead(200, {'content-type':'text/css'});\n\t\t\tresponse.write(data);\n\t\t\tresponse.end();\n\t\t}\n\t});\n}", "function getCS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove a client from the client pool
function removeClient ( client ) { var i = clients.indexOf( client ); if (i !== -1) { clients.splice(i, 1); } }
[ "remove(clientID) {\n var c = this.clients.get(clientID);\n if (!c) return;\n c.setTimer(null);\n c.deregister();\n this.clients.delete(clientID);\n\n debug(\"Removed client %s from room %s\", clientID, this.id);\n if (this.empty() && this.ecb) this.ecb();\n }", "closeClient(key) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function displays the selected prescription in a popup
function showPrescription(uid){ showLoader(); const infoContent = document.querySelector("#info-display"); db.collection("repeats").doc(uid).get() .then(repeatDoc => { if (repeatDoc.exists) { const repeat = repeatDoc.data(); const patQuery = db.collection("patients").doc(repeat.nhsNumber).get(); co...
[ "function callPolice(){\n const option = user.value;\n user.value = '';\n\n \n if(option === 'polisen' || option === 'POLISEN' || option === 'Polisen'){\n story.innerHTML = 'Polisen kom direkt och ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function get the result of claim based on claim type and claim amount The following fields are passed as query parameters claimType claimAmount
function getClaimResult(req, res) { var results = { }; // Create a Rule Engine instance var R = new rule(); // Add a rule var claimRule = { "condition" : function(R) { R.when((this.claimType === 'MEDICAL' && this.claimAmount > 100) || (this.claimType === 'DENTAL' &&...
[ "async totalClaimable(){\n try {\n let claimable = await this._contract.claimAmount({\n user: this._accountId\n })\n return utils.format.formatNearAmount(claimable)\n } catch (error) {\n console.log(error)\n return 0 \n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clears the content of a render target.
__clearRenderTargetContent(element) { element.innerHTML = ''; // Whenever a Lit-based renderer is used, it assigns a Lit part to the node it was rendered into. // When clearing the rendered content, this part needs to be manually disposed of. // Otherwise, using a Lit-based renderer on the same node wil...
[ "function clearContentBox(){\n\t\tcontent.html('');\n\t}", "clear() {\n // Wipe out the DOM content.\n for (let [, containerElem] of this._containerHtmlElems) {\n $(containerElem).empty();\n }\n // Clear the data structures.\n this._containerHtmlElems.clear();\n this._svgDispl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
used to switch focus to the "next" node, based on a search function returns false if it fails to switch, true otherwise.
switchNodes(searchFnNode, searchFnCur, e) { let node = this.getActiveNode(); let inclusive = false; if (!node) { node = searchFnCur(this.cm.getCursor()); if (!node) { // In the context of UP and DOWN key, this might mean the cursor is at the // top of bottom already, so we should...
[ "function returnFocus() {\n if( focused )\n focused.focus();\n }", "function highlightNext($element) {\n var highlighted = $element.query('.'+_CLASSES.HIGHLIGHTED)\n var next\n\n if ($element.contains(highlighted...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
flips the rect 180 degreens along the Zposition. purely for the sake of looking good.
function flip_rect_bit($rect, deg){ deg = deg || 0; $rect.css('transform', 'rotateY(' + deg +'DEG)'); $rect.css('transform-origin', (parseInt($rect.attr('x')) + CELL_WIDTH/2) + 'px'); if(deg < 180){ timers.FLIP_TIMER=setTimeout(function(){self.flip_rect_bit($rect, deg+2);}, 5); } }
[ "rotate270() {\n const { x } = this;\n this.x = this.y;\n this.y = -x;\n }", "function flipX() {\n\t/// TODO:\n}", "function flip (flipped) {\n const projection = getProjection()\n target = getTargetAngle(projection, flipped)\n updateAnimation()\n }", "function flipY(y) {\n\treturn h - y;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
READ_MAIN(X) 1. Parse X as JSON. a. If contents of X is not valid JSON, STOP b. Otherwise, let J = contents of X 2. If field was passed a. M = READ_FIELD(X, J) b. if M is not null, return 3. Look for "main" field in J a. If "main" is present and a valid string, return
async readMain(x) { assert(typeof x === 'string'); assert(isAbsolute(x)); const j = await readJSON(x); if (!isObject(j)) return null; if (this.field) { const m = await this.fieldMain(x, j); if (m) return m; } if (!isString(j.main)) return null; retur...
[ "async fieldMain(x, j) {\n assert(typeof x === 'string');\n assert(isAbsolute(x));\n assert(isObject(j));\n\n const y = dirname(x);\n const b = j[this.field];\n\n if (b === false || isString(b))\n return this.normalize(b, y);\n\n if (isString(j.main) && isObject(b)) {\n const m = awai...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the server profile for the guild
async getServerProfile() { let profile = null; try { this.logger.debug(GuildService.name, this.getServerProfile.name, "Getting profile."); profile = await this.profileRepo.getByServerId(this.guild.id); } catch(error) { this.logger.error(GuildService.na...
[ "get guildID() {\n return this._player.guildID;\n }", "get userProfile() {\n return spPost(ProfileLoaderFactory(this, \"getuserprofile\"));\n }", "function loadServerStats(server, context) {\n User.getRosterStatus().then((value) => {\n const conodeAndStatusPair = User._statusList[0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TreeGetBranchById This function returns a branch by ID or false if not found or loaded.
function TreeGetBranchById(id) { var tree = this; if ( tree.branchesById[id]) return tree.branchesById[id]; return false; }
[ "function getBranch() {\n return new baseService()\n .setPath('ray', '/company/branch/' + vm.currentBranch)\n .execute()\n .then(function (res) {\n vm.branchName = res.name;\n });\n }", "function getBranch(payload) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set new password if lost
'resetLostPassword'(email, password) { return setNewPassword(email, password, function(error, result){ if(error) { throw new Meteor.Error(error, message); } else { return true; } }); }
[ "function setNewPassword() {\n var Customer, resettingCustomer;\n Customer = app.getModel('Customer');\n\n app.getForm('resetpassword').clear();\n resettingCustomer = Customer.getByPasswordResetToken(request.httpParameterMap.Token.getStringValue());\n\n if (empty(resettingCustomer)) {\n \tresponse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add all items in an iterable to this set.
addAll(iterable) { if (!iterable || typeof iterable.forEach !== 'function') { return } iterable.forEach(item => { this.add(item) }) }
[ "addTo(iterable) {\n if (isIterable(iterable)) {\n for (let item of iterable) {\n this.add(item);\n }\n } else {\n this.add(iterable);\n }\n return this;\n }", "addToFromProp(prop, iterable) {\n for (let item of iterable) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculate the distance between 2 nodes
function calcDistance(node1, node2) { //could use Math.hypot if it's compliant w/their specs; check // return Math.hypot(node1.x-node2.x,node1.y,node2.y) var x = node1.x - node2.x; var y = node1.y - node2.y; return Math.sqrt(x * x + y * y) } //calcDistance
[ "function distanceBetweenNodes(node1, node2,edges) {\n for (let i = 0; i < edges.length; i++) {\n if (\n (edges[i].source === node1 &&\n edges[i].target === node2) ||\n (edges[i].source === node2 &&\n edges[i].target === node1)\n ) {\n return edges[i].metadata.distance;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: forecast_zip() Description: sends a POST XML request to the server to change the forecast zip to zip.json
function forecast_zip(zip,callback) { var postURL = "/"; var postRequest = new XMLHttpRequest(); postRequest.open('POST',postURL); postRequest.setRequestHeader('Content-Type','application/json'); postRequest.addEventListener('load', function(event){ var error; if(event.target.status !== 200){ ...
[ "function store_zip(zip,callback) {\n var postURL = \"/\";\n var postRequest = new XMLHttpRequest();\n\n postRequest.open('POST',postURL);\n postRequest.setRequestHeader('Content-Type','application/json');\n\n postRequest.addEventListener('load', function(event){\n var error;\n if(event.target.status !==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for mediamodule template(change the top margin of tower ad accoringly to dynamic height of media module half widget to make towerad float below 300 x 250 ad
function getheight(){ var ff = (navigator.userAgent.toLowerCase().indexOf('firefox') != -1); var NS = (navigator.userAgent.toLowerCase().indexOf('netscape') != -1); var IE = (navigator.userAgent.toLowerCase().indexOf('msie') != -1); if(isgE('MET_MediaModule_Half')) { var height...
[ "function marginControll() {\r\n if (window.matchMedia('(min-width: 540px)').matches) {\r\n\r\n $('.direction').css('margin-top', -$('.direction__list').height() / 2 - 27);\r\n \r\n }\r\n }", "function setnhdrwrapsizerReducedSizePX(){\r\nvar gseaInitSize = document.getElementById('g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests the commonEnd function.
function testCommonEnd() { const { parameters } = tests.exercises.find((exercise) => { return exercise.name === "commonEnd"; }); let tc = 0; let pass = 0; for (let a of parameters[0].values) { for (let b of parameters[1].values) { const functionCall = `commonEnd(${format(a)}, ${format(b)})`; ...
[ "theEnd() {\n\t\t// quest end phases\n\t\tfor(let quest of this.prioritizedQuestList) {\n\t\t\ttry {\n\t\t\t\tquest.questEnd();\n\t\t\t} catch(e) {\n\t\t\t\tLogger.errorLog(\"error caught in quest end phase, colony:\" + this.name + \", quest:\" + quest.nameId, ERR_TIRED, 5);\n\t\t\t\tLogger.log(e.stack, 5);\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the normalize() function passed to a loader plugin's normalize method.
function makeNormalize(relName) { return function (name) { return normalize(name, relName); }; }
[ "function getNormalizationFunction() {\n var repl = [];\n for (var i = 0; i < arguments.length; i++) {\n var mapping = arguments[i];\n for ( var key in mapping) {\n repl.push({\n regexp : new RegExp(key, 'gim'),\n value : mapping[key]\n });\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This generates forward connections
generateConnections(){ for(var i = 0; i < this.neurons.length; i++){ this.neurons[i].generateForwardSynapses(i); } }
[ "_connectNodes() {\n // Connect start\n let startAstNode = this.#jp;\n if (startAstNode.instanceOf(\"function\")) {\n startAstNode = startAstNode.body;\n }\n\n if (!startAstNode.instanceOf(\"statement\")) {\n throw new Error(\n \"Not defined how to connect the Start node to an AST no...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getting a list of all my claimed records
function getclaimedrecordslist() { StaticDataFactory.GetClaimedRecordsList().then(function (data) { if(data === undefined) { return; } vm.claimedRecords = data.claimedrecords; }); ...
[ "ListOfAuthorizedDeferredPaymentAccountForThisCustomer() {\n let url = `/me/paymentMean/deferredPaymentAccount`;\n return this.client.request('GET', url);\n }", "function getAwardList(personReferenceKey) {\n\n personAwardLogic.getAwardList(personReferenceKey).then(function (response) {\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set image to scissors image
function setScissorsImg(){ decision = "scissors"; document.getElementById('meImg').src = SCISSORSIMGPATH; }
[ "function dressup(swatch) {\n\tvar swatchPart = $(swatch).parent().attr(\"title\");\n\tvar swatchImage = $(swatch).children(\"img\").attr(\"src\");\n\n\t$(\"#\"+swatchPart+\" > img\").attr({\"src\": swatchImage});\n }", "function setRockImg(){\n decision = \"rock\";\n document.getElementById('meImg').src...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds owner form with the possibility to add owner's address. Make ajax call to the server to save owner with address.
function addOwnerFormAndSaveResult(rows, ownerType) { $resourceNewOwnerForm.empty(); $ownerAddressForm.empty(); let $form = $('<form/>', { class: 'form', id: ownerFormId }); // append form for the owner and append all rows needed by this form $resourceNewOwnerForm.append($form);...
[ "function displayAddOwner(){\n getToken().then((token) => {\n var params = window.location.search + \"&idToken=\" + token;\n\n const displayRequest = new Request(\"/get-role\" + params, {method: \"GET\"});\n fetch(displayRequest).then(response => response.json()).then((role) => {\n var elem = documen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updateFolderDisplay : update display for all subfolder of a folder
updateFolderDisplay( folder ,verbose ){ for(var fldr in folder.__folders ){ if (verbose) log( 'Entering folder :', fldr ) ; this.updateFolderDisplay(folder.__folders[fldr], verbose) ; } this.updateControllersDisplay( folder.__controllers , verbose ) ; }
[ "function updateUI() {\n showFolderOrFileContentById(navigationHistory.getCurrentId(), true);\n var treeState = getExplorerState();\n showFoldersTree(treeState);\n }", "onDisplayingFolder() {\n let displayedFolder = this.view.displayedFolder;\n let msgDatabase = displayedFolder && di...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get for the Credits Part of Job Overview
function _GetCreditsForJobPage() { vm.$userCreditsService.GetCreditsForJobPage(_GetCreditsForJobPageSuccess, _GetCreditsForJobPageError); }
[ "getCredits() {\n return this.credits;\n }", "async getAccountSummary() {\n const summaries = await this.client.getAccountSummary();\n await this.push(summaries);\n this.locked = false;\n this.get();\n }", "async componentDidMount() {\n let company = await JoblyApi.getCompa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by ObjectiveCPreprocessorParserpreprocessorNot.
exitPreprocessorNot(ctx) { }
[ "exitPreprocessorParenthesis(ctx) {\n\t}", "exitPreprocessorDefined(ctx) {\n\t}", "exitPreprocessorConditional(ctx) {\n\t}", "exitPreprocessorDef(ctx) {\n\t}", "exitPreprocessorBinary(ctx) {\n\t}", "exitPreprocessorImport(ctx) {\n\t}", "enterPreprocessorNot(ctx) {\n\t}", "exitPreprocessorDefine(ctx) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Override moveCompleted so we can wait, then fade in the fog and switch the turn
moveCompleted() { // Housekeeping this.from = null; // Check if the game is actually over! let moves = this.getMoves(); if (moves.length === 0) { if (this.game.in_check()) { // CHECKMATE this.showResult(true, this.getTurn(false)); } else { // STALEMATE ...
[ "startMoving () {\r\n this._isMoving = true;\r\n }", "move(direction) {\r\n\t\tlet somethingChanged = this.moveMap(direction);\r\n\t\tif (somethingChanged) {\r\n\t\t\tthis.spawnNew();\r\n\t\t}\r\n\t}", "toGoPosition() {\n console.log('[johnny-five] Proceeding with Go Sequence.');\n\n this.red.on();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name the class with the given id.
function name_class(klass, id) { klass.__classid__ = id; }
[ "processNamedClass() {\n if (!this.tokens.matches2(tt._class, tt.name)) {\n throw new Error(\"Expected identifier for exported class name.\");\n }\n const name = this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 1);\n this.processClass();\n return name;\n }", "function getClassFr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clear class 'selected' on section list
function clearSelSec() { for(var i = 0; i < sectionLen; i++) { sectionList[i].className = ''; } }
[ "function deselectAll() {\n selected = 0;\n\n let selectedCards = qsa(\".selected\");\n let i;\n for (i = 0; i < selectedCards.length; i++) {\n selectedCards[i].classList.remove(\"selected\");\n }\n }", "function blockClassReset() {selectedBlock.attr('class', 'unse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set Item's fields Keyup listener where: 1. selector is an html element object 2. eventHandler is a method to act a change event
function setKeyUpItemListener(selector, eventHandler){ selector.keyup(function(){ selector.removeClass("active"); $(this).addClass("active"); eventHandler($(this),selector); }); }
[ "_listenFieldSelected() {\n var self = this;\n self.m_fieldChangeHandler = function (e) {\n if (!self.m_selected)\n return;\n var $selected = $(e.target).find(':selected');\n var fieldName = $selected.val();\n var fieldType = $selected.data('t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a valid point according to MCMC logic
getValidPoint(v){ let flag = true; let foo = 0; let X; let Y; let lk1 = this.likelihood(v.x,v.y); let lk2; while(flag & foo < 100){ // First step of MCMC X = v.x + randomGaussian(0,this.std); Y = v.y + randomGaussia...
[ "function check_point(p) {\n if (p.x < 0 || p.x > 9) {\n return false;\n } else if (p.y < 0 || p.y > 9) {\n return false;\n } else if (spielfeld[p.y][p.x]) {\n //console.log(\"point already in use:\", p);\n return false;\n } else {\n //console.log(\"point ok:\", p);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the total cost of all transactions.
getTotalCost() { return this.transactions.map(t => t.cost).reduce((acc, value) => acc + value, 0); }
[ "function totalPrice(){\n\t\t\t\tvar totalPrice = 0;\n\t\t\t\tfor (var i in cart){\n\t\t\t\t\ttotalPrice += cart[i].price;\n\t\t\t\t}\n\t\t\t\treturn totalPrice;\n\t\t\t}", "function total() \n{\n // create var to store total\n var total = 0\n \n // check if there are items in the cart:\n if(cart.length > 0)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define the DateTimeFormat constructor internally so it cannot be tainted
function DateTimeFormatConstructor() { var locales = arguments[0]; var options = arguments[1]; if (!this || this === Intl) { return new Intl.DateTimeFormat(locales, options); } return InitializeDateTimeFormat(toObject(this), locales, options); }
[ "function restoreDateTimeFormat() {\n Object.defineProperty(Intl.DateTimeFormat.prototype, 'format',\n originalDateTimeFormatDescriptor);\n}", "function SimpleDateFormat(pattern) {\n this.pattern = pattern;\n this.regex = new RegExp(\"^\" + pattern.replace(\"yyyy\", \"\\\\d{4}\").replace(\"MM\", \"(0\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate a new array of students for each page and limit the number of students to 10.
function studentArray(list) { // Create a copy of the student list var studentsArray = list.slice(0); var pagesArray = []; // Generate an array of pages with each page containing an array of 10 students while (studentsArray.length) { pagesArray.push(studentsArray.splice(0, 10)); } return pagesArray; }
[ "function generateEmployeesByPage(employees, pageNo) {\n // I assumed showing 10 employees per page\n const perPage = 10;\n if (employees.length) {\n // Filter 10 employees by page number\n return employees.filter((employee, i) => {\n return i >= perPage*(pageNo-1) && i < perPage*p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function checkDoorOrShelf seleted. Options between the door or the bookshelf.
function checkDoorOrShelf(){ const option = user.value; user.value = ''; if(option === 'dörren' || option === 'DÖRREN' || option === 'Dörren'){ purpleRoom(); }else if(option === 'bokhyllan' || option === 'BOKHYLLAN' || option === 'Bo...
[ "function checkSelectedDeleteItems()\n\t{\n\t\tif (!isAnySelected()) {\n\t\t\talert('You have to select at least 1 item to delete !');\n\t\t\treturn false;\n\t\t}\n\t\telse\n\t\t\treturn confirm('Are you sure you want to delete these item ?');\n\t}", "function idbNoteDelete(whichTar) {\n\tif (!idbSupport) return;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
changes packages/fluentui packages to be public (those not in a denylist)
function setPrivateFlagOnFluentuiPackages(root, flag) { // We will flip all the @fluentui/* under packages/fluentui to public (barring things in a deny-list) const fuiPackageJsonFiles = glob.sync('packages/fluentui/*/package.json', { cwd: root }); for (let packageJsonFile of fuiPackageJsonFiles) { const fullP...
[ "async function changePackages() {\n const packages = await getPackages()\n\n await Promise.all(\n packages.map(async ({ pkg, path: pkgPath }) => {\n // you can transform the package.json contents here\n\n if (\n pkg.files &&\n pkg.files.includes('lib') &&\n pkg.name !== 'babel-p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=================== set bot response in the chats ===========================================
function setBotResponse(response) { //display bot response after 500 milliseconds setTimeout( function () { hideBotTyping(); if (response.length < 1) { //if there is no response from Rasa, send fallback message to the user var fallbackMsg = "Algo ha ocurrido, por favor intenta despu&eacute;s!!!"; var ...
[ "function chatbotResponse() {\n talking = true;\n botMessage = \"I'm confused\"; //the default message\n\n if (lastUserMessage === 'hey' || lastUserMessage =='hello'||lastUserMessage =='hii'||lastUserMessage =='hi'||lastUserMessage =='howdy'||lastUserMessage =='hey bro'||lastUserMessage =='pranam'||lastUserMessa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function verify if the hash of the api key passed by the user request matches a key stored inside keys.js file
function verifyKey(key) { const shasum = crypto.createHash('sha256'); shasum.update(key); const digest = shasum.digest('hex'); return allKeys.indexOf(digest); }
[ "function checkAPIKey() {\n if (mashapeAPIKey == null) {\n console.error('ERROR: API Key must be set!');\n }\n}", "apiRespond(challenge) {\n // this is actually identical to Alton Towers, but the challenge and API Key are swapped around\n return crypto.createHash('md5').update(challenge + this.construc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes Legend with some attributes and position the legend on top or bottom according to attribute sent by user
function _initializeLegend(){ // TODO Invoke d3.oracle.ary() gAry = d3.oracle.ary() .hideTitle( true ) .showValue( false ) .leftColor( true ) .numberOfColumns( 3 ) .accessors({ color: gLin...
[ "initLegend() {\n const self = this;\n\n // Array containing all legend lines (visible or not)\n self.d3.legendLines = [];\n self.curData.forEach(function (datum, index) {\n self.d3.legendLines.push(\n self.d3.o.legend.append(\"p\")\n .style(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a grammar file into the dist folder for each view. The grammar file defines the voice commands that will cause the associated Application Event to be fired when the voice command is recognized by the device. If there are no application events with an associated voice alias, the generation of the grammar files...
function compileVoiceRecGrammarFiles(saveConfig) { let viewsDistPath = path.join(saveConfig.destTargetRoot, 'app', 'components'); fs.ensureDirSync(viewsDistPath); const dataFile = fs.readJsonSync(path.join(saveConfig.srcSharedRoot, 'components', 'Data.json')); // find all twx-app-event elements that have a non...
[ "function compileVoiceRecGrammarFiles(saveConfig) {\n let viewsDistPath = path.join(saveConfig.destTargetRoot, 'app', 'components');\n fs.ensureDirSync(viewsDistPath);\n\n const dataFile = fs.readJsonSync(path.join(saveConfig.srcSharedRoot, 'components', 'Data.json'));\n // find all twx-app-event elements that ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mainly for debug, prints every item on banList
function getBanList() { banList.forEach( function( each ) { console.log(each + ";"); }); }
[ "syncBanList() {\n let banList = this.omegga.getBanList();\n if (!banList) return;\n banList = banList.banList;\n\n // upsert all bans\n for (const banned in banList) {\n const entry = {\n type: 'banHistory',\n banned,\n bannerId: banList[banned].bannerId,\n created: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether the `renderer` is a `ProceduralRenderer3`
function isProceduralRenderer(renderer) { return !!(renderer.listen); }
[ "function detect3dSupport(){\n var el = document.createElement('p'),\n has3d,\n transforms = {\n 'webkitTransform':'-webkit-transform',\n 'OTransform':'-o-transform',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The time (in hundredths of a second) since the network management portion of the system was last reinitialized.
async getSysUpTime() { return ((new Date()).getTime() - this.cache.startTime.getTime()) / 10; }
[ "ms () { return this.now() - this.startMS }", "function time_since_last_update()\r\n{\r\n var last_update = localStorage.getItem(\"last_update\"); // Last update time\r\n last_update = last_update ? last_update : 0; // 0 if not yet stored\r\n\r\n return current_time() - last_update;\r\n}", "function ti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clamps a number between zero and a maximum.
function clamp$1(value, max) { return Math.max(0, Math.min(max, value)); }
[ "function clamp(n, min, max) {\n return isNumeric(n) ? Math.min(Math.max(n, min), max) : min;\n}", "static Clamp(value, min, max) {\n const v = new Vector3();\n Vector3.ClampToRef(value, min, max, v);\n return v;\n }", "clamp(number, lower, upper) {\r\n /* Initial version\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate incoming base filter value and transform it, if needed
function baseFilterValidator(value) { var uuidRegexp = /^(stack-)?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, match = uuidRegexp.exec(value); if (match !== null) { return match[0]; } return null; }
[ "function createLessThanFilter(base) {\n // YOUR CODE BELOW HERE //\n if (typeof base === \"string\"){\n return function testString(input){\n if(base.localeCompare(input) === -1){return false;}\n else if (base.localeCompare(input)=== 1){return true;}\n };\n } else if (ty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: makeEditableCopy DESCRIPTION: Returns an editable copy of the ServerBehavior object. Setting parameters on the copy will preserve the original parameters and will allow you to update the existing SB on the page using ServerBehavior.queueDocEdits (see queueDocEdits). Note: Calling this function if this is alre...
function ServerBehavior_makeEditableCopy() { // Make a new ServerBehavior object for the copy. We must use the constructor // property to create this object since we may have been called from a // subclass. var sbCopy = new this.constructor(); for (var i in this) { if ( (typeof this[i] != "funct...
[ "function ServerBehavior_initServerBehavior(name, title, selectedNode)\n{\n // UD required properties\n this.title = (title) ? title : name; // Default to the SB name if no title.\n this.selectedNode = (selectedNode) ? selectedNode : null;\n this.incomplete = false;\n this.participants = new Array(); // partic...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the data value of grid cell
function getDataValOfCell(gO, r, c) { // get data value. // NOTE: If there is only rows present (only 1 dimension) // data is stored as *columns* in the C/JS style data // arrays. So, we use 'r' to index into 'columns' of // data arrays. // var val; if (gO...
[ "function cellValue(activeRange,row,col) {\n var row = row;\n var col = col;\n var range = activeRange;\n var cell = range.getCell(row,col).getValue();\n Logger.log(\"cellValue: \" + cell);\n return cell;\n}", "function getCell(row, col) {\n return document.getElementById(`cell-${row}-${col}`);\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shipping Fulfillment MAIN Build structure of an Shipping Fulfillment You can pass in the "availability", "packageWeightAndSize", and "product" as either separate params or within the main "item" param
function _buildShippingFulfillment( fulfill, lineItems ) { // Handoffs for extending if ( !fulfill.lineItems && lineItems ) { fulfill.lineItems = lineItems; } // Dependent if( ( fulfill.shippingCarrierCode && !fulfill.trackingNumber ) || ( !fulfill.shippingCarrierCode && ...
[ "function buildOrderItem(menu_id, size, cost, category, name, toppings) {\n var orderItem = {\n 'id': guid(),\n 'menu_id': menu_id,\n 'size': size,\n 'cost': cost,\n 'category': category,\n 'name': name,\n 'toppings': toppings\n }\n return orderItem;\n\n}", "async order_params_conditional(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays the expected final state of datagrid
function displayExpected(expected) { console.log("Expected final state of data grid:"); return prettyPrint(expected); }
[ "updateGridProperties() {\n this.internal.gridPropertiesGUI.modal('show');\n return false;\n }", "function onUpdatedGridData() {\n // Publish model changed\n Control.publishModelChanged(component.address, {values: component.model.values});\n // Store event\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Terminate parent process helper
_terminateProcess(code, signal) { if (signal !== undefined) { return process.kill(process.pid, signal); } if (code !== undefined) { return process.exit(code); } throw new Error('Unable to terminate parent process successfully'); }
[ "_terminate() {\n if (this._instance) {\n this._instance.close();\n this._instance = null;\n this._stopListeningForTermination();\n this._options.onStop(this);\n }\n\n process.exit();\n }", "kill() {\n children.forEach( (child) => {\n child.stdin.pause();\n child.kill();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handler for updating a dish's data
function update(req, res) { const dishId = req.params.dishId // create variable that finds the dish with a matching id const matchingDish = dishes.find((dish) => dish.id === dishId) const { data: { name, description, price, image_url } = {} } = req.body // use that variable to define the key-value p...
[ "function update(req, res) {\n const dish = res.locals.dish;\n const { data: { name, description, price, image_url } = {} } = req.body;\n\n if (dish.name !== name) {\n dish.name = name\n }\n if (dish.description !== description) {\n dish.description = description\n }\n if (dish.pric...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Append in the end a value on tag with id
function appendValue (id,value) { $(id).append(value); }
[ "function appendValue (id,value) {\n\t$(id).prepend(value);\n}", "function appendTextToNode(id, text) {\n\t\tlet elem = document.getElementById(id);\n\t\tlet textNode = document.createTextNode(text);\n\t\telem.appendChild(textNode);\n\t}", "function createH2Element(id, value, div) {\n let h2 = document.createE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
exports getAspectRatio(dimensions) Return the aspect ratio for the `dimensions` (width / height)
function getAspectRatio(dimensions) { return dimensions.height !== 0 ? dimensions.width / dimensions.height : 1; }
[ "static calculateScaledWidth(height, aspectRatio) {\n return Math.floor(height * aspectRatio);\n }", "function aspectScale() {\n $(\".media-container\").each(function () {\n var container = $(this);\n container.find(\"img, video\").each(function () {\n var dims = {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the active (highlighted) ExprObj indicated by sO.activeParentExpr
function getActiveExprObj(sO) { var act_expr = sO.activeParentExpr; // currently active expression if (!sO.isSpaceActive && act_expr) { // if space not active assert((sO.activeChildPos < act_expr.exprArr.length), "invalid child"); expr = act_expr.exprArr[sO.acti...
[ "parent() {\n var selection = this.selected.anchorNode;\n // prevent '#text' node as element\n if (selection && selection.nodeType == 3) selection = selection.parentElement;\n\n return selection ? selection : null;\n }", "get parentItem()\n\t{\n\t\t//dump(\"get parentItem: title:\"+...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Starts a new notebook and opens it
createNotebook( session, sessionLanguage, settings, fileMetadata = { id: null, itemName: this.getNotebookFileName(settings), } ) { const id = this.getTabIdForFileMetadata(fileMetadata); if (this.fileIsOpen(fileMetadata)) { log.debug('File is already open, focus tab'); ...
[ "function NewTab() {\n window.open(url, \"_blank\");\n }", "function load_ipython_extension () {\r\n events.on('create.Cell',create_cell);\r\n\r\n Jupyter.toolbar.add_buttons_group([\r\n {\r\n \r\n label : 'Input Excel',\r\n icon : 'fa-c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CONSTRUCTOR: CachedData stores cached data that can then be retrieved from it. also keeps track of the time it was stored and can be checked with the expired() method. param: data the data value of this CachedData
function CachedData( data ) { this.data = data; this.timeStored = Date.now(); }
[ "function DataContainer(data) {\n this._data = data;\n}", "constructor(_data, _blockhash, _prevhash){\n this.timestamp = Date.now()\n this.data = _data\n this.prevHash = _prevhash\n this.nonce = nonce ++\n this.blockHash = _blockhash\n }", "_setCacheExpiry() {\n const...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parentElement > the lessonTag to add Questions to, if one exists contents > contents of the textFrame look through the contents of the textFrame for Questions, create Question Tags, add the xml to a new textFrame in the xml document
function findQuestions(parentElement,contents) { var pattern = /^\s*(\d+)\./gm; var patternTwo = /^\s*(\d+)\./gm; do { var matchArray = pattern.exec(contents); var lastMatchedIndex = -1; if (matchArray != null && matchArray.length > 0) { // $.writeln("question lastIndex: "...
[ "function generateQuiz() {\n quizAnswers = [];\n quizContent = \"<div class=\\\"main2-banner-title\\\">Quiz \" + currentQuiz + \"</div>\";\n var xhttp = new XMLHttpRequest();\n xhttp.onreadystatechange = function () {\n if (this.readyState == 4 && this.status == 200) {\n myFunction(thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns questions that user has seen
getSeen() { let seen = []; for (let question of this.conv.user.storage.history.history) { if (question && question.seenCount > 0) { seen.push(question.questionNumber); } } return seen; }
[ "function getUsedAnswers() {\n var answers = angular.copy(pageData.answers);\n return answers.filter(function(entry) {\n return entry.answer !== '';\n });\n }", "getUnseen() {\n\t\tlet unseen = [];\n\t\tfor (let question of this.conv.user.storage.history.hist...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assert that a `Response` or `Request` object has a given contenttype.
function checkContentType (name) { var val = contentTypes[name]; Assertion.addProperty(name, function () { var contentType = getHeader(this._obj, 'content-type'); this.assert( contentType && contentType.indexOf(val) >= 0, 'expected the response type to be #{exp} but got #{act}', ...
[ "function isStringType(contentType){\n var stringTypes = ['text/plain', 'application/javascript', 'text/html', 'text/css', 'application/json',\n 'application/ld+json','application/manifest+json', 'image/svg+xml'];\n\n return stringTypes.includes(contentType);\n}", "function isReqXml( req ) {\n\tlet heade...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
6 toggle (show/hide) the emojis menu smile
function toggleEmojis() { /* $('#emojis').show(); // #show */ $('#emojis').toggle(); // #toggle }
[ "function changeEmojiBox()\n{\n console.log('in change Emojii arrived');\n $('#emojis-button').toggle(); \n}", "function virtual_keyboard_toggle_reset() {\r\n\t//even indices are the first state, odd indices are the second state\r\n\tif (mirror_text_type == \"mirrored_font_text\") { \r\n\t\tmirrored_font_t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
recursive animate function that animates frame (by requesting frame ) and calls update for each animation frrame.
function animate() { requestAnimationFrame(animate); // Insert animation frame to update here. }
[ "function Animate(id, frames, frame, noLoop) {\n //check if we are looping, or have not reached finish of animation\n if (!noLoop || (frame < frames.length - 1)) \n {\n //set next recursive run of animation\n window.requestAnimationFrame(function (timestamp) {\n Animate(id, frames,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Line 311 maps over the array of instances with this.addEmotionKeys, just below
addEmotionKeys(obj) { /* These arrays will be used for genre sorting below (genreStringComplex, line 54), to help determine which emotion(s) Google determined to be dominant. */ this.veryLikelyMood = []; this.likelyMood = []; this.possibleMood = []; this.leastUnlikelyMood = []; /* Then we ta...
[ "function Keymap(){\r\n this.map = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',\r\n 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'backspace', 'enter', 'shift', 'delete'];\r\n }", "constructor(pairs) {\n super(pairs, \"Reflector\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
propiedad calculada saldo, se accede como un atributo
get saldo() { return this.ingreso - this.deuda }
[ "function calculaValorDevido ( pesoDaRoupaSuja ){\r\n return (( pesoDaRoupaSuja * 3 ) + 10 )\r\n}", "ingresarDinero(ammount, cuenta) {\n if (cuenta.access === true && cuenta.id === this.id) {\n if (this.moneyPocket > ammount) {\n cuenta.balance += ammount;\n this.moneyPocket -= ammount;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resize the cache when the lengthCalculator changes.
set lengthCalculator (lC) { if (typeof lC !== 'function') lC = naiveLength if (lC !== this[LENGTH_CALCULATOR]) { this[LENGTH_CALCULATOR] = lC this[LENGTH] = 0 this[LRU_LIST].forEach(hit => { hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key) this[LENGTH] += hit.len...
[ "function recache() {\n // cache the viewport dimensions\n cache.viewport = {\n width: window.innerWidth,\n height: window.innerHeight };\n\n\n cache.document = {\n height: main.scrollHeight,\n width: main.scrollWidth };\n\n\n cache.node = tapeBody.getBoundingClientRect();\n\n scrollCheck();\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the names of the measures recorded by the data logger. In most case, the measure names match the hardware identifier of the sensor that produced the data.
function YDataLogger_get_measureNames() { return this._measureNames; }
[ "function YDataRun_get_measureNames()\n {\n return this._measureNames;\n }", "function measure_id () {\n if ( ! _current.measure ) {\n return 'false';\n }\n return _current.measure + '__' + ( _current.weights ? 'wt_true' : 'wt_false' );\n }", "function getColorMeasureName(chart) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
purp: initializes google maps object calls: getMyLocation
function init() { map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); getMyLocation(); }
[ "function init(){\n const address = localStorage.getItem('address')\n if(address){\n userLocation = JSON.parse(address)\n } else {\n geolocalizeUser() \n }\n loadMap(userLocation)\n}", "function init_map(){\r\n\t//Retrieves an associative array with the current form values\r\n\tvar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::S3::Bucket.ReplicationRuleAndOperator` resource
function cfnBucketReplicationRuleAndOperatorPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnBucket_ReplicationRuleAndOperatorPropertyValidator(properties).assertSuccess(); return { Prefix: cdk.stringToCloudFormation(properties.prefix), ...
[ "function CfnBucket_ReplicationRuleAndOperatorPropertyValidator(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 ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets chrome authentication flags in electron
function setChromeFlags() { log.send(logLevels.INFO, 'setting chrome flags!'); // Read the config parameters synchronously let config = readConfigFileSync(); // If we cannot find any config, just skip setting any flags if (config && config !== null && config.customFlags) { if (config.cus...
[ "function electronAuth(resolveAuth, rejectAuth) {\n electron.start();\n electron.on('auth-success', (authCookie) => {\n if (successReceived) {\n return;\n }\n successReceived = true;\n\n electron.stop();\n\n resolveAuth(`${authCookie.name}=${authCookie.value}`);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates all the contents for the food
function generateContents(foodName) { var food = foodDict[foodName]; var nameText = '<h1 class="text-center">' + foodName + '</h1>'; var foodURL = '<h5 class="text-center"><a target="_blank" href="' + food["url"] + '">' + food["url"] + '</a></h5>'; var imgText = '<img style="padding-top:30px;float:left" src="'...
[ "function cardContentIngrd() {\n for (let j = 0; j < data[i].recipe.ingredients.length; j++) {\n\n recipeArray = [data[i].recipe.url];\n var ingrdContent = $('<p>').text(data[i].recipe.ingredients[j].food);\n reveal.append(ingrdContent);\n }\n }", "function foodFactor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the next drum PID.
function getNextPID() { DropballEntityPIDInc = DropballEntityPIDInc + 1; return DropballEntityPIDInc; }
[ "#nextId() {\n const nextId = \"id_\" + this.#currentId;\n this.#currentId++;\n return nextId;\n }", "nextId(position){\n position+=1;\n if(this.machine.length >position){\n return this.machine[position].activity_id\n }\n return -1\n }", "function consoleCommon_getNextEmployeeNo()\n{...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by Java9ParserfloatingPointType.
enterFloatingPointType(ctx) { }
[ "enterNumericType(ctx) {\n\t}", "exitFloatingPointType(ctx) {\n\t}", "function safeParseFloat(value) {\n if (!value) {\n return 0.00;\n }\n if (ok(value, tyString)) {\n return parseFloat(value);\n }\n if (ok(value, tyNumber)) {\n return value;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fancybox modal popup init
function initLightbox() { jQuery('a.lightbox, a[rel*="lightbox"]').each(function(){ var link = jQuery(this); /* added (15th Oct 2014) */ // when clicking on a lightbox class element that opens a fancybox modal, determine if option modal is true or false // this prevents the user of closing th...
[ "function init_hot_popup() {\n $('.popap.p_type2').find('.close3').unbind('click');\n $('.popap.p_type2').find('.close3').click(function() {\n $(this).parent().removeClass('opened');\n $(this).parent().arcticmodal('close');\n });\n\n //$('.otel_btn').unbind('click')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
para saber el total de dias que tiene que escribir, si son 28, 29, 30 o 31
function diasTotal(meses) { if(meses === - 1) meses = 11; if(meses == 0 || meses == 2 || meses == 4 || meses == 6 || meses == 7 || meses == 9 || meses == 11) { return 31; }else if(meses == 3 || meses == 5 || meses == 8 || meses == 10) { return 30; }else{ return bisiesto() ? 29:28; } }
[ "function calcTotalDayAgain() {\n var eventCount = $this.find('.everyday .event-single').length;\n $this.find('.total-bar b').text(eventCount);\n $this.find('.events h3 span b').text($this.find('.events .event-single').length)\n }", "function Dias_Fevereiro(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers a global handler for an event in a target view.
addGlobalEventListener(target, eventName, handler) { const plugin = this._findPluginFor(eventName); return plugin.addGlobalEventListener(target, eventName, handler); }
[ "function setEventHandler(eventHandler) {\n if (g_eventHandler) g_eventHandler = eventHandler;\n}", "register(named_event, fn) {\n const group = named_event.network\n , name = named_event.name\n , event = named_event.event\n\n if (warn(!group || !name || !event, \"Registering a view r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the compatability distance between two genomes. Equation (1)
static compatabilityDistance(parentA, parentB) { let dif = Genome.difference(parentA, parentB); let E = dif.excess; // number of excess genes let D = dif.disjoint; // number of disjoint genes let W = Genome.averageWeightDifferences(parentA, parentB); let N = max(parentA.getConnectionGenes().length, ...
[ "function moduleDistance(a, b) {\n\tconsole.assert(a, 'missing first path');\n\tconsole.assert(b, 'missing second path');\n\n\tvar folderA = path.dirname(a);\n\tvar folderB = path.dirname(b);\n\tconsole.assert(folderA, 'could not get dirname from', a);\n\tconsole.assert(folderB, 'could not get dirname from', b);\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
include a socket if you want to leave it out, otherwise broadcast to every open socket
function broadcast(data, socketToOmit) { // All connected sockets can be found at wsServer.clients wsServer.clients.forEach((client) => { // Send to all clients in the open readyState, excluding the socketToOmit if provided if (client.readyState === WebSocket.OPEN && client !== socketToOmit) { client....
[ "[kMaybeBind]() {\n if (this.#state !== kSocketUnbound)\n return;\n this.#state = kSocketPending;\n this.#lookup(this.#address, QuicEndpoint.#afterLookup.bind(this));\n }", "[kMaybeBind](callback = () => {}) {\n if (this.#state === kSocketBound)\n return process.nextTick(callback);\n\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a keyFile, extract the key and client email if available
async getCredentials(keyFile) { const ext = path.extname(keyFile); switch (ext) { case '.json': { const key = await readFile(keyFile, 'utf8'); const body = JSON.parse(key); const privateKey = body.private_key; const clientEmail ...
[ "function findPrivateKey(filepath) {\n if (filepath) {\n return fs_1.default.readFileSync(filepath, \"utf8\");\n }\n if (process.env.PRIVATE_KEY) {\n let privateKey = process.env.PRIVATE_KEY;\n if (isBase64(privateKey)) {\n // Decode base64-encoded certificate\n p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fires whenever Apollo Server will parse a GraphQL request to create its associated document AST.
parsingDidStart(requestContext) { console.log('Parsing started!') }
[ "function createServer() {\n return new GraphQLServer({\n typeDefs: 'src/schema.graphql',\n resolvers: {\n Mutation: Mutations,\n Query: Queries,\n Person: PersonResolver,\n Planet: PlanetResolver,\n },\n resolverValidationOptions: {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
varijabla koja cuva dugme za restart funkcija koja se poziva kad igrac odluci restartovati igru
function restartuj() { nivo = -1; //nivo se vraca na pocetak $('.trenutno').removeClass('trenutno'); //elementu koji u datom momentu ima klasu 'trenutno' uklonjena je ta klasa $('.skala li:last').addClass('trenutno'); //klasa trenutno se postavlja na posljednji element u skali iznos = '0 KM'; //iznos se vraca ...
[ "function restart() {\n number = 60;\n start();\n }", "function restart() {\n force.start();\n t = 1;\n }", "function restartGame(){\r\n\r\n }", "function restart(x) {\n setTimeout('window.location.reload()', x);\n}", "function restartGame() {\n initAll();\n resetPlaye...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
======================== password sha256 to string ======
function passwordSha256ToString(paramPassword){ return crypto.createHash('sha256').update(paramPassword).digest('hex'); }
[ "function getHash(pw, salt) {\n return crypto.createHash('sha256').update(pw+salt).digest('hex');\n}", "function sha256_encode_bytes() {\n var j = 0;\n var output = new Array(32);\n for (var i = 0; i < 8; i++) {\n output[j++] = ((ihash[i] >>> 24) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the current UI mode
function updateMode(newMode) { mode = newMode; // sets global 'mode' variable // Toggle the correct mode button d3.select('div#modes') .selectAll('button') .attr('class', null); d3.select('div#modes') .selectAll('button#' + mode) .attr('class', 'hidden'); // Toggle the corr...
[ "function update_gui()\n{\n\tnotevaluesgui.message('set', selected.obj.notevalues.getvalueof());\n\tnotetypegui.message('set', selected.obj.notetype.getvalueof());\n\tRandom.message('set', selected.obj.random.getvalueof());\n\tGroove.message('set', (selected.obj.swing.getvalueof()*100)-50);\n\tChannel.message('set'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enable or disable expanded character set.
static setExpandedCharacters(node, expanded) { if (expanded) { node.classList.remove(CSS_PREFIX + "-narrow"); node.classList.add(CSS_PREFIX + "-expanded"); } else { node.classList.remove(CSS_PREFIX + "-expanded"); node.classList.add(CSS_PREFIX + "-...
[ "isExpandedCharacters() {\n return this.node.classList.contains(CSS_PREFIX + \"-expanded\");\n }", "enable() {\n this._enabled = true;\n this._model = new SelectionModel(this._bufferService);\n }", "startKeyboardControl() {\n this.state.keyboardEnabled = true;\n }", "SET_ACT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
input new question and disable submit button
function addQuestion () { $('h2').text(allQuestions[index].question); document.getElementById('submit-button').disabled = true; }
[ "function submitNewToggle() {\n if (DEBUG) console.log(\"RAM: submitNewToggle\");\n var buttonLabel = maindocument.getElementById('submit_new_toggle').innerHTML;\n var result_element = maindocument.getElementById('quiz_result')\n if (buttonLabel == 'Submit') {\n Blockly.Quizme.evaluateUserAnswer();\n } else...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves one shape from the models shapelist to current shape
function refactorShape(id){ sciMonk.viewStack.pop(); sciMonk.placementType = "shape"; sciMonk.currentShape.shape = sciMonk.currentModel.shapes[id].shape; sciMonk.currentShape.scaledShape = sciMonk.currentModel.shapes[id].shape; sciMonk.currentShape.originalShape = sciMonk.currentModel.shapes[id].shape; sciM...
[ "function updateShapePointer() {\n selectedShape.oldFillColor = selectedShape.fillColor;\n selectedShape.oldLineColor = selectedShape.lineColor;\n selectedShape.oldLineWidth = selectedShape.lineWidth;\n shapeArray[shapeArrayPointer++] = selectedShape;\n}", "function rotateShape() {\n removeSha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
same as above, but treat the left array as an unordered set e.g. ['b', 'a'], ['a', 'b', 'c'] is true, but ['c'], ['a', 'b', 'c'] is false
function oneSetIsSubArrayOfOther(left, right) { left = left.slice(); for (var i = 0, len = right.length; i < len; i++) { var field = right[i]; if (!left.length) { break; } var leftIdx = left.indexOf(field); if (leftIdx === -1) { return false; } else { left.splice(leftIdx, 1...
[ "function eqSets_QMRK_(s1, s2) {\n let ok_QMRK_ = true;\n if( (s1.size === s2.size) ) {\n if (true) {\n s1.forEach(function(v, k) {\n return ((!s2.has(v)) ?\n (ok_QMRK_ = false) :\n null);\n });\n }\n }\n return ok_QMRK_;\n}", "function mergeUnique(arr1, arr2) {\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks whether this grammar is in Chomsky Normal Form
isChomsky() { return this.classify().includes(CLASS_CHOMSKY); }
[ "function isCorrectSentence(str) {\n return str.match(/^[A-Z].*\\.$/)? true: false\n}", "containsDirectRules() {\n return this.productions.find(p => p.right.length == 1 && this.isNonterminal(p.right[0])) !== undefined;\n }", "function isValidSentence(chars) {\n if (chars.length > 30 || PRONOUNS.ha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function drawRightStars(num) that prints 75 characters total. Stars should build from right side. The last num characters should be asterisks; the other 75 should be spaces.
function drawRightStars(num){ var str = ''; var star = 75 - num; for(var i = 0; i < 76; i++){ if(i <= star){ str += ' '; }else{ str += "*"; } } console.log(str); }
[ "function drawDiamond(lineCount) {\n var middleP, fullStatsArr;\n var starsArr = Array(lineCount).fill(0).map((u, i) => { return i + 1; });\n if (lineCount % 2 == 0) {\n middleP = lineCount / 2;\n fullStatsArr = starsArr.slice(0, middleP).concat(starsArr.slice(0, middleP).reverse());\n } e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Opens the Manage Input Methods page.
onManageInputMethodsTap_() { settings.Router.getInstance().navigateTo( settings.routes.OS_LANGUAGES_INPUT_METHODS); }
[ "function open() {\n\t\t\t\tif ( !visible ) {\n\t\t\t\t\t// Call input method if cached value is stale\n\t\t\t\t\tif (\n\t\t\t\t\t\t$input.val() !== '' &&\n\t\t\t\t\t\t$input.val() !== cachedInput\n\t\t\t\t\t) {\n\t\t\t\t\t\tcachedInput = $input.val();\n\t\t\t\t\t\tonInput();\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Sho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The NL function uses the precomputed table from 1090WP914
function cprNLFunction (lat) { if (lat < 0) lat = -lat /* Table is simmetric about the equator. */ if (lat < 10.47047130) return 59 if (lat < 14.82817437) return 58 if (lat < 18.18626357) return 57 if (lat < 21.02939493) return 56 if (lat < 23.54504487) return 55 if (lat < 25.82924707) return 54 if (lat...
[ "function polyNtt(r) {\r\n return ntt(r);\r\n}", "function ntt(r) {\r\n var j = 0;\r\n var k = 1;\r\n var zeta;\r\n var t;\r\n // 128, 64, 32, 16, 8, 4, 2\r\n for (var l = 128; l >= 2; l >>= 1) {\r\n // 0,\r\n for (var start = 0; start < 256; start = j + l) {\r\n zeta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset function for information filter
function resetInformationFilter() { let input = document.getElementById("information-filter"); input.value = ""; filterInformations(); }
[ "function resetFilters() {\n Filters.distance = 10;\n Filters.minPrice = 0.0;\n Filters.maxPrice = 100.0;\n Filters.itemQuality = 0;\n Filters.gender = 'all';\n Filters.type = 'all';\n Filters.size = 'all';\n Filters.color = 'all';\n Filters.freeOnly = false;\n}", "function resetFilters...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
render card content based on role
function cardContent(employee){ let returner = "" let role = employee.getRole(); switch (role){ case "Manager": returner = `<p class="card-text">Office Number: ${employee.getOfficeNumber()} </p>`; break; case "Engineer": returner = `<p class="card-text"><...
[ "role() {\n return this.props.projectData.role \n .map(role => \n <span className=\"tag is-size-5 is-white has-text-weight-bold\">{role}</span>\n );\n }", "function managerCard(managerObj) {\n var name = managerObj.getName();\n var id = managerObj.getID();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! Add `eachAsync()` to aggregation cursors
function decorateCursor(cursor) { cursor.eachAsync = function(fn, opts, callback) { if (typeof opts === 'function') { callback = opts; opts = {}; } opts = opts || {}; return eachAsync(function(cb) { return cursor.next(cb); }, fn, opts, callback); }; }
[ "forEach(callback) {\n const mutations = this.val();\n return mutations.every(mutation => {\n const ref = mutation.target.reduce((ref, key) => ref.child(key), this.ref);\n const snap = new DataSnapshot(ref, mutation.val, false, mutation.prev);\n return callback(snap);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }