query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
posiciona os navios do jogador
function posicionaNaviosJogador(){ for (var i = 0; i < 10; i++){ console.error("\nNavio n.º "+(i+1)); linhaJogador = (pegarNumero("Linha: ", 1, 10)-1); colunaJogador = (pegarNumero("Coluna: ", 1, 10)-1); if (tabuleiro[linhaJogador][colunaJogador] == " ~~~~ "){ tabuleiro[linhaJogador][colun...
[ "colocarNaves(ejercito) {\n ejercito.listadoNaves.forEach(element => {\n this.poscionNaves.push(element);\n });\n }", "colocarNaves(ejercito, capa) {\n for (let index = 0; index < ejercito.listadoNaves.length; index++) {\n const element = ejercito.listadoNaves[index];\n //Le doy un index ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load expense of a user and append to req.
function load(req, res, next, expenseId) { Expense.get(req.params.userId, expenseId) .then(expense => { req.expense = expense; return next(); }) .catch(e => next(e)); }
[ "function addExpense(req, res) {\n var username = req.body.username ? req.body.username : req.user.username;\n expenseService.addExpense(username, req.body)\n .then(function () {\n res.sendStatus(200);\n })\n .catch(function (err) {\n res.status(400).send(err);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Normalize Level Map If user levelmap not defined tries to normalize using instance levels.
function normalizeLevelMap(levels, levelmap) { if (u.isUndefined(levelmap) || u.isEmpty(levelmap)) { var tmpmap_1 = { default: findLevelBySeverity(levels, 2) }; u.keys(statusToLevel).forEach(function (k) { var severity = findLevelBySeverity(lev...
[ "function normalizeInterestMap() {\n\tif (targetLevel === 'all' ) {\n\t\tinterestMap = mergeAllLevels();\n\t} else {\n\t\tfor (var i = 0; i < interestMap.length; i++) {\n\t\t if (interestMap[i].level.toLowerCase() === targetLevel) {\n\t\t interestMap = interestMap[i].data;\n\t\t return;\n\t\t }\n\t\t}\n\t}\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
aimlInterpreter.findAnswerInLoadedAIMLFiles('What is your name?', callback);
function sendAIMLMessage(message){ aimlInterpreter.findAnswerInLoadedAIMLFiles(message, callback); }
[ "function askForName() {\n let name = input.question(\"Hello, what's your name? \");\n candidateName = name\n}", "function toAIML(kb) {\n let d = header_1(kb)\n d += entry_1(kb)\n d += questions_1(kb)\n d += getvars_1(kb)\n d += setvars_1(kb)\n d += footer_1(kb)\n return d\n\n function he...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: _fnReDraw Purpose: Redraw the table taking account of the various features which are enabled Returns: Inputs: object:oSettings dataTables settings object
function _fnReDraw( oSettings ) { if ( oSettings.oFeatures.bSort ) { /* Sorting will refilter and draw for us */ _fnSort( oSettings, oSettings.oPreviousSearch ); } else if ( oSettings.oFeatures.bFilter ) { /* Filtering will redraw for us */ _fnFilterComplete( oSettings, oSettings.oPrevi...
[ "function _fnReDraw(oSettings) {\n\t\t\tif (oSettings.oFeatures.bSort) {\n\t\t\t\t/* Sorting will refilter and draw for us */\n\t\t\t\t_fnSort(oSettings, oSettings.oPreviousSearch);\n\t\t\t} else if (oSettings.oFeatures.bFilter) {\n\t\t\t\t/* Filtering will redraw for us */\n\t\t\t\t_fnFilterComplete(oSettings, oSe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IUpdateService AddService (string, string)
AddService(string, string) { }
[ "_addService( name, service ) { this.services[ name ] = service; }", "AddService2(string, int, string) {\n\n }", "static addApiServiceSpec(servicename,spec){Env.api.services[servicename]=spec}", "addService(service) {\n if (this.services.has(service.serviceName)) {\n throw Error('Service with name:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to prepare survey result JSON
function prepareSurveyResults(survey) { resultsJSON = survey.data; let returnJSON = {}; // Add a timestamp and prolific ID to the results. returnJSON.timestamp = getCurrentDateTime(); returnJSON.prolificID = $("#submitted-prolific-pid").val(); returnJSON.studyId = studyId; returnJSON["inf...
[ "function export_as_json(ref) {\n var survey = [];\n\n // Get all groups\n groups = $(\"#selected-content\").find('.question-group');\n\n // Loop on each group\n groups.each(function () {\n\n // Get group name and is_template option\n group_name = ($(this).find('.group_name_container')....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set description for an account tag.
setAccountTagDescruption(tag, description) { return __awaiter(this, void 0, void 0, function* () { return yield this.request("set_account_tag_description", { tag, description, }); }); }
[ "description(value) {\n this.tag.description = value;\n }", "set description(value) { this._description = value; }", "set description(aValue) {\n this._logService.debug(\"gsDiggStoryDTO.description[set]\");\n this._description = aValue;\n }", "set description(description) {\n\t\tlet descElem = this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Console.logs the name and cuisines of given restaurants
function logRes(restaurants) { restaurants.forEach( function (r) { console.log(r.restaurant.name + " " + r.restaurant.cuisines); }); }
[ "function printRestaurantInConsole(){\n\n AvailableRestaurantsLaFourchette.forEach((restaurant) => {\n if (typeof (restaurant.Sale) != \"undefined\" && restaurant.Sale[0].is_special_offer == true) {\n\n console.log(\"----Restaurant----\\n\\n\" + restaurant.name + \"\\n\\n------------------\\n\\n\")\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reshapes generated mapData to [noteCount, dcmFeatureLength = 6]
function reshapeMapData(data) { var a = Array.from(data), out = []; for(let i=0; i<a.length; i+=dcmFeatureLength) { out.push(a.slice(i, i + dcmFeatureLength)); } return out; }
[ "scale_map_create() { \n var current_note;\n for (var i = 0; i < this.size; i++) {\n for (var j = 0; j < this.notes[i].length; j++) {\n current_note = this.notes[i][j];\n this.scale_map[current_note] = [i, j];\n }\n }\n }", "function mg_g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
There is a function one , which has two params 'a' 'onecb' which is function as an argument
function one(a, onecb) { console.log(a); //Since it is a function onecb(a+1,(c,threecb)=>{ console.log(c); threecb(c+1,(e)=>{ console.log(e); console.log(a) console.log(c) }); }); }
[ "function one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}", "function callbackExample(cb){\n\n}", "function consume(a, b, callback) {// we start by creating a function called consume, with 3 parameters\n return callback(a, b);// one of the parameters is a cllback function\n }", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given a relativeresolved module name and normalized parent name, apply the map configuration
function applyMap(name, parentName, loader) { var curMatch, curMatchLength = 0; var curParent, curParentMatchLength = 0; var tmpParentLength, tmpPrefixLength; var subPath; var nameParts; // first find most specific contextual match if (parentName) { for (var p in loader.map) { ...
[ "function applyMap(name, parentName, loader) {\n var curMatch, curMatchLength = 0;\n var curParent, curParentMatchLength = 0;\n var tmpParentLength, tmpPrefixLength;\n var subPath;\n var nameParts;\n\n // first find most specific contextual match\n if (parentName) {\n for (var p in loader....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
just loop through the units and console.log them
function consoleLogUnits() { console.log("consoleLogUnits()"); units.forEach(unit => { console.log("Unit:", unit); }); }
[ "function getUnits () {\n return units;\n }", "get units() {\n return this._units;\n }", "get units() {\n return this._units;\n }", "get unitFormatted() {\r\n\t\treturn this.count > 1 ? this.unit + 's' : this.unit;\r\n\t}", "function getAllUnits() {\n Object.va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1652006 Cria um objeto HTML com a tag especificada setando atributos(usando um array nome=valor). Ex.: makeElement("INPUT", "type=TEXT&value=234")
function makeElement(tagName, arrayPropertys) { var el = document.createElement(tagName); if (arrayPropertys == null || arrayPropertys == "") return el; //setando atributos for (x = 0; x < arrayPropertys.split("&").length; ++x) { var attr = arrayPropertys.split("&")[x].split("=")[0]...
[ "function createEl(tag, value) {\r\n\t\tvar el = document.createElement(tag);\r\n\t\tel.innerHTML = value;\r\n\t\treturn el;\r\n\t}", "function newElt(A,doc,isXhtml){if(!doc)return newStruct(A);\n var addAttr=function(elt,att,val){\n // elt[att]=val;\n if(isXhtml)elt.setAttributeNS(null,att,val);\n else...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is required at the moment to get CORS headers support for Firefox. Based on jQuery is not fixing because it's a FF bug. FF is fixing but only as of version 21+ so to support older versions in combination with jQuery 1.4+, we'll need this:
function fixFirefoxXhrHeaders() { var _super = $.ajaxSettings.xhr; $.ajaxSetup({ xhr: function() { var xhr = _super(); var getAllResponseHeaders = xhr.getAllResponseHeaders; xhr.getAllResponseHeaders = function() { var allHeaders = getAllResponseHeaders.call(xhr); ...
[ "function CORS(){}", "function addHeaders(jqXHR, settings) {\n jqXHR.setRequestHeader('Access-Control-Allow-Origin', 'www3.septa.org');\n }", "function addCORSHeaders(resp) {\n var res = resp;\n res.header(\"Access-Control-Allow-Origin\", \"*\");\n res.header('Access-Control-Allow-Methods', 'GET...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
> // This functions checks or unchecks all the checkboxes in the form, using the value of allbox. Takes dynamic arguments. If 2 arguments 1st argument form object reference, 2nd argument checkall all checkbox reference If 3 arguments 3rd argument name of the checkboxes, that has to ckecked/unchecked
function checkAll() { var args = checkAll.arguments; if (args.length > 1) { var formObj = args[0]; var allBoxObj = args[1]; var checkBoxName; var checkedVal = allBoxObj.checked; if (args.length > 2) { checkBoxName = args[2]; } for (var i=0; i<formObj.elements.length; i++) { if (formObj.elements[i...
[ "function CheckAllGroupAllbox () {\n\tif (document.forms[1]) {\n\t\tfor (var j = 0; j < document.forms.length; j++) {\n\t\t\tfor (var i = 0; i < document.forms[j].elements.length; i++) {\n\t\t\t\tif( document.forms[j].elements[i].type == 'checkbox' && document.forms[j].elements[i].name.match(/all-/) ) {\n\t\t\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update row number column size
function updateRowNumberColumn() { // Update row number column size if (component.controller.rowNumbers) { // Get string size var rowNumberColumnSize = (String(getLastRecord()).length + 1) * component.scope.charSize; // Change column width ...
[ "setRowGroupSize(cnt) {\n this.rowGroupSize = cnt;\n }", "setCellSize(val) {\n this.cellSize = val;\n }", "updateSize() {\n\t\tvar t = this;\n\t\tvar len = t.getLength();\n\t\tif (len == 0) {\n\t\t\tt.setLength(1);\n\t\t} if (len > 0) {\n\t\t\tvar needsNew = !t.isRowBlank(t.getRow(len - 1)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iterates through the questions
function iterateQuestionsAndAnswers() { if (questionIndex < questions.length - 1) { questionIndex++; displayQuestions(); } else if (questionIndex === questions.length - 1 && currentScoreValue > 12) { winner(); } }
[ "function iterateThroughQuestionsArray(questions) {\n \n for(var x = 0; x < questions.length; x++){\n \n //call display questions function\n displayQuestions(questions[x]);\n //call display choices function\n displayChoices(questions[x].choices, x);\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUBLIC Removes this connection from the map.
function removeConnection() { this.originPort.remove(); this.destinationPort.remove(); document.getElementById(MAP).removeChild(document.getElementById(this.id)); }
[ "mapRemove() {\n\n\t\tthis.map.remove();\n\n\t}", "remove() {\n this.setMap(null);\n }", "function removeConnection(map) {\n var overlayPane = d3.select(map.getPanes().overlayPane);\n overlayPane.selectAll('.clusterConnection').remove();\n }", "removeConnection(conn) {\n\t\tvar da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates file fields by merging in the 'updates', does not perform any validation, and does not save to the server
function updateFile(fileId, updates) { setFormState(prevFormState => { const newFormState = _cloneDeep(prevFormState) let fileChanged = newFormState.files.find(f => f._id === fileId) if (!fileChanged && isAnnDataExperience) { const annDataFile = newFormState.files.find(f => f.file_type ===...
[ "async update() {\n await Promise.all(this.files.map(file => file.update()));\n\n this.data.files = this.files.map(file => file.data);\n }", "function updateFileProperties(obj) {\r\n\tvar endpointUrl = obj.siteUrl + \"/_api/web/getFileByServerRelativeUrl('\" + obj.fileUrl + \"')/ListItemAllFields\";\r\n\tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get in a array the names of different groups in CSV
function GetGroups(massiveData){ var uniqueNames = []; for(i = 0; i< massiveData.length; i++){ if(uniqueNames.indexOf(massiveData[i].group.grupo) === -1){ uniqueNames.push(massiveData[i].group.grupo); } } return uniqueNames; }
[ "getGroupNames(groups) {\n if (groups === -1) {\n return [PhysicsManager.DEFAULT_GROUP];\n }\n else {\n let g = 1;\n let names = [];\n for (let i = 0; i < 32; i++) {\n if (g & groups) {\n // This group is in the group...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the path of `filename` relative to `relTo` which should be a directory path without a trailing path separator.
function getRelativeFileName(filename, relTo) { if (filename.startsWith(relTo + path.sep)) { return filename.slice(relTo.length + 1); } else { return filename; } }
[ "function fullyQualifiedPath(filename) {\n\t\treturn path.join(OTRTALK_ROOT, filename);\n\t}", "function fullyQualifiedPath(filename) {\n\treturn path.join(OTRTALK_ROOT, filename);\n}", "function buildRelativePath(from, to) {\n var _a = parsePath(from), fromPath = _a.path, fromFileName = _a.filename, fromDir...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when the player is ready, start checking the current time every 100 ms.
function onPlayerReady() { var videotime = 0; var timeupdater = null; function updateTime() { var oldTime = videotime; if(player && player.getCurrentTime) { videotime = player.getCurrentTime(); } if(videotime !== oldTime) { onProgress(videotime); } } time...
[ "function onPlayerReady() {\n\tfunction updateTime() {\n\t\tvar oldTime = videotime;\n\t\tif (player && player.getCurrentTime) {\n\t\t\tvideotime = player.getCurrentTime();\n\t\t}\n\t\tif (videotime !== oldTime) {\n\t\t\tonProgress(videotime);\n\t\t}\n\t}\n\n\ttimeupdater = setInterval(updateTime, 100);\n}", "han...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add eventlisteners to buttons if student is not expelled
function addStudentActions() { if (allStudents.includes(student)) { clone.querySelector(".prefect").addEventListener("click", prefectClick); function prefectClick() { checkPrefectStatus(student); } clone.querySelector(".inquisitorial").addEventListener("click", inquisitorialClick); ...
[ "function addProfileListeners(studentClicked, studentArray) {\n expelBtn.addEventListener(\"click\", function () {\n expelStudent(studentClicked, studentArray);\n });\n addPrefectBtn.addEventListener(\"click\", function () {\n addPrefectStudent(studentClicked, fullArray);\n });\n remove...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove edge connect to these vertexs
removeAllEdgeConnectToTheseVertex(lstVertex) { lstVertex.forEach(e=>{ this.findEdgeRelateToVertex(e.id).forEach(edge=>{ edge.remove() }) }) }
[ "removeAllEdgeConnectToVertex(vertex)\n\t{\n\t\tthis.findEdgeRelateToVertex(vertex.id).forEach(edge=>{\n\t\t\tedge.remove()\n\t\t})\n\t}", "removeVertex(vertex) {\n for(let node of vertex.adjacent){\n node.adjacent.delete(vertex);\n }\n vertex.adjacent.clear()\n this.nodes.delete(vertex);\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adjusts size of seek bar divs to reflect how much of video has played
calculateTime() { let video = document.getElementById('video'); let seekBarPlayed = document.getElementById('seek-bar-played'); let seekBarBuffered = document.getElementById('seek-bar-buffered'); var time = video.currentTime; var duration = video.duration; var buffered =...
[ "seekBarUpdate() {\n const ratio = this.video.currentTime / this.video.duration\n this.seekBarFillElement.style.transform = `scaleX(${ratio})`\n }", "function updateProgressBar() {\n seekEl.value = Math.floor(videoEl.currentTime);\n progressBarEl.value = Math.floor(videoEl.currentTime);\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A class method returning a new random cube
static random() { return new Cube().randomize(); }
[ "function generateCube() {\n var geometry = new THREE.CubeGeometry(100, 100, 100);\n\n this.addGeometry(geometry);\n _camera.position.z = 500;\n\n return this;\n }", "function createCube() {\r\n let cube = document.createElement(\"div\");\r\n cube.style.cssText = `width:${CUBEWITH}px;height:${C...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
provides condition for re rendering based on new props
shouldRender(newProps) { return true; }
[ "_shouldRender(props, changedProps, prevProps){\n console.log('props are now: ', props);\n console.log('props that changed: ', changedProps);\n console.log('previous props were: ', prevProps);\n\n // You can override _shouldRender if you need to specify which property\n // changes should trigger a re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inserta el combobox en la tabla, con los nombres de las distribuciones del tipo 'type'
function insertDistributionCombo(table, current, type) { var html = "&nbsp;<select id='DIST_SELECT' name='DIST_SELECT' >"; for (var ix in distribuciones) { if (distribuciones[ix].tipo == type) { html += "<option value='" + ix + "'"; if...
[ "function initTypeBox() {\n ComboBox.init({\n inputSelector : \"#ctype\",\n parentContainer : '#search-container',\n appendTo : '#search-container',\n isMultiSelect : false,\n selectAction : function() {\n setTypeInputDataAttribute($(\"#ctype\"));\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sends deal action to the route
click() { this.sendAction('deal', this.get('result')); }
[ "_handleTransfer() {\n this.set('route.path', './fund-transfer')\n }", "function dealorhit() {\n if(dealpressed == 0) {\n deal();\n } \n else {\n gethit('me')\n }\n }", "function carryRoute(index) {\n var elem = curRoute.route[index];\n var action = \"leaveUser\";\n if (elem....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the total number of dataplanes from a mesh
getDataplaneFromMeshTotalCount ({ commit }, mesh) { return api.getAllDataplanesFromMesh(mesh) .then(response => { const total = response.items.length commit('SET_TOTAL_DATAPLANE_COUNT_FROM_MESH', total) }) .catch(error => { console.error(error) ...
[ "get subMeshCount() {}", "getTrafficTracesFromMeshTotalCount ({ commit }, mesh) {\n return api.getAllTrafficTracesFromMesh(mesh)\n .then(response => {\n const total = response.items.length\n\n commit('SET_TOTAL_TRAFFIC_TRACES_COUNT_FROM_MESH', total)\n })\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pushubutton Make Switch 2 Extends mxShape.
function mxShapeElectricalPushbuttonMakeSwitch2(bounds, fill, stroke, strokewidth) { mxShape.call(this); this.bounds = bounds; this.fill = fill; this.stroke = stroke; this.strokewidth = (strokewidth != null) ? strokewidth : 1; }
[ "function mxShapeElectricalPushbuttonTwoCircuitSwitch2(bounds, fill, stroke, strokewidth)\n{\n\tmxShape.call(this);\n\tthis.bounds = bounds;\n\tthis.fill = fill;\n\tthis.stroke = stroke;\n\tthis.strokewidth = (strokewidth != null) ? strokewidth : 1;\n}", "function mxShapeElectricalManualSwitch2(bounds, fill, stro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This creates a query popup to ask for a player name.
function askForName() { // drop down menu let input = document.createElement("input"); input.type = "text"; // when the input field is unselected the popup will be closed input.addEventListener("blur", (e) => { players.push(new Player(e.target.value)); e.target.parentNode.style.display = "none"; }...
[ "function showOpponentName(name) {\n\tlet startBtnArea = document.querySelector('#prompt_field');\n\tlocalStorage.setItem('opponentUserName', name);\n\tstartBtnArea.innerHTML = `<p>${name} has joined the room</p>`;\n\tsetTimeout(function() {\n\t\tchooseQuestion();\n\t}, 3000);\n}", "function playerNameSelection()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
errorOnPoolSave While creating/updating a pool, validation errors can be thrown from the server This will map the error to repective fields in the form If there is no field errors then an error popup will be shown
function errorOnPoolSave($scope, $model) { return function(resp) { var errorInField = false; var fields = ['name', 'size', 'pg_num', 'crush_ruleset']; _.each(fields, function(field) { if (_.has(resp.data, field)) { ...
[ "handleAddPool() {\n const isFormValid = this.validateForm();\n if (!isFormValid) return;\n\n this.setState({ isAdding: true });\n const { name, serialNumber } = this.state;\n api.addPool(name.value, serialNumber.value)\n .then(() => this.handleCloseModal())\n .catch(err =>{\n consol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the Id of a given item
function getIdOfItem(item){ return item.id; }
[ "getId(item) {\n if (item === undefined) throw new Error(this.options.modelName+\": Cannot get Id of undefined!\")\n return _.get(item, this.options.nameOfIdAttr+'.$oid')\n }", "function getItemIdFromElement(item) {\n return $(item)\n .closest('.js-item-element')\n .data('item-id');\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add button to header
function addButton(header, section, prepend, sectionIdStr) { // add button var id = sectionIdStr; if (id) { section.attr('id', id); } else { id = sectionId(header, section); } var buttonEl = button(id); if (prepend) { header.prepend(buttonEl); } else { header.append(buttonEl); } // ...
[ "function addHeader() {\n layout.header.add(new Surface({\n content: 'Make a selection',\n properties: {\n backgroundColor: 'black',\n lineHeight: '50px',\n fontSize: '30px',\n textAlign: 'center',\n color: 'white'\n }\n }));\n }", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save score and initials to array
function saveScore() { let userInitials = $userInitialsEl.val().trim(); let savedScore = (userInitials + " " + userScore); if (userInitials === "") { return; } scores.push(savedScore); $userInitialsEl.val(""); showHighScores(); storeScores(); ...
[ "function saveScore() {\n // console.log(\"saveScore\");\n // console.log(initials);\n \n localStorage.setItem(\"initials\", initials);\n localStorage.setItem(\"score\", score);\n}", "function saveScores() {\n var scoreName = initialsInput.val();\n var highScores = scoreName + \" : \" + secondsLe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Closes all Tabs (it keeps one open)
closeAllTabs() { for (let i = this.boxes.webviews.length; i > 0; i--) { this.closeTab(i); } }
[ "closeAll() {\n const tabs = this.slice();\n this._current = null;\n for (let tab of tabs) tab.close();\n }", "function closeAllTabs() {\n IDE.sessions.forEach(function (session) {\n IDE.closeSession(session);\n });\n }", "function closeTabs() {\n while (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes movie night list from collection
async deleteMovieNightList(ctx, name) { await db.collection(auth.currentUser.uid).where('name', '==', name).get().then(snap => { snap.forEach(doc => db.collection(auth.currentUser.uid).doc(doc.id).delete() ); }) ctx.dispatch('fetchMovieNightLists'); }
[ "async movieNightRemoveFromList(ctx, movie) {\n let list = ctx.getters.getMovieNightList;\n await list.forEach((m, i) => {\n if(m == movie) {\n list.splice(i, 1);\n }\n });\n await ctx.commit('setMovieNightList', list);\n }", "function removeFromWatc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add popup to row free HTML code
function addPopupContent(row) { return false; var sheetName = $(row).attr("sheetName"); $(row).popup({ html: $(getCellNamesAsHTML()), inline: true, hoverable: true, transition: "zoom", delay: { show: 500, hide: 100 }, setFluidWi...
[ "function MatchPopUp(row, cell, value) {\n\t\t\n\t\t\treturn '<span class=\"select-match-pop\"></span>';\n\t\t\n\t}", "tablePopup_html(set) {\n let text = \"<div class='table-popup'>\"\n let nameStr = \"\";\n let imageUrl = \"\";\n if(set.name){\n nameStr = set.name.Name;\n image...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
log the started download
function onStartedDownload(id) { console.log(`Started downloading: ${id}`); }
[ "function printCompleteMessageToConsole() {\n console.log('Download complete');\n}", "function downloadLogs() {\r\n extraInfo = [\r\n \"--- Additional debug information ---\",\r\n {player: player}];\r\n logger.download(extraInfo);\r\n}", "function downloadFinished(){\n}", "function launch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find produto by id
async findByID(id) { try { // busca o produto const findProduto = await this.dbProduto.findByPk(id) // retorna o produto return findProduto; } catch (error) { // mostra o erro no console console.log(error); // gera um erro throw new Error({ 'ProdutosService error:...
[ "function obtenerProducto(id) {\n return Atencion.findById(id)\n}", "function findById(id) {\n let currentProduct = products.find((product) => {\n return product.id === id\n })\n return currentProduct\n}", "getProduct(products,id) {\n return products.find(prod=>prod.id===id)\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Master constructor for a pinch/zoom handler on an image. By default, the parent element will be used as the container in which to constrain the image; specify this.containerNode to override this. Images will be initially displayed at tofit size, using a scale transform for speed. TODO:RB:20111130: While this could be e...
function PinchZoom(image, options) { var defaultConfig = { maxScale: 5, hardScaleLimit: true }, Listeners = require('./event-listeners'), cssPrefix = require('./vendor-css-prefix'); // Ensure this is an instantiated object, enabling eg. require('pinchzoom')(image, ...) ...
[ "function initImageZoom() {\n\n \t//reset the zoom\n \tpublicAPI.resetZoom();\n\n \tvar\t$parentWidth = $parent.width();\n\n\n \tif($parentWidth) {\n\n\t\t\tvar $imageWidth = $image[0].naturalWidth,\n \t\t$imageHeight = $image[0].naturalHeight,\n\n \t\tnewHeight = Math.round($parentWidth * $imageH...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
formatType6 :: PropPath > Integer > (String > String) > Type > PropPath > String > String
function formatType6(indexedPropPath) { return function(index_) { return function(f) { return function(t) { return function(propPath_) { var indexedPropPath_ = Z.concat ([index_], propPath_); var p = isPrefix (indexedPropPath_) (indexedPropPath); var q = i...
[ "function formatType6(indexedPropPath) {\n return function(index_) {\n return function(f) {\n return function(t) {\n return function(propPath_) {\n var indexedPropPath_ = Z.concat ([index_], propPath_);\n var p = isPrefix (indexedPropPath_) (indexedPropPath);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Crypt start Proview Javabased implementation of the unix crypt command
function JopCrypt() { this.ITERATIONS = 16; this.con_salt = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00...
[ "function pidCrypt(){\n //TODO: better radomness!\n function getRandomBytes(len){\n if(!len) len = 8;\n var bytes = new Array(len);\n var field = [];\n for(var i=0;i<256;i++) field[i] = i;\n for(i=0;i<bytes.length;i++)\n bytes[i] = field[Math.floor(Math.random()*field.length)];\n return byt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mouse out event, hide tooltip
handleMouseOut(vis, event, d) { // console.log("hover out", d); //Put tool tip back vis.tooltip .style("opacity", 0) .style("left", 0) .style("top", 0) .html(``); }
[ "function mouseout() {\n tooltip.style(\"display\", \"none\");\n }", "function mouseout(){\n tooltip.transition()\n .duration(500)\n .style(\"opacity\", 0);\n }", "mouseLeave() {\n this.tooltipBox.style(\"visibility\", \"hidden\");\n }", "tipMouseout()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
register a project and it's subsequent plugins
function registerProject(projectName, projectDescriptor, protocols) { var pluginList = []; for (var pluginName in projectDescriptor.plugins) { var pluginDescriptor = projectDescriptor.plugins[pluginName]; var taskList = registerPlugin([projectName, pluginName], pluginDescriptor,...
[ "register(...plugins) {\r\n for (let plugin of plugins) {\r\n this.plugins[plugin] = DI.resolve(plugin + 'Form');\r\n }\r\n }", "function pluginsInstallation() {\n const strapiBin = path.join(scope.strapiRoot, scope.strapiPackageJSON.bin.strapi);\n // Define the list of default p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process all the vendor configs given in the config object
function processVendors () { gutil.log(`Cleaning ${vendorsConfig.dest}...`) // Delete the contents of the vendors folder del.sync([vendorsConfig.dest + '/*']) // Process all the vendors processVendorConfig(vendorsConfig.vendors) }
[ "function processVendorConfig (vendorConfig, vendorConfigName) {\n if (typeof vendorConfig === 'object' && vendorConfig) {\n // Process the config object which has a src property\n if (objectPath.has(vendorConfig, 'src')) {\n gutil.log(`Processing vendor config for ${vendorConfigName}`)\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility to check that args.length === n or (args.length % m) === n and that args.length < min. Throws an error otherwise. Only the first two arguments are required
function check(args, n, m, min) { if (n !== (m ? args.length % m : args.length) || args.length < min) throw new Error("wrong number of arguments"); }
[ "function checkRequiredParams(argsLength, requiredLength) {\n if (argsLength - 1 < requiredLength) {\n return false;\n }\n\n return true;\n}", "function _ch_checkArgs(args, count, message) {\n if (args.length < count) {\n _ch_error(message + \" requires at least \" + count + \" arguments...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
validate all the plugins
function validateAllPlugins(pluginDefs) { Log.section('Validating plugins'); const validatePromises = pluginDefs.map(plugin => validatePlugin(plugin)); return Promise.all(validatePromises) .then( Log.resolved('Plugins validation completed'), Log.rejected('Plugins validation failed'), ).catch...
[ "async function validatePlugins(validatePlugin, rc) {\n const errors = [];\n if (!Array.isArray(rc.plugins)) {\n return [];\n }\n await Promise.all(rc.plugins.map(async (plugin) => {\n if (!Array.isArray(plugin)) {\n return;\n }\n const pluginErrors = await validat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SFVFS[] Set Freedom Vector From Stack 0x0B
function SFVFS(state) { var stack = state.stack; var y = stack.pop(); var x = stack.pop(); if (DEBUG) console.log(state.step, 'SPVFS[]', y, x); state.fv = getUnitVector(x, y); }
[ "function SFVFS(state) {\n\t var stack = state.stack;\n\t var y = stack.pop();\n\t var x = stack.pop();\n\n\t if (exports.DEBUG) { console.log(state.step, 'SPVFS[]', y, x); }\n\n\t state.fv = getUnitVector(x, y);\n\t}", "function SFVFS(state) {\n var stack = state.stack;\n var y = stack.pop()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the left indent for selected paragraphs.
set leftIndent(value) { if (value === this.leftIndentIn) { return; } this.leftIndentIn = value; this.notifyPropertyChanged('leftIndent'); }
[ "get leftIndent() {\n return this.leftIndentIn;\n }", "function doInsertRulerLeft(level){\n var rep = this.rep,\n documentAttributeManager = this.documentAttributeManager;\n\n var firstLine, lastLine;\n \n firstLine = rep.selStart[0];\n lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
podPress_https_check checks whether the request is an https request and adjusts the protocol if necessary (will change only URLs with the siteurl at the begining)
function podPress_https_check(url) { var siteurl_without_protocol = podPressBlogURL.match(/^https?:\/\//i, url); var url_without_protocol = podPressBlogURL.replace(siteurl_without_protocol, ''); var siteurl_regexp = new RegExp( url_without_protocol, 'i' ); if ( -1 != url.search(siteurl_regexp) ) { retur...
[ "function isHttps() {\n return protocol().toLowerCase() == \"https:\" ? true : false;\n}", "function ensureHttps() {\n if (window.location.protocol != \"https:\" && window.location.protocol != \"file:\" && window.location.hostname != \"localhost\") {\n window.location.href = \"https:\" + window.location.hr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the function that does multiplecombinatorials size is en the sets we are making is pSets numbset is the actual set
function generateMultipleCombins(en,pSets,numbSet) { function makeTwoSets(en,pSetsNumb,pNumbSet) { var keepSet = [] var splitSet =[] var baOut = binaryAssignment(en,pSetsNumb,pNumbSet,true); if ((baOut[0][0].length==pSetsNumb)) { splitSet=baOut[1].slice(); keepSet=baOut[0].slice(); } else { ...
[ "function expCountSubsetsOfSet(n) {\n if (n === 0) return 1\n else return expCountSubsetsOfSet(n - 1) + expCountSubsetsOfSet(n - 1)\n}", "cardinality(set) {\n return set.size;\n }", "getCandidateSets(potentialUsedSets, baseSets, setlessMods) {\n /**\n * Possible sets:\n *\n * base set...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new Vue object for the Sample Template in a safe way
function newSampleTemplateVue(target) { if (sampleTemplatePage !== null) { sampleTemplatePage.$refs.stElem.destroy(); } sampleTemplatePage = new Vue({el: target}); }
[ "created() {\n this.$nuxt = true\n }", "InitializeFromTemplate() {\n\n }", "createVueVM() {\n this.vm = new Vue({\n data: {\n state: this\n }\n })\n }", "create() {\n if (this.template) {\n this.innerHTML = elation.template.get(this.template, this);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Normalizes the path found in the error message. If it cannot be normalized the original error message is returned. Example: converts 'base/Token.sol:6:46: Warning: Unused local variable' to 'Token.sol:6:46: Warning: Unused local variable' This is used to prevent logging the same error multiple times.
function getNormalizedErrMsg(errMsg) { var SOLIDITY_FILE_EXTENSION_REGEX = /(.*\.sol):/; var errPathMatch = errMsg.match(SOLIDITY_FILE_EXTENSION_REGEX); if (errPathMatch === null) { // This can occur if solidity outputs a general warning, e.g // Warning: This is a pre-release compiler versio...
[ "standardizeError(err, path, realPath) {\n const index = err.message.indexOf(path);\n if (index !== -1) {\n err.message = err.message.substr(0, index) + realPath + err.message.substr(index + path.length);\n err.path = realPath;\n }\n return e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
focal stack viewer constructor
function focalStackViewer(viewer_div_obj, mode, data_obj){ // Input: data_obj, which contains the information of focal stack dataset // // Here is the layout of data_obj: // src_dir // frame_number // depth_map // title // // frames are named in the following manner (1 base...
[ "constructor(scene, slices, stacks)\n\t{\n\t\tsuper(scene);\n\t\tthis.slices = slices;\n\t\tthis.stacks = stacks;\n\t\tthis.initBuffers();\n\t}", "function OpenSeadragon(t){return new OpenSeadragon.Viewer(t)}", "function LView() {}", "function StackFramesView() {\n this._onFramesScroll = this._onFramesScroll...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set noremove flag for all inventory items
function inventory_items_set_noremove() { for (var i=0; i<inventory_array.length; i++) { inventory_array[i].gObject.mesh.noremove = true; } }
[ "function updateInventory() {\n for (let key in state) {\n if (!inventory[key]) {\n // Hoppa över ifall key inte finns i inventory.\n continue\n }\n state[key] ? inventory[key].status = true : inventory[key].status = false\n }\n }", "resetTakeItemsInMenus() {\n this.vLab...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get meals from LS
function getMealsFromLs() { const favMeals = JSON.parse(localStorage.getItem("fav-meals")); return favMeals === null ? [] : favMeals; }
[ "static getMeal(mealID) {\n const meals = this.getMeals();\n let meal;\n meals.forEach((ml) => {\n if (ml.id === mealID) {\n meal = ml;\n }\n });\n return meal;\n }", "static getMeals() {\n let meals;\n const mealData = fs.readFileSync(\n './assets/data/meals.json',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
share = amount part/total
function calcShare(s, T, A){ const _s = new BigNumber(s) const _A = new BigNumber(A) const _T = new BigNumber(T) return (_s.times(_A)).div(_T); }
[ "async claimableTotalShares(cycle, pair) {\n const query = this.createQuery({\n method: {\n name: 'claimable-total-shares',\n args: [`u${cycle}`, `\"${pair}\"`],\n },\n })\n const receipt = await this.submitQuery(query)\n return parseInt(receipt.result.slice(1))\n }", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the information for a forward pass of a 3D convolution/pooling operation.
function computeConv3DInfo(inShape, filterShape, strides, dilations, pad, depthwise, dataFormat) { if (depthwise === void 0) { depthwise = false; } if (dataFormat === void 0) { dataFormat = 'channelsLast'; } var _a = [-1, -1, -1, -1, -1], batchSize = _a[0], inDepth = _a[1], inHeight = _a[2], inWidth = _a[3]...
[ "function computeConv3DInfo(inShape, filterShape, strides, dilations, pad, depthwise, dataFormat, roundingMode) {\n if (depthwise === void 0) {\n depthwise = false;\n }\n if (dataFormat === void 0) {\n dataFormat = 'channelsLast';\n }\n var _a = [-1, -1, -1, -1, -1], batchSize = _a[0], inDepth = _a[1], i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds a class name to all the movable tiles
function addClass() { var tiles = $$("#puzzlearea div"); for(var i = 0; i < tiles.length; i++) { // adding/removing classNames based on whether they are movable if(canMove(tiles[i])) { tiles[i].addClassName("movablepiece"); } else { tiles[i].removeClassName("movablepiece"); } } }
[ "function changeTiles(){\r\n\tdocument.getElementById('tile-2').setAttribute('class', 'metro-tile');\r\n}", "function setTileAttributes() {\n tileArray.forEach((element) =>\n element.setAttribute(\"onclick\", \"moveTile(this)\")\n );\n tileArray.forEach((element) => element.classList.add(\"tile\"));\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For each property of p, delete the property with the same name from o. Return o.
static subtract(o, p) { for(let prop in p) { // For all props in p delete o[prop]; // Delete from o (deleting a // nonexistent prop is harmless) } return o; }
[ "function subtract(o, p) {\n for(prop in p) { // For all props in p\n delete o[prop]; // Delete from o (deleting a\n // nonexistant prop is harmless)\n }\n return o;\n}", "static restrict(o, p) {\n for(let pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw the unit circle and axes
draw_axes(gfx) { // Drawing in white gfx.noFill(); gfx.stroke(255); // Draw the unit circle (width and height 2) gfx.ellipse(0, 0, 2, 2); // Draw x- and y-axes gfx.line(-10, 0, 10, 0); gfx.line(0, -10, 0, 10); }
[ "function drawCircle(){\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n createGrid();\n let center = getCentroid();\n let radius = getRadius(center);\n ctx.beginPath();\n ctx.strokeStyle = 'blue';\n ctx.arc(center.x, center.y, radius, 0, 2 * Math.PI);\n ctx.stroke();\n }", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fill all selects with values.
_fillSelects() { // octaves for (let i = 1; i <= 7; i++) { let option = document.createElement("option"); option.value = i; option.textContent = i; this._octaveSelectEl.appendChild(option); } // keys CHORDS_KEYS.forEach(key => { let option = document.createElement("option"); option.value = ...
[ "function fillSelectWithColumns(id, addNone, setValue, value){\n $.post(\"get_table_columns?table={{table}}\", function(response){\n var values = response.split(',');\n if (addNone){\n values.unshift('none');\n }\n select_class = document.getElementById(id);\n select...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getPageRangesDiffSegment returns a single segment of page ranges starting from the specified Marker for difference between previous snapshot and the target page blob. Use an empty Marker to start enumeration from the beginning. After getting a segment, process it, and then call getPageRangesDiffSegment again (passing t...
async listPageRangesDiffSegment(offset, count, prevSnapshotOrUrl, marker, options) { var _a; const { span, updatedOptions } = createSpan("PageBlobClient-getPageRangesDiffSegment", options); try { return await this.pageBlobContext.getPageRangesDiff(Object.assign({ abortSignal: options...
[ "async listPageRangesDiffSegment(offset, count, prevSnapshotOrUrl, marker, options = {}) {\n return tracingClient.withSpan(\"PageBlobClient-getPageRangesDiffSegment\", options, async (updatedOptions) => {\n var _a;\n return assertResponse(await this.pageBlobContext.getPageRangesDiff({\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads disclaimer dialog popup for calc field precision explanation
function calcDisclaimer() { $.get(app_path_webroot+'DataEntry/calc_disclaimer_popup.php', { pid: pid }, function(data) { if (!$('#calcDisclaimer').length) $('body').append('<div id="calcDisclaimer"></div>'); $('#calcDisclaimer').dialog('destroy'); $('#calcDisclaimer').html(data); $('#calcDisclaimer').dial...
[ "function showWarranty() {\n debug && console.log( \"EquipmentDetail.showWarranty: Displaying warranty notes.\");\n // Do nothing for now\n /*\n\n if( equipment.warranty == null ) {\n alert( Localization.getText( \"noWarranty\" ) );\n } else {\n var warranty ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
tag explode (split) event handler
function onExplode(event) { var self = getSelf($(this)); onButton.call(this, event, services.tag.explode, { sel: "Explode this tag in SELECTED videos?", all: "Explode ALL tags of this kind?", hits: "Explode this tag in SEARCH results?" }, function (mediaids, tag) { var tmp = explode(tag), i; ...
[ "function parseTags() {\n\t\tlet words = tagContainer.current.textContent;\n\t\tconst t = words.split(/\\s/g);\n\t\t// the last element is either empty string or the currently typed word\n\t\tt.pop();\n\t\tsetTags(t);\n\t}", "split(iterable) {\n if (!Array.isArray(iterable)) {\n // warning is developer fr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if updated observation data is available from bom
function checkBomUpdates() { // Get the current date and time as UTC let lCurrentTime = new Date(); // Get the current bom obs timestamp from the data area of the page let lObsTimestampStr = document.getElementById('bomTimestamp').innerHTML; try { // Create the date object for the b...
[ "checkForChange() {\n\t\tthis.observables.forEach( (observe) => {\n\t\t\tif(observe.lastValue != observe.gene.value) {\n\t\t\t\tthis.receiveUpdatedMessage(\"dna\", observe.gene.name);\n\t\t\t}\n\t\t});\n\t}", "gotUpdated() {\n return this.hasType(0 /* UPDATED */);\n }", "function checkExamUpda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Previous Visible Tab
function GetPreviousTab() { let currentTab = GetCurrentTab(); return TabList[($.inArray(currentTab, TabList) - 1 + TabList.length) % TabList.length]; }
[ "_prevTab() {\n const tabs = this._allTabs();\n const newIdx =\n tabs.findIndex(tab => tab.selected) - 1;\n return tabs[(newIdx + tabs.length) % tabs.length];\n }", "_prevTab() {\n const tabs = this._allTabs();\n // Use `findIndex()` to find the index of the currently\n // selected...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populate the HTML with the content from Reddit's API
function populate_posts(parsed_json) { let post_counter = 0; const REDDIT_HOST = 'https://www.reddit.com'; $.each(parsed_json, function (jsonkey, jsonval) { let media_html = ''; let epoch_date = parsed_json[jsonkey]['date_created']; let date_object = new Date(epoch_date*1000); ...
[ "function getReddit(city, country) {\r\n // Variables \r\n let api, sortBy, link;\r\n // Base of API \r\n api = 'https://www.reddit.com/search.json?q=';\r\n // Sort articles from reddit by relevence\r\n sortBy = '&sort=relevance';\r\n // Limit number of array's element\r\n limitBy = '&limit=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
assigns value to playerDetails.job
function getJob() { //can be called by testJobSelect function (test drop down on page) playerDetails.job = jobs.war; //<--- hard-coded. will need to be replaced with db query. addJobStyling(playerDetails.job); }
[ "assign(job) {\n this.job = job;\n if (job) {\n this.creep.memory.jobId = job.id();\n job.assign(this);\n } else {\n this.creep.memory.jobId = null;\n }\n }", "get jobId() {\n return this.getStringAttribute('job_id');\n }", "set job(jobName) {\n this._job = JOBS.get(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Messaging login with user name
function login(name) { console.log('logging in as', name); var msg = { type: 'login', from: name } conn.send(JSON.stringify(msg)); }
[ "function send_login() {\n ws.send(\n JSON.stringify(\n {\n type: 'login',\n id: user.id,\n name: user.name,\n color: user.col,\n x: user.x,\n y: user.y,\n room: roomName\n }\n )\n );\n}", "function chatLogin() {\n sendWebSocketMessage(v_chatWe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check SQL For Password TextBoxes
function chksqltxt_psw(txt_ctrl) { var txtval = txt_ctrl.value; if (txtval=="") { alert('Please Enter Password ...'); return false; } else if (txtval=="$" || txtval=="+" || txtval=="(" || txtval==")" || txtval=="|") { txt_ctrl.value=""; alert('Do not use SQL Key-W...
[ "function checkPassword() {\n\tscrollToBottom();\n\tif (level == 1)\n\t\tswitch (textInBox) {\n\t\t\tcase password:\n\t\t\t\tendLevel();\n\t\t\t\tbreak;\n\t\t\tcase \"root\":\n\t\t\t\tendLevel();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tinputPhase = 0;\n\t\t\t\tunknownInput();\n\t\t}\n\t\tscrollToBottom();\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
bind json data to an object
function bindJSON(object, url, data, callback) { $.getJSON(url, data, function(mydata){ if(object != null) { for(var one in mydata) { var value = mydata[one]; object[one] = value; } if(callback != undefined) callback(object); } else { if(callback != undefined) callback(mydata); } }); }
[ "function JsonData(initial) {\n if(!initial) initial = '';\n this.data = initial;\n this.push = bind(this.push, this);\n }", "fromJSON(json) {\n this.name = json.name;\n this.hand = json.hand;\n this.numCards = json.numCards;\n this.points = json.points;\n }", "loadJSON(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Starts chapter i shows gamearea and hides splash screen
function demarrerChapitre(i) { var chap = getChapter(i); document.getElementById("bcSplashScreen").style.display = "none"; document.getElementById("gamearea").style.display = "block"; chap.after(); splashScreenOn = false; mainloop(); }
[ "function startGame()\n {\n sectionIntro.style.display = \"none\";\n sectionBoard.style.display = \"block\";\n }", "function startGame()\n {\n game.start();\n hideMenu();\n } // startGame", "function gameIntroPage() {\n //front ant gif\n frontAntImage();\n //renders game start but...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create category key/legend at bottom of SVG
function createCategoryKey() { var keyWidth = keyElementWidth * categories.values().length; var categoryKeyScale = d3.scaleBand() .domain(categories.values()) .range([(width - keyWidth) / 2, (width + keyWidth) / 2]); svg.append("g") .a...
[ "function addLegend() {\n\t\tvar catLegend = svg.select(\"g.catLegend\"),\n\t\t\tdogLegend = svg.select(\"g.dogLegend\"),\n\t\t\txStart = 0,\n\t\t\tyStart = 100,\n\t\t\tyOffset = 30,\n\t\t\trectWidth = 80,\n\t\t\ty;\n\n\t\tcatLegend.select(\"g.catIcon\")\n\t\t\t.on(\"click\", function(d) {\n\t\t\t\tzoomFromLegend(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
append products to the DOM
function appendProducts(products) { let htmlTemplate = ""; for (let product of products) { htmlTemplate += ` <article> <div class="card"> <div class="card-image waves-effect waves-block waves-light"> <img class="activator" src="${product.acf.img}"> </div> <div class="card-co...
[ "function appendProduct(product){\n let template = ` \n <span>${product.product.name}</span>\n <span>${product.quantity}</span>\n `\n let $product = $(template);\n\n $product.appendTo($orderProducts);\n}", "function appendProducts(products) { \n document.querySelector(\"#products-cont...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! END DB SETUP ! FUNCTIONS Generates random string of length TOKEN_LENGTH defined in the .env file. This is used for client authentication
function generateToken() { let token = ""; const chars = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890"; for (i=0; i < process.env.TOKEN_LENGTH-1; i++) { token = token + chars[Math.floor(Math.random() * (chars.length-1))]; } return token }
[ "function getToken() { return ( Math.random() + '' ).replace( /\\D/g, '' ); }", "generateToken(length) {\n return (Math.random().toString(36)+'00000000000000000').slice(2, length + 2);\n }", "function getNewToken() {\n return crypto.randomBytes(24).toString('base64');\n}", "function randomUserToken()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AJAX GET alert and current statistics.
function getAlerts() { $.get("/load_charts/get-stats/?threshold="+threshold.toFixed(2), function (data){ var alertJson = JSON.parse(data); updateAlert(alertJson); updateStats(alertJson); }); }
[ "function getStats(){\n ajaxRequest(\"GET\", hrAvgUrl, displayAvg);\n ajaxRequest(\"GET\", hrMaxUrl, displayMax);\n ajaxRequest(\"GET\", hrMedUrl, displayMed);\n ajaxRequest(\"GET\", hrMinUrl, displayMin);\n}", "function getListOfStatistics() {\n\tajax(\"requestType=getListOfStatistics\");\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render localstorage task list
function renderTasks() { // pull and parse localStorage into tasks timeTask = JSON.parse(localStorage.getItem("tasklist")); placeTask = JSON.parse(localStorage.getItem("placement")); // Loop through each task array item for (i = 0; i < timeTask.length; i++) { // append task text to...
[ "function renderSavedTasksList() {\n let storedTasks = JSON.parse(localStorage.getItem('task-details'))\n if (storedTasks !== null) {\n renderTask(storedTasks)\n } else {\n storedTasks = []\n }\n}", "loadTasks() {\n let taskHtml = this.tasks.reduce(\n (html, task, index) => (html...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove an address from the address book
function removeAddress(address) { var addressTable = document.getElementById('address-table'); var rows = addressTable.childNodes; for (var i=2; i < rows.length; ++i) { var row = rows[i]; var addressText = getAddressText(row); if (addressText === address) { row.parentNode.remove...
[ "function removeAddress() {\n\t\tself.address = storageService.get('address', {}, true);\n\t}", "function delete_address_book(aAddrBook) {\n MailServices.ab.deleteAddressBook(aAddrBook.URI);\n}", "function removeAddress(wbID) {\n var self = this;\n\n self.addresses.forEach(function (addr, idx) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
middleware para buscar vendas
function getVendas(req, res, next) { venda.find({}).lean().exec(function (err, docs) { req.vendas = docs next() }) }
[ "function middleware(request, response, next) {}", "middleware() {\n let kepi = this;\n return function(req, res, next) {\n kepi.applyTo(res);\n next();\n }\n }", "middlewares() {\n /* Prepara app para receber requisicoes em formato json */\n this.server.use(express.json());\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load tree data to tag ul: the dom element data: array, the tree node data append: defines if to append data
function loadData(target, ul, data, append, state) { if (!state) state = $.data(target, 'tree'); var opts = state.options; var $ul = $(ul); data = opts.loadFilter.call(target, data, $ul.prev('div.tree-node')[0]); if (!append) { $ul.empty(); } var che...
[ "function loadData(target, ul, data, append){\n\t\tif(!$.data(target, 'tree')){return false;}\n\t\tvar opts = $.data(target, 'tree').options;\n\t\tdata = opts.loadFilter.call(target, data, $(ul).prev('div.tree-node')[0]);\n\t\t\n\t\tif (!append){\n\t\t\t$(ul).empty();\n\t\t}\n\t\t\n\t\tvar uncheckedNodes = [];\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Data for an instantiated NodeType.PureExpression. Attention: Adding fields to this is performance sensitive!
function PureExpressionData() { }
[ "static isPureExpression(ctx) {\n if (ctx.expressionInStructure() === undefined || ctx.expressionInStructure().length != 1) {\n return false;\n }\n return ctx.expressionInStructure(0).text.trim() === ctx.text.trim();\n }", "populateNodesWithEquationData() {\n this._hydrat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function handles submitting all pending transactions, and calls the previous one This function should be run in the background continuously
async function submitPendingTransactions() { // See what transactions in the db are still pending var pendingTransactions = connection.query("SELECT * FROM stellartransactions WHERE state = ?", ["pending"]); if (pendingTransactions.length > 0) { var tx = pendingTransactions.pop(); awai...
[ "function submitPendingTransactions(exchangeAccount) {\n // See what transactions in the db are still pending\n // Update in an atomic transaction\n db.transaction(function () {\n var pendingTransactions = querySQL(\"SELECT * FROM StellarTransactions WHERE state =`pending`\");\n\n while (pend...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter events with a particular speaker
function filterByName(val){ return val.speaker == this; }
[ "function filterEventList() {\n\t\tvar query = this.value,\n\t\t events = $( '.wp15-events-list' ).children( 'li' );\n\t\t speak = _.debounce( wp.a11y.speak, 1000 );\n\n\t\tif ( '' === query ) {\n\t\t\tevents.attr( 'aria-hidden', false );\n\t\t\tspeak( strings.search_cleared );\n\t\t\treturn;\n\t\t}\n\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loading a svg with XMLHttpRequest/Get
function loadSVG() { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { // loading the document with drawsvg chan.call({ method: "loadStringSVG", params: { // string svg contents 'stringSVG' : xmlhttp.responseTex...
[ "function load_svg(id,filename){\n\txhr = new XMLHttpRequest();\n\txhr.open(\"GET\",filename,false);\n\t// Following line is just to be on the safe side;\n\t// not needed if your server delivers SVG with correct MIME type\n\txhr.overrideMimeType(\"image/svg+xml\");\n\txhr.send(\"\");\n\tdocument.getElementById(id)....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
const allEqual = arr => arr.every( v => v === arr[0] );
function allEqual(arr) { if(!arr.length) return true; return arr.reduce(function(a, b) {return (a === b)?a:(!b);}) === arr[0]; }
[ "function allSame(arr) {\n if (!check.array(arr)) {\n return false;\n }\n if (!arr.length) {\n return true;\n }\n var first = arr[0];\n return arr.every(function (item) {\n return item === first;\n });\n }", "function allSame (arr) {\n\t if (!Array.isArray(arr)) {\n\t retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
drag drop function for ie4+ and NS6////
function drag_drop(e){ if (ie4&&dragapproved){ crossobj.style.left=tempx+event.clientX-offsetx crossobj.style.top=tempy+event.clientY-offsety hideShowCovered(); return false } else if (ns6&&dragapproved){ crossobj.style.left=tempx+e.clientX-offsetx+"px" crossobj.style.top=tempy+e.clientY-offsety+"px" h...
[ "function drag_drop(e) {\n if (ie4 && dragapproved) {\n crossobj.style.left = tempx + event.clientX - offsetx\n crossobj.style.top = tempy + event.clientY - offsety\n return false\n }\n else if (ns6 && dragapproved) {\n crossobj.style.left = tempx + e.clientX - offsetx + \"px\"\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper function: parse int to string, and add px helpful for styling
function numToString(i){ var rv = i.toString(); rv += "px"; return rv; }
[ "function makeStylePx(number){\n var tmpNumber = number.toString();\n var tmpEnding = \"px\";\n var tmpString = tmpNumber.concat(tmpEnding);\n return tmpString\n}", "function exports(str) {\n\t return toNum(str.replace('px', ''));\n\t }", "function appendPxIfNumber(value) {\n return typeof va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse the WOV_LOGGER_ASEPCTS/WOV_LA env variables and assign them as aspects.
readEnvAspects() { let aspects = []; if ( process.env.WOV_LOGGER_ASPECTS != null ) { aspects = aspects.concat(process.env.WOV_LOGGER_ASPECTS.split(/\s+/)); } if ( process.env.WOV_LA != null ) { aspects = aspects.concat(process.env.WOV_LA.split(/\s+/)); } for (let i=0; i<aspects.leng...
[ "function appAspects() {\n\n // define our framework run-time stack\n const reducerAspect = createReducerAspect();\n const logicAspect = createLogicAspect();\n const routeAspect = createRouteAspect();\n const aspects = [\n reducerAspect, // redux ... extending: Feature.reducer\n logicAspect,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the Portfolio Detail Navigation
function update_portfolio_navigation( wrap ) { if( !wrap ) { return; } /* lets get the next and previous element */ var prev = $('#ut-portfolio-details-'+wrap).find('.active').prev('.ut-portfolio-detail'), next = $('#ut-portfolio-details-'+wrap).find('.active').next('.ut-portfolio-detail...
[ "function updatePortfolioInfo() {\n\t\t//Append all the content\n\t\tvar content = $(portfolioImages[currentImageIndex]).parent().children(\"aside\").html();\n\t\tportfolioInfo.empty().append(content);\t\n\t\tif(!content) {\n\t\t\tportfolioInfo.css(\"display\", \"none\");\t\t\t\n\t\t}\n\t}", "updateNavDetail(info...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes all the cookies from Mixpanel. This resets the user session info and the super properties that are added to each event. NOTE: The behavior if called in midsession is unknown.
clearSession() { this.withMixpanel(() => { // Clears entire session // This should be called only on LOGOUT and not in mid-session. if (mixpanel.cookie && mixpanel.cookie.clear) { mixpanel.cookie.clear(); this._sessionInitialized = false; ...
[ "function resetCookies() {\n\tTi.Network.createHTTPClient().clearCookies(config.base);\n}", "resetSessionData() {\n cy.clearLocalStorage();\n // we have to clear cookies 2x to really make it work\n cy.clearCookies();\n cy.clearCookies();\n }", "removeAllCookies() {\n this.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
passes comment edit data to dialog
function dialogCommentEditData(obj) { $dest = obj.attr('data-dialog'); $comment_id = obj.attr('data-comment-id'); if (obj.length > 0 && $('#' + $dest).length > 0) { $msg = $.trim( obj.closest('.comment').find('.comment-message').attr('data-comment') ); if ($msg.length > 0) { $('#' + $dest).find('tex...
[ "function commentEditDlgPopup(ident)\r\n{\r\n\t$commentEditDlg.find(\"input\").val($('#ent_'+ident+'_txt').html());\r\n\t$commentEditDlg.data('ident', ident);\r\n\t$commentEditDlg.dialog('open');\r\n}", "function editComment(comment) {\r\n // copy comment information to form\r\n formName.value = comment.nam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Report transfer progress for any upload or download to a given handler. This will also reset the overall transfer counter that can be used for multiple transfers. You can also call the function without a handler to stop reporting to an earlier one.
trackProgress(handler) { this._progressTracker.bytesOverall = 0; this._progressTracker.reportTo(handler); }
[ "trackProgress(handler) {\n this._progressTracker.bytesOverall = 0;\n this._progressTracker.reportTo(handler);\n }", "reportProgress() {\n\t\tif (this._reportProgressHandler) {\n\t\t\tclearTimeout(this._reportProgressHandler);\n\t\t\tthis._reportProgressHandler = false;\n\t\t}\n\t\tImporterWebs...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functions// Change Booleans to false
function changeBooleansToFalse() { demo = false; isLegalMovement = false; isBlackToolInsideJump = false; isWhiteToolInsideJump = false; isForcedJump = false; isToolTaken = false; isExtraForcedJump = false; }
[ "function isFalse(boolean) {\n\n}", "SetBool() {}", "function booleans(){\n return true;\n }", "function False () {\n}", "function convertBooleansOnAttrs(attrs) {\n return (0, _mapValues2.default)(attrs, function (val) {\n if (val === 'true') {\n return true;\n }\n if (val === 'fals...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
section format retrieval ends. Paragraph format retrieval implementation starts. Retrieve selection paragraph format
retrieveParagraphFormat(start, end) { this.getParagraphFormatForSelection(start.paragraph, this, start, end); }
[ "retrieveSectionFormat(start, end) {\n let startParaSection = this.getContainerWidget(start.paragraph);\n let endParaSection = this.getContainerWidget(end.paragraph);\n if (!isNullOrUndefined(startParaSection)) {\n this.sectionFormat.copyFormat(startParaSection.sectionFormat);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is used to launch State Sequencer Application
function LaunchStateSeq() { if(TestedApps.OMSeq.Run()) { Log.Message("Launched State Sequencer Application") if(Btn_Start_Continue.Exists) { Log.Message("State Sequencer launched successfully.") return true } else { Log.Message("Start button on State Sequencer doesn't exist...
[ "start()\n\t{\n\n\t\t// Initialize the application\n\t\tapplication.initialize();\n\n\t}", "function launch() {}", "handle_start_application() {\n // Show interface elements\n this.view.get(EL.text_title).show();\n this.view.get(EL.button_start).show();\n this.view.get(EL.text_questi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: prepare sql batch limited by content size, reading: show variables like 'max_allowed_packet';
function next() { if (pointer >= amount) return callback(false, bulk); var amountParams = bulk[pointer].params.length; bulk[pointer].batches = new Array(); var i, j; for (i = 0, j = bulk[pointer].params.length; i < j; i += limitOfBatch) { bulk[pointer].batches.push(bulk[pointer].para...
[ "async function executeSqlInBatches(conn, sql) {\n let batches = sql.split(SQL_BATCH_DELIMITER);\n\n // We loop instead of forEach due to async/await issue w/ forEach callback\n for (let i = 0; i < batches.length; i++) {\n let nonEmptyBatch = !!batches[i].trim();\n if (nonEmptyBatch) await conn.executeNow(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }