query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Checks if a field has any messages
function hasMessage(id) { var fieldId = getAttributeId(id); var messageData = getValidationData(jQuery("#" + fieldId)); if (messageData && (messageData.serverErrors.length || (messageData.errors && messageData.errors.length) || messageData.serverWarnings.length || (messageData.warnings && messag...
[ "function isMessageValid() {\n return $message.val().length > 0;\n }", "function handleMessagesAtField(id, pageSetupPhase) {\n var field = jQuery(\"#\" + id);\n var skip = field.data(\"vignore\");\n\n if (pageSetupPhase == undefined) {\n pageSetupPhase = false;\n }\n\n //check to see...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get amount from input field and reset
function getAmountandSetBlank(){ var amount = Math.round($('#amount').val() * 100)/100; $('#amount').val(''); return amount; }
[ "function getAmount() {\n let amount = getInput.value;\n createBoxes(amount);\n}", "function checkAndUpdateInputSellAmount ()\n{\n if (SellCurrency.value != \"void\" && BuyCurrency.value != \"void\" && inputSellAmount.value != \"\")\n updateBuyValue(parseFloat(inputSellAmount.value), SellCurrency.valu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assert can navigate from Status to the related BillingDetails
function NavFromStatus(data) { var status = data.results[0]; var type = data.query.fromEntityType.shortName; if (!status) { ok(false, "a query failed to return a single " + type); } else if (typeof status.BillingDetails !== 'function') { ok(false, type + " doesn...
[ "NavigateToProperPage() {\n console.log('this.accRecord.Application_Current_Stage__c '+ this.accRecord.Application_Current_Stage__c )\n if(this.accRecord.Application_Current_Stage__c == 'Not Started'){\n this.currentStep=\"1\"\n this.navigateToGeneralInfo()\n }\n // If Current Stage == Person...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
number formatting function copyright Stephen Chapman 24th March 2006, 10th February 2007 permission to use this function is granted provided that this copyright notice is retained intact
function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) { var x = Math.round(num * Math.pow(10,dec)); if (x >= 0) n1=n2=''; var y = (''+Math.abs(x)).split(''); var z = y.length - dec; if (z<0) z--; for(var i = z; i < 0; i++) y.unshift('0'); y.splice(z, 0, pnt); if(y[0] == p...
[ "function FormatNumber(srcStr, nAfterDot){\r\n\tvar srcStr,nAfterDot;\r\n\tvar resultStr,nTen;\r\n\tsrcStr = \"\"+srcStr+\"\";\r\n\tstrLen = srcStr.length;\r\n\tdotPos = srcStr.indexOf(\".\",0);\r\n\tif (dotPos == -1){\r\n\t\tresultStr = srcStr+\".\";\r\n\t\tfor (i=0;i<nAfterDot;i++){\r\n\t\t\tresultStr = resultStr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find a panel by specified property, return the panel object or panel index.
function findBy(container, property, value, all){ var me = container; var panels = me.panels; var pp = []; for(var i=0; i<panels.length; i++){ var p = panels[i]; if (property){ if (p[property] == value){ pp.push(p); ...
[ "function arr_findIndex(arr = [], prop = \"\", val) {\n\treturn arr.findIndex(v => { return v && v[prop] === val })\n}", "function getPaneById(id) {\n return refs.panes.querySelector(`#${id}`);\n}", "function obj_find(obj, prop, val) {\n\tfor (let k in obj) {\n\t\tlet v = obj[k]\n\t\tif (v[prop] === val)\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
delete tables. tables is an array of strings. will be deleted in order
function deleteTables(tables) { console.log('Dropping database tables'); for(let t of tables) db.exec('DROP TABLE IF EXISTS ' + t); }
[ "function delTable(table){\r\n\tvar size = tablearr.length;\r\n\tvar indice = -1;\r\n\tvar pos = 0;\r\n\tvar found = false;\r\n\t\r\n\tif (size > 0){\r\n\t\twhile (found == false && pos < size){\r\n\t\t\tif (tablearr[pos] == table){\r\n\t\t\t\tfound = true;\r\n\t\t\t\tindice = pos;\t\r\n\t\t\t}else{\r\n\t\t\t\tpos ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END GET INFO MINCUT UPDATE MINCUT MANAGER / updateMincutManager updates mincut manager
function updateMincutManager(formData, tabName, device, cb) { try { _self.emit("log", "mincut.js", "updateMincutManager(" + tabName + "," + device + ")", "info", formData); var dataToSend = {}; //dynamic attributes for (var k in formData) { if (formData.hasOwnProperty(k)) { if ...
[ "function getMincutManager(device, cb) {\n try {\n _self.emit(\"log\", \"mincut.js\", \"getMincutManager(\" + device + \")\", \"info\");\n\n var dataToSend = {};\n dataToSend.device = _device;\n dataToSend.token = _token;\n dataToSend.what = 'GET_MINCUT_MANAGER';\n dataToSend.expect...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a Course Object and fill this object's props with txtLine
createCourse(txtLine){ let words = txtLine.split("\t"); let course; course = new Course(words[0], words[1], words[2], words.slice(3)); return course; }
[ "createStudent(txtLine){\r\n let words = txtLine.split(\"\\t\");\r\n let student;\r\n let studentCourseList = this.findStudentCourses(words.slice(3));\r\n student = new Student(words[0], words[1], words[2], studentCourseList);\r\n return student;\r\n }", "addCoursesToMap(txt,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Take all files matching the patterns in config.js and order them by the order specified with the patterns in config.jsOrder
function getOrderedJsFiles() { return gulp.src(paths.js) .pipe(plugins.order(paths.jsOrder)) }
[ "function getAllIncludedJS(foldername, filenames) {\n // Default binding\n let JSfilenames = ['assert.js', 'sta.js'];\n filenames.forEach(filename =>\n JSfilenames = JSfilenames.concat(getIncludedJS(foldername, filename)));\n //Deduplication\n JSfilenames = JSfilenames.filter((item, pos) => JSfilenames.inde...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse out a list of components for reactants or products rawComponents: The list of components returns: The parsed list of EquationComponent objects
function parseEquationComponents(rawComponents){ let comps = []; for(var i = 0; i < rawComponents.length; i++){ let c = rawComponents[i]; comps.push(new EquationComponent( c[EQUATION_COMPONENT_PROPERTY_COEFFICIENT], new ChemProperties(c[EQUATION_COMPONENT_PROPERTY_ID]) ...
[ "function parseEquations(rawEquations){\n for(var i = 0; i < rawEquations.length; i++){\n let eq = rawEquations[i];\n let reacts = parseEquationComponents(eq[EQUATION_PROPERTY_REACTANTS]);\n let prods = parseEquationComponents(eq[EQUATION_PROPERTY_PRODUCTS]);\n makeEquation(eq[EQUATIO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the playback loop
setLoop(loop) { this._loop = loop; this.audio.loop = loop; }
[ "function setLoopProper() {\n\t\tif (this.looping) {\n\t\t\tthis.audio.setAttribute('loop', 'loop');\n\t\t} else {\n\t\t\tthis.audio.removeAttribute('loop');\n\t\t}\n\t}", "toggleLoop() {\r\n this.setLoop(!this._loop);\r\n }", "startLoop() {\n clearTimeout(this.persistentLoop);\n this.persis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use for multi grunt.registerTask() inside use initSpriteTypeList()
function registerMultiSprite() { var obj; obj = initSpriteTypeList(); for(var key in obj) { var objKeyLength = obj[key].length; if(objKeyLength == 1) { grunt.registerTask(key, ['sprite:' + obj[key].toString().substr(1) + key]); } else { for(var i = 0; i < objKeyLength...
[ "createTasks() {\n let jobProfile = null; // \"arwen_express\" or \"arwen_cpu\" for example\n let management = {\n 'jobManager': this.jobManager,\n 'jobProfile': jobProfile\n };\n return this.nodes.map((n) => {\n return new taskModules[n.tagtask](manageme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function question that calculates percentage and display the result based on the score a user gets
function calculatePercentageAndDisplayResult(score) { let percentage = ((Number((score/7)*100))).toFixed(2); if (percentage=>0 && percentage<=50){ document.getElementById("outputDiv").innerHTML = `<span class="redColor">Your score is: ${percentage}%</span>` ; } if(percentage>50 && percentage<80)...
[ "function getPercentage(score)\n{\n var percentage = {\n \"0\": \"0\",\n \"1\": \"1.3\",\n \"2\": \"2.2\",\n \"3\": \"3.2\",\n \"4\": \"4.0\",\n \"5\": \"6.7\",\n \"6\": \"9.8\",\n \"7\": \"9.6\",\n \"8\": \"6.7\",\n \"9\": \"15.2\"\n };\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
will overwrite obj1 property values with those from obj2, unless they are already defined
function overwriteObjectUndefineds(obj1, obj2){ for(var prop in obj2){ if(typeof obj1[prop] === 'undefined'){ obj1[prop] = obj2[prop]; } } return obj1; }
[ "function objMerge(obj1, obj2) {\n if ((typeof obj1 != 'object') || (typeof obj2 != 'object')) {\n return;\n }\n \n for (var prop2 in obj2) {\n obj1[prop2] = obj2[prop2];\n }\n \n return obj1;\n}", "function MergeRecursive(obj1, obj2) {\n\n for (var p in obj2) {\n try {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Functions // Attempts to retrieve the MVT id from a cookie, or sets it.
function getMvtId(): number { const mvtIdCookieValue = cookie.get(MVT_COOKIE); let mvtId = Number(mvtIdCookieValue); if (Number.isNaN(mvtId) || mvtId >= MVT_MAX || mvtId < 0 || mvtIdCookieValue === null) { mvtId = Math.floor(Math.random() * (MVT_MAX)); cookie.set(MVT_COOKIE, String(mvtId)); } retur...
[ "function kva_uuid() {\n var uuid = Cookies.get('kva_uuid');\n if (typeof uuid === 'undefined') {\n Cookies.set('kva_uuid', UUID(), {expires: 365});\n uuid = Cookies.get('kva_uuid');\n }\n return uuid;\n}", "function varifyId(idToVarify) {\n var findId =\n \"https://api.themoviedb.or...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function report bug of story
function storyMenuReport() { storyMenuClick(); if (accountGlobal.id === 0) return; data.forEach((val, index) => { if (val.id === accountGlobal.id) { data[index].bug.status = 1; data[index].bug.initial = 1; return; } }) document.getElementById(`stor...
[ "function bugGeneration() {\n let time = Math.random() * 3000 + 2000;\n setTimeout(() => {\n createBug();\n bugGeneration();\n }, time);\n }", "function failure() {\n return { solution: false };\n}", "function getStory() {\n return story;\n}", "function conf...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts private & public part of given key to ASN1 Hex String.
function _rsapem_privateKeyToPkcs1HexString(rsaKey) { var result = _rsapem_derEncodeNumber(0); result += _rsapem_derEncodeNumber(rsaKey.n); result += _rsapem_derEncodeNumber(rsaKey.e); result += _rsapem_derEncodeNumber(rsaKey.d); result += _rsapem_derEncodeNumber(rsaKey.p); result += _rsapem_der...
[ "encodeKey(key) {\n return `${key.hostname}+${key.rrtype}`\n }", "getPrivKey() {\n var output = PrivKeyAsn1.encode({\n d: this.key.priv.toString(10),\n }, \"der\")\n return output.toString('hex')\n }", "function _rsapem_publicKeyToX509HexString(rsaKey) {\n var encodedId...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
newBoard.player.erasePrevious(); newBoard.enemy1.erasePrevious(); newBoard.enemy2.erasePrevious(); newBoard.enemy3.erasePrevious(); newBoard.potion1.erasePrevious(); newBoard.potion2.erasePrevious(); newBoard.updateBoard(); newBoard.player.render(); newBoard.enemy1.render(); newBoard.enemy2.render(); newBoard.enemy3.re...
function moveSomething(e) { function moveLeftRight(xVal){ var newX = xVal; board.player.xPrev = board.player.x; board.player.yPrev = board.player.y; board.player.x = newX; board.player.y = board.player.y; board.position[newX][board.player.y] = 4; board.position[board.player.xPrev][board.p...
[ "undoMove()\r\n {\r\n game.pastBoards.pop();\r\n let lastAnimation = game.pastAnimations.pop();\r\n\r\n\r\n //Restores board \r\n game.board = game.pastBoards[game.pastBoards.length-1];\r\n \r\n //Retrieves information from last move\r\n let pieceName = lastAnimat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves selected item to the medium priority combo box above
function moveItemUpToMediumPriorityList() { jQuery('#lowPriorityList option:selected').appendTo('#mediumPriorityList'); jQuery('#lowPriorityList option:selected').remove(); jQuery('#mediumPriorityList option:selected').prop("selected", false); }
[ "function moveItemDownToLowPriorityList() {\n jQuery('#mediumPriorityList option:selected').appendTo('#lowPriorityList');\n jQuery('#mediumPriorityList option:selected').remove();\n jQuery('#lowPriorityList option:selected').prop(\"selected\", false);\n}", "function moveItemUpToHighPriorityList() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Increasing the least upvote in the array object by 1 using map
function increaseLeastMap() { feedArray.map(function(allElement){ if(mini==allElement.upvotes) allElement.upvotes++; }) console.log(feedArray); }
[ "function vote() {\n for (party in total_votes_per_party) {\n if (total_votes_per_party[party] > 0) {\n // Calculate the increment for this party\n var increment = Math.round(multiplier * Math.random());\n // Vote and then remove those votes from the counters\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
6. The call back should loop through the response and console.log every item name
function getAllItemsCallback(response){ }
[ "function getItems() {\n fetch('http://genshinnews.com/api')\n .then(response => response.text())\n .then(data => {\n discordHooks = JSON.parse(`[${data}]`)\n webhookLoop(discordHooks)\n });\n }", "function showList(a_oItems, g_nLoc){\n \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if node is an empty paragraph.
function isEmptyParagraph(node) { return (!node || (node.type.name === 'paragraph' && !node.textContent && !node.childCount)); }
[ "function isEmptyDocument(node) {\n var nodeChild = node.content.firstChild;\n if (node.childCount !== 1 || !nodeChild) {\n return false;\n }\n return (nodeChild.type.name === 'paragraph' &&\n !nodeChild.childCount &&\n nodeChild.nodeSize === 2);\n}", "function isEmptyNode(node) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
nearbyCommunities takes in a coordinate and returns a callback with the key/names of 3 nearby communities
function nearbyCommunities(coordinates, callback){ var formattedNearbyCity0 = geolib.findNearest(coordinates,Directories.formattedCityCoordinatesDirectory,0); var formattedNearbyCity1 = geolib.findNearest(coordinates,Directories.formattedCityCoordinatesDirectory,1); var formattedNearbyCity2 = geolib.findNea...
[ "function nearestCommunity(coordinates,callback){\n //a coordinate object representing the closest community in our \"cities\" object\n var community = geolib.findNearest(coordinates,Directories.cityCoordinatesDirectory,0);\n callback(community.key);\n}", "function wikidata_user_nearby_city(user_lat, use...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return query that will be appeneded to url when requesting logs
function generateURLQuery() { var url=window.default_query + "&xml=1&order_by=log_id"; if (window.last_log_id != -1) url += "&log_id_op=>&log_id="+window.last_log_id; else url += "&date_from="+window.start_date+"&date_from_unit=gregorian"; if(window.user_id) url += "&user_id="+window.user_id; r...
[ "function radLogger(req, res, next) {\n console.log(req.query) //req.query is the query in object form\n next();\n}", "function buildSolrQueryString(){\n\n\tvar querystring = window.location.search;\n\tif(!querystring.match(/fq=/)) return \"\";\n\t// get rid of values not used by Solr: t, d, and q (which...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return null if null in area
_getAreaZero() { let newArr = []; this.area.map(el => { newArr.push(...el) }); return newArr.some(el => el === null); }
[ "GetEntityPosition( entity ) { return null; }", "getLocation(name) { return this.#locations_.get(name) ?? null; }", "get area() { return this.height * this.width; }", "function areaDisponibleInterno(coordenada, areaOcupadaInterna){\n let puntoValido = true;\n let puntoDentro = recorreArrayAre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Serialie a Payment into buffer to transport on the network.
function serializePayment(payment: Payment): Buffer { const toData = payment.to.converseToBuffer(); const data = Buffer.alloc(8 + toData.length); data.writeUInt32LE(payment.amount, 0); toData.copy(data, 8); return data; }
[ "function paymentFromComponent(req, res, next) {\n const reqDataObj = JSON.parse(req.form.data);\n if (reqDataObj.cancelTransaction) {\n return handleCancellation(res, next, reqDataObj);\n }\n const currentBasket = BasketMgr.getCurrentBasket();\n let paymentInstrument;\n Transaction.wrap(() => {\n colle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function 'deleteOneLocation' to remove a location (from both the xref table and the location table)
deleteOneLocation(id) { return db.none(` DELETE FROM location WHERE id = $1 `, id); }
[ "function targetDel(target) {\n var pings = pingTable.query({parentId : target.getId()});\n for (var i=0; i<pings.length; i+=1)\n pings[i].deleteRecord();\n target.deleteRecord();\n }", "function delTable(table){\r\n\tvar size = tablearr.length;\r\n\tvar indice = -1;\r\n\tvar po...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a nice popping animation for appearing visit symbols.
function animateSymbol(s) { // create a white outline and explode it var c = map.paper.circle().attr(s.path.attrs); c.insertBefore(s.path); c.attr({ fill: false }); c.animate({ r: c.attrs.r * 3, 'stroke-width': 7, opacity: 0 }, 2500, ...
[ "function animacionGmOver() {\n\tconsole.log(\"Perdiste AMEEEEO!!\");\n}", "function AnimateSocialIcons() {\n TweenMax.from(\".bubble\", 1, {\n autoAlpha: 0,\n ease: Back.easeOut\n })\n TweenMax.from(\".social a\", 1, {\n opacity: 0,\n scale: 0,\n ease: Back.easeOut,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update global microservice configuration based on identifier.
function updateGlobalConfiguration(axios$$1, identifier, config) { return restAuthPost(axios$$1, 'instance/microservice/' + identifier + '/configuration', config); }
[ "function getGlobalConfiguration(axios$$1, identifier) {\n return restAuthGet(axios$$1, 'instance/microservice/' + identifier + '/configuration');\n }", "function updateTenantConfiguration(axios$$1, tenantToken, identifier, config) {\n return restAuthPost(axios$$1, 'instance/microservice/' + identifier + '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders all tiles inside an area with a given zoom level.
function renderLevel(args,cb){ var bbox = args.bbox; var xyz = mercator.xyz(bbox, args.z); var alltiles = []; var i = 1; var total = (xyz.maxX - xyz.minX + 1) * (xyz.maxY - xyz.minY+ 1); for (var x = xyz.minX; x <= xyz.maxX; x++) { for (var y = xyz.minY; y <= xyz.maxY; y++) { ...
[ "function onZoom()\r\n{\r\n\tevaluateLayerVisibility();\r\n\t$(\"#zoomlevel\").val(Math.floor(map.getView().getZoom()));\r\n}", "renderTiles() {\n for (const [key, value] of config.tiles.entries()) {\n for (const tile of value) {\n const tileToAdd = new _tile.TileSprite({\n game: this.game...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the weight of a matched post/page/category/tag.
function weight(keywords, obj, fields, weights) { var value = 0; parseKeywords(keywords).forEach(function(keyword) { var pattern = new RegExp(keyword, "img"); // Global, Multi-line, Case-insensitive fields.forEach(function(field, index) { if (obj.hasOwnProperty(field)) { var matche...
[ "function getUrlWeight(url){\n var weights = {\n '/Account/': 0, // Customer Sign-In\n '/Report.aspx': 0, // Printable report\n '/GiveFeedback/': 0, // Give feedback about a member\n '/Search/': 0.1, // Good for building the network, but I think there are infinite searc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTIONS///// /scales landing to window
function scaleLanding() { $("#landing_content_div").css({ height: "80%", width: "80%" }); $("#landing_svg_bg").css({ height: "100%", width: "100%" }); if ( $("#landing_content_div").height() > $("#landing_content_div").width()*landingSvgRatio ) { $("#landing_svg_bg").height( $("#landing_content_div").width()*...
[ "setLeftHalf() {\n let viewPort = {};\n viewPort.x = 0;\n viewPort.y = 0;\n viewPort.width = global.screen_width / 2;\n viewPort.height = global.screen_height;\n this._setViewPort(viewPort);\n this._screenPosition = GDesktopEnums.MagnifierScreenPosition.LEFT_HALF;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Register each scene on the Scene Manager
function registerScenes() { var j = scenes.length; var scenesRegistered = 0; SM.EE.addListener('scene:register', function() { scenesRegistered++; console.log('%cRegister scene '+ scenesRegistered, 'color: #0000ff'); load += 80 / scenes.length; ee.emitEvent('loader:update',...
[ "function SceneManager()\n {\n EventEmitter.call(this);\n this.meshes = {};\n } // end SceneManager", "LoadScene()\n {\n\n if ( this.__loaded )\n {\n console.error( \"Unable to load scene, already loaded \" )\n return;\n }\n\n this.LocalScen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Vertex format: x, y, z, ambient occlusion packed_normal, tex_size, tex_id_hi, tex_id_lo Note: packed_normal is 6 bits (out of 8) tex_size is 3 or 4 bits in practice (out of 8) so there are 6 or 7 bits available for future expansion Voxel format: Max 16 bits per voxel Bit 15 is opacity flag (set to 1 for voxel to be sol...
function voxelTexture(voxel, side, voxelSideTextureIDs) { return voxelSideTextureIDs ? voxelSideTextureIDs.get(voxel&0x7fff, side) : voxel&0x7fff }
[ "function show_texture() {\n let index = this.getAttribute(\"data-index\");\n empty_all();\n\n let height = data_editor.dom.config.offsetHeight - 10;\n let texture_container = DOM.cdiv(data_editor.dom.config, null, \"texture_container\");\n let texture_path = \"/3dshapes/\" + shapegroup_key + \"/\" +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Produces an object in which each key is a price table (like small) and the fields are objects that map product ids to its prices
getPriceMap(priceTable) { return priceTable.reduce((prev, curr) => { // eslint-disable-next-line no-shadow const { type, values } = curr const priceMap = values.reduce( (currMap, itemPrice) => ({ ...currMap, [itemPrice.id]: itemPrice.price, }), {} ...
[ "function initProductsVar(productsPrices) {\n\tvar products = {};\n\n\tfor (var i = 0; i < productsPrices.length; i++) {\n\t\tvar imagePath = productsPrices[i];\n\t\tvar productName = productNameFromImagePath(imagePath);\n\n\t\t// All quatities are initialized to 5:\n\t\tproducts[productName] = 5;\n\t}\n\n\treturn ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new (empty) document and display it.
function createDocument() { current = { html : "", subject : "", userURI : [ "foo" ] }; console.log("createDocument() = " + JSON.stringify(current)); showNewDocument(); }
[ "function newDoc() {\n docCounter++;\n const newDoc = {\n id: 'doc-' + docCounter,\n title: 'Untitled ' + docCounter,\n newPlayerCount: 0,\n newTextCount: 0,\n newRectCount: 0,\n newCircleCount: 0,\n newLineCount: 0,\n selectedObject: null,\n stag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to pull player homeruns and divide by the number of games to determine average home runs per game.
function homerunspergame (player) { return player.homeruns / player.games; }
[ "function batspergame (player) {\n\treturn player.atbats / player.games;\n}", "function triplespergame (player) {\n\treturn player.triples / player.games;\n}", "function getWeekScore(results) {\n var score = 0;\n var average = 0;\n\n for (result in results) {\n score += Math.round(results[result...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assigns value for the main chart's main property, that has the given key
handleMainPropertyChange(key, value) { const state = this.state; state.configuration[key] = value; this.setState(state); this.props.onConfigurationChange(state.configuration); }
[ "handleSubChartPropertyChange(key, value) {\n const state = this.state;\n state.configuration.charts[0][key] = value;\n this.setState(state);\n this.props.onConfigurationChange(state.configuration);\n }", "function setExprProp(eID, {key, value}) {\n\t\tCalc.setExpression({\n\t\t\tid...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[SECTION] Demo Window / ShowDemoWindow() We split the contents of the big ShowDemoWindow() function into smaller functions (because the link time of very large functions grow nonlinearly) static void ShowDemoWindowWidgets(); static void ShowDemoWindowLayout(); static void ShowDemoWindowPopups(); static void ShowDemoWin...
function ShowDemoWindow(p_open = null) { done = false; // IM_ASSERT(ImGui.GetCurrentContext() !== null && "Missing dear imgui context. Refer to examples app!"); // Exceptionally add an extra assert here for people confused with initial dear imgui setup // Examples Apps (accessible from the "E...
[ "function ShowDemoWindow(parent, init)\n{\n var window = two.ui.window(parent, 'ImGui Demo', two.WindowState.Default | two.WindowState.Menu);\n\n var body = two.ui.scrollable(window.body);\n //var scrollsheet = two.ui.scroll_sheet(window.body);\n //var body = scrollsheet.body;\n\n if(window.menu)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add or update organisation vendor by using action type(add/update)
function addOrUpdateOrgVendor(request,reply){ //var _addUpdateUserId=1;//get from token if (metadatafile.saveMetadata(request.payload.metadata)) { var _msg; async.waterfall([ function(callback){ userModel.getUserIdByEmail(request.auth.credentials.email, function(err, res) { i...
[ "function postEditCommodityAPI() {\n var msg = callAPI(uRL + '/' + idManufacturer, \"GET\");\n if(msg)\n {\n $('#manufacturer-id').val(msg['tradeId']);\n $('#manufacturer-name').val(msg['companyName']);\n $('#manufacturer-address').val(msg['address']['street']);\n }\n else\n {\n alert(\"Không lấy ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given the Thetas, output the XY
function current_XY(THETA1D,THETA2D){ var THETA1D = mapToDegrees(ln1); var THETA2D = mapToDegrees(ln2); X = l1*math.cos(THETA1D) + l2*math.cos(THETA1D+THETA2D); Y = l1*math.sin(THETA1D) + l2*math.sin(THETA1D+THETA2D); }
[ "function pitagoroTeorema (x, y) {\nvar rezultatas = ( x * y ) + ( y * y);\n console.log(\"Ilgoji trikampio kraštinė:\", rezultatas);\n}", "function pitagoroTeorema(x, y) {\nvar ilgosKrastinesIlgis = Math.sqrt(Math.pow(x,2)+Math.pow(y,2));\nconsole.log(ilgosKrastinesIlgis);\n}", "function TAU() {\n return τ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET ERASER FRONT SIDE,PART OF ERASER
function getEraserFrontSide(x,y,s){ var result="M"+(x-s*2/3)+" "+(y+s/3)+","; result=result+"L"+(x-s/3*8)+" "+(y+s/3)+","; result=result+"L"+(x-s/3*8)+" "+(y+s*5/6)+","; result=result+"L"+(x-s*2/3)+" "+(y+s*5/6)+","; result=result+"Z"; return result; }
[ "function getEraserRightSide(x,y,s){\n\tvar result=\"M\"+x+\" \"+y+\",\";\n\tresult=result+\"S\"+(x-s/3)+\" \"+y+\" \"+(x-s*2/3)+\" \"+(y+s/3)+\",\";\n\tresult=result+\"L\"+(x-s*2/3)+\" \"+(y+s*5/6)+\",\";\n\tresult=result+\"L\"+(x-s*7/9)+\" \"+(y+s)+\",\";\n\tresult=result+\"S\"+(x-s/2)+\" \"+(y+s)+\" \"+(x+s/6)+\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get season club member list
getApiClubSeasonMemberList(season_id, ClubMembersList){ ClubMembersList.setState({members_data: []}); let API_URL = ''; if(season_id === 'all'){ API_URL = ClubMembersList.props.API_URL + '/v2.1/clubs/' + ClubMembersList.props.club_id + '/profiles/'; } else { API_URL = ClubMembersLi...
[ "function updateMemberList() {\n people_list = RTMchannel.getMembers().toString(); // gets list of channel members\n document.getElementById(\"people_list\").innerHTML = \"<u>People</u>: \" + people_list.toString();\n}", "function BrowseSeasons() \n{\n HideListingCriteria();\n movieCriteria = \"All\"\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
void InstallPartition (string, string, int, string, string, string)
InstallPartition(string, string, int, string, string, string) { }
[ "ExportPartition(string, string, int) {\n\n }", "InstallApplication(string, string, int, string, string, string) {\n\n }", "InstallComponent(string, string, string, string) {\n\n }", "function Partition(props) {\n return __assign({ Type: 'AWS::Glue::Partition' }, props);\n }", "In...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scrape a list of urls by extracting the pubID in each url, call the API to receive the data and create an item in Zotero out of this.
function scrape(urlList) { for (index in urlList) { var url = urlList[index]; var pubID = url.match(/\/detail\/(\d+)/)[1]; var apiUrl = "https://academic.microsoft.com/api/browse/GetEntityDetails?entityId=" + pubID + "&correlationId=undefined"; ZU.doGet(apiUrl, function(text) { var data = JSON.pars...
[ "function common_crawl_pop_and_download(months, list, callback) {\n\n //\n // Local variables\n //\n var month, tmp, len; // , list = [];\n var CCStats = {\n emails: 0,\n processed: 0,\n months: {}\n };\n\n len = months.length - 1;\n\n // checks if all links are already ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add valid class or invalid class in input
function addClass(input, regex) { if (regex.test(input.value)) { input.classList.add('valid'); input.classList.remove('invalid'); } else { input.classList.add('invalid'); input.classList.remove('valid'); } }
[ "function view_setValidationErrorStateForGradeInput() {\n $(\"#input-grade\").attr('class', 'error');\n}", "function validateClassInput() {\n //validity bool\n var valid = false;\n //return value for fn\n var returnedVal;\n //select class input by NAME instead of ID\n var cl = document.getEle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays a simple loading screen with the loading model's name
function loading() { background(255); push(); fill(0); textSize(22); textAlign(CENTER, CENTER); text(`Loading ${modelName}...`, width / 2, height / 2 - 100); pop(); }
[ "function showLoadingStatus() {\n console.log(\"[menu_actions.js] Showing loading status\");\n showElementById(\"loading-status\");\n}", "function showLoading(message) {\n var msg = message || 'Working...';\n updateDisplay('<em>' + msg + '</em>');\n}", "function loadingScreen() {\r\n textAlign(CENTER);\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
collision method where the ball will reflect off the players' paddle
collide(player, ball) { // If the ball is colliding with the player's paddle, then the ball will reflect if (player.left < ball.right && player.right > ball.left && player.top < ball.bottom && player.bottom > ball.top) { const len = ball.vel.len; // save the current ball velocity ...
[ "function lPaddleCollision() {\n if(ball.xPos - ball.radius/2 < lPaddle.xPos + lPaddle.width && ball.yPos + ball.radius/2 > lPaddle.yPos && ball.yPos + ball.radius/2 < lPaddle.yPos + lPaddle.height && ball.xPos > 0 && ball.xPos < width && ball.yPos > 0 && ball.yPos < height) {\n ball.vx = ball.vx * -1;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
opp is either "rho" or "lho" state is "disconnected", "waiting" or "connected" The function changes the class of the corresponding element in order to display the red, yellow or green symbol
function setConnectionState(opp, state) { var elDis; var elWat; var elCon; //console.log("setConnectionState", opp, state); if (opp == "rho") { elDis = document.getElementById("rho-disconnected"); elWat = document.getElementById("rho-waiting"); elCon = document.getElementById("rho-connecte...
[ "updateSectionColorPlayer(opponent) {\n $(\"#\"+opponent).removeClass(\"player-infos--active\");\n $(\"#\"+this.name).addClass(\"player-infos--active\");\n }", "function showred() {\r\n var o_panel_info = document.getElementById(\"outputpanel\").classList\r\n if(o_panel_info.length > 1){\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SoCommand class. Display an image according to given type.
function SoCommand(botName) { var types = { 'jira': 'http://i.imgur.com/Zjwo4.gif', 'shame': 'http://i.imgur.com/GVDjO.gif', 'flag': 'http://i.imgur.com/oN1Er.gif', 'crazy': 'http://i188.photobucket.com/albums/z284/oblongman7/Scrubs/b6488ee3.gif', 'notme': 'http://i.imgu...
[ "static imageCommand (guild_id: string, name: string, imageUrl: string) {\n return new Response({\n guild_id: guild_id,\n name: name,\n content: imageUrl,\n is_image: true,\n requires_prefix: true\n });\n }", "display()\r\n {\r\n image(this.image,this.x, this.y, this.w,th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rotate the zepMarker to let the zeppelin fly around the stadium
function zeppelin_circle(rotation) { if (rotation > 0.06) rotation = 0.06; zepMarker.rotateY(rotation); }
[ "function mRotateZ() {\n rotateZ(...[...arguments]);\n mPage.rotateZ(...[...arguments]);\n}", "function rotateZ(point, radians) {\r\n\tvar x = point.x;\r\n\tpoint.x = (x * Math.cos(radians)) + (point.y * Math.sin(radians) * -1.0);\r\n\tpoint.y = (x * Math.sin(radians)) + (point.y * Math.cos(radians));\r\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the country is a valid string
function validCountryProvided(c) { return typeof c === 'string' && c.length < 501; }
[ "function assertStateCode(code) {\n if (![\"\", \"at\", \"be\", \"bg\", \"ch\", \"cy\", \"cz\", \"de\", \"dk\", \"ee\", \"es\", \"fi\", \"fr\",\n \"gb\", \"gr\", \"hr\", \"hu\", \"ie\", \"is\", \"it\", \"li\", \"lt\", \"lu\", \"lv\", \"mt\",\n \"nl\", \"no\", \"pl\", \"pt\", \"ro\", \"se\", \"si\",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: deleteFormat DESCRIPTION: Removes the format function declaration from the top of the user's document. ARGUMENTS: format Object the format to be applied. This object represents the format tag that was selected in Formats.xml RETURNS: nothing
function deleteFormat(format) { }
[ "function deleteFormat(format)\r\n{\r\n}", "function removeFormatting() {\n hideAllContextMenus();\n\n document.execCommand(\"removeFormat\", false, null);\n document.execCommand(\"unlink\", false, null);\n\n cur_contentdiv.focus(); // return focus back to editing field\n }", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
endregion region console color tokens generates the token used in a console message to color the background
function colorBGToken(color) { return `\u001B[48;2;${color.r_8b};${color.g_8b};${color.b_8b}m`; }
[ "function letterboxColor (command_) {\n\tvar argList = toArgList (command_);\n\n\tvar red = argList[1];\n\tvar green = argList[2];\n\tvar blue = argList[3];\n\n\tdocument.body.style.background = 'rgb(' + red + ',' + green + ',' +\n\t blue + ')';\n}", "function prettyPrint(tokens) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
converts a number's value in one range to it's corresponding value in another range
function convertRange(value, r1, r2){ return (value - r1[0]) * (r2[1] - r2[0]) / (r1[1] - r1[0]) + r2[0]; }
[ "function normalizeInRange(start, end, value) {\n if (value < 0.0 || value > 1.0) {\n return -1;\n }\n\n if (end < start) {\n // if end is 45 and start is 50\n\n return start - ((start - end) * value); \n } else {\n // if end is 55 and start is 50\n\n return sta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the ISite instance associated with this hubsite
async getSite() { const d = await this.select("SiteUrl")(); return Site([this, d.SiteUrl]); }
[ "getById(id) {\n return HubSite(this, `GetById?hubSiteId='${id}'`);\n }", "static getInstance() {\n return ViewHub._findInstance() || new ViewHub(appEnvStub);\n }", "function Site(id, type, color) {\n\n this._id = id;\n this._type = type;\n this._color = color;\n}", "static get instance...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if `index` in `value` is inside an alignment row.
function alignment(value, index) { var start = value.lastIndexOf(lineFeed, index) var end = value.indexOf(lineFeed, index) var char end = end === -1 ? value.length : end while (++start < end) { char = value.charAt(start) if ( char !== colon && char !== dash && char !== space && ...
[ "function i2uiCheckForAlignmentRow(tableid)\r\n{\r\n var headeritem = document.getElementById(tableid+\"_header\");\r\n var dataitem = document.getElementById(tableid+\"_data\");\r\n\r\n if (headeritem != null &&\r\n dataitem != null &&\r\n dataitem.rows.length > 0)\r\n {\r\n var last...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines whether the given input is defined.
static isDefined(input) { return typeof (input) !== 'undefined'; }
[ "function checkInput(input) {\n var essentialColumns = input.name && input.x && input.y;\n if (essentialColumns === undefined) {\n console.error(\"X or Y or Z Column cannot be empty.\");\n return false;\n }\n input.name = parseName(input.name);\n input.x = parseX(input.x);\n input.y ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ReturnStatement : 'return' OptExpression ;
ReturnStatement() { this._eat("return"); const argument = this._lookahead.type !== ";" ? this.Expression() : null; this._eat(";"); return { type: "ReturnStatement", argument, }; }
[ "function Return() {\n \t\t\tdebugMsg(\"ProgramParser : Return\");\n \t\t\tvar line=lexer.current.line;\n \t\t\t\n \t\t\tlexer.next();\n \t\t\t\n \t\t\tvar expr=Expr();\n \t\t\tvar ast=new ASTUnaryNode(\"return\",expr);\n \t\t\tast.line=line;\n \t\t\treturn ast;\n \t\t}", "ReturnStatement(node) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OBJETO: pgdoc_cmbstipo_documento_codigo METODO: INIT
function pgdoc_cmbstipo_documento_codigo__init(){ $("#pgdoc_cmbstipo_documento_codigo").html(''); $.post("../../controller/servicio.php?op=ctrl_apr_web_tipo_documento_select", function(data, status){ $("#pgdoc_cmbstipo_documento_codigo").html(data); $("#pgdoc_cmbstipo_documento_codigo").sel...
[ "function libro(indice,isbn,titulo,autor,anio,editorial){\n\tthis.indice=indice;\n\tthis.isbn=isbn;\n\tthis.titulo=titulo;\n\tthis.autor=autor;\n\tthis.anio=anio;\n\tthis.editorial=editorial;\n}", "function cargarAbogado(campoAbogado) {\n\t$.ajax({\n\t\t dataType: \"json\",\n\t\t url: contexto + \"/maestro/obte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to delete tendency option
function deleteTendencyOption(id) { $('#tendency_' + id).remove(); }
[ "function deleteOneSelectOption(sel, value, bDontSetWidth)\n{\n if (isNLDropDown(sel))\n {\n getDropdown(sel).deleteOneOption(value, bDontSetWidth);\n }\n else if (isNLMultiDropDown(sel))\n {\n getMultiDropdown(sel).deleteOneOption(value);\n }\n else if (sel.type == 'select-one' |...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a string describing the type / value of the provided input.
function valueDescription(input) { if (input === undefined) { return 'undefined'; } else if (input === null) { return 'null'; } else if (typeof input === 'string') { if (input.length > 20) { input = input.substring(0, 20) + "..."; } retu...
[ "function sfTypeToApexType(input){\n\n var output = '';\n\n if(input === 'Text'){\n return output = 'string';\n }else if(input === 'Number'){\n return output = 'double';\n }if(input === 'Checkbox'){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addClient Create a new client through Clients Collection Set addFolder: false through Session model
addFolder(e) { e.preventDefault(); if(this.props.client) { let clientName = this.props.client.clientName; let clientId = this.props.client.objectId; let subFolderName = this.refs.folderName.value.toLowerCase(); store.fileStore.createSubFolder(clientName, clientId, subFolderName); } ...
[ "handleAddRemoveClient () {\r\n let isAlreadyAdded = this.props.userClients.find(client => client.clientIdentifier === this.props.client.clientIdentifier);\r\n if(isAlreadyAdded) {\r\n this.props.removeClientRow(this.props.client.clientIdentifier);\r\n } else {\r\n this.pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this polyfill is to add support for CustomEvent in IE11
static addCustomEventPolyfill() { if (typeof window['CustomEvent'] === 'function') { return false; } const CustomEvent = (event, params) => { params = params || { bubbles: false, cancelable: false, detail: null }; const evt = document.createEvent('CustomEvent'...
[ "function PointerEventsPolyfill(t){if(this.options={selector:\"*\",mouseEvents:[\"click\",\"dblclick\",\"mousedown\",\"mouseup\"],usePolyfillIf:function(){if(\"Microsoft Internet Explorer\"==navigator.appName){if(null!=navigator.userAgent.match(/MSIE ([0-9]{1,}[\\.0-9]{0,})/)){if(parseFloat(RegExp.$1)<11)return!0}}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populate drop down with list of replacements: 'word_to_replace > replacement_word'
function populate_replacements() { var replacements = get_replacements(); var select = document.getElementById("word_substitutions_select"); // Clear the drop down first for (var i = select.options.length - 1; i >= 0; i--) { select.remove(i); } for (var key in replacements) { if (replacem...
[ "function populateDropDown(allKeyWords) {\n const $dropdown = $('#filter');\n $dropdown.empty();\n $dropdown.append($('<option>', {value: 'default', text: 'Filter by Keyword'}));\n allKeyWords.forEach(keyword => {\n $dropdown.append($('<option>', { value: keyword, text: keyword }));\n });\n}", "function g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
controller for getting all supplier data
function getSupplierList(req, res, next) { supplierService .getAll() .then((result) => { if (!result.length) { return next({ message: 'Supplier not found', status: '400', }) } res...
[ "function getSupplierByID(req, res, next) {\n supplierService\n .findById(req.params.id)\n .then((result) => res.status(200).json(result))\n .catch((err) => next(err))\n}", "function getPopulate(req, res, next) {\n supplierService\n .getPopulate(req.params.id)\n .then((res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if word completed
function completed_word() { if (_line_idx == 0) { return (false); } if (_line[_line_idx-1] == 0x20) { return (true); } return (false); }
[ "isValidWord() {\n if (this.words.includes(this.wordInput)) {\n this.validWord = true;\n this.wordValidate = 'La palabra se encuentra dentro de la gramatica ingresada'\n } else {\n this.validWord = true;\n this.wordValidate = 'La pala...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set active icon for newMarker and get from variable id of oldMarker. If this exists set domestic unactive icon for him.
function toggleMarkersIcons(newMarker) { var oldMarker = controller.getActiveMarker(); if (oldMarker != null) setMarkerIconUnactive(oldMarker); setMarkerIconActive(newMarker); }
[ "function setMarkerIconActive(marker) {\n setMarkerIcon(marker, 'yellow', 'dot');\n}", "function setMarkerIconUnactive(marker) {\n if (controller.isStartPoint(marker.id))\n setMarkerIcon(marker, 'green', 'dot');\n else\n setMarkerIcon(marker, 'red', 'dot');\n}", "function updateMarker(pic...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API From If "simple" request (paraphrased): 1. If the Origin header is not set, or if the value of Origin is not a casesenstive match to any values listed in `opts.origins`, do not send any CORS headers 2. If the resource supports credentials add a single 'AccessControlwAllowCredentials' header with the value as "true"...
function cors(opts) { assert.optionalObject(opts, 'options'); opts = opts || {}; assert.optionalArrayOfString(opts.origins, 'options.origins'); assert.optionalBool(opts.credentials, 'options.credentials'); assert.optionalArrayOfString(opts.headers, 'options.headers'); var headers = (opts.header...
[ "enableCors(originDomain, opt) {\n this.cors = {\n credentials: true\n };\n if (typeof originDomain === 'string') { // remove any trailing /\n let corsDomain;\n if (originDomain.indexOf('://') !== -1) {\n let tmp = originDomain.split('//');\n corsDomain = tmp[0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the heart of the server. route returns a FUNCTION that is passed to createServer in server.js. That function is invoked for each request recieved and passed the request and response objects. route's callback returns undefined under all circumstances. for each request received it calls bodyParser. if BP succeeds...
route() { return (request, response) => { Promise.all([bodyParser(request)]) .then(() => { logger.log(logger.INFO, `Router rec'd: ${request.method} ${request.url.pathname}`); // the line below retrieves the ROUTE callback using the request method and pathname // as route...
[ "function Router(){\n\n let routes = [];\n let final = () => {};\n\n /**\n * Called when the router wants to handle an incoming connection.\n * When specify blocking routes.\n * That means that if the next callback is not a 'if' the regular expression\n * is not even tested.\n */\n this.when = (regex, callback...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads a language definition into the `languages` cache. The function takes a key and optionally values. If not in the browser and no values are provided, it will load the language file module. As a convenience, this function also returns the language values.
function loadLang(key, values) { values.abbr = key; if (!languages[key]) { languages[key] = new Language(); } languages[key].set(values); return languages[key]; }
[ "function loadLocale() {\n\tvar xobj = new XMLHttpRequest();\n\txobj.overrideMimeType(\"application/json\");\n\txobj.open('GET', '/locales/' + langCode + '.json', true);\n\txobj.onreadystatechange = function () {\n\t\tif (xobj.readyState == 4) {\n\t\t\tif (xobj.status == \"200\") {\n\t\t\t\tlocale = JSON.parse(xobj...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by Java9ParserinterfaceType_lfno_classOrInterfaceType.
exitInterfaceType_lfno_classOrInterfaceType(ctx) { }
[ "exitClassType_lfno_classOrInterfaceType(ctx) {\n\t}", "exitInterfaceType_lf_classOrInterfaceType(ctx) {\n\t}", "exitUnannClassType_lfno_unannClassOrInterfaceType(ctx) {\n\t}", "exitClassType_lf_classOrInterfaceType(ctx) {\n\t}", "exitUnannClassType_lf_unannClassOrInterfaceType(ctx) {\n\t}", "exitUnannInt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provides header/body/footer button support for Widgets that use the `WidgetStdMod` extension. This Widget extension makes it easy to declaratively configure a widget's buttons. It adds a `buttons` attribute along with button accessor and mutator methods. All button nodes have the `Y.Plugin.Button` plugin applied. This ...
function WidgetButtons() { // Has to be setup before the `initializer()`. this._buttonsHandles = {}; }
[ "button(x, y, content, opts){\n\n let button = new Button(x, y, content, opts);\n this.layer.buttons.push(button);\n return button;\n\n }", "function appendButtons(memeId) {\n createEditButton(memeId);\n createDeleteButton(memeId);\n createDownloadButton(memeId);\n createShareB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method queries the databsase to find all entries with the same type as the previous purchase (prev), and then passes the array of products, the location, and the callack, to get_suggestion_based_on_weather. If something goes wrong, a descriptive error message is returned, however, if everything goes nicely, nothin...
function get_suggestion_based_on_previous_item(prev, geo, callback){ var types = {}; if(prev == -1){ //Ignore the previous item and just get the information from the location return get_suggestion_based_on_weather(geo, null, callback); } client.query("select type from products where id='"+prev+"'", function(err...
[ "function performSearch(srch, srchType, btnIndex){\n //Make the inputs into the URL and call the API\n //Reset variables\n currentFoodResults = [[],[],[],[],[]];\n currentWineResults = [[],[],[],[],[],[],[]];\n varietalInformation = null;\n foodRunFlag = false;\n wineRunFlag = false;\n numRe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for getV3DockerfilesName
getV3DockerfilesName(incomingOptions, cb) { const Gitlab = require('./dist'); let defaultClient = Gitlab.ApiClient.instance; // Configure API key authorization: private_token_header let private_token_header = defaultClient.authentications['private_token_header']; private_token_header.apiKey = 'YOUR API KEY'...
[ "getV3TemplatesDockerfilesName(incomingOptions, cb) {\n const Gitlab = require('./dist');\nlet defaultClient = Gitlab.ApiClient.instance;\n// Configure API key authorization: private_token_header\nlet private_token_header = defaultClient.authentications['private_token_header'];\nprivate_token_header.apiK...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Raise the exception class with the given string message.
function raise(exc, str) { if (str === undefined) { str = exc; exc = eException; } var exception = exc.m$new(str); raise_exc(exception); }
[ "function Exception(message){if(message===void 0){message=undefined;}var _this=_super.call(this,message)||this;_this.message=message;return _this;}", "function raise_exc(exc) {\n throw exc;\n}", "function HamburgerException(errorMessage) {\r\n this.errorMessage = errorMessage;\r\n}", "function DOMException(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fetch simple option data
function fetchOptionData(){ limit = limitData[city]; pageLimit = pageLimitData[city]; page_number = pageNumberData[city]; order = orderData[city]; sortColId = sortColIDData[city]; sortColNumber = sortColNumberData[city]; }
[ "function getOption(response, id) {\n let sql = \"SELECT * FROM options WHERE id = \" + id + \";\"\n\n console.log(sql);\n connectionPool.query(sql, function(err, result) {\n\n if (err) {\n response.status(HTTP_STATUS.INTERNAL_SERVER_ERROR)\n response.json({ 'error': true, 'mes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GLOBAL FUNCTIONS Resizes Map when window is resized
function resize(){ $('#map').css("height", ($(window).height() - navBarMargin)); $('#map').css("width", ($(window).width())); }
[ "function resize() {\n map_width = sky_map.width();\n map_height = sky_map.height();\n font_height = map_height / 25;\n axis_size.x = map_width / 20;\n var x = sky_map.css('font-size', font_height).measureText({\n text: '888888'\n });\n if (x.width > axis_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Control move: Employee end the job
function empEndJob() { // Set control variable employeeIsWorking = false; // Hide all employee images empHideAll(); // Show employee image getting the job if (powerUp) { $("#emp_up_2").show(); } else { $("#emp_stress_2").show(); } // Set timer to give up the ended job setTimeout("empNoJob()", 300); }
[ "function workoutFinished(){\n\n }", "turnEnd() {\n logger.debug(this.events.turnEnd);\n const isClickedPlayersTurn = this.gameInstance.isPlayersTurn(this.playerID);\n if (!isClickedPlayersTurn) {\n this.emitToAllInGame(this.events.gameDetails, this.gameInstance);\n return;\n }\n\n const...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define the test value
function TestValue() {}
[ "function setTestRanTrue() {\n testRan = true;\n}", "function test (actual, expected) { console.log(actual === expected ? `√ ${actual}` : `X ${actual} | ${expected}`) }", "function initValue(options, property, defaultValue, expected) {\n let current = options[property];\n return (current && typeof curren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if idSet is not empty, append a log message with prefix.
function logMsg(prefix, idSet) { if (! idSet.isEmpty()) { log.show(prefix + idSet.map(function (id) { return table.idToStr(tableSpec.rows(), id) }).join(" ")) } }
[ "_log() {\n let args = Array.prototype.slice.call(arguments, 0);\n\n if (!args.length) {\n return;\n }\n\n if (args.length > 1)\n this.emit('log', args.join(', '));\n else\n this.emit('log', args[0]);\n }", "log (msg) {\n if (msg === undefi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loadEmails_flat: Load a topic in a flat display
function loadEmails_flat(id, close, treeview) { var lvid = id if (treeview) { lvid = treeview } var thread = document.getElementById('thread_' + lvid) if (thread) { current_thread = lvid thread.style.display = (thread.style.display != 'block') ? 'block' : 'none'; if (...
[ "function load_emails(mailbox) {\n fetch('/emails/'+mailbox)\n .then(response => response.json())\n .then(emails => {\n // Print out emails to correct mailbox\n emails.forEach(function(item) {\n if (item.read != true) {\n document.querySelector('#emails-view').innerHTML += `<div id=\"email-view...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes the destination of the ship to empty location returns true if successfully cleared
function clearDestination( shipObj ) { DEBUG_MODE && console.log( "Calling clearDestination in ShipBO" ); if ( shipObj == undefined ) { DEBUG_MODE && console.log( "ShipBO.clearDestination: ship is undefined" ); return false; } DEBUG_MODE && console.log( "ShipBO.clearDestination: o...
[ "clearDestinationIfReached() {\n let currentTile = this.getOwnTile();\n if (currentTile === this.destination) {\n this.destination = undefined;\n }\n }", "function clearMove(){\n for(var y; y < 8; y++){\n for(var x; x < 8; x++){\n if(state.board[y][x] === 'move'){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
agregate out of bounds items from top menu into ellipsis dropdown
function navTopbarEllipsis() { navTopbarReset(); $('#nav-topbar ul.menu').find('li.maintab').each(function(){ if ($(this).position().top > 0) { ellipsed.push($(this).html()); $(this).addClass('hide'); } }); if (ellipsed.length > 0) { $('#nav-topbar ul.menu').append('<li...
[ "function initMenuEmptyHeight(){\n\tResponsiveHelper.addRange({\n\t\t'1024..': {\n\t\t\t// on: function() {\n\t\t\t// \tjQuery(document).ready(function(){\n\t\t\t// \t\tjQuery('#nav .empty-description').each(function(){\n\t\t\t// \t\t\tvar heightImg = jQuery(this).find('i').height();\n\t\t\t// \t\t\tvar strong = jQ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a Db based on the given configuration.
function createDb(conf) { var state = new DbState(); state.configure(conf); return state.db; }
[ "function connect(poolConfig) {\n return new Db(pg.Pool(poolConfig));\n}", "function getDbDriver(config) {\n validateConfig(config);\n const {logger} = config;\n const queryLogger = logger || getLogger();\n const {rwPool, roPool} = getConnectedPool(config);\n return new DbDriver({rwPool, roPool, \"logger\":...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an egg and starts it moving.
function createEgg() { startMoving(new egg); }
[ "function gravity_spawn()\n{\n\tstop_gravity();\n\tspawn_piece();\n\trender_board(board);\n\tqueue_gravity();\n}", "spawning () {\n }", "plantSeed() {\n\t\tthis.stop();\n\t\tthis.loops = 0;\n\t\tthis.myTree = new FractalTree({x: ground.width/2-100, y: ground.height-20}, this.myDNA);\n\t\tthis.settingsClose()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds a request to the mempool
addARequestToMempool(request){ let self = this; //we use an array to hold the request index in mempool array based on the wallet address let indexToFind = this.walletList[request.walletAddress]; let validInWalletList = this.validWalletList[request.walletAddress]; //if user already...
[ "function add(request) {\n request.queueTime = (new Date()).getTime();\n\n queue.add(request).save();\n\n if (settings.get('developer')) {\n utils.log('Queue', queue);\n }\n }", "async addRequest(request) {\n // make sure these writes are atomic\n\n if (!this.batch)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility method to call alerts service for both ingest and status
function callAlertsService(node, params){ params.json = true; params.headers = { 'Authorization': `Bearer ${node.accessToken}`, 'tenant': node.server.config.tenantId // Tenant UUID } params.url = node.server.config.ingestionUrl; if(params.method === 'GET'){ params.u...
[ "function refreshServiceStatus() {\n sendWithPromise('getServiceStatus').then(onGetServiceStatus);\n}", "checkServerStatus(){\nreturn this.post(Config.API_URL + Constant.HEALTHCHECK_CHECKSERVERSTATUS);\n}", "alert( alertId, text ) {\n let alertText = null;\n\n if ( Array.isArray( text ) ) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
override the next argument with argv[n]
function setargN( argz, n, p ) { if (n > argz.nargs) throw new Error("missing i-th argument " + n + "$ for % conversion at offset " + p); // negative n never passed in, scanDigits does not handle minus sign // if (n < 1) throw new Error("invalid $ argument specifier for % conversion"); return argz.argN ...
[ "reset() {\n this._argv = process.argv.slice(2)\n }", "function setargM( argz, name, p ) {\n var hash = argz.argN ? argz.argN : argz.argv[0];\n if (hash[name] === undefined) throw new Error(\"missing named argument %(\" + name + \") at offset \" + p);\n return argz.argN = hash[name];\n}", "shift_ar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse
function removeAxisDelta(axis, translate, scale, origin, boxScale) { if (translate === void 0) { translate = 0; } if (scale === void 0) { scale = 1; } if (origin === void 0) { origin = 0.5; } var originPoint = (0,popmotion__WEBPACK_IMPORTED_MODULE_1__.mix)(axis.min, axis.max, origin) - translate; ax...
[ "function updateAxisDelta(delta, source, target, origin) {\n if (origin === void 0) { origin = 0.5; }\n delta.origin = origin;\n delta.originPoint = (0,popmotion__WEBPACK_IMPORTED_MODULE_3__.mix)(source.min, source.max, delta.origin);\n delta.scale = calcLength(target) / calcLength(source);\n if (isN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the document as HTML.
getHTML() { return getHTMLFromFragment(this.state.doc, this.schema); }
[ "getHTML() {\n return getHTMLFromFragment(this.state.doc.content, this.schema);\n }", "function getHtmlContent(){\n \n }", "function convert_docx_to_html(file) {\n let output = 'html.html'\n execSync(`pandoc ${file} -o ${output} --extract-media=.`)\n console.info(\"Converted docx file to HTML...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether or not the button should show an account name input field. This is for Authenticators that do not have a concept of account names.
async shouldRequestAccountName() { return false; }
[ "function validatePlayerName() {\n const name = getGameForm()['player-name'].value;\n if (!name.trim()) {\n getById('play-button').style.visibility = 'hidden';\n } else {\n playerName = name;\n getById('play-button').style.visibility = 'visible';\n }\n}", "isLoginAndRegisterPopUpD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save the book data to localStorage.
function saveData() { if (hasLocalStorage) { localStorage.setItem(SAVE_LOCATION, JSON.stringify(books)); } }
[ "function loadBookData() {\n bookDataFromLocalStorage = JSON.parse(localStorage.getItem(\"bookData\"));\n if (bookDataFromLocalStorage == null) {\n bookDataFromLocalStorage = bookData;\n localStorage.setItem(\"bookData\", JSON.stringify(bookDataFromLocalStorage));\n }\n}", "function saveDat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves the first value that is defined in an array, going backwards from an index position. To avoid repeating the same data (as when the "format" and "standalone" forms are the same) add the first value to the locale data arrays, and add other values only if they are different.
function getLastDefinedValue(data, index) { for (let i = index; i > -1; i--) { if (typeof data[i] !== 'undefined') { return data[i]; } } throw new Error('Locale data API: locale data undefined'); }
[ "function zerothVal(arr) {\n\treturn arr[0];\n}", "function zerothItem(arr) {\n\treturn arr[0];\n}", "function lastElement(array){\n if (array.length > 0){\n return array[array.length-1];\n }\n return null;\n}", "function lastEntry (array, n) {\n const lastEntryIndex = array.length;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function returns the first selected block.
getSelectedBlock(editorState) { if (editorState) { return this.getSelectedBlocksList(editorState).get(0) } return undefined }
[ "firstChild(blockId) {\n const block = this.blocks[blockId];\n invariant(block, 'expect to be able to find the block');\n return block.components && block.components.length ? block.components[0] : null;\n }", "function getNextBlock () {\n\n // ensure something to pull from\n fillBag();\n\n // t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IMGUI_API bool DragFloat2(const char label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char display_format = "%.3f", float power = 1.0f);
function DragFloat2(label, v, v_speed = 1.0, v_min = 0.0, v_max = 0.0, display_format = "%.3f", power = 1.0) { const _v = import_Vector2(v); const ret = bind.DragFloat2(label, _v, v_speed, v_min, v_max, display_format, power); export_Vector2(_v, v); return ret; }
[ "function DragFloat(label, v, v_speed = 1.0, v_min = 0.0, v_max = 0.0, display_format = \"%.3f\", power = 1.0) {\r\n const _v = import_Scalar(v);\r\n const ret = bind.DragFloat(label, _v, v_speed, v_min, v_max, display_format, power);\r\n export_Scalar(_v, v);\r\n return ret;\r\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IMGUI_API bool IsItemDeactivatedAfterEdit(); // was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that requires continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable...
function IsItemDeactivatedAfterEdit() { return bind.IsItemDeactivatedAfterEdit(); }
[ "function IsItemActivated() { return bind.IsItemActivated(); }", "isEditing() {\n return Template.instance().uiState.get(\"editing\");\n }", "function isEditable() {\n return (current && current.isOwner && !current.frozen);\n}", "function IsItemHovered(flags = 0) {\r\n return bind.IsItemHovered(fl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a fabric client, used to interact with fabric chaincode
async function getFabricClient (organization) { if (!organization) { throw new Error ('Organization must be supplied in order to create a fabric client.'); } var connectionProfile = getConnectionProfile((organization)); if (!connectionProfile.certificateAuthorities) { throw new Error ('...
[ "_buildClient() {\n var metadata = (0, _frames.encodeFrame)({\n type: _frames.FrameTypes.DESTINATION_SETUP,\n majorVersion: null,\n minorVersion: null,\n group: this._config.setup.group,\n tags: this._tags,\n accessKey: this._accessKey,\n accessToken: this._accessToken,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Emulates reading a "document" from a NoSQL database. Doesn't do any tricky document joins, as we will cover that in the latter half of the course. :)
function readDocument(collection, id) { // Clone the data. We do this to model a database, where you receive a // *copy* of an object and not the object itself. var collectionObj = data[collection]; if (!collectionObj) { throw new Error(`Object collection ${collection} does not exist in the database!`); }...
[ "function read_from_couchdb(cl_cb) {\n\t\t\tlet read_op = couch.getDoc;\n\t\t\tif (opts.view) {\t\t\t\t\t\t\t\t\t\t// if its a view, use this function\n\t\t\t\tread_op = couch.getDesignDocView;\n\t\t\t}\n\n\t\t\tread_op(opts, (err_cl, resp_cl) => {\n\t\t\t\tconst key = build_key(opts);\n\t\t\t\tif (err_cl != null) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the shiny div container parent of the input table getting element by tagName as id not always guaranteed
static getParentId(el){ return $(el).parents('div[class^="shiny"]').prop("id"); }
[ "function getTableIdFromChild(component) {\n return jQuery(component).closest('.uif-tableCollectionSection').attr('id');\n}", "function getParentRichTableId(childElement) {\n return jQuery(childElement).parents('table.dataTable').attr('id');\n}", "function getCurEmployeeCard(employeeName) {\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }