query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Implements "Access Shared Terminal" UI command
async listSharedTerminals() { const terminals = await this.getRunningTerminalsAsync(); if (terminals.length === 0) { await vscode.window.showInformationMessage('No terminals are currently shared in the collaboration session.', { modal: false }); return; } let inde...
[ "function Terminal () {}", "openTerminal() {\n let target = this.document_.getElementById('kd-shell-term');\n this.term.decorate(target);\n target.firstChild.style.position = null;\n this.term.installKeyboard();\n }", "function terminal(ssh_host) {\n if(ssh_host != undefined) {\n window.ope...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends an email based on the supplied properties
sendEmail(props) { const params = { properties: extend(metadata("SP.Utilities.EmailProperties"), { Body: props.Body, From: props.From, Subject: props.Subject, }), }; if (props.To && props.To.length > 0) { ...
[ "sendEmail() {\n email([EMAIL], null, null, null, null);\n }", "sendMail(options) {}", "function sendEmail(santa,giftee)\r\n{\r\n const email = {\r\n from: \"sample email\",\r\n to:santa[\"email\"],\r\n subject: \"Secret Santa\",\r\n text: `Hello ${santa[\"name\"]}, you have r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make a function which configures a child process to automatically respond to a certain question
function respondFactory(question, answer, verbose) { return (child) => { child.stdin.setDefaultEncoding('utf-8'); child.stdout.on('data', (data) => { if (data != null) { if (verbose) { process.stdout.write(data); } if (d...
[ "registerProcess() {\n this.events.request('processes:register', 'embark', (setRunning) => {\n // on 'outputDone', set 'embark' process to 'running'\n this.events.on('outputDone', setRunning);\n });\n // set 'embark' process to 'starting'\n this.events.request('processes:launch', 'embark', () ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a list of frameworks to the source input for transferring competencies from (to another framework)
function addSourceFrameworks(frameworks){ for(var i = 0; i < frameworks.length; i++){ var framework = frameworks[i]; var id = framework.shortId().split("/"); var id = id[id.length-1]; if(id != $("#importLocationSelect").val()) addSourceFramework(framework); cached_frameworks[id] = framework; } ...
[ "function possibleFrameworks() {\r\n return __awaiter(this, void 0, ResultP, function () {\r\n return __generator(this, function (_a) {\r\n // prettier-ignore\r\n return [2 /*return*/, pipeA(sampleProjectionsDirectory)(ls)(okThen(map(frameworkFromSampleFilename)))(okThen(frameworkNam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a group of bars to the plot (alreadyAddedMutations keeps track of the already added bars to understand at which vertical position each bar of the new group should start)
function uc1_addBars(g, groupId, bins, alreadyAddedMutations, color, normalize, avg) { // Bars representing the amount of mutations in a bin, independently on the type of mutation var selection = g.svg.selectAll("rect[rect-type='"+color+"']").data(bins) // update selection // Get the vertical position of...
[ "function createBarGroup() {\n var temp = new BlockGroup(arguments[0], arguments[1]);\n var counter = 0;\n for (var i = 0; i < arguments[1].length; i++) {\n arguments[1][i].BlockGroup = temp;\n }\n counter = arguments[1].length - 1;\n\n blockGroups.push(temp);\n lastLeftOff += unit;\n}", "function makeN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for showing final score, clearing questions and displaying s of correct and wrong answers
function finalScore(){ //stop the timer once final score is to be shown timer.stop(); //empty the contents of question from screen $(".question").empty(); //append the correct number of answers to the question div $(".question").append("<h3>" + correct + " questions answered right." + "</h3>"); //append t...
[ "function finalScore(){\n\n\t\t// none so that users will not accidentally 'answer', would add to their tally\n\t\tdocument.getElementById(\"answers\").style.display = \"none\";\n\n\t\t// display score\n\t\tscore = \"<p class='finalScore'>Here's how you did!<br>Correct Answers: \" + answersRight \n\t\t+ \"<br>Incor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=============================================================================== Controllers / UI / Sortable
function UIJquerySortableCtrl() { this.handleOptions = { handle: 'i.fa-unsorted', }; this.rowsOptions = { containerSelector: 'table', itemPath: '> tbody', itemSelector: 'tr', placeholder: '<tr class="placeholder">', }; }
[ "function draggablePanels($scope) {\n\n $scope.sortableOptions = {\n connectWith: \".connectPanels\",\n handler: \".ibox-title\"\n };\n\n}", "function initSortables() {\n $scope.board.width = $scope.board.lists.length * 400;\n setTimeout(function () {\n $('div[data-board=' + $scope....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
collect monthly salaries and get total
function getMonthlySalaries(employeesList) { console.log('in getMonthlySalaries'); console.log('input:', fnameInput, lnameInput, idInput, titleInput, salaryInput); let monthlySalary = []; // loop through employee list annual salary // push to monthly salary array for (let i = 0; i...
[ "function calculateMonthlyExpenditure(){\n var allEmployeeSalary = 0;\n for (var i = 0; i < employeeArray.length; i++) {\n allEmployeeSalary += employeeArray[i].annualSalary;\n }\n allEmployeeSalary = allEmployeeSalary / 12;\n return allEmployeeSalary;\n}", "function calculateTotalMonthly() {\n let tot...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepend one or more elements BEFORE the other elements.
prepend(...elements) { this.elements = flatten(elements).concat(this.elements); return this; }
[ "prepend(selector, items) {\n return this.insert(\"before\", \"\".concat(selector, \"[0]\"), items);\n }", "function result_element_prepend(parent, child, next)\n{\n if(next == null)\n result_element_append(parent, child);\n else\n if(parent != null && child != null)\n {\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funcion que permite enviar un formulario para almacenar la url referer en una variable de sesion, en caso de ser distinta a la url actual.
function url_referer() { var refer = document.referrer; var actual = document.location; if (refer != actual) { document.getElementById('div_url_ref').innerHTML = '<input type="hidden" name="url_ref" value="' + document.referrer + '">'; document.getElementById('formUrlReferer').submit(); ...
[ "function cambiarUrl(thisObj){\n\tvar campo = thisObj.attr('name');\n\tvar valor = thisObj.val();\n\tvar nombrePath = window.location.pathname;\n\tvar parametrosInput = thisObj.parents('form').find('#parametrosUrl').val();\n\n\t\n\twindow.history.replaceState(\"object\", nombrePath, nombrePath +'?'+ parametrosInput...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
we need typed arrays
function TypedArray(arg1) { var result; if (typeof arg1 === "number") { result = new Array(arg1); for (var i = 0; i < arg1; ++i) result[i] = 0; } else result = arg1.slice(0) result.subarray = subarray result.buffer = result result.byteLength = result.length result.set = set...
[ "function Arrays() {}", "function Array() {}", "function TypedArray(arg1)\r\n\t\t{\r\n\t\t\tvar result;\r\n\t\t\t\r\n\t\t\tif (arg1 != undefined)\r\n\t\t\t{\r\n\t\t\t\tif (typeof arg1 === \"number\")\r\n\t\t\t\t{\r\n\t\t\t\t\tresult = new Array(arg1);\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (var i = 0; i < arg1; ++i)\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
exampleTagSingleURL() shows how to request the tags for a single image URL
function exampleTagSingleURL() { var testImageURL = "http://www.clarifai.com/img/metro-north.jpg"; var ourId = "train station 1"; // this is any string that identifies the image to your system // Clarifai.setRequestTimeout( 100 ); // in ms - expect: force a timeout response // Clarifai.setRequestTimeout( 100 ); //...
[ "function exampleTagSingleURL() {\n // var testImageURL = 'http://www.clarifai.com/img/metro-north.jpg';\n var testImageURL = 'https://scontent-sea1-1.xx.fbcdn.net/hphotos-xtf1/v/t1.0-9/10557291_790760364288671_3921226209702919389_n.jpg?oh=a0bc4ce1da64a4ab3e5f7ad3cdc6c812&oe=573290BC'\n\n var ourId = \"train sta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns true if (x1,y1) is adjacent to (x2,y2)
function isAdjacent (x1, y1, x2, y2) { var dx = Math.abs(x1 - x2), dy = Math.abs(y1 - y2); return (dx + dy === 1); }
[ "function is_adjacent(point1, point2){\r\n\tif(point1.x == point2.x && (point1.y == point2.y-1 || point1.y == point2.y+1))\r\n\t\treturn true;\r\n\tif(point1.y == point2.y && (point1.x == point2.x-1 || point1.x == point2.x+1))\r\n\t\treturn true;\r\n\treturn false;\r\n}", "function is_adjacent(point1, point2) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: manage company multiple addresses TODO: passing adress data to CompanyTooltip
function CompanyMarker() { const themeContext = React.useContext(ThemeContext) const companyInfo = themeContext?.company const { maps, shortName, description } = companyInfo const companyCoordinates = [maps?.latitude, maps?.longitude] return ( <MapMarker position={companyCoordinates} title={s...
[ "function addCompanyAddress(){\n\t\t\t\tvar numItems = $('.company-addresses-input').length;\n\t\t\t\t$('.company-addresses').append(''+\n\t\t\t\t\t'<div class=\"col-sm-12 col-xs-12\"> '+\n\t\t\t\t\t\t'<div class=\"form-group field-address-address\">'+\n\t\t\t\t\t\t\t'<div class=\"col-sm-3 text-right\">'+\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
query the dom for the ticket banner and return it if found.
function findTicketBannerExists() { var ticketBanner = selectTicketBanner(); if(ticketBanner === null || ticketBanner === undefined) return null; // if the star is already added if(selectStarPicker(ticketBanner).length !== 0) return null; return ticketBanner; }
[ "function pollForTicketBannerElement() {\n\tvar ticketBanner = null;\n\tvar timesChecked = 0;\n\tvar timeBetweenAttempt = 500;\n\t\n\tvar searchInterval = setInterval(function() {\n\t\tvar ticketBanner = findTicketBannerExists();\n\t\t\n\t\tif(ticketBanner !== null) {\n\t\t\tclearInterval(searchInterval);\n\t\t\tse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function changeProv function loadDistsProv Obtain the list of districts for a specific province in the 1871 census as an XML file. Input: prov two character province code
function loadDistsProv(prov) { var censusSelect = document.distForm.Census; var census = censusSelect.value; var censusYear = census.substring(2); var xmlName; if (censusYear < "1871") { // pre-confederation xmlName = "CensusGetDistric...
[ "function loadDistsProv(prov)\n{\n var censusId = document.distForm.censusId.value;\n var censusYear = censusId.substring(2);\n\n // get the district information file \n HTTP.getXML(\"CensusGetDistricts.php?Census=\" + censusId +\n \"&Province=\" + prov,\n gotDis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Quand un champ de formulaire est change, on modifie le comportement des liens hypertexte de la page
function surveiller_formulaires() { $("textarea,input,select").one("change", function(){ var reg = new RegExp("<.*>|&nbsp;|\r|\n|\:", "g"); afficher_bloquerClick = $(this).parent().find("label").html(); if (!afficher_bloquerClick) afficher_bloquerClick = "Inconnu"; else afficher_bloquerClick = afficher_bloq...
[ "function getModificationFormulaire() {\n return modificationEnCours; \n}", "function setModificationFormulaire(value) {\n modificationEnCours = value;\n console.log(\"setModificationFormulaire = \" + modificationEnCours); \n}", "function wrs_int_updateFormula(mathml, editMode, language) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the pathToIdMap object removing the old path to id mapping and creating a new mapping based on a new path.
function updateFilePathToIdMap(oldFilePath, newFilePath) { //get the file/dir id based on the old path var id = pathToIdMap[oldFilePath]; //delete the mapping from the old path delete pathToIdMap[oldFilePath]; //create a new mapping from the new file/dir path to the id pathToIdMap[...
[ "function updateAllPathToIdMap(oldDirPath, newDirPath) {\n\t\n //add the ending separator if necessary\n oldDirPath = addEndingPathSeparator(oldDirPath);\n newDirPath = addEndingPathSeparator(newDirPath);\n\n\t//holds all the new paths and ids of the files/dirs that have moved \n\tvar movedPaths = {};\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show or hide convexhull, or disable the checkbox
function showConvexhull(state) { var convexhull = svg.select('#convexhull'); var checkbox = document.getElementById('convexhullCheckbox'); if(state == true) { console.log('show convexhull'); convexhull.style('visibility', 'visible'); checkbox.disabled = false; checkbox.checke...
[ "function toggleBoundary() {\r\n var checkbox = document.getElementById(\"boundary\");\r\n if (checkbox.checked == true){\r\n boundary = true\r\n }\r\n else {\r\n boundary = false\r\n }\r\n render();\r\n}", "function egenposOnClick() {\n\n var cb= document.getElementById(\"cb1\");...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOTE: needs to be tested gets a random xkcd web comic
async function xkcd_rand(){ await common.getFromAPI("https://xkcd.com/info.0.json", (jsonData) => { common.getFromAPI("https://xkcd.com/" + (Math.floor(Math.random(jsonData["num"]) * 100)) + "/info.0.json", (data) => { common.download(data["img"], data["title"] + data["img"].match(/\.[0-9a-z]+$/i)[0]); }); ...
[ "function getxkcd(numComics, callback) {\n var comicToSelect = Math.floor(Math.random() * numComics);\n request({ \n url: 'http://xkcd.com/' + comicToSelect + '/info.0.json',\n method: 'GET'\n }, function(error, response, body){\n if(error) {\n console.log(error);\n } else {\n var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Queries the registry for the given image's list of tags.
listTags(authToken, image) { return this.performHttpsGet({ hostname: "registry-1.docker.io", port: 443, path: "/v2/" + image + "/tags/list", headers: { Accept: "application/json", Authorization: "Bearer " + authToken ...
[ "function getTags() {\n Clarifai.getTagsByUrl([imageTagSearch]).then(\n handleResponse,\n handleError\n );\n }", "async function fetchPhotoFromTags(tags) {\r\n //convert to array\r\n const querytags = tags.split(\",\");\r\n\r\n page++;\r\n const response = await axios.get(\r\n `h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Asks the C++ ComponentsDOMHandler to get details about the installed components. The ComponentsDOMHandler should reply to returnComponentsData() (below).
function requestComponentsData() { chrome.send('requestComponentsData'); }
[ "async function fetchComponents() {\r\n let componentsArray = document.getElementsByTagName(\"component\");\r\n for (let i = 0; i < componentsArray.length; i++) {\r\n node = componentsArray[i];\r\n componentKey = node.getAttribute(\"html\");\r\n if (componentKey) {\r\n if (CACHE_COMPONENTS.get(compo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OPEN ALL BOOKMARKS FOR FOLDER (processes click on open all button) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function openAllFolderMarks(id){ chrome.bookmarks.getChildren(String(id), function(marks){ // console.log(marks); marks.forEach(function(mark){ console.log(mark.url); chrome.tabs.create({url: mark.url}); }); }); }
[ "function testOpenAndCloseAllBookmarks() {\n enduranceManager.run(function () {\n var testFolder = new elementslib.Selector(controller.window.document,\n \"toolbarbutton.bookmark-item[label='\" +\n BOOKMARK_FOLDER_NAME + \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle a transitioned reposition when the activeTarget moved beneath the pointer. When it comes to an end, if the mouseout has not hidden, then realign at the new position if the activeTarget is still beneath the pointer.
onTransitionEnd(event) { const me = this, currOver = Tooltip.currentOverElement; if (realignTransitions[event.propertyName]) { // Don't realign if the mouse is over this, and is allowed to be over this // If user is interacting with this Toolltip, they won't expect it to move. if (me.al...
[ "onTransitionEnd(event) {\n const me = this,\n currOver = Tooltip.currentOverElement;\n\n if (realignTransitions[event.propertyName]) {\n // Don't realign if the mouse is over this, and is allowed to be over this\n // If user is interacting with this Toolltip, they won't expect it to move.\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To make this data structure use the 'weighted' quickunion algorithm, pass in `true` for the 2nd parameter. Passing in `false` or don't pass in anything at all, to use the regular quickunion data structure.
function QuickUnion(n, weighted) { QuickFind.call(this, n); if (typeof weighted === 'undefined') { this.weighted = false; } else { this.weighted = true; // keep track of the number of nodes in each tree rooted at each node this.sizes = (function setSizes(x) { var i = 0; var sizes = [...
[ "function unionSum() {}", "function PathCompressionWeightedQuickUnionUF(N) {\n this.id = new Array(N);\n this.size = new Array(N).fill(1);\n for(var i = 0; i < N; i++) {\n this.id[i] = i;\n }\n}", "function orderedMultiSetUnion(sortedA, sortedB){\n \n}", "union(p, q) {\n let i = this.root(p),...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If this is the friend browser then setup the screen accordingly
function setFriend() { const urlParams = new URLSearchParams(window.location.search); const isFriend = urlParams.get("friend"); if (isFriend == "true") { document.getElementById("endButton").dataset.relationship = "friend"; document.getElementById("endButton").style.display = "none"; document.getEleme...
[ "function displayBrowser (name) {\n\t\tvar commands = [];\n\t\tif (typeof game.active_browser !== 'undefined') {\n\t\t\tclearDisplayObject(game.browsers[game.active_browser].screen, commands);\n\t\t\tconsole.log(\"Warning: displayBrowser( \" + name + \") was called when there was already an active browser, which wa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function definition to generate the calendar table
function createCalendar(calDate) { var calendarHTML = "<table id= 'calendar_table'>"; calendarHTML += calCaption(calDate); calendarHTML += calWeekdayRow(); calendarHTML += calDays(calDate); calendarHTML += "</table"; return calendarHTML; }
[ "function createCalendar() {\r\n let date = new Date();\r\n let calendarHTML = \"\";\r\n calendarHTML += calCaption(date);\r\n calendarHTML += calHead();\r\n calendarHTML += calDays(date);\r\n document.getElementById(\"calendar_table\").innerHTML = calendarHTML;\r\n}", "function generateTable() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retrive data from localstorage or else use initialValue
function useLocalStorage(key, initialValue) { try { // Get from local storage by key const item = localStorage.getItem(key); console.log(item); // Parse stored json or if none return initialValue return item ? JSON.parse(item) : initialValue; } catch (error) { // If error als...
[ "function getLocalStoreage() {\n\tvar city = localStorage.getItem(\"city\");\n\tif (city !== undefined || city !== \"\") {\n\t document.getElementById(\"city\").placeholder = city;\n\t $(\"#city\").innerHTML = city; \n\t}\n\treturn city;\n}", "function readFromLocalStorage() {\n var item = localStorage...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a task from tasks. Tasks may not be rrsolved yet, so we need to make sure that tasks are resolved before we find the task with our ID.
function getTask(id) { // Create a deferred object that will resolve later var deferred = $q.defer(); // Add a handler to the task promise tasks.$promise.then(function() { // Find the task in the list of tasks var task = getTaskSync(id); ...
[ "function getTask(id) {\n for (i = 0; i < tasks.length; i++) {\n if (tasks[i].tId == id) {\n return tasks[i];\n }\n }\n }", "function getTask(taskID)\r\n{\r\n\tlet task;\r\n\tfor (let i=0; i<tododata.tasks.length; i++)\r\n\t{\r\n\t\tif (tododata.tasks[i].id ==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
used to retrieve SysEx Events in realtime
function getSystemEvent(code, length, data='') { switch(code) { case 'f0': //0xF0: return new SysExStart(length, data); break; case 'f7': //0xF7: return new SysExEnd(length, data); break; default: break; } }
[ "_watchEventsLegacy () {\n const getAllObjects = () => {\n return this._sessionCall('system.listMethods').then(methods => {\n // Uses introspection to determine the methods to use to get\n // all objects.\n const getAllRecordsMethods = filter(\n methods,\n ::/\\.get_al...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
kLog 2 (Panel ID: TER19260043) raw range: 1270 to 1200
function kLog2 (kRaw) { var kLogConverted2; if (kRaw <= 0 || kRaw >= 3300) { kLogConverted2 = null; } else if (kRaw > 1270) { kLogConverted2 = 0.0001; } else if (kRaw < 1200) { kLogConverted2 = 0.01; } else { kLogConverted2 = (Math.pow(10, ((kRaw-1252.14)/-28.3))...
[ "function pLog2 (pRaw) {\n var pLogConverted2;\n \n if (pRaw <= 0 || pRaw >= 3300) {\n pLogConverted2 = null;\n } else if (pRaw > 1415) {\n pLogConverted2= 0.0001;\n } else if (pRaw < 1380) {\n pLogConverted2 = 0.01;\n } else {\n pLogConverted2 = (Math.pow(10, ((pRaw-13...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to return (if any) an existing transaction in the pool with the address of the passed address
existingTransaction(address) { return this.transactions.find(t => t.input.address === address); }
[ "existingTransaction(address) {\n return this.transactions.find(t => t.input.address === address);\n }", "existingTransaction(address) {\n return this.transactions.find((tx) => tx.input.address === address);\n }", "existingTransaction({ inputAddress }) {\n const allTransactions = Object.values(this.t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns avg time to travel between startS and endS. The avg time == only direct traveling
getAverageTime(startStation, endStation) { let stationTimes = this.travelTime.get(`${startStation} ${endStation}`) return stationTimes[0] / stationTimes[1] }
[ "function average_time_slept(start,end){\n \n var gts_time_arr = get_gts_time_arr();\n if(gts_time_arr == -1){return 'NA';}\n \n var wu_time_arr = get_wu_time_arr();\n if(wu_time_arr == -1){return 'NA';}\n \n set_interval_string(wu_time_arr[start],wu_time_arr[end]);\n \n var total_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adiciona um input de coluna no formulario
function addColum(){ let input = document.createElement('input') input.classList.add('colum') input.setAttribute('type','text') input.setAttribute('oninput','setSelectPrimaryKey()') document.getElementById('Colums-inputs').appendChild(input) }
[ "function addInputToColumn(column) {\r\n // console.log(addItems[column].textContent);\r\n const itemText = addItems[column].textContent;\r\n if (!itemText) return;\r\n const selectedArray = listArray[column];\r\n selectedArray.push(itemText);\r\n addItems[column].textContent = '';\r\n updateDOM();\r\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates internal validator method name for given name
generateValidatorMethodName(name) { if(!name) return null; let clean = validate.capitalize(name.replace('-', ' ')).replace(' ', ''); let method = 'validate' + clean; return method; }
[ "function buildValidatorName(type) {\n\t// if(type === 'amount_int') {\n\t// \treturn 'validateAmount';\n\t// }\n\n\tvar classified = Ember.String.classify(type);\n\treturn 'validate' + classified;\n}", "function typeName(name) {\n return lodash_1.upperFirst(methodName(name));\n}", "function makeUniqueName(b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IT bits. cpsr[15:10,26:25]. / System control coprocessor (cp15)
function cp15() { this.c0_cpuid = 0; this.c0_cachetype = 0; this.c0_c1 = new Uint32Array(8); // Feature registers. this.c0_c2 = new Uint32Array(8); // Instruction set registers. this.c1_sys = 0;// System control register. this.c1_coproc = 0; // Coprocessor access reg...
[ "function I_ANDI_SR(p) {\n\t\tif (regs.s) {\n\t\t\tvar s = coreNext16();\n\t\t\tvar d = coreGetSR();\n\t\t\tvar r = s & d;\n\t\t\t//SAEF_log((\"I_ANDI_SR.W val $%04x, old $%04x new $%04x\", s, d, r));\n\t\t\tcoreSetSR(r);\n\t\t\tcoreSyncPC();\n\t\t\t//ccna\n\t\t\treturn p.cyc;\n\t\t} else {\n\t\t\t//SAEF_log(\"I_AN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a card and assigns it a suit, value, and valueNum
function createCard(suitNum, valueNum){ var suit, value; switch(suitNum){ case 0: suit = "spades"; break; case 1: suit = "clubs"; break; case 2: suit = "hearts"; break; case 3: suit = "diamonds"; ...
[ "function Card(suit, value)\n{\n this.suit = suit \n this.value = value\n}", "newCard(suit, value, abbv) {\n\t\t// Initialize variables\n\t\tthis.mSuit = suit;\n\t\tthis.mValue = value;\n\t\tthis.mAbbv = abbv;\n\t}", "function Card(suit, number) {\nthis.suit = suit;\nthis.number = number;\n}", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculate the totalCost of all items in the cart
function total() { let totalCost = 0 for (var i = 0; i < cart.length; i++) { for (var item in cart[i]) { totalCost += cart[i][item] } } return totalCost }
[ "function getTotalCost()\n{ totalCost=0;\n\tsaveProducts();\n for(let element in productsInCart) {\n\t\ttotalCost+=productsInCart[element].amount*productsInCart[element].productPrice;\n\t}\n}", "function totalCart() {\n\tvar totalCost = 0;\n\tfor (var i in cart) {\n\t\ttotalCost += cart[i].price * cart[i].cou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Global methods Static API vtkCalculator methods
function vtkCalculator(publicAPI, model) { // Set our className model.classHierarchy.push('vtkCalculator'); publicAPI.requestData = (inData, outData) => { // implement requestData if (!outData[0] || inData[0].getMTime() > outData[0].getMTime()) { const newArray = new Float32Array(inData[0].getPoints()....
[ "function vtkCalculator(publicAPI, model) {\n\t // Set our className\n\t model.classHierarchy.push('vtkCalculator');\n\n\t publicAPI.setFormula = function (formula) {\n\t if (formula === model.formula) {\n\t return false;\n\t }\n\t model.formula = formula;\n\t publicAPI.modified();\n\t return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to populate the dropdown for user group
function populateDropDown(userGroupMap) { var userGroupSelect = document.getElementById("inputUserGroupInpt"); for (var key in userGroupMap) { var option = document.createElement("option"); option.text = userGroupMap[key]; option.value = key+"!"+userGroupMap[key]; option.className = "form-cont...
[ "function fillGroups() {\n modules.loadGroups(function(groups) {\n groups.forEach(function(group) {\n $('.module-view .module-groups')\n .append(`<option value=\"${group}\">${group}</option`);\n });\n $('.module-view .module-groups').on('change', function() {\n const name = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[START functions_getProjects] Calls the Cloud Resource Manager API to get a list of projects. Writes a Pub/Sub message for each project
async function getProjects() { try { // Lists all current projects const [projects] = await resource.getProjects(); console.log(`Got past getProjects() call`); // Set a uniform endTime for all the resulting messages const endTime = new Date(); const endTime...
[ "function getProjects() {\n return ____awaiter_23(this, void 0, void 0, function () {\n var ids, ret, _i, ids_1, id, project_1;\n return ____generator_23(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, _$store_26.store.getItem(\"ez-projects\")];\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if there the interface has exactly one supertype that isn't named 'Function'
function hasOneSupertype(node) { if (!node.extends || node.extends.length === 0) { return false; } if (node.extends.length !== 1) { return true; } const expr = node.extends[0].expression; return (expr.type !== utils_...
[ "isImplemented(_interface) {\n return this.ancestors.has(_interface)\n }", "function _checkinterface(x,intrfc)\n{ if (x===null || x._interfaces.indexOf(intrfc)>=0) return x;\n throw (new java_lang_ClassCastException())._0()._e; \n}", "function checkInterface(obj, funcs) {\n for (var i = 0; i < fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcao que usa ajax para aparecer a quantidade de participantes escolhida
function quantidadeParticipante() { $("#participantes").load("ajax",{qt_participante:$("#qt_participante").val()}); /*se for selecionada uma quantidade de participantes, aparece para seleciona as quantidades de psicologo, nome do psicologo e botao para comecar a dinamica*/ if($("#qt_participante").val() !...
[ "function getNumSolicitudes(){\n \t var url = \"app/service.php?tag=numeroSolicitudes\"; // El script a dónde se realizará la petición.\n //var usuarioLocal = $('#refYou').val();\n var usuarioLocal = $.cookie('lUser');\n\t\t$.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\tdataType: 'json',\n\t\t\t\turl: ur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get items and account types
async getData() { const accountTypes = await this.getAccountTypes().then((_accountTypes) => ({ isFarmer: _accountTypes[0], isDistributor: _accountTypes[1], isRetailer: _accountTypes[2], isConsumer: _accountTypes[3], })); const items = await this.getItems(); return { account...
[ "function getItemTypes() {\n return $http.get(API.sailsUrl + '/itemtypes/')\n .then(function success(res) {\n if(res.data) {\n return res.data.data;\n } else {\n return $q.reject(res.data);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checking Is Price Is Only Numbers
function onlyNumbers(price) { var reg = /^\d+$/; return reg.test(price); }
[ "function validateUnformattedPrice(unformattedPrice) {\n return isNumeric(unformattedPrice);\n }", "function checkIfOnlyPrice(field) {\n if (/^[0-9]+\\.?[0-9]{1,2}$/.test(field.value)) {\n setValid(field);\n return true;\n } else {\n setInvalid(field, `${field.dataset.helper} must contain onl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
define a module with library id, schema id, etc.
function module(library_id, schema_id, title, fields, x, y) { this.library_id = library_id; this.schema_id = schema_id; this.title = title; this.fields = fields; this.x = x; this.y = y; }
[ "function liModule(type_id,name) {\n\t\tthis.type_id = type_id;\n\t\tthis.name = name;\n\t}", "function _module (id, def, module, ns, i, l, parts, pi) {\n\t\t// Always return the require func back for \"require\" and the string back for \"module\" and \"exports\"\n\t\tif (id === \"require\"){\n\t\t\treturn requir...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
working on pushing previous channels....
function channelVideosPush() { //https://api.twitch.tv/kraken/channels/freecodecamp/videos?broadcasts=true $.getJSON("https://api.twitch.tv/kraken/channels/"+name_+"/videos?broadcasts=true", function(data) { for (var x = 0; x < 4; x++) { if (data.videos[x]) { ...
[ "newChannel() {\n this.processor.channels.push({});\n }", "lastChannel() {\n this.playChannel(this.lastChannelNumber);\n }", "function lastPush(path, channel) {\n var channelExits = false;\n try {\n if (lastPushes.length > 0) {\n for (var i = 0; i < lastPushes.length; i++) {\n if (lastP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a popover to the collaboration rect so the user can add notes and delete
function drawCollabPopover(collabId) { $("#interaction_" + collabId).popover({ class: "collabPopover", id: '"collabPopover_' + collabId + '"', html: "true", trigger: "click", title: "Collaboration", content: 'Description of Collaborative Work: ' +'<textarea r...
[ "function drawCollabPopover(collabId) {\n $(\"#interaction_\" + collabId).popover({\n class: \"collabPopover\", \n id: '\"collabPopover_' + collabId + '\"',\n html: \"true\",\n trigger: \"click\",\n title: \"Collaboration\",\n content: 'Description of Collaborative Work:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use component did mount to get all notes on load
componentDidMount() { this.getNotes(); }
[ "componentDidMount() {\n this.props.getNotes();\n }", "componentDidMount() {\n\t\tthis.RefreshNotes();\n\t}", "function loadNotes() {\n API.getNotes()\n .then(res => {\n setNotes(res.data.notes)\n }).catch(err => console.log(err));\n }", "function loadNotes() {\n API.getNotes()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build an accordian containing a summary of all nested facts/footnotes corresponding to the current viewer selection.
_selectionSummaryAccordian() { const cf = this._currentItem; // dissolveSingle => title not shown if only one item in accordian const a = new Accordian({ onSelect: (id) => this.switchItem(id), alwaysOpen: true, dissolveSingle: true, }); const...
[ "function loadInfoModal(tree) { \n var results = '';\n \n //Loops through each node in the tree\n tree.visit(function(node){\n if(node.isSelected() ) {\n results += '<div class=\"panel panel-default\"><div class=\"panel-heading\" id=\"ph' + node.key +'\"><h4 class=\"panel-title\"><a data-toggle=\"colla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Trigger a redraw of the canvas layer
redraw() { if (this.isActive() && this._canvasLayer) this._canvasLayer.needRedraw(); }
[ "redraw() {\n if (this.isActive() && this._canvasLayer) this._canvasLayer.needRedraw();\n }", "_refreshCanvas() {\n this._refreshCanvasSize();\n this.renderCanvas();\n }", "__redraw() {\n var canvas = this.getContentElement();\n var height = canvas.getHeight();\n var width = canvas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retrieve all collectors, find our target one
function collectors(n){ var url = "https://"+user+":"+password+"@"+apiUrl+"collectors?limit="+pageLimit+"&offset="+n return fetch(url) }
[ "collector(collector) {\n if (arguments.length) {\n this._collector = collector;\n return this;\n }\n if (this._collector === undefined || this._collector === null) {\n var collector = this.constructor.classes().collector;\n this._collector = new collector();\n }\n return this._co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
5.5 Structured cloning of Headers, FetchBodyStream, Request, Response 5.6 Fetch method Promise fetch(RequestInfo input, optional RequestInit init);
function fetch(input, init) { return new Promise(function(resolve, reject) { var r = new Request(input, init); var xhr = new XMLHttpRequest(), async = true; xhr._url = r.url; try { xhr.open(r.method, r.url, async); } catch (e) { throw TypeError(e.message); } for (var iter = r.header...
[ "function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var r = new Request(input, init);\n\n var xhr = new XMLHttpRequest(), async = true;\n xhr._url = r.url;\n\n try { xhr.open(r.method, r.url, async); } catch (e) { throw TypeError(e.message); }\n\n for (var i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render the feed for authenticated users.
feed() { const key = this.io.getSessionKey(); this.whenAuthenticated('/', (key, user) => this.render(Feed, { user: user, edit: () => this.io.navigate('/a/edit/'), newTab: () => this.io.navigate('/tabs/new/'), getPage: (page, done) => this.logs.frontpage(key, page...
[ "renderFeed(userId) {\n // skip programs planned for future\n return this.entryListAll(PersonalFeedEntry, {\n statement: 'UserId = ?',\n values: userId,\n });\n }", "function showMyFeed() {\n if (!isLoggedIn()) return;\n\n //make sure we are on the messages page...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This implementation uses depthfirst search approach. computes the connected components of the undirected graph G
function CC(G) { var marked = new Array(G.getVertices()); // marked[v] = has vertex v been marked? var id = new Array(G.getVertices()); // id[v] = id of connected component containing v var size = new Array(G.getVertices()); // size[id] = number of vertices in given component var count = 0; // number of connect...
[ "function GSCC() {\n\tdfs(G);\n\n\tlet G_T = [];\n\n\tG.forEach(function(u){\n\t\tu.neighbors.forEach(function(v){\n\t\t\tlet t = search(G_T, v);\n\t\t\tif (t == null) {\n\t\t\t\tG_T.push({\"name\": v, \"neighbors\":[u.name], \"pi\": undefined});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tt.neighbors.push(u.name); \n\t\t\t}\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculates the total price for all items in each category div
function calculatePrice() { var total = 0; for (i in cats) { var div = document.getElementById(i); var nodes = div.childNodes; for (j = 0; j < nodes.length; j++) { total += parseFloat(nodes[j].getAttribute("price")); } } var parseTotal = total.toFixed(2); var totalDiv = document.getEleme...
[ "function calcPrice() {\n var total = 10; // basic cheese pizza\n var list = $(\".panel.price ul li\").not(\".hidden\").toArray();\n list.map(item => {\n total += parseInt(item.innerHTML.substr(1, 3)); // supports 0-999 $ items\n });\n $(\".panel.price strong\").html(\"$\" + total);\n }", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Instantly teleport the tank to its spawn position. The spawn position is a three dimensional vector in the class.
teleportSpawn() { //Use the moveTank function to adjust also the position of the bounding boxes (collision and hit bounding boxes). this.moveTank(new BABYLON.Vector3(this.spawnPoint.x, this.spawnPoint.y, this.spawnPoint.z)); return; }
[ "function teleportBot(bot,loc) {\n var new_pos = new pk_mineflayer.vec3();\n new_pos.x = loc[0];\n new_pos.y = loc[1];\n new_pos.z = loc[2];\n bot.bot.entity.position = new_pos;\n}", "teleportTo(x,y){\r\n // Remove from current tile\r\n let currentTile = this.field.getTile(this.x, this.y);\r\n if (c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show ============================================================================================ Description: Triggers the map to show the specified layer
function show(layerName) { let $map = $('#map'); $map.trigger('show', layerName); }
[ "function showLayer(layer, show){\n layer.setVisible(show);\n}", "function showMap() {\n g.select(\"#map_layer\")\n .classed(\"no_click\",false)\n .transition()\n .duration(500)\n .style(\"opacity\",1)\n g.select(\"#rank_layer\")\n .classed(\"no_click\",true)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start the intervals to copy the output and offset files to the home directory
function startCopyIntervals(){ setInterval(function(){ copyPartialOutput(); exec(`cp offsets.csv ${outputDir}/offsets.csv`, (error) => { if (error) { console.error(`Offset copy error: ${error}`); return; } console.log(`${new Date()....
[ "start () {\n console.log('backup start', this.dirs.length)\n\n // start monitor file changes\n this.startMonitor()\n\n // start calculation of speed and broadcast status\n this.startCalcSpeed()\n\n this.status = 'Idle'\n this.dirty = true\n this.isAborted = false\n this.run()\n }", "s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
on tile click open lightbox
function onTileClick(data, objTile) { objTile = jQuery(objTile); var objItem = g_objTileDesign.getItemByTile(objTile); var index = objItem.index; g_lightbox.open(index); }
[ "function onTileClick(data, objTile){\n\t\t\n\t\tobjTile = jQuery(objTile);\t\t\n\t\t\n\t\tvar objItem = g_objTileDesign.getItemByTile(objTile);\n\t\tvar index = objItem.index;\t\t\n\t\t\n\t\tg_lightbox.open(index);\n\t}", "function showLightbox(id) {\n \n // update the preview items in the lightbox\n u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints the stack on its proper order
printStack(){ var i; var stackString = ""; for(i = this.items.length - 1; i >= 0; i--){ stackString = stackString + this.items[i] + " "; } return stackString; }
[ "function printStack() {\n\tconsole += \"------------------------ Stack ----------------------------- <br/>\";\n\tfor (var i = 0; i < stackCount; i++) {\n\t\tprintRegister(stack[i]);\t\n\t}\n\tconsole += \"------------------------------------------------------------ <br/>\";\n}", "print(){\n\t\tlet current = this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bind names and values of an object to the named parameters of the statement
bindFromObject(valuesObj) { for (let name in valuesObj) { const value = valuesObj[name]; const num = sqlite3_bind_parameter_index(this.stmt, name); if (num !== 0) { this.bindValue(value, num); } } return true; }
[ "function paramFunction() {\n var x = value.apply(this, arguments);\n if(typeof x == \"object\") {\n for (param in x) d3_set_param(this, param, x[param].value, x[param].type);\n return;\n }\n d3_set_param(this, name, x, type);\n }", "function editObjectParameter(obj) {\n obj['fouth']...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Run Brython CLI command
function runBrython(cb) { exec(BRYTHON_CLI_CMD, {cwd: DIR_APP}, cb) }
[ "function runBrython(console, argdict) {\n console.clear();\n __EXECUTE__BRYTHON__();\n }", "function CLI() {\n\t}", "function runCarbBuilder(args){\n\tspawn.sync('files/CBv2.1.25/CarbBuilder2.exe', args.split(\" \"), { stdio: 'inherit'});\n\t//execa('./files/CBv2.1.25/CarbBuilder2.exe', args.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this is called once the translation has ended
onTranslationEnded() { // we will stop rendering our WebGL until next drag occurs if(this.curtains) { this.curtains.disableDrawing(); } }
[ "onTranslationEnded() {\n }", "onTranslationEnded() {\n }", "function progressCallback(progress) {\n console.log('translation progress: ' + progress);\n translatingprogress = progress;\n }", "function playTranslatedText(err,translation)\n{\n console.log(\"In translation callback!!!...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CAT PRODUCT getting all cat product
getProducts() { return this.catProduct; }
[ "function getProductCategory(){\n return Restangular.all('product/category').getList().then((data) =>{\n $log.info('success', 'Products category fetched');\n return data;\n }, function(err) {\n toaster.pop('error', 'Api error.', 'error connect to api to fetching product category.');\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Execute buttons / Adds an Execute Button after the given element. Clicking the button will cause the JS code in the element to be executed.
function addExecuteButton(elt) { var button = $("<button type='button'>Execute it</button>") .addClass("execute") .click(function (evt) { that = this; var code = $(elt).text(); // closure over elt console.log("executing code: "+code); try { eval(code);...
[ "function getExecuteOperationButton () {\n let executeOperation = document.getElementById('executeOperation');\n\texecuteOperation.addEventListener('click', beginExecution);\n}", "function customAfterExecCall(buttonId)\r\n{\r\n\tif(buttonId == undefined || buttonId == null || buttonId == '')\r\n\t{\r\n\t\tretu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reduce stamina level if player is sprinting
function updateStamina() { // increase player stamina playerStamina += width / 3000; // Constrain the result to a sensible range playerStamina = constrain(playerStamina, 0, playerMaxStamina); //if the players stamina level drops below 5, reduce //player's max speed to 2, return to 4 after stamina regenerate...
[ "function burn_player_stamina(amount){\r\n for (var i = 0; i < amount; i++){\r\n player.stamina --;\r\n if (player.stamina < 0){\r\n player.stamina = 0;\r\n change_player_health(-2);\r\n }\r\n }\r\n update_player_info();\r\n}", "updateGameLevel(){\n if (t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clone element with three cards for round 1 for remaining rounds and update ID
function createRoundWrappers() { for (const entry of races) { // results in 1 more entry than races due to cloning the first round let cardsClone = round.cloneNode(true); cardsClone.id = `round${entry}`; scheduleContainer.appendChild(cardsClone); } // remove the superflous ro...
[ "function cloneCards() {\r\n let existingCards = document.getElementsByClassName(\"flip-container\");\r\n if (existingCards) {\r\n for (let i = existingCards.length - 1; i > 0; i--) {\r\n felt.removeChild(existingCards[i]);\r\n }\r\n }\r\n cards = [];\r\n for (let i = 0; i < 52 * (de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a delete mutation which will delete a single value from a collection using a given collection key. TODO: test
function createDeleteCollectionKeyMutationFieldEntry(buildToken, collectionKey) { // If we can’t delete from the collection key, quit early. if (!collectionKey.delete) return; var collection = collectionKey.collection; var name = "delete-" + collection.type.name + "-by-" + collectionKey.name; ...
[ "function deleteCollection(key, next) {\n\tkey = getCollectionKey(key);\n\tassert.equal(is.function(next), true);\n\n\tgetCollectionWithReferences(key, (collection) => {\n\t\tReference.deleteReferences(collection);\n\t\tassert.equal(is.string(collection._key), true);\n\t\tconnection.del(collection._key, (err, res) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When an image intersects, stop observing it and preload it
function onIntersection(entries) { // Loop through the entries entries.forEach(function(entry) { // Are we in viewport? if (entry.intersectionRatio > 0) { // Stop watching and load the image observer.unobserve(entry.target); preloadImage(entry.target); } }); }
[ "function onIntersection(imageEntities) {\n //and for each of those images we will loop thru\n imageEntities.forEach((image) => {\n //if the current image is intersecting,\n if (image.isIntersecting) {\n //we stop watching it, during this step we are going to set the source on the image, we a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Warns when two props which are mutually exclusive are both being used.
function warnMutuallyExclusive(componentName, props, exclusiveMap) { if (true) { for (var propName in exclusiveMap) { if (props && props[propName] !== undefined) { var propInExclusiveMapValue = exclusiveMap[propName]; if (propInExclusiveMapValue && props[propInExc...
[ "function warnMutuallyExclusive(componentName, props, exclusiveMap) {\n if (process.env.NODE_ENV !== 'production') {\n for (var propName in exclusiveMap) {\n if (props && props[propName] !== undefined) {\n var propInExclusiveMapValue = exclusiveMap[propName];\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get data from getBenefits API
getAllBenefits ({ commit }) { benefitsAPI.getBenefits(benefit => { commit(mutationType.SHOW_ALL_BENEFITS, benefit) }) }
[ "async getBenefits(res) {\n\t\tlet benefits = await this.models.benefits.find()\n\t\t\t.select('title description _id');\n\t\tif (benefits.length < 1) {\n\t\t\tError.conflictError(res, ErrorMessage.NO_DATA_ERROR);\n\t\t}\n\t\treturn {\n\t\t\tcount: benefits.length,\n\t\t\tbenefits\n\t\t};\n\t}", "async getBenefit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saves all Flache data to browser session storage for cache persistence. Purges after 200 seconds.
saveToSessionStorage() { Object.keys(this).forEach(key => sessionStorage.setItem(key, JSON.stringify(this[key])) ); setTimeout(() => sessionStorage.clear(), 200000); }
[ "static saveSession() {\n if (typeof window === 'undefined') return\n window.sessionStorage.idCache = JSON.stringify(idCache)\n window.sessionStorage.itemCache = JSON.stringify(itemCache)\n }", "static saveSession() {\n if (typeof window === 'undefined') return\n window.sessionStorage.idCacheByUse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION TO LOAD FOLLOWERS TO INVITE TO GROUP
function loadfollowersforgroup(from, group, calling) { // alert('in here'); calling = typeof(calling) != 'undefined' ? calling : ''; if (calling == 'followers') { loading = $('.showMoreFollowerPopup').attr('loadmore'); offset = $('.showMoreFollowerPopup').attr('currentOffset'); } if(fro...
[ "function loadfollowingforgroup(from, group, calling) {\n calling = typeof(calling) != 'undefined' ? calling : '';\n if (calling == 'following') {\n loading = $('.showMoreFollowingPopup').attr('loadmore');\n offset = $('.showMoreFollowingPopup').attr('currentOffset');\n }\n\tif(from=='directi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lookup char to know if it's a zalgo char or not
isZalgoChar(c) { var i; for(i = 0; i < this.zalgoUp.length; i++) if(c == this.zalgoUp[i]) return true; for(i = 0; i < this.zalgoDown.length; i++) if(c == this.zalgoDown[i]) return true; for(i = 0; i < this.zalgoMid.leng...
[ "function is_zalgo_char(c)\n{\n\tvar i;\n\tfor(i=0; i<zalgo_up.length; i++)\n\t\tif(c == zalgo_up[i])\n\t\t\treturn true;\n\tfor(i=0; i<zalgo_down.length; i++)\n\t\tif(c == zalgo_down[i])\n\t\t\treturn true;\n\tfor(i=0; i<zalgo_mid.length; i++)\n\t\tif(c == zalgo_mid[i])\n\t\t\treturn true;\n\treturn false;\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Circumscribe an ellipse for the bounding box with a diamond shape. I derived the function to calculate the diamond shape from:
function diamond(parent,bbox,node){var w=bbox.width*Math.SQRT2/2,h=bbox.height*Math.SQRT2/2,points=[{x:0,y:-h},{x:-w,y:0},{x:0,y:h},{x:w,y:0}],shapeSvg=parent.insert("polygon",":first-child").attr("points",points.map(function(p){return p.x+","+p.y}).join(" "));node.intersect=function(p){return intersectPolygon(node,poi...
[ "function diamond(parent, bbox, node) {\n\t var w = (bbox.width * Math.SQRT2) / 2;\n\t var h = (bbox.height * Math.SQRT2) / 2;\n\t var points = [\n\t { x: 0, y: -h },\n\t { x: -w, y: 0 },\n\t { x: 0, y: h },\n\t { x: w, y: 0 }\n\t ];\n\t var shapeSvg = parent.insert(\"polygon\", \":first-chil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Declare a function to check if any roles are currently selected
function checkAllRoles() { roleIsDirty = false; $('#orgRoleList input').each(function (index, value) { if ($(value).prop('checked')) { roleIsDirty = true; } }); }
[ "static hasRole(role){\n let user = new User();\n user.getCurrent();\n let hasRole = false;\n user.data.roles.forEach(user_role => {\n if(user_role.name == role) {\n hasRole = true;\n }\n });\n return hasRole;\n }", "hasRole(email, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcion para cambiar el formato de la fecha. esto es un por desorden que hay en el formato del input en chrome.
function __darFormatoFecha(fecha){ //despedazo la fecha fecha = fecha.split(/[-\/\.]/); //la reconstrullo como DD/MM/AAAA return fecha[2] + "/" + fecha[1] + "/" + fecha[0]; }
[ "function cambiarFormatoFecha(fecha) { \n\t // alert(\"cambiaremos formato fecha\"+fecha); \n\n\t console.log(\"fecha\"+fecha); \n\n\t var info = fecha.split('/');\n\t\t\t\t\t\n\t\treturn info[2] + '-' + info[1] + '-' + info[0]; // yyyy/mm/dd\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t }", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The "insertBefore(newChild,refChild)" method raises a HIERARCHY_REQUEST_ERR DOMException if the node to be inserted is one of this nodes ancestors. Retrieve the second employee and attempt to insert a node that is one of its ancestors(root node). An attempt to insert such a node should raise the desired exception.
function hc_nodeinsertbeforenodeancestor() { var success; var doc; var newChild; var elementList; var employeeNode; var childList; var refChild; var insertedNode; doc = load("hc_staff"); newChild = doc.documentElement; elementList = doc.getElementsByTagName(...
[ "function nodeinsertbeforerefchildnonexistent() {\n var success;\n if(checkInitialization(builder, \"nodeinsertbeforerefchildnonexistent\") != null) return;\n var doc;\n var refChild;\n var newChild;\n var elementList;\n var elementNode;\n var insertedNode;\n \n var docRef...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
\ Element.addStop [ method ] Only for gradients! Adds another stop to the gradient. color (string) stops color offset (number) stops offset 0..100 = (object) gradient element \
function GaddStop(color, offset) { var stop = $("stop"), attr = { offset: +offset + "%" }; color = Snap.color(color); attr["stop-color"] = color.hex; if (color.opacity < 1) { attr["stop-opacity"] = color....
[ "function GaddStop(color, offset) {\n var stop = $(\"stop\"),\n attr = {\n offset: +offset + \"%\"\n };\n color = Snap.color(color);\n attr[\"stop-color\"] = color.hex;\n\n if (color.opacity < 1) {\n attr[\"stop-opacity\"] = color.opacity;\n }\n\n $(stop, at...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to center object on its bounding box An object created in blender may not have its origin at the object's physical center, and this can be annoying when, say, you want to rotate that object. This function will shift the object relative to its parent coordinate system so that its center is at the parent's origi...
function centerOnBoundingBox(object) { // ----------------------------------------------------->>> // Get center of boundingBox var boundingBox = new THREE.Box3().setFromObject(object); var _boundingBox$getCente = boundingBox.getCenter(new THREE.Vector3()).toArray(), x2 = _boundingBox$getCente[0], ...
[ "function centerOnBoundingBox(object) {\n // ----------------------------------------------------->>>\n // Get center of boundingBox\n var boundingBox = new THREE.Box3().setFromObject(object);\n\n var _boundingBox$getCente = boundingBox.getCenter(new THREE.Vector3()).toArray(),\n x2 = _boundingBo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculate and print score then lock submit btn and unlock try agien btn.
function calcProcentAndLock(){ var total = (pointCounter/6)*100; document.querySelector("#score").innerHTML += parseFloat(total).toFixed(2); document.querySelector("#score").innerHTML += "%"; if (total >= 80) { console.log("hei"); document.querySelector("#grats").innerHTML = "Congrats ...
[ "function submitScore(){\n saveScore();\n hideResult();\n showScoreBoard();\n}", "function submitScore() {\n var scoreInfo = getScoreInfo();\n if (scoreInfo) {\n var xhttp = new XMLHttpRequest();\n\n xhttp.onreadystatechange = function() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get first error fro the errors list
first() { return Arr.first(this.errors); }
[ "function getFirstError(errors) {\n \n for (var error in errors) {\n if (errors[error]) {\n return error;\n }\n }\n \n }", "firstError (fieldId) {\n if (!(fieldId in this.fields)) {\n return null;\n }\n\n return this.fields[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the status on given thread, current thread or selected threads
function setThreadStatus(key, value, thread, event) { if ( event ) { event.stopPropagation(); } if (!thread) thread = vm.currentThread; if ( thread ) { if (thread[key] == value) return; thre...
[ "function setThreadStatus(key, value, thread, event)\n {\n // Stop the propagation if event provided\n // This will stop unwanted actions on button clicks\n if ( event )\n {\n event.stopPropagation();\n }\n\n // If the thread pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sync changes across Kanban boards using Pusher
function pusherSync() { syncChannel.bind('client-issue-updates', function(data) { var fromLabel = data.fromLabel; var toLabel = data.toLabel; var toMilestone = data.toMilestone; var fromMilestone = data.fromMilestone; var fromCount = data.fromCount; var toCount = data.toCount; var issueLin...
[ "sync() {\n this._sendPacket('sync', {}, []);\n }", "function pushUpdate(JSONTrackToUpdate) {\n console.log(\"Pushed Update\");\n io.emit('update', JSONTrackToUpdate);\n}", "sync() {\n\t\tthis.send_all({\n\t\t\ttype: \"queue sync\",\n\t\t\tplayers: this.players.map(p => {\n\t\t\t\treturn {\n\t\t\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks config for attrs option to deserialize records a defined option object for a resource is treated the same as `deserialize: 'records'`
hasDeserializeRecordsOption(attrs, attr) { var alwaysEmbed = this.hasEmbeddedAlwaysOption(attrs, attr); var option = this.attrsOption(attrs, attr); var hasSerializingOption = option && (option.deserialize || option.serialize); return alwaysEmbed || hasSerializingOption /* option.deseria...
[ "hasDeserializeRecordsOption(attr) {\n var alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);\n var option = this.attrsOption(attr);\n return alwaysEmbed || option && option.deserialize === 'records';\n }", "hasSerializeIdsAndTypesOption(attr) {\n var option = this.attrsOption(attr);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to check the Terms & Conditions
function checkTerms(e) { //If someone clicked on the checkbox, it will return true. if (check.checked == true) { return true; } else { return false; } } //End CheckTerms //
[ "function validTerms() {\n if ($('#termsCheck').prop(\"checked\") == false) {\n showErrors('terms_errors', \"You must agree to terms and conditions.\");\n return false;\n }\n return true;\n}", "function checkTerm(){\r\n\t\tif ($('#termsChkbx').is(':checked')) {\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init filter endpoint GET '/search?filter=xxx'
initFilterEndpoint() { this.router.get('/search', (req, res) => { if (!req.query || !req.query.filter) return res.status(200).send([]); // TODO parse filter return this.getDAO().getByCriteria(req.query.filter, { user: req.user }) .then(result => res.status(200...
[ "function initSearch() {\n clearResults();\n getUrl(function(url) {\n requestUrl(url);\n });\n }", "initFromUrl() {\n // see if filters have changed.\n const filterString = this.props.location.search.replace(/^\\?/,'');\n if(filterString.length > 0) {\n const allConfig = qs.parse(filt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves a link with text name from the sublink area to the mainlink area before the mainlink with text before
function makeMainLink(name, before) { var link = getSubLink(name); var nodBefore = getMainLink(before); addMainLink(link, nodBefore); }
[ "function makeSubLink(name, before)\n{\n\tvar link = getMainLink(name);\n\tvar nodBefore = getSubLink(before);\n\taddSubLink(link, nodBefore);\n}", "function makeMainLinkAfter(name, after)\n{\n\tvar link = getSubLink(name);\n\tvar nodAfter = getMainLink(after);\n\taddMainLink(link, nodAfter ? nodAfter.nextSibling...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Caps the steering force at the maximum level
function truncate_steering(steering_direction : Vector3, max_force : float){ if (steering_direction.magnitude > max_force){ return steering_direction.normalized * max_force; } else { return steering_direction; } }
[ "changeBackwardGear(){\n if(this.speed == 0){\n this.gear = 6;\n } else {\n this.applyBreak();\n this.gear = 6;\n }\n }", "control_jump(){\n\t\tvar power = 15; // sets max power cap \n\t\tthis.jumpPow = (this.jumpPow * 1.95 + power * 0.05) / 2; //caps out at `power`\n\t\tif(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NEXT FUNCTION RETURNS 'true' IF 'user_email_str' HAS A PASSWORD VALUE OF 'user_password_str', 'false'... ...OTHERWISE A VALID EMAIL IN THE DATABASE SHOULD EXIST AND BE PASSED AS 'user_email_str' 'user_email_str' SHOULD EXIST AS A USER IN 'collection_str' COLLECTION OF THE DATABASE
async function this_user_has_this_password(user_email_str, user_password_str, database, collection_str) { let database_results_array = await database.collection(collection_str).find( {email : user_email_str, password : user_password_str} ).toArray(); if(database_results_array.length ===...
[ "function passwordCheck (pass, email) {\n for (let key in users) {\n if (emailExist(email)) {\n if (users[key].password === pass) {\n return true\n }\n }\n } return false\n}", "checkEmailPassword(email, password) {\n // FIXME Connection with first fake user only\n return email === f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return slide data for requested index
function getSlideDataByIndex(index) { var entryID = indexes[index]; return entryData[entryID] }
[ "function getSlide(index) {\n return $($plex_slides[index]);\n }", "function getSlideData( indices ) {\n\t\tif (!indices) indices = slideIndices;\n\t\tfor (var i = 0; i < storage.data.length; i++) {\n\t\t\tif (storage.data[i].slide.h === indices.h && storage.data[i].slide.v === indices.v && stor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IBuilder.getProduct() Fallback implementation of 'buildPart' service part_id: String or Integer or Enumeration
buildPart(part_id, ...args) { MxI.$raiseNotImplementedError(IBuilder, this); }
[ "getProduct() {\n MxI.$raiseNotImplementedError(IBuilder, this);\n }", "getPart(id) {\n let part = this.parts[id];\n if (!part) {\n console.error('part:', id);\n throw 'getPart: unknown part';\n }\n return part;\n }", "_mapProduct(ctProduct) {\n if (ctProduct.id === undefined) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subscribe to all functions within a namespace.
function subscribeAll(namespace, publicFunctions, observable){ var arr, x; for(x in publicFunctions){ //wildcard syntax arr = x.match(/(.*)/); if (arr != null) { observable.subscribe(publicFunctions[arr[0]]); } } }
[ "function subscriptions() {\n db.smembers(\"nbtsymbols\", function(err, nbtsymbols) {\n if (err) {\n console.log(err);\n return;\n }\n\n nbtsymbols.forEach(function(nbtsymbol, i) {\n subscribe(nbtsymbol);\n });\n });\n}", "function unsubscribeAll(namespace, publicFunctions, observable...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
StorageService.records are updated on every add/edit/delete operation So that background rules can be updated which are executed when each request URL is intercepted
updateRecords(changes, namespace) { var changedObject, changedObjectIndex, objectExists, changedObjectKey; // If storageType is changed then source the data in new storage if (namespace === 'sync' && changes.hasOwnProperty('storageType') && changes['storageType'].newValue) { ...
[ "addRecords(newRecords,uiapiEntityWhitelist){{assert$1(newRecords,\"newRecords must be provided\");assert$1(typeUtils.isArray(newRecords),\"newRecords must be an array\");}// Process the record if LDS has an observable with something listening to it\n // Otherwise note the fields ADS is tracking for the record.\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To get UserID from user name string "Name(ID)". Arguments: 1) User name string. Sample Call: SP_GetUserID(oLeadAuditor[i].value);
function SP_GetUserID(user) { if( SP_Trim(user)!="" && user.indexOf('(')!=-1 ) { try { user = user.substring(user.lastIndexOf('(')+1,user.lastIndexOf(')')); }catch(ex){}; } return user; }
[ "function getUserId(name) {\n\n var whiteSpace = name.replace(/\\s/g, '');\n // check for an empty field\n if (name == '' || whiteSpace == '') {\n return ''; // pass through the empty name\n }\n for...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructor function that creates an object with the sentences property
function GenerateNewText() { // Add property to the object this.sentences = doggoarray; this.punctuation = [".", ",", "!", "?", ".", ",", ",", "!!", ".", ","]; }
[ "function GenerateNewText() {\n // Add property to the object\n this.sentences =\n [\n `how do i get cowboy paint off a dog .`,\n `im little jesica. im dying because of obamas help care bill. im on my death bed and the doctor is ignoring me because my dady works hard`,\n `Welcome to the citadel ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Script data end tag name state
[SCRIPT_DATA_END_TAG_NAME_STATE](cp) { if (isAsciiUpper(cp)) { this.currentToken.tagName += toAsciiLowerChar(cp); this.tempBuff.push(cp); } else if (isAsciiLower(cp)) { this.currentToken.tagName += toChar(cp); this.tempBuff.push(cp); } else { ...
[ "_stateScriptDataEndTagName(cp) {\n if (this.handleSpecialEndTag(cp)) {\n this._emitChars('</');\n this.state = State.SCRIPT_DATA;\n this._stateScriptData(cp);\n }\n }", "function scriptDataEndTagNameI(c){\n if(c == \"p\") {\n return scriptDataEndTagName...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns reference to the current ignition point fire ellipse (changes often!)
ignEllipse () { return this._ignEllipse }
[ "fireEllipse () { return this._ignGrid._ellipse }", "get fireAlias(){\n\t\tvar p = new playerProjectile(this.pos);\n\t\tp.vel = vec2.fromAng(this.rotation, this.firePow);\n\t\tp.explode = function(){this.vel = new vec2(NaN)};\n\t\treturn p;\n\t}", "get fire() {\n return this._fire;\n }", "get eye() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saves a new artist, exposed at POST /artists
function AddNewArtist(req, res) { // Add a new artist by req.body }
[ "function saveArtist(user, token, artistUrl) {\n console.log(\"Save Artists start\");\n request.get(artistUrl, {\n json: true,\n headers: {\n Authorization: 'Bearer ' + token\n }\n }, function (err, response, artist) {\n user.artists.push(artist.items);\n user.save();\n return;\n });\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }