query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Delete the rows specified by this query, and return a list of return values if this query has any. Applies relational and other side effects on loaded models when used outside library scope. The parameters are reserved for internal use.
async delete(_applySideEffects=true) { // Comprehend and validate this querys essence. let {conditions, returns} = this._validatedEssence( 'conditions', 'returns' ); // Retrieve the primary key identity in the host schema, which is // manually specified for return...
[ "del() {\n var deferred = q.defer();\n if(!this[this.primaryKey]) {\n deferred.reject(this.modelName + \" has no primary key value. Cannot delete.\");\n } else {\n var strSql = \"DELETE FROM \" + this.tableName + \" WHERE [\" + this.primaryKey + \"] = @...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Activa el control para arrastrar los puntos de una ruta para editarlos de forma manual
function permitirArrastrarPuntosRutas(){ //--Add a drag feature control to move features around. dragPuntosRuta = new OpenLayers.Control.DragFeature(lienzoRutas, { // onStart: iniciarArrastre, onDrag : arrastrar, onComplete : finalizarArrastre }); map.addControl(drag...
[ "function cargarCgg_ger_indicador_tipoCtrls(){\nif(inRecordCgg_ger_indicador_tipo){\ntxtCggit_codigo.setValue(inRecordCgg_ger_indicador_tipo.get('CGGIT_CODIGO'));\ntxtCggit_descripcion.setValue(inRecordCgg_ger_indicador_tipo.get('CGGIT_DESCRIPCION'));\nisEdit = true;\nhabilitarCgg_ger_indicador_tipoCtrls(true);\n}}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the placemarks table
function createPlacemarksTable(callback) { pool.query( ` CREATE TABLE IF NOT EXISTS placemarks( placemark_id SERIAL PRIMARY KEY, created_at BIGINT NOT NULL, vin VARCHAR(155) NOT NULL, UNIQUE(vin, created_at) ) `, function(err, res) { if (err) console.log("error creating placemar...
[ "function createMarkTable() {\n console.log(index);\n console.log(marked_board[index]);\n var td_table=document.createElement('table');\n var td_bdy=document.createElement('tbody');\n\n for (var i = 0; i < 3; ++i)//rows\n {\n var row=document.createElement('tr');...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to generate the radial chart of threshold
function generateRadialChart(numTotal, numthresholdIn, numthresholdOut) { if (window.radialChart != undefined) { window.radialChart.destroy(); } var percIn = ((numthresholdIn / numTotal) * 100).toFixed(2); var percOut = ((numthresholdOut / numTotal) * 100).toFixed(2); ...
[ "calculateRadiusLegendValues() {\n const vis = this;\n\n let min = vis.minCount;\n let max = vis.maxCount;\n const range = max - min;\n const radiusLegendValues = [];\n\n // default numOfCircles for legend\n const numOfCircles = 4;\n\n // range === 0\n min = vis.roundToNearestTens(min);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a date string from the date in the given fact (if any), or return 'undefined' otherwise.
function getFactDate(fact) { if (fact && fact.date && fact.date.original) { return fact.date.original; } return undefined; }
[ "function createDateStr(date)\n{\n\tif (date == null) { return \"No or improper date provided\"; }\n\t\n\tvar day;\n\tswitch (date.getDay())\n\t{\n\t\tcase 0: day = getLocalizedString(\"Sunday\"); break;\n\t\tcase 1: day = getLocalizedString(\"Monday\"); break;\n\t\tcase 2: day = getLocalizedString(\"Tuesday\"); br...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
0 / 3. String Check. Create a function that takes a string and a word, and then returns true or false depending on whether the word starts with the initial string.
function isStrInWord(string, word) { if (word.startsWith(string) == true) { console.log(true); } else { console.log(false); } }
[ "function isStrInWord(initial_string, word) {\n if (word.includes(initial_string)) {\n return true;\n }\n else{\n return false;\n }\n}", "function isStrInWord(str1, word1) {\n let sliceWord1 = word1.substr(0, str1.length)\n if (str1 === sliceWord1) {\n console.log(\"Does \" + word1 + \" sta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets colour for the selected section
function setSelectedSection(selected) { document.getElementById(currentSelected).style.backgroundColor = ''; document.getElementById(selected).style.backgroundColor = '#B6F5E0'; currentSelected = selected; }
[ "set selectionColor(value) {}", "function pickColor() {\n color = this.id;\n doc.querySelector('.selected').classList.remove('selected');\n this.classList.add('selected');\n }", "function updateSelectedColor(newColor) {\n selectedColor = newColor;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler for the statfs() FUSE hook. cb: a callback of the form cb(err, stat), where err is the Posix return code and stat is the result in the form of a statvfs structure (when err === 0)
function statfs(cb) { cb(0, { bsize: 1000000, frsize: 1000000, blocks: 1000000, bfree: 1000000, bavail: 1000000, files: 1000000, ffree: 1000000, favail: 1000000, fsid: 1000000, flag: 1000000, namemax: 1000000 }); }
[ "fstat(fd, cb = nopCb) {\n const newCb = wrapCb(cb, 2);\n try {\n const file = this.fd2file(fd);\n file.stat(newCb);\n }\n catch (e) {\n newCb(e);\n }\n }", "stat(path, callback) {\n // Make sure the ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Orderna por pontos e saldo
function ordernarPorPontoSaldo(a, b){ if (a.totalPontos > b.totalPontos){ return -1; }; if (a.totalPontos === b.totalPontos){ if(a.saldoFinal > b.saldoFinal){ return -1; } } }
[ "get saldo() {\n\t\treturn this.ingreso - this.deuda\n\t}", "adicionaPonto(){\n //Verificando qual a ultima operação\n let ultimaOperacao = this.getUltimaOperacao();\n\n //Verificando se a operação ja existe e se é um string e se dentro dessa string tem um ponto\n // Se tiver ponto faz...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build out the numStrings function below, using a loop that counts all of the strings in the array parameter called list. Remember to return the amount of strings found before the function exits.
function numStrings(list) { var count = 0; for (var i = 0; i < list.length; i++){ if( typeof list[i] == "string" ){ count++; } } return count; }
[ "function numStrings(list) {\n var count = 0\n for (var i = 0; i < list.length; i++) {\n if (typeof(list[i]) == \"string\") {\n count++;\n return;\n }\n }\n return count;\n }", "function numStrings(list) {\n var count = 0;\n for(var i = 0; i < list.length; i++){\n if(typeof list[i] === \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Minimize Search Tickets Container
function minSearchTickets() { if (!minimizeSearchTickets) { $('.minimize-search-tickets').hide(); $('#search-tickets-svg').removeClass('fa-minus-circle'); $('#search-tickets-svg').addClass('fa-plus-circle'); minimizeSearchTickets = true; } else { ...
[ "function minRecentTickets() {\n if (!minimizeRecentTickets) {\n $('.minimize-recent-tickets').hide();\n $('#recent-tickets-svg').removeClass('fa-minus-circle');\n $('#recent-tickets-svg').addClass('fa-plus-circle');\n minimizeRecentTickets = true;\n } else ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wraps beforeSend, which is a custom property on the jQuery ajax data call.
function beforeSendMethod(jqXHR, settings) { /*jshint validthis:true */ this.fire(dataEvents['beforeSend'], jqXHR, settings); }
[ "function beforeSend() {\n}", "function ajaxBeforeSend(xhr, settings) {\n\t var context = settings.context;\n\t if (settings.beforeSend.call(context, xhr, settings) === false || triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false) return false;\n\t\n\t triggerGlobal(settings, co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function will retrieve the Tasks and role of each person
function getTasks() { console.log("Called: getTasks "); let result = []; let tempTasks = []; let value = this.state.compareRole.toLowerCase(); result = this.state.roles.filter(function (data) { // return data.role.includes(value) !== -1; // return data._id.includes("60fdefe4d7bc2a0eb3c...
[ "function retrieveSpecificAccountTasks(accountID){\n\t\t// an interaction is an initiative or task or other version of the same thing\n\t\t\n\n\t\tvar allQuery = '<fetch version=\"1.0\" output-format=\"xml-platform\" mapping=\"logical\" distinct=\"false\">'+\n\t\t\t\t\t '<entity name=\"task\">'+\n\t\t\t\t\t\t'<att...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses package list output
function parsePackageOutput(stdout) { const lines = stdout.split('\n'); const packages = []; let lastPackage; lines.forEach((l) => { if ( l.substr(0, 1) === ' ' ) { if ( lastPackage ) { lastPackage.description += ' ' + l.trim().replace(/\s+/g, ' '); } } else { if ( l.length > ...
[ "function parseListFromPkgOutput({\n\texports: {\n\t\tname,\n\t\tversion,\n\t\tdependencies,\n\t\tdevDependencies\n\t}\n}) {\n\tif (!name && !version) return; // Not a npm package if having neither name nor version\n\n\tlet list = [];\n\n\t(function printTitle() {\n\t\tif (version) {\n\t\t\tconsole.log(chalk.blueBr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Default publication method for entities. It publishes the entire collection and just the inventory associated to an owner.
publish() { if (Meteor.isServer) { // get the InventoryCollection instance. const instance = this; /** This subscription publishes only the documents associated with the logged in user */ Meteor.publish(inventoryPublications.inventory, function publish() { if (this.userId) { ...
[ "publish() {\n if (Meteor.isServer) {\n // get the InventoryCollection instance.\n const instance = this;\n /** This subscription publishes only the documents associated with the logged in user */\n Meteor.publish(inventoryPublications.inventory, function publish() {\n if (this.userId)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send message on the socket and register a test function to get result Test function should return true on a valid response
function sendMessage(message, testFunc, resolve) { if (testFunc) { listeners.push(function (data) { var result = !!testFunc(data); if (result) { if (data.hasOwnProperty('param')) { resolve(data.param); } else if (da...
[ "function sendTest5() {\n var sock = new net.Socket();\n sock.on('data', function(data) {\n str = data.toString();\n if (data.toString() === (\"HTTP/1.1 500 Internal Server Error\\r\\nDate: now\\r\\n\" +\n \"Content-Length: 3\\r\\n\\r\\nabc\")) {\n console.log('sendTest5\\t\\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function should updates the `semester` variable.
function updateSemester(clicked) { // code goes here semester = clicked.innerHTML }
[ "function updateSemester() {\n $(\"#semester\")\n .text(\"Year \" + sem.acadYear + \" SEM\" + sem.semester);\n }", "setSemester(aSemester) {\n this.semester = aSemester;\n }", "function updateSemester(semesterId, semester) {\n delete semester._id;\n return Semester\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
success of tweeters to explore
function getSuccessTweeters(data) { AlltweetersFromApi = AlltweetersFromApi.concat(data); chkIfFinished = chkFinishExplore(TweetersToExplore, AlltweetersFromApi) //we need to check if we finished to find all the tweeters we needed to explore if (chkIfFinished) // finished to find all tweeters { ...
[ "function tweetSearch (){\nT.get('search/tweets', { \n q: '#trumpregrets', count: 1 }, \n function(err, data, response) {\n var tweets = data.statuses;\n for (var i = 0; i < tweets.length; i++){\n //console.log(tweets[i].hashtags);\n\n\n T.post('statuses/update', {status:tweets[i].text},\n functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that delete all the calendar event that is created by this spreadsheet. Basically this is a hard refrest type of thing. If anything goes wrong, clear all, then resycn it with the canlendar.
function clearAll() { // Show prompt to user indicating that this will clear everything, and ask them to confirm on continue. let ui = SpreadsheetApp.getUi(); let response = ui.alert('WARNING! IRREVERSIBLE ACTION! \nThis will delete all the auto generated event and clear the EventID columns content in all define...
[ "function deleteCalendars() {\n var calendars = CalendarApp.getCalendarsByName(\"icu timetable\");\n for(var i=0;i< calendars.length;i++){\n calendars[i].deleteCalendar();\n }\n}", "function clean() {\n calendar.empty();\n }", "function deleteAllEventsAddedByScript() {\n let existingEvents = getA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
exported EquationDisplay / global explorableGroup TODO: REVIEW IF ANCHOR HORIZONTAL AND ANCHOR VERTICAL ARE ACTUALLY USED HERE
function EquationDisplay(options) { let anchorHorizontal, anchorVertical, coordinates, display, where; display = this; init(options); return display; /* INITIALIZE */ function init(options) { _required(options); _defaults(options); display.group = addGroup(); display.inn...
[ "function EquationDisplayTerm(options) {\n let color,\n fontFamily,\n fontSize,\n fontWeight,\n displayTerm,\n string,\n where;\n\n displayTerm = this;\n\n init(options);\n\n return displayTerm;\n\n /* INITIALIZE */\n function init(options) {\n\n _required(options);\n _defaults(options...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a seed value, unfold calls the unspool function, waits for the returned promise to be resolved, and then calls it again if a next seed value was returned. All the values of all promise results are collected into the resulting promise which is resolved as soon the last generated element value is resolved.
function unfold(unspool, seed) { var d = defer(); var elements = new Array(); unfoldCore(elements, d, unspool, seed); return d.promise(); }
[ "function unfold(unspool, seed) {\n var d = defer();\n var elements = new Array();\n unfoldCore(elements, d, unspool, seed);\n return d.promise();\n }", "function unfold_(a, f) {\n return new Schedule(now => T.succeedWith(() => Decision.makeContinue(a, now, unfoldLoop(f(a), f))));\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an alphabetical array of dictionary entries and a word to search for, find that word's definition (if it exists). A dictionary entry is just a string where the word's name appears first, followed by [definition]. const dictionary = [ 'a Used when mentioning someone or something for the first time in a text or con...
function dictionaryWordFinder(word, dictionary) { let start = 0; let end = dictionary.length - 1; let mid; while (start <= end) { mid = Math.floor(end - start / 2); if(dictionary[mid].startsWith(word + " - ")) return dictionary[mid].slice(word.length + 3); if (word < dictionary[...
[ "function lookItUp(searchWord){\n // provided the searchWord, I want this function to return the definition\n // from the dictionary object\n console.log(dictionary[searchWord])\n}", "find_entry(word) {\n for (let i=this.dictionary.length - 1; i >= 0; i--) {\n let entry = this.dictionar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MORE HELPER FUNCTIONS // Fetch highlights on page load
function getHighlights(url) { $.get(baseUrl + "/tags/highlights", { "url": url, }).done(function(res) { if (res.success) { for (var h in res.highlights) { var hl = decodeURIComponent(h); var hl_id = res.highlights[h].id; var max_tag = res.highlights[h].max_tag; var is_...
[ "function CustomHighlight() {}", "function highlighter() {\n $('.highlight').removeClass('highlight');\n\n if (!window.location.hash)\n return;\n\n if (window.location.hash.indexOf('#hl-') == 0) {\n var id = window.location.hash.slice('hl-'.length + 1);\n\n $(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return whether we're in expanded (wide) character mode.
isExpandedCharacters() { return this.expanded; }
[ "_expandModeIs(modesArray) {\n const that = this;\n\n return modesArray.indexOf(that.expandMode) > -1;\n }", "isTruncating() {\n return this.flagStr.indexOf('w') !== -1;\n }", "function isExtendingChar(code) {\r\n return code >= 768 && (code >= 0xdc00 && code < 0xe000 || extend...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Withdraw tokens from the pool
async withdrawAllTokenTypes(userAccountA, userAccountB, poolAccount, userTransferAuthority, poolTokenAmount, minimumTokenA, minimumTokenB) { return await (0, send_and_confirm_transaction_1.sendAndConfirmTransaction)('withdraw', this.connection, new web3_js_1.Transaction().add(TokenSwap.withdrawAllTokenTypesInst...
[ "spend_tokens(count) {\n this.tokens_held-=count;\n }", "withdraw(event) {\n if (event) event.preventDefault();\n // withdraw tokens\n let amount = this.props.objects.web3.utils.toWei(this.withdrawValue.value, \"ether\");\n return this.props.objects.Voting.withdrawTokens(String(amount), {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parse embed data, used if you insert JSON data directly instead of point it via "src" attribute
parseEmbedSource() { if (!this.getAttribute('src')) { try { this.data = JSON.parse(this.innerHTML); } catch (err) { this.data = []; // no value } this.render(); } }
[ "function embedData(embedinfo) /* (embedinfo : embedinfo) -> string */ {\n return embedinfo.embedData;\n}", "normalizeMetadata(data) {\n if (typeof data === 'string') {\n return data.replaceAll(/https?:\\/\\//g,'https://');\n } else if (Array.isArray(data)) {\n let result = [];\n for (let ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the value of a specific key based on its name If the key is a node, then it returns a subset If multiple keys with same name, the first value found is returned If not found, then "ERROR: NOT FOUND" is returned
function getValueByName(mds, name) { var value = "ERROR: NOT FOUND"; for (var item in mds) { // check if the key equals to the search term if (item === name ) { return mds[item]; } // check if the key points to an object if (typeof (mds[item]) === "object") { // if value is an objec...
[ "function getValueByName(dataset, name) {\n var value = \"ERROR: NOT FOUND\";\n for (var item in dataset) {\n // check if the key equals to the search term\n if (item === name ) { return dataset[item]; }\n // check if the key points to an object\n if (typeof (dataset[item]) === \"object\") {\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
log in as a random participant
function logInAsRandomParticipant(participantList) { var participant = getRandomElementFrom(participantList); // we are well aware that this is a global variable (as we are logged in and want to use it elsewhere) console.log(participantUUID); participantUUID = participant.id; console.log("Login rea...
[ "function login() {\n\n // User has not compeleted the tutorial\n if (!eCon.local.firstRun) {\n eCon.Container.pagecontainer('change', 'help.html');\n return;\n }\n\n /**\n * Variable tracking whether the user needs to log in\n * @type {boolean}\n */\n var login = true;\n\n\n if (eCon.local.ID) { ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback for the pointerup event for the ghost anchor.
onGhostPointerUp(e) { this.ghostAnchor.node.releasePointerCapture(e.pointerId); this.onChange(this, this.regionData.copy(), IRegionCallbacks_1.ChangeEventType.MOVEEND); }
[ "function onPointerUp () {\n pointerDownTarget = 0\n }", "function onPointerUp () {\n console.log('up')\n pointerDownTarget = 0\n}", "function onPointerUp() {\n if (pointerActive) {\n pointerActive = false;\n }\n }", "function onPointerUp () {\nconsole.log('up')\npointerDownTarget = 0\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide all buttons in range
hideButtons() { this.visible = false; for (const button of this.buttonsAsArray) { button.hideButton(); } }
[ "static hideAll() {\n super._hideButtons('choiceButtons');\n }", "static hideAll() {\n super._hideButtons('homeButtons');\n }", "hideAll() {}", "function hideAllButtons()\n\t{\n\t\tfor(var j=0; j < buttons.length; j++)\n\t\t\tbuttons[j].classList.add(\"no-display\");\n\t}", "function hideButtons(){\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enable or disable the save command(s) (and related elements)
function enableSave( enable ) { if( enable ) { document.getElementById('cmd_ple_save').removeAttribute('disabled'); document.getElementById('cmd_ple_saveAs').removeAttribute('disabled'); } else { document.getElementById('cmd_ple_save').setAttribute('disabled','true'); document.getElementById('cmd_ple_saveA...
[ "function enable_save() {\n save_button.prop('disabled', false)\n }", "function enableSaveButton() {\n $('#save-changes').attr('disabled', false);\n }", "function enableSave() {\n self.saveBtn.attr(\"disabled\", function() {\n return self.filters.length < 1;\n });\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders empty background into inner element and removes itself from render queue. note: this method should not be called but invoked through renderQueue
destroyInner() { this.revealInner.style.background = '' renderQueue.delete(this.destroyInner) }
[ "rerender() {\n this.rendered.removeChildren();\n this.rendered.addChild(this.buildGraphics());\n }", "function cleanPaint(){\n\t\t//isElementDown = true;\n\t\tcontainerPaint.removeAllChildren();\n\t}", "clearBackground() {\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
translate object in horizontal direction a TRUE direction will translate the object in a positive direction along the window X axis a FALSE direction will translate the object in a negative direction along the window X axis
function horizontal(direction){ // a and d key // console.log(String.fromCharCode(key)); if(index != vCount) return; var thetaRadian = toRadians( theta ); // making adjustment for the rotation. var tX = Math.cos(thetaRadian) * displacementX[0]; // x component of transfromation var t...
[ "horizontalTranslate (horizontalOffset) {\n \n // as the player moves through the world, the player's x value will keep an absolute frame of reference,\n // but the dom element must stay centered, so it will be translated. Subracting the h offset makes it\n // so that your character appe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply group reporting filter, e.g. group_id=n?implicit=f in URL.
function applyGroupFilter(data) { if (indiciaData.filter_group_id) { if (typeof indiciaData.filter_group_implicit === 'undefined') { // Apply default, strictest mode. indiciaData.filter_group_implicit = false; } // Proxy will be responsible for filter setup. data.group_filter...
[ "function doElementGroupFiltering(id)\n{\t\n\tvar idSplit = id.split(\"_\");\n\tvar param = \"filterType=elementGroupFilter&type=\" + idSplit[1] + \"&view=listView&pdct=GEN\";\n\tdoAjax(\"FilterController\", param, ActivityFilterCallback, \"\", \"json\");\n}", "function filterGroup() {\n var sel = document.getE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scroll the thumbnail onscreen in the search view if the search isn't currently visible.
scrollSearchToThumbnail() { if(this.isAnimating || !this.parent.active || this.dragger.position < 1) return; ppixiv.app.scrollSearchToMediaId(this.parent.dataSource, this.parent._wantedMediaId); }
[ "search() {\n super.search({view : this.viewStyle})\n .then((response) => {\n this.thumbnailContext = this.thumbnailContextBuilder.generateThumbnailContext(response.documents);\n this.updateSelections();\n if(!this.searchModel.selectionQuery) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
enforest the tokens, returns an object with the `result` TermTree and the uninterpreted `rest` of the syntax
function enforest(toks, context, prevStx, prevTerms) { assert(toks.length > 0, 'enforest assumes there are tokens to work with'); prevStx = prevStx || []; prevTerms = prevTerms || []; if (expandCount >= maxExpands) { return { result: null, rest...
[ "function enforest(toks, env) {\n var env = env || new Map();\n\n parser.assert(toks.length > 0, \"enforest assumes there are tokens to work with\");\n\n function step(head, rest) {\n if(head.hasPrototype(TermTree)) {\n\n // // function call\n // if(this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepend an element before another
function prepend(elem,prev){var parent=elem.parent;if(parent){var childs=parent.children;childs.splice(childs.lastIndexOf(elem),0,prev);}if(elem.prev){elem.prev.next=prev;}prev.parent=parent;prev.prev=elem.prev;prev.next=elem;elem.prev=prev;}
[ "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 // insert child node before the next node:\n for(var i = 0; i < parent.content.length; i++)\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`_makeFlat` is a helper function that returns a onelevel or fully recursive function based on the flag passed in.
function _makeFlat(recursive) { return function flatt(list) { var value, result = [], idx = -1, j, ilen = list.length, jlen; while (++idx < ilen) { if (isArrayLike(list[idx])) { value = (recursive) ? flatt(list[idx]) : list[idx]; j ...
[ "function _makeFlat(recursive) {\n\t return function flatt(list) {\n\t var value, jlen, j;\n\t var result = [];\n\t var idx = 0;\n\t var ilen = list.length;\n\n\t while (idx < ilen) {\n\t if (_isArrayLike(list[idx])) {\n\t value = recursive ? flatt(list[idx]) : list[idx];\n\t j = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
routerDir ('webapp', '/web') prefix[optional]
routerDir (dir, prefix) { var self = this this.routerPath = resolve(this.opts.root ? this.opts.root : this.root, dir) if (fs.existsSync(this.routerPath) === false) { if (this.opts.debug === true) console.log('router path is not exists: ' + this.routerPath) return } return Promise.resol...
[ "function setUpRoutes (__dirname) {\n fs.readdirSync(__dirname).forEach(fileName => {\n if (fs.lstatSync(__dirname + '/' + fileName).isDirectory()) {\n // Recurse if current file is a folder\n setUpRoutes(__dirname + '/' + fileName)\n } else {\n // Get file name. Fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a vertex normal between two line segments that share a common point (c) arguments: p line 0 start point c common point (line 0 end / line 1 start) n line 1 end point returns: normalized vec2
function vertexNormal (p, c, n) { var e1 = c.subtract(p, true).normalize() var e2 = c.subtract(n, true).normalize() var d = e1.add(e2, true) if (e1.perpDot(e2) > 0) { d.negate() } return d.normalize() }
[ "function getLineNormal(a, b) {\n var u = normalize(a[0] - b[0], a[1] - b[1]);\n return [-u[1], u[0]];\n}", "function getLineNormal (a, b) {\n const u = normalize(a[0] - b[0], a[1] - b[1]);\n return [-u[1], u[0]];\n}", "function lineToNormal(a, b) {\n return new V2(b.y - a.y, a.x - b.x).normalize();\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references to various AnimationCurveNodes and is referenced by an AnimationStack node note: theoretically a stack can multiple layers, however in practice there always seems to be one per stack
function parseAnimationLayers( FBXTree, connections, curveNodesMap ) { var rawLayers = FBXTree.Objects.AnimationLayer; var layersMap = new Map(); for ( var nodeID in rawLayers ) { var layerCurveNodes = []; var connection = conn...
[ "parseAnimationLayers( curveNodesMap ) {\n\n\t\tconst rawLayers = fbxTree.Objects.AnimationLayer;\n\n\t\tconst layersMap = new Map();\n\n\t\tfor ( const nodeID in rawLayers ) {\n\n\t\t\tconst layerCurveNodes = [];\n\n\t\t\tconst connection = connections.get( parseInt( nodeID ) );\n\n\t\t\tif ( connection !== undefi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check for webShare support and add click handler or remove button as approriate.
constructor() { var $this = this; if(!jQuery(".webshare-list-item").length) { return; } $(document).ready(function() { if (navigator.share) { $this.addWebShareButtonClickHandler(); $this.removeSocialSharebuttons(); ...
[ "function setupShareButtons() {\n $( \"#CopyShareEmbed\" ).click(() => {\n $( \"#shareEmbed\" ).select();\n document.execCommand(\"copy\");\n });\n\n $( \"#CopyShareURL\" ).click(() => {\n $( \"#shareURL\" ).select();\n document.execCommand(\"copy\");\n });\n\n $...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
In the player on Tizen.
set TizenPlayer(value) {}
[ "get TizenPlayer() {}", "turnOn(cb) {\n this.log(\"Turning on the TV...\");\n var browser = require(\"airplay\").createBrowser();\n browser.on(\"deviceOnline\", (device) => {\n device.play(\"http://foo/bar\", 0, () => {\n device.close();\n browser.stop();\n\n // Wait 14 secs f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the visual state of the active element
updateActiveElement() { if (!this.activeElement) { return; } this.activeElement.classList.add(A11yClassNames.ACTIVE); }
[ "updateActiveElement() {\n let itemSelected;\n this.tabLinks.forEach((item, index) => {\n item.classList.contains('active') ? ((itemSelected = item), (this.currentItemIndex = index)) : '';\n });\n\n itemSelected ? '' : ((itemSelected = this.tabLinks.item(0)), (this.currentItemIndex = 0));...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether the voice connection is authenticated.
checkAuthenticated() { const { token, endpoint, sessionID } = this.authentication; if (token && endpoint && sessionID) { this.client.clearTimeout(this.connectTimeout); this.status = Constants.VoiceStatus.CONNECTING; /** * Emitted when we successfully initiate a voice connection. ...
[ "checkAuthenticated() {\n const { token, endpoint, sessionID } = this.authentication;\n\n if (token && endpoint && sessionID) {\n clearTimeout(this.connectTimeout);\n this.status = Constants.VoiceStatus.CONNECTING;\n /**\n * Emitted when we successfully initiate a voice connection.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Each lobby sec, BROADCAST 'lobby_timer_update' w/ secs remaining to nonempty rooms.
function lobbyTick(context) { for (var room = MIN_ROOM_NUM; room < MIN_ROOM_NUM+NUM_ROOMS; room++) { if (roomCount[room]) { app.io.room('' + room).broadcast('lobby_timer_update', secsRemaining); if (currentTimerInterval != TimerEnum.NORMAL_TIMER_INTERVAL) ...
[ "function startLobbyCountdown(){\n lobbyTimeLeft = 10; //Time given for reviewing end of game table\n\n //Start the timer\n timer = setInterval(function(){\n lobbyTimeLeft--;\n $(\"#lobbytimer\").text(lobbyTimeLeft);\n if(lobbyTimeLeft <= 0)loadLobby();\n }, 1000);\n}", "function firstLobbyTick(conte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a Duration representing an amount of hours
static hours(amount) { return new Duration(amount, TimeUnit.Hours); }
[ "static hours(d) {\n return new Duration(d, HOURS);\n }", "toHours() {\n return HOURS.convert(this.duration, this.unit);\n }", "timeInDays(hours){\r\n hours*=Hr\r\n return hours/Day\r\n }", "addHour() {\n this.state.duration += 60;\n }", "function Duration(time...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Groups all tabs with URLs matching a pattern into the same window
async function groupTabs(urlPattern, windowId) { console.log("groupTabs: " + urlPattern); //check if we already have a window for this pattern await getTabWindow(urlPattern, windowId, async function(tabWindow){ console.log("groupTabs: tabWindow: " + JSON.stringify(tabWindow)); const urlsToGroup = await g...
[ "function grouper(windowInfo) {\n\n // if no open tabs\n if (windowInfo.tabs.length == 0) {\n // handle error\n onError('No active tabs...nothing for me to do');\n }\n\n // sort tabs by url & recursively move all tabs to front in sorted order\n browser.tabs.move([...windowInfo.tabs].sor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functiongenerate steps input > questions form backend output > Arrey of steps
function generateSteps(questions) { let questionsNumber = questions.length; let steps = []; if (questionsNumber > 0) { $.each(questions, function (i) { stepsfill = {}; steps.push(stepsfill); }); } else { console.log("The...
[ "function ask_questions(step) {\r\n //assigns question var to specific step question\r\n var question = questions[step];\r\n //if there is a valid question\r\n if (question) {\r\n //if there is some text in the question\r\n if (question.text) {\r\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Global reducer for reducereducers.
get globalReducer() { return null; }
[ "static get Reducer() {\n return Reducer;\n }", "function coreReducer() {\n return combineReducers({\n user: UserReducer,\n menu: MenuReducer,\n topProgress: TopProgressReducer,\n statusBar: StatusBarReducer\n // Export new reducer here\n\n // End export\n });\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Here, we are not passing args to resolve as we are not querying conditionally, we return whole books structure
resolve(parentvalue, args){ return books }
[ "resolve(parent, args) {\n // console.log(parent)\n //parent is the initial author\n // return _.find(authors, { id: parent.authorId });\n\n //whenever user make a query for the books,then they can also request the author\n return Author.fi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `ExcludedRuleProperty`
function CfnWebACL_ExcludedRulePropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ...
[ "function checkSameProps(properties, qParams, model) {\n var result = INCLUDE;\n\n _.each(properties, function(property) {\n if (_.has(qParams, property) && qParams[property] !== model.get(property)) {\n result = EXCLUDE;\n }\n });\n\n return result;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
speichert alles im Localstorage indem Funktion die Methode toJSON vom Object itemList der Klasse ItemList aufruft
function storeItems() { //#app.js store.setItem('items', itemList.toJSON()) }
[ "function putItemsInStorage (){\n let stringifiedArray = JSON.stringify(Item.allItems);\n localStorage.setItem('item', stringifiedArray);\n}", "saveListToLocal() {\n localStorage.setItem('list', JSON.stringify(this.list));\n }", "static getItemList() {\n let itemList;\n if (localStorage.getIte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper Function: populate the food result table with obtained foods
function fillResultTable() { $("#result-table").DataTable().clear().draw(); for(let i = 0; i < foods_onlineData.length; i++){ var food_array = foods_onlineData[i]; var name = food_array["food_name"]; var serving_size = food_array["serving_weight_grams"].toString(); var calo...
[ "function populateTable() {\n \n // Clear any current data\n clearTable()\n\n // Loop through data and populate table rows\n tableData.forEach((ufoSighting) => {\n var row = tbody.append(\"tr\");\n Object.entries(ufoSighting).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get items from data
getItemsFromData(data) { let items = false; if (typeof data.items !== 'undefined' && _.isArray(data.items)) { items = data.items; } return items; }
[ "getItemData(item) {\n\t\t\n\t\tlet data = this.state.data;\n\t\tlet results = [];\n\n\t\tfor (var i = 0; i < data.length; i++) {\n\n\t\t\tif (data[i].name == item) {\n\t\t\t\tresults.push(data[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn results;\n\n\t}", "function getItems(){\n return items\n }", "function getItems...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dado un album y un nombre de track busca este en el album, de encontrarlo lo elimina del album y lo retorna.
deleteTrackFromAlbum(album, trackName){ let track = this.returnIfExists(album.tracks.find((t)=>t.name===trackName), "track " + trackName); album.tracks.splice(album.tracks.indexOf(track), 1); return track; }
[ "deleteAlbum(artistName, albumName){\n let artistWithAlbum = this.getArtistByName(artistName);\n let albumToDelete = this.getAlbumInArtist(artistWithAlbum, albumName);\n let tracksFromAlbumToDelete = albumToDelete.tracks;\n tracksFromAlbumToDelete.forEach((t)=> this.deleteTrackFromPlaylists(t));\n al...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to fetch quizes of the user
async function fetchUsersQuizes() { const loggedUserId = await AsyncStorage.getItem('loggedUserId'); if (loggedUserId) { console.log("user is",loggedUserId); const quizesDbRef = firebase.app().database().ref('assignmentquizes/'); quizesDbRef .on('value', ...
[ "async function fetchUsersQuizes() {\n const loggedUserId = await AsyncStorage.getItem(\"loggedUserId\");\n if (loggedUserId) {\n const quizesDbRef = firebase.app().database().ref(\"quizes/\");\n quizesDbRef\n .once(\"value\")\n .then((resp) => {\n const quizes = resp.val();\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decrease the "number of users in room" indicator label for a room
function decreaseRoomCount(roomId) { var room = $('#room-' + roomId); var numUsers = parseInt(room.attr('data-users'), 10); numUsers--; room.attr('data-users', numUsers); room.html(room.attr('data-name') + ' (' + numUsers + ')'); }
[ "function decreaseRoomCount(roomId) {\n var room = $('#room-'+roomId);\n var numUsers = parseInt(room.attr('data-users'), 10);\n numUsers--;\n room.attr('data-users', numUsers);\n room.html(room.attr('data-name')+' ('+numUsers+')');\n}", "function changeUserCounter(userCount) {\n document.getElementById('ro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When this component mounts, grab the player with the _id of this.props.match.params.id e.g. localhost:3000/players/599dcb67f0f16317844583fc
componentDidMount() { API.getplayer(this.props.match.params.id) .then(res => this.setState({ player: res.data })) .catch(err => console.log(err)); }
[ "componentDidMount() {\n const { id } = this.props.match.params;\n\n this.props.fetchStream(id);\n this.buildPlayer();\n }", "function PlayerLoad() {\r\n let { id} = useParams()\r\n let { sport} = useParams()\r\n return (\r\n <div>\r\n <Player player={id} s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Modul: Addition a + b | Test ausgabe(addieren(1,2));
function addieren(a,b) { return a + b; }
[ "function addieren(a,b) {\n return a + b; \n}", "function addieren(a,b){\n return a + b;\n}", "function addieren(a,b)\n{\n return a + b;\n}", "function add(a, b) {\n return (a + b);\n }", "function add(a, b) {\n var total = (a + b);\n return total;\n }", "function my_add...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implementation of filtering by category which takes in a list of adventures, list of categories to be filtered upon and returns a filtered list of adventures.
function filterByCategory(list, categoryList) { // TODO: MODULE_FILTERS // 1. Filter adventures based on their Category and return filtered list let arr = [] for(let category of categoryList){ let filterarr = list.filter(option => option.category === category) arr = [...arr,...filterarr] } return ...
[ "function filterByCategory(list, categoryList) {\n // TODO: MODULE_FILTERS\n // 1. Filter adventures based on their Category and return filtered list\n // console.log(\"Inside category\", categoryList)\n let filteredList = [];\n list.forEach((adventure) => {\n categoryList.forEach((category) => {\n if(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a promise. Resolve's parameter the last insert id
function mysql_insert( sql ) { return new Promise( (resolve, reject) => { pool.getConnection(function(err, connection) { if (err) reject( err.message); connection.query(sql, function (err, result) { connection.release(); ...
[ "save() {\n return new Promise((resolve, reject) => {\n require(\"../helpers/\" + index.getDBEngine() + \"Requester.js\").insert(this.constructor.TABLE_NAME, this, this.constructor.SQL_MAPPING).then((rows) => {\n this.id = rows.insertId;\n resolve(rows);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return to Shortcuts / FUNCTION DEFINITION / FUNCTION encodeOverlayImage
function encodeOverlayImage(overlayImage){ let overlayBase64String; try { const rawOverlay = Data.fromPNG(overlayImage); if (rawOverlay === null) { errMsg = "Error_convert_Image_to_Data"; writeLOG(errMsg); return; } overlayBase64String = rawOverlay.toBase64String(); if (overlay...
[ "function encodeImage() {\r\n //verify that the second image has same dimensions of first image\r\n hidden_image = adjustImageSize(main_image,hidden_image);\r\n //create cleared main image\r\n var cleared_image = clearImage();\r\n //create masked hidden image\r\n var masked_image = maskImage();\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Query the API for the urls for the individual pokemon names found in the text file
async function getPokeURLS(url,pokeNames){ let pokeData = []; let response = await fetch(url).catch(e => {console.log(e)}); let data = await response.json(); data.results.forEach( element => { pokeNames.forEach( pokeName => { if(element.name.toLowerCase() === pokeName.toLowerCase()...
[ "function pokeList(input) {\n // get data from the input file\n fs.readFile(input, (err, data) => {\n // if no data is found, error message\n if (err) {\n console.err('ERROR');\n return;\n }\n // else, create a promise\n // converts the input data into a string, and spli...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add the viewport__link to the nav
function addViewPortLink(id){ const linkInviewPort = `nav a[href ="#${id}"]`; document.querySelector(linkInviewPort).classList.add("viewport__link"); }
[ "function addListenerToNavLinks() {\n document.addEventListener('click', e => {\n e.preventDefault();\n if (e.target.dataset['link'] !== undefined) {\n const URI = e.target.href.substring(location.origin.length);\n createView(URI);\n }\n });\n}", "function addListe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialise the actions on the trade rows. Note: this function call needs to be made after the initial form.validate initialisation, otherwise we cannot add validation.
function initialiseTradeRow($row) { // limit inputs $(".trade-experience-years", $row).numeric({negative: false, decimal: false}); // add validation. completely empty rows are allowed (ignored server side) // so the field is only required if other fields are populated $(".trade-...
[ "function initialiseTradeRow($row) {\n // limit inputs\n $(\".trade-experience-years\", $row).numeric({ negative : false, decimal: false });\n\n // add validation. completely empty rows are allowed (ignored server side)\n // so the field is only required if other fields are populated\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
decrease statistics in time
function decreaseStats() { reviveBtn.style.display = "none"; called = setInterval (() => { Object.entries( statistics ).forEach( ( [ name, value ] ) => { value--; setStat( name, value ); }) checkMood(); }, 1000); }
[ "resetStatistics() {\n this.statistics = {\n startTime: Date.now(),\n endTime: null,\n testsRun: 0,\n testsFail: 0,\n testsSuccess: 0\n };\n }", "deactivate() {\n this.stats.metadata.roundFinishTime = Date.now();\n this.active =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is necessary to do check values before edit contract
function checkBeforeEdit() { /** * Function that is necessary to insert fee info to current container * @param fee_container * @param options */ function insertFeeInto(fee_container, options) { var wrap = options.wrap || false; var prepend = options.prepend || null; ...
[ "checkSchedule1DocValidity() {\n //Set Schedulec Doc complete based on Line12 entered & (Shcedule c enter value)\n if (this.scheduleCList.length.size === 0) {\n this.objInputFields.bScheduleCDocComplete = false;\n this.objInputFields.dLine12Adjusted = 0;\n\n } else if (!th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method to get location and add marker at current location
function addmarker() { function success(position) { const latitude = position.coords.latitude; const longitude = position.coords.longitude; const myLatLng = { lat: latitude, lng: longitude }; mark.textContent = 'Update My Location Marker'; ...
[ "function add_current_location_to_map(){\n\t\tvar point = new google.maps.LatLng(_lat, _lon);\n\t\tvar image = new google.maps.MarkerImage('images/img/blue_dot_circle.png',\n\t\t\tnew google.maps.Size(38, 38), // size\n\t\t\tnew google.maps.Point(0, 0), // origin\n\t\t\tnew google.maps.Point(19, 19) // anchor\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetching styles information from the breweries database api
async function fetchStyles() { try { checkBreweryAPIConfiguration(); const apiUrl = `${BREWERY_DB.API_ENDPOINT}/styles?key=${BREWERY_DB.API_KEY}`; return rp({ uri: apiUrl, json: true }); } catch(err) { console.log(err); } }
[ "getStyleById() {\n const sql = 'select * from public.\"Style\" WHERE id = $1 ORDER BY id ASC';\n return queryDB(sql, [this.id])\n }", "checkExistStyle() {\n const sql = 'select * from public.\"Style\" WHERE stylename = $1';\n return queryDB(sql, [this.stylename])\n }", "async ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the Starting Player
getStartingPlayer(){ return Math.floor(Math.random() * 2) + 1; }
[ "function getStartingPlayer() {\n const coin = Math.floor(Math.random() * 2);\n if (coin === 1)\n return 'player1';\n else\n return 'player2';\n }", "function determineStartingPlayer()\n{\n // @TODO: Random laten bepalen welke speler aan de beurt is of mag beginnen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the message for the popup. info: An object with header, message, and showRestartTip properties.
setMessage(info) { this.showRestartTip = info.showRestartTip; this.header.setText(info.header); this.message.setText(info.message); let headerWidth = this.header.getWidth(); let messageWidth = this.message.getWidth(); let longer = Math.max(headerWidth, messageWidth); ...
[ "function infoMessageBox(message, title){\n\t$(\"#info-body\").html(message);\n\t$(\"#info-title\").html(title);\n\t$(\"#info-popup\").modal('show');\n}", "function infoMessageBox(message, title){\n $(\"#info-body\").html(message);\n $(\"#info-title\").html(title);\n $(\"#info-popup\").modal('show');\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shows greeting after the user logs in or registers / We need to show greeting to the user not only after logging in, but when the application starts
function setGreeting(){ let username = localStorage.getItem("username"); if(username !== null){ loggedIn.show(); loggedIn.text(`Welcome, ${username}`); loginLink.hide(); registerLink.hide(); listAdsLink.show(); createAdLink.show();...
[ "function welcome() {\n var userName = getName();\n return 'Welcome ' + userName;\n }", "function showWelcome() {\n const demo = action(\"load-demo\", \"demo database\");\n let message = `<p>${messages.invite}<br>or load the ${demo}.</p>`;\n message += `<p>Click the logo anytime to start from scra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get a binary byte from a string (bytes) at position offset
function getByte(bytes, offset) { return bytes.charCodeAt(offset) % 256; }
[ "function string_of_bytes(b, offset, len) {\n let utf8 = Buffer.from(b, offset, len);\n return utf8.toString();\n}", "function getHexToBinaryPosition(s, index, length) {\n\tif (typeof length === 'undefined') {\n\t\tlength = 1;\n\t}\n\tvar bin = hex2bin(s);\n\tbin = bin.substr(index, length);\n\tvar ret = bin2he...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sound functions play typing sound function
function playTypeSound() { if (sound) { typeSound.play(); } }
[ "function playAttackSound()\n{\n\t//print( \"Playing an attack sound....\" );\n\tplaySound( attackNotes );\n}", "function mathtable_inputonclick(){\nsound_golfsound.play();\n}", "function echo(sound) {\nreturn sound;\n}", "function playSound(name) {\r\n name.play();\r\n}", "function playWord() {\n\tgetElem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ajax call to update the relationship level
function submitRequestLevelUpdate(level, fromEmailAddress, toEmailAddress, buttonClicked, url) { var relationshipBean = { "fromEmailAddress" : fromEmailAddress, "toEmailAddress" : toEmailAddress, "level" : level } $.ajax({ type : "POST", contentType : 'application/json; char...
[ "function activate_relation (treeId, rel) {\r\n\tvar tree = trees[treeId];\r\n\t$.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: \"server.py\",\r\n\t\tdata: {\"fct\": \"activate_relation\", \"mat\": \"[[\"+tree.relations.join(\"],[\")+\"]]\", \"relations\": \"[[\"+rel.join(\"],[\")+\"]]\"},\r\n\t\tsuccess: function (res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Spoof of vertex shader's setSkinMatRowsForBone() function.
_vsSetSkinMatRowsForBone(bsmr, b) { var i, icgr, icgt, iibr, iibt, rCGb, rIBb, rSkinb, tCGb, tIBb, tSkinb; iibt = b * 4 * 4; iibr = iibt + 4; // Inverse Bind Pose icgt = iibr + 4; icgr = icgt + 4; // Current (global) Pose tSkinb = [0, 0, 0]; rSkinb = [0, 0, 0, 0]; tCGb = (function() { var k, results; results = []; fo...
[ "generateSkinMatRows(m) {\n//------------------\nthis.skinTRX.copyTRX(this.globalTRX);\nthis.skinTRX.setPostStar(this.invBindPoseTRX);\nthis.skinTRX.convertToRowsMat3x4(m);\nreturn m; // return the given skin matrix\n}", "function prepare_skinning_info(bpy_obj, obj, armobj) {\n\n var render = obj.render;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a menu div with borgars
function createMenu() { const menu = document.createElement('div'); menu.classList.add('menu'); menuBorgars.forEach((borgar) => { menu.appendChild(borgar); }); return menu; }
[ "function makeMenu ()\r\n{\r\n /**************************************************************************/\r\n var details = new Array();\r\n \r\n function gatherInfo (x)\r\n {\r\n\tif (x.includeInSelectionMenu())\r\n\t details.push(x.data().name + \"%%%\" + x.data().eltIndex);\r\n }\r\n\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a custom isEqual handler specific to circular objects
function createCircularEqualCreator(isEqual) { return function createCircularEqual(comparator) { var _comparator = isEqual || comparator; return function circularEqual(a, b, cache) { if (cache === void 0) { cache = getNewCache(); } var isCacheableA = !!a && typeof a === ...
[ "get isCircular() {\n let that = this,\n isCircular = false;\n \n that.forEach(function(value) {\n if(value === that) {\n isCircular = true;\n \n return;\n }\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
displays custom attributes stored in CUSTOM_QUALIFICATION_DATA
function displayCustomAttributes() { let customAttributeArray = Object.keys(CUSTOM_QUALIFICATION_DATA); let customAttributeHtml = ""; for (let i = 0; i < customAttributeArray.length; i++) { customAttributeHtml = customAttributeHtml + customAttributeArray[i]+":"+ "<input type='text' id='custom"+customA...
[ "function displayStandardAttributes() {\n let standardAttributeArray = Object.keys(STANDARD_QUALIFICATION_DATA);\n let standardAttributeHtml = \"\";\n for (let i = 0; i < standardAttributeArray.length; i++) {\n standardAttributeHtml = standardAttributeHtml +\n standardAttributeArray[i]+\":\"+\n \"<input...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete the owned car that matches the passed primary key.
function deleteOwnedcar(primaryKey) { for (var i = 0; i < ownedcarsRootScope.ownedcarsData.length; i++) { if (primaryKey === ownedcarsRootScope.ownedcarsData[i].primaryKey) { ownedcarsRootScope.ownedcarsData.splice(i, 1); } } }
[ "deleteCar(car) {\n let index = this.cars.indexOf(car);\n this.cars.splice(index, 1);\n }", "deleteCar(carId)\n {\n const promiseResult = CarModel.deleteCar({_id:carId});\n return promiseResult;\n }", "async function deleteCar(_id) {\n const result = await Car.deleteOne({ _id });\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generic function to find the oddball in an array given a comparator function
function findOddball(array, comparator) { var cur = array[0]; var candidate = null; for (var i = 1; i < array.length; i++) { var same = comparator(cur, array[i]); if (candidate != null) { return same? candidate : cur; } if (!same) { candidate = cur; } cur = array[i];...
[ "function oddComparator(home,away,flag){\n if(home >= away){\n if(flag == \"low\"){\n return [\"away\",away];\n }else{\n return [\"home\",home]\n }\n }else{\n if(flag == \"low\"){\n return [\"home\",home]\n }else{\n return [\"away\",away]\n }\n }\n}", "function search(x, a, cmp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A StepPanel is a view of a WKStep step : Instance of WKStep.Step, representing a step generated by AlgebraKIT dom_jq: jquery reference to the container for this StepPanel parentStepPanel: StepPanel object that contains this step
function StepPanel(step, dom_jq, parentStepPanel) { //private fields //----------------- var _this; //state variables var subStepsCreated = false; var afterStepsCreated = false; var explanationExpanded = false; //the panel consists of tw...
[ "public getPanel() : JQuery {\n return this.panel;\n }", "function slideInPanel(jqr, opts) {\n\t\tif (isHidden(jqr)) {\n\t\t\tslideInPanels(jqr, opts, function() {\n\t\t\t\t\t//Scroll-Anweisung wird explizit für Vater-Panel ausgestellt, welches das this-Panel ja als Kindknoten enthält.\n\t\t\t\t\t//Grun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Amount in range [0, 1] Assume color1 & color2 has no alpha, since the following src code did so.
function mix(rgb1, rgb2, amount) { var p = amount / 100; var rgb = { r: (rgb2.r - rgb1.r) * p + rgb1.r, g: (rgb2.g - rgb1.g) * p + rgb1.g, b: (rgb2.b - rgb1.b) * p + rgb1.b }; return rgb; }
[ "function mix$1(rgb1, rgb2, amount) {\n var p = amount / 100;\n var rgb = {\n r: (rgb2.r - rgb1.r) * p + rgb1.r,\n g: (rgb2.g - rgb1.g) * p + rgb1.g,\n b: (rgb2.b - rgb1.b) * p + rgb1.b\n };\n return rgb;\n}", "function mix(rgb1, rgb2, amount) {\n var p = amount / 100;\n var rgb = {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
format an Instagram time stamp into readable format return format will be mm/dd/yy, HH:MM
function formatInstagramTime(instagramTime) { var time = new Date(instagramTime * 1000); var timeStr = (time.getMonth()+1) + "/" + time.getDate() + "/" + time.getFullYear() + ", "; // make sure hours have 2 digits if (time.getHours() < 10) { timeStr += "0" + time.getHour...
[ "function formatTimeStamp(timestamp)\n{\n timestamp = timestamp.split(\":\");\n timestamp[0] = parseInt(timestamp[0]);\n\n var daytimeLabel = \"am\";\n if (timestamp[0] >= 12)\n daytimeLabel = \"pm\";\n if (timestamp[0] > 12) // convert from 24 hr to 12 hr\n timestamp[0] -= 12;\n\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The Texture Key that the Bullets use when rendering. Changing this has no effect on bullets inflight, only on newly spawned bullets.
get bulletKey() { return this._bulletKey; }
[ "function _createTexture( key )\n {\n\n // get full relative url to asset source url\n var sourceUrl = assetClass.baseUrl + assetList[ key ],\n\n // push new texture instance to the collection\n newTexture = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
finishes the test: sets the CSS according to the status, removes the frame and starts the next test
function finish(bFailed) { oTest.element.firstChild.classList.remove("running"); if (bFailed) { oTest.element.firstChild.classList.add("failed"); oFirstFailedTest = oFirstFailedTest || oTest; } else if (!mParameters.keepResults) { // remove iframe in order to free memory document.body.re...
[ "function endTest () {\n const {\n wordDisplayArea,\n containers: {\n result,\n },\n buttons: {\n redChoice,\n greenChoice,\n blueChoice\n }\n } = domElements;\n\n toggleDomElementsDisplay([ wordDisplayArea, result, redChoice, g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
how to know param is array or not
function isArray(param) { if (typeof param == 'string') { console.log(param + ' -> String'); } else if (Object.prototype.toString.call(param) == '[object Array]') { console.log(param + ' -> Array'); } else { console.log(param + ' -> Not an Array'); } }
[ "function is_array(input){\n\t\t\t \n\t\t\t return typeof (input) =='object' && (input instanceof Array);\n\t\t\t \n\t\t\t}", "is_array(val) {\n return Array.isArray(val);\n }", "function isArray(input) {\n\t return Object.prototype.toString.call(input) === '[object Array]';\n\t }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to switch the confirm button to Model Answer button
function switchToModelButton() { intButtonState = 1; changeImage("confirm_r"); if (appTop.booMainWindow) { parent.objNavFrame.checkInstruction(); } }
[ "function swapConfirmButton() {\r\n try {\r\n if (pageAttributes.confirmBoxGameOver != \"\") {\r\n if ($('#yesButton').hasClass('confbuttonSelected')) {\r\n $('#yesButton').removeClass('confbuttonSelected');\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loginUser does a post to our "api/login" route and if successful, redirects us the the members page
function loginUser(email, password) { $.post("/api/login", { email: email, password: password }) .then(() => { window.location.replace("/members"); // If there's an error, log the error }) }
[ "function loginUser(email, password) {\n $.post(\"/api/login\", {\n email: email,\n password: password\n })\n\n // this changes the path from login to members if the route was successful.\n .then(function () {\n window.location.replace(\"/members\");\n // If there's an error,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resolve() is the public function to call. It performs arbitrary checks on the dataSet to ensure a fast exit from the function, if there is no need to calculate the data (e.g. the dataSet is empty).
resolve(dataSet){ return dataSet.length > 0 ? this._resolve(dataSet) : []; }
[ "function resolve( data ){\n\t\tif( isLocked ) return;\n\t\tsetState( true );\n\t\t//Update the data and lock if Immutable\n\t\tsetData( data, isImmutable );\n\t\trunCallbacks( 'resolve' );\n\t\treturn self;\n\t}", "function resolve() {\n\t\t\t\t\t// Our promise is either resolved or rejected by the hubs response...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For functions related to manipulating the lightbulb as well as for sending messages to the lightbulb toggles the power of the lightbulb when called
function togglePower() { let message = '{"id":1,"method":"toggle","params":[]}' rtm({ type: 'request', message: message }); }
[ "togglePower() {\n\t\tthis.power(!this.data.on);\n\t}", "function coolAction (){\n\trelay.toggle(1, function (err) {\n\t\tif (err) return console.err() \n\t\tif (LOGS) console.log('toggled');\n\t});\n}", "function power() {\n isTurnOn = !isTurnOn;\n //if power is turn on,\n if (isTurnOn) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The path to an manifest file describing all of the asset bundles used in the build (optional).
get assetBundleManifestPath() {}
[ "set assetBundleManifestPath(value) {}", "assetPath(name) {\n const manifest = this.manifest();\n if (!manifest[name]) {\n throw new Error(`Cannot find path for \"${name}\" asset. Make sure you are compiling assets`);\n }\n return manifest[name];\n }", "function getMani...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the Node version bundled inside Electron.
getElectronNodeVersion () { debug('getting Electron Node version') const args = [] if (isSandboxNeeded()) { args.push('--no-sandbox') } // runs locally installed "electron" bin alias const localScript = path.join(__dirname, 'print-node-version.js') debug('local script that prints N...
[ "static getNodeJsVersion() {\n return process.versions.node;\n }", "function _nodeVer() { return \"Node \" + process.version + \" running on \" + process.platform + \" \" + process.arch; }", "async function getNodeVersion () {\n log.verbose('Reading \"engine.node\" from package.json')\n const p = re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implementation of filtering by category which takes in a list of adventures, list of categories to be filtered upon and returns a filtered list of adventures.
function filterByCategory(list, categoryList) { // TODO: MODULE_FILTERS // 1. Filter adventures based on their Category and return filtered list return list.filter(item => categoryList.includes(item.category)) }
[ "function filterByCategory(list, categoryList) {\n // TODO: MODULE_FILTERS\n // 1. Filter adventures based on their Category and return filtered list\n // console.log(\"Inside category\", categoryList)\n let filteredList = [];\n list.forEach((adventure) => {\n categoryList.forEach((category) => {\n if(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a function "divBy100" that takes a number as an argument. "divBy100" should return a true if the number passed to it is divisible by 100. For example, if the input is 120 then your function should return false and if the input is 600 it should return true.
function divBy100(num) { return (num % 100 === 0) }
[ "function divisible(num) {\nif(num % 100 == 0){\n return true;\n}else\nreturn false;\n\n}", "function divisible(num) {\n return num % 100 === 0;\n}", "function divisible(num) {\n if(num % 100 === 0) {\n return true;\n } else {\n return false;\n }\n}", "function divisible(num) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when user defines angle which is very close to winter solstice sunray angle.
winterSolsticeReachedHandler(minAngle) { this.prevDay = this.seasonsState.day; this.outOfRange = true; this.targetAngle = minAngle; let newDay; if (!this.winterPolarNight()) { newDay = WINTER_SOLSTICE; } else { newDay = this.angleToDay(0); // Set the first day which has angle e...
[ "summerSolsticeReachedHandler(maxAngle) {\n this.prevDay = this.seasonsState.day;\n this.outOfRange = true;\n let newDay = SUMMER_SOLSTICE;\n this.targetAngle = maxAngle;\n if (!this.summerPolarNight()) {\n newDay = SUMMER_SOLSTICE;\n } else {\n newDay = this.angleToDay(180);\n // S...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HTML factory for the actual datepicker table element has to read the year range so it can setup the correct years in our HTML
function newDatepickerHTML() { var years = []; // process year range into an array for (var i = 0; i <= opts.endyear - opts.startyear; i++) years[i] = opts.startyear + i; // build the table structure var table = jQuery('<table class="datepicker" cellpadding...
[ "function newDatepickerHTML () {\n\t\t\t\n\t\t\tvar years = [];\n\t\t\t\n\t\t\t// process year range into an array\n\t\t\tfor (var i = 0; i <= opts.endyear - opts.startyear; i ++) years[i] = opts.startyear + i;\n\t\n\t\t\t// build the table structure\n\t\t\tvar table = jQuery('<table class=\"datepicker\" cellpaddin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace all macros in str str string to modify arrMacro array of Macro objects
function ReplaceMacros(str, arrMacro) { for (var i = 0; i < arrMacro.length; ++i) { var macro = arrMacro[i]; str = str.replace(new RegExp("(" + macro.name + ")", "g"), macro.value) } return str; }
[ "function replaceMacro(str) {\n\t\t\tvar returnVal = str;\n\t\t\tif (returnVal.indexOf('!{') != -1) {\n\t\t\t\ttry {\n\t\t\t\t\tfor (var i = 0; i <= str.split('!{').length; i++) {\n\t\t\t\t\t\treturnVal = (returnVal[\"substring\"](str.indexOf(\"{\") + 1, returnVal.search(\"}\")) + \"\")[\"toLowerCase\"]();\n\t\t// ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function to draw ellipses over the detected keypoints
function drawKeyPoints() { // Loop through all the poses detected for (let i = 0; i < poses.length; i++) { // For each pose detected, loop through all the keypoints for (let j = 0; j < poses[i].pose.keypoints.length; j++) { // A keypoint is an object describing a body part (like rightArm or leftShoul...
[ "function drawKeypoints() {\n // Loop through all the poses detected\n for (let i = 0; i < poses.length; i++) {\n // For each pose detected, loop through all the keypoints\n let pose = poses[i].pose;\n for (let j = 0; j < pose.keypoints.length; j++) {\n // A keypoint is an object describing a body ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }