query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Gets the current open notebook and displays it in the header of the page
function displayCurrentNoteBook() { let currentNotebookHeading = document.getElementById("current-notebook"); currentNotebookHeading.innerText = openNotebook.toUpperCase(); newNoteBookIntro(currentNotebookHeading); }
[ "function getNotebookContent() {\n $('.collections').on('click', '.js-open-notebook', function () {\n const id = $(this).attr('id');\n const title = $(this).text();\n $('#editor').attr('data-book', id);\n $.ajax(`/notebooks/${id}`, {\n beforeSend...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds some messages directly to a mailbox (eg new mail)
function addMessagesToServer(messages, mailbox) { // For every message we have, we need to convert it to a file:/// URI messages.forEach(function(message) { let URI = Services.io .newFileURI(message.file) .QueryInterface(Ci.nsIFileURL); // Create the imapMessage and store it on the mailbox. ...
[ "function addMessagesToServer(messages, mailbox) {\n // For every message we have, we need to convert it to a file:/// URI.\n messages.forEach(function(message) {\n let URI = Services.io\n .newFileURI(message.file)\n .QueryInterface(Ci.nsIFileURL);\n // Create the imapMessage and store it on the m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PixInsight JavaScript Runtime API PJSR Version 1.0 ZernikeAberrations.js Released 2015/11/23 00:00:00 UTC This file is part of WavefrontEstimator Script Version 1.18 Copyright (C) 20122015 Mike Schuster. All Rights Reserved. Copyright (C) 20032015 Pleiades Astrophoto S.L. All Rights Reserved. Redistribution and use in ...
function ZernikeAberrations() { // Singular values smaller than the product of this threshold and a // default will be dropped. this.pseudoInverseThreshold = 1; // Gives the aberration labels. this.aberrationLabels = function() { return new Array( "Z1 (0, 0) Piston", "Z2 (1, 1) T...
[ "function z0691(){this.zfff3=false;this.z9ea2=false;this.ze3c2=false;this.z2b20=[];this.zf310=[];this.z23eb={};this.zc901=false;this.z907d=null;this.z93cb=null;this.z4e9a=null;this.zefb8=false;this.Debug=null;var z1a23=this;this.z95e8=function(){this.z23eb[\"s_keyToken\"]=\"c563575ce0b0ae62ee5522a90d7d9630570010536...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
display feedback for incorrect answer
function answerIsIncorrect () { feedbackForIncorrect(); }
[ "function displayFailureMessage(){\r\n $(\"#correct\").html('<div class=\"alert alert-danger\"><p class=\"text-center\"><b>'+ failureMessage\r\n + '</b></p><p> You have correctly answered ' + score + ' of ' + maxQuestions + ' possible questions</p></div>');\r\n }", "function answerIncorrect() {\n feedback...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler for clicks on a chart point. Toggles the visibility of the tooltip for the point.
function onPointClick(event) { toggleDisplayedPoint(this); }
[ "function togglePoint(seriesIndex, pointIndex) {\n \tvar series = this.series[seriesIndex];\n if (!series.selection || !series.selection.show)\n return false;\n \n \tvar selectedNow = togglePointImpl.call(this, seriesIndex, pointIndex);\n \tvar args = [seriesIndex, pointIndex, sele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of available sections sorted by A11yAttributeNames.SORT_ORDER and optionally reversed
get sections() { let domElements = this.sortElementsByAttributeOrder(this.sectionHTMLCollection); domElements = domElements.filter((element) => { return this.elementIsVisible(element); }); if (this.shouldReverseSections) { domElements.reverse(); } ...
[ "function arrayDataInOrder() {\n sectionList.sort(relativeSectionOrder)\n\n console.log(sectionList)\n }", "function getSectionsNames() {\n \n let sections=[];\n for(let i=0;i<allSections.length;i++){\n sections.push(allSections[i].getAttribute(\"data-nav\"));\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The goal chosen per category for a given user.
function UserGoal(data) { if (!data) { throw 'Invalid data for User'; } this.id = data.Id; this.selectedGoal = new Goal(data.SelectedGoal); this.selectedUnit = new Unit(data.SelectedUnit); this.targetValue = data.TargetValue; this.customName = data.CustomGoal; this.latestEntr...
[ "getGoal() {\n return isValidGoal(this.goal) ? this.goal : DEFAULT_GOAL;\n }", "function getGoalAmount(categorySelected) {\r\n jQuery.ajaxSetup({async:false});\r\n $.post(\"/api/getUserGoals\", {username:user}, function(data) {\r\n amountSet = 0;\r\n $(jQuery.parseJSON(JSON.stringify(data))).eac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create index events with mapping if it doesn't exist
checkIndex() { this.client.indices.exists({ index: 'events' }).then((response) => { if (response.body === false) { this.initMapping('events', './mapping/events.json'); } }); }
[ "async _initIndices() {\r\n const mappings = this._config.get(SettingKeys_1.ElasticSearch.MAPPINGS).tryGetValue([]);\r\n await Promise.all(mappings.map(async (m) => {\r\n debug(`Checking index \"${m.index}\"...`);\r\n if (await this._createIndexIfNotExist(m.index)) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the value and position above the slider
function updateElem_youGet(pos, value) { var sp = (value < 10) ? 4 : 2; elem_aboveSliderVal_youGet.innerHTML = Math.round(value); if (pos > 0) { elem_aboveSliderVal_youGet.style.left = pos + sp + "px"; } elem_infoyougetval.innerHTML = Math.round(value); elem_youget_bar.styl...
[ "_updateValue () {\n let sliderWidth = this._sliderElement.offsetWidth;\n\n // Calculate the new value\n let { minValue, maxValue } = this._options;\n let percentage = this._xPosition / sliderWidth;\n let value = minValue + (maxValue - minValue) * percentage;\n this.emit(\"update\", value);\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Invoked immediately after a component is mounted. Reset the array here
componentDidMount() { this.resetArray(); }
[ "reset () {\n this.internalProps = []\n this.internalComponents = []\n }", "removeAll() {\n this.components = [];\n }", "reset(){\n\t\tthis.assets = [];\n\t\tthis.count = 0;\n\t\tthis.loaded = 0;\n\t}", "reset() {\n this.set('data', []);\n this._reset();\n }", "reset(){\n\t\tthis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if frame has slot with name (and value).
has(name, value) { if (typeof name === 'string') name = this.store.lookup(name); if (!this.slots) return false; for (let n = 0; n < this.slots.length; n += 2) { if (this.slots[n] === name) { if (value === undefined) return true; if (this.store.resolve(this.slots[n + 1]) == value) retur...
[ "hasSlot(slotName) {\n let slots = this.getSlots();\n let slot = slots[slotName];\n // When slot is not recognized, '?' is returned\n return slot !== void 0 && slot.value !== '?';\n }", "function isSlotValid(request, slotName) {\n var slot = request.intent.slots[slotName];\n var s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Register a step implementation. Only needed if you are uploading a flow from json
registerStep(type, step) { this.registry.set(type, step); }
[ "function resolveAndRunStepDefinition(testController, step) {\n const { expression, implementation } = resolveStepDefinition(step);\n\n if (expression && implementation) {\n return implementation(\n testController,\n ...expression.match(step.text).map(match => match.getValue())\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests if the adapter process has already exited
didAdapterStop() { return this._adapterExit != undefined; }
[ "hasExited () {\n\t\treturn joePrivate.exited === true\n\t}", "hasExited() {\n return this.has_exited;\n }", "exitProcess()\n {\n /**\n * make the process is dead with environment.\n * call deleteCid and publishEvent with same time\n * after process exit\n */\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Question 4 Imagine that you work at the corporate headquarters of a retailer that is closing a location. That location is having a clearance sale to get its inventory out the door quickly. Every item is 20% off. Write a function called calculateNewPrice that accepts an old price, and prints "The new price is $X.XX" to ...
function calculateNewPrice(oldPrice){ console.log(`The new price is $${oldPrice*0.8}`); }
[ "function resurrectPrice(){\n var price =\n findItem(\"Soul rune\").overall_average * 8 +\n findItem(\"Nature rune\").overall_average * 12 +\n findItem(\"Blood rune\").overall_average * 8 +\n findItem(\"Earth rune\").overall_average * 25;\n\n return price;\n}", "function exerciseThree() {\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
a function to call stop propagation before calling the cb
function stop_propagation_cb(cb, cb_args) { return function(evt) { evt.stopPropagation(); cb && cb.apply(this, cb_args); } }
[ "function stopPropagation(e){e.stopPropagation();}", "function stopPropagation(ev) {\n if (!ev) return;\n ev.stopPropagation && ev.stopPropagation();\n}", "removePropagation() {\n // Leave this to the scope of the subcircuit. Do nothing.\n }", "_preventPropagation(e) {\n e.stopPropagation();\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2. Ajax & session storage calls Requests the team object and displays basic team records on the righthand side of the screen
function getTeam(teamId) { var teamURL = selectTeam(teamId); // Displays basic team records function populateScreenTeam (teamObj){ let team = "<p>" + teamObj.name + "</p>"; let wins = "<p style='color: #2b9642'>"; wins += teamObj.wins; wins += " wins</p>"; let losses = "<...
[ "function runTeamPlayersBeforeShow() {\n /* This trick to know witch team should be used to display the players gave a lot of trouble. Because I needed to make the application figure out witch team was being displayerd, since the API was using different JSON files for the team's simple info and for the players */\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate an array of segments for a single event. A "segment" is the same data structure that View.rangeToSegments produces, with the addition of the `event` property being set to reference the original event.
function buildSegmentsForEvent(event) { var segments = rangeToSegments(event.start, getEventEnd(event)); for (var i=0; i<segments.length; i++) { segments[i].event = event; } return segments; }
[ "function buildSegmentsForEvent(event) {\n var startDate = event.start;\n var endDate = exclEndDay(event);\n var segments = rangeToSegments(startDate, endDate);\n for (var i=0; i<segments.length; i++) {\n segments[i].event = event;\n }\n return segments;\n }", "function bui...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
visitPage() visits each page in data structure, begins word search and performs error handling and callback
function visitPage(urlObj, res, callback){ console.log("Current page " + urlObj.URL); try { request({ uri: urlObj.URL, method: "GET", timeout: 5000, followRedirect: true, maxRedirects:10 } , function(error, response, body) { if(error) { console.log('Error from URL: ' + error); ...
[ "function visitPage(url,callback) {\n // add page to pageVisited\n pageVisited.add(url);\n\n console.log(`Visiting page ${url}`);\n request(url,(err,res,body) => {\n console.log('Status code' , res.statusCode);\n if(res.statusCode !== 200) {\n callback(); // call on crawl if it cannot get in\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clears RFC Index cache
function clearIndex () { return rmrf(p.resolve(exports.RFC_CACHE, exports.RFC_CACHE_INDEX)) }
[ "static async clearCache() {\n await this._cacheDb.destroy();\n this._cacheDb = new PouchDB('cache');\n await this._cacheDb.createIndex({\n index: {\n fields: ['type'],\n },\n });\n }", "clear() {\n this.index.clear();\n }", "function _clea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the peerConnection is closed the statsCb is called once with an array of gathered stats.
gatherStats (peerConnection, interval) { let stats = []; let statsCollectTime = []; return new Promise((resolve, reject) => { const getStats = () => { if (peerConnection.signalingState === 'closed') { return resolve({stats, statsCollectTime}); } // Work around for we...
[ "gatherStats (peerConnection, interval) {\n let stats = [];\n let statsCollectTime = [];\n\n return new Promise((resolve, reject) => {\n const getStats = () => {\n window.pc = peerConnection;\n if (peerConnection.signalingState === 'closed') {\n return resolve({stats, statsColle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the screen dimensions
static updateScreenDimensions() { let width = window.innerWidth; let height = window.innerHeight; this.screenWidth = width; this.screenHeight = height; this.screenWidth = width; this.screenHeight = height; this.canvas.width = this.screenWidth; ...
[ "function updateScreenSize(screenWidth, screenHeight){\n $(\".screen\").css({\"width\": screenWidth, \"height\": screenHeight});\n $(\".window\").css({width: screenWidth});\n}", "function screenResized() {\n resizeCanvas(windowWidth - simulation.ui.infoContainer.offsetWidth -\n simulation.ui.infoContainer.o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the unit of the maxheight attribute.
setMaxHeightUnit(valueNew){let t=e.ValueConverter.toDimensionUnit(valueNew);null===t&&(t=this.getAttributeDefaultValueInternal("MaxHeightUnit")),t!==this.__maxHeightUnit&&(this.__maxHeightUnit=t,e.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"MaxHeightUnit"}),this.__processMaxHeightUnit())}
[ "set maxHeight(value) {\n this._maxHeight = value;\n }", "getMaxHeightUnit(){return this.__maxHeightUnit}", "setMaxHeight(maxHeight) {\n this.maxHeight = maxHeight;\n }", "set height(val) {\n this._setAttributes(val,'height')\n }", "setMaxHeight(valueNew){let t=e.ValueC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End the setup process
function endProcess() { clearInterval(interval); process.stdout.write(chalk.blue('\n\nSetup complete!!\n\n')); process.exit(0); }
[ "function finishSetup() {\n chrome.storage.local.set({\n setupComplete: true,\n resetChrome49: true\n }, function() {\n chrome.runtime.sendMessage({ type: 'onSetupComplete' });\n window.close();\n });\n}", "end() {\n $('#setupContent').html(this.provider.endMessage());\n var setupsCom...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler for hide:pageName, subclass may implement
onHide() {}
[ "function hidePage(page) {\n\tif (typeof(page.main) == \"string\") {\n\t\t$(page.main).hide();\n\t}\n\tif (typeof(page.buttons) == \"string\") {\n\t\t$(page.buttons).hide();\n\t}\n\tif (page.onHide){\n\t\tpage.onHide();\n\t}\n}", "hidePage(){\n\t\tthis.page.style(\"visibility\",\"hidden\");\n\t}", "function han...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The url of the edit profile page for the current user
get editProfileLink() { return this.clone(UserProfileQuery, "EditProfileLink").get(); }
[ "function userProfileUrl(userId) {\r\n return url.context + \"/page/user/\" + encodeURI(userId) + \"/profile\";\r\n}", "function onEditProfileClick() {\n\tvar site = location.origin\n\tvar path = site + \"/srv/home/servant/servantProfileUpdate\";\n\tlocation.assign(path);\n}", "function getProfileURL(){\r\n\tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is where we calculate the total of every stat based on the top (left most in the UI) items for each equipment slot. First we set a score of 0, then we receive our top items for every slot through props. Then we define the strings that need to be used to reference our data for each equipment slot. Finally, w...
addStats(currentStat) { let score = 0; let topItemsForSlots = this.props.topItemsForSlots; let slotTitles = ["head", "cape", "neck", "weapon", "body", "shield", "legs", "hands", "feet", "ring"]; for (let i = 0; i < slotTitles.length; i++) { let currentItem = topItemsForSlots[slotTitles[i]][0]; ...
[ "initializePlayerStats() {\n for (let i = 0; i < this.players.length; i++) {\n this.players[i].gamesPlayedAcc = 0;\n this.players[i].gamesCaptainedAcc = 0;\n this.players[i].freeGamesMissedAcc = 0;\n this.players[i].gamesMissedAcc = 0;\n this.players[i]....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTIONS Fetches all the jobs of a company.
function fetchCompanyJobs(country) { let dataSource = "server"; if (sessionStorage.getItem("fetchCompanyJobs")) { dataSource = "cache"; } var getOptions = { source: dataSource, }; firestore .collection(country) .doc("jobs") .get(getOptions) .then(function (snapshot) { sessionSt...
[ "async getJobs(ctx) {\n\n let result = Joi.validate(ctx.query, jobQuerySchema.jobList);\n if (result.error !== null) {\n ctx.throw(400);\n }\n\n let jobs = await jobModel.\n listJobs(ctx.query.q, ctx.query.limit, ctx.query.offset, ctx.query.order)\n .catc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Elimina un director seleccionado
function deleteDirector(){ //Recoge el valor del boton pulsado var dir = this.value; /* LINEAS AÑADIDAS EN LA PRACTICA 8 */ //Abre la conexion con la base de datos categorias var directoresDB = indexedDB.open(nombreDB); //Si ha salido bien directoresDB.onsuccess = function(event) { var db = event.target.resu...
[ "remove(){\n this.dirs.pop();\n }", "function eliminarArchivo(nodo, posicion){\n let nodoPadre = nodo.parentNode;\n nodoPadre.innerHTML = '';\n archivosSeleccionados.items.remove(posicion);\n inputElement.files = archivosSeleccionados.files;\n volverACrearElementos(archivosSeleccionados);\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GENERIC FORM METHODS / a function to return 0 if a field's value is empty, otherwise return the field's value
function zero_if_empty($form_field) { return $form_field.val() == '' ? 0 : $form_field.val(); }
[ "function GetZeroOnIsNullOrEmpty(value) {\n if (value == \"\" || value == null)\n return 0;\n else {\n return value;\n }\n}", "get value() {\n\t\tconst value = this.input.value\n\t\treturn value !== \"\"\n\t\t\t? +value\n\t\t\t: null\n\t}", "function isFieldEmpty (field) {\r\n\tif (field....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Configration for the sub page of this pages
function ConfigurationSubPageWithID() { if(!Form.checkCurrentMode(0, true)) return; Form.addForm(); Form.all_or_this = 1; // this ****** pages Form.main_or_sub = 1; // main pages Form.option_check = false; LoadCurrentConf(); SetCurrentConf(); Form.option_check = true; Form.openForm(); }
[ "function ConfigurationSubPage() {\r\n\tif(!Form.checkCurrentMode(0, true)) return;\r\n\tForm.addForm();\r\n\tForm.all_or_this = 0;\t// all ****** pages\r\n\tForm.main_or_sub = 1;\t// sub pages\r\n\tForm.option_check = false;\r\n\tLoadCurrentConf();\r\n\tSetCurrentConf();\r\n\tForm.option_check = true;\r\n\tForm.op...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Join the keyParts to make a unififed string
static makeKey(keyParts) { return keyParts.map(part => JSON.stringify(part)).join(':'); }
[ "implodeKey(parts) {\n return parts.join('#');\n }", "function join(path, key) {\n return path != null ? path + \"[\" + key + \"]\" : key;\n }", "function formatKey(key) {\n if (_.isArray(key)) return key.join(':');\n else if (key.includes('.') && !key.includes(':')) return key.replace('.', ':');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
= Description Sets the label on a control component: the text that's displayed in HControl extensions. Visual functionality is implemented in component theme templates and refreshLabel method extensions. Avoid extending directly, extend +refreshLabel+ instead. = Parameters +_label+:: The text the component should displ...
setLabel(_label) { if (this.escapeLabelHTML) { _label = this.escapeHTML(_label); } if (_label !== this.label) { this.label = _label; this.refresh(); } return this; }
[ "refreshLabel() {\n const _elemId = this._getMarkupElemIdPart('label', 'HView#refreshLabel');\n if (this.isNumber(_elemId)) {\n ELEM.setHTML(_elemId, this.label);\n }\n return this;\n }", "set label(value) {\n this._label = value;\n }", "updateLabel() {\n this.innerHTML = this.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prompt users with two messages: Ask them the ID of the product they would like to buy Ask how many units of the product they would like to buy
function requestProduct() { inquirer. prompt([{ name: "productID", type: "input", message: "What product would you like to buy? (Enter Product ID #)", validate: validateInput, filter: Number }, { name: "productUnits", ...
[ "function requestID(){\n inquirer.prompt([\n {\n type: \"number\",\n name: \"item\",\n message: \"Enter the ID of the product you would like to purchase:\"\n }\n ]).then(function(answer){\n if(answer.item < 0 && answer.item > numProducts){\n console.log(\"Please select an ID between 1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the label with relevant message.
function updateLabel(msg) { $("#status_label").text(msg); }
[ "updateLabelText() { }", "updateLabel() {\n this.text = this._text;\n }", "function updateLabel() {\n // set the label to be chosen emoji\n this.marker.setLabel(image)\n //return the image var to empty so that next created marker does not have a label from start\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
+ creates a simple object with x and y offset
function createGameObjectPrototype(){ var basicObj = {} basicObj.relX = getXOffset(); //offset value relative to center basicObj.relY = getYOffset(); //offset value relative to center return basicObj; }
[ "constructor(){\n this.x = 0;\n this.y = 0;\n }", "constructor(x, y) {\n this.position = { x: x, y: y };\n this.size = {x: 5, y:5};\n }", "function createPosition() {\n return { x: 0, y: 0 };\n}", "constructor(x = 0, y = 0) {\n this.x = x;\n this.y = y;\n }", "function make...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
para eliminar los programas con el cuadro de dialogo
function eliminar_programas(id) { bootbox.confirm("ESTA SEGURO DE ELIMINAR EL PROGRAMA?", function(result) { if(result) { $.ajax({ url: 'data/programas/app.php', type: 'post', dataType:'json', data: {eliminar_programas:'asjkef', id: id}, success: function (data) { //$('#tbt_progr...
[ "function eliminacionProhibida() {\n llenarNotificaciones(\"Los permisos de los menus con numeros del 1 al 4 no se pueden eliminar\");\n}", "function DialogRemove() {\n\tvar pos = 0;\n\tfor(var D = 0; D < CurrentCharacter.Dialog.length; D++)\n\t\tif ((CurrentCharacter.Dialog[D].Stage == CurrentCharacter.Stage)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a string describing the encryption on a given socket instance.
function describeTLS(socket) { if (socket instanceof tls_1.TLSSocket) { const protocol = socket.getProtocol(); return protocol ? protocol : "Server socket or disconnected client socket"; } return "No encryption"; }
[ "function getEncryptedPrefix() {\n return 'enc::';\n}", "get serverSideEncryption() {\n return this.getStringAttribute('server_side_encryption');\n }", "getPrivateKeyString () {\n return secUtil.bufferToHex(this.getPrivateKey())\n }", "function getEncryption(strEncrypt)\n{\n\tswitch (strEncry...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function doesn't load rally point, rally point must be loaded by a prior call to TS_getRequest() its purpose is to set doing to 1 when rally point load is complete
function loadRallyPoint ( response, newdid, checkForIncomingAttack, setDoingToOne ) { try { //flag ( "loadRallyPoint():: Started for newdid: " + newdid ); if ( response != null && response != "" ) { // check if we have rally point var h1name = document.evaluate('.//h1', response, null, XPFirst, null).singleN...
[ "function prepRetreatReinforce(rally_doc)\r\n{\r\n var tag;\r\n TS_debug(\"prepRetreatReinforce: starting\");\r\n tag = find(\".//table[@class='troop_details']//div[@class='sback']/a[(contains(@href,'?d=')) and (contains(@href,'&c='))]\", XPList, rally_doc);\r\n if (tag.snapshotLength <= 0)\r\n {\r\n tag = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Which REVISITType has been selected ?
function getChoiceRevisit(f) { for (var i = 0; i < f.retype.length; i++) { if (f.retype.options[i].selected == true) { return f.retype.options[i].text } } return null }
[ "function changeVisitType() {\n\n\tif(allow_all_cons_types_in_reg == 'N' && screenid == \"reg_registration\") {\n\t\tloadPreferenceConsultationTypes(document.mainform.doctorCharge);\n\t\tloadPreferenceConsultationTypes(document.orderDialogForm.doctorCharge);\n\t}\n\n\t// For Main visit enable or disable insurance d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
puts errors into the error box
function puterrors(error) { var errBox = document.getElementById("reg-body"); // set the error box border to solid (from unset/hidden) errBox.style.borderStyle = "solid"; // create a br (line break) element var br = document.createElement("br"); var br2 = document.createElement("br"); //check if there have been ...
[ "function displayErrors(err){\n console.log(\"INSIDE displayErrors: \" + err);\n }", "printErrors() {\n if (!this.isValid()) {\n const errorPrint = [];\n\n Object.keys(this.errors).forEach(objectName => {\n errorPrint.push(objectName);\n\n Object.keys(this.errors[objectName])....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
goes through all of the key objects, and find the one with the same letter as is passed
function updateCurrentKeyByLetter(letter) { for (var i = 0; i < allKeyObjects.length; i++) { if (allKeyObjects[i].letter.toLowerCase() == letter) { currentKey = allKeyObjects[i]; return; } } }
[ "function updateCurrentKeyByLetter(letter) {\n\tfor (var i = 0; i < allKeyObjects.length; i++) {\n\t\tif (allKeyObjects[i].letter.toLowerCase() == letter) {\n\t\t\tcurrentKey = allKeyObjects[i];\n\t\t} \n\t}\n}", "function matchFirstNameToKey(firstNameLetter, selectedKey){\n firstName = selectedKey[firstNameLett...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggle task status as checked
function toggleTaskStatus(e) { var target = e.target; target.classList.toggle("checked"); }
[ "function toggleCheck(task)\n {\n task.checked = !task.checked;\n }", "'click .toggle-checked'() {\n Tasks.update(this.task._id, {\n $set: { checked: ! this.task.checked }, //Toggle If not checked: \"check\", else: \"uncheck\"\n });\n }", "function toggleChec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the beta app encryption declaration resource ID associated with a build.
function getAppEncryptionDeclarationIDForBuild(api, id) { return api_1.GET( api, `/builds/${id}/relationships/appEncryptionDeclaration` ) }
[ "function getBuildBetaDetailsResourceIDForBuild(api, id) {\n return api_1.GET(api, `/builds/${id}/relationships/buildBetaDetail`)\n}", "function getAppResourceIDForAppEncryptionDeclaration(api, id) {\n return api_1.GET(api, `/appEncryptionDeclarations/${id}/relationships/app`)\n}", "function getBuildIDFor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine if there is a specified scale type and if it is appropriate, or determine default type if type is unspecified or inappropriate. NOTE: CompassQL uses this method.
function scaleType(specifiedType, channel, fieldDef, mark, specifiedRangeStep, scaleConfig) { var defaultScaleType = defaultType(channel, fieldDef, mark, specifiedRangeStep, scaleConfig); if (!channel_1.hasScale(channel)) { // There is no scale for these channels return null; } if (speci...
[ "function scaleType(specifiedType, channel, fieldDef, mark, scaleConfig) {\n var defaultScaleType = defaultType$1(channel, fieldDef, mark, scaleConfig);\n if (!isScaleChannel(channel)) {\n // There is no scale for these channels\n return null;\n }\n if (specifiedType !== undefi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets if the provided structure is a ExportDeclarationStructure.
static isExportDeclaration(structure) { return structure.kind === StructureKind_1.StructureKind.ExportDeclaration; }
[ "static isExportSpecifier(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.ExportSpecifier;\r\n }", "static isExportable(structure) {\r\n switch (structure.kind) {\r\n case StructureKind_1.StructureKind.Class:\r\n case StructureKind_1.StructureKind.En...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a spreadsheet for the summary and stores it in the folder. Creates sheets for the Percentages and Averages. Populates header rows and columns.
function addSummaryFile(folder, name) { var spreadsheet = SpreadsheetApp.create(name); var sheetH = spreadsheet.getActiveSheet(); sheetH.setName("Percentages"); // Add the first column for the horizontal data table. sheetH.getRange(1, 1, 72, 1).setValues( [["All keywords"], [1], [2], [3], [...
[ "function createSheet(name, folderId){\n var throughputHeader = [['Date (MM/DD/YYYY)','Cloud Worker','Use Case','Task Type','Tasks Completed','Task Duration',\n 'Notes','Average Task/Hr','Ramp Percentage','Target (Min) (Actual)','Target (Max) (Actual)',\n 'Target...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the shots from the other clients, applying them physics
updateOtherPlayerShots(otherPlayerShots){ if(otherPlayerShots.weaponName != "shotgun"){ var s = this.enemyBullets.getFirstDead(); s.x = JSON.parse(otherPlayerShots.posX); s.y = JSON.parse(otherPlayerShots.posY); s.rotation = JSON.parse(otherPlayerShots.rotation); s.speed = JSON.parse(otherPlayerShots...
[ "function updatePhysics() {\n\tif (pullCount < 200) {\n\t\tprotons.forEach(pullOrigin);\n\t\tneutrons.forEach(pullOrigin);\n\t}\n\n\telse if (pullCount >= 200) {\n\t\tprotons.forEach(pushOrigin);\n\t\tneutrons.forEach(pushOrigin);\n\t}\n\n\tif (pullCount > 225) {\n\t\tpullCount = 150;\n\t}\n\n\tpullCount++;\n\n\tne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
listen To Install Prompt
listenToInstallPrompt() { window.addEventListener('beforeinstallprompt', (e) => { // Prevent Chrome 67 and earlier from automatically showing the prompt e.preventDefault(); // Stash the event so it can be triggered later. this._deferredPrompt = e; if ...
[ "displayInstallPrompt() {\n window.addEventListener('beforeinstallprompt', event => {\n event.prompt();\n });\n }", "function onInstall() {\n ui.alert('Installed');\n onOpen();\n}", "function handleInstall(e) {\n console.log('[INSTALL] event:', e);\n}", "function callInstallPrompt() {\n\t// W...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for validating initial time
function initialTimeValidate() { var initialTimeInput = document.getElementById("add_initial_time"); if (initialTimeInput.value == "") { document.getElementById("initialDateStatus").innerHTML = "Please enter the initial time for the event"; document.getElementById("initialDateStatus").style....
[ "function validTime() {\r\n // todo: write logic\r\n curTime = moment().tz('America/Los_Angeles')\r\n hourOfDay = parseInt(curTime.format('HH'))\r\n startHour = 19\r\n if (curTime.days() == 6 || curTime.days() == 7) {\r\n startHour = 15\r\n }\r\n return !(hourOfDay>=12 && hourOfDay<start...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
run until `maybeTrue()` returns `false` (so the body of the loop might _never_ run!)
function doWhileLoop(Y) { do { Y.shift() return Y } while (Y.length > 0 && maybeTrue()); }
[ "function runUntilTrue(func, callback) {\n runUntilTrueWrapper(func, callback)();\n}", "function doWhile(conditional)\n\t\t{\n\t\t\tvar jump = { loopStart: queueToFill.length, ifDone: null };\n\t\t\tjumpsToFix.push(jump);\n\t\t\tvar command = {\n\t\t\t\targuments: [],\n\t\t\t\tstart: function(scene) {\n\t\t\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createMap function has the a search string contianing the club stadium name, city and country passed to it (clubLocation). The array is also passed in (club).
function createMap(clubLocation, club) { // Create a new map in the club-location-map div element. map = new google.maps.Map(document.getElementById("club-location-map"), { zoom: 15, }); service = new google.maps.places.PlacesService(map); infowindow = new google.maps.InfoWindow(); // Pa...
[ "function mapNeigh(){\n \n var searchterm = (document.getElementById(\"search\").value).toLowerCase();\n var areaNum = neighborhood_obj[searchterm][0];\n var areaCrimeList = new Array();\n\n for(var i=0; i<js_objects.length; i++){\n if(js_objects[i][4] == areaNum){\n areaCrimeList.push(js_objects[i])\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the token in the queued messages changes than remove messages that use the old token
function removeOldTokenMessages(messageQueue) { let outQueue = []; if(localStorage) { if(typeof localStorage.getItem === 'function') { const token = $tw.Bob.Shared.getMessageToken(); outQueue = messageQueue.filter(function(messageData) { return messageData.message.token === token...
[ "function pruneMessageQueue(inQueue) {\n inQueue = inQueue || [];\n let token = false\n if($tw.browser && localStorage) {\n token = localStorage.getItem('ws-token');\n }\n // We can not remove messages immediately or else they won't be around to\n // prevent duplicates when the message from t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`applyContainer` performs an operation on the container and its views as specified by `action` (insert, detach, destroy) Inserting a Container is complicated by the fact that the container may have Views which themselves have containers or projections.
function applyContainer(renderer, action, lContainer, parentRElement, beforeNode) { ngDevMode && assertLContainer(lContainer); var anchor = lContainer[NATIVE]; // LContainer has its own before node. var _native5 = unwrapRNode(lContainer); // An LContainer can be created dynamically on any node ...
[ "function applyContainer(renderer, action, lContainer, renderParent, beforeNode) {\n ngDevMode && assertLContainer(lContainer);\n var anchor = lContainer[NATIVE]; // LContainer has its own before node.\n var native = unwrapRNode(lContainer);\n // An LContainer can be created dynamically on any node by i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
There are free tasks indicated by the `status` array
function gotTasks(status) { var queue = d3.queue(10); // Handle each finished task status.forEach(function(finishedTask) { log.info( '[%s] %s', finishedTask.env.MessageId, JSON.stringify({ outcome: tasks.report(finishedTask.outcome), reaso...
[ "checkTaskStatus(currentIndex) {\n let {tasks} = this.state;\n let {dependencies} = this.state;\n\n let complete = function(index) {\n if (tasks[index].completedAt !== null) {\n return true;\n }\n }\n\n for (var index in dependencies) {\n if (dependencies[index].includes(current...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the userInfo from localStorage. This method may be used when user has logged out.
static removeUserInfoFromStorage() { localStorage.removeItem(this.KEY_USER_INFO); }
[ "static removeUser() {\n localStorage.removeItem('userInfo');\n }", "function logout() {\n localStorageService.remove(\"user\");\n }", "function deleteUserDataFromSessionStorage() {\n localStorage.removeItem('userData');\n}", "function clearAuthUserLocalStorageInfo() {\n localforage....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
nothing can harm elemental during initial animation
if (m_bInitialAnim) { return; }
[ "function firstAnimationState() {\n resetAnimationState();\n render();\n }", "animation() {}", "function initialAnimations() {\n snakeEmblem.removeClass('to-animate');\n setTimeout(function() {\n snakeEmblem.removeClass('no-border-offset');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a lazy constant in both math and mathWithTransform
function setLazyConstant (math, name, resolver) { lazy(math, name, resolver); lazy(math.expression.mathWithTransform, name, resolver); }
[ "function setLazyConstant (math, name, resolver) {\n lazy$4(math, name, resolver);\n lazy$4(math.expression.mathWithTransform, name, resolver);\n}", "function setLazyConstant(math, name, resolver) {\n object.lazy(math, name, resolver);\n object.lazy(math.expression.mathWithTransform, name, resolver);\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load version api for given console
function loadVersionConsoleByName(consoleName) { // load console list api $.ajax({ url: apiUrl+("/v2/consoles/")+consoleName+"/old", type: 'GET', contentType: 'application/json', success: function(res) { appendVersionConsoleList(res); }, error: function() { showErrorAlert("Unable t...
[ "function loadVersionConsoleById(consoleId) { // load console list api\n $.ajax({\n url: apiUrl+(\"/v2/consoles/\")+consoleId+\"/old/get\",\n type: 'GET',\n contentType: 'application/json',\n success: function(res) {\n isViewingVersionConsole = true;\n resetBrowserUrl();\n preparePageRen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add reddit data to the DOM
function createRedditPost(data) { // create column container for reddit post var redditPostDiv = document.createElement('div'); redditPostDiv.classList = "column is-half-tablet is-one-third-desktop"; // create box for styling var redditPost = document.createElement('div'); redditPost.classList =...
[ "function populate_posts(parsed_json)\n{\n let post_counter = 0;\n const REDDIT_HOST = 'https://www.reddit.com';\n\n $.each(parsed_json, function (jsonkey, jsonval) {\n let media_html = '';\n let epoch_date = parsed_json[jsonkey]['date_created'];\n let date_object = new Date(epoch_date...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: isPlusFloatD4(valueOfStr). Description: Check out that if the parameter valueOfStr is one plus float number with 4 decimals. Param: A string or a number. Return: True when it is or it can be cast to a plus float number and with 4 decimals, otherwise return false.
function isPlusFloatD4(valueOfStr){ var patrn1 = /^([+|]?[0-9])+(.[0-9]{0,4})?$/; try{ //alert("isPlusFloatD4("+valueOfStr+").patrn="+patrn1.exec(valueOfStr)); if (patrn1.exec(valueOfStr)){ return true; }else{ return false; } }catch(e){ return false; } }
[ "function isFloatD4(valueOfStr){\r\n\tvar patrn1 = /^([+|-]?[0-9])+(.[0-9]{0,4})?$/;\r\n\ttry{\r\n\t\t//alert(\"isFloatD4(\"+valueOfStr+\").patrn=\"+patrn1.exec(valueOfStr));\r\n\t\tif (patrn1.exec(valueOfStr)){\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t}catch(e){\r\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: Suppose there's a promotion in Walmart, each customer is given a randomly generated "lucky number" between 0 and 5. If your lucky number is 0 you have no discount, if your lucky number is 1 you'll get a 10% discount, if it's 2, the discount is 25%, if it's 3, 35%, if it's 4, 50%, and if it's 5 you'll get all for ...
function calculateTotal(luckyNumber, totalAmount) { switch (luckyNumber) { case 0: discountPercentage = 0; break; case 1: discountPercentage = .10; break; case 2: discountPercentage = .25; break; case 3: ...
[ "function calculateTotal (luckyNumber,amountTotal) {\n var discount;\n if (luckyNumber === 0) {\n discount = 0;\n } else if (luckyNumber === 1) {\n discount = .1;\n } else if (luckyNumber === 2) {\n discount = .25;\n } else if (luckyNumber === 3) {\n discount = .35;\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a MatchConfig which is used to store the match configuration state before we call the actual lobby creation functions
function MatchConfig(queue) { this.io = queue.ioQueue; this.players = _.map(queue.queue, lobbies.clientPlayerInfo); this.id = queue.nextId; this.queue = queue; this.pickNumber = 0; this.season = queue.season; this.settings = { name : 'LD2L Inhouse '+this.season.id+'-'+this.id, password : randomstring.genera...
[ "createMatch(matchName) {\n return Match.create({ matchName });\n }", "getMatchingConfig(matchParams = {}) {\n const message = matchParams.message;\n // Passed userId -> passed member's id -> passed message's author's id\n const userId = matchParams.userId ||\n (matchPara...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the location info DIV for an editable location
function umMakeEditLocationInfoContent(Location, ID) { var Content; ID = typeof ID !== 'undefined' ? ID : umCreateUniqueLocationID(); if (ID === null) ID = umCreateUniqueLocationID(); Content = '<div class="umLocationInfoEdit" id="' + ID + '">'; Content += '<form id="' + ID + 'form" onSubmit="return false;">';...
[ "function LocationInput(){\n\tjQueryInterface.call(this);\n this.fields = [];\n var onebox = OCA.Settings.LocationFieldSingleBox;\n var suburbLabel = onebox ? OCA.getI18n().gettext(\"Location\") : OCA.getI18n().gettext(\"Suburb\");\n var latlng = OCA.Settings.LocationFieldShowLatLng !== false;\n var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the app information for a specific beta license agreement.
function readAppInformationForBetaLicenseAgreement(api, id, query) { return api_1.GET(api, `/betaLicenseAgreements/${id}/app`, { query }) }
[ "function readBetaLicenseAgreementForApp(api, id, query) {\n return api_1.GET(api, `/apps/${id}/betaLicenseAgreement`, { query })\n}", "function getAppResourceIDForBetaLicenseAgreement(api, id) {\n return api_1.GET(api, `/betaLicenseAgreements/${id}/relationships/app`)\n}", "function readBetaLicenseAgreem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Quantum fixer See settings.js for the meaning of QUANTUM_SIZE. The issue we fix here is, to correct the .ll assembly code so that things work with QUANTUM_SIZE=1.
function quantumFixer() { if (QUANTUM_SIZE !== 1) return; // ptrs: the indexes of parameters that are pointers, whose originalType is what we want // bytes: the index of the 'bytes' parameter // TODO: malloc, realloc? var FIXABLE_CALLS = { 'memcpy': { ptrs: [0,1], bytes: 2 }, 'memmove':...
[ "function quakeSize(magnitude) {\n return (10000 * magnitude);\n }", "function Quantize(){var bs;this.rv=null;var rv;this.qupvt=null;var qupvt;var vbr=new VBRQuantize();var tk;this.setModules=function(_bs,_rv,_qupvt,_tk){bs=_bs;rv=_rv;this.rv=_rv;qupvt=_qupvt;this.qupvt=_qupvt;tk=_tk;vbr.setModules(qupvt,tk);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
changeRadius(): sets radius for heatmap Layer Inputs: null Returns: null
changeRadius() { this.heatmap.set('radius', this.heatmap.get('radius') ? null : 20); }
[ "function changeRadius() {\n heatmap.set('radius', heatmap.get('radius') ? null : 10);\n}", "function changeRadius() \n{\n ttcHeatmap.set('radius', ttcHeatmap.get('radius') ? null : 20);\n}", "updateHeatmapRadius(radius, blur) {\n if (isNumber(radius)) {\n this._heatmap.radius(radius, blur);\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
23.1.4 Properties of Map Instances 23.1.5 Map Iterator Objects
function MapIterator() {}
[ "function test6() {\n var map = new Map();\n map.set(1, 'foo');\n map.set(2, 'bar');\n\n var iterator = map.entries();\n\n console.log(iterator.next().value);\n console.log(iterator.next().value);\n}", "function test9() {\n var map = new Map();\n map.set(1, 'foo');\n map.set(2, 'bar');\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a mouse listener to the game
setMouseListener() { this.functionOnClick = this.mouseupEventHandler(this); let target = document.getElementById("gameport"); target.addEventListener("mouseup", this.functionOnClick); }
[ "function enableMouse() {\n frame.addEventListener('mousemove', mousePaddle);\n }", "addMouseListener() {\n this.functionOnClick = this.mousedownEventHandler(this);\n let target = document.getElementById(\"gameport\");\n target.addEventListener(\"mousedown\", this.functionOnClick);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compare two rng beg or end values (basically a value vector V[2] where V[0] is virtual file offset and V[1] is inflated block offset). Return if RV1 RV2.
function rngComp (rv1, rv2) { return (rv1[0] == rv2[0]) ? rv1[1] - rv2[1] : rv1[0] - rv2[0]; }
[ "function range_equals(r1, r2) {\n if (r1.length != r2.length) {\n return false;\n }\n for (var i = 0; i < r1.length; i++) {\n if (r1.start(i) != r2.start(i) || r1.end(i) != r2.end(i)) {\n return false;\n }\n }\n return true;\n}", "function rangesEqual(a, b) {\n return a[0] === b[0] && a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the selected key has a passphrase, then decrypt it and call the login function
function decryptKeys() { $('.errorlist').hide(); const crypto = new OpenCrypto(); const passphrase = document.getElementById('id_passphrase').value; crypto.decryptPrivateKey(keyPair.private, passphrase, 'RSASSA-PKCS1-v1_5', ['sign']) .then(cryptoKey => { return doLogin(keyPair.email, cryptoK...
[ "function unlockKey(){\n \n var privatekey;\n var passcode;\n var encryptedkey;\n var decryptedkey;\n \n passcode = document.getElementById(\"passcode\").innerHTML;\n \n if (typeof(Storage) != \"undefined\") {\n \n encryptedkey = localStorage.getItem(\"encryptedkey\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A [nodemongodbnative]( collection implementation. All methods methods from the [nodemongodbnative]( driver are copied and wrapped in queue management.
function NativeCollection(name, options) { this.collection = null; this.Promise = options.Promise || Promise; MongooseCollection.apply(this, arguments); }
[ "function NativeCollection() {\n\t this.collection = null;\n\t MongooseCollection.apply(this, arguments);\n\t}", "function NativeCollection() {\n this.collection = null;\n MongooseCollection.apply(this, arguments);\n}", "function Collection() {}", "function Collection () {}", "function MongoDB() {\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calls the function to add a new row and to clear the form
function entryAddSuccess(entry) { entryAddRow(entry); formClear(); }
[ "function addRow(){\n insertData();\n createRow();\n editTable();\n}", "function addRow() {\n var $newRow = lastRow().clone(true).insertAfter(lastRow());\n clearRow($newRow.get());\n }", "function addRowToTable(){\n createTableElementsFromInputs();\n postTableElementsFromInputs();\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Since |this.propertyDict| may change multiple times after the user |this.allFieldsReadOnly| becomes false (while editing the properties of a connected network), the first CrInputElement should be ready before it's focused.
onPropertyDictChanged_() { // Do not proceed if the user has not opted for manual edit, or has // already made an edit. if (this.allFieldsReadOnly || this.hasAnyInputFocused_) { return; } this.attemptToFocusFirstEditableCrInput_(); }
[ "attemptToFocusFirstEditableCrInput_() {\n flush();\n\n const crInput = /** @type {?HTMLElement} */\n (this.shadowRoot.querySelector('cr-input:not([readonly])'));\n if (!crInput) {\n return;\n }\n\n // Note that |this.hasAnyInputFocused_| should not change here because a\n // CrInputEl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cubic bezier with control points (0, 0), (x1, y1), (x2, y2), and (1, 1).
function cubicBezier(x1, y1, x2, y2) { function xForT(t) { var omt = 1-t; return 3 * omt * omt * t * x1 + 3 * omt * t * t * x2 + t * t * t; } function yForT(t) { var omt = 1-t; return 3 * omt * omt * t * y1 + 3 * omt * t * t * y2 + t * t * t; } function tForX(x) { // Binary subdivision. ...
[ "function cubicBezierCurve(t, p0, p1, p2, p3) {\n return (1 - t) * (1 - t) * (1 - t) * p0 + 3 * (1 - t) * (1 - t) * t * p1 + 3 * (1 - t) * t * t * p2 + t * t * t * p3;\n }", "function _cubicBezierCurve(t,p0,p1,p2,p3){return(1-t)*(1-t)*(1-t)*p0+3*(1-t)*(1-t)*t*p1+3*(1-t)*t*t*p2+t*t*t*p3;}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepend a button before a tree item which allows the user to collapse or expand all tree items at that level; see `_toggleTreeItem`.
_addToggleButton(div, hidden = false) { const toggler = document.createElement("div"); toggler.className = "treeItemToggler"; if (hidden) { toggler.classList.add("treeItemsHidden"); } toggler.onclick = evt => { evt.stopPropagation(); toggler.classList.toggle("treeIt...
[ "redo() {\n this.newOwner.addChild(this.treeItem, true)\n }", "function _createUpButtons($tree) {\n $tree.find('ul').each(function() {\n var $currentList = $(this);\n\n $(this).parents('ul').each(function(){\n if (typeof $(this).data('panel-title') !== 'undefined') {\n $currentLis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[1][clone] uu.node.bulk(Node) > DocumentFragment [2][build] uu.node.bulk("html") > DocumentFragment uu.node.bulk convert HTMLString into DocumentFragment
function uunodebulk(source, // @param Node/HTMLFragment: source context) { // @param Node/TagString(= "div"): context // @return DocumentFragment: context = context || "div"; var rv = doc.createDocumentFragment(), placeholder = context.nodeTyp...
[ "appendStringAsNodes(element, html) {\n\n var frag = document.createDocumentFragment(),\n tmp = document.createElement(\"body\"), child;\n tmp.innerHTML = html;\n // Append elements in a loop to a DocumentFragment, so that the browser does\n // not re-render the document for each node\n while ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If totalValue becomes greater then game generated number, alert player that they loss
function checkIfWon() { if (totalValue > randomNumber) { alert("Sorry, you lost!"); //increment losses losses++; //create var to include text, plus updated losses number var showLosses = "Losses: " + losses; //show on html page $("#lossesAmount").text(showLosses); sta...
[ "function checkLoss(){\n\tif(totalScore > randomNumber){\n\t\tcountLoss++;\n\t\t$(\"#userLosses\").html(countLoss);\n\t\talert(\"Game over man, game over! Final score: \" + totalScore + \" ( > \" + randomNumber + \")\");\n\t\tnextGame();\n\t}\n}", "function checkDealerTotal() {\r\n\r\n // dealer stands on 17 (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to help clean up Event module
function cleanEvent() { var removable = ACT.Event.removable; for (var itor = 0; itor < removable.length; itor++) { if (removable[itor].eventType === 'env:envRendered') continue; if (removable[itor].eventType === 'message') continue; if (removable[itor].eventType === 'screen:status') continue; if (removable[it...
[ "function unmap_events(ec) {\n\t\n}", "unWireEvents() {\n /*! Find the Events type */\n let isIE11Pointer = Browser.isPointer;\n let start = Browser.touchStartEvent;\n let stop = Browser.touchEndEvent;\n let move = Browser.touchMoveEvent;\n let cancel = isIE11Pointer ? 'p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
determine the respective node that handles scrolling, defaulting to browser window
function deriveScrollingViewport(stickyNode) { // derive relevant scrolling by ascending the DOM tree var match =findAncestorTag (scrollableNodeTagName, stickyNode); return (match.length === 1) ? match[0] : $window; }
[ "function get_doc_scrollElement()\n{\n // for the sake of effectivity & simplicity, I'll choose a browser-sniffing solution\n // instead of the dynamic approach that I had worked out with a helping nudge of\n // StackOverflow [1]. Because, the problem with that approach is that it fails to\n // identify the bro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize statement and parameters for inserting an array
function initializeArrayInsert(aStatementKey, aArray, aAddParams) { if (!aArray || aArray.length == 0) return; let stmt = self.getAsyncStatement(aStatementKey); let params = stmt.newBindingParamsArray(); aArray.forEach(function(aElement, aIndex) { aAddParams(params, ...
[ "function instructionInsertArray({\n arrayTableName,\n messageIdField,\n messageIdFieldType,\n arrayField,\n arrayFieldType\n}) {\n return {\n instruction: 'exec-with-tuples',\n condition: {included: arrayField},\n // tuple is, e.g. \"(?, ?, ?)\" or \"(?, ?, from_unixtime(...)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes a uri for a Data Object or a GS object along with an authorization header. This method will gather and return metadata for the object and will attempt to use the bearer token to generate a signed url ( that will grant access to the object.
async function fileSummaryV1Handler(req, res) { const origUrl = (req.body || {}).uri; const auth = req.headers.authorization; if (!origUrl || !isValidProtocol(origUrl)) { console.error(new Error('Uri is missing or invalid')); res.status(400).send('Request must specify the URI of a DOS or GS...
[ "presignedGetObject(bucketName, objectName, expires, respHeaders, cb) {\n if (!isValidBucketName(bucketName)) {\n throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName)\n }\n if (!isValidObjectName(objectName)) {\n throw new errors.InvalidObjectNameError(`Invalid object nam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draws the type of stat along with a color
drawType(type, n) { write(' '); write(color(type, n)); write('\n'); }
[ "function printStats(unit){\r\n drawSideBar();\r\n ctx.font = \"20px Comic Sans MS\";\r\n if(unit.color == \"blue\"){\r\n \tctx.fillStyle = \"blue\";\r\n }\r\n else{\r\n\tctx.fillStyle = \"red\";\r\n }\r\n ctx.textAlign = \"center\";\r\n ctx.beginPath();\r\n ctx.fillText(unit.type, 900...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resets star images and starting stars queue back to 3. adds current star bonus to total star bonus.
function resetStars(){ $('#star-10').attr('src','images/star.png'); $('#star-20').attr('src','images/star.png'); $('#star-30').attr('src','images/star.png'); endingStarBonus += startingStars; startingStars = 3; incorrectGuesses = 0; }
[ "function resetStarRating()\n{\n // Code will only apply if there are less than three stars.\n while (numberOfStars < 3)\n {\n // Clone a star and append it to the parent node.\n starClone = star.cloneNode(true);\n stars['0'].appendChild(starClone);\n star = stars[\"0\"].firstElementChild;\n numbe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle Edit a Recipe
handleEdit(recipe, index) { this.props.handleEdit(recipe, index) }
[ "function editRecipe() {\n displayEditForm();\n }", "function handleRecipeEdit () {\n console.log('handle edit recipe function was invoked');\n window.location.href = `/add?recipe_id=${this.value}`;\n }", "function handleRecipeEdit() {\r\n var currentRecipe = $(this)\r\n .parent()\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
function BufferCopy (target, target_start, start, end) { var source = this if (!start) start = 0 if (!end && end !== 0) end = this.length if (!target_start) target_start = 0 // Copy 0 bytes; we're done if (end === start) return if (target.length === 0 || source.length === 0) return // Fatal error con...
[ "function BufferCopy(target,target_start,start,end){var source=this;\n// Copy 0 bytes; we're done\nif(start||(start=0),end||0===end||(end=this.length),target_start||(target_start=0),end!==start&&0!==target.length&&0!==source.length){\n// Fatal error conditions\nif(end<start)throw new Error(\"sourceEnd < sourceStart...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
turn a single bullet point into a list item with tag the loop index (i) will be the unique key b is just a string with the description of the job each individual bullet point (there are around 24 individual bullet points within the individual "desc" array of each job) will be passed through the Bullet function, via the...
function Bullet(b, i) { return (<li key={i}>{b}</li>); }
[ "renderBulletListItem(bulletListItem, index) {\n let title = null;\n if (bulletListItem.title) {\n let titleText = bulletListItem.title.trim();\n title = (\n <strong>{titleText}: </strong>\n )\n }\n\n let subText = null;\n if (bulletListItem.subtext) {\n subText = (\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function Updates circuit status object
function updateCircuitStatus(statusObj) { // check status of living room if (LED1.readSync() === 0) { statusObj.livingRoom = "off"; } else { statusObj.livingRoom = "on"; } // check status of guest bedroom if (LED2.readSync() === 0) { statusObj.guestRoom = "off"; } else { statusObj.guestRo...
[ "update_status(new_status)\n {\n this.status = new_status;\n }", "function statusUpdate()\n{\t\n\tvar sim = {\n\t\t\n\t\t\"aReg\" : aReg,\n\t\t\"bReg\" : bReg,\n\t\t\"oReg\" : oReg,\n\t\t\"iReg\" : iReg,\n\t\t\"inst\" : instIdx[iReg],\n\t\t\"pReg\" : pReg,\n\t\t\"iPt1\" : iPrt[0],\n\t\t\"iPt2\" : iPrt[1],\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes the input format from 'integer' to 'floatingPoint'.
_changeFromIntegerToFloatingPointInputFormat() { const that = this; if (that.radixDisplay) { that.radixDisplay = false; that.$radixDisplayButton.addClass('jqx-hidden'); } if (that._radixNumber !== 10) { that.radix = 10; that._radixNumber =...
[ "_changeFromIntegerToFloatingPointInputFormat() {\n const that = this;\n if (that.radixDisplay) {\n that.radixDisplay = false;\n that.$radixDisplayButton.addClass('smart-hidden');\n }\n\n if (that._radixNumber !== 10) {\n that.radix = 10;\n tha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper methods Parses the data, returns the resulting document.
function parseDocument(data, options) { var handler = new domhandler_1.DomHandler(undefined, options); new Parser_1.Parser(handler, options).end(data); return handler.root; }
[ "function parseDoc(){\n var sections = getSections();\n \n var data = {\"quote\":\"\", \"summaries\":[], \"others\":[], \"tidbit\":\"\", \"bottomquote\":\"\"};\n \n for (i in sections)\n {\n var sect = sections[i];\n var type = getType(sect);\n \n if (type == \"_SUMMARY\")\n {\n var su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract the assignees of the card, returning a concatenated string with comma separating the names
function extract_assignees(card_data) { var concatenated_str = ''; var first_name = true; for (var assignee of card_data['assignees']) { if (!first_name) { concatenated_str += ','; } else { first_name = false; } // join the new name to the ot...
[ "getAssigneesText (codemark, options) {\n\t\tlet { members } = options;\n\t\tif (!members) {\n\t\t\tmembers = [];\n\t\t}\n\t\tconst users = [];\n\t\t(codemark.assignees || []).forEach(userId => {\n\t\t\tconst user = members.find(user => user.id === userId);\n\t\t\tif (user) {\n\t\t\t\tusers.push(user.username);\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test to see if this is HTC Default Browser
function isHTCMobile() { var regExp = new RegExp("HTC", "i"); var test = navigator.userAgent.match(regExp); return test; }
[ "function xrxIdentifyCurrentBrowser()\r\n{\r\n var uaString = navigator.userAgent;\r\n return (((uaString != undefined) && (uaString != null)) ? (((uaString = uaString.toLowerCase()).indexOf( \"galio\" ) >= 0) ? \r\n \"FirstGenBrowser\" : ((uaString.indexOf( \"webkit\" ) >= 0) ? \"SecondGenBrowser\" : ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse the shadow value and extract the values.
function parseShadow(shadow) { var match, color, parsedShadow = {}; // Parse an CSS-syntax color. Outputs an array [r, g, b] // Match #aabbcc if (match = /#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(shadow)) { color = [parseInt(match[1], 16), parseInt(match[2], 16), parseInt(match[3], 16)]...
[ "function parseShadow(shadow) {\n\t\tvar match, color, parsedShadow = {};\n\n\t\t// Parse an CSS-syntax color. Outputs an array [r, g, b]\n\t\t// Match #aabbcc\n\t\tif (match = /#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(shadow)) {\n\t\t\tcolor = [parseInt(match[1], 16), parseInt(match[2], 16), parseIn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the height of the nav overlay to open
function openNav() { document.getElementById("navOverlay").style.height = "100%"; }
[ "function closeNav() {\n document.getElementById(\"navOverlay\").style.height = \"0\";\n}", "function updateNav(){\n\t\tvar windowHeight = window.innerHeight;\n\t\t$('.nav-list-wrapper').css({'height': windowHeight});\n\t}", "function updatePrimaryNavHeight() {\n const {top} = $.one('.mh-frame__inner').getB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
alert(document.getElementById(cur_slide_number[idn][nav_test]).className); document.getElementById("car_left_" + idn).style.visibility = "hidden"; document.getElementById("car_right_" + idn).style.visibility = "visible";
function car_click(idn,ca_lr,cr_rpt,cardir) // ca_lr 0 = prev 1 = next { if(car_rpt[idn] === "true") { document.getElementById("car_left_" + idn).style.visibility = "visible"; document.getElementById("car_right_" + idn).style.visibility = "visible"; } if(car_rpt[idn] === "false") { switch(cardir) { ...
[ "startCar(){\r\n document.getElementById(\"car-img\").style.visibility = 'hidden';\r\n }", "function show() {\n document.querySelector(\"#intro\").style.display = \"none\";\n document.querySelector(\"#classResult\").style.visibility = \"visible\";\n}", "function showSliderControls(){\n\tdocument...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper class to smooth data values. It does this over a window of size 'samples'
function Smoother(samples) { this.data = new Array(); this.low = 99999999; this.high = 0; for (var i=0;i<samples; i++) { this.data.push(0); } }
[ "_smooth()\n {\n // smooth the signal & compute the average\n this._average = 0;\n for(let i = 0; i < this._bucketSize; i++) {\n this._smoothedData[i] = this._median(this._window(i));\n this._average += this._smoothedData[i];\n }\n this._average /= this._b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open the file selection dialog, and call callbackUpload when it closes.
function chooseFiles() { transferObject.chooseUploadFiles(callbackUpload); }
[ "function openUploadDialog() {\n\n var self = this;\n var doc = window.document;\n var dialogBox = self.dialogBox = $(\"<div class='ui-bizagi-component-loading'/>\");\n\n // Reset Flag\n self.isClicked = false;\n\n var buttons = {};\n\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fncSetCookie =============== Sets value for specified cookie Parameters in strName string variable containing cookie name in strValue string variable containing cookie value in intDaysToExpiration date/time variable containing date of expiration in days If omitted or null, expires the cookie at the end of the current s...
function fncSetCookie (strName, strValue, intDaysToExpiration, strPath, strDomain, blnSecure) { // Get current time/date var timToday = new Date(); // Set expiration date to now plus specified days to expiration var timExpires = new Date(); timExpires.setTime(timToday.getTime() + 1000*60*60*24*intDaysToExpir...
[ "function setCookie(strCookieName,strCookieValue,intDaysToExpire,strPath,strDomain) {\n var exdate = new Date();\n exdate.setDate(exdate.getDate() + intDaysToExpire);\n \n strCookie = strCookieName + \"=\" + escape(strCookieValue);\n strCookie += ((intDaysToExpire==null) ? \"\" : \";expires=\" + exd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Internal method to retrieve sdk instance (initialising if necessary)
function _getSdk() { if (_comapiSDK) { return Promise.resolve(_comapiSDK); } else { return COMAPI.Foundation.initialise(comapiConfig) .then(function (result) { _comapiSDK =...
[ "function init() {\n /**\n * Get API key and secret.\n */\n var auth = utils.getAuth();\n\n /**\n * Set up the SDK.\n */\n sdk.utils.setup({\n key: auth.key,\n secret: auth.secret,\n });\n\n return {\n out: out,\n sdk: sdk,\n };\n}", "getCountrSdk()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cache the rightside narrative offset.
cacheRight() { let n = $('#narrative'); this.right = n.offset().left + n.outerWidth(); }
[ "get flexRightOffset() {\n if (this.isntNumber(this.__rightOffset)) {\n this.__rightOffset = 0;\n }\n return this.__rightOffset;\n }", "get right() {\r\n return this.x + this.width;\r\n }", "get right() {\n return this.x + this.width;\n }", "get right() {\n // x is le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract currency from string $234.43 > return: $ 234.43$ > return: $ 234$ 43 > return: $
function extractCurrency(str) { return str.replace(/[0-9,\.,\,]/g, ''); }
[ "function extractCurrencyValue(str) {\n // Extract the currency value\n let money = +str.slice(1); // convert the string to a number\n return money;\n}", "function extractCurrencyValue(str) {\n return +(str.substring(1));\n}", "function extractCurrencyValue(str) {\r\n\treturn Number(str.slice(1))\r\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }