query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Bins the generated timestamp into the same itnerval set with var timeGrouping
function binTimestamp(timestamp) { timestamp = parseInt(timestamp); var divVal = null switch (timeGrouping) { case 'minute': divVal = 1000 * 60; break; case 'second': divVal = 1000; break; case 'millisecond': divVal = 1; break; default:...
[ "function bin_by_time(span) {\n return {\n func: function(datum) {\n let date = new Date(datum/1000);\n return Math.floor((date.getHours() + date.getMinutes()/60) / span);\n },\n count: 24/span\n };\n}", "joinTimestamp(splitTimestamp) {\n let nl, ns;\n let out = null;\n if (\n s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
turns icon back to gray when you click outside of the search box
function revertIconColor() { searchIcon.style.color = '#757575' }
[ "function searchIconClick() {\n searchIcon.on(\"click\", function () {\n if (toggleSearch == false) {\n searchHeader.css({\"width\": \"96%\"});\n form.css({\"width\": \"100%\"});\n formGroup.css({\"width\": \"95%\"});\n searchInput.css({\"width\": \"100%\", \"opacity\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check the current role of the comment authors and save it to comments
function checkCurrentRoleOfAuthor(comments){ return new Promise((resolve, reject)=>{ comments.forEach((comment)=>{ User.findById(comment.author.id, (err, user)=>{ if(err){ req.flash('error', "unable to retrieve comment user"); ...
[ "function checkCurrentRoleOfAuthor(blogs){\n return new Promise((resolve, reject)=>{\n blogs.forEach((blog)=>{\n User.findById(blog.author.id, (err, user)=>{\n if(err){\n req.flash('error', \"unable to retrieve blog author\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The comment submit button action
function submitComment() { submitCmt.click(function () { $(".default-cmt__content__cmt-block__cmt-box").find('.messages').hide(); if (checkGuestFormValidate()) { var cmtText = cmtBox.val(); if (cmtText.trim().length) { $('.default...
[ "function submitComment(evt) {\n evt.preventDefault();\n\n const comment = $('#comment')\n\n $.post('/community', comment, (response) => {\n $('#d-flex flex-column comment-section').append(`${response.global_comment}`);\n } )\n console.log('posted')\n}", "function submitComment(){\n\tcomment...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get an identifier for a layer that can be used in a target= option (returns name if layer has a unique name, or a numerical id)
function getLayerTargetId(catalog, lyr) { var nameCount = 0, name = lyr.name, id; catalog.getLayers().forEach(function(o, i) { if (lyr.name && o.layer.name == lyr.name) nameCount++; if (lyr == o.layer) id = String(i + 1); }); if (!id) error('Layer not found'); return name...
[ "function getID(layer)\n{\n\treturn layer.url ? layer.id : layer.id;\n}", "function getID(layer)\n{\n\treturn layer.url ? layer.id : layer.featureCollection.layers[0].id;\n}", "function getID(layer)\r\n\t\t\t{\r\n\t\t\t\treturn layer.url ? layer.id : layer.id;\r\n\t\t\t}", "function getLayerIdFromAnchorName(n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the JSON Schema version number that corresponds to the Swagger/OpenAPI version number
function getJsonSchemaVersionNumber ({ swagger, openapi }) { if (swagger && swagger.startsWith("2.0")) { // Swagger 2.0 uses JSON Schema Draft 4 return "draft-04"; } else if (openapi && openapi.startsWith("3.0")) { // OpenAPI 3.0 uses JSON Schema Wright Draft 00 (a.k.a. Draft 5). // This library d...
[ "schemaVersion() {\r\n if (this.getType().indexOf(\":\") == -1)\r\n return 1;\r\n return 2;\r\n }", "function getSchemaVersion (obs) {\n if (obs.schemaVersion) return obs.schemaVersion\n if (typeof obs.device_id === 'string' &&\n typeof obs.created === 'string' &&\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler to remove note from a group
function removeNoteFromGroup(userId, groupId, noteId, done) { logger.info("Inside service method - remove note from a group"); groupsDao.removeNoteFromGroup(userId, groupId, noteId, done); }
[ "function removeNote(){}", "function removeNote(e) {\n div_id = e.path[2].id;\n if (div_id !== 'data') {\n // do not delete the entire data element accidentally due to html image glitches.\n document.getElementById(div_id).remove();\n save_notes();\n loadN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Task 1 format a name and email address into the following String format:
function formatEmailAddress(name, email) { return name + ' <' + email + '>'; }
[ "function buildEmailAddressString(address) {\r\n return address.displayName + \":\" + address.emailAddress + \";\";\r\n }", "function buildEmailAddressString(address) {\n return address.displayName;\n }", "function my_email(x,y){return x+\".\"+y+\"@evolveu.ca\"}", "function buildEmailAddressStri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the PR info (labels and body) to the commit
async addPrInfoToCommit(commit) { const modifiedCommit = Object.assign({}, commit); if (!modifiedCommit.labels) { modifiedCommit.labels = []; } if (modifiedCommit.pullRequest) { const [err, info] = await await_to_js_1.default(this.git.getPr(modifiedCommit.pullRequ...
[ "async addPrInfoToCommit(commit) {\n const modifiedCommit = Object.assign({}, commit);\n if (!modifiedCommit.labels) {\n modifiedCommit.labels = [];\n }\n if (modifiedCommit.pullRequest) {\n const info = await this.git.getPr(modifiedCommit.pullRequest.number);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apertura modal approvazione appunto e recupero codice argomento e appunto selezionati
function openModalApprovaAppunto(btn) { idAppunto = parseInt($(btn).attr("id").split('_')[$(btn).attr("id").split('_').length - 1]); idArgomento = parseInt($(btn).attr("id").split('_')[$(btn).attr("id").split('_').length - 2]); $("#contModale").text("Sei sicuro di voler accettare questo allegato?"); $("...
[ "function abrirModalPrato(tipo, prato, preco, quantPrato){\r\n\t\r\n\tmodalPratoTitle.innerText = tipo;\r\n\tlet html = \"<p>\"+prato+\"</p>\";\r\n\thtml += \"<p>R$ \"+preco+\"</p>\";\r\n\tmodalPratoInfo.innerHTML = html;\r\n\tquantidade.value = quantPrato;\r\n\tmodalPrato.modal('show');\r\n}", "function openModa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read ARP Cache (/opt/net/arp)
readARP() { try { var content = fs.readFileSync(ARP_FILE, 'utf8'); return content .split(os.EOL) .map((line) => { let ip = findPattern(IPV4, line); if (!ip) return null; let mac = findPattern(MAC,...
[ "function arpAll () {\n return cp.exec('arp -a').then(parseAll)\n}", "function arpOne (address) {\n return cp.exec('arp -n ' + address).then(parseOne)\n}", "getElementsFromArpTable() {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const promise = new Promis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saves standups to db
function saveStandUp(standUpDetails) { repos.userStandupRepo.add(standUpDetails); }
[ "saveStandup(standupDetails) {\n AppBootstrap.userStandupRepo.add(standupDetails);\n }", "function saveToDatabase() {\n idb.add(dbKeys.stations, JSON.stringify(stationList));\n idb.add(dbKeys.lastFrequency, lastFrequency);\n }", "function saveStandup(room, time) {\n var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pauses / resumes the game when "Escape" is pressed
function Update () { if (Input.GetKeyUp(KeyCode.Escape)) { if (paused == false) { PauseGame(); } else { ResumeGame(); } } }
[ "function Update () {\r\n\tif (Input.GetKeyUp(KeyCode.Escape)) {\r\n\t\tif (paused == false) {\r\n\t\t\tPauseGame();\r\n\t\t} else {\r\n\t\t\tResumeGame();\r\n\t\t}\r\n\t}\r\n}", "function Update () {\n if (Input.GetKeyUp(KeyCode.Escape)){\n pause();\n }\n}", "function pauseByESC() {\r\n window.on...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the distances in AP from (from_x, from_y) to (places[i][1], places[i][2]) and put it into places[i][3] Then sort places by increasing distance
function sort_places(from_x, from_y, places) { // {{{ function dist_sort(e1, e2) { return e1[3] - e2[3]; } for (var i = 0 ; i < places.length; ++i) { places[i][3] = distance_AP(from_x, from_y, places[i][1], places[i][2]); } places.sort(dist_sort); // }}} }
[ "function sortByDistance()\n {\n Places.sort(function(a,b)\n {\n return a.distance-b.distance;\n });\n }", "function orderedPlaces(places) {\n var arr = [];\n for (var i = 0; i < places.length; i++) {\n arr.push(places[i].object_form());\n }\n var ordArr = [];\n var pairs = [];\n fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a function to be run before processing spans Conservatively, this function works even if called after MAJAX has completed loading and has already processed the spans once.
function majaxRunBeforeSpanProcessing(func) { if (majax !== undefined && majax.loaded) { func(); majaxProcessSpans(); } else { majaxLoadHandlers.push(func); } }
[ "onStart(span, _) {\n span.setAttribute('service_name', span.resource.attributes['service.name']);\n span.setAttribute('honeycomb.trace_type', 'otel');\n otelTraceBase.SimpleSpanProcessor.prototype.onStart.call(this, span);\n }", "function setBeforeStart(fn) {\n beforeStart = fn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funzione per il controllo della selezione dell'abbonamento cena
function ControlloAbbonamentoCena() { var i; var AbbonamentoCena = document.getElementById("AbbonamentoCena"); var Iscrizione = document.getElementById("Iscrizione"); if (!Iscrizione.checked && AbbonamentoCena.checked) { alert("Non è possibile registrare l'abbonamento alle cene senza l'isc...
[ "function vendiCasa(){\n //verifico che il terreno esista e salvo il risultato in proprietà\n var n = EsisteTerreno(props.terreni, terreno);\n if(n === -1){\n setTestoVenditaEdifici('Controlla che il nome del terreno sia scritto in modo corretto');\n setOpenVenditaEdifici(true); \n return;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate peer identity keypair + transform to desired format + add to config.
function generateAndSetKeypair() { var keys = peerId.create({ bits: opts.bits }); config.Identity = { PeerID: keys.toB58String(), PrivKey: keys.privKey.bytes.toString('base64') }; writeVersion(); }
[ "function generateAndSetKeypair () {\n var keys = peerId.create({\n bits: opts.bits\n })\n config.Identity = {\n PeerID: keys.toB58String(),\n PrivKey: keys.privKey.bytes.toString('base64')\n }\n\n writeVersion()\n }", "function genKeyPair() {\n\n generateKeyPai...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get our information from the info sheet The only fields applicable are the api key, region, summoner name, season, summoner id, and check duoer
function getInfo(value) { var s = SpreadsheetApp.getActiveSpreadsheet(); var sheet = s.getSheetByName('Configuration'); if(value == 'api_key') { return sheet.getRange('B1').getValue(); } if(value == 'region') { return sheet.getRange('B2').getValue(); } if(value == 'summoner_name') { return she...
[ "async getAllInfoBySummonerName() {\n try {\n let temp = {};\n // First get basic summoner data by summoner name, update temp\n const summonerInfoByName = await this.getSummonerBySummonerName();\n temp = { ...temp, ...summonerInfoByName };\n\n // Then ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resizes a tab strip element.
_resize(event) { const that = this; if (!that._resizing) { return; } const orientationSettings = that._orientationSettings, sizeChange = event[orientationSettings.coordinate] - that._resizeFrom, customElement = that._getCorrespondingCustomElement(tha...
[ "function setElementsSize_hor() {\n\t\t\n\t\t// get strip height\n\t\tvar stripHeight = g_objStrip.getHeight();\n\t\tvar panelWidth = g_temp.panelWidth;\n\n\t\t// set buttons height\n\t\tif (g_objButtonNext) {\n\t\t\tg_objButtonPrev.height(stripHeight);\n\t\t\tg_objButtonNext.height(stripHeight);\n\n\t\t\t// arrang...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getMode Returns the current editor's mode.
getMode() { return this.mode; }
[ "function mode() {\n var value = (attr.mdMode || \"\").trim();\n if ( value ) {\n switch(value) {\n case MODE_DETERMINATE:\n case MODE_INDETERMINATE:\n case MODE_BUFFER:\n case MODE_QUERY:\n break;\n default:\n value = undefined;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks Function to check if the active shape is at the bottom
checkBottom(y) { return !( y + this.activeshape[this.rotation][0].y >= this.canvasheight / this.blockSize || y + this.activeshape[this.rotation][1].y >= this.canvasheight / this.blockSize || y + this.activeshape[this.rotation][2].y >= this.canvasheight / this.blockSize || ...
[ "isAtViewBottom(){\n let body = document.getElementById(`sheet-${this.sheet.props.id}-body`);\n let bottomRow = body.lastChild;\n let cornerElement = bottomRow.lastChild;\n return this.selectionFrame.corner.y === parseInt(cornerElement.dataset[\"y\"]);\n }", "function checkBaseline(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if a command has been restricted in that guild
function isRestrictedCommand(str_command, guild){ const specs = utils.getSpecifics(guild); if (specs.restricted.indexOf(str_command) > -1){ return true; } return false; }
[ "function restrictCommand(author, str_command, guild){\r\n\tlet specs = utils.getSpecifics(guild);\r\n\tif (!isRestrictedCommand(str_command, guild)){\r\n\t\tspecs.restricted.push(str_command);\r\n\t}\r\n\tutils.writeSpecifics(guild, specs);\r\n\treturn sendRestrictions(author, guild);\r\n}", "function canControl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method :: setServiceSteps Desc :: Sets components steps for stepzila to create and update service data
setServiceSteps() { const steps = [ { name: 'Create', component: <MlServiceCardStep1 data={this.state.data} />, icon: <span className="ml my-ml-add_tasks"></span> }, { name: 'Select Tasks', component: <MlServiceCardStep2 data={this.state.data} opti...
[ "setServiceSteps() {\n let canStatusChange = (this.state.serviceBasicInfo.isLive || this.state.serviceBasicInfo.isApproved ) && FlowRouter.getQueryParam(\"id\") ;\n const {\n serviceBasicInfo,\n daysRemaining,\n clusterCode,\n clusters,\n clusterName,\n serviceTermAndCondition,\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all items of the DockingLayout that have been undocked
get undockedItems() { const that = this; if (!that.isReady) { return; } const tabsWindows = document.getElementsByTagName('jqx-tabs-window'); let undockedWindows = []; for (let i = 0; i < tabsWindows.length; i++) { if (!tabsWindows[i].closest('j...
[ "get undockedItems() {\n const that = this;\n\n if (!that.isReady) {\n return;\n }\n\n const tabsWindows = document.getElementsByTagName('smart-tabs-window');\n let undockedWindows = [];\n\n for (let i = 0; i < tabsWindows.length; i++) {\n if ((!tabsWi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if search param contains RFE collection
function isRFE() { var exists = false; if ($location.search().kind) { if ($location.search().kind.indexOf('RFE') > -1) { exists = true; } } return exists; }
[ "containsSearchTermMatch (searchTerm) {\n let contains = false\n this.models.forEach((model) => {\n if (model.matchesSearchTerm(searchTerm)) {\n contains = true\n }\n })\n return contains\n }", "function checkSearch(req) {\n\n\t\tlet searchParam = req.query.s\n\n\t\treturn searchPara...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HELPER FUNCTIONS function that gets all questions for a given category, difficulty, startdate, and enddate
function getAllQuestions(category, difficulty, startDate, endDate, res) { category = category.toLowerCase(); let questions = []; let promises = []; let categories = categoryCache.getCategories(); for (let i = 0; i < categories.length; i ++) { let currCategory = categories[i].category.toLowe...
[ "async function getQuestionsById(id, category, difficulty, startDate, endDate) {\n\n return new Promise(resolve => {\n let questions = [];\n let url = \"http://jservice.io/api/category?id=\" + id;\n fetch(url)\n .then(response => response.json())\n .then(data => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to check conditions of multiple ORs in one if condition Can be used to check even one OR Comparision is strongly typed Eg: if(task.taskType ===STRING_NORMAL || task.taskType === FULL_KIT || task.taskType === MILESTONE ) if(multipleORs(task.taskType,STRING_NORMAL,FULL_KIT,MILESTONE))
function multipleORs(){ var args =arguments; if(_.rest(args).indexOf(_.first(args)) !== -1) return true; else return false; }
[ "function testLogicalOr(val) {\n if (val < 10 || val > 20) {\n //|| = OR\n return \"outside\";\n }\n return \"inside\";\n}", "function isAcceptedByConditionsJoinType(value, conditions, type) {\n\t\tvar condition;\n\n\t\tif (conditions && conditions.length) {\n\t\t\tfor (var i in conditions) {\n\t\t\t\tco...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set position y target object to center of window
function __setCenterY(target) { target.position.y = __getCenterY(target); return target; }
[ "set TopCenter(value) {}", "function setPosition() {\n\tconst bounds = mainTray.getBounds();\n\tconst { x, y } = bounds;\n\tmainWindow.setPosition(x - (mainWidth / 2), y - mainHeight);\n}", "function centerViewportOn(Crafty, target, time) {\r\n\t\tvar worldTargetCenter = {\r\n\t\t\tx: target.x + target.w / 2,\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a slug from the category name. Spaces are replaced by "+" to make the URL easier to read and other characters are encoded.
function getCategorySlug(name) { const encodedName = name; return encodedName .split(' ') .map(encodeURIComponent) .join('+'); }
[ "function getCategorySlug(name) {\n return name.split(' ').map(encodeURIComponent).join('+');\n } // Returns a name from the category slug.", "function getCategorySlug(name) {\n return name\n .split(' ')\n .map(encodeURIComponent)\n .join('+');\n }", "function getCategorySlug(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
objCountry =============== Constructor function for country object Parameters in strName Country name instrValue Cookie value used for storing country instrRegion Region in which the country is a part of instrURL URL of Homepage specific for country/language Return value
function objCountry (strName, strValue, intRegion, strURL) { this.name = strName; // Country name this.value = strValue; // Cookie value used for storing country this.region = gobjRegionArray[intRegion]; // Region in which the country is a part of this.language = new Array(); // Language array this.lang...
[ "function objLanguage (strName, strValue, strURL)\r\n{\r\n\tthis.name = strName\t\t\t// Names of language used in country\r\n\tthis.value = strValue\t\t\t// Cookie value of language used in country\r\n\tthis.url = strURL\t\t\t// URL for language-specific homepage\r\n}", "function Country(countryName, countryPopul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get TreeNode props with Tree props.
function getTreeNodeProps(key, _ref3) { var expandedKeysSet = _ref3.expandedKeysSet, selectedKeysSet = _ref3.selectedKeysSet, loadedKeysSet = _ref3.loadedKeysSet, loadingKeysSet = _ref3.loadingKeysSet, checkedKeysSet = _ref3.checkedKeysSet, halfCheckedKeysSet = _ref3.halfCheckedKeysSet, dragOv...
[ "function getTreeNodeProps(key, _ref3) {\n\t var expandedKeys = _ref3.expandedKeys,\n\t selectedKeys = _ref3.selectedKeys,\n\t loadedKeys = _ref3.loadedKeys,\n\t loadingKeys = _ref3.loadingKeys,\n\t checkedKeys = _ref3.checkedKeys,\n\t halfCheckedKeys = _ref3.halfCheckedKeys,\n\t drag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the Param metadata. Use this decorator to compose your own decorator.
function ParamFn(fn) { return (target, propertyKey, index) => { if (core.decoratorTypeOf([target, propertyKey, index]) === core.DecoratorTypes.PARAM) { fn(exports.ParamMetadata.get(target, propertyKey, index), [target, propertyKey, index]); } }; }
[ "function ctorParameterToMetadata(param, isCore) {\n // Parameters sometimes have a type that can be referenced. If so, then use it, otherwise\n // its type is undefined.\n var type = param.typeExpression !== null ? param.typeExpression : ts.createIdentifier('undefined');\n var propertie...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Downloads all new posts from saved urls TODO: Download only pages that have not been fully downloaded yet.
function downloadPosts(){ chrome.storage.local.get("urls", function(result){ result = result["urls"]; result = (result === undefined ? {} : result); //Variables to define: let pageTotal = 0; let loadingBar = document.getElementById("loadingBar"); let toDownload = {}; //Stores num to download in key-valu...
[ "function fetchPosts() {\n // Exit if postURLs haven't been loaded\n if (!postURLs) return;\n\n isFetchingPosts = true;\n\n // Load as many posts as there were present on the page when it loaded\n // After successfully loading a post, load the next one\n var loadedPosts = 0,\n postCount = $...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes the leave command to the command parameter fed to this function Expects this.commandParameters to be set prior to calling this function
ProcessLeaveChangeCommand() { var newYtLink = this.commandParameters[0]; this.leaveLink = newYtLink; var msg = 'Leave audio changed to the link: ' + newYtLink; this.ReplyToMessage(msg); }
[ "endCommand() {\n this.activeCommand = null;\n this.state = {};\n }", "function leaveBuilding() {\n inBuilding.inside = false;\n var eventObject = {\n \"event\": \"\",\n \"description\": \"\",\n \"image\": naratorImg\n };\n eventObject.event = \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
push our new position to the positionContainer
pushPosition(position) { this.positionContainer.push(position); }
[ "updatePosContainerPositions() {\n const chart = this.chart;\n // If exporting, don't add these containers to the DOM.\n if (chart.renderer.forExport) {\n return;\n }\n const rendererSVGEl = chart.renderer.box;\n chart.container.insertBefore(this.afterChartProxyP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a path, which can be a directory or file, will return a located adapter path or will throw.
function resolveAdapterPath(inboundAdapterPath) { var outboundAdapterPath = undefined; // Try to open the provided path try { // If we're given a directory, append index.js if (_fs2['default'].lstatSync(inboundAdapterPath).isDirectory()) { // Modify the path and make sure the modified path exists...
[ "function getCustomAdapter(projectRoot, adapterName)\n{\n let adapter, adapterFile;\n\n if (adapterName.match(path.sep))\n {\n try\n {\n return require(path.resolve(`${projectRoot}/${adapterName}`));\n }\n catch (e)\n {}\n }\n else\n {\n try\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return object containing different Leaflet layers
function getLayers(options) { var layers = {}; // Set layer types to return // Defaults to return only `streets` layer options = angular.merge({ streets: true, satellite: false, outdoors: false }, options || {}); // Streets if(options.streets && isMap...
[ "function buildLeafBaseLayers() {\n\n\t\t// Create the default layers\n\t\tstreetMapLayer = L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {\n\t\t\tattribution: 'Imagery from <a href=\"http://mapbox.com/about/maps/\">MapBox</a> &mdash; Map data &copy; <a href=\"http:/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Variablelength FizzBuzz with arrays: Write a function which prints out the numbers mn with substitutions of: each element of the numbers array replaced by the element at the same index of the terms array. e.g., to mimic the behavior of fizzBuzz1, you would call the function like so: fizzBuzz4(1,100,[3,5],['fizz','buzz'...
function fizzBuzz4(m,n,numbers,terms){ }
[ "function superFizzBuzz(array){\n for (var i = 0 ; i < array.length; i++){\n if (array[i] % 15 === 0 ){\n array[i] = \"FizzBuzz\"; }\n else if (array[i] % 5 === 0 ){\n array[i] = \"Buzz\"; }\n else if(array[i] % 3 === 0 ){\n array[i] = \"Fizz\"; }\n else {\n array[i];\n };\n };\n return array\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
===== Mobile marker menu =====
function showMarkerMenu() { state.set({ marker_menu_open: true }); }
[ "function markerMenu(event, ATMId) {\n var x = event.pageX;\n var y = event.pageY;\n $(\"#defaultMarkerMenu\").attr(\"atmid\", ATMId);\n $(\"#defaultMarkerMenu\")\n .css({top: y + \"px\", left: x + \"px\"})\n .show();\n}", "function lm() {\n var locationsMenu = new UI.Menu({\n sectio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
traversal algorithms Breadthfirst search / Starting from one node and checks for all child nodes. Then checks all child nodes of these nodes and so on... until we find the node we are searching for.Layer by layer.
bfs (firstNode, searchedNode) { const queue = [firstNode] // queue ds const visited = {} // obj(or Map) stores all the visited nodes while (queue.length) { let current = queue.shift() // we check if the current Node is visited if (visited[current]) { continue } // we...
[ "traverseBreadthFirst(callback)\n {\n\t\t\n\t\tvar queue = new Queue();\n\t \n\t\tqueue.enqueue(this._root);\n\t \n\t\tlet currentNode = queue.dequeue();\n\t\twhile(currentNode){\n\t\t\tfor (var i = 0, length = currentNode.next.length; i < length; i++) {\n\t\t\t\tqueue.enqueue(currentNode.next[i]);\n\t\t\t}\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MultiplexClient sits on top of a SockJS connection and lets the caller open logical SockJS connections (channels). The SockJS connection is closed when all of the channels close. This means you can't start with zero channels, open a channel, close that channel, and then open another channel.
function MultiplexClient(sockjsUrl, whitelist) { // The URL target for our SockJS connection(s) this._sockjsUrl = sockjsUrl; // The whitelisted SockJS protocols this._whitelist = whitelist; // Placeholder for our SockJS connection, once we open it. this._conn = null; // A table of all active...
[ "function MultiplexClient(conn) {\n // The underlying SockJS connection. At this point it is not likely to\n // be opened yet.\n this._conn = conn;\n // A table of all active channels.\n // Key: id, value: MultiplexClientChannel\n this._channels = {};\n this._channelCount = 0;\n // ID to use...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the score of a comparison with another subject by taking the Manhattan, or L_1 distance between the vectors. When the `weights` property is on, the method returns a weighted version of the L_1 distance.
function compareWithSubject(subject, subjectToCompare) { var returnValue = 0.0 if(!weighted) { for (index = 0; index < subjectToCompare.length; index++) { var valueToAccumulate = subject[index] - subjectToCompare[index] // Get absolute values if (valueToAccumulate < 0) valueToAccumulate *= -1 returnValu...
[ "function weightedDistanceMatching(poseVector1, poseVector2) {\n const vector1PoseXY = poseVector1.slice(0, 34);\n const vector1Confidences = poseVector1.slice(34, 51);\n const vector1ConfidenceSum = poseVector1.slice(51, 52);\n\n const vector2PoseXY = poseVector2.slice(0, 34);\n\n // First summation\n const ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The bigger of the two totals are taken unless, the biggertotal is greater than 21, the chosen total is display in the game area
function biggerTotal(hand) { if (hand.firsttotal < hand.secondtotal && hand.secondtotal <= 21) { hand.total = hand.secondtotal; } else { hand.total = hand.firsttotal; } playerscore.innerHTML = playerHand.total; dealerscore.innerHTML = dealerHand.tot...
[ "function evaluateDealerTotal(){ \n displayDealerFirstCard(); \n if (dealer.total > 21){\n $(\"#instructions\").text(dealer.name + \" busts\")\n winMonies();\n }else if (dealer.total < 17){ //if the dealer's total is under 17, they have to take cards until they are over ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if O wins,it has an array and a number as parameters
function checkO(array,i){ var wincombo=[[],[],[],[],[],[],[],[]]; wincombo[0]=[document.getElementById("1"),document.getElementById("2"),document.getElementById("3")]; wincombo[1]=[document.getElementById("4"),document.getElementById("5"),document.getElementById("6")]; wincombo[2]=[document.getElementById("7"),doc...
[ "function isO(piece){ return piece == 1 || piece == 2;}", "function arrCheck (a){\n if ((a[0]===1 || a[1]===1)||(a[0]===3 || a[1]===3)){\n return \"yes it is\"\n } else {\n return \"No its not\"\n }\n}", "function checkNoArrays(checkPlayer,t,s)\n{\n\tswitch(t)\n\t{\n\t\tcase \"suspect\":\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a unique version number 20140816a4d4bd9f
function createVersionNumber() { return new Date().toJSON().slice(0, 10) + '--' + uniqueId(); }
[ "createVersion(){\n return \"key-\"+Math.floor(Date.now() / 1000);\n }", "versionNumber () {\n let release = this.release();\n if (release) {\n return release.versionNumber\n }\n }", "get version() {\n return crypto_1.createHash('md5').update(JSON.stringify(this.manifest())).dige...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HW470: Cylinder derivative function
function cylinderDerivative(t) { return 0 }
[ "function derivative(x, coefficients)\n{\n\tvar sum = 0;\n\tfor (i = POLY_DEG - 1; i >= 0; i--)\n\t{\n\t\tsum += (i + 1) * Math.pow(x, i) * coefficients[POLY_DEG - 1 - i];\n\t}\n\treturn sum;\n}", "function derivative(f){\n return function(x){\n return (f(x+.01)-f(x)) / .01\n }\n}", "function deriv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method Name: backShadowExp Function : to reset the widget from the shadow view
function backShadowExp() { kony.print("\n**********in backShadowExp*******\n"); frmHome.show(); //"shadowDepth" : Represents the depth of the shadow in terms of dp. //As the shadow depth increases, widget appears to be elevated from the screen and the casted shadow becomes soft frmShodowView.flxShadow.shadowD...
[ "deactivate() {\n this.context.shadowOffsetX = undefined;\n this.context.shadowOffsetY = undefined;\n this.context.shadowColor = undefined;\n this.context.shadowBlur = undefined;\n this.isActive = false;\n }", "function shadowExp()\n{\n kony.print(\"\\n**********in shadowExp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sends the chat message to the server
function sendMessage() { var message = data.value; data.value = ""; // tell server to execute 'sendchat' and send along one parameter socket.emit('sendchat', message); }
[ "function sendMessage() {\n let message = data.value;\n data.value = \"\";\n // tell server to execute 'sendchat' and send along one parameter\n socket.emit(\"sendchat\", message);\n }", "function sendMessage() {\n let message = data.value;\n data.value = \"\";\n // tell server to execute 'sendcha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
code TODO: contactarCtrl | controller_by_user controller by user
function controller_by_user(){ try { } catch(e){ console.log("%cerror: %cPage: `contactar` and field: `Custom Controller`","color:blue;font-size:18px","color:red;font-size:18px"); console.dir(e); } }
[ "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page form_contact_us => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page faq_singles => cus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This DFT verifies an update in PPT Name as direct PPT name verification is covered in BVTS
function VerifySharedPPTName() { LogMessage("DataCollabTest :: VerifySharedPPTName"); var selfDisplayName = GetTestCaseParameters("DisplayName1"); var presenterName = GetBuddyDisplayName(0); var pptName1 = GetPPTName(); var pptName2 = GetPPTName(); //Share PPT from Bot GotoMyInfo(); SetNote(...
[ "function VerifyPPTPresenterName()\n{\n LogMessage(\"DataCollabTest :: VerifyPPTPresenterName\");\n var selfDisplayName = GetTestCaseParameters(\"DisplayName1\");\n var presenterName1 = GetBuddyDisplayName(0);\n var presenterName2 = GetBuddyDisplayName(1);\n \n //Share PPT from Bot\n GotoMyInfo();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return an array of all US IRS campus prefixes
function enUsGetPrefixes() { var prefixes = []; for(var location in enUsCampusPrefix)// https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes // istanbul ignore else if (enUsCampusPrefix.hasOwnProperty(location)) prefixes.push.apply(prefixes...
[ "function enUsGetPrefixes() {\n var prefixes = [];\n\n for (var location in enUsCampusPrefix) {\n // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes\n // istanbul ignore else\n if (enUsCampusPrefix.hasOwnProperty(location)) {\n pre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function : SimpleGlyph / comment : Stores raw, xMin, yMin, xMax, and yMax values for this glyph.
function SimpleGlyph(raw, numberOfContours, xMin, yMin, xMax, yMax) { this.raw = raw; this.numberOfContours = numberOfContours; this.xMin = xMin; this.yMin = yMin; this.xMax = xMax; this.yMax = yMax; this.compound = false; }
[ "function SimpleGlyph(raw, numberOfContours, xMin, yMin, xMax, yMax) {\n this.raw = raw;\n this.numberOfContours = numberOfContours;\n this.xMin = xMin;\n this.yMin = yMin;\n this.xMax = xMax;\n this.yMax = yMax;\n this.compound = false;\n }", "function Compou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets timer on or off when play/pause button is pressed and starts session (displays countdown)
function playPause() { setSession(true); setIsTimerRunning((prevState) => !prevState); }
[ "function startCountDown(){\n playing = true;\n finished = false;\n if(paused===true){\n paused = false;\n countDown('remain');\n }\n else{\n countDown('session');\n }\n}", "function startTimer() {\n minutes = times.sessionMinutes;\n seconds = minutes * 60;\n docume...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a variable size (height) from given index.
getVarSize(index, nocache) { const { delta, variable, item } = this; const cache = delta.varCache[index]; if (!nocache && cache) { return cache.size; } if (typeof variable === 'function') { return variable(index) || 0; } // when using item, it can only get curre...
[ "getSizeAt(index) {\n return this.sizesCache[index + 1] - this.sizesCache[index];\n }", "getHeightForWhitespaceIndex(index) {\n this._checkPendingChanges();\n index = index | 0;\n return this._arr[index].height;\n }", "_getItemSize(idx) {\n return {\n [t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2.Get the tens of a number having 3 digits
function getTheTensNumber(n) { if (n.toString().length !== 3) return -1; return Math.trunc(n / 10) % 10; }
[ "function smallestThreeDigit(t) {\r\n\tvar result\r\n\tfor (var i=9; i>=0; i--) {\r\n\t\tfor (var j=9; j>=0; j--) {\r\n\t\t\tfor (var k=9; k>=0; k--) {\r\n\t\t\t\tif (i*j*k === t)\r\n\t\t\t\t\tresult = i*100 + j*10 + k\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn result\r\n}", "function extractDigit3(num,digitNum) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Is Unique Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures? Solution 1: create a set and loop through the string. Check if character exists in set. If yes, return false. If not, add character. Time: O(N) Additional Space: O(N)
function isUnique1(string){ let charsSet = new Set(); for(let i = 0; i < string.length; i++){ if(charsSet.has[string[i]]){ return false; } else { charsSet.add[string[i]]; }; return true; } }
[ "function isUnique(s) {\n // assuming only lowercase characters; can be changed to suit other character combinations\n if (s.length > 26) {\n return false\n }\n let charSet = new Set([])\n for (var i=0; i<s.length; i++) {\n if (charSet.has(s[i])) {\n return false\n } else {\n charSet.add(s[i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stores host binding fn and number of host vars so it will be queued for binding refresh during CD.
function queueHostBindingForCheck(tView,def,hostVars){ngDevMode&&assertEqual(getFirstTemplatePass(),true,'Should only be called in first template pass.');var expando=tView.expandoInstructions;var length=expando.length;// Check whether a given `hostBindings` function already exists in expandoInstructions, // which can h...
[ "function allocHostVars(count) {\n var lView = Object(render3_state.m)(), tView = lView[interfaces_view.s];\n tView.firstTemplatePass && (function(tView, def, hostVars) {\n var expando = tView.expandoInstructions, length = expando.length;\n // Check whether a give...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
count the nonnull elements in an array
function countNonEmpty(array) { return array.filter(Boolean).length; }
[ "function arrayLengthWithoutNull(array) {\n var length = 0;\n for (var i=0; i<array.length; i++) {\n if (array[i])\n length++;\n }\n return length;\n}", "function _countMissing(array) {\n\t return array.length - _.without(array, undefined, null).length;\n\t }", "function countT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a promise for response trailers from the mock data.
promiseTrailers() { var _a; const trailers = (_a = this.data.trailers) !== null && _a !== void 0 ? _a : TestTransport.defaultTrailers; return trailers instanceof RpcError ? Promise.reject(trailers) : Promise.resolve(trailers); }
[ "fetchWaitTimes() {\n return new Promise(((resolve, reject) => {\n // request challenge string\n this.http({\n method: 'POST',\n url: `${this.constructor.apiBase}/queue-times`,\n headers: {\n connection: 'Keep-Alive',\n },\n }).then((data) => {\n if (!da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
called when a student presses the submit button on the home page if input was given, create the questions popup, otherwise display error
function submitQuestion() { var input = document.getElementById("questionInput").value || null; var error = document.getElementById("questionError"); if (input) { error.style.display = "none"; //hide error message createPopup(); //the button to proceed with posting the question var continueB = popupVeri...
[ "function changeToCreateQuestions () {\n const basicInformationQuizz = savingBasicQuizzInformation();\n let numCharOk;\n let urlOk;\n let nQuestionsOk;\n let nLevelsOk;\n \n if (basicInformationQuizz.title.length >= 20 && basicInformationQuizz.title.length <= 65) {\n numCharOk = true;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
searchByProfessions : given an array of professions , this method tries to search it in the data store. param professionSearch : the array of values to search return itemId : the id of the first item found or item_not_found in other case.
searchByProfessions( professionSearch ) { let itemId = this.ItemNotFound; let list = this.state[this.townName]; for( let indx=0; indx<list.length; ++indx ) { for( let indxProf=0; indxProf<list[indx].professions.length; ++indxProf ) { if( list[indx].professions[indxProf...
[ "function ItemsSearch(proc, callback) {\n\tvar tab=[];\n\t// loop on the procs list\n\tproc.forEach(function(p) {\n\t\t// for each proc we search info in mongodb\n\t\titemOneSearch(p,function(ret) {\n\t\t\ttab.push(ret);\n\t\t\t// return of the outcomes when it is fully filled\n\t\t\tif (tab.length == proc.length)\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset the log handlers to the default ones.
resetLogHandlers() { this[logHandlersSymbol] = [this.defaultLogHandler]; this.initializeLogHandlers(); }
[ "initializeLogHandlers() {\n this.removeAllListeners();\n this[logHandlersSymbol].forEach((handler) => {\n this.on('log', handler);\n });\n }", "function resetLogger() {\n globalLogManager = new DefaultLogManager();\n globalLogLevel = models.LogLevel.NOTSET;\n }", "function reset...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fixes the position of adjacent tiles after a resize event ui > the ui element from the resize event TODO: if the n handle of the top element is pulled, move it back. same for w of left, s of bottom, e of right
function resizeFixup(ui){ var resizeId = ui.element.attr('id'); //which direction did it resize? if(resizeDir == 'n'){ var diff = virtical_location(ui.originalPosition.top, 0) - virtical_location(ui.helper.position().top, 0); if(diff <= 0 && parseInt(ui.element.attr('row')) <= 1){ //the tile is at...
[ "function positionFixup(){\n\t\tfor (var i = tiles.length - 1; i >= 0; i--) {\n\t\t\tvar layout = returnBalanced(maxCols, maxHeight);\n\t\t\tvar t = $('#'+tiles[i]);\n\t\t\tt.attr({\n\t\t\t\t'row': layout[tiles.length-1][i].row(maxHeight),\n\t\t\t\t'col': layout[tiles.length-1][i].col(maxCols),\n\t\t\t\t'sizex': la...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to control the pages to slide arg: 1 | 1 1 slide up 1 slide down
function pageSlide(arg){ if(isReachBoundary(arg)){ return false; } var page_height = $(".fullPage").eq(0).height(); var pre_top = parseInt($(".fullPage-Container").css("top")); _index -= arg; var callback = $(".fullPage").eq(_index).attr("inView"); return...
[ "function nextslide() {if(current==total_slides){current = 1}else{current++} check_slide();}", "function slideIn(callback) {\n setX(upperPage(), 0, slideOpts(), callback);\n }", "function turnPageSlider() {\n leftPageNo = _getSliderPage();\n rightPageNo = leftPageNo + 1;\n _updateUrlPage(); /* Causes ini...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a number to superscript.
toSuperscript(value, supToNormal) { const chars = '-0123456789', sup = '⁻⁰¹²³⁴⁵⁶⁷⁸⁹'; let result = ''; for (let i = 0; i < value.length; i++) { if (supToNormal === true) { const m = sup.indexOf(value.charAt(i)); result += (m !== -1 ? char...
[ "function superscript(n) {\r\n\tvar s = n.toString();\r\n\tvar out = '';\r\n\tfor(var i=0;i<s.length;i++) {\r\n\t\tout += superscript_numbers[s[i]];\r\n\t}\r\n\treturn out;\r\n}", "exponentialToSuperscript(exponentialValue) {\n const indexOfE = exponentialValue.indexOf('e'),\n power = exponentia...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the newest datetime as a string
function newest(files) { const dates = extractDates(files); const newest = String(Math.max.apply(null, dates)); return newest; }
[ "async getLastSyncedDate() {\n const data = await this.DynamoDBDocumentClient.get(\n {\n Key: {\n PlayerName: Constants.LAST_SYNCED_DATE\n },\n TableName: Constants.PLAYER_TABLE_NAME\n }).promise();\n return data.Ite...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get non IMS messages. Get red and green message bars.
function getNonIMSMessages() { /** * result. */ var result = []; /** * temp message bar. * @type {Object} */ var tempMessageBar = null; /** * m. * @type {Number} */ var m = 0; for (m = 0; m < messageBoxes.length; m++) { tempMessageBar = message...
[ "getColor() {\n return this.remoteMsg[RNRemoteMessage.NOTIFICATION.COLOR];\n }", "HighlightedMessages() {\n let ret = [];\n if (this.HighlightedRegion.t0 == -999 || this.HighlightedRegion.t1 == -999) { return ret; }\n const lb = Math.min(this.HighlightedRegion.t0, this.HighlightedRegion.t1);\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save textbox when enter is pressed.
function saveOnEnter(e) { codeReporter("saveOnEnter()"); e.preventDefault(); var box = ($(e.target).attr('id') ? $(e.target) : $(e.target).parent()); // Grab the current value of the textarea. var new_text = box.find("textarea").val(); // Empty the current contents of the box. box.empty(); // Write the ...
[ "function inputPressEnter(e) {\n \n if (e.which === 13) {\n\n var editedItem = $(this).parent().find('.editText').val();\n $(this).hide();\n $(this).parent().find('.editText').hide();\n $(this).parent().find('.newText').text(editedItem);\n $(this).par...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Push the specified item onto the specified list if it is not already there.
function pushIfNotPresent(item, list) { for (var j = 0; j < list.length; j++) { if (item === list[j]) { return; } } list.push(item); }
[ "function addItem(array, item) {\n if (!array.contains(item))\n array.push(item);\n }", "function add(array, item){\n if(!contains(array, item)){\n array.push(item);\n array[array.length] = item;\n \n // var bla = [item];\n // array.concat(bla);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Serialize Templates Does not save template parents and may not need to.
serializeTemplates(templates) { let _this = this; // Skip if template does not have filePath if (!templates.getRootPath()) return BbPromise.resolve(); return BbPromise.try(function () { // Validate: Check project path is set if (!S.hasProject()) throw new SError('Template...
[ "function serializeAndSaveSitecoreTemplates() { \n FileSystem.showSaveDialog(\"Save serialized Sitecore templates as...\", null, \"Untitled.json\", function (err, filename) {\n if (!err) {\n if (filename) {\n // save the file\n var file =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
; public static const ISSUE_MODIFIER_WITH_LIST:BEMModifier =
function ISSUE_MODIFIER_WITH_LIST$static_(){IssuesPanelBase.ISSUE_MODIFIER_WITH_LIST=( IssuesPanelBase.ISSUE_BLOCK.createModifier("with-list"));}
[ "function ISSUE_ELEMENT_LIST$static_(){IssuesPanelBase.ISSUE_ELEMENT_LIST=( IssuesPanelBase.ISSUE_BLOCK.createElement(\"list\"));}", "function __FIXME_SBean_assert_ignore_list() {\n\tthis._pname_ = \"assert_ignore_list\";\n\t//this.keywords:\t\tset[string]\t\n}", "get format_list_bulleted () {\n return new I...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stop song by setting the current time to 0 and pausing the song.
function stopSong(){ activeSong.currentTime = 0; activeSong.pause(); }
[ "function stopSong() {\n activeSong.currentTime = 0;\n activeSong.pause();\n }", "function stopSong(){\r\n activeSong.currentTime = 0;\r\n activeSong.pause();\r\n}", "function stopSong() {\n\tpauseSong();\n\tinstance.setPosition(0);\n}", "function stopSong(){\n $(\"#theme\")[0].pause()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Individual function to get suit
function getSuit() { var s = document.querySelectorAll("input[name= 'suit']:checked")[0].getAttribute('value'); return cards[s][0]; }
[ "function pickCard(){ \r\n    var suit = Math.round(Math.random()*3); \r\n    if (suit === 0) suit = \"Hearts\"; \r\n    else if (suit === 1) suit = \"Diamonds\"; \r\n    else if (suit === 2) suit = \"Clubs\"; \r\n    else suit = \"Spades\"; \r\n \r\n    //your code here \r\n \r\n    return suit; \r\n \r\n} \r\n \r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints the tx or send it to the blockchain based on user's config
async function printTxOrSend(call) { if (program.opts().send) { const { pair } = await useKey(); // const r = await call.signAndSend(pair, ); // How to specify {nonce: -1}? const r = await new Promise(async (resolve, reject) => { const unsub = await call.signAndSend(pair,...
[ "async sendUtxo(utxo, sendToAddr, walletInfo, BITBOX) {\n try {\n //console.log(`utxo: ${util.inspect(utxo)}`)\n\n // instance of transaction builder\n if (walletInfo.network === `testnet`)\n var transactionBuilder = new BITBOX.TransactionBuilder(\"testnet\")\n else var transactionBuil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_shift: number; _inverted: boolean; _samplesSinceChange: number; _lastBit: boolean; _loHys: number; _hiHys: number; _bit: boolean; _lastr: number; _lasti: number; _bitsum: number; _scopeData: number[][]; _scnt: number; _sx: number; _sf: Filter; _mf: Filter; _dataFilter: Filter; _symbollen: number; _halfsym: number;
constructor(par) { super(par); this._shift = 170.0; this.inverted = false; this.rate = 45.0; this._samplesSinceChange = 0; this._lastBit = false; // receive this._loHys = -1.0; this._hiHys = 1.0; this._bit = false; this._lastr = 0;...
[ "handleDemodData(iFloat,iShort,asComplex) {\n // if( this.printSlicer ) {\n // console.log('enter demodData ' + iShort.length + ' ' + asComplex.length);\n // }\n\n // this is \n // output of reverse mover, named reverse_mover in AirPacket.cpp\n let moverOut = [];\n\n for( let i = 0; i < iShor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PointSet Description: An object a collection of points Attributes: _points an array containing all the points in the set _size the number of points in the set _centroid a Point object which is located at the centroid of this collection of points (should not be accessed directly as it will be null until explicitly compu...
function PointSet() { this._points = []; this._size = 0; /*************************************************************************** * addPoint * * Description: * Adds a point to this collection of points; an attempt to add a preexisting point will fail, and result in no changes * * Args: * point - a Point ...
[ "function PointSet() {\n\t var argv = Array.prototype.slice.call(arguments), argc = argv.length;\n\n\t var _points;\n\t if (argc === 1 && _.isArray(argv[0])) {\n\t if (argv[0].length === 0) {\n\t throw new Error('PointSet() Can not determin pointset dimension from []');\n\t }\n\t _points = argv[0];...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the inverted matrix
invert() { let result = new Matrix(); result._matrix = ExtMath.inv(this._matrix); return result; }
[ "static get inverseMatrix() {}", "get inverseMatrix() {\n if (this.dirty) {\n this.refreshMatrices();\n }\n return this._inv;\n }", "inverse() {\n\t\tconst n = this.constructor.n;\n\t\tconst adj = this.adjugate();\n\t\tif(!this.det)\n\t\t\tthrow new Error(\"Matrix is not inver...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION THAT CREATES FACULTY
function createFaculty(name) { return new Faculty(name); }
[ "function giveDifficulties(difficulty) {\r\n difficulties = difficulty;\r\n}", "function createTeam() {\n inquirer.prompt([\n {\n type: 'list',\n name: 'memberChoice',\n message: 'What team member would you like to create?',\n choices: [\n 'E...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Expands the given item tree.
expandItem(item){if(!this._isExpanded(item)){this.push("expandedItems",item)}}
[ "expandItem(item){if(!this._isExpanded(item)){this.push('expandedItems',item);}}", "expandItem(item) {\n if (!this._isExpanded(item)) {\n this.push('expandedItems', item);\n }\n }", "expandItem(item) {\n if (!this._isExpanded(item)) {\n this.push('expandedItems', item);\n }\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns half the width of the engine's visible drawing surface in pixels including zoom and device pixel ratio.
get halfDrawWidth() { return this.drawWidth / 2; }
[ "get drawWidth() {\n if (this._camera) {\n return this.scaledWidth / this._camera.z / this.pixelRatio;\n }\n return this.scaledWidth / this.pixelRatio;\n }", "get halfDrawWidth() {\n return this.screen.halfDrawWidth;\n }", "static get screenWidth() {\n if (Eng...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compile arguments, pushing an Arguments object onto the stack.
function CompileArgs({ params, hash, blocks, atNames }) { let out = []; let blockNames = blocks.names; for (let i = 0; i < blockNames.length; i++) { out.push(Object(_blocks__WEBPACK_IMPORTED_MODULE_3__["PushYieldableBlock"])(blocks.get(blockNames[i]))); } let { count, actions } = Compi...
[ "function CompileArgs({\n params,\n hash,\n blocks,\n atNames\n}) {\n let out = [];\n let blockNames = blocks.names;\n\n for (let i = 0; i < blockNames.length; i++) {\n out.push(PushYieldableBlock(blocks.get(blockNames[i])));\n }\n\n let {\n count,\n actions\n } = CompilePositional(params);\n ou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set up listeners for the live links.
function setUpListeners(state) { // If they click on one of the live links, pause the video. $('.hx-link-text-live').on('click tap', function() { state.videoPlayer.pause(); }); }
[ "_setupLinks() {\n\t\tthis.$links = this.$control.find( '.link' );\n\n\t\tthis._bindLinked();\n\t}", "function setupConfigLinkListeners()\n{\n var allAs, thisA;\n allAs = outputDiv.getElementsByTagName('a');\n for (var aIdx = 0; aIdx < allAs.length; aIdx++)\n {\n thisA = allAs[aIdx];\n if (thisA.classNa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the toolbar ui iframe and inject it in the current page
function initToolbar(searchTerm) { var url = "toolbar/ui.html?searchTerm=" + searchTerm; var iframe = document.createElement("iframe"); iframe.setAttribute("id", "augmentedSearch"); iframe.setAttribute("src", chrome.runtime.getURL(url)); iframe.setAttribute("style", "position: fixed; bottom: 0; left: 0; z-ind...
[ "function generateToolBar (){\n\n //generate toolbar\n var toolbar = document.createElement(\"div\");\n toolbar.id = \"toolbar\";\n toolbar.style.position = \"fixed\";\n toolbar.style.display = \"inline-block\";\n \n\n //append toolbar\n var body = document.getElementsByTagName(\"body\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a function that is executed prior to any invoking a route, if the fun returns false it will cancel the route invokation
function pre(fun) { preRouteHook = fun; }
[ "function controlFnExec(fnParam){\n return function(allowed){\n if(allowed){\n fnParam();\n }\n }\n}", "function revocable(fun) {\n return {\n invoke: function(a) {\n if(fun !== undefined) {\n return fun(a);\n }\n },\n revoke: function() { ru...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deregisters the fs storage as plugin.
static deregister() { delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["FSStorage"]; }
[ "static deregister() {\n delete common_plugin[\"a\" /* PLUGINS */][\"IndexedStorage\"];\n }", "static deregister() {\n delete common_plugin[\"a\" /* PLUGINS */][\"PartitioningAdapter\"];\n }", "static deregister() {\n delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__[\"a\" /* PLUGIN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show all times here
showTime(time) { const current = new Date(time.time); const currentMonth = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"][current.getMonth()]; const currentDay = current.getDate(); const currentYear = current.ge...
[ "function overview() {\n var eventsDB = Db.shared.get('events');\n \n // getting the times, starting by most recent time\n var times = Object.keys(eventsDB);\n times.reverse();\n \n // and render for each day the time\n Dom.div(function () {\n Dom.style({\n textAlign: 'center',\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
let contentDivOrder: HTMLDivElement = document.getElementById("deleteContent");
function deleteContent() { console.log("deleteContent"); divname.innerHTML = ""; divdescription.innerHTML = ""; divkindOfPotion.innerHTML = ""; divduration.innerHTML = ""; divAdd.innerHTML = ""; divheat.innerHTML = ""; divcool.innerHTML = ""; divst...
[ "function deleteDiv() {\n let thisDiv = $(this).closest('.generatedDiv');\n thisDiv.remove();\n}", "function deleteContent() {\n let child = container.lastElementChild;\n while (child) {\n container.removeChild(child);\n child = container.lastElementChild;\n }\n }", "function deleteRow() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
async functions To get the count of films where a character exists
async function countOfFilms(arr_people){ let todo = 0; try{ for (const [idx, pid] of arr_people.entries()) { todo += parseInt(await filmModel.countDocuments({ characters: { $in: [pid] } })) } }catch(e){ console.log(e) } return todo; }
[ "function filmCount(){\n return films.length;\n}", "static get allCamerasCount() {}", "count (ngram, options) {\n let matchingDocs = this.findDocs(ngram, options)\n return matchingDocs.length\n }", "count (ngram, options) {\n const matchingDocs = this.findDocs(ngram, options)\n return matchingDo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds a telemetry set
build() { let set = { "asset": this.config.asset, "collectedAt": Date.now() } const measurements = this.measurements.where(function(item) { return item.reading !== null && typeof item.reading !== 'undefined' }) if (!measurements && measurement.length === 0) { this.emit('err...
[ "function buildChartDatasets() {\n // datasets: [\n // {\n // type: 'bar',\n // label: 'Bar Component',\n // data: [10, 20, 30],\n // },\n // {\n // type: 'line...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests whether an object is an instance of the class represented by the specified base id.
function __instanceof(ptr, baseId) { const U32 = new Uint32Array(memory.buffer); let id = U32[ptr + ID_OFFSET >>> 2]; if (id <= U32[__rtti_base >>> 2]) { do { if (id == baseId) return true; id = getBase(id); } while (id); } return false; }
[ "function __instanceof(ptr, baseId) {\n const U32 = new Uint32Array(memory.buffer);\n var id = U32[(ptr + ID_OFFSET) >>> 2];\n if (id <= U32[rttiBase >>> 2]) {\n do if (id == baseId) return true;\n while (id = getBase(id));\n }\n return false;\n }", "function __instanceof...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Carga los datos del proveedor seleccionado en el formulario
function mostrarDatosProveedor() { //tomar el idProveedor desde el value del select let idProvedor = document.getElementById("idProveedor").value; //buscar el proveedor en la lista for (let i = 0; i < listaProveedores.length; i++) { let dato = listaProveedores[i].getData(); if(dato['idPr...
[ "function getDatosSelect() {\n getCompetenciasAndComportamientos(getGestores);\n}", "function cargarOption() {\n \n // sacar los array de alumno y tutor\n \n addOptions(\"selectPrimero\", oPasen.cargarOptions());\n addOptions(\"selectSegundo\", oPasen.cargarOptions());\n }", "function cargarVal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pass draw function to superclass, then draw sprites, then check for overlap
draw() { // PNG room draw super.draw(); drawSprite(this.piggySprite) // talk() function gets called playerSprite.overlap(this.piggySprite, talkToPiggy); if( this.talk2 !== null && talkedToPiggy === true ) { image(this.talk2, this.drawX + 40, this.drawY - 190); } }
[ "draw() {\n\n // PNG room draw\n super.draw();\n if (x0 === true) this.bookSprites[0].remove();\n if (x1 === true) this.bookSprites[1].remove(); \n if (x2 === true) this.bookSprites[2].remove();\n if (x3 === true) this.bookSprites[3].remove(); \n\n drawSprite(this.bookSprites[0]);\n draw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subscribes to notifycc messages from the server
subscribeToNotifyCC(func) { // Do something with the data recieved. this.socket.on('notify-cc', (data) => { func(data); }); }
[ "static subscribe(commands,interval,callback){return Server.subscribeEx(commands,interval,null,callback)}", "subscribeCid()\n {\n /**\n * subscrible CID_CHANNEL\n * received message with SystemSub\n * if message is delete\n * call updateCid to re-init this cluster 's cid ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Normalizes am / a.m. / etc. to AM (uppercase, no other characters)
function normalizeAMPM(ampm) { return ampm.replace(/[^apm]/gi, '').toUpperCase(); }
[ "function convertTimeIntoAmPm(time){\n var timeString = time;\n var hourEnd = timeString.indexOf(\":\");\n var H = +timeString.substr(0, hourEnd);\n var h = H % 12 || 12;\n var ampm = H < 12 ? \"AM\" : \"PM\";\n timeString = h + timeString.substr(hourEnd, 3) + ampm;\n return timeString\n\n}", "function amp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a dialog when a user clicks on map marker/pin that shows a list of the services offered by the person at that marker
function createServiceChoiceDialog(chosenMarker) { console.log(chosenMarker); var chosenMarkerUserID = chosenMarker; var chosenMarkerUser = readUser(chosenMarkerUserID); var chosenMarkerName = chosenMarkerUser.FirstName + " " + chosenMarkerUser.LastName; //set name on dialog $('#servicesChoiceDialogName').text(...
[ "function addMarkerClickListener(marker, map, service, place){\n var infoWindow = new google.maps.InfoWindow();\n google.maps.event.addListener(marker, 'click', function() {\n service.getDetails(place, function(result, status) {\n if (status !== google.maps.places.PlacesServiceStatus.OK) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
K1 and b are tuning constants from the report mentioned above: K1 modifies term frequency (higher values increase the influence) b modifies document length (between 0 and 1; 1 means that long documents are repetitive and 0 means they are multitopic)
constructor(names, texts, customStopwords = [], K1 = 1.5, b = 0.75) { this.stopwordFilter = term => !Stopwords.includes(term) && !customStopwords.includes(term); this.K1 = K1; this.b = b; this.documents = new Map(); this.collectionFreq = new Map(); this.termWeights = new Map(); this.uniqueDo...
[ "function updateDeltaK() {\n deltaK = (k1 - k2) / 2;\n}", "train(){\n for(let [key, value] of this.ids){\n // Calculate probability for all of the classifications\n for(let classification of this.documents.keys()){\n let repetitionsInClass = this.documents.get(classification).get(key) + 1;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Welcome. In this kata, you are asked to square every digit of a number. For example, if we run 9119 through the function, 811181 will come out, because 92 is 81 and 12 is 1. Note: The function accepts an integer and returns an integer
function squareDigits(num){ //may the code be with you var newnum=num.toString() var square = "" for (i=0;i<newnum.length;i++){ square += newnum[i] ** 2 } return parseInt(square) }
[ "function squareDigits(num){\n //may the code be with you\n const numArray = num.toString().split('')\n const result = [];\n for (let index of numArray) {\n result.push(index * index);\n }\n return (parseInt(result.join('')));\n}", "function squareDigits(num) {\r\n let result = '';\r\n num = num.toStri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Excluir vinculo com o animal
function excluirAnimalMedico(animal, usuario, res){ console.log("Excluir animal"); console.log(animal); console.log(usuario); connection.acquire(function(err, con){ con.query("update MedicoAnimal set MedicoAnimal.status=2 where MedicoAnimal.Medico=? and MedicoAnimal.Animal=?",[usuario.idusuario, animal],func...
[ "removeAnimal() {\n\t\tthis.animal = null;\n\t}", "function remove(animals, name){\n \n \n for(var i = 0; i< animals.length; i++){\n//Check if name exist in animals array \n if(name === animals[i].name){\n//if name exist remove it \n animals.splice(i, 1)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wrapper function for generating the CodeTree for the given tree
function getCodeTree(originalTree, type, sourceFile, appId) { return new CodeTree(originalTree, type, sourceFile, appId); }
[ "function CodeTree(originalTree, type, sourceFile, appId) {\n if (type == \"ast\") {\n this.tree = transformAstToCodeTree(originalTree, sourceFile, appId);\n }\n else if (type == \"dom\") {\n this.tree = transformDomToCodeTree(originalTree, sourceFile, appId);\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the instruction to generate for interpolated text.
function getTextInterpolationExpression(interpolation) { switch (getInterpolationArgsLength(interpolation)) { case 1: return Identifiers$1.textInterpolate; case 3: return Identifiers$1.textInterpolate1; case 5: return Identifiers$1.textInterpolate2; ...
[ "function getTextInterpolationExpression(interpolation){switch(getInterpolationArgsLength(interpolation)){case 1:return Identifiers$1.textInterpolate;case 3:return Identifiers$1.textInterpolate1;case 5:return Identifiers$1.textInterpolate2;case 7:return Identifiers$1.textInterpolate3;case 9:return Identifiers$1.tex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }