query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Custom type guard for OAuth2SecurityScheme. Returns true if node is instance of OAuth2SecurityScheme. Returns false otherwise. Also returns false for super interfaces of OAuth2SecurityScheme.
function isOAuth2SecurityScheme(node) { return node.kind() == "OAuth2SecurityScheme" && node.RAMLVersion() == "RAML10"; }
[ "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === SigningProfilePermission.__pulumiType;\n }", "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
queryParse takes a protobuf `model` to decode the raw bytes, and an optional keyMap function that creates an object with one element from the key. If no keyMap given, then key is returned unmodified under _key
async queryParse(data, path, model, keyMap) { keyMap = keyMap || defaultKeyMap; const parse = (val) => model.toObject(model.decode(val), {longs: Number}) let {height, results} = await this.query(data, path); let parsed = results.map((res) => { let k = keyMap(res.key); ...
[ "key(key: string): HrQuery {\n const path = {\n ...this.path,\n key,\n };\n\n return new HrQuery(this.st, path);\n }", "function resolveKey(opKey, keys) {\n\tif (objUtils.isEmpty(keys)) {\n\t\t// when keys map is null or empty, use the param key in rsql string\n\t\treturn opKey;\n\t}\n\telse {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves the list of raw asynchronous validators attached to a given control.
function getControlAsyncValidators(control) { return control._rawAsyncValidators; }
[ "async function getIndices(api, vals, validators) {\n let authIndices = [];\n for (const [index, validator] of validators.entries()){\n if (vals.includes(validator.toString())) {\n authIndices.push(index)\n console.log(index, validator.toString());\n }\n }\n return authIndices\n}", "registerAt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles shoot sounds for the rocket.
_shootSound() { if (this._targetPlanet.name === "blueBig") { Assets.sounds.shootLeft.stop(); Assets.sounds.shootRight.play(); } else if (this._targetPlanet.name === "redBig") { Assets.sounds.shootRight.stop(); Assets.sounds.shootLeft.play(); } }
[ "function bombShot() {\n playSound(\"audioBombShot\");\n }", "shoot() {\n var targetX = this.sceneManager.Zerlin.x;\n var targetY = this.sceneManager.Zerlin.boundingbox.y + this.sceneManager.Zerlin.boundingbox.height / 2;\n var randTargetX = targetX + (this.sceneManager.Zerlin.boundingbox.width...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles setting the network failover unicast address
function handleFailoverUnicast() { if (this.declaration.Common.FailoverUnicast) { let body = {}; const unicastAddresses = this.declaration.Common.FailoverUnicast.unicastAddress || []; if (unicastAddresses.length === 0 || unicastAddresses === 'none') { // There are no addresses t...
[ "[kUsePreferredAddress](address) {\n process.nextTick(\n emit.bind(this, 'usePreferredAddress', address));\n }", "function defangIPaddr(address, str=\"\") {\n if(!address.length) return str;\n str += address[0] === \".\" ? \"[.]\" : address[0];\n return defangIPaddr(address.slice(1), str);\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Swap colours and functionality for radio buttons (when adding a category)
function setEnabled(){ 'use strict'; if($('input:radio[name=cats]:checked').val()==="opt1"){ $("#category").removeAttr("disabled"); $("#oldlabel").css('color', '#000000'); $("#category1").attr("disabled","disabled"); $("#newlabel").css('color', '#808080'); }else{ $("#category1").removeAttr("disabled"); ...
[ "static set radioButton(value) {}", "function updateRadio() {\n if (component.property !== undefined) {\n var value = model.get(component.property);\n\n for (var i = 0, len = options.length; i < len; i++) {\n if (options[i].value === value) {\n $inputs[i].attr(\"checked\", true);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
closes and saves value of edited item then displays value in 'span'
function editItemOff(event) { var input = $(this); var span = input.siblings("span"); input.hide(); span.text(input.val()); console.log("Edited value" + input.val()); span.show(); }
[ "function editElement(event){\n\t\t\t\t\tclickedItem.innerHTML = textBox.value;\n\t\t\t\t}", "function handleEditItem() {\n $('.js-shopping-list').on('input', '.js-shopping-item', function(event) {\n let itemIndex = getItemIndexFromElement(event.currentTarget); //assigning the index of the the editted i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolves the raw $http promise.
function resolvePromise(response, status, headers, statusText) { // normalize internal statuses to 0 status = Math.max(status, 0); (isSuccess(status) ? deferred.resolve : deferred.reject)({ data: response, status: status, headers: headersGetter(headers), config: config, ...
[ "function NativeDeferred() {\n var _this = this;\n /**\n * Is fulfilled tracked status.\n */\n this.isFulfilled = false;\n /**\n * Is pending tracked status.\n */\n this.isPending = true;\n this.promise = new Promise(function (resolve, reject...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update x, y, and mouthGap
move() { this.change = this.mouthGap == 0 ? -this.change : this.change; this.mouthGap = (this.mouthGap + this.change) % (Math.PI / 4) + Math.PI / 64; this.x += this.horizontalVelocity; this.y += this.verticalVelocity; }
[ "update(x,y){\n\n if (x > 0 & x < width){\n if(y > 0 & y < height/2){\n //if(!this.nearWall()){\n this.pos.x= x;\n this.pos.y= y;\n for (var i = 0; i < this.rays.length;i++) {\n this.rays[i].update(this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a gToken if it doesn't already exist.
createGToken() { if (!this.gtoken) { this.gtoken = new gtoken_1.GoogleToken({ iss: this.email, sub: this.subject, scope: this.scopes || this.defaultScopes, keyFile: this.keyFile, key: this.key, additional...
[ "static create_token({ organizationId, createToken }) {\n return new Promise(\n async (resolve) => {\n try {\n resolve(Service.successResponse(''));\n } catch (e) {\n resolve(Service.rejectResponse(\n e.message || 'Invalid input',\n e.status || 405,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns an array with the uris of all similars of the object with the given uri
findSimilars(dymoUri) { //TODO DOESNT WORK WITH LISTS!!!!! return this.findAllObjects(dymoUri, uris.HAS_SIMILAR); }
[ "async function getRoverPhotoUrls(rover, photoDate, page) {\n console.log(`Querying NASA API for photo URLs for rover/date/page: ${rover.name} / ${photoDate} / ${page}`);\n\n const url = `${NASA_API_BASE_URL}/rovers/${rover.name.toLowerCase()}/photos?earth_date=${photoDate}&page=${page}&api_key=${API_KEY}`;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get value from the target input and update this state with an object, Object contains target value and random number for key
updateTask(e) { const taskValue = e.target.value; const keyForTask = Math.round(Math.random() * Math.floor(999999)); const updatedTask = {}; updatedTask[keyForTask] = taskValue; this.setState({ [e.target.name]: updatedTask }); }
[ "function calculateNewTargetPossition(originValue)\r\n {\r\n return originValue + (Math.random() < 0.5 ? -Math.random() : Math.random()) * settings.nodeMovementDistance;\r\n }", "handleHolderChange(event) {\n event.preventDefault();\n\n this.setState({\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TRAVERSES DOM TO GET PARENT FROM ORIG EL AND CLASS
getParent(el, cls) { while (el.parentNode) { el = el.parentNode; if (el.classList) { if (el.classList.contains(cls)) return el; } } return null; }
[ "function get_parent(el, class_name) {\n var elem = el.parentElement;\n while (!elem.classList.contains(class_name)) {\n if (elem.classList.contains(\"main\")) {\n return null;\n }\n elem = elem.parentElement;\n }\n return elem;\n}", "static getParentId(el){\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if a variable is null or undefined.
function isNullOrUndefined(variable) { return variable === null || variable === undefined; }
[ "static isDefined(input) {\n return typeof (input) !== 'undefined';\n }", "function isPresent(obj) {\r\n return obj !== undefined && obj !== null;\r\n}", "function isNullOrUndefinedOrEmptyString(variable){\r\n\tif(isNullOrUndefined(variable))return true;\r\n\tvar string = String(variable);\r\n\tret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1) The state variable 'show' is used to determine the visibility of the modal window. state.show is set to false by default. it can be changed by using one of the 2 functions, 'handleClose' or 'handleShow'. 2) The Click Me! element has an onClick attribute that will set state.show to true, triggering the Modal window t...
function App() { // state variable const [show, setShow] = useState(false); // Functions that can change the state variable const handleClose = () => setShow(false); const handleShow = () => setShow(true); return ( <div className="App"> {/* the Button that opens the modal window */} <Bu...
[ "function Modal (props){\n return(\n <div className=\"modal fade login in\" style={{display: 'block'}} id=\"loginModal\">\n <div className=\"modal-dialog login animated\">\n <div className=\"modal-content\">\n <button type=\"button\" className=\"close\" style={{fontSize: '35px', marginRight...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns entity from element entityID
function getEntityFromElementID(entityID) { entityID = entityID.substring(6, entityID.length) var entity; // Look through all the squares for(i = 0; i < squares.length; i++){ // If it has an entity and that entityElements id is equal to the id we're looking for if(squares[i] && squares[i].id == entityID...
[ "function getId(dbEntity){\n return dbEntity.entity.key.path[0].id ||\n dbEntity.entity.key.path[0].name;\n}", "function setId(entity){\n entity['id'] = entity[datastore.KEY].id;\n return entity;\n}", "function getID(elemento){ return document.getElementById(elemento); }", "getSelectionEntity(edito...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
evaluates the conditionals for each property to get the true/false output for each fieldResolver function(fieldName) => fieldValue conditionsObject object that describes the conditional logic
function evaluate(fieldResolver, conditionsObject) { validate(conditionsObject); return Object.keys(conditionsObject).reduce((copy, key) => { const conditionObject = conditionsObject[key]; //console.log(`-${key}:`); copy[key] = conditionEngine(fieldResolver, conditionObject); return copy; }, {}); ...
[ "conditionalFields(values) {\n return conditionalFields(\n this.schema,\n this.schema,\n values,\n this.externalConditionsResults\n );\n }", "validations(body,objectRules){\n console.log('body',body);\n let data = [];\n data['status'] = true;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disables all 'test' links, that point to the href '', by Ross Shannon
function disableTestLinks() { var pageLinks = document.getElementsByTagName('a'); for (var i=0; i<pageLinks.length; i++) { if (pageLinks[i].href.match(/[^#]#$/)) { addEvent(pageLinks[i], 'click', knackerEvent, false); } } }
[ "function remove(){\n body.querySelectorAll(\"a\").forEach(\n (aTag) => {\n if (aTag.getAttribute(\"href\").startsWith(shouldNotStartWith)){\n body.removeChild(aTag);\n }\n }\n )\n}", "function filterLinks() {\r\n\tvar links = div.getElementsByTagName('a');...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check or Uncheck All license CheckBox
function selectAllLicenseMenuCheckBox(){ if(document.getElementById('licenseMenuSelectAllId').checked==true){ document.getElementById('licenseMenuAddId').checked=true; document.getElementById('licenseMenuViewId').checked=true; document.getElementById('licenseMenuUpdateId').checked=true; document.getElementBy...
[ "function selectAllCoutryMenuCheckBox(){ \n\tif(document.getElementById('countryMenuSelectAllId').checked==true){\n\n\t\tdocument.getElementById('countryMenuAddId').checked=true;\n\t\tdocument.getElementById('countryMenuViewId').checked=true;\n\t\tdocument.getElementById('countryMenuUpdateId').checked=true;\n\t\tdo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show detailed information regarding one element
function showInfo(element) { elName.textContent = element.number + ' ' + element.name; elName.href = element.source; elSummary.textContent = element.summary; elDiscoveredBy.textContent = u(element.discovered_by); elNameGivenBy.textContent = u(element.named_by); elAtomicMass.textContent = u(element.atomic_m...
[ "function ShowInfo() {\n\t\tconsole.log('article: ', article);\n\t\t// console.log(articleText);\n\t}", "function displayDetailedInfo(info) {\n $('#info-title').html(info[0]);\n $('#infobox-detailed-content').html(info[1]);\n $('#infobox-detailed').show();\n}", "function showDetails(tile) {\n getTr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function determines whether or not a square is a magic square
function isSquareMagic(squareList) { // Performing math that determines the sum of array number combinations let firstRow = squareList[0] + squareList[1] + squareList[2]; let secondRow = squareList[3] + squareList[4] + squareList[5]; let thirdRow = squareList[6] + squareList[7] + squareList[8]; let firstColum...
[ "function checkForProtectedSquare(moveX, moveY) {\n for (const squareId in state.fruits) {\n const square = state.fruits[squareId]\n\n if ((square.x - 1 === moveX && square.y + 1 === moveY) || (square.x + 1 === moveX && square.y + 1 === moveY)) {\n return false\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets or sets the amount of right border to use for the cell content of this column.
get borderRightWidth() { return this.i.bf; }
[ "get activationBorderRightWidth() {\n return this.i.bb;\n }", "get actualBorderWidth() {\n return this.i.bu;\n }", "get right() { return this.pos.x + this.size.width;}", "get activationBorderLeftWidth() {\n return this.i.ba;\n }", "function fixRight() {\n var table = $...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Starts the round by setting the round picture and setting the round end time
start(){ this.picture = DRAWINGS[Math.floor(Math.random()*DRAWINGS.length)]; this.setRoundTime(ROUND_TIME_VAR) }
[ "function toggleRound() {\n\tif (roundUp) {\n\t\troundUp = false;\n\t} else {\n\t\troundUp = true;\n\t\tsecondsOn = false;\n\t}\n}", "function newRound() {\n\tif (player != \"\") {\n\t\tif (! roundCont) {\n\t\t\t\n\t\t\tvar geturl = \"/sanaruudukko/rest/sr/process?func=newround&player=\" + player + \"&passcode=\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::AppMesh::VirtualNode.Backend` resource
function cfnVirtualNodeBackendPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnVirtualNode_BackendPropertyValidator(properties).assertSuccess(); return { VirtualService: cfnVirtualNodeVirtualServiceBackendPropertyToCloudFormation(propertie...
[ "function cfnVirtualNodeVirtualServiceBackendPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualNode_VirtualServiceBackendPropertyValidator(properties).assertSuccess();\n return {\n ClientPolicy: cfnVirtualNodeClientPolicyProper...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private functions / Apply the Rotator's calculated angle to its Transform's rotation.
function applyRotator() { if (this._transform.useQuaternion) { this._transform.useQuaternion = false; } this._transform.rotation.copy(this.angle); this._transform.updateMatrix(); this._transform.updateMatrixWorld(true); }
[ "calculateRotation() {\n const extentFeature = this._extentFeature;\n const coords = extentFeature.getGeometry().getCoordinates()[0];\n const p1 = coords[0];\n const p2 = coords[3];\n const rotation = Math.atan2(p2[1] - p1[1], p2[0] - p1[0]) * 180 / Math.PI;\n\n return -rotation;\n }", "compute...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given already filtered encounter, look at its value and, possibly, add it to the options list
addOption(encounter) { var item = encounter[this.dataKey]; if (!this.options.includes(item)) this.options.push(item); }
[ "static filter(encounter, only_obj) {\n // Apply all filters and check if the encounter passes them\n var passed = filterRegistry.every(f => f.applyFilter(encounter));\n\n // Additional loop for encounters that passed the filters\n // They are used to update option lists, so that they co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fullSeconds takes a number and if less than 10 will add the preceeding zero
function fullSeconds (seconds) { if (seconds < 10) { return seconds = "0" + seconds; } else { return seconds; } }
[ "function fastupdateGodTimer(){\r\n\t\r\n\t//Check if round is ongoing\r\n\tif(godtimer_in_seconds > 0){\r\n\t\tgodtimer_in_seconds = godtimer_in_seconds - 0.2;\r\n\t\t////console.log(godtimer_in_seconds);\r\n\t\tgod_numhours = Math.floor(godtimer_in_seconds / 3600);\r\n\t\tgod_numminutes = Math.floor((godtimer_in_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handleTap / internal functions / This function is used to provide updates when the markers have changed. This involves informing other waking the parent view and having a redraw occur and additionally, firing the markers changed event
function markerUpdate() { // wake and invalidate the parent self.changed(); // trigger the markers changed event self.trigger('markerUpdate', markers); } // markerUpdate
[ "_renderCustomMarkers(markersList){\n // List of <MarkerView>s\n let markers = [];\n if(markersList == null){\n markersList = [];\n }\n\n for(var m = 0; m < markersList.length; m++){\n\n marker = markersList[m];\n // console.log(marker.category);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Launch Autolink config page
function launchAutolinkConfig(){ }
[ "function config() {\n\toutlet(0, 'host', addr_broadcast);\n\toutlet(0, 'port', iotport);\n\toutlet(0, '/config');\n}", "function showConfig() {\n\ttheApplet.showConfiguration();\n}", "function GADGET_GEN_Launch()\n{\t\n\tSystem.Gadget.Settings.write(\"URL\", URL.Site);\n\tShell.Run(URL.Site);\n}", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: Should be changed so option has label field instead of key but multicheckbox field type must be updated so default value still works
createMulticheckbox(origField) { const options = []; const defaultValue = []; origField.fieldGroup.forEach(field => { const label = field.templateOptions && field.templateOptions.label ? field.templateOptions.label : null; const option = { key: field.key, ...
[ "_getDefaultBooleanSelectBox(value) {\n const { valueRequired } = this.state;\n const { readOnly } = this.props;\n\n return (\n <Basic.BooleanSelectBox\n ref=\"value\"\n value={value}\n readOnly={readOnly}\n required={valueRequired}\n label={this.i18n('entity.Automat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the bytelength of the value encoded in the given buffer at the given index.
function encodedLength(encodedBuffer, index) { var result = 0; while (encodedBuffer[index + result] >= 0x80) { result++; } result++; // to account for the last byte if (index + result > encodedBuffer.length) {// FIXME(sven): seems to cause false positives // throw new Error("integer representation ...
[ "getAvailableLength (index) {\n let file\n for (const f of this._files) {\n if (f.index === index) {\n file = f\n break\n }\n }\n if (!file) {\n return ''\n }\n const bin = this.get(index, 0, file.length - 1)\n const onesLength = headOnes(bin) * this._pieceLength\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function to hide the invitations section
function hideInvitationsSection() { var element = document.getElementById('invitationsSection'); jQuery(document).ready(function() { jQuery(element).hide(300); }); }
[ "function toggleInvitationsSection() {\n var string = 'invitationsSection';\n var value = getStyle(string, 'display');\n hideNewListSection();\n hideInviteMemberSection();\n if(value == 'none') {\n\tshowInvitationsSection();\n } else {\n\thideInvitationsSection();\n }\n}", "function toggleInv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The randomPassword function will create a random password by looping a number of characters base on the length entered by the user. It will also check the length of the password if its between 8 to 128 characters long, if not it'll prompt an error
function randomPassword(passwordLength){ outputPassword='' for (i=0;i<passwordLength;i++) outputPassword+=randomCharacters.charAt(Math.floor(Math.random()*randomCharacters.length)) if (i < 8 || i > 128){ alert("*ERROR* Your password must be between 8 to 128 characters long"); } else { return outputPassword } }
[ "function randomPassword(len){\n\n}", "function generatePassword() {\n for (i = 0; i < passLengthInput - count; i++) {\n var randomCharacter = Math.floor(Math.random() * criteria.length);\n // Pushes randomCharacter to our password array each iteration.\n passwordString += criteria[randomCharact...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Animation of the Game instance that calls the animation of the Capy and Level instances, within this context.
animate() { this.level.animate(this.ctx); /* After animating all the instances, #gameOver will be called which will return the user to the starting frame of the game via #restart if needed. */ if (this.gameOver()) { // this.audioObj.dead.play(); Why d...
[ "function playAnimations() {\n animator.start();\n}", "animate () {\n if (this.multiStep) this.animateSteps()\n this.animateDraws()\n }", "drawCapy(ctx) {\n // ctx.fillStyle = \"yellow\";\n // ctx.fillRect(this.x, this.y, CONST.CAPY_WIDTH, CONST.CAPY_HEIGHT);\n\n // ctx.drawImage(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends the active state to ChromeVox.
sendActiveState_() { this.sendToChromeVox_( {type: 'activeState', active: this.engineID_.length > 0}); }
[ "function sendIdle() {\r\n sendStatus(status = \"idle\");\r\n}", "SET_ACTIVE_CHAR(state, char) {\n state.activeChar = char;\n }", "function sendWindowStateEvent(window, state) {\n window.webContents.send(windowStateChannelName, state)\n}", "function selectActiveForIndex(index){\n\tlet elm = docume...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generates 'n' amount of likes between ids, 0 and maxUsers
async function likeAlot(n, maxUsers){ let i = 0; while (i++ <= n){ let user = gen.getRandomInt(1, maxUsers); let profileId = gen.getRandomInt(1, maxUsers); if (user != profileId) await likeUser(user, profileId); } }
[ "async function scrapeUsers(n=10) {\n\tfor (var i=0;i<n;i++) {\n\t\tconst id = scrapeNextUser();\n\t\tif (await id) {\n\t\t\tawait parseUserByID(await id);\n\t\t} else {\n\t\t\treturn i+1;\n\t\t}\n\t\tawait sleep(delay);\n\t}\n\treturn n;\n}", "function getTopRecommendations(user, n) {\n const recommendations ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the character to a new locaton based on input. credit for this one to Dean Mathaias marks the old location as being a breadcrumb cell updates the score based on proximity to the shortest path toggles the breadcrumbs or the shortest path
function moveCharacter(keyCode, character) { console.log('keyCode: ', keyCode); if(!gameOver){ var r = character.location.location.row; var c = character.location.location.col; maze[r][c].breadCrumb = true; if (keyCode === 83 || keyCode === 40 || keyCode ===75) { if (character.location.dirOutOfCell.S) { ...
[ "update() {\n\t\tlet landmark = landmarks[party.landmarkIndex];\n\t\tif (landmarks[++party.landmarkIndex]) {\n\t\t\tparty.milesToNextMark = landmarks[party.landmarkIndex].distance;\n\t\t\tthis.nextLandMark = landmarks[party.landmarkIndex].name;\n\t\t\tthis.initialDistance = landmarks[party.landmarkIndex].distance;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Damage by monster, takes in whether physical (true/false)
function mDamage(physical) { var baseD = enemy.damage; if (physical) { return (baseD * enemy.phys); } else { return (baseD * enemy.mag); } }
[ "_hasDamage(type) {\n if (type === \"weapon\") {return true};\n // if (!this.data.data.causeDamage) {return false};\n if (type === \"power\" && this.data.data.causeDamage === true) {return true};\n return false;\n }", "function pDamage(member, physical) {\n if (member.active == 0) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
register binds a client to the websocket.
register(clientID, ws) { var c = this.client(clientID); c.register(ws); debug("Client %s registered in room %s", clientID, this.id); // Sends the queued messages from the other client of the room. if (this.clients.size > 1) { for (var oc of this.clients.values()) { if (oc.id !== clien...
[ "function listen( client )\n{\n\tclient.emit('welcome' , \"You have established an connection\");\n\tclient.on('login' , serverCommands.VerifyLogin );\n\t\n\tclient.on('re_establish' , \n\t\tfunction( message ) {\n\t\tclientSocketTable[ message.user_name ] = this;\n\t\tconsole.log(\"re-established \" + message.user...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The top level function. It's a wrapper around main. This async function catches and displays exceptions.
async function executeMain() { try { await main(); } catch (e) { let body = e.response && e.response.body; if (body) { // DocuSign API problem console.log (`\nAPI problem: Status code ${e.response.status}, message body: ${JSON.stringify(body, null, 4)}\n\n`); } else { // Not an A...
[ "function main() {\n console.log(`testing ngtools API...`);\n\n Promise.resolve()\n .then(() => codeGenTest())\n .then(() => i18nTest())\n .then(() => lazyRoutesTest())\n .then(() => {\n console.log('All done!');\n process.exit(0);\n })\n .catch((err) => {\n cons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NEW ITEM FUNCTIONS addItemShoppingList(newItem) pushes new item to STORE handleNewItems() adds item iput to STORE Pushes new item to STORE. Called by handleNewItems
function addItemShoppingList(newItem) { STORE.items.push({name: newItem, checked: false}); }
[ "addNewItem() {\n // we remove whitespace from both sides of the string saved in newItem\n this.newItem = this.newItem.trim();\n if (this.isInputValid(this.newItem)) {\n // if the user input is valid, we add the user input to the todo-list\n this.todos....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
validateForm() Validate the form (name, address, phone number, payment type, card name, card number, and expiration). Validate shipping section only if the checkbox was unchecked, or checkShipping was true.
function validateForm(event) { var success = true; if (!validateName('input[name="billFirstName"]', 'input[name="billLastName"]', "#error_bill_names_div")) { success = false; } if (!validateAddress('input[name="billAddress"]', 'input[name="billCity"]', 'input[name="billState"]', 'input[name="bi...
[ "function validateDefaultShippingCostForm(formID)\n{\n if(validateForm(formID, 'frmShippingCost','Shipping Cost','R'))\n { \n return true;\n } \n else \n {\n return false;\n }\n}", "function validateBillingAddress(formname)\n{\n\t\n if(validateForm(formname,'frmAddressLine1', '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates an expression that evaluates to the frag coord in pixels (samplers take normalized coordinates, so you might want [[nfcoord]] instead)
function pixel() { return new FragCoordExpr(); }
[ "constructor (gl, fs, ins, outs, dim) {\n this.ins = ins;\n this.outs = outs;\n this.dim = dim;\n if (dim.length == 1) {\n this.w = dim[0];\n this.h = 1;\n }\n if (dim.length == 2) {\n this.w = dim[0];\n this.h = dim[1];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds a Keyframe to active Element
addKeyframe() { if(this.project._activeElement !== null){ this.project._activeElement.addKeyframe(new this.Keyframe(this.project._pot)); } }
[ "function inputElem_add_byKey(e) {\n\t\n}", "function frameIn(frame){\n // curatam clasa active din meniu daca exista\n cleanActiveFrame();\n\n // element activ in meniu\n var element = document.getElementById(frame);\n element.classList.add(\"active\");\n}", "addKeyframeTrack(name){\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prepRoute() Set up the transitioning of the route
function prepRoute() { transitionRoute(this.path); }
[ "function reCalculateRoute(){\n\t\tcalculateRoute(lastRouteURL);\n\t}", "_initialize() {\n if ( this._initialized ) {\n return;\n }\n\n this._log(2, `Initializing Routes...`);\n\n //Add routing information to crossroads\n // todo: handle internal only routes\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates and fills the position buffer from the position array
createPositionBuffer () { if (this.positionArray === null) { console.log("positionArray uninitialized"); } const gl = this.gl; // allocate space for a buffer this.positionBuffer = gl.createBuffer(); // bind current buffer to perform operations on it gl.bindBuffer(gl.ARRAY_BUFFER, this.positionBuf...
[ "function createPosition(){\n position = [];\n // push the x and y position values to an array of position objects\n for (var i = 0; i < rangee; i++){\n for (var j = 0; j < column; j++){\n position.push(new Position(pX[j],pY[i]));\n }\n }\n}", "function create_arr(mem, pos, size) {\n\t\t\treserve_m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for when no PC card matches the currentCard, the PC draws a new card
function pcDraw() { createRandomValues(); let card = document.createElement("span"); pcHand.appendChild(card); card.textContent = randomNumberValue; card.className = randomColorValue; card.style.color = "lightslategrey"; card.style.backgroundColor = "lightslategre...
[ "function drawCard() {\n render();\n checkWin();\n if(warActive === false) {\n currCard.player = pile.player[0];\n currCard.comp = pile.comp[0];\n // display computers card\n crdDisplay.comp.up.src = \"./images/cards/\" + currCard.comp + \".svg\";\n crdDisplay.comp.up.sty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates run rate and adjusts campaign bids as needed.
function _adjust_campaign_budget(my_tot_cost) { var today = new Date(); // Accounting for December var eom = (today.getMonth() == 11) ? new Date(today.getFullYear()+1,0,1) : new Date(today.getFullYear(),today.getMonth()+1,1); var days_left = Math.round((eom-today)/1000/60...
[ "updateRunningBalances() {\n\t\t// Do nothing for investment accounts\n\t\tif (\"investment\" === this.context.account_type) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.transactions.reduce((openingBalance, transaction) => {\n\t\t\ttransaction.balance = openingBalance + (transaction.amount * (\"inflow\" === transaction.dire...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes previously registered event listeners from the trigger element.
_removeTriggerEvents() { if (this._triggerElement) { pointerDownEvents.forEach((type) => { this._triggerElement.removeEventListener(type, this, passiveEventOptions); }); if (this._pointerUpEventsRegistered) { pointerUpEvents.forEach((type) => {...
[ "function removeListeners() {\n removeEventListener('pointerup', onPointerUp, listenerOpts);\n removeEventListener('pointercancel', onPointerCancel, listenerOpts);\n }", "_removeMouseDownListeners() {\n if (this._screenElement.ownerDocument) {\n this.lastEvent = null;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tries to send all pending requests and delete the ones that success
_sendAllPendingRequests() { return this._dbPromise.then(db => // Get all pending requests db .transaction(PendingRequestsDatabaseSingleton.IDB_OBJECT_STORE_NAME) .objectStore(PendingRequestsDatabaseSingleton.IDB_OBJECT_STORE_NAME) .getAll() // Send all requests and delete...
[ "function ignorePendingRequests() {\n hasPendingRequest = false;\n currentPendingQuery = null;\n loadError = null;\n }", "function cleanupPending() {\n // Function to periodically check the pending queue for timeouts.\n // If message has been pending too long, requeue for work\n debug(\"Queue s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to populate the div with id biography when using the search of a super hero
function getBiographySearch(data) { biography.innerHTML = ""; let properties = ["Full Name:", "Alter egos:", "Aliases:", "Place of Birth:", "First Appearance:", "Publisher:", "Alignment:"]; let i = 0; for (let prop in data.results[0].biography) { if (data.results[0].biography[prop] === "null" ||...
[ "function searchtoresults()\n{\n\tshowstuff('results');\n\thidestuff('interests');\t\n}", "function displaySpeciesData(data) {\r\n cartegoriesCounter = 0;\r\n var listBox = document.getElementById(\"searchResults\");\r\n listBox.innerHTML = \"\";\r\n listBox.innerHTML = \"<p>Name: \" +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to help identify if an event happened near the left edge of an element.
function isNearLeftEdge(element, event) { let ret = false; let offset = getElementOffset(element); let rightEdge = element.getBoundingClientRect().right - offset.left; let mouseClickPosition = event.pageX - offset.left; let buttonWidth = element.getBoundingClientRect().width * .30; if (buttonWidth > 50){ butt...
[ "function calculateOffsetLeft(r){\n return absolute_offset(r,\"offsetLeft\")\n}", "function checkHitLeftRight(ball) {\n\t\tif (ball.offsetLeft <= 0 || ball.offsetLeft >= 975) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "getElementX(el) {\n var parent = this.myRef.current;\n var center ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copyright (c) 20102011 Turbulenz Limited renderingCommonGetTechniqueIndexFn
function renderingCommonGetTechniqueIndexFn(techniqueName) { var dataStore = renderingCommonGetTechniqueIndexFn; var techniqueIndex = dataStore.techniquesIndexMap[techniqueName]; if (techniqueIndex === undefined) { techniqueIndex = dataStore.numTechniques; dataStore.techniquesIndexMap[te...
[ "GetShaderEngine () {\n return this.ShaderEngine\n }", "function WebGlRenderUtility() {\n}", "function getSmoothnessIndex(surfaceIndex) {\n if (surfaceIndex == 0 || surfaceIndex == 1) {\n return 1;\n } else if (surfaceIndex == 2) {\n return 2;\n } else if (surfaceI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets count of all articles where importance = 1. For the home page/main page
getCountArticlesImportance(callback: mixed){ super.query("select COUNT(*) as x from NewsArticle where importance = 1", [], callback); }
[ "function StoriesGermany(ArticleCollection) {\n\n\tfor (var counter = 0; counter < ArticleCollection.length; counter++) {\n\t\t/*Above, is everything I want to actually happen to the list*/\n\t\t/*Here, I'm creating a variable for the result*/\n\t\tvar currentArticle = ArticleCollection[counter];\n\t\t/*If the loop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When we click on "New Project", create a new project object and allow us to type in it.
function create_new_project() { var project_node = generate_empty_project(); // And finally append the project to the actual page var project_node_jquery = $(project_node); project_node_jquery.insertBefore( $("div#new-project") ); // Give focus to the Heading input project_node_jquery.find("div.heading > input....
[ "function createProject() {\n const projectName = helpers.toTitleCase(app.getArgument('projectName'));\n app.ask(`Creating Project - ${projectName} now, please confirm`);\n }", "function createProject(name){\n let thisproj = document.createElement('BUTTON');\n Object.assign(thisproj,{\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
extract data from output outlet7 return JSON with object
function extractPresetOutput(){ outlet(7, JSON.stringify(output)); }
[ "function createOutputJsonInstance()\n{\n\tvar output = \n\t\t{\n\t\t\t\"status\": null,\n\t\t\t\"message\": null,\n\t\t\t\"data\": null\n\t\n\t\t}\n\n\treturn output;\n\n}", "function GetTelemetryObj() {\n var myJSON = { \n \"utc\": 0,\n \"soc\": 0,\n \"soh\": 0,\n \"speed\": 0,\n \"c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compute the coordinates of the errorbar objects
function errorCoords(d, xa, ya) { var out = { x: xa.c2p(d.x), y: ya.c2p(d.y) }; // calculate the error bar size and hat and shoe locations if(d.yh !== undefined) { out.yh = ya.c2p(d.yh); out.ys = ya.c2p(d.ys); // if the shoes go off-scale (ie log scale,...
[ "function updateErrorBounds() {\n let yError = yError3rdOrder(xCoords[sliderValue], xError);\n\n upperBound = {\n x: [0,10],\n y: [yCoords[sliderValue]+yError, yCoords[sliderValue]+yError],\n mode: 'lines',\n line: {\n dash: 'dashdot',\n width: 2,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that takes in a object that has keyvalue pairs of placeIds to their extraDetailsPlace object sets placesMapping[pid] = extraDetailsPlace object
function getExtraDetails(placesMapping, place_id, service) { service.getDetails(obj, function(place, status) { }); }
[ "function createMap(id, object) {\n\t\t\tobj_to_id[0].unshift(object);\n\t\t\tobj_to_id[1].unshift(id);\n\t\t}", "updateItineraryAndMapByArray(places){\n let newMarkerPositions = [];\n this.setState({placesForItinerary: places});\n places.map((place) => newMarkerPositions.push(L.latLng(parseF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Obtiene la hora del spinner de las horas
function getHora(){ hora = spin.getValue(); return hora; }
[ "function actualizarHora(){\n\t\n\tvar dia = new Date();\n\tvar hora = (\"0\" + dia.getHours()).slice(-2);\n\tvar minutos = (\"0\" + dia.getMinutes()).slice(-2);\t\n\n\tdocument.querySelector('#hora_actualiza').innerHTML = hora + \":\" + minutos;\n\n}", "calcTime() {\n const numIng = this.ingredients.length;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get site root URL
function getSiteRoot() { var url = window.location.protocol + '//' + window.location.host, path = '/Site'; if (window.location.pathname.indexOf(path) == 0) { url += path } return url + '/'; }
[ "function getRootUrl(url) {\n var domain = url.replace('http://','').replace('https://','').replace('www.', '').split(/[/?#]/)[0];\n return domain;\n}", "function getRootPathname() {\n let pathname,\n pathRoot,\n indEnd\n\n pathname = window.location.pathname;\n\n if (pathna...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
purchaseProduct > purchasing the product
function purchaseProduct(product) { showInfo('Product purchased.') requester.get('user', sessionStorage.getItem('userId'), 'Kinvey') .then((userInfo) => { userInfo.cart = userInfo.cart || {}; if (userInfo.cart.hasOwnProperty(product._id)) { ...
[ "function PurchaseGiftCertificate() {\n var CartController = require('./Cart');\n var GetBasketResult = CartController.GetBasket();\n\n\n\n var EnsureShipmentResult;\n var ProductList;\n var ProductListController;\n if (!GetBasketResult.error) {\n var Basket = GetBasketResult.Basket;\n\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return `true` if is polling. Otherwise, `false`.
isPolling() { return !!this._lastRequest; }
[ "async isBusy() {\n return new Promise((resolve, reject) => {\n this.rpc.stdin.write('busy' + os.EOL);\n this.rpc.stdout.once('data', (data) => {\n data = data.toString().trim();\n if ((typeof data == 'boolean' && data) || data == \"true\") {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether we should insert a timeout between processing messageA and messageB. Artificially queueing protocol messages guarantees that any microtasks for previous message finish before next message is processed. This is essential ordering when using promises anywhere along the call path. For example, take the fol...
needsTaskBoundaryBetween(messageA, messageB) { return messageA.type !== 'event' || messageB.type !== 'event'; }
[ "async processQueue() {\n let message;\n while (this.queue.length) {\n if (!message || this.needsTaskBoundaryBetween(this.queue[0], message)) {\n await async_1.timeout(0);\n }\n message = this.queue.shift();\n if (!...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds keyboard shortcut ctrlr (only appropriate on macOS)
function addShortcut() { const keyEventHandler = function(keyEvent) { if (keyEvent.ctrlKey && !keyEvent.shiftKey && !keyEvent.altKey && !keyEvent.metaKey && keyEvent.code === "KeyR") { keyEvent.stopPropagation(); keyEvent.preventDefault(); reloadScripts(); } }; document.a...
[ "addShortcut(keys, callback) {\n Mousetrap.bind(keys, callback)\n }", "function addCmd(key, ctrlEqualsCmd) {\n if (!ctrlEqualsCmd) return key;\n var keyAr = _underscore2.default.isArray(key) ? key : [key];\n var newAr = keyAr.reduce(function (c, k) {\n var n = k.replace('ctrl+', 'meta+');\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end of function CreateObjects / Function: HookDVDOptEv / Description: Hooks events at the time when the object is being created
function HookDVDOptEv(){ try { MFBar.HookScriptlet("DVDOpt", "OnOpen()", "OnOptOpen()"); MFBar.HookScriptlet("DVDOpt", "OnClose()", "OnOptClose()"); MFBar.HookScriptlet("DVDOpt", "OnHelp(strObjectID)", "OnOptHelp(strObjectID)"); } catch(e) { e.description = L_ERRORUnexpectedError_TEXT; HandleError(e)...
[ "function HookDVDEv(){\n\ntry {\n\tMFBar.HookScriptlet(\"DVD\", \"ReadyStateChange(state)\", \"OnReadyStateChange(state)\");\n\tMFBar.HookScriptlet(\"DVD\", \"DVDNotify(event, param1, param2)\", \"ProcessDVDEvent(event, param1, param2)\");\n\tMFBar.HookScriptlet(\"DVD\", \"PlayForwards(bEnabled)\", \"ProcessPFEvent...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check the action status before a change is supposed to happen to the action
checkActionStatus() { if (this.state >= SolairesAction.STATUS.DONE) return; if (this.state == SolairesAction.STATUS.ACK) SolairesAction.updateGMAck(false); }
[ "function hasActionChanged() {\r\n\r\n return( action !== previousAction );\r\n\r\n }", "@action\n statusChangeAction(field, value) {\n if (value == 'approved') {\n this.editEntry.set('create_entry', 1);\n }\n }", "isActionAborted() {}", "static find_status(action) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns POTENTIAL_MATCHES onecharacter strings, mostly consisting of the input characters
function regexOneCharStringsWith(frequentChars) { var matches = []; for (var i = 0; i < POTENTIAL_MATCHES; ++i) { matches.push(rnd(8) ? Random.index(frequentChars) : String.fromCharCode(regexCharCode())); } return matches; }
[ "function matchSingleCharactersNotSpecified(string, possibilities) {\n // This will find all the characters not in possibilities in string.\n let regex = new RegExp(\"[^\" + possibilities + \"]\", \"ig\");\n console.log(regex);\n return string.match(regex);\n}", "function solve(s) {\n\tlet result = \"\";\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert the html data into the element that has the specified id.
function htmlInsert(id, htmlData) { document.getElementById(id).innerHTML = htmlData; }
[ "append(id) {\n\t\t\tthis.ids.push(id);\n\t\t\tthis._loadPage();\n\t\t}", "function updateAnnouncements (data, id){\n \n const newAnnouncement =` \n <div class=\"card-panel announcement white row\" data-id=${id}>\n <div class=\"announcement-details\">\n <div class=\"announcement-title\">${data.title}</...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Logic to handle click events In this case: Propogates up the chain to the container component by calling the onClickSubItem method of the PROP
handleClick(id) { this.props.onClickSubItem(id); }
[ "function itemClick(event) {\n\n\n $(this).find(\"input[type=checkbox]\").click();\n\n updateCompletedBtn();\n updateCheckCount();\n\n // Don't bubble up the event to the enclosing <li> element ?? Ask Willis\n event.stopPropagation();\n}", "function handleClickOnContentItemWithChildren(contentItem)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update Sequence in financial Year tbl when its fresh sale insert
function updateCRSequenceGenerator(center_id) { let qryUpdateSqnc = ''; qryUpdateSqnc = ` update financialyear set cr_note_seq = cr_note_seq + 1 where center_id = '${center_id}' and CURDATE() between str_to_date(startdate, '%d-%m-%Y') and str_to_date(enddate, '%d-%m-%Y') `; return new Promise(function (re...
[ "function setNextYear() {\n\n var year = tDoc.calControl.year.value;\n if (isFourDigitYear(year)) {\n year++;\n calDate.setFullYear(year);\n tDoc.calControl.year.value = year;\n\n\t// GENERATE THE CALENDAR SRC\n\tcalDocBottom = buildBottomCalFrame();\n\n // DISPLAY THE NEW CALENDAR\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a command by name or alias
function getCommand(command) { if (client.commands.has(command)) { return client.commands.get(command); } else if (client.aliases.has(command)) { return client.commands.get(client.aliases.get(command)); } }
[ "function makeCommand(cmdName) {\n return {\n name: cmdName,\n arguments: [\n { id: 'search',\n role: 'object',\n nountype: noun_arb_text,\n label: 'search text'\n },\n ],\n previewUrl: 'http://localhost/webiquity/commands/testCommand.html?cmd=' + cmdName + '&preview={{se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks if a given block is the same as this one. this function not only checks the block hash, but also checks that the two blocks are exactly same in its contents as well
is_equal_to(block) { if (!this.header.is_equal_to(block.header)) { return false; } if (!this.merkle_tree.is_equal_to(block.merkle_tree)) { return false; } return true }
[ "validateBlockSequence(firstBlockHeight) {\n var promises = [];\n promises.push(this.getBlock(firstBlockHeight));\n promises.push(this.getBlock(firstBlockHeight+1));\n return Promise.all(promises).then(function(results) {\n let blockHash = results[0].hash;\n let previousHash = results[1].pre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggle visibility of the handle DOM based on whether our current frame is confined within the slider range (feature not available natively within noUiSlider).
updateHandleVisibility() { if (!this.slider.target) { return; } const handle = this.slider.target.getElementsByClassName('noUi-origin'); if (this.state.current >= this.state.start && this.state.current <= this.state.end) { handle[0].classList.remove('is-off-time...
[ "function hideSlider() {\r\n\tvar mydiv = document.getElementById('day-panel');\r\n\tmydiv.style.display = (mydiv.style.display = 'none');\r\n}", "function exitSlider () {\nmainWrapper.style.display = 'none';\n}", "function checkSlide(e) {\n images.forEach(img => {\n // console.group('image ',img.id)\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
func to get substatus
function getSubstatus(status, data) { if (utils.isEmptyVal(status)) { self.substatuses = []; return; } if (self.filter.statuses.length > 0) { var flag = true; _.forEach(self.filter.statuses, function (item) { ...
[ "static get STATUS_RUNNING () {\n return 0;\n }", "function ADLObjStatus() \r\n{\r\n}", "getGeneralSystemStatus() {\n const journey = this.props.spec.journey;\n if (journey.steps.SUBPROCESS_APP_LOAD_OR_EXEC\n && journey.steps.SUBPROCESS_APP_LOAD_OR_EXEC.state === 'STEP_ERRORED')\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : loadImgInit AUTHOR : Clarice Salanda DATE : March 15, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : initializes data in table PARAMETERS : RETURN :
function loadImgInit(){ var imgStat=''; var loadImgStat=''; if(globalInfoType == "JSON"){ var devices = getDevicesNodeJSON(); }else{ var devices =devicesArr; } for(var i = 0; i < devices.length; i++){ if(HostName && HostName != "" && devices[i].HostName != HostName){continue;} imgStat+=...
[ "function loadImgData(data){\n\tvar mydata = data;\n\tif(globalInfoType == \"XML\"){\n\t\tvar parser = new DOMParser();\n\t\tvar xmlDoc = parser.parseFromString( mydata , \"text/xml\" );\n\t\tvar row = xmlDoc.getElementsByTagName('MAINCONFIG');\n\t\tvar uptable = xmlDoc.getElementsByTagName('DEVICE');\n\t\tvar lowt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve the set derivation path
getPath() { return this._baseDerivationPath; }
[ "setPath(basDerivationPath) {\n this._baseDerivationPath = basDerivationPath;\n }", "getPath() {\n return this.$data[ENTITY_PATH];\n }", "function getLearningPaths() {\n datacontext.getLearningPaths()\n .then(function (data) {\n if (data) {\n vm.learningPaths ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter menu data according to permission configuration
function filterMenu(menuData, roles) { menuData.forEach(menu => { if (menu.meta && menu.meta.invisible === undefined) { if (!hasAuthority(menu, roles)) { menu.meta.invisible = true } if (menu.children && menu.children.length> 0) { filterMenu(menu.children, roles) } } ...
[ "function hideSectionsBasedOnPermission(){\n currentUserPermission = currentLoggedInUser.privilege;\n $('.permission-link').hide(); //Hide all navigation links by default\n $('.permission-link').each(function(){ //Show proper sections based on the permission\n if($(this).hasClass('perm-'+currentUser...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle user input on stdin. Inputs are prefixed with identifiers corresponding to child processes and are passed through to the relevant process.
function pipeStdIn() { process.stdin.resume(); process.stdin.on('data', function ( chunk ) { var s = chunk.toString('utf8'); // Find the relevant child process by its stdin prefix. var cp = childProcesses.filter(function ( cp ) { var prefix = new RegExp('^' + cp.stdinPrefix + '\\.'); retu...
[ "handleInput() {\n this.calculateInputOutput(true);\n }", "function processInput() {\n //\n // Double buffering on the queue so we don't asynchronously receive inputs\n // while processing.\n let processMe = inputQueue;\n inputQueue = Queue.create();\n\n while (!processMe.empty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add elements to observer to watch.
_observeEntries() { this.items.forEach((item) => { item.elementsList.forEach((element) => { this.observer.observe(element); }); }); }
[ "addObserver(observer){\n \n this.observers.push(observer)\n }", "function attachTracklistModificationListeners(onTracklistModifiedByExternalSource) {\n let onEvent = (event) => {\n if(!currentlyModifyingAnyTracklist)\n onTracklistModifiedByExternalSource()\n }\n\n for(trackList of getTrac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
represent an instance of mission card.
function MissionCard(missionType, owner) { // id of the type of this instance of mission card. this.missionType = missionType; /** * the player object that owns this card. * null if the card is not owned. */ this.owner = owner; this.isComplete = function() { this.missionType.isComplete(this.owner); }; }
[ "function getCard() {\n\t\n\t// STUB: this code shows a minmal model for a Card object. You job is to build a better one!\n\tvar card = {\n\t\tisFaceUp : true,\n\t\ttoString : function() { \n\t\t\t\t\t\treturn \"2d\"; \n\t\t\t\t\t},\n\t};\n\t\n\treturn card;\t\n}", "function createCard(cardnum, CVC, exp, type)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The ASCII string value is the sum of the ASCII values of every character in the string. (You may use String.prototype.charCodeAt() to determine the ASCII value of a character.) Understand ? create a function with a string argument ? return the value of the string argument( the sum of the values of each char in the stri...
function asciiValue(string) { let totalValue = 0; let stringArray = string.split(''); for( let i = 0; i < stringArray.length; i += 1) { totalValue += stringArray[i].charCodeAt(); } return totalValue; }
[ "function uniTotal(string) {\n if (string.length == 0){\n return 0;\n } else {\n let num = 0;\n \n for (let i = 0; i < string.length; i++) {\n num += string.charCodeAt(i);\n }\n return num;\n }\n}", "function charSum (str) {\n\t// First convert string to an array of digits via regEx.\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change this matrix row with another row of same matrix.
change(row) { if (this._matrix !== row.matrix) { throw new Error("Row change operation is not compatable with rows of two different matrices."); } else { for (let j = 0; j < this._matrix.width(); j++) { this._matrix.put(this._index, j, this._matrix.get(row...
[ "interchange(row) {\n if (this._matrix !== row.matrix) {\n throw new Error(\"Row interchange operation is not compatable with rows of two different matrices.\");\n }\n else {\n for (let j = 0; j < this._matrix.width(); j++) {\n let temp = this._matrix.get(ro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
:: Persistent data structure representing an ordered mapping from strings to values, with some convenient update methods.
function OrderedMap(content) { this.content = content; }
[ "function Map() {\n this.keys = OrderedSet.create();\n this.values = {};\n}", "function generateOrdering(sequence)\r\n{\r\n var keySequence = generateRandomSequence(sequence.length);\r\n var elementOrder = new IntHashMap();\r\n elementOrder.expectSize(sequence.length);\r\n \r\n for(var i = 0, l =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merge public shares to produce a common public key.
function mergePublicShares(shares) { const sum = shares.slice(1).reduce((sum, share) => { return sum.add(bls.PointG1.fromCompressedHex(bigIntToBuffer(share))) }, bls.PointG1.fromCompressedHex(bigIntToBuffer(shares[0]))) return bufferToBigInt(sum.toCompressedHex()) }
[ "function mergeSignatures(shares) {\n const ids = Object.keys(shares)\n const coeffs = lagrangeCoefficients(ids.map(id => BigInt(id)))\n let sign = bls.PointG2.ZERO\n for (let i = 0; i < ids.length; i++) {\n sign = sign.add(bls.PointG2.fromSignature(bigIntToBuffer(shares[ids[i]])).multiply(coeffs[i]))\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retracts the horizontal textbox used to post comments into its shortened version when the user clicks outside of its container.
function retractVerticalCommentsControls(event) { if (!$(event.target).closest('#vertical-comment-expanded-container').length) { $('#vertical-comment-expanded-container textarea').removeClass('vertical-textarea-expanded'); setTimeout(function () { $('#vertical-comment-expandable-containe...
[ "function retractHorizontalCommentsControls(event) {\n if (!$(event.target).closest('#horizontal-comment-expanded-container').length) {\n $('#horizontal-comment-expanded-container textarea').removeClass('horizontal-textarea-expanded');\n setTimeout(function () {\n $('#horizontal-comment-...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for validate assigned Technician
function validate_techAssign(){ if(document.frmtechAssign.SrchTechnician.value == ''){ document.getElementById('lblSrchTechnician').innerHTML = 'This field is required'; document.frmtechAssign.SrchTechnician.focus(); return false; }else{ document.getElementById('lblSrchTechnician').innerHTML = ''; } /*if(do...
[ "function validate_techEdit(){\n\tvar emailExp = /^[\\w\\-\\.\\+]+\\@[a-zA-Z0-9\\.\\-]+\\.[a-zA-z0-9]{2,4}$/;\t\n\tif(document.frmTech.TechFirstName.value == ''){\n\t\tdocument.getElementById('lblTechFirstName').innerHTML = 'This field is required';\n\t\tdocument.frmTech.TechFirstName.focus();\n\t\treturn false;\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the instruction to generate for an interpolated attribute
function getAttributeInterpolationExpression(interpolation) { switch (getInterpolationArgsLength(interpolation)) { case 3: return Identifiers$1.attributeInterpolate1; case 5: return Identifiers$1.attributeInterp...
[ "function getAttributeValue(template, attribute){\n\t// var pattern = new RegExp(attribute + '\\=\"(.*?)\"');\n\tvar pattern = new RegExp('([\\\\s|\\\\S]* ' + attribute + '\\=\")(.*?)(\"[\\\\s|\\\\S]*)');\n\treturn template.replace(pattern, \"$2\");\n}", "function getPropertyInterpolationExpression(interpolation)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the current time and the HSL value On change, notify the observer to update the view
itsTime() { // Get the current time let t = this.setCurrentTime(); // Change hue based on minutes passed let totalMinutes = (parseInt(t.hour) * 60) + parseInt(t.minute) ; let hue = totalMinutes * 0.25; // Keep saturation in the mid ranges let sat = pa...
[ "function updateTime() {\n const datetime = tizen.time.getCurrentDateTime();\n const hour = datetime.getHours();\n const minute = datetime.getMinutes();\n const second = datetime.getSeconds();\n\n const separator = second % 2 === 0 ? \":\" : \" \";\n\n $(\"#time-text\").htm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deze popup wordt getoond wanneer een gebruiker niet ingelogt is en op matchen klikt
function alertpopupUitgelogd() { alert("U moet eerst registreren om te kunnen matchen!"); loadController(CONTROLLER_REGISTREER); }
[ "function openLogin(){\n\n $(\"#login_popup\").show();\n popupIsOpen = true;\n\n}", "isLoginAndRegisterPopUpDisplayed() {\n return elementUtil.isElementDisplayed(this.loginAndRegisterPopUp);\n }", "function alertModalPass() {\n getElement('id_bh_modal').className = \"BH_MODAL\";\n getEleme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a single sphere.
function addSphere() { sphereNum += 1; // Generate random position of particle var x = Math.random() * 2.4 - 1.2; var y = Math.random() * 2.4 - 1.2; var z = Math.random() * 2.4 - 1.2; pos.push(vec3.fromValues(x, y, z)); // Generate random velocity of particle x ...
[ "function addSpheres() {\n // Visible grid sphere\n const gridSphere = createSphereOfQuadsWireframe(gridRadius, 36, 18, \"#2e2e2e\", true, true);\n gridSphere.name = 'gridSphere';\n scene.add(gridSphere);\n // Clickable inverted sphere (transparent hollow cube)\n const invertedSphere = createInver...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
14. If I enter an even number, I want next 10 even numbers to be printed. If I enter an odd number, I want next 10 odd numbers to be printed.
function prog14() { var n= prompt("Enter Even No"); n=parseInt(n); for( var i=n+2;i<=n+10;i=i+2) { console.log(i); } }
[ "function printOddFrom10To1() {\n const array = []\n for(let i = 10 ; 0 < i ; i--) {\n if (i % 2 === 1) {\n array.push(i);\n } \n }\n return array.map(item => `<p class=\"output\">${item}</p>`).join(\"\");\n}", "function printNums() {\n var num = 0\n while ( num <=15 ) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hilfsfunktion fuer die Ermittlung eines Elements der Seite name: Name des Elements (siehe "name=") index: Laufende Nummer des Elements (0based), Default: 0 doc: Dokument (document) return Gesuchtes Element mit der lfd. Nummer index oder undefined (falls nicht gefunden)
function getElement(name, index = 0, doc = document) { const __TAGS = document.getElementsByName(name); const __TABLE = (__TAGS === undefined) ? undefined : __TAGS[index]; return __TABLE; }
[ "static getByName(name) {\n var elt = elts['elements'];\n var number = -1;\n for (var i = 0; i < elt.length; i++) {\n if (elt[i].name.split(' ')[0].toLowerCase() === name.toLowerCase()) {\n number = i + 1;\n }\n }\n\n if (number > 0) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to compute what l2 segments are connected together (l2 domains)
findL2Domains() { let l2segment_domain = {}; let l2domains = {}; let l2links = []; let id = 0; this.scene.L3.children.forEach((parent_element) => { if(parent_element.userData.type === "base") { parent_element.children.forEach((element) => { ...
[ "function formatIntersectingSegment(x, y, i, j, xx, yy) {\n if (xx[i] == x && yy[i] == y) {\n return [i, i];\n }\n if (xx[j] == x && yy[j] == y) {\n return [j, j];\n }\n return i < j ? [i, j] : [j, i];\n}", "function segmentIntersection(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2) {\n var d = (ax2 - ax1)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to set headers for "Kapitel", "Gruppe" and "Klasse"
function setMainHeaders(kapitel, gruppe, klasse) { setKapitel(kapitel); setGruppe(gruppe); setKlasse(klasse); }
[ "procesarHeaders(){\n var headers = {\n \"Accept\": \"*/*\",\n \"User-Agent\": \"Cliente Node.js\"\n };\n if(this.basicAuth != undefined){\n headers.Authorization = \"Basi c\" + this.basicAuth;\n }\n return headers;\n }", "setHeader(key, value) {\n this._head...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the mute status for the tab by its domain if listed and returns true. If not listed, returns false.
function handleMuteByDomain(tab){ console.log("METHOD [handleMuteByDomain], tabId: [" + tab.id + "]"); if(isUrlDomainMuted(tab.url) == false){ console.log("RETURN from [handleMuteByDomain]: false"); return false; } // Mute this tab muteUnmuteTab(tab, true); console.log("RETURN from [handleMuteByDoma...
[ "function updateDomainMute(tab){\n console.log(\"METHOD [updateDomainMute], tabId: [\" + tab.id + \"]\");\n var domain = getDomainFromUrl(tab.url);\n if(mutedDomain[domain] != null){\n // Unmute domain\n delete mutedDomain[domain];\n muteUnmuteTab(tab, false);\n }\n else{\n // Mute domain\n mute...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
render the sample call graph
function renderSample () { logger.log('generating sample graph') const data = '' // need to XHR it render('peakfun-sample.json', data) }
[ "_toHumanReadableCallData() {\n // Sanity check: must have a root block.\n if (this._root === undefined) {\n throw new Error('expected root');\n }\n // Constants for constructing annotated string\n const offsetPadding = 10;\n const valuePadding = 74;\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a value to the copy object based on its type
function add (copy, key, value) { if (copy instanceof Array) { copy.push(value) return copy[copy.length - 1] } else if (copy instanceof Object) { copy[key] = value return copy[key] } }
[ "function addObject(copy, key, value) {\n\tcopy[key] = value;\n\treturn copy[key];\n}", "function cloneValue(value) {\n\t\n\t\t// The value is an object so lets clone it.\n\t\tif (getTypeOf(value) === 'object') {\n\t\t\treturn quickCloneObject(value);\n\t\t}\n\t\n\t\t// The value is an array so lets clone it.\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lists the collections in a thread
listCollections(thread) { const req = new pb.ListCollectionsRequest(); req.setDbid(thread.toBytes()); return this.unary(threads_pb_service_1.API.ListCollections, req, (res) => res.toObject().collectionsList); }
[ "function _GET_AllThreads() {\n\n $.ajax({\n dataType: \"json\",\n // headers: { \"Authorization\": \"Basic \" + btoa(state.user + \":\" + state.password) },\n url: \"/threads\",\n success: function success(data) {\n state.movieThreads = data.movieThreads;\n saveToStorage(state); // persist\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define the function: pickUpNearestCoin
function pickUpNearestCoin() { var coin = hero.findNearestItem(); if (coin) hero.move(coin.pos); }
[ "function coinCombo(cents) {\n return 'TODO'\n}", "makeCoin(){\n for (let i = 0; i < this.numberOfCoins; i++){\n this.randX = Math.floor(random(this.mapSize));\n this.randY = Math.floor(random(this.mapSize));\n if (this.gameMap[this.randY][this.randX] === 0) {this.gameMap[this.randY][this.ran...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Nutzt 'pandoc' um das gegebene DOCXDokument in eine HTMLDatei umzuwandelen Gibt den Pfad der neuen Datei zurueck
function convert_docx_to_html(file) { let output = 'html.html' execSync(`pandoc ${file} -o ${output} --extract-media=.`) console.info("Converted docx file to HTML") return output }
[ "function exportHTML(html){\r\n var header = \"<html xmlns:o='urn:schemas-microsoft-com:office:office' \"+\r\n \"xmlns:w='urn:schemas-microsoft-com:office:word' \"+\r\n \"xmlns='http://www.w3.org/TR/REC-html40'>\"+\r\n \"<head><meta charset='utf-8'><title>Export HTML to Word D...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }