query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Get all URLs quitting last part path until no more parts available. Example. For ' two URLs will be created: ' and ' :param urls: list of strings, URLs to work with. :return urls_paths: list of strings, all possible URLs omitting parts of the paths.
function getUrlsWithPaths(urls){ // Variable with results. var urls_paths = [] urls.forEach( function(url) { // Quit last slash. if (url.slice(-1) == '/'){ url = url.substring(0, url.length -1); } // Loop all parts of the path until no more par...
[ "function getUrlsWithPaths(urls){\n // Variable with results.\n let urls_paths = []\n for (let url of urls) {\n // Quit last slash.\n if (url.slice(-1) == '/'){\n url = url.substring(0, url.length -1);\n }\n // Loop all parts of the path until no more parts.\n while (url.slice(-1) != '/') {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assign a role to each player in the room. No more players can be added after this function is called!
assignRoles() { const available = roles[this.players.length]; shuffle(available); this.players.forEach((player, i) => { player.role = available[i]; }); }
[ "function assignRoles() { // TODO: Figure out what to do in games of more than 6 players\n rng();\n\n players[arr[0]].TEAM = 'Mafia';\n players[arr[0]].ROLE = 'Mafia';\n\n players[arr[1]].TEAM = 'Mafia';\n players[arr[1]].ROLE = 'Mafia';\n \n players[arr[2]].TEAM = 'Village';\n players[arr[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
9. Create an arraySet function that accepts three parameters `arr`, `i` and `n`. The first one is an array and the second one an index. The function should place the value of the third parameter into the array at an index specified by the second parameter, if (and only if) such an index is already in the array. Note th...
function arraySet(arr, i, n){ if(Number.isInteger(i) && arr.length > i){ arr[i] = n } }
[ "function setInSpliceOutN(\n array,\n setInIdx,\n setInValue,\n spliceOutIdx,\n n,\n canEdit\n) {\n const newArray = spliceOutN(array, spliceOutIdx, n, canEdit);\n\n // Now we can edit regardless of canEdit\n if (setInIdx < spliceOutIdx) {\n newArray[setInIdx] = setInValue;\n } else if (setInIdx >= spl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
apply layout changes to show vertical blueprints tools
function verticalTheme() { $('#loader').attr('class', 'hidden'); if (!vertical) { // hide toogle grid option $('#toggle_grid').parent().remove(); // build scale Planta tools html $('#toolbox').append( '<!-- scale Planta up -->' + '<button class="btn" ti...
[ "function setLayout(){\n\n}", "function Layout() {return;}", "function changeLayout() {\n $(sortArea).animate({\n opacity: 0\n }, function() {\n $('.grid__item').removeClass('compact grid list');\n $('.grid__item').addClass(button);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show labels that do not overlap with others
function showLabels() { let labels = gLabels.selectAll("text:not([display=none])"); let points = gPoints.selectAll("path"); let labelsToShow = []; // gLabels.selectAll("rect").remove(); // Debug labels.each(function () { let label = d3.select(this); let labelBBox = getBBox(this); ...
[ "function fixOverlappingLabels(chart, labels) {\r\n var prev;\r\n labels.each(function(d, i) {\r\n // skip the first iteration\r\n if (i > 0) {\r\n // get bounding boxes\r\n var thisBounding = this.getBoundingClientRect();\r\n var prevBounding = prev.getBoundingC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Worker function for drag motion cleanup for gobjects being changed.
function completeDragMotion() { var that = this; $.each(this.controlList, function(index,item) { if (item.isController) { item.gobj.transformComplete(item.gobj.sQuery.sketch, that.tracker); item.gobj.sQuery.sketch.invalidateGeom(item.gobj); } }); }
[ "cleanupDrag() {\n this.repositionTiles_(currentlyDraggingTile);\n // Remove the drag mask.\n this.updateMask_();\n }", "_cleanup() {\n if (!this.getDrag() && this.__inCapture) {\n return;\n }\n\n // Fire change event if needed\n if (this.__selectionModified) {\n this._...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert text into the center of the donut
function centerText() { return function() { var svg = d3.select("svg"); var donut = svg.selectAll("g.nv-slice").filter( function (d, i) { return i == 0; } ); dount.insert("text", "g") .attr("text-anchor", "middle") ...
[ "function centerText() {\n return function() {\n var svg = d3v3.select(\"#nvd3_svg_new_2\");\n var donut = svg.selectAll(\"g.nv-slice\").filter(\n function (d, i) {\n return i == 0;\n }\n );\n //Insert text ins...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepares and analyzes the image. processCallback = function(err, analysis);
function processImage(doc, fileName, processCallback) { prepareImage(fileName, function (prepareErr, prepareFileName) { if (prepareErr) { processCallback(prepareErr, null); } else { analyzeImage(doc, prepareFileName, function (err, analysis) { ...
[ "function processImage(args, fileName, processCallback) {\n prepareImage(fileName, function (prepareErr, prepareFileName) {\n if (prepareErr) {\n processCallback(prepareErr, null);\n } else {\n analyzeImage(args, prepareFileName, function (err, analysis) {\n processCallback(err, analys...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setNumber Input: 1 <= i, j, n <= 9 Results: None Side Effects: change this.numbers, this.candidates
setNumber(i, j, n, depth=0){ this.numbers[(i-1)*9 + (j-1)] = n; // i 行と j 列 の候補を削除 for(let k=1; k<=9; k++){ this.deleteCandidate(i, k, n); this.deleteCandidate(k, j, n); } // cell(i, j) のブロック内の候補を削除 const i_block = Math.floor((i-1)/3) +...
[ "setCandidate(i, j, n){\r\n const I = i-1;\r\n const J = j-1;\r\n const N = n-1;\r\n\r\n const n_bit = 1<<N;\r\n this.candidates[I*9 + J] |= n_bit;\r\n\r\n const i_bit = 1<<I;\r\n const j_bit = 1<<J;\r\n this.candidates_row[N*9 + I] |= j_bit;\r\n this.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a cognito user object for the instance
initCognitoUser() { var userData = { Username : this.username, Pool : this.userPool }; this.cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData); }
[ "signup(username, password, email) {\n var attribute = {\n Name: 'email',\n Value: email\n };\n var attributeEmail = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserAttribute(attribute);\n var attributeList = [];\n\n attri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fx that takes 2 positive integer. Find out if the 2 numbers have the same frequency of digits. input = int1, int2 output = TRUE if same digit frequency for int1 and int2, else FALSE can integers be different lengths?
function sameFrequency(int1, int2) { const freqCount1 = {}; const freqCount2 = {}; // need to convert int => str in order to iterate over indiv digits const strInt1 = String(int1); const strInt2 = String(int2); // if integers are different lengths, cannot have same digit frequency if (strInt1.length !== s...
[ "function sameFrequency(integer1, integer2) {\n let integer1Freq = createFreqCounter(integer1);\n let integer2Freq = createFreqCounter(integer2);\n for (let digit of integer1Freq.keys()) {\n if (!integer2Freq.has(digit)) return false;\n else if (integer1Freq.get(digit) !== integer2Freq.get(di...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Track multiple entities before upserting (adding and updating) them to the collection. Does NOT update the collection (the reducer's job).
trackUpsertMany(entities, collection, mergeStrategy) { if (mergeStrategy === MergeStrategy.IgnoreChanges || entities == null || entities.length === 0) { return collection; // nothing to track } let didMutate = false; const entityMap = collection.entiti...
[ "trackAddMany(entities, collection, mergeStrategy) {\n if (mergeStrategy === MergeStrategy.IgnoreChanges ||\n entities == null ||\n entities.length === 0) {\n return collection; // nothing to track\n }\n let didMutate = false;\n const changeState = entiti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a function to return the second number from an array sort the array in descending order > Take the 2th value 1.Way
function secondLargest(arr){ arr.sort((a,b)=> b-a); return arr[1]; }
[ "function secondHighest(arr){\n var sorted = arr.sort(function(a,b){\n return b-a\n })\n return sorted[1]\n}", "function secondLargest(arr){\n arr = arr.sort(function(a,b){\n return b-a;\n });\n return arr[1];\n }", "function secondHighest(array) {\n\tvar retval;\n\tvar sortable = array.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Flush both queues and run the jobs.
function flush () { flushing = true run(queue) run(userQueue) reset() }
[ "function flush () {\n flushing = true\n run(queue)\n run(userQueue)\n reset()\n }", "function flush () {\n\t flushing = true\n\t run(queue)\n\t run(userQueue)\n\t reset()\n\t}", "function executeQueue () {\n if (jobQueue.length===0) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ In the event of the app being minimized this method handles media property change events. If the app receives a mute / notification, it is no longer in the foregroud. /
function systemMediaControls_PropertyChanged(args) { // Check to see if the app is being muted. If so, it is being minimized. // Otherwise if it is not initialized, it is being brought into focus. if (args.target.soundLevel === Media.SoundLevel.muted) { cleanupCameraAsync(); ...
[ "function mediaChange(e) {\r\n setMedia(e.target.value);\r\n }", "onmediadevicechange() {\r\n this.update();\r\n }", "function onMediaChanged(data) {\n var message = data.detail.message;\n if (message.result === SAP_RESULT_FAILURE) {\n console.error(\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check item type and add to player object
function checkAndAddItem(item) { console.log(`${player.name} takes the ${item.name}.`); // check if item is a weapon, add to player's weapon list if (allWeapons.includes(item)) { player.equip.weapon.push(item); } else if (allArmor.includes(item)) { // check if item is armor, add to player's armor pl...
[ "addItem(item) {\n this.checkType(item)\n this.addItems(item)\n }", "function addItem(player, item){\n //Add to inventory\n player.inventory.items.push(item)\n //Add passes to player\n getPasses(item).forEach(pass =>{\n if(!player.passes.includes(pass)){\n player.passes.push(pass)\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the tourDef DOM element (or false)
function _getTourDef(tourId) { var tourDefElements = jQuery(KingTour.tourSel); // iterate over the dom el inside the tour definition for ( var i = 0; i < tourDefElements.length; i++) { if (tourDefElements[i].getAttribute('id') == tourId) { return tourDefElements[i]; } } KingToolz...
[ "function forbbidenElement(el){\r\n editElement = editPanel.has(el).length || $(el).hasClass('edit-panel');\r\n pageElement = $(el).is('html') || $(el).is('body');\r\n return editElement || pageElement;\r\n}", "get isBuilderMode() {\n\t\tconst { element: pEl, id, root } = this.parent;\n\t\tif (this.build...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns array of widths of pieces of the timeline scaled to the width of the screen
function getScaledWidths(recipe, tlWidth, arrowMargin){ let widths = [] let parsedTimes = [] let totalTime = 0.0; let usableSpace = tlWidth-(arrowEndMargin*2); let i; //Determines total time from extracted times for (i = 0; i < recipe.instructions.length; i++){ parsedTimeInMinutes = parseTime(recipe....
[ "function calculateTimelineWidth() {\n\tvar selectTimelineWidth = document.querySelector('.Timeline');\n\ttimelineWidth = selectTimelineWidth.clientWidth;\n\treturn timelineWidth;\n}", "function scaleTimelineWidth() {\n $('.day').css('width', unitWidth);\n $('.month').each((index, item) => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inventory Declare a function called calcInventoryValue. It takes one parameter, an array of InventoryItem objects. It returns a number, the total value of all the products in the inventory array provided as an argument. If the array argument is empty, return 0.
function calcInventoryValue(items) { let totalValue = 0; for (const inventories of inventory) { totalValue += (inventories.product.price * inventories.quantity); } ; // console.log(totalValue); return totalValue; }
[ "function calcInventoryValue(inventoryItemsArray) {\n // Declare a variable for the itemPrice (item in array * its quantity)\n var itemPrice = 0;\n // Declare a variable for the totalPrice of all the items in the cart\n var totalPrice = 0;\n // Loop through the array and, for each item, calculate the...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adding objects to object array
addObject(obj){ this.objects.push(obj); }
[ "function add(array,object){\n// create a baseline status that there are no duplicate names by assigning it to false \n let duplicateName = false; \n// use for loop to search through the array to see if the object name matches a name in the array \n for( var i = 0; i < array.length; i++){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get full encoding string.
function getFullEncoding(spec) { return spec.encoding; }
[ "function getFullEncoding(spec){return spec.encoding;}", "getEncoding() {}", "function getFullEncoding(spec) {\n return spec.encoding;\n}", "function getMessageEncoding() {\n const messageBox = document.querySelector(\"#raw-message\");\n const message = messageBox.value;\n const enc = new TextEncode...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a request validate that all of the fields for it are valid and make sense. This includes verifying the following notions: Each type requested is present in types Only allow a name for a field to be specified once If an array is specified, validate that the requested field exists and comes before it. If fields is ...
function ctCheckReq(def, types, fields) { var ii, jj; var req, keys, key; var found = {}; if (!(def instanceof Array)) throw (new Error('definition is not an array')); if (def.length === 0) throw (new Error('definition must have at least one element')); for (ii = 0; ii < def.length; ii++) { req = def[ii]...
[ "function ctCheckReq(def, types, fields)\n {\n \tvar ii, jj;\n \tvar req, keys, key;\n \tvar found = {};\n \n \tif (!(def instanceof Array))\n \t\tthrow (new Error('definition is not an array'));\n \n \tif (def.length === 0)\n \t\tthrow (new Error('definition must have at least one ele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
WorkspaceIndexer: object Detects workspace counts and index of current workspace. Signals: countchanged( count ) : void: emitted when a workspace is added or removed. count : int: count of workspaces. indexchanged( index ) : void: emitted when user switches workspace or one of previous workspaces removed. index : int: ...
function WorkspaceIndexer(){ this._init(); }
[ "function modifyNumWorkspaces() {\n /// Setting the number of workspaces.\n Meta.prefs_set_num_workspaces(\n Utils.WS.getWS().workspace_grid.rows *\n Utils.WS.getWS().workspace_grid.columns\n );\n\n /* NOTE: in GNOME 3.4, 3.6, 3.8, Meta.prefs_set_num_workspaces has\n * *no effect* ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ResetHtml Removes the generated HTML from buildHtml() to populate a new list.
function resetHtml() { var list = document.getElementById("wad-list"); // Purge the list list.innerHTML = ''; return true; }
[ "function resetSearchList() {\n\t\t$('#itemsList').html('');\n\t}", "function clearTodoListHtml() {\n todoList.innerHTML = \"\"\n}", "function resetList(){\n pageList.innerHTML = \"\";\n}", "function resetList()\n{\n\tvar element = document.getElementById('resultslist');\n\telement.innerHTML = \"\";\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes path from filename, returning JUST the name of the file
function removePath(filename) { var pos = filename.lastIndexOf("/"); return filename.substr(pos+1); }
[ "function stripFilename(path) {\n\tif (!path) return \"\";\n\tconst index = path.lastIndexOf(\"/\");\n\treturn path.slice(0, index + 1);\n}", "function stripFilename(path) {\n if (!path)\n return '';\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}", "function remove_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a signed commit
async function sign ({ dir, gitdir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(dir, '.git'), fs: _fs, privateKeys, openpgp }) { const fs = new FileSystem(_fs); const oid = await GitRefManager.resolve({ fs, gitdir, ref: 'HEAD' }); const { type, object } = await GitObjectManager.read({ fs, gitdir, ...
[ "async function sign ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n privateKeys,\n openpgp\n}) {\n try {\n const fs = new FileSystem(_fs);\n const oid = await GitRefManager.resolve({ fs, gitdir, ref: 'HEAD' });\n const { type, object } = await re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize texture from an image.
function initTexture(image, textureObject) { // create a new texture gl.bindTexture(gl.TEXTURE_2D, textureObject); // set parameters for the texture gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); gl.texParameteri(gl.TEXTU...
[ "function initTexture() {\n\n // Create a new texture reference before loading the texture image in via JS\n earthTexture = gl.createTexture();\n earthTexture.image = new Image();\n \n // Background thread to load the image asynchronously. \n earthTexture.image.onload = function() {\n handl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set time elapsed in local storage
function setElapsed() { var time = endTime - startTime; timeElapsed += time; //var oldTime = chrome.storage.local.get("totalTime", function(items) { // return items.totalTime; //}); chrome.storage.local.set({"totalTime": timeElapsed}, function() { }); console.log(timeElapsed); }
[ "update() {\n this.ticks++;\n //2 ticks is one minute, to change the time switch the ticks / a number\n this.minutes = ((this.ticks / 2) % (60));\n this.hours = ((this.ticks / 2) / 60) % 24;\n this.days = ((this.ticks / 2) / (60 * 24));\n\n localStorage.setItem(\"Time\", JS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PROTECTED Changes the "Angle to the right side", "Angle to the left side" or "No angle" items of the popup menu associated to this connection to prevent the apparition of the actual middlePoint value as an option inside the popup menu.
function updateConnectionPopupMenu() { var action = null; var i = 0; for (var found = false; i < this.popupListItems.getLength() && !found; i++) { action = this.popupListItems.get(i).action; if (action == LEFT_CORNER || action == RIGHT_CORNER || action == NO_CORNER || action == "null") { found = true; ...
[ "get disableOptionCentering() { return this._disableOptionCentering; }", "set LeftCenter(value) {}", "function angle_OnClick()\n{\n\ntry {\n\tnAngles = DVD.AnglesAvailable;\n\n // return if there is only 1 viewing angle\n\tif (nAngles <= 1) return;\n\n\tnCurrentAngle = DVD.CurrentAngle + 1;\n\tif (nCurrentAn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PM use custom range check, dates should be always valid, basic compare should be enough replaced textBox.rangeCheck(date, constr)
function customRangeCheck(d, constraints, selector) { return ("min" in constraints ? (gdate.compare(d, constraints.min, selector) >= 0) : true) && ("max" in constraints ? (gdate.compare(d, constraints.max, selector) <= 0) : true); // Boolean }
[ "function validateRange(){\r\n\tvar vRFormName = \"\";\r\n\tvar vMissingInfo= \"\";\r\n\tvar vFocusCounter=0;\r\n\r\n\tif(arguments.length > 1)\r\n\t{\r\n\t\tvRFormName = arguments[0];\r\n\t\tfor(vRCounter=1; vRCounter<arguments.length; vRCounter=vRCounter+2)\r\n\t\t{\r\n\t\t\tif(eval(trimSpaces(vRFormName[argument...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process Models convert their moves into beat by beat positions and actions add models to a list of all the models in this walk
process_models() { //for each model for(var i=0; i<models.length; ++i) { //pre set starting positions //left - middle left - middle - middle right - right if(typeof models[i].start == "string") { //if the starting position includes the word "middle" if(models[i].start.indexOf("...
[ "recordModelNewPosition(i) {\n //get new model position\n models[i].x += this.step * models[i].moves[models[i].moves.length-1].dx;\n models[i].y += this.step * models[i].moves[models[i].moves.length-1].dy;\n //record new model position\n models[i].moves[models[i].moves.length-1].x = models[i].x;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
58 RQEVN test cases
function GetTestCase_RQEVN () { var testCases = []; for (NN = 1; NN < 4; NN++) { if (NN == 1) nodeId = 0; if (NN == 2) nodeId = 1; if (NN == 3) nodeId = 65535; testCases.push({'nodeId':nodeId}); } return testCases; }
[ "function q5_test() {\r\n // todo: write a test driver\r\n // hint: be sure to test for all 3 options\r\n}", "function q4_test() {\r\n // todo: write a test driver\r\n // hint: be sure to test for true and false\r\n}", "function GetTestCase_RQNPN () {\n\t\tvar testCases = [];\n\t\tfor (NN = 1; NN < 4; NN++)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: _fnAjaxUpdateDraw Purpose: Data the data from the server (nuking the old) and redraw the table Returns: Inputs: object:oSettings dataTables settings object object:json json data return from the server. The following must be defined: iTotalRecords, iTotalDisplayRecords, aaData The following may be defined: sCo...
function _fnAjaxUpdateDraw ( oSettings, json ) { if ( typeof json.sEcho != 'undefined' ) { /* Protect against old returns over-writing a new one. Possible when you get * very fast interaction, and later queires are completed much faster */ if ( json.sEcho*1 < oSettings.iDraw ) { retur...
[ "function _fnAjaxUpdateDraw ( oSettings, json )\n {\n if ( typeof json.sEcho != 'undefined' )\n {\n /* Protect against old returns over-writing a new one. Possible when you get\n * very fast interaction, and later queires are completed much faster\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests if the given message is a response message
function isResponseMessage(message) { var candidate = message; return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null); }
[ "function isResponseMessage(message) {\n const candidate = message;\n return candidate && (candidate.result !== void 0 || !!candidate.error) && (typeof candidate.id === 'string' || typeof candidate.id === 'number' || candidate.id === null);\n}", "function isResponseMessage(message) {\n const candidate = mess...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return user local timezone
function getTimeZone() { const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; return (userTimeZone); }
[ "function getUserTimezone() {\n var timezone = jstz.determine();\n return timezone.name();\n}", "get timezone() {\n if (!localStorage.startingTime) return undefined\n\n let offset = this.startingTimeInfo.getTimezoneOffset()\n\n offset = 0 - offset == 0 - -offset ? '+ ' : '- ' + offset ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
canvasEventHandlers add handlers to the events from the canvas. This is done to emit out the operations done by the user to the canvas.
canvasEventHandlers(canvas) { if (canvas == null) { return; } console.log(`Received a request to wire up the canvas event handlers`); /** * **/ canvas.on('object:added', (e) => { if (e.target.id != null) { return; } e.target.id = uuid4(); /** ...
[ "registerEvents() {\n // Mouse\n this.canvas.addEventListener('mousedown' , this.eventsHandler.handleStart , false);\n this.canvas.addEventListener('mousemove' , this.eventsHandler.handleMove , false);\n this.canvas.addEventListener('mouseup' , this.eventsHandler.handleEnd , f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function, when triggered, get the previous prime value from a div, and then prints the next one
function printNextPrime() { var num = parseInt(document.getElementById("numberinfo").innerHTML); console.log(document.getElementById("numberinfo").innerHTML); setTimeout(document.getElementById("numberinfo").innerHTML = findNextPrime(num), 1000); }
[ "function prime_number_postion_num(){\n var read=require(\"readline-sync\");\n var numbers_prime=read.questionInt(\"enter prime number\");\n var c=0;\n var i=0;\n while(c<numbers_prime){\n j=1\n count=0\n while (j<=i){\n if (i%j===0){\n count++\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Manages the state of the browser action button to ensure that it displays correctly for the currently active tab. An onchange callback will be called when the extension changes state. This will be provided with the tabId, the current and previous states. Each state has a method to enable it such as activateTab() and a ...
function TabState(initialState, onchange) { var _this = this; var currentState; var previousState; this.onchange = onchange || null; /* Replaces the entire state of the object with a new one. * * newState - An object of tabId/state pairs. * * Returns nothing. */ this.load = function (newSta...
[ "function toggleState(tabId) {\r\n // default tab state is undefined when extension is uninitiated\r\n if (typeof tabStates[tabId] === 'undefined') {\r\n tabStates[tabId] = TAB_STATE.ACTIVE;\r\n return TAB_ACTION.INIT;\r\n }\r\n else if (tabStates[tabId] == TAB_STATE.ACTIVE) {\r\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
======== pinmuxRequirements ======== Return peripheral pin requirements as a function of config
function pinmuxRequirements(inst) { let misoRequired = false; let mosiRequired = false; let txRequired = true; let rxRequired = true; switch (inst.duplex) { case "Full": misoRequired = true; mosiRequired = true; break; case "Master TX Only": ...
[ "function pinmuxRequirements(inst)\n{\n /* if the peripheral interface is not specified, there's nothing to do */\n if (inst.resourceType == \"\") {\n return ([]);\n }\n\n /* compose single requirement from inst configs */\n function filterByName(pobj) {\n var ok = inst.resourceName == ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
About the clock oscillator in runQueenOperatingMineStrategy() and runSecOperatingStrategy(): The queen cycles her own cell through four or five or six colors when the experimental FoodControlled Oscillator feature is enabled, depending on her current amount of hoarded food, or always through six colors otherwise. The s...
function runQueenOperatingMineStrategy() { // Assert: compass is set, secretary and self mutually at CCW[compass+1] // (facing in opposite directions), gardener at CCW[compass]. if ((adjFoes[ANT_QUEEN] > 0) && (myFood > 0)) { // Emergency... Forget about our clock for a moment. // Try to create a bodygu...
[ "function runQueenSettlingStrategy() {\n // Assert: compass is set, gardener and self mutually at CCW[compass]\n // (facing in different directions). Phase ends with the secretary at\n // our CCW[compass+1] and the clock not yet running.\n // When resettling after an emergency, we gain one tempo by cr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
outside_ip_address computed: true, optional: false, required: false
get outsideIpAddress() { return this.getStringAttribute('outside_ip_address'); }
[ "function endpointAddress(options) {\n return ({\n ip: (options && options.ip) || null,\n }).merge(options);\n}", "fetchIpAddress(ip) {\n console.log(ip)\n }", "get ipAddress() {\n return this.getStringAttribute('ip_address');\n }", "function validateIPAddressWithoutCIDR(ipaddress){...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
can be called to output debug information
function showDebugInfo() { console.log(); }
[ "function DebugInfo() {\n }", "function debug() {\n \n}", "function ForDebug() {}", "debug() {\n this.logger.debug('Printing source mapper debugging information ...');\n for (const [key, value] of this.infoMap) {\n this.logger.debug(` source ${key}:`);\n this.logger.de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
.append adds elements to a target fluent doc(target).append(children); legacy doc.append(target, children);
function append(target, children){ var target = getTarget(target), children = getTarget(children); if(isList(target)){ target = target[0]; } if(isList(children)){ for (var i = 0; i < children.length; i++) { append(target, children[i]); } ...
[ "append(target) {\n var args = Array.prototype.slice.call(arguments);\n if (!Array.isArray(target)) {\n target = [target];\n }\n return target.concat.apply(target, args);\n }", "append(content) {\n if (this.elements.length === 0) return;\n // if (typeof content === 'object' &&\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::CodeDeploy::DeploymentGroup.TargetGroupInfo` resource
function cfnDeploymentGroupTargetGroupInfoPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnDeploymentGroup_TargetGroupInfoPropertyValidator(properties).assertSuccess(); return { Name: cdk.stringToCloudFormation(properties.name), }; }
[ "function CfnDeploymentGroup_TargetGroupInfoPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `VisibilityConfigProperty`
function CfnWebACL_VisibilityConfigPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but receiv...
[ "function CfnRuleGroup_VisibilityConfigPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an obje...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the screen information from xrandr and returns the first connected screen
async function getXrandrScreen(){ const output = await exec('DISPLAY=:0.0 xrandr'); const xScreens = parseXrandr(output); Object.keys(xScreens).forEach(o => { xScreens[o].output = o }) const selectedScreen = Object.values(xScreens).find(d => d.connected && !!d.modes.length); if(!selectedScreen){ throw new...
[ "function getCurrentScreen() { return hwc.getCurrentScreen(); }", "function getScreen(){\n\n\t\treturn g_screenBuf;\n\n\t}", "function getCurrentScreen() {\n return curScreenKey;\n}", "function getActiveScreens() {\n return screenSocketMap.keys();\n}", "function getElectronScreen(){\n const screens = e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepends a root to the url if a 'root' option is provided
function addRootToUrl ({ root, url }) { if (!root) return return { url: join(root, url) } }
[ "function setRootUrl() {\n var url;\n if (req.headers.host.includes(process.env.APP_NAME)) {\n url = 'https://' + req.headers.host\n } else {\n url = 'http://' + req.headers.host\n }\n global.rootUrl = url\n }", "function getRootUrl() { var a = window.lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
request to add a friend by querying firestore and creating documents in both user's 'Friends' collections.
async function addFriend(uid) { const currentUserData = await getCurrentUserDataAsync(); db.collection('users').doc(currentUserData.id).collection('Friends').doc('sent' + uid) .set({ isConfirmed: false, friendID: uid, }) .then(() => { console.log("Doc...
[ "function add_friend_request_to_database(User, me, friend) {\n User.findOne(\n {\n username: friend,\n },\n function (err, user) {\n if (err) {\n console.log(err);\n return;\n }\n let newFriendRequest = [...user.friend_request];\n User.findOne(\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is very specific for the plotting needs of this dashboard, after using the countBy function. This allows the creation of separate arrays from the countBy JS object that was created. count_by_data is the JS object created in countBy, property is the value you want in your array. This will also put a 0 in p...
function get_display_data(count_by_data, property) { return Object.values(count_by_data).map(item => { return item[property] || 0; }); }
[ "function updateComponentCountTable() {\n let count = {\n MOVE: 0,\n WORK: 0,\n CARRY: 0,\n ATTACK: 0,\n RANGED_ATTACK: 0,\n HEAL: 0,\n CLAIM: 0,\n TOUGH: 0\n };\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if there are upcoming talks and hides dedicated closest specific parent otherwise
checkUpcomingTalksPresent() { if (this.talksJson.length === 0) { this.talksDataEl.closest('.js-talks-data_upcoming-only__hide-when-empty').style.display = 'none'; } }
[ "function findAndHide(parent, src) {\n if(parent != null) {\n if(parent.id.indexOf(\"hyperfeed_story_id\") !== -1) {\n parent.style.display = \"none\";\n console.log(\"Hiding Sarahah post with id \" + parent.id + \" and link \" + src);\n console.log(\"Total Blocked: \" + ++totalBlocked);\n } e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show dialog with YAML function config
function viewConfig() { ngDialog.open({ template: '<ncl-function-config-dialog data-close-dialog="closeThisDialog()" ' + ' data-function="ngDialogData.function">' + '</ncl-function-config-dialog>', ...
[ "function viewConfig() {\n ngDialog.open({\n template: '<ncl-function-config-dialog data-close-dialog=\"closeThisDialog()\" ' + ' data-function=\"ngDialogData.function\">' + '</ncl-function-config-dialog>',\n plain: true,\n data: {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to update the total sales column with additional sale
function updateTotalSales() { // Query to update total sales based on product id var queryTerms = "UPDATE products SET ? WHERE ?"; // parseFloat is required to make sure the math is handled with decimal values, not string var grandTotalSales = parseFloat(newSales) + parseFloat(totalSales); connec...
[ "function productSales(data, totalCost, id) {\r\n // we take whatever the product sale was and add the gross revenue\r\n var productSale = totalCost + data[0].product_sales;\r\n connection.query(\r\n \"UPDATE products SET ? WHERE ?\",\r\n [\r\n {\r\n product_sales: productSale\r\n },\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makeHWHills() Purpose: returns an Object3D containing three hills grouped together (hills taken from the map functions) origin: lower right corner of the hill group (aligns with the southeastern corner of the hidden world) Parameters: height (number): the height of the leftmost hill (the other two hills are scaled from...
function makeHWHills (height, radius, image) { var frame = new THREE.Object3D(); var hillLeft = makeHill(height, radius, image, 0); var hillRight = hillLeft.clone(); var hillBack = hillLeft.clone(); hillRight.scale.y = 0.8; hillRight.position.set(0, 0, -radius); frame.add(hillRight); hillLeft.position.set(-r...
[ "function createHair(params){\n var hairFrame = new THREE.Object3D();\n \n addHairBase(hairFrame,params);\n addFringe(hairFrame,params);\n \n \n // creates a row of hair tufts across the back of the head\n var hairTuftAngle = Math.PI/2;\n \n while (hairTuftAngle <= (3/2)*Math.PI){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return all squares that fits the param filter
function filterSquares(fnSquare) { return _board.flatMap(row => row.filter(square => fnSquare(square))); }
[ "getAllSquares() {\n return this.squares.flat();\n }", "getFillableSquares() {\n return this.squares.flat().filter((square) => {\n return !this.gameElements.find(e => e.occupies.includes(square))\n && square !== this.startSquare\n && square !== this.endSqu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
repaints all the labels
function repaintAllLabels(){ //enableLoadingScreen(); //give chance for loading screen to pop up //setTimeout(function() { repaintLabels(undefined); //disableLoadingScreen(); //},0); }
[ "redrawLabels() {\n this.redrawVerticalLabels();\n this.redrawHorizontalLabels();\n }", "function drawLabels() {\n drawDataLabels();\n updateCompositeLabels();\n }", "function redrawLabels() {\n labels\n .transition()\n .duration(1500)\n .attr(\"x\", d => d.x)\n .a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Map over this.state.friends and render a FriendCard component for each friend object
render() { return ( <Wrapper> <Title>Maryland Legislators on House Bill 1300</Title> {this.state.friends2.map(friend2 => ( <FriendCard name={friend2.LastName} image={friend2.Portrait} district={friend2.District} vote2020={friend2.Vote20...
[ "render() {\n return (\n <Wrapper>\n <Title>Friends List</Title>\n {this.state.friends.map(friend => (\n <FriendCard\n removeFriend={this.removeFriend}\n id={friend.id}\n key={friend.id}\n name={friend.name}\n image={friend.image}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selects all sections in filtered Section window
function selectAllSections() { $("#section-frame").children("div").each(function(index, value) { $("#"+value.id+"-checkbox").prop("checked", true); }); }
[ "function selectAll() {\n\t\tif(unique <= 0) {\n\t\t\tselections = [];\n\t\t}\n\t\telse {\n\t\t\tselections = [[heatLimits.min, heatLimits.max, topMarg + selectionBarTopMargin, topMarg + drawH - selectionBarBottomMargin, 0]];\n\t\t}\n\t\tdrawSelections();\n\t\tupdateLocalSelections(true);\n\t\tsaveSelectionsInSlot(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: GET To get airline by Id.
function _getAirlineById(req, res, next) { var airlineId = req.params.id; if(!COMMON_ROUTE.isValidId(airlineId)){ json.status = '0'; json.result = { 'message': 'Invalid Airline Id!' }; res.send(json); } else { AIRLINES_COLLECTION.findOne({ _id: new ObjectID(airlineId)}, function (airlineerror, getAirline) ...
[ "function getAirportById(id, airports)\r\n{\r\n for(let i = 0; i < airports.length; i++)\r\n {\r\n //console.log(\"checking \"+airports[i].airportId+\" against \"+id);\r\n if (airports[i].airportId == id)\r\n {\r\n return airports[i];\r\n }\r\n }\r\n return null;\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if current inline in exist before inline
isExistBeforeInline(currentInline, inline) { if (currentInline.line === inline.line) { return currentInline.line.children.indexOf(currentInline) < inline.line.children.indexOf(inline); } if (currentInline.line.paragraph === inline.line.paragraph) { return ...
[ "isExistAfterInline(currentInline, inline) {\n if (currentInline.line === inline.line) {\n return currentInline.line.children.indexOf(currentInline) >\n inline.line.children.indexOf(inline);\n }\n if (currentInline.line.paragraph === inline.line.paragraph) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a copy of the given morph.
setFromMorph(morph) { //----------- this.fourCCName = morph.getName(); return this.amount = morph.getAmount(); }
[ "clone () {\n return new this.constructor(this.attributes);\n }", "clone(result) {\n return ClipShape.createFrom(this, result);\n }", "clone() {\n return new this.constructor(this.attributes);\n }", "clone() {\n const clone = new this.constructor()\n clone.copyFrom(this)\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add album data to db
addData(newAlbum) { // typeof(newImage) == Image // if (!enable()) return null; // add all images to img db for (let image of newAlbum.albumImages) { _imgur.db.image.addData(image); } // search album ob...
[ "addAlbum({name, coverImg, ownerId, timestamp}){\n this.create(\n {name, coverImg, ownerId: window.localStorage.getItem('ownerId'), timestamp},\n {\n success: (response)=>{\n this.add({response});\n }\n }\n );\n }", "function db_addAlbum(albumObjs, callback) {\n\tconso...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Type of the ViewChild decorator / constructor function.
function ViewChildDecorator() {}
[ "function ViewChildDecorator(){}", "function ViewChildDecorator() { }", "function ViewChildrenDecorator(){}", "function ViewChildrenDecorator() {}", "function ContentChildDecorator() {}", "function ContentChildDecorator(){}", "function ViewChildrenDecorator() { }", "function ContentChildDecorator() { ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
send a player's turn
sendTurn(turn) { this.socket.emit('turn', turn); }
[ "function playerTurn() {\n var message;\n if (params.turn === 1) {\n message = \"It's your turn!\";\n }\n else {\n message = \"It's \" + params.oppUserName + \"'s turn!\";\n }\n showMessage(message);\n }", "sendTurn(pIdx, turn) {\n this.sendToPlayer(pIdx, `You selected ${turn}`);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper method to check for dupes before adding a new block
addBlockToChain(newBlock) { const height = newBlock.header.height; const generation = this.chainCache[height] || []; if (generation.some(block => block.cid === newBlock.cid)) { return; // alredy exists, don't add it again. } this.chainCache[height] = generation.concat(newBlock); }
[ "addBlockToChain (newBlock) {\n const height = newBlock.header.height\n const generation = this.chainCache[height] || []\n if (generation.some(block => block.cid === newBlock.cid)) {\n return // alredy exists, don't add it again.\n }\n this.chainCache[height] = generation.concat(newBlock)\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fetch data local MOCKUP
function fetchdataMOCKUP() { setUsers(JSON_MOCKUP); }
[ "fetchFertilizerData(){\n //const API_URL = `http://35.200.155.144:8000/fertilizerdetail`\n const API_URL = `http://localhost:8000/fertilizerdetail`\n return ezFetch.get(API_URL)\n }", "function fetchFromOne(){\n\tvar url = 'http://localhost:3000/test/one';\n\t\n\tfetch(url, {\n\t method: 'GET', \n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
seraches through the addresses of this group to find the address with the label of the checked radio button.
getSelectedAddress() { // next to the selected address appears the label var selector = `input[name=${ADDRESSGROUP_NAME}]:checked` var $selected = $(selector).first() if ($selected.length == 0) { console.error(`CSS selector ${selector} found no checked button in the radio gro...
[ "function displayAddresses(addressOptions) {\n // Display each of the address options\n if (addressOptions.length > 0) {\n for(const addressOption of addressOptions) {\n const htmlElements = [];\n const radioInput = `\n <input\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use the class method CookieJar.deserialize instead of calling this directly
_importCookies(serialized, cb) { let cookies = serialized.cookies; if (!cookies || !Array.isArray(cookies)) { return cb(new Error("serialized jar has no cookies array")); } cookies = cookies.slice(); // do not modify the original const putNext = err => { if (err) { return cb(err...
[ "_importCookies(serialized, cb) {\n let cookies = serialized.cookies;\n if (!cookies || !Array.isArray(cookies)) {\n return cb(new Error(\"serialized jar has no cookies array\"));\n }\n cookies = cookies.slice();\n // do not modify the original\n const putNext = err => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates the coverage for an individual file
function calculateFileCoverage (baseDbcAssertions, baseFunctionCount, overallCoverage) { const assertions = calculateCoverageDelta(overallCoverage.dbcAssertions, baseDbcAssertions) const functions = calculateCoverageDelta(overallCoverage.functionCount, baseFunctionCount) // Take the number of assertions per file,...
[ "function calculateCoverage() {\n var numTrue = 0;\n for (var i in codeCoverage) {\n if (codeCoverage[i]) {\n numTrue++;\n }\n }\n return numTrue * 100 / codeCoverage.length\n}", "function calculateCoverage() {\n var numTrue = 0;\n for (var i in codeCoverage) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compile Sass into CSS In production, the CSS is compressed
function sassToCss() { return gulp.src('src/assets/scss/builders/main.scss') .pipe($.sourcemaps.init()) .pipe($.sass({ includePaths: PATHS.sass }) .on('error', $.sass.logError)) .pipe($.autoprefixer({ browsers: COMPATIBILITY })) //...
[ "function compileSass() {\n return gulp.src([\n path.css.src + 'app.scss',\n path.css.src + 'holder.scss'\n ]).pipe(\n sass({}).on('error', sass.logError)\n )\n .pipe($.sourcemaps.init())\n .pipe($.autoprefixer({\n browsers: COMPATIBILITY\n }))\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load details for sample
function loadSampleDetails( ctx, next ) { var sampleKey = ctx.params.sampleKey; self.editorData.input( null ); // If params have sample key if ( sampleKey === 'new' ) { self.editorData.input( {} ); } else if ( sampleKey ) { // Load details for sample key var getDetails = qualityCo...
[ "function loadDetails() {\n getDetails(\"visitorcenters\");\n getDetails(\"campgrounds\");\n getDetails(\"alerts\");\n getDetails(\"articles\");\n getDetails(\"events\");\n getDetails(\"newsreleases\");\n getDetails(\"lessonplans\");\n getDetails(\"people\");\n getDetails(\"places\");\n}", "function load...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns position of the the head 'bone'
headPos() { // FIXME this is way suboptimal as it forces computation this.head().getTransformNode().computeWorldMatrix(true); var headPos = this.head().getTransformNode().getAbsolutePosition(); return headPos.clone(); }
[ "position() {\n return VrMath.getTranslation(this.headMatrix);\n }", "get getHeadX(){\n\t\treturn this.head.x = Math.round(document.querySelector('#snake_head').offsetLeft);\n\t}", "static get xboxDeployKinectHeadPosition() {}", "function heading(){\n return position.heading;\n }", "get boneIn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for hall current slider
function hallcurrentExperiment(scope){ /** Setting the slider value to the label variable */ hallcurrent = scope.hallcurrent_num = scope.hallcurrentNum; calculation(scope); }
[ "function applyCurrent() {\n\tvar current = openSlider.get(0).slick.currentSlide; //current index in the slider\n\topenHeadings.removeClass(\"current_heading\");\n\topenHeadings.eq(current).addClass(\"current_heading\");\n}", "function slider(){\n currentImage=$(this).attr(\"rel\");\n sliderLeft();\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear the order, retains name and delivery cost if param is false
function clearOrder(clearAll) { if (clearAll) { order.id = null; order.name = ""; order.delivery = 0; let node = document.getElementById("restaurant"); while (node.firstChild) { node.removeChild(node.firstChild); } } order.items = {}; order.sub...
[ "clearCheckoutDeliveryDetails() {\r\n this.clearCheckoutDeliveryAddress();\r\n this.clearCheckoutDeliveryMode();\r\n this.clearCheckoutDeliveryModes();\r\n }", "function clearOrderdetails() {\n $scope.Order_Detail_No = 0;\n $scope.Item_Name = \"\";\n $scope.Notes = \"\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cancel uploading newly uploaded cover photo and displaying previously adedd with previous db record.
function cancelCoverPhotoChanges(element) { var loader = addLoadingImage( $(element), 'before', 'loading_small_purple.gif', 0, 0,"save_cover_loading" ); $(element).hide(); $('input#save_cover').hide(); $('ul.cover_photo_menu').hide(); var current_user_id = $('input#upld_cvr_photo').attr('rel'); var cover_img_na...
[ "function cancelPicture() {\n\n // Remove preview image\n const elem = document.getElementById('imageFile');\n elem.src = '';\n\n // Toggle gallery section\n $('#preview').addClass('d-none');\n $('#success').addClass('d-none');\n $('#gallery').removeClass('d-none');\n $('#addSpace').removeCl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles the release of a pokemon. It makes sure to check if what we are clicking is a button tag since we added it to our pokemonContainer
static handleRelease(event){ if(event.target.tagName === "BUTTON"){ let pokemonId = parseInt(event.target.parentNode.dataset.id) event.target.parentNode.remove() deletePokemon(pokemonId) } }
[ "function releaseClick(event){\n\t\treleasePoke(event.target.name)\n\t}", "function releaseaPokemon(e){\n const pokemonid = e.target.getAttribute(\"data-pokemon-id\")\n fetch(POKEMONS_URL + \"/\" + pokemonid, {\n method: 'DELETE',\n headers: {\n 'Content-Type': 'application/json'\n }\n })\n .th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::WAFv2::RuleGroup.SqliMatchStatement` resource
function cfnRuleGroupSqliMatchStatementPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnRuleGroup_SqliMatchStatementPropertyValidator(properties).assertSuccess(); return { FieldToMatch: cfnRuleGroupFieldToMatchPropertyToCloudFormation(prop...
[ "function cfnWebACLSqliMatchStatementPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnWebACL_SqliMatchStatementPropertyValidator(properties).assertSuccess();\n return {\n FieldToMatch: cfnWebACLFieldToMatchPropertyToCloudFormation(pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check the state of a page
function check_page_state() { //if no user_data or state data, skip it if (typeof(user_data) == 'undefined' || typeof(user_data.navstate) == 'undefined') { return false; } //no vc if (typeof(vc_info.vc) == 'undefined' || vc_info.vc=='dist/user/data' || vc_info.vc=='dist/user/map' || vc_info.vc=='user/ma...
[ "function checkPage(){\n\n\t\tvar page_id = $(\".navigation ul li.active a\").attr(\"href\").split(\"#\")[1];\n\n\t\tgoto_page(page_id);\n\n\t}", "function checkPage() {\n currentPage\n console.log(\"Current Page: \", currentPage)\n }", "function checkState() {\n if (state === `homepage`) {\n homepag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all number values within parent container box
function get_box_vals($small_box) { var vals = []; $small_box.siblings().each(function(i) { var val = $(this).text(); if (val) { vals.push($(this).text()); } }); return vals; }
[ "function valueDragToBoxes() {\n var totalValue=0;\n for(var i = 0; i<dragToBoxes.length; i++) {\n \n totalValue += dragToBoxes[i].contents*Math.pow(10, i);\n }\n return totalValue;\n}", "function getNums (identifier) {\n myList = document.getElementsByClassName(identifier);\n myNu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts date/time to SLT. datetime may have a timezone set (the conversion is being performed then) If datetime has no timezone, we consider it in SLT already. Also, datetime may be empty current SL time is being returned then
function timeToSLT(datetime = undefined) { if (!datetime) { datetime = new Date(); } return (0, moment_SLT_1.default)(datetime); }
[ "function TimeConv(datetime){\n\n\tmomentTime = 'No Time has beed found';\n\n\tif (datetime) {\n\n\t\tlet momentDate = moment(datetime);\n\n\t\tmomentTime = momentDate.format('LT');\n\n\t}\n\n\treturn momentTime;\t\n\n}", "function getLocalizedDateTime( date ) {\n if (logLevel >= 4) { logToWorkflow(\"entering ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The other returns use and system for each legacy document type
function GetDocumentSystemUse(abbrev) { var system = ""; var use = ""; const DocTypeToSystemMap = options.SystemMap; var MyIndex = -1; for (let i = 0; i < DocTypeToSystemMap.length; i++) { if (DocTypeToSystemMap[i].type == abbrev) { MyIndex = i; break; } ...
[ "function determineDocType(type) {\n\t\n\tconsole.log(\"Type: \" + type);\n\t\n\tif (type == 'jpg' || type == 'jpeg' || type == 'png' || type == 'bmp') {\n\t\tesindex = 'images';\n\t}\n\telse if (type == 'mp4' || type == 'wmv' || type == 'avi' || type == 'mov') {\n\t\tesindex = \"videos\";\n\t}\n\telse if (type == ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
edit project function, takes info from form and and it to state in edit variable
editProject(id, title, description, URL) { this.setState({ editProjectData: { id, title, description, URL }, editProjectModal: !this.state.editProjectModal }); }
[ "function editButtonClick() {\n\tid = $('body > div.project form.project input.id').val();\n\tname = $('body > div.project form.project input.name').val();\n\tdescription = $('body > div.project form.project input.description').val();\n\teditProject(id, name, description);\n}", "function handleProjectEditClick(e)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disable backing up of keys.
disableKeyBackup() { if (this.algorithm) { this.algorithm.free(); } this.algorithm = undefined; this.backupInfo = undefined; this.baseApis.emit('crypto.keyBackupStatus', false); }
[ "function lockdown() {\n delete exportedKeys.keys;\n delete exportedKeys.passphrase;\n delete exportedKeys.privateKey;\n delete self.exportedKeys;\n delete self.importKeys;\n delete self.setKeyPair; \n delete self.lockdown;\n passphrase = undefined;\n }", "function disab...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Index of element in list with given UID.
function indexOf(obj, uid) { for (var i = 0; i < obj().length; ++i) { if (obj()[i].uid() == uid) { return i; } } return -1; }
[ "function findUser(uid) {\n var i=0; // array/loop index\n var found = false; // boolean for the user search\n\n // find the user corresponding to the given user id\n while (i < userData.length && (!found)) {\n if (uid === userData[i].person.userID) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hang callback on mouse wheel up event of this frame
onMouseWheelUp(callback, isOnce = false) { this._mouseWheelUpCallbacks.push([ callback, isOnce ]); }
[ "function mouseUp(event) {\n if(dustyFrame) {\n rub.pause();\n dragging = false;\n }\n }", "function onWheel(tracker,event){handleWheelEvent(tracker,event,event);}", "function mouseUpHandler() {\n mouseDown = false;\n console.log(\"mouse u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find NPCs in room
function npcInRoom (id) { var roomNPCs = []; for (var i = 0; i < npcs.length; i++) { if (npcs[i].roomid === id) { roomNPCs.push(npcs[i]); } } return roomNPCs; }
[ "function findTargets() {\n getEnts({radius: radius_homing, callback_done: 'foundTargets', channel: 'player', fields: ['pos']});\n }", "function findSpawnsInRoom(r) {\n /* Make sure we have storage */\n if (undefined === Game.rcache) {\n Game.rcache = {};\n }\n if (und...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Admin can see All the Representatives.
async function showRepresentatives(req, res) { if (req.user.user == 'admin') { const result = await RepresentativeModel.find(); if (result != null) { return res.status(200).json({ result, message: "All Representatives Present.." }); } else { return res.status(...
[ "async index() {\n return await Orphanage.query().where('admin_accepted', false).fetch();\n }", "static displayContestants(){\n // get contestants that are stored in local storage\n const contestants = Store.getContestants();\n\n //loop through the contestants in ls\n contestants.f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make up Ghettonest data from Spotify data
function makeUpGhettonest (remainderUris, spotifyDatas) { var newGhettoNests = []; // match the remainderUris with spotifyDatas _.each(spotifyDatas.items, function (spotifyData) { _.each(remainderUris, function (uri) { if (uri !== spotifyData.track.uri) { return; } // make up a Ghett...
[ "function getEchonestData (playlistSongs) {\n playlistSongs.items = util.solveDuplication(playlistSongs.items);\n var spotifyUris = mapUris(playlistSongs);\n var tracks = [];\n\n // 1) check database for existing songs\n return GhettoNest.find({spotify_id: { $in: spotifyUris}})\n .then(function(dbSongs) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stop the game when stop is clicked
function stop() { if (isGameActive) { isGameActive = false; } }
[ "function stop() {\n console.log(\" stop button clicked \");\n // game.gameOverScreen();\n game.stopGame();\n\n }", "function stop() {\n isGameActive = false;\n }", "function stopGame() {\n\tgame.stop();\n\trender();\n}", "stop() {\n clearInterval(this.gameLoop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API for Channel Live
function live(){ //console.log("Begin Script"); $.ajax({ datatype: 'json', //url: 'https://api.twitch.tv/helix/streams?user_login=BackgroundGaming_', url: 'https://api.twitch.tv/helix/streams?user_login=TheGamingSaloonNetwork', headers: { "Client-ID": 'o118lfy65junb52nuye0weh4x...
[ "function KalturaLiveChannelService(client){\n\tthis.init(client);\n}", "function openChannelConnection() {\n $.ajax({\n type: 'POST',\n dataType: 'json',\n url: ('/playlists/edit/' + encodeURIComponent(playlistId) +\n '/generate_channel_token' +\n '?uuid=' + encodeURICompo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On load, html page will fetch the stored score
function loadScore() { level1TopScore = Number(localStorage.getItem("level1TopScore")); level2TopScore = Number(localStorage.getItem("level2TopScore")); if (level2TopScore == null) { level2TopScore = 0; } if (level == 1) { topScore = level1TopScore; } else { topScore = level2TopScore; } document.getElemen...
[ "function initializeScore() {\n if (!window.localStorage.getItem('score'))\n window.localStorage.setItem(\"score\", \"0\");\n window.localStorage.setItem(\"name\", \"DEFAULT\");\n document.getElementById(\"score_value\").innerHTML = \"Highscore : \" + window.localStorage.getItem('name') + \" - \" + ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear comment, comment_group tables and resets school's comments/scores
resetData() { var resetColumns = `UPDATE school SET score=NULL, comment_group_id=NULL, total_score=0, score_count=NULL, review_count=NULL WHERE comment_group_id <> 0;`; await(SqlHelper.resetTable(models.Comment.tableName)); ...
[ "function resetStats() {\n score = 0;\n questionNumber = 0;\n $('.score').text(0);\n $('.questionNumber').text(0);\n }", "function resetCounters()\n{\n\t//reset questionCounter and counterCorrectAnswers\n\tquestionCounter = 0;\n\tcounterCorrectAnswers = 0;\n}", "function resetScor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load restaurants from indexed DB.
static loadRestaurantsFromIndexedDB(id) { return dbPromise.then(function (db) { const tx = db.transaction('restaurants'); const restaurantsStore = tx.objectStore('restaurants'); const idIndex = restaurantsStore.index('by-id'); return id ? restaurantsStore.get(Number(id)) : idIndex.getAll(); }).then(func...
[ "function readRestaurantsFromIDB() {\n var request = indexedDB.open('restaurants');\n request.onsuccess = function(e){\n var db = e.target.result;\n var transaction = db.transaction(['restaurant'], 'readonly');\n var store = transaction.objectStore('restaurant');\n return store.get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve selection cell format
retrieveCellFormat(start, end) { if (start.paragraph.isInsideTable && end.paragraph.isInsideTable) { this.cellFormat.copyFormat(start.paragraph.associatedCell.cellFormat); this.getCellFormat(start.paragraph.associatedCell.ownerTable, start, end); } else { //Wh...
[ "getCharacterFormatForSelectionCell(cell, start, end) {\n for (let i = 0; i < cell.childWidgets.length; i++) {\n this.getCharacterFormatForBlock(cell.childWidgets[i], start, end);\n }\n }", "format_selected(format_command) {\n let range = window.getSelection().getRangeAt(0);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check file size in bytes against a max size in MB
function isTooBig(file, maxFileSize) { const fileSize = file.size / 1024 / 1024 // in MB return fileSize > maxFileSize }
[ "sizeGuard(file, sizeLimit) {\n return !sizeLimit || file.size < sizeLimit * 1024 * 1024; // TODO : improve\n }", "function checkInputFilesize(input, limit) {\n var fileSize = (((input.files[0].size) / 1024).toFixed(2) / 1024).toFixed(2);\n\n if(fileSize >= limit) {\n return true;\n }\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates a badge for some container jQuery is required for this plugin
function RT_Badge(userOpts) { this.$badge = null; this.z = 0; this.opts = { container : $("body")[0], position : "topright", theme : "red", offsetX : -10, offsetY : -10, animate : "blink", shape : "round", x : 0 }; // add the badge to the page this.apply = function(userOpts) { this.opts = $.e...
[ "function constructManualBadgeMode(){\n removeAllChildren(UIDiv);\n \n appendPWithReturnButton(UIDiv);\n\tappendDivWithBadgeUI(UIDiv);\n}", "function createBadge(){\n const bannerBase = document.querySelector(\".banner\");\n let badge = document.createElement(\"div\");\n badge.className = \"badge\"\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
By default value of array item is parseFloat(object[propertyForSort]), withParse argument can change this behavior (so we can compare strings). If values of comparing objects equal, sort by object.id. Function can sort in descending order.
function sortByProperty({ array, propertyForSort, descending = false, withParse = true, }) { array.sort((item1, item2) => { let value1; let value2; if (withParse) { value1 = parseFloat(item1[propertyForSort]); value2 = parseFloat(item2[propertyForSort]); } else { value1 = ite...
[ "function sortObjectsNumeric( objects, prop ){\n return objects.sort( function ( _a, _b ) {\n var a = +(_a[prop]);\n var b = +(_b[prop]);\n return (a < b) ? -1 : (a > b) ? 1 : 0;\n });\n}", "sortData(fieldName, direction) {\n // serialize the data before calling sort function\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Completes a loop for a specific intersection point entry curve.
function completeLoop(expMax, takenOuts, out) { let additionalOutsToCheck = []; let beziers = []; // Move immediately to the outgoing start of the loop let out_ = out; let additionalBezier; do { takenOuts.add(out_); // Mark this intersection as taken let { beziers: additionalBezi...
[ "function manageIntersections(intersectionPoints){\n if(intersectionPoints){\n var currentColor = -1;\n //Outer area\n var g = d3.select('#inside').selectAll('.intersection');\n console.log('---');\n var intersection = g.selectAll('.intersectionArea').data(intersectionPoints, function(d) { console.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the last object for a victim
function victimLastSeen(nodeId) { return victimsPoints[nodeId][0]; }
[ "function getLastObject(procedure,index){\n switch(procedure.condition){\n case \"twopriv\": return twoprivtargets[index];\n case \"twovis\": return twovistargets[index];\n case \"onetarget\": return oneobjtargets[index];\n default: return getTargetObject(fillergrids[index]);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepare for the next sound to be played
function prepareSound() { if (soundNumber >= 0) { sounds[soundNumber].pause(); //Stop playing the old sound sounds[soundNumber].currentTime = 0; //Rewind sound } nextSound = true; //The next sound will be initiliased in the next draw cycle nextPt = str(Math.floor(random(56))); //Get random partici...
[ "function soundInit() {\n wasPlayed = true;\n soundGoalScored.play();\n impactSound.play();\n soundGoalScored.pause();\n impactSound.pause();\n }", "function playNextAudio() {\n Cards.playAudio();\n }", "function play_next() {\r\n \r\n // is this the las...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to close the hint displayed after 4 mins of displaying
function closeHint() { hintText.style.visibility="hidden"; }
[ "function closeHintPopUp () {\n document.getElementById('hint-background').style.display = 'none';\n document.getElementById('hint-content').style.display = 'none';\n}", "function delayHintButton() {\n toggleHintButton(/* hide = */ true);\n hintClock = window.setTimeout(toggleHintButton, HIDE_INTERVAL_MS, fal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }