query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Gets the tile at (x, y), or undefined if the coordinates are offmap.
getTile(x, y) { if (x < 0 || x >= this.mapWidth || y < 0 || y >= this.mapHeight) { return undefined; } return this.tiles[x + y * this.mapWidth]; }
[ "getTile(x, y) {\n if (x < 0) {\n x = this.width - 1;\n }\n if (x >= this.width) {\n x = 0;\n }\n if (y < 0) {\n y = this.height;\n }\n if (y >= this.height) {\n y = 0;\n }\n return this.tiles[(x * this.width) + y];\n }", "getTile(x,y){\r\n let tile = this.tiles[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update request headers New headers are merged with existing headers.
updateHeaders(headers) { Object.assign(this.headers, headers); }
[ "function updateRequestHeaders() {\n var requestHeaders = lodash.get(ctrl.selectedEvent, 'spec.attributes.headers', {});\n\n ctrl.headers = lodash.map(requestHeaders, function (value, key) {\n var header = {\n name: key,\n value: value,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to delete todo if delete span is clicked.
function deleteTodo(){ for(let span of spans){ span.addEventListener ("click",function (){ span.parentElement.remove(); event.stopPropagation(); }); } }
[ "function deleteButtonPressed(todo) {\n db.remove(todo);\n }", "function deleteTodo() {\n const lista = Array.from(spans); // Los trasformo en un array, podría ahorrame esto y recorrelos con un for ... of que es lo mismo\n console.log(lista);\n lista.forEach((span) => {\n span.addEventList...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new `AWS::Route53RecoveryControl::SafetyRule`.
constructor(scope, id, props) { super(scope, id, { type: CfnSafetyRule.CFN_RESOURCE_TYPE_NAME, properties: props }); try { jsiiDeprecationWarnings.aws_cdk_lib_aws_route53recoverycontrol_CfnSafetyRuleProps(props); } catch (error) { if (process.env.JSII_DEBUG !== "1...
[ "newSecurityRule() {\n return {\n resource_name: `${this.generateResourceName()}Rule`,\n direction: \"INGRESS\", \n protocol: \"all\", \n is_stateless: false, \n description: \"\",\n source_type: \"CIDR_BLOCK\", \n source: \"0.0.0.0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
push imune coordinates into the map
function createImuneStrict(coords, map) { map.imune.push(coords); }
[ "function update() {\n for (var i = 0; i < _this.dataMap.length; i++) {\n _this.globe.addPoint(_this.dataMap[i].lat, _this.dataMap[i].lon, _this.dataMap[i].mag * 10);\n }\n }", "function repopulateMap() {\nfor (var x = 0; x < imageData.length; x++) {\n addToMap(imageData[x]);\n}\n}", "drawL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks check whether toCheck is in Interval [lower, upper]
function isInInterval(toCheck, lower, upper) { return (toCheck >= lower) && (toCheck <= upper); }
[ "checkIfInBounds(num, lowerBound, upperBound){\r\n return (num >= lowerBound && num < upperBound);\r\n }", "function validBounds(lower, upper){\n\tif (upper == \"*\"){\n\t\treturn true;\n\t}\n\telse{\n\t\tlower = parseInt(lower,10);\n\t\tupper = parseInt(upper,10);\n\t\treturn lower <= upper;\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets all the current styles
function setStyles() { _.each(_.keys(site.styles), function(classKey) { var cssClass = site.styles[classKey]; _.each(_.keys(cssClass), function(styleKey) { setStyle(classKey, styleKey, cssClass[styleKey]); }); }); }
[ "function setStyles(){\n setHeaderStyle()\n setFooterStyle();\n setMainStyle();\n setMainWellStyle();\n}", "setStyle(allStyle){\n\t\tObject.assign(this.element.style, allStyle);\n\t\treturn this;\n\t}", "setStyles(styles) {\n Object.assign(this.element.style, styles);\n }", "refreshStyles() {\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to retrieve pallet_ind of material
function getMaterialPalletInd() { var material_pallet_ind_val = material_pallet_ind[getFieldValueById("trxtransactiondetails-material_code")]; return material_pallet_ind_val; }
[ "function findMaterialIndex(material) {\n let str = material.match(/((###)(\\s+)(\\d+))/);\n if (str) {\n // console.log(str[4])\n return str[4];\n }\n}", "function getPaletteIndex(modCode) {\n\treturn App.addedModules.indexOf(modCode);\n}", "get lightmapIndex() {}", "getUniformBlockInd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
After a conversation is received, we must augment it with several info that are not available in the database, and they strictly depend on the logged in user or the actual context. These information include the nextMessage, the other participant, the avatar of the other participant etc.
function augmentConversation(conversation) { let fstID = conversation.participants[0]; let sndID = conversation.participants[1]; let otherParticipantID = (fstID === $scope.currentUser._id) ? sndID : fstID; conversation.name = undefined; conversation.nextMessage = ""; con...
[ "function updateConversationWithNewMessage(conversation) {\n let contentLength = conversation.content.length;\n let lastMessageObj = (contentLength > 0) ?\n conversation.content[contentLength - 1] :\n undefined;\n\n conversation.lastMessageTimestamp = (contentLength > 0) ?...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
extracts the attributes of a copy from an html row row: html row header: order of the columns
function extractCopy (row, header) { // library let library = $('td:nth-of-type(' + header[0] + ') a', row).text().trim() // if there is no a link if (!library) { library = $('td:nth-of-type(' + header[0] + ')', row).text().trim() } // place let place = $('td:nth-of-type(' + header[1] + ')', row).text...
[ "function rowAttrs(row) /* (row : row) -> attrs */ {\n return row.rowAttrs;\n}", "function extractFields (row) {\n // image cover (if any)\n let img = $('.img-delayed', row).attr('data-src')\n // medium (CD, Buch,...)\n let medium = $('.rList_medium > img', row).attr('title')\n // title\n let title = $('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Produce a starter worker file from a BPMN file
static async scaffold(filename) { const bpmnObject = BpmnParser.parseBpmn(filename)[0]; const taskTypes = await BpmnParser.getTaskTypes(bpmnObject); const interfaces = await BpmnParser.generateConstantsForBpmnFiles(filename); const headerInterfaces = {}; // mutated in the recursive funct...
[ "function createWorker()\n {\n var childWorkerId = workerPool.createWorkerFromUrl('js/'+WORKER_FILENAME);\n workerPool.sendMessage([\"3..2..\", 1, {helloWorld: \"Hello world!\"}], childWorkerId);\n }", "function sw() {\n return gulp\n .src(\"./src/service-worker.js\")\n .pipe(plumber())\n .pipe(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the pid a given user socket id
function getPidForUser(guid){ for (var i = 0; i < sessions.length; i++){ var users = sessions[i].users; for (var j = 0; j < users.length; j++){ if(guid === users[j].guid){ return users[j].pid; } } } return null; }
[ "function getOwnSocketId(id){\n return userlist.filter((u) => { return u.userId === parseInt(id); })[0].socketid;\n}", "function getSocketID(userID) {\n const socketID = _userTable[userID]\n\n if (!socketID) {\n throw new Error('No socket ID for the user.')\n }\n\n return socketID\n}", "getPid() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funciones funcion para cargar todos los empleados en la tabla
function getEmpleadosTabla() { $http.post("EmpleadosTabla/getEmpleadosTabla").then(function (r) { if (r.data.cod == "OK") { vm.lista.data = r.data.d.tablaEmpleado vm.lista.disp = [].concat(vm.lista.data); } }) }
[ "function cargarDatosExpediente() {\n let obtenerDatos = JSON.parse(localStorage.getItem(\"Guardar_Cita\")) || []\n obtenerDatos.forEach(element => {\n $(\"#tbl_expediente\").append(`<tr><td>${element.date}</td><td>${element.hora}</td><td>${element.nombre}</td><td>${element.servicio}</td>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
display event names on right side of the tab
function displayEventNames(e){ let txt="<pre>Wait Class: "+e.data.waitEvent+"<br>"; txt=txt+ "-".repeat(e.data.waitEvent.length+12)+"<br>"; let eventObj=rangeWaitClassObj[e.data.waitEvent][1]; for (let eventName of Object.keys(eventObj)){ txt=txt+eventName+": "+eventObj[eventName]+"% <br>" }; txt=txt+"</...
[ "function slideName (event) {\n $('#slide-title').html(String(slideNames[event.indexh]).toUpperCase())\n }", "function _list() {\r\n\t\tvar len = _events.length,\r\n\t\t\ti, out = '';\r\n\t\tfor (i = 0; i < len; i += 1) {\r\n\t\t\tout += _events[i].name + ' ' + _events[i].time + '\\n';\r\n\t\t}\r\n\t\tconsole...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isUSPhoneNumber (STRING s [, BOOLEAN emptyOK]) isUSPhoneNumber returns true if string s is a valid U.S. Phone Number. Must be 10 digits. NOTE: Strip out any delimiters (spaces, hyphens, parentheses, etc.) from string s before calling this function. For explanation of optional argument emptyOK, see comments of function ...
function isUSPhoneNumber (s) { if (isEmpty(s)) if (isUSPhoneNumber.arguments.length == 1) return defaultEmptyOK; else return (isUSPhoneNumber.arguments[1] == true); return (isInteger(s) && s.length == digitsInUSPhoneNumber) }
[ "function isUSPhoneNumber (s)\r\n{ if (isEmpty(s))\r\n if (isUSPhoneNumber.arguments.length == 1) return defaultEmptyOK;\r\n else return (isUSPhoneNumber.arguments[1] == true);\r\n return (isInteger(s) && s.length == digitsInUSPhoneNumber)\r\n}", "function checkUSPhone (theField, emptyOK)\r\n{ if (ch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add new record to Zone Accepts zonefile strings
addRecord(zone, string) { if (!this.zone[zone]) throw "This zone doesn't exist yet. Please add it first." const rr = new wire.Record() rr.fromString(string) return this.zone[zone].insert(rr) }
[ "function zoneAdd (zone) {\n\n\t\tdatabases.zones.insert({name: zone}, function (err, doc) {\n\t\t\t// send back current zones\n\t\t\tsendZones();\n\t\t});\n\t}", "function addZoneRecord(id, subDomain, rec_type, addrStr)\n{\n const params = {\n HostedZoneId: id,\n ChangeBatch: {\n Changes: [\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clears and toggles the update film form
function hideUpdateFilm() { $("#update-film-result").empty(); $("#update-film-success").empty(); $("#update-film-boxes").toggle("slow"); }
[ "function editADifferentMovie(){\n reHide(\"edit-another\");\n unHide(\"edit-form\");\n unHide(\"edit-this-movie\");\n reHide(\"edit-submit-form\");\n enableButton(\"edit-this-movie\");\n disableButton(\"confirm-edit-button\")\n}", "function hideAddFilm() {\n\t$(\"#add-film-result\").empty();\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
normalize vector into a unit vector
function _normalizeVector(v){ if(_almostEqual(v.x*v.x + v.y*v.y, 1)){ return v; // given vector was already a unit vector } var len = Math.sqrt(v.x*v.x + v.y*v.y); var inverse = 1/len; return { x: v.x*inverse, y: v.y*inverse }; }
[ "normalize(outVector, inVector) {\r\n // @todo\r\n }", "function normalize(vector) {\n\tconst magnitude = Math.sqrt(Math.pow(vector[0], 2) + Math.pow(vector[1], 2));\n\tvector[0] /= magnitude;\n\tvector[1] /= magnitude;\n\treturn vector;\n}", "function normalize(vector){\n let sum = vector.reduce(f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays terrain with appropriate shaders
display(){ this.scene.pushMatrix(); this.heightmap.bind(0); this.texture.bind(1); this.scene.setActiveShader(this.shader); this.terrain.display(); this.scene.setActiveShader(this.scene.defaultShader); this.scene.popMatrix(); }
[ "function terrainShaderInit(){\n terrainShaderProgram = shaderPrograms[TERRAIN_PREFIX];\n\n /** Attributes */\n terrainLocations[\"aVertexPosition\"] = gl.getAttribLocation(terrainShaderProgram, \"aVertexPosition\");\n gl.enableVertexAttribArray(terrainLocations[\"aVertexPosition\"]);\n\n terrainLocations[\"aV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function will get called whenever the requirement fails. (AKA it returns false) Use this for instance to return an error message
requirementsFail({ msg, suffix }) { msg.reply(`No!`); }
[ "static _checkRequirements() {\n _.forEach(this._requirements, (pluginInfo, pluginName) => {\n const maxVersion = _.max(pluginInfo);\n const pluginVersion = this.getVersion(pluginName);\n\n if (pluginVersion === undefined) {\n const error = 'Required to install...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
9.Write a function that for a given departure and arrival time calculates the time the trip takes. Input: 8:22:13 11:43:22 Output: 3 hours 21 minutes 9 seconds
function tripTime(departure, arrival) { var start = departure.split(":"); start = new Date(2018, 0, 0, ...start); var end = arrival.split(":"); end = new Date(2018, 0, 0, ...end); var diff = Math.abs(end - start); var hours = Math.floor(diff / (1000*60*60)) diff = diff - hours*(1000*60*60); ...
[ "function calculateTime(departure, arrival) {\n\n var year = new Date().getFullYear();\n var newDeparture = new Date(year + \" \" + departure);\n var newArrival = new Date(year + \" \" + arrival);\n\n\n\n var result = (newArrival - newDeparture);\n\n //TODO:\n var hours = Math.floor(result / 36e5)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function checkfnm() retrieves the First Name of Person Measuring value entered by the user. The funcion checks to make sure that the value entered only contains letters, apostrophes, and end spaces.Save button is disabled or enabled depending on the status of the validation.
function checkfnm() { var fnm = document.getElementById("fnameofpersonmeasuringdiameter").value; if (fnm == null || fnm == "") { return; } var regex = /^([a-zA-Z' ])+$/ if (!new RegExp(regex).test(fnm)) { alert("Your spelling contains numerics or special characters. ...
[ "function checkFirstName() {\n\t\t\n\t\tvar pattern = /^[a-zA-Z]*$/;\n\t\tvar fname = idFirstName.val();\n\t\tif (pattern.test(fname) && fname !== '') {\n\t\t\tidFirstNameError.hide();\n\t\t\terrorFirstName = false; \n\t\t\tidFirstName.css(\"color\",\"Dodgerblue\");\n\t\t}\n\t\telse {\n\t\t\tidFirstNameError.html(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate the OpCodes to update the bindings of a string.
function generateBindingUpdateOpCodes(str,destinationNode,attrName,sanitizeFn){if(sanitizeFn===void 0){sanitizeFn=null;}var updateOpCodes=[null,null];// Alloc space for mask and size var textParts=str.split(BINDING_REGEXP);var mask=0;for(var j=0;j<textParts.length;j++){var textValue=textParts[j];if(j&1){// Odd indexes ...
[ "function generateBindingUpdateOpCodes(str, destinationNode, attrName, sanitizeFn) {\n if (sanitizeFn === void 0) { sanitizeFn = null; }\n var updateOpCodes = [null, null]; // Alloc space for mask and size\n var textParts = str.split(BINDING_REGEXP);\n var mask = 0;\n for (var j = 0; j < textParts.le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns x.y of a random empty cell
function getRandomEmptyCell() { var max = 16, min = 0; var n = Math.floor(Math.random() * (max - min)) + min; var i = Math.floor(n / 4); var j = Math.floor(n % 4); var coord = {x : i, y : j}; return coord; }
[ "getRandomEmptyCell() {\n do {\n let x = randomNumber(this.grid.length);\n let y = randomNumber(this.grid.length);\n if (\n this.grid[x][y].isBlocked == true ||\n this.grid[x][y].hasPlayer == true ||\n this.grid[x][y].hasWeapon == true\n ) {\n } else {\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return whether a channel supports a particular mark type.
function supportMark(channel, mark) { return mark in getSupportedMark(channel); }
[ "function supportMark(channel, mark) {\n return mark in getSupportedMark(channel);\n }", "function channel_supportMark(channel, mark) {\n return channel_getSupportedMark(channel)[mark];\n}", "function supportMark(channel, mark) {\n return getSupportedMark(channel)[mark];\n}", "allowsMarkType(markT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
xSetIETitle, Copyright 20032007 Michael Foster (CrossBrowser.com) Part of X, a CrossBrowser Javascript Library, Distributed under the terms of the GNU LGPL
function xSetIETitle() { var ua = navigator.userAgent.toLowerCase(); if (!window.opera && navigator.vendor!='KDE' && document.all && ua.indexOf('msie')!=-1 && !document.layers) { var i = ua.indexOf('msie') + 1; var v = ua.substr(i + 4, 3); document.title = 'IE ' + v + ' - ' + document.title; } ...
[ "function xSetIETitle()\n{\n if (xIE4Up) {\n var i = xUA.indexOf('msie') + 1;\n var v = xUA.substr(i + 4, 3);\n document.title = 'IE ' + v + ' - ' + document.title;\n }\n}", "function setWindowTitle(title) {\n document.getElementsByTagName(\"title\")[0].innerText = title;\n}", "static set xboxTitleI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepares a list of valid conference talks
prepareConferenceList(conferences) { for (let talk of conferences) { let duration = talk.split(' ').pop(); if (duration.toLowerCase() === 'lightning') { duration = 5; } else if (duration.toLowerCase().endsWith('min')) { duration = parseInt(dura...
[ "schedule (talks) {\n let conference = new Conference()\n\n // place all talks into the bin packer\n let binStore = new BinPacker(talks)\n \n // create and sort talks using firstFit function\n let sessions = binStore.firstFit()\n \n // for every 2 binStore, cr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to write all question data to Firebase DB
function writeQuestionsToFirebase(questions) { questions.forEach(function (question) { writeQuestionData(question.id, question.question, question.options, question.question_type); }); }
[ "function writeQuestionData(questionId, question, answerOptions, questionType) {\n firebase.database().ref('questions/' + questionId).set({\n questionId: questionId,\n question: question,\n answerChoices: answerOptions.length > 0 ? answerOptions : '',\n questionType: questionType,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Regulates the creation of the list of offending columns by checking if there is a userdefined set of offenses to look for and if there is, search for those first before searching for the predefined offenses. Note that userdefined offense types are matched as caseinsensitive, so "css" = "CSS".
function createOffendingColumnsList ( extension, line, offenses ) { var merge_columns, columns = []; //If user-defined offenses are given, process those first if(offenses !== undefined) { for (var type in offenses) { if (!offenses.hasOwnProperty(type)) { continue; } /* Check if offenses has ...
[ "function findOffendingColumns ( line, type, pattern, message )\n {\n var result,\n defined_pattern,\n defined_message = message,\n pattern_modifiers = ['g', 'i'],\n columns = [];\n if(Array.isArray(pattern) && pattern.length > 0 &&\n (!doesTypeExist(type) || override)) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reduces 5 minutes of focusTime & playTime down to 5 minutes
function reduceFocus() { setFocusTime(prevTime => prevTime > 5 ? prevTime - 5 : prevTime); setPlayTime(prevTime => prevTime > 300 ? prevTime - 300 : prevTime); }
[ "function increaseFocusDuration() {\n // If focusDuration is less than 60 minutes, increase focusDuration by 5\n if (focusDuration < 60) {\n // setFocusDuration fn takes focusDuration state & does the increase\n setFocusDuration(focusDuration + 5);\n }\n }", "function incrFocusDuration() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cheks if a player has other players nearby that he can resurrect. If so, allows resurrection
checkIfDeadPlayerNearby(){ if(!this.player.dead){ if(Math.abs(Phaser.Point.distance(this.player.position, this.otherPlayer.position)) < 64 && this.otherPlayer.dead){ this.player.resurrectText.setText("Press Resurrect Key"); if(this.player.keys.Resurrect.isDown){ this.player.resurrecting = true; ...
[ "isThreatened() {\n //check against all opponents to make sure non are within this\n //player's comfort zone\n let it;\n it = this.Team().Opponents().Members();\n \n for( let iter = 0, size = it.length; iter < size; iter++ ){\n\n let curOpp = it[ iter ];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CLEAR FORM CREATE CATEGORY
function clear_frm_save_category() { $('input:text, input:password, input:file, select, textarea', '#frm-create-category').val(''); $('input:checkbox, input:radio', '#frm-create-category').removeAttr('checked').removeAttr('selected'); $('#inactive').prop('checked', false); $(function(){ ...
[ "function clearCategoryForm(){\n\t$(\"input#categoryId\").val(\"\");\n\t$(\"input#categoryName\").val(\"\");\n}", "function new_category() {\n $(\"#category_title\").val(\"\");\n $(\"#category_id\").val(\"\");\n $(\"#add_btn\").show();\n $(\"#update_btn\").hide();\n location.href = \"#category_form...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
client_net represents the client side of a game connection. sender is an object whose send method accepts an ArrayBuffer of data to send. input_type is a constructor that is a subclass of clientinput that represents input from the player.
function client_net(sender, input_type) { function sender_send(data) { sender.send(data); } this.netconn = new netconn(); // Last time reported by the server. this.serverTime = 0; // If set, the thing that represents this client's avatar. this.self = null; // The local time at whi...
[ "function server_client(sender) {\n this.sender = function(data) { sender.send(data); };\n this.netconn = new netconn();\n // If set, inform the client that this is their avatar.\n this.clientThing = null;\n\n // The last input ID this client sent.\n var lastReceivedInputID = -1;\n // Game stat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build up the URL string to connect to the MongoDB instance.
function buildMongoUrl() { var mongoUrl = 'mongodb://' + c.db.username + ':' + c.db.password + '@' + c.db.host + ':' + c.db.port + '/' + c.db.database + '?auto_reconnect=true&safe=true'; return mongoUrl; }
[ "function buildMongoURL() { \n\tif(c.dbs.auth.dbUsername && c.dbs.auth.dbPassword) {\n\t\treturn 'mongodb://' + c.dbs.auth.dbUsername + ':' + c.dbs.auth.dbPassword + '@' + c.dbs.auth.dbHost + ':' + c.dbs.auth.dbPort + '/' + c.dbs.auth.dbName + '?auto_reconnect=true&safe=true';\n\t} else { \n\t\treturn 'mongodb://' ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the FormatNumber abstract operation is called with arguments numberFormat (which must be an object initialized as a NumberFormat) and x (which must be a Number value), it returns a String value representing x according to the effective locale and the formatting options of numberFormat.
function FormatNumber (numberFormat, x) { var n, // Create an object whose props can be used to restore the values of RegExp props regexpState = createRegExpRestore(), internal = getInternalProperties(numberFormat), locale = internal['[[dataLocale]]'], nums = internal['[[numb...
[ "function FormatNumber (numberFormat, x) {\n\t var n,\n\t\n\t // Create an object whose props can be used to restore the values of RegExp props\n\t regexpState = createRegExpRestore(),\n\t\n\t internal = getInternalProperties(numberFormat),\n\t locale = internal['[[dataLocale]]'],\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create our rented div and available div
function createInitalDivs() { let mainContainer = createDivElement({id: 'mainContainer'}); let movieDisplays = createDivElement({id: 'movieDisplays'}); let sideBar = createDivElement({id: 'sideBar'}); let available = createDivElement({id: 'aDiv', class: 'movieDivs'}); let rented = createDivElem...
[ "function createDiv(doc){\n\n newdiv = document.createElement('div'); \n newdiv.id = 'newid'+i.toString();\n newdiv.className=\"violationwrapper\";\n body.appendChild(newdiv); \n\n div2=document.createElement('div');\n div2.id='row'+i.toString();\n div2.className=\"violationRow\";\n newdiv....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds a CSS selector that matches `node`.
function getSelector(node) { var name; var selector = []; while (node.nodeName !== "#document") { name = node.nodeName; // Only one of these are ever allowed -- so, index is unnecessary if (name!=="html" && name!=="body" & name!=="head") { name += ":nth-child("+ getNthIndex(node) +")"; } // B...
[ "selector(node) {\n return true;\n }", "generateSelector() {\n /* root element cannot have a selector as it isn't a proper element */\n if (this.isRootElement()) {\n return null;\n }\n const parts = [];\n let root;\n for (root = this; root.par...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if all data dependencies are solved
function check() { // decrease number of loading datasets counter--; // are not all data dependencies solved? => abort if ( counter !== 0 ) return; // waitlist not empty? => abort and solve a data dependency in waitlist if ( waiter.length > 0 ) return ccm.h...
[ "function checkQuestionDependencies(allQuestions, data) {\n if (data.dependencies().length === 0) {\n return true;\n }\n\n for (let dependency of data.dependencies()) {\n let dependencyQId = dependency.questionId();\n let dependencyQValue = dependency.questionValue();\n\n for (let question of allQues...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update user role. User and role data stored in given element
function updateUserRole(el) { //console.log(el.attr('data-id')); //console.log(el.attr('data-role-name')); //console.log(el.val()); var dataModel = { UserId: el.attr('data-id'), RoleName: el.attr('data-role-name'), Add: el.val() }; $.ajax({ url: '/api/users/upda...
[ "function updateRole() {\n\n}", "function ChangeUserRole(){\n\t\n\tCURRENT_ROLE = $('#' + USER_ROLE).val();\n\t\n\tAuthentificate();\n\t\n}", "function updateRole(rawUser) {\n var user = UserUtils.convertRawUser(rawUser);\n _users[user.id].role = user.role;\n return true;\n}", "function editRole(req, res) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
card_name Validation: 1. Digits or letters (including space ' ') 2. Length: 1 ~ 15 characters, can't be empty 3. Name cannot be the same as users other cards (This is already implemented in the server side, just need a error message like the others.
function validateCardName(card_id) { let card_name = $("#cardNameInput").val(); if (card_name === "") { // Display some messages return; // } else if ( doValidation() ) { } else { setCardName(card_id, card_name); } }
[ "function checkCardName() {\n\n let name = cardName.value\n let regexpEng = RegExp(/^[a-zA-Z0-9 ]*$/);\n let regexpRus = RegExp(/^[а-яА-Я0-9 ]*$/);\n\n if (!regexpEng.test(name) && !regexpRus.test(name)) {\n error_cardName = true;\n } else {\n error_cardName ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the 'toplevel' (defined as 'a direct child of the node passed as the top argument') node that the given node is contained in. Return null if the given node is not inside the top node.
function topLevelNodeAt(node, top) { while (node && node.parentNode != top) { node = node.parentNode; } return node; }
[ "function topLevelNodeAt(node, top) {\n while (node && node.parentNode != top)\n node = node.parentNode;\n return node;\n }", "function topLevelNodeBefore(node, top) {\n while (!node.previousSibling && node.parentNode != top) {\n node = node.parentNode;\n }\n return topLevelNodeAt(node.previ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
delete the contact at the given index
deleteAt(index) { if (index >= 0 && index < this.contacts.length) { this.contacts.splice(index, 1); } else { console.log("Invalid index."); } }
[ "deleteAt(indexParam) {\n this.contacts.splice(indexParam, 1);\n }", "function deleteContact(index) {\n var contacts = getContactsFromLocal();\n console.log(contacts);\n console.log(\"Delete index \", index);\n contacts.splice(index, 1);\n console.log(contacts);\n setContactsToLocal(contacts...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mostrar les dades d'un rocket individual.
function printInfoRocketIndividual(rocket, position) { var allPropellersMaxPowersOfARocket = mapPropellersMaxPowersOfARocket(rocket); var maxPower = calculateMaxPowerOfARocket(allPropellersMaxPowersOfARocket); createRocketCard(position, rocket.code, allPropellersMaxPowersOfARocket, maxPower); rocket.sho...
[ "printRovers() {\n rovers.forEach(el => {\n console.log(`${el.X} ${el.Y} ${el.D}\\n`);\n });\n }", "function consultPotenciaAllRockets() {\n document.getElementById(\"infoRockets\").innerHTML = \"\";\n for (var i = 0; i < arrayCoets.length; i++) {\n var sumaPotencias = 0;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A standard compare of two values, as used in sort functions: If val1 val2, return 1. Values are compared as numbers if both can successfully be converted.
function compareValues(varVal1, varVal2) { //local variables var fltVal1, fltVal2, intReturn; //try converting both values to numbers fltVal1 = parseFloat(varVal1); fltVal2 = parseFloat(varVal2); //see if they can both be treated as numbers if (!isNaN(fltVal1) && !isNaN(fltVal2)) { //work with the numbers fr...
[ "function compareValues(val1, val2){\n\tif (val1 > val2) {\n\t\treturn -1;\n\t} else if(val2 > val1) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}", "function compareNumberOrString(a, b) {\n return b > a ? 1\n : b === a ? 0\n : -1;\n}", "function compareValues(a, b) {\n return a.valu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate if dino hits the things.
hits(dino) { if (this.x < dino.x + dino.width && this.x + this.width > dino.x && this.y < dino.y + dino.height && this.height + this.y > dino.y) { return true; console.log('heelo'); } else { return false; } }
[ "hits(asteroids) {\n for (let i = 0; i < asteroids.length; i++) {\n let asteroidDim = asteroids[i].getDim();\n let centerX = asteroidDim[0], centerY = asteroidDim[1];\n let x = this.x\n if (checkPoint(centerX, centerY, this.x, this.y,asteroidDim[2] / 2)<= 1 || \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to active any turtle
function changeActiveTurtle(index){ vm.activeTurtle = index; }
[ "function turtle_activate(turtle, animType){\n\tturtle.meshType = \"turtle\";\n\t\n\tif(typeof turtle.animType != 'undefined'){\n\t\tturtle.prevAnimType = turtle.animType;\n\t}\n\tturtle.animType = animType;\n\tturtle.speed = 2; /* Slows down the animation the higher it goes. 1 = Regular speed, 2 = 2x slo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tries to parses |filterElement| as a single "is:" directive, and returns a new filter function. Returns null on failure.
function parseRestrictDirective_(filterElement) { var match = /^is:(.*)$/.exec(filterElement); if (!match) return null; if (match[1] == 'active') { return function(sourceEntry) { return !sourceEntry.isInactive(); }; } if (match[1] == 'error') { return function(sourceE...
[ "function getFilter(element) {\n while (element !== filtersElement) {\n if (hasClass(element, 'filter')) {\n return element;\n }\n element = element.parentNode;\n }\n return null;\n }", "function parseStringDirective_(filterElement) {\n var match = RegExp('^([^:]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private methods Converts function status state.
function convertStatusState() { ctrl.convertedStatusState = FunctionsService.getDisplayStatus(ctrl.function); lodash.set(ctrl.function, 'ui.convertedStatus', ctrl.convertedStatusState); // used for sorting by status }
[ "function convertStatusState() {\n var status = lodash.chain(ctrl.function.status.state).lowerCase().upperFirst().value();\n\n ctrl.convertedStatusState = status === 'Error' ? 'Error' : status === 'Scaled to zero' ? 'Scaled to zero' : status === 'Ready' && ctrl.function.spec.disable ? 'Standby...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rebase change IN: documentId, change, version (change version) OUT: change, changes (server changes), version (server version)
_rebaseChange(args, cb) { this.documentEngine.getChanges({ documentId: args.documentId, sinceVersion: args.version }, function(err, result) { let B = result.changes.map(this.deserializeChange) let a = this.deserializeChange(args.change) // transform changes DocumentChange.tra...
[ "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histCh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Comparing React `children` is a bit difficult. This is a good way to compare them. This will catch differences in keys, order, and length.
function childrenEqual(a /*: ReactChildren*/ , b /*: ReactChildren*/ ) /*: boolean*/ { return (0, _lodash.default)(_react.default.Children.map(a, function (c) { return c.key; }), _react.default.Children.map(b, function (c) { return c.key; })); }
[ "function childrenEqual(a\n/*: ReactChildren*/\n, b\n/*: ReactChildren*/\n)\n/*: boolean*/\n{\n return (0, _lodash.default)(_react.default.Children.map(a, function (c) {\n return c === null || c === void 0 ? void 0 : c.key;\n }), _react.default.Children.map(b, function (c) {\n return c === null || c === voi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Declare a function to load the Master Roles for the current company
function loadMasterRolesByCompany(CompanyID, callback, errorHandler) { // Declare a Deferred construct to return from this method var promise; var targetUrl; // Declare a resonse structure to return from this object var response = new Response(); var token = sessionStora...
[ "function loadMasterRoles(callback, errorHandler) {\n // Declare a Deferred construct to return from this method\n var promise;\n // Declare a resonse structure to return from this object\n var response = new Response();\n var targetUrl;\n\n var token = sessionStorage.getIt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function adds color blocks to the page on page load
function addBlocksToPage() { // this empties colors from the page first $('#colorBlockContainer').empty(); // this appends the buttons on DOM load based on the colorArray for (var i = 0; i < numberOfColors; i++) { var newColorBlock = $('<button>'); newColorBlock.css('background-color', colorArray[i]); ...
[ "function generateColorBlocks() {\n $('.palette').html('');\n\n $('.palette').append('<h4 class=\"text-muted\">Dominant Color</h4>');\n\n var c = rgbToCssString(bgColor);\n\n $('.palette').append('<div class = \"color-blocks\"><div class=\"color-block\" style=\"background-color: ' + c + ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility function substitutes an url for the hashtag () in a format string
function hashReplace(fmtStr, urlStr) { return retStr = fmtStr.replace('#', urlStr); }
[ "async function cleanHashtag(user_string) {\n\tif (user_string[0] == '#') {\n\t\treturn '%23' + user_string.substring(1)\n\t}\n\telse {\n\t\treturn user_string\n\t}\n}", "function _linkifyHashtags(text, links) {\n // If there is no search URL for a hashtag, there isn't much we can do\n if (links.has...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SystemJS AMD Format Provides the AMD module format definition at System.format.amd as well as a RequireJSstyle require on System.require
function amd(loader) { // by default we only enforce AMD noConflict mode in Node var isNode = typeof module != 'undefined' && module.exports; loader._extensions.push(amd); // AMD Module Format Detection RegEx // define([.., .., ..], ...) // define(varName); || define(function(require, exports) {}); || def...
[ "function transformAMDModule(node){var define=ts.createIdentifier(\"define\");var moduleName=ts.tryGetModuleNameFromFile(node,host,compilerOptions);var jsonSourceFile=ts.isJsonSourceFile(node)&&node;// An AMD define function has the following shape:\n//\n// define(id?, dependencies?, factory);\n//\n// This has ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build switch move between squares x1,y1 and x2,y2
getSwitchMove_s([x1, y1], [x2, y2]) { const c = this.getColor(x1, y1); //same as color at square 2 const p1 = this.getPiece(x1, y1); const p2 = this.getPiece(x2, y2); let move = new Move({ appear: [ new PiPo({ x: x2, y: y2, c: c, p: p1 }), new PiPo({ x: x1, y: y1, c: c, p: p2 }) ], vanish: [ ...
[ "getSwitchMove_s([x1,y1],[x2,y2])\n\t{\n\t\tconst c = this.getColor(x1,y1); //same as color at square 2\n\t\tconst p1 = this.getPiece(x1,y1);\n\t\tconst p2 = this.getPiece(x2,y2);\n\t\tif (p1 == V.KING && p2 == V.ROOK)\n\t\t\treturn []; //avoid duplicate moves (potential conflict with castle)\n\t\tlet move = new Mo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler entry point. Does nothing. Note that this method doesn't call `onResult` callback, so it breaks main app loop.
call(onResult) { onResult(); }
[ "resultHandler(result) {\r\n if (this.resultFn) {\r\n this.resultFn(result);\r\n } else {\r\n result ? console.log(\"the picture contains nudity\") : console.log('Its is safe');\r\n }\r\n }", "function handler (done) { \r\n validateParams((err) => {\r\n if (err) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
writeOutPoint encodes op to the Decred protocol encoding for an OutPoint to w.
function writeOutPoint(input, arr8, position) { const opRawHash = hexToBytes(input.prevTxId); arr8.set(opRawHash, position); position += opRawHash.length; arr8.set(putUint32(input.outputIndex), position); position += 4; arr8.set(putUint8(input.outputTree), position); return position + 1; }
[ "async putOutPointClaim (txInput: TransactionInput, txHash: string, blockchain: string = 'bc', opts: Object = { asBuffer: true, force: false }): Promise<boolean> {\n const outpoint = txInput.getOutPoint()\n const key = `${blockchain}.op.${outpoint.getHash()}.${outpoint.getIndex()}`\n try {\n // if thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Algorithm: Total working hours = ((endTime startTime) / 1000 / 60 / 60).toFixed(2) (30 /60)
onChange(startTime, endTime, breakTime) { let workHours = 0; if (endTime && startTime) { let gap = 0; let startDate = new Date("2019-07-09T" + startTime + "Z"); let endDate = new Date("2019-07-09T" + endTime + "Z"); gap = endDate - startDate; workHours = (gap / 1000 / 60 / 60).toFixed(2); } if (b...
[ "function hoursWorked(startHr, startMin, finishHr, finishMin){\n let total = 0; \n let hrs = finishHr - startHr;\n let mins = (finishMin - startMin)/60;\n total = total + hrs + mins;\n return total\n}", "function question4(){\n var typeDuration=[]\n employeeType.forEach(function(value){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when user clicks on any player. Stores currently selected player for future use.
function clickPlayer(thisPlayer, playerDisplay) { selectedPlayer = thisPlayer; selectedPlayerDisplay = playerDisplay; }
[ "function chosePlayer() {\t\n\t$(\".choseYou\").on(\"click\", function(event) {\n\t\t$(\".player\").html('');\n\t\t$(\".choseYou\").off(\"click\");\n\t\tlastChar = event.target.id[event.target.id.length -1];\n\t\tcreateCard(lastChar);\n\t\tselectedFillPlayer(lastChar);\n\t\tselectionType = \"enemies\";\n\t\tplayer ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the sorting to by popular
setSortByPopular() { this.setSort(SortbyContainer.SORT_BY_POPULAR); }
[ "function popularSort(array){\n\tarray.sort(function(a, b){\n\t\tvar a1= a.amountBought, a2= b.amountBought;\n\t\tif(a1== a2) return 0;\n\t\treturn a1> a2? 1: -1;\n\t}); \n\t\n\tarray.reverse();\n}", "function sortByPopularity() {\n\t\t//Make a copy of the initialArray and the sort function\n\t\tlet copiedContact...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of sorted keys from an associative array.
function sortedKeys(array) { var keys = []; for (var i in array) { keys.push(i); } keys.sort(); return keys; }
[ "function sortedKeys(array) {\n var keys = [];\n for (var i in array) {\n keys.push(i);\n }\n keys.sort();\n return keys;\n}", "function sortedKeys(array) {\n}", "function sortedKeys(array) {\n const keys = []\n for (let i in array) {\n keys.push(i)\n }\n keys.sort()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assert that a cajoled and loaded fixtureguest.html has the right results.
function assertGuestHtmlCorrect(frame, div, opt_containerDoc) { var containerDoc = opt_containerDoc || document; assertStringContains('static html', div.innerHTML); assertStringContains('edited html', div.innerHTML); assertStringContains('dynamic html', div.innerHTML); assertStringContains('external...
[ "assertLogo() {\n cy.fixture(Section2.literals.FIXTURE_LOGO_BASELINE).then((expected) => {\n cy.fixture(Section2.literals.FIXTURE_LOGO_DOWNLOAD).then((downloaded) => {\n expect(expected).to.be.deep.equal(downloaded)\n })\n })\n }", "function setUpHTMLFixture() {\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: dwscripts.getDataSourceNodes DESCRIPTION: Given a dataSource, returns the DataSource nodes which correspond to the children of the data source ARGUMENTS: dataSource DataSource object the data source for which to get nodes RETURNS: array of DataSource nodes
function dwscripts_getDataSourceNodes(dataSource) { var retVal = new Array(); var serverModelFolder = dw.getDocumentDOM().serverModel.getFolderName(); //get the dom of the data source var dsDOM = dreamweaver.getDocumentDOM(dreamweaver.getConfigurationPath() + "/DataSources/" + serverModelFolder + "/" + data...
[ "function dwscripts_getDataSourceTypes(arrayOfDataSourceNodes)\n{\n var retVal = new Array();\n \n if (arrayOfDataSourceNodes != null)\n {\n for (var i=0; i < arrayOfDataSourceNodes.length; i++)\n {\n retVal.push(arrayOfDataSourceNodes[i].dataSource);\n }\n }\n \n return retVal;\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
vm.shareToFacebook("/th/channelplay/"+video.description[0].channel_id+"/"+video.description[0].id+"/", video.name, video.description[0].detail, video.real_thumbnail)
function shareToFacebook(){ var url = window.location.host + vm.url; fb_publish(vm.title, vm.detail, url , vm.imgsrc); }
[ "function share_video_fb(){\r\n\t\t$.post('/account/upload/fb', { input: 'video', fb_share_text: $('#share_text_video').val(), fb_url: $('#share_url_video').val() }, function(){\r\n\t\t$('#share_text_video').val('');\r\n\t\t$('.share_box').slideUp(200);\r\n\t\t\r\n\t\t});\r\n\t}", "function showFacebookShare() {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Override for the store's setRootNode method. We have to override this because we need to either (a) get the name of the repository, or (b) resolve the root folder path to an object id, both of which require a service call. The base class method is invoked after the service call returns.
function storeSetRootNode(root) { function idCallback(resolvedId) { if (resolvedId == null) { this.on("beforeload", function() { return false; }); root.contentTree.hide(); } if(resolvedId && roo...
[ "buildRootNode() {\n return {};\n }", "function AutomationRootNodeImpl(treeID) {\n $Function.call(AutomationNodeImpl, this, this);\n this.treeID = treeID;\n this.axNodeDataCache_ = {__proto__: null};\n}", "get rootFolder() {\r\n return new Folder(this, \"rootFolder\");\r\n }", "setRoot(node) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle VNC auth challenge
async _handleAuthChallenge() { if (this._challengeResponseSent) { // Challenge response already sent. Checking result. if (this._socketBuffer.readUInt32BE() === 0) { // Auth success this._log('Authenticated successfully', true); this._aut...
[ "function authenticate (buffer) {\n if (buffer[0] !== 0x01 /* subnegotiation version */) return sock.end()\n const uLen = buffer[1]\n const user = buffer.toString('utf8', 2, 2 + uLen)\n const pLen = buffer[uLen + 2]\n const pass = buffer.toString('utf8', uLen + 3, uLen + 3 + pLen)\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fetching data required for home page along with adding in html for cards
function getHomeData(){ $.getJSON("index.php/getHomeData", function(jsonObj){ // can see the object returned //var jsonObj = $.parseJSON(rawjson); console.log("homeData"); console.log(jsonObj); // get home page text $('#title_home').html('<h2>' + jsonObj[0].Title + '</h2>'); $('#subtitle_h...
[ "function loadData() {\n let url = generateApiFullString();\n console.log('Calling the API with the following URL:',url);\n fetch(url)\n .then(response => response.json())\n .then(data => updateHtml(data));\n }", "function loadLandingPageData(){\n fetch('ht...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set progress of a progress bar.
setProgress (value) { this.progressBar.style.width = (value || 0) +'%'; }
[ "setProgress(value) { this._behavior('set progress', value); }", "function SetProgress(bar, value){\n\n // temporarily animate the bar\n bar.classList.add(\"progress-bar-animated\");\n\n // set the bar's new value\n bar.style.width = value+\"%\";\n bar.setAttribute(\"aria-valuenow\", value);\n b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch JSON config file
_fetchConfig() { $.getJSON('assets/autocomplete/commandAutocompleteConfig.json') .done((response) => this.onConfigFetchedHandler(response)) .fail((jqXHR) => console.error(`Failed to load autocomplete configuration: ${jqXHR.status}: ${jqXHR.statusText}`)); }
[ "async getConfigFromJson() {\n if (!this.config) {\n try {\n let res = await fetch(_CONFIG_FILE_PATH,_FETCH_ARGS);\n return res.json();\n } catch(err) {\n console.log(err);\n return null; \n }\n } else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
writeTxInPrefixs encodes ti to the Decred protocol encoding for a transaction input (TxIn) prefix to w.
function writeTxInPrefix(input, arr8, position) { position = writeOutPoint(input, arr8, position); arr8.set(putUint32(input.sequence), position); return position + 4; }
[ "addPrefixes(prefixes, done) {\n // Ignore prefixes if not supported by the serialization\n if (!this._prefixIRIs) return done && done();\n\n // Write all new prefixes\n let hasPrefixes = false;\n for (let prefix in prefixes) {\n let iri = prefixes[prefix];\n if (typeof iri !== 'string') ir...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
tpmt is two power minus ten times t scaled to [0,1]
function tpmt(x) { return (Math.pow(2, -10 * x) - 0.0009765625) * 1.0009775171065494; }
[ "function tpmt(x) {\n return (Math.pow(2, -10 * x) - 0.0009765625) * 1.0009775171065494;\n }", "function tpmt(x) {\n return (Math.pow(2, -10 * x) - 0.0009765625) * 1.0009775171065494;\n}", "function mmtp(mm) {\n return mm*2.83464566929134\n}", "function tdist(v, t){\n return gamma((v+1)/2) / (Math.sq...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sends data to solr server
function sendData(postData){ var clientServerOptions = { body: JSON.stringify(postData), method: 'POST', headers: { 'Content-Type': 'application/json' } } // on response from server, log response let response = request('POST', 'http://localhost:8983/solr/getti...
[ "async function pushToSolr(data) {\n\tconsole.log(\"pushing to solr\");\n\ttry {\n\t\tconst result = await solrClient.update(data);\n\t\tconsole.log('Response:', result);\n\t} catch(e) {\n\t\tconsole.error(e);\n\t}\n}", "function sendData(postData){\n\n var clientServerOptions = {\n body: JSON.stringify...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start lobby button event listener Called when user clicks the 'Start Lobby' button
function start_lobby_click_listener($event) { chrome.runtime.sendMessage({ type: 'start_lobby' }, function (response) { if (response && response.type) { if (response.type === 'start_lobby_ack' && response.success) { // Update the view update_state(POPUP_STATE.In...
[ "function showLobby() {\n if (window.game.state === Game.states.DECKLIST) {\n ui.main.html(ui.lobby.html());\n ui.main.find(\"#lobby-ready\").on(\"click\", function(ev) {\n game.socket.send(JSON.stringify({ ready: true }));\n ev.target.classList.add(\"disabled\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save a blob to a local file
function savelocalfile(blob, filename) { if (window.navigator.msSaveOrOpenBlob) // IE10+ window.navigator.msSaveOrOpenBlob(file, filename); else { // Others var a = document.createElement("a"), url = URL.createObjectURL(blob); a.href = url; a.download = filename; document...
[ "function saveBlob(blob, name) {\n\t saveDataURL(URL.createObjectURL(blob), name);\n\t}", "static saveBlob(blob, filename)\n {\n let blobUrl = URL.createObjectURL(blob);\n\n let a = document.createElement(\"a\");\n a.hidden = true;\n a.href = blobUrl;\n a.download = filena...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Plus minus button input.
function clickPlusMinus() { if (dispError()) return; if (currentNumber===undefined) { if (storedNumber === undefined) return; currentNumber = -1 * storedNumber; digitAfterPeriod = String(currentNumber).split('.')[1] === undefined ? 0 : String(currentNumber).split('.')[1].length + 1; ...
[ "function cartPlusminus(){\n\n $('.cart-plus-minus').append('<div class=\"dec qtybutton\">-</div><div class=\"inc qtybutton\">+</div>');\n $('.qtybutton').on('click', function () {\n var $button = $(this);\n var oldValue = $button.parent().find('input').val();\n if ($b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This single value param component can be used when the param input accepts a single number
function SingleValueParam({ name, buttonName, mode, DEFAULT_VAL, ALGORITHM_NAME, EXAMPLE, formClassName, handleSubmit, setMessage, }) { const { dispatch, disabled, paramVal, setParamVal, } = useParam(DEFAULT_VAL); /** * The default function that uses the single value to * run an animati...
[ "set intParameter(value) {}", "addParam(value) {\n this._digitIsSub = false;\n if (this.length >= this.maxLength) {\n this._rejectDigits = true;\n return;\n }\n if (value < -1) {\n throw new Error('values lesser than -1 are not allowed');\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change the audio sources for when a bank change occurs
function setAudioSources() { if (bank == 1) { for (let i = 0; i < LETTERS.length; i++) { $("#" + LETTERS[i]).attr("src", SOUNDS[i + 9]); $("#" + makeValidText(i)).attr("id", makeValidText(i + 9)); } } else { for (let i = 0; i < LETTERS.length; i++) { $("#" + LETTERS...
[ "function changeSource()\n{\n\tif (!alarmRinging)\n\t{\n\n\t\taudio.src = 'audio/alarm.mp3'\n\n\t\talarmRinging = true;\n\t}\n}", "function swapSource(){\n\t\tlet currenttrack = this.dataset.currenttrack;\n\n\t\taud.src = `audio/${currenttrack}`;\n\t\taud.load();\n\t\taud.play();\n\t}", "updateAudioSource() {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete marker by unique ID
static deleteMarker(markerId) { }
[ "function deleteMarker() {\r\n\tmarkerArray.splice(1, 1);\r\n}", "function removeMarker(id){\r\n marker = markers[id];\r\n marker.setMap(null);\r\n delete markers[id];\r\n}", "destroyMarkerId(id) {\r\n this.destroyMarker(this._findMarkerIndex(id));\r\n }", "function removeMarker(marker){\n\t\t\t/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the hue gradient used for hsv
function getHueGradientHSV(sliderValues) { let col = hsvToRgb(0, sliderValues[1], sliderValues[2]); let ret = 'linear-gradient(90deg, rgba(2,0,36,1) 0%, '; ret += 'rgba(' + col[0] + ',' + col[1] + ',' + col[2] + ',1) 0%,' col = hsvToRgb(60, sliderValues[1], sliderValues[2]); ret += 'rgba(' + col[0...
[ "function calculateHSV(){\n\n // set a temporary value\n var t = hsl.s * (hsl.l < 50 ? hsl.l : 100 - hsl.l) / 100;\n\n // store the HSV components\n hsv =\n {\n 'h' : hsl.h,\n 's' : 200 * t / (hsl.l + t),\n 'v' : t + hsl.l\n };\n\n // correct a division-by-zer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempt to update the entity on the server failed or timedout. Action holds the error. If saved pessimistically, the entity in the collection is in the presave state you may not have to compensate for the error. If saved optimistically, the entity in the collection was updated and you may need to compensate for the err...
saveUpdateOneError(collection, action) { return this.setLoadingFalse(collection); }
[ "saveUpdateManyError(collection, action) {\n return this.setLoadingFalse(collection);\n }", "saveUpdateOneSuccess(collection, action) {\n const update = this.guard.mustBeUpdateResponse(action);\n const isOptimistic = this.isOptimistic(action);\n const mergeStrategy = this.extractMer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
private method that determines the image for the button
function setImage(){ btn.backgroundImage = btn.value ? btn.imageOn : btn.imageOff; }
[ "function ChangeButtonImage(iButton, iButtonNum, iNewImageType) \r\r\n{\r\r\n ChangeObjectImage(iButton, GetButtonImageFile(iButtonNum, iNewImageType));\r\r\n}", "function getBtnSRC() {\n if (gifState) {\n return '/pause.png';\n }\n return '/play.png';\n }", "function ie_norm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns null and logs warning if a single video segment does not have a vmaf score
function _getAverageVmafDelivered() { _sliceAll(playback.mediaTime.value); // use video for calculating total var videoSegments = PlayTimeTracker$_aggregatePlayTime(_playedVideo, PlayTimeTracker$_vmafAggregateFunction); var averageVmaf; try { averageVmaf = PlayTimeTr...
[ "function _hasVmaf() {\n return !!(_playedVideo[0] && _playedVideo[0].stream && isDefined(_playedVideo[0].stream.vmaf));\n }", "function getScore() {\n\t\treturn 0.0; //dummy\n\t}", "getScore() {\n if (!this.score) {\n // \tif (config.callGraph.dynamicallyInitializeCallGraph) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private Variables Good! But what if an object wants to keep some information hidden? Just as functions can have local variables which can only be accessed from within that function, objects can have private variables. Private variables are pieces of information you do not want to publicly share, and they can only be di...
function Person(first,last,age) { this.firstname = first; this.lastname = last; this.age = age; var bankBalance = 7500; this.getBalance = function() { // your code should return the bankBalance return bankBalance; }; }
[ "function Person (name,last,age){\n this.firstName = first;\n this.lastName = last;\n this.age = age;\n // private variable\n var bankBalance = 7500;\n\n // private method\n var returnBalance = function (){\n return bankBalance;\n };\n\n// askTeller is public\n// create askTeller \n this.askTeller = fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
normalize the source object
function normalizeSource(source) { if (source.className) { if (typeof source.className == 'string') { source.className = source.className.split(/\s+/); } }else{ source.className = []; } var normalizers = fc.sourceNormalizers; fo...
[ "normalize(data) {\n return Processor.normalize(this, data);\n }", "function cleanUpObject( src ) {\n let ret = { };\n Object.assign( ret, src );\n // undefined properties are kept in database as null because of mongoose mixed type. remove them:\n // this should be recursive to clean up all levels.....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the "balances" object in global state based on the current initial balances:
recalculateBalances() { const { initialRaw, initialCooked } = this.state.balances; const { currentRaw, currentCooked } = this.wasm.getCurrentBalances( initialRaw, initialCooked ); this.state.balances = { initialRaw, currentRaw, initialCooked, currentCooked }; }
[ "function initialBalanceUpdate(){\n\tbalance = balance - betAmount;\n\tsetBalance(balance);\n}", "initialBal() {\n\t\t// 2. Add to transaction history\n\t\tlet bankAccount = searchAcctHolder(bankNum);\n\t\t// 3. Update new balance\n\t\tthis.balance = bankAccount.balance;\n\t}", "function updateAllBalances() {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make a server call to format the text of the given date widget.
function formatDate(widget) { if (widget.data("bean").isValid()) { toolboxService.formatDate(widget.val(), function(result) { widget.val(result); }); } }
[ "function date_to_text() {\n\n var date_text_el = $('#text_data');\n\n var from_str = date_to_str(get_date_from());\n var to_str = date_to_str(get_date_to());\n\n date_text_el.html(from_str + ' - ' + to_str);\n }", "function setDateText(date)\n{\n var dateText = document.getEleme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks to see if dice roll is a full house
function fullHouse() { if (((diceArray[0] === diceArray[1] && diceArray[2] === diceArray[0]) && (diceArray[3] === diceArray[4]) && diceArray[0] !== diceArray[4]) || ((diceArray[0] === diceArray[1]) && (diceArray[3] === diceArray[2] && diceArray[3] === diceArray[4]) && diceArray[0] !== diceArray[4])) { return 25; ...
[ "function isFullHouse (dieRoll) {\n var counts = _.values(getCountPerValue(dieRoll));\n\n // A full house requires two of a kind and three of a kind\n return counts.includes(2) && counts.includes(3);\n}", "function isFullHouse(arr) {\n\tlet newArr = countDice(arr);\n\tif (newArr.length === 2) {\n\t\tif (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function which takes a head of a function, a list of bound variables (i.e. the variables argument) of the parent function, and a list of temporary metavariables. Returns an expression which will become the body of the imitation function. This is an application of the form: head(temp_metavars[0](bound_vars),...,t...
function createBody(head, bound_vars, temp_metavars, bind, binding_variables) { var args = []; for (var i = 0; i < temp_metavars.length; i++) { var temp_metavar = temp_metavars[i]; args.push(makeExpressionFunctionApplication(temp_metavar, bound_vars)); } if (bind) { // should be only...
[ "function partial() {\n var args = Array.prototype.slice.call(arguments, 0),\n subpos = args.reduce(function (blanks, arg, i) {\n return arg === _ ? blanks.concat([i]) : blanks;\n }, []);\n\n if (subpos.length === 0) {\n return args[0].apply(undefined, a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getMeta_og is the main function to get OpenGraph meta tags and process using OpenGraph meta reg.
function getMeta_og(html, field) { var Regs = Regex.metaRegGenrator_og(field); if (!(Regs.a && Regs.b)) { return ''; } try { var result = html.match(Regs.a); if ( bvalid.isArray(result) && bvalid.isString(result[1]) && result[1].trim().length != 0 ) { return result[1].tri...
[ "function applyOpenGraphMetaProperties (html, config) {\n var og = config.browser.openGraph;\n for (var key in og) {\n html.push(' <meta property=\"og:' + key + '\" content=\"' + og[key] + '\" />');\n }\n}", "function ogMeta(metaData) {\n\treturn Object.keys(metaData)\n\t\t// only use keys beginning with...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Launchs the next app for inspection if available
function launcher() { if(apps.length > 0 && running < limit) { var app = apps.shift() if(app !='') { util.puts('Starting Process: ' + app.replace(root, '')) running++ inspect(app) } } else if(apps.length == 0 && running == 0) done() }
[ "function openApp(){\n $('.open-app').click(function(){\n app_info.forEach(function(app){\n if($('.open-app').attr('name') == app.name){\n window.open(app.short_url , \"_blank\");\n }\n })\n })\n }", "function launchApp() {\n\tconsole.log('launching app...');\n\tch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads the URL of a RDF document, makes a RDF databank, and passes it to a callback. Purely experimental.
function DoLoadRdfUrl( the_url_nomode, processingFunc, showErr, divErrMsg ) { var the_url = CheckMode(the_url_nomode,"rdf"); /* * http://stackoverflow.com/questions/5355667/strange-underscore-param-in-remote-links * * I get links like: http://localhost:3000/products?_=1300468875819&page=1 * To disable the...
[ "createRdf(){\n// serialize a document to N-Quads (RDF)\n this.rdf=\"\";\n let doc = this.content;\n jsonld.toRDF(doc, {format: 'application/nquads'}, (err, nquads) => {\n this.rdf+=nquads;// nquads is a string of N-Quads\n console.log('got nquads',nquads,err)\n let data = new Blob([this.rdf...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
attempts to resolve citeproc metadata for all works onDone is passed an array of Jquery ajax results (both successes and failiure)
function fetchCiteprocJSONForSimpleWorks(simpleWorks, onDone){ var requests = []; simpleWorks.forEach(function(obj){ var d = fetchCiteprocJSONForSimpleWork(obj); requests.push(d); }); $.when.all(requests).done(onDone); }
[ "function resolveCiteproc(results){\n\t\t\tvar citeprocJSONArray = [];\n\t\t\tvar id = 0;\n\t\t\tfor (r in results){\n\t\t\t\tif (results[r][1] == \"success\" && results[r][0].responseJSON){\n\t\t\t\t\tciteprocJSONArray[id] = results[r][0].responseJSON;\n\t\t\t\t\tciteprocJSONArray[id].id = \"\"+id;\n\t\t\t\t\tid++...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::WAFv2::LoggingConfiguration.SingleHeader` resource
function cfnLoggingConfigurationSingleHeaderPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnLoggingConfiguration_SingleHeaderPropertyValidator(properties).assertSuccess(); return { Name: cdk.stringToCloudFormation(properties.name), };...
[ "function cfnWebACLSingleHeaderPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnWebACL_SingleHeaderPropertyValidator(properties).assertSuccess();\n return {\n Name: cdk.stringToCloudFormation(properties.name),\n };\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::IoTEvents::AlarmModel.Firehose` resource
function cfnAlarmModelFirehosePropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnAlarmModel_FirehosePropertyValidator(properties).assertSuccess(); return { DeliveryStreamName: cdk.stringToCloudFormation(properties.deliveryStreamName), ...
[ "function cfnApplicationOutputKinesisFirehoseOutputPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnApplicationOutput_KinesisFirehoseOutputPropertyValidator(properties).assertSuccess();\n return {\n ResourceARN: cdk.stringToCloudForm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a replaceBadWords (string) function which 1) breaks a phrase into words, 2) replaces bad words with asterisks (). When solving this problem, you need to break the array into words using the .split ("") function, after which the array will need to be pasted .join ("") Bad words: shit and fuck. Provide an opportun...
function replaceBadWords(string){ let stringLower = string.toLowerCase(); let arr = stringLower.split(' '); let arrRes = arr.map((item)=>{ if(item.includes(`fuck`)){ return item.replace(`fuck`, `****`); }; if(item.includes(`shit`)){ return item.replace(`sh...
[ "function cleanUpStory(cleanBadWord){\n let arr = cleanBadWord.split(' ')\n const sampleLetter = ['.', ':', '!', '?', \"'\",\"'\", \",\"]\n const newArray = arr.map(word =>{\n sampleLetter.forEach(letter => {\n if(word.includes(letter)){\n word = word.replace(letter,'')\n }\n })\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
... EFFECT SIZE ........................................................................................................................................................................................
function effect_start_size(element){ var size = 'width'; var length = '50%'; if($('#'+element).data('effect-size-direction')!==undefined && $('#'+element).data('effect-size-direction')!=''){ size = $('#'+element).data('effect-size-direction'); } if($('#'+element).data('effect-size-length')!==undefined &...
[ "_setEventSize () {\n this.setLogActions(\"showSizeGame\", this.sizeGame);\n }", "changeSize() {\n // Smooth amplitude to reduce the unwanted noise in the size of the drop\n this.amplitude.smooth(0.9);\n // Set the level variable to the actual amplitude of the sound\n this.level = this.ampli...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the name color for user editing
function setNameColor(color){ $(".identifier span").css({"color": "#" + color}); newNameColor = "#" + color; }
[ "function handleSetName({ name, color }) {\r\n console.log(`Setting user name for ${name} with color: ${color}`);\r\n // Find user in array\r\n const [user, index] = findUserObject(socket);\r\n\r\n // update\r\n if (user) {\r\n updateUserName(socket, name, color);\r\n } else {\r\n consol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
advance the animation's frequency time wheels. advance frequency time wheels for any live transitions also
function turnFrequencyTimeWheels(deltaTime, speed) { var wheelAdvance = 0; // turn the frequency time wheel if (motion.currentAnimation === motion.selectedWalk || motion.currentAnimation === motion.selectedSideStepLeft || motion.currentAnimation === motion.selectedSideStepRight) { ...
[ "animate() {\n\n\t\tif (this.frequency) this.updateBpm();\n\t\tthis.injectBpm();\n\n\t}", "updateTimers() {\n if (this.delayTimer > 0) {\n this.delayTimer -= 1;\n }\n\n this.speaker.emulateCycle();\n }", "function changeFrequency() {\n if (speed != 0) {\n if (speed < 0 && currentFreq > firstF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
filter user: 1.user.universal = true; 2.user is not the existing user list;
function filterUsers() { var usersIds = getUsersId(); return allUsers.map(function(el) { if (!el.universal && usersIds.indexOf(el.id) < 0) { return el; } }); }
[ "static filterApptUserData(user) {\n return {\n name: user.name,\n email: user.email,\n phone: user.phone,\n id: user.id,\n photo: user.photo,\n type: user.type,\n };\n }", "static filterRequestUserData(user) {\n return {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Manages a process's execution for the given amount of time Processes that have had their states changed should not be affected Once a process has received the alloted time, it needs to be dequeue'd and then handled accordingly, depending on whether it has finished executing or not
manageTimeSlice(currentProcess, time) { // manages and keeps track of how much time has elapsed; similar to the function executeProcess in Process.js if (currentProcess.isStateChanged()) { // check if process is in the blocking queue or not this.quantumClock = 0; return; } ...
[ "executeProcess(time) {\n // set stateChanged to be false in case we receive a process that used to be blocking and we want it to be running again it needs to be toggled back to false.\n this.stateChanged = false;\n // if no blocking time is needed by this process\n if (this.blockingTimeNeeded === 0) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }