query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
mobile menu: move the seach form into mainnav (when it becomes the mobile menu) and move it back when switching to desktop (works only on browsers with media queries) | function moveSearchForm(mq) {
var searchForm;
if (mq.matches) {
// move search form back into tools menu
searchForm = $('#main-nav .search-form').detach();
$('.heading-first .tools').append(searchForm);
}
else {
... | [
"function movemenu() {\n if ((getDevice() == \"mobile\") || jQuery('body').hasClass('bw-mobile') || jQuery('body').hasClass('bw-tablet')) {\n if (jQuery('.mobile-menu-sidebar').length == 0) {\n jQuery(\"#navmenu-sidebar ul.reg li\").clone().insertAfter('#main-menu-nav .main-nav li.first.leaf').addClass('mo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function called when the cities refresh button is called | function refreshCities(){
$.aceOverWatch.field.grid.reloadPage(objCities.grid);
} | [
"function refresh () {\n\t\tfor (var i in cities) loadWeather(cities[i], views[i]);\n\t}",
"function refresh()\n\t{\n\t\tdrawMinimap();\n\t\tdrawMinimapOverlay();\n\t\tdrawFoodBar();\n\t\tdrawProductionShields();\n\t\tdrawFoodStorage();\n\t\tdrawShieldBar();\n\t\tdrawTradeBar();\n\t\tdrawOutput();\n\n\t\t$(\"#cit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Count number of to do items & number of completed to do items | function countItems() {
count = 0;
completed = 0;
$.each($('.new-item'), function (index, toDoItem) {
count++;
if (toDoItem.firstChild.checked)
completed++;
});
} | [
"@action\n todoInCompletedCount() {\n let temp = 0;\n if (this.allTodoItems.length === 0) return 0;\n else {\n for (let i = 0; i < this.allTodoItems.length; i++) {\n if (!this.allTodoItems[i].completed) temp++\n }\n }\n this.InCompletedCount... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If you want the clone to have the same prototype as the original, you can use Object.getPrototypeOf() and Object.create(): | function clone2(orig) {
const origProto = Object.getPrototypeOf(orig);
return Object.assign(Object.create(origProto), orig);
} | [
"function setPrototypeAdvanced(){\n //Object.create(proto) -> Creates a new object using an existing object as a prototype\n const proto1={name:\"kk\"}\n const proto2={name_2:\"jj\"}\n const obj=Object.create(proto1);\n console.log(Object.getPrototypeOf(obj))\n}",
"function Clone() {}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the player's current familiar is equal to the one supplied | function isCurrentFamiliar(familiar) {
return (0, _kolmafia.myFamiliar)() === familiar;
} | [
"function isCurrentFamiliar(familiar) {\n return kolmafia_1.myFamiliar() === familiar;\n}",
"playerInHat(){\n return this.field.getXY(this.player.X,this.player.Y) === hatCharacter;\n }",
"isPlayerOne() {\n return this.userName == this.state.playerOneName;\n }",
"static getHasUserInteracte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Get PreGame Odds Line Movement / / The ScoreID of an NFL score (game). ScoreIDs can be found in the Scores API. Valid entries are 16654 or 16667 | getPreGameOddsLineMovementPromise(scoreid){
var parameters = {};
parameters['scoreid']=scoreid;
return this.GetPromise('/v3/nfl/odds/{format}/GameOddsLineMovement/{scoreid}', parameters);
} | [
"getInGameOddsLineMovementPromise(scoreid){\n var parameters = {};\n parameters['scoreid']=scoreid;\n return this.GetPromise('/v3/nfl/odds/{format}/LiveGameOddsLineMovement/{scoreid}', parameters);\n }",
"getPeriodGameOddsLineMovementPromise(scoreid){\n var parameters = {};\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utility function in order to delete unnecessary data from the tag detection and then return just labels and relative scores (take only the ones which are above the minScore threshold) | function azureFilterTags(azureJson, minScore){
let retObj = {};
//categories annotations
retObj['categories'] = [];
for(let category of azureJson['categories']){
if(Number.parseFloat(category['score']) > minScore)
retObj['categories'].push(category);
}
//tags annotations
... | [
"function gcloudFilterTags(gcloudJson, minScore){\n\n let retObj = {};\n\n //landmark annotations\n retObj['landmarks'] = [];\n for(let landMarkAnn of gcloudJson['landmarkAnnotations']){\n if(Number.parseFloat(landMarkAnn['score']) > minScore)\n retObj['landmarks'].push({\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reset board function that reloads the page from the browser cache | function clearBoard() {
location.reload(false);
} | [
"function clearBoard() {\n location.reload(false);\n }",
"function resetGame() {\n location.reload();\n}",
"function resetGame() {\n location.reload();\n}",
"function resetGame() {\r\n window.location.reload();\r\n}",
"function resetBoard() {\n resetSolveBtn();\n setBoard(preset);\n drawTiles();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates cloud formation template for the api resource | createResourceTemplate() {
let updated = false;
const resourcePath = this.props.apiResourcePath;
const resTokens = (resourcePath === EMPTY_RESOURCE)?'':resourcePath;
let basePath = `resources/api${this.props.apiParentResource}`;
resTokens.split('/').forEach((resourceName) => {
... | [
"function createNewAPITemplates() {\n\tvar extensions = fs.readFileSync(\"./samples/extensions.yaml\", \"utf8\");\n\t\n\tvar soap = fs.readFileSync(\"./templates/soap.yaml\", \"utf8\");\n\tvar newSoap = soap + os.EOL + os.EOL + extensions;\n\tfs.writeFileSync(\"./\" + FLOWTESTOUTPUT + \"/soap.yaml\", newSoap, \"utf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
console.log(isShuffle2('def', 'dec', 'dedecf')); console.log(isShuffle2('qrt', 'urt', 'qurtrt')); console.log(isShuffle2('qrt', 'urt', 'qurttr')); | function isShuffle3(str1, str2, str3) {
let stringIndecies = [0, 0];
while (stringIndecies.length) {
let str1Idx = stringIndecies.shift(),
str2Idx = stringIndecies.shift(),
str3Idx = str1Idx + str2Idx;
if (str3Idx === str3.length) {
return true;
}
if (str1[str1Idx] === str3[s... | [
"function isShuffle2(str1, str2, str3) {\n if (!str3.length) {\n return (str2.length === 0 && str1.length === 0);\n }\n if (str3[0] === str1[0]) {\n return (isShuffle2(str1.slice(1), str2, str3.slice(1)));\n }\n\n if (str3[0] === str2[0]) {\n return (isShuffle2(str1, str2.slice(1), str3.slice(1)));\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clearEmployeeListOnLinkClick(): This empties out the employee list when "Clear employee list" button clicked. | function clearEmployeeListOnLinkClick(){
let ul = document.querySelector('ul')
let button = document.querySelector('a')
button.addEventListener("click", function() {
document.querySelector('ul').innerHTML = ''
})
// $("a").on("click", function() {
// document.querySelector(".employee-list").remov... | [
"function clearEmployeeListOnLinkClick() {\n document.querySelector('a').addEventListener('click', function(event){\n ul.innerHTML = \"\";\n });\n}",
"function clearAll(e) {\n e.preventDefault();\n // Resets list\n itemList.innerHTML = \"\";\n}",
"function clearLinkList() {\n var linkList ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
isValidPuzzleString returns true if the string is a valid sudoku layout | isValidPuzzleString(puzzleString) {
return this.isValidLength(puzzleString) &&
this.isValidCharacters(puzzleString);
} | [
"validate(puzzleString) {\n // Length has to be 81\n if (puzzleString.length !== 81) {\n return false;\n }\n // Can only contain numbers (no alphabets, special characters besides .)\n var regex = /^(\\d|[.])*$/;\n if (!regex.test(puzzleString)) {\n return false;\n }\n // Now that ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validates the interval property. | validateInterval(interval) {
const that = this.context,
range = that._maxObject.subtract(that._minObject);
that._validInterval = new JQX.Utilities.BigNumber(interval);
that._validInterval = this.round(that._validInterval);
if (that._validInterval.compare(range) === 1) {
... | [
"validateInterval(interval) {\n const that = this.context,\n range = that._maxObject - that._minObject;\n\n if (interval <= 0) {\n interval = 1;\n }\n\n that._validInterval = Math.min(parseFloat(interval), range);\n\n that.interval = that._validInterval;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add inline attachment at position | function attach_inline(index, filename)
{
insert_text('[attachment=' + index + ']' + filename + '[/attachment]');
document.forms[form_name].elements[text_name].focus();
} | [
"function attachmentCallBack( filename, mimeType, attachment ) {\n\t\tvar ifrm = $( '#message-iframe-'+ message.id )[0].contentWindow.document;\n\t\tvar link = getAttachmentBody( attachment, filename, mimeType );\n\t\t$( link ).insertAfter( $( ifrm.body ) );\n\t}",
"function sendInline(session, filePath, contentT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a new DealPersonDataPhone. | constructor() {
DealPersonDataPhone.initialize(this);
} | [
"constructor(id /* Number */, name /* String */, address /* Address object */, phone /* String */) {\n if (id === null) {\n this.id = Math.random().toString()\n } else {\n this.id = id\n };\n this.name = name;\n this.address = address;\n this.phone = p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
initialize spinner on ajax loading | function InitSpinner() {
$(document).ajaxSend(function () {
$('#divSpinner').show();
}).ajaxComplete(function () {
$('#divSpinner').hide();
}).ajaxError(function (e, xhr) {
// do something on ajax error
});
} | [
"function initSpinner() {\n $('#spinner')\n .ajaxSend(function(){$(this).fadesIn()})\n .ajaxComplete(function(){$(this).fadesOut()});\n}",
"function initLoader() {\n $(document).ajaxSend(function () {\n if (ajaxInProgress) {\n // c(\"Ajax Request rejected because a request is already i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add row at the top of the table | function addRowTop(tableID) {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
var row = table.insertRow(1);
var colCount = table.rows[0].cells.length;
for(var i=0; i<colCount; i++) {
var newcell = row.insertCell(i);
newcell.innerHTML = table.rows[0].ce... | [
"insertRowBefore() {\n this.insertRow();\n }",
"function addRow() {\n var $newRow = lastRow().clone(true).insertAfter(lastRow());\n clearRow($newRow.get());\n }",
"addRow(entry){\n const tr = this.makeRow(entry);\n this.tableBodyEl.appendChild(tr);\n if(this.autoScrollEnabled){\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
display all DONE todo | function displayDoneTodos() {
let todos = '';
for (let index = 0; index < doneTodoList.length; index++) {
let counter = index + 1;
todos += `<p>
${counter}. ${doneTodoList[index]}
`;
}
document.getElementById('displayDoneTodoList').innerHTML = todos;
} | [
"static displayToDos() {\n const todos = CRUD.getTodos();\n todos.forEach(todo => UI.addToDoToList(todo));\n }",
"function displayTasks() {\n\t$.each(allItems, function(i, v) {\n\t\t//Appends new task and separates with lines\n\t\tif(this != allItems[allItems.length - 1]) {\n\t\t\t$todoList.appen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets DomHelper.scrollBarWidth cache, triggering a new measurement next time it is read | static resetScrollBarWidth() {
scrollBarWidth = null;
} | [
"static resetScrollBarWidth() {\n scrollBarWidth = null;\n }",
"recalculateScrollBar() {\n this.hasScrollBar = window.innerWidth > document.documentElement.clientWidth;\n if (this.hasScrollBar) {\n this.scrollbarWidth = this.getScrollBarWidth();\n } else {\n this.scrollbarWidth = 0;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the order of genres (in ordered_data) | function get_genres_order(ordered_data) {
var res = [];
for (var i = 0; i < ordered_data.length; i++) {
res.push(ordered_data[i].genre);
}
return res;
} | [
"getGenres() {\n return ['Rock', 'Indie', 'Pop', 'Country', 'Jazz', 'Rap'];\n }",
"function getGenres(data) {\n var genreSet = [];\n for (var i = 0; i < data.length; i++) {\n var genres = data[i].genre;\n for (var j = 0; j < genres.length; j++) {\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Navigation of thumbnails by big slider | function navigationOfThumbnailsByMainSLider() {
setTimeout(function() {
// get index
var number = sliderMain.find(".js-property-slider-item.active").index();
// go to slide
// sliderMain.goToSlide(number);
// change active thumbnail
// sliderThumbnails.find(".js-property-slider-thumbna... | [
"_slideThumbnails() {\n this._slider.events.on('indexChanged', () => {\n const currentIndex = this._getCurrentIndex();\n this._thumbnailSlider.goTo(currentIndex);\n });\n\n this._thumbnailSlider.events.on('indexChanged', () => this._activateThumbnailNavigationItem());\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Private Methods Attaches keyboard shortcut event listeners. | function attachKeys() {
var inputs = d.body.getElementsByTagName('input'),
selects = d.body.getElementsByTagName('select'),
textareas = d.body.getElementsByTagName('textarea');
next = yud.get('next_url');
prev = yud.get('prev_url');
hotKeys.ctrl_alt_a = new yut.KeyListener(d,
... | [
"function initKeyboardShortcuts() {\n document.body.onkeydown = function(event) { _handleKeyboardShortcut(event); };\n}",
"function bindShortcutsToEvents() {\n\n // disable scrolling when pressing the space bar\n $(document).keydown(function (e) {\n // space = 32, backspace = 8, page up = 73, page dow... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Quick and dirty way to format as euros | function formatAsEuros (amount) {
var res = '€'
, currentPart
;
if (amount === 0) { return '0 ' + res; }
while (amount > 0) {
currentPart = amount - 1000 * Math.floor(amount / 1000);
if (amount === currentPart) { // No padding if it's the last part
res = currentPart + ' ' + res;
} el... | [
"function FormatCurrency(num, currencyCode, isReplace, justFormat)\r\n{\r\n if (num == null)\r\n return \"\";\r\n var num = num.toString().replace(/\\$|\\,/g, '');\r\n if (isNaN(num))\r\n num = \"0\";\r\n var sign = (num == (num = Math.abs(num)));\r\n num = Math.floor(num * 100 + 0.5000... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The constraint is only for `top`, not for `left`, and it's imposed by viewport, not document. And also, constraint, at least right now only applies when in `horizontal` mode. | calcOffsetConstraintForHorizontalMode() {
let viewport = getViewportDimension();
let offsetToViewport = calcOffsetToViewport(this.props.baseEl.offsetParent);
let height = this.props.height || DEFAULT_HEIGHT;
return {
min: -offsetToViewport.top,
max: viewport.height - height - offsetToViewpo... | [
"function createConstraint()\n\t\t{\n\t\t\tconstraint.css({\n\t\t\t\tleft : -(map.width()) + viewport.width(),\n\t\t\t\ttop : -(map.height()) + viewport.height(),\n\t\t\t\twidth : 2 * map.width() - viewport.width(),\n\t\t\t\theight : 2 * map.height() - viewport.height()\n\t\t\t});\n\t\t\t\n\t\t\t// Check if map is ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
on click handler for deleting a note | function note_delete()
{
// grab the .data element of note to delete
var axe_it = $(this).data("_id");
$.ajax(
{
url: "/api/notes/" + axe_it,
method: "DELETE"
}).then(function()
{
// on success, hide the modal
bootbox.hideAll();
});
} | [
"function deleteButtonPressed(note) {\n removeFromDb(note);\n}",
"function deleteNote() {\n\n var noteToDelete = $(this).data(\"_id\");\n // DELETE request to the API\n $.ajax({\n url: `/api/notes/${noteToDelete}`,\n method: \"DELETE\"\n }).then(function() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Templates can contain references to other templates, find them in the DOM. | function findReferencedTemplateIDs(parsedDOM) {
const dependentTemplateIDs = new Set();
parsedDOM
.root()
.find("[data-bind*=template]")
.each((index, element) => {
const dataValue = parsedDOM(element).data("bind");
// Some template names are code to be executed instead of a string
//... | [
"function templateFinder(template,container){\r\n var tArray = template.Templates || [];\r\n for(var i = 0; i< tArray.length; i++){\r\n if(tArray[i].Container == container)\r\n return tArray[i];\r\n else {\r\n var t = templateFind... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetch Artists and set it to state variable | async function fetchArtists() {
let response = await fetch(props.baseUrl + "artists", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-cache",
}
})
response = await response.json();
se... | [
"function fetchSpotifyArtists() {\n let url = `https://api.spotify.com/v1/search?q=${query}&type=artist,album&limit=4`;\n fetch(url, {\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${params.access_token}`\n }\n })\n .then(resp => resp.json())\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decodes a system program from the binary. If the binary is not at all a system program, returns undefined. If it's a system program with decoding errors, returns partiallydecoded binary and sets the "error" field. | function decodeSystemProgram(binary) {
const chunks = [];
const annotations = [];
let entryPointAddress = 0;
const b = new teamten_ts_utils_1.ByteReader(binary);
const headerByte = b.read();
if (headerByte === teamten_ts_utils_1.EOF) {
return undefined;
}
if (headerByte !== FILE_... | [
"function decodeSystemProgram(binary) {\n const chunks = [];\n const annotations = [];\n let entryPointAddress = 0;\n const b = new teamten_ts_utils_dist[\"ByteReader\"](binary);\n const headerByte = b.read();\n if (headerByte === teamten_ts_utils_dist[\"EOF\"]) {\n return undefined;\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
An element consisting of a paragraph of text text options: 0: paragraph text | function buildText(options) {
html += `<p class ="text">${options[0]}</p>`
} | [
"paragraph(text, options) {\r\n return this.el(\"p\", text, options);\r\n }",
"function ssmlParagraph(text) {\r\n return ` <p>${text}</p> `;\r\n} // end of ssmlParagraph()",
"function createParagraphElement(text) {\n const pElement = document.createElement('p');\n pElement.innerText = text;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
call this each time the detailed view is loaded to check what action the mortgage button should take. | function setupMortgageBtn() {
if (current_prop.numHouses > 0 || current_prop.hotel === true) {
$("#mortgagebtn").addClass("unavailable")
.unbind();
$("#mortgagebtn .btncaption").html("Mortgage");
return;
}
if (current_prop.mortgaged === true) {
$("#mortgagebtn .btncaption").ht... | [
"function ViewItineraryPage() { }",
"function onPageBeforeShow() {\n refresh();\n }",
"function doAfterPageLoadActions() {\n\t//TODO: Override this\n}",
"function directUserFromViewInfo() {\n if (nextStep == \"Departments\") {\n viewDepartments();\n }\n if (nextStep =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the current set of enabled optional extensions. Note that the external Scandit Engine library will also use any applicable mandatory extension for the symbology. | getEnabledExtensions() {
return this.extensions;
} | [
"getExtensions() {\n return this.extensionSet.getExtensions();\n }",
"getExtensions() {\n return this.extensionSet.getExtensions();\n }",
"get availableExtensions() {\n return this.plugin.availableExtensions;\n }",
"get all() {\n return Array.from(this.extensions.values()).map(o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The meta information of the stored table object | get tableMeta() {
if (this.table !== undefined) {
return this.table.meta
}
} | [
"function ColumnMeta() {}",
"get metaData() {\n if (this._impl) {\n return this._impl.metaData;\n }\n return undefined;\n }",
"getMeta() {\n return this.meta;\n }",
"async function readMeta() {\n return dbInstance.meta\n}",
"get metadata () {\n return {\n name: this.name,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Release all resources allocated to play the audio file. Must be called even if the audio file was not played. | releaseResources() {
if (this._audioFileStartedSubscriber) {
this._audioFileStartedSubscriber.remove();
delete this._audioFileStartedSubscriber;
}
if (this._audioFileStoppedSubscriber) {
this._audioFileStoppedSubscriber.remove();
delete this._audio... | [
"function releaseAudio() {\n if (my_media)\n my_media.release();\n}",
"function removeAudioFile() {\n var audioFile = Ti.Filesystem.getFile(res.data.filePath);\n audioFile.deleteFile();\n }",
"reset() {\n\t\tthis.audio.file.currentTime = 0;\n\t\tthis.audio.file... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clears the current myActivities elements, and then gets the myActivities field in the current users document and adds them to the activities array. Once done, it then calls method ShowActivities(); | function GetActivities() {
firebase.auth().onAuthStateChanged(function (user) {
if (user != null) {
ClearMyActivities();
// if there is a user, access the current users document
db.collection("users").doc(user.uid).get()
.then(function ... | [
"clearActivityList() {\n this._activityLogger.debug(\"clearActivityList\");\n\n this._ignoreNotifications = true;\n // If/when we implement search, we'll want to remove just the items\n // that are on the search display, however for now, we'll just clear up\n // everything.\n activityManager.clean... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new file version from the file specified by the version label. | restoreByLabel(label) {
return this.clone(Versions_1, `restoreByLabel(versionlabel = '${label}')`).postCore();
} | [
"async function createFileVersion(filename) {\n\n try {\n\n let stat = await fs.stat(filename)\n\n // Make sure that it is a file.\n if (!stat.isFile()) {\n throw new Error(`\"${ filename }\" is not a file.`)\n }\n\n let dirname = path.dirname(filename)\n let extname = path.e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updates the score, resets the options and question | function correctAnswer() {
score++;
console.log(score);
$("#options").empty();
$("#question").text("");
} | [
"function updateScore() {\n // if answer is correct, add 10 points\n if (questions[currentQuestion].answer == selectedOption) {\n score += 10;\n currentScore.textContent = score;\n console.log(score);\n } else {\n // if answer is wrong, subtract 5 seconds from timer\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the function audio name. Ex: "DLC_Dmod_Prop_Editor_Sounds" | set FunctionAudioName(value) {
this._functionAudioName = value;
} | [
"set HoverAudioName(value) {\n this._hoverAudioName = value;\n }",
"function playSound(name) {\r\n name.play();\r\n}",
"static muteSound(name)\n {\n setSoundMuted(name, true);\n }",
"setSoundAlias(new_sound_alias)\n {\n this.sound_alias = new_sound_alias;\n }",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns and sets the playing attribute value. | get playing() {
return this.hasAttribute('playing')
} | [
"set playing (value) {\n this._playing = value;\n\n // update the icon automatically\n this.playIcon.innerText = this._playing ? 'pause_circle_outline' : 'play_circle_outline';\n }",
"set Playback(value) {}",
"get isPlaying() {\n return this.playing;\n }",
"ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
seckill center create seckillswiper | function create_seckillswiper() {
const seckillswiper = new Swiper(".swiper-seckill", {
slidesPerView: 4,
slidesPerGroup: 4,
loop: true,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
});
} | [
"function makeSwiper(){\n _this.calcSlides();\n if (params.loader.slides.length>0 && _this.slides.length==0) {\n _this.loadSlides();\n }\n if (params.loop) {\n _this.createLoop();\n }\n _this.init();\n initEvents();\n if (params.paginatio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Drag jsPlumb helpers Jqueryui freeselect | function updateFreeSelect ( e , ui ) {
if ( $('.node_frame.ui-selected, node_frame.ui-selecting, .network_frame.ui-selected,.network_ui-selecting, .customShape.ui-selected, .customShape.ui-selecting').length > 0 ) {
$('#lab-viewport').addClass('freeSelectMode')
}
window.freeSelectedNodes = []
... | [
"function baseDragAndDrop() {}",
"drag_feedback(){\r\n this.dragging = true;\r\n }",
"function win_drag_start(ftWin){draggingShape = true;}",
"setupSelectBox(){\n\n let self = this,\n selectDisabled = true,\n mouseDown = [0,0],\n dragValue = [0,0];\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check, that for each entry of src there is a corresponding entry in target | function checkPresence( src, target, srcKey, targetKey ) {
// list of missing
var missing = new Set();
// check, if there is actually something in the target dataset
if( target.length > 0 ) {
// build lookup
var lookup = buildLookup( target, targetKey );
// check for unit existence
for( v... | [
"function checkConversion(source, target) {\n for (let sourceContent of source.directoryEntries) {\n let sourceContentName = sourceContent.leafName;\n let ext = sourceContentName.substr(-4);\n let targetFile = FileUtils.File(\n PathUtils.join(target.path, sourceContentName)\n );\n log.debug(\"C... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this will show the count next to the compare button | function showCompareCount(){
if(srvObj.count > 1){
$('#compareCounter').show().text(srvObj.count);
}else{
$('#compareCounter').hide();
}
} | [
"function countComparisons() {\n leftImage = document.getElementById('left-weight-content').children[0];\n rightImage = document.getElementById('right-weight-content').children[0];\n if ((leftImage != lastLeftImage) || (rightImage != lastRightImage)) {\n comparisons += 1\n fmts = gettext(\"Number of compar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /experts or PUT /expert/:id | async createOrUpdate(req, res){
try{
if(!req.cookies.aat || req.cookies.aat != 'true'){
res.status(400).send({message:'Rejected'});
return;
}
const payload = await jwtService.verify(req.headers.authorization);
const user = await User.findById(payload._id);
const {id} = req.params;
const {na... | [
"function post(config){\n return $http.post(expertUrl, config)\n .then(function(response){\n return response.data\n })\n .then(function(data){\n return createData(data, config);\n });\n }",
"function deleteExpertById(id, response) {\n Expert.findByIdAndDelete(\n id,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for filling the third data table with the averages of the selected school(s) english scores | function showMeanEngScoreGrid() {
var htmlList = "";
var ctrl = "satMeanGridEng";
//Build a HTML table on the fly dynamically and initialize it as a jQuery data table
htmlList += "<table width= 100% style= 'margin-top:12px:width:100%' class='row-border table-striped table-hover' id = 'table-" + ctrl + ... | [
"function showMeanTotalScoreGrid() {\n var htmlList = \"\";\n var ctrl = \"satMeanGrid\";\n\n //Build a HTML table on the fly dynamically and initialize it as a jQuery data table\n htmlList += \"<table width= 100% style= 'margin-top:12px:width:100%' class='row-border table-striped table-hover' id = 'tab... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exercise 6 Write a function that takes 3 parameters and returns one number, which is the product of the first two numbers raised to the power of the third passing this function 1,2,3 should give you back the answer to (1 2)^3 | function productOf(num1, num2, num3){
let product = Math.pow((num1*num2), num3);
return product;
} | [
"function productOfThree(num1=1, num2=1, num3=1) {\n\n\treturn (num1 * num2 * num3);\n}",
"function raisedTopow(num1, num2, num3) {\n let multi = num1 * num2;\n let power = Math.pow(multi, num3)\n console.log(`The answer is: ${power}`)\n}",
"function product (num1,num2,num3) {\n let result = num1 * num2 * n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
try to dock with WM 1.5 main script | function dock(){
//check that dock exists
var door=$('wmDock');
if (!door) {
//cannot find dock
window.setTimeout(dock, 1000);
return;
}
//check that the dock does not not already have us listed
var doorMark=$('wmDoor_app102452128776');
if (doorMark) return; //already posted to door
... | [
"function dock(){\r\n\r\n\t\t//enter material names here as objects\r\n\t\t//each object takes a name, id and event\r\n\t\t//id defaults to name - spaces and lowercase\r\n\t\t//event defaults to \"Unsorted\"\r\n\t\t//flags defaults to null\r\n\t\tvar materials = [\r\n\t\t];\r\n \r\n\t\t//mark all these as new while... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Send AWS URL to trade MQ | function WriteAWSURLtoMQ(AWSURL) {
amqp.connect('amqp://localhost', function(error0, connection) {
if (error0) {
throw error0;
}
connection.createChannel(function(error1, channel) {
if (error1) {
throw error1;
}
//TODO: Name th... | [
"function sendRequest() {\n var form = document.forms[0];\n var accessKeyId = 'AKIAIWXZMJLVODQOQSNA';\n var secretKey = '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';\n var url = generateSignedURL(\"SendMessage\", form, accessKeyId, secretKey, \"https://queue.amazonaws.com\", \"2012-11-05\");\n //var po... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setQueue(queue) This function sets the new Array to the queue and QUEUE Arrays. | setQueue(queue) {
this.queue = queue;
this.QUEUE = queue.slice(0);
} | [
"replaceQueue(newQueue) {\n this.queue.data = Object.assign([], newQueue);\n }",
"link_queue(queue) {\n\t\tthis._queue = queue;\n\t}",
"function updateQueue() {\r\n\tconsole.log(\"Updating queue\");\r\n\tif (gTicks >= TICK_SIZE) gTicks = 0;\r\n\tfor (var i = 0; i < 4; i++ ) {\r\n\t\tfor (var j... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function finds the path from the current frame in focus to the new frame we want to go to. Assume that the frames are arranged in a tree. We are given locations of 2 nodes. The locations are encoded as colon separated indices. E.g. root:2:4:0. We have to find directions from one node to another. The operations we ... | function getDirectionsToReachFrameLocation(
currentFrameLocation,
frameLocation
) {
let directions = [];
let newFrameLevels = frameLocation.split(":");
let oldFrameLevels = currentFrameLocation.split(":");
while (oldFrameLevels.length > newFrameLevels.length) {
directions.push("relative=parent");
o... | [
"function findPath(currentPosition) {\r\n var i = 0,\r\n x = currentPosition[0], \r\n y = currentPosition[1],\r\n s = currentPosition[2];\r\n if (x < 3) {\r\n var s1 = grid[x+1][y].status;\r\n }\r\n if (y < 3) {\r\n var s2 = grid[x][y+1].status;\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function that takes a person obj and checks if the person is old enough to enter the club. If they are 21 or older return true else return false | function isOldEnough(obj) {
for(key in obj) {
if(key === 'age' && obj[key] >= 21) {
return true;
}
return false
}
} | [
"function isPersonOldEnoughToDrive(person) {\n // your code here\n return person.age >= 16 ? true : false;\n}",
"function isPersonOldEnoughToVote(person) {\n // your code here\n return person.age >= 18 ? true : false;\n}",
"function isPersonOldEnoughToDrive() {\n let age = person.age;\n if (age >= 16) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Configure everything before enabling. Cuz we don't want the test engine (in main.ts file tests get discovered when config changes are detected) to start discovering tests when tests haven't been configured properly. | function enableTest(wkspace, configMgr) {
const pythonConfig = vscode.workspace.getConfiguration('python', wkspace);
// tslint:disable-next-line:no-backbone-get-set-outside-model
if (pythonConfig.get('unitTest.promptToConfigure')) {
return configMgr.enable();
}
return pythonConfig.update('un... | [
"function configure(){\n /**\n * Default configuration options - override these in your config file\n * (e.g. var preambleConfig = {timeoutInterval: 10}) or in-line in your tests.\n *\n * windowGlobals: (default true) - set to false to not use window globals\n * (i.e. ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create ths for a table row in a table head and render it | function renderTableHead() {
const thead = document.querySelector('thead');
const tr = document.createElement('tr');
createTdOrTh('', tr);
createTdOrTh('', tr);
createTdOrTh('Product', tr);
createTdOrTh('Price', tr);
createTdOrTh('Quantity', tr);
createTdOrTh('Total', tr);
thead.appendChild(tr);
} | [
"function renderTableHeadings(tableHeadings) {\n const tableRow = document.createElement(\"tr\");\n tableHeadings.forEach((heading) => {\n const tableHeading = document.createElement(\"th\");\n heading = heading.replace(\"_\", \" \");\n tableHeading.innerText = heading;\n tableHeading.clas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function either turns on or off the row highlighting for vegetarian items (depending on the value of bShowVeg) | function HighlightHorror(idTable, bShowVeg) {
//bshow is the check box
// if bShowVeg is true, then we're highlighting vegetarian
// meals, otherwise we're unhighlighting them.
var i=0;
var oTable = document.getElementById(idTable);
var oTBODY = oTable.getElementsByTagName('TBODY')[0];
var aTRs = oTBODY.getElemen... | [
"highlightSelected() {\n\n for (let i in this.items) {\n this.items[i].setStyle(this.inactiveStyle); // change the style of all entries to the inactive style\n }\n\n this.items[this.selected].setStyle(this.activeStyle); // change the style of the selected entry to the activ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shallow merge specs toghether | async function combineSpecs(urls) {
const specs = await loadSpecs(urls);
const res = specs[0];
const oasVersion = getSpecVersion(specs[0]);
for (let i = 1; i < specs.length; i++) {
const spec = specs[i];
const specUrl = urls[i];
if (getSpecVersion(specs[i]) !== oasVersion) {
console.error(
... | [
"function mergeBuildSpecs(lhs, rhs) {\n if (!(lhs instanceof ObjectBuildSpec) || !(rhs instanceof ObjectBuildSpec)) {\n throw new Error('Can only merge buildspecs created using BuildSpec.fromObject()');\n }\n if (lhs.spec.version === '0.1') {\n throw new Error('Cannot extend buildspec at vers... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Allow simulation with calculated currents, derived from set of linear equations. Use Modified Nodal Analysis (MNA) as shown here: Reference: DeCarlo, RA, Lin PM, Linear Circuit Analysis: Time Domain, Phasor and Laplace Transform Approaches, Oxford University Press, 2001. Node Voltage, Loop Current, and Modified N... | function induceCurrents(diagram) {
const elements = diagram.getElements();
// Find paths from positive to negative terminals.
const positiveTerminals = elements.filter(
(element) => element.getType?.() === "positiveTerminal"
);
const negativeTerminals = elements.filter(
(element) => element.getType?... | [
"function calculatesTrajectory()\n {\n var path = rg.path.pos;\n var timeStep = rg.timeStep.t;\n //pi = path index, we start here from poinit B:\n for( pi = 1; pi<spatialStepsMax; pi++ ) {\n\n\n //====================================================\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear the passed in event id from the timeline | clear(eventId) {
if (this._scheduledEvents.hasOwnProperty(eventId)) {
const item = this._scheduledEvents[eventId.toString()];
item.timeline.remove(item.event);
item.event.dispose();
delete this._scheduledEvents[eventId.toString()];
}
return this;
... | [
"clear(eventId) {\n if (this._scheduledEvents.hasOwnProperty(eventId)) {\n const item = this._scheduledEvents[eventId.toString()];\n\n item.timeline.remove(item.event);\n item.event.dispose();\n delete this._scheduledEvents[eventId.toString()];\n }\n\n return this;\n }",
"function cl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test to get, set and delete a test record. | function testGetSet(callback)
{
var key = 'test#' + token.create();
var value = {a: 'b'};
var cache = new exports.Cache();
testing.assertEquals(cache.get(key), null, 'Could get record before setting it', callback);
testing.assert(cache.set(key, value), 'Could not set record', callback);
testing.assertEquals(cache... | [
"function testGetSetDelete(callback)\n{\n\tvar key = 'test#' + token.create();\n\tvar value = {\n\t\ta: 'b',\n\t};\n\trunTest(11235, function(client, rest)\n\t{\n\t\tclient.set(key, value, 10, function(error, result)\n\t\t{\n\t\t\ttesting.check(error, 'Could not set value', callback);\n\t\t\ttesting.assertEquals(re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Safe way of detecting whether or not the given thing is a primitive and whether it has the given property | function primitiveHasOwnProperty (primitive, propName) {
return (
primitive != null
&& typeof primitive !== 'object'
&& primitive.hasOwnProperty
&& primitive.hasOwnProperty(propName)
);
} | [
"function primitiveHasOwnProperty (primitive, propName) {\n return (\n primitive != null\n && typeof primitive !== 'object'\n && primitive.hasOwnProperty\n && primitive.hasOwnProperty(propName)\n );\n }",
"function isPrimitive(v) {\n if (v === undefined) return false;\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcao que encapsula o pedido para obter o terapeuta por id tipoPedido: "idTerapeuta" > pedido para obter o terapeuta com o idTerapeuta "metodo" > | function pedidoInformacaoTerapeutaIdXML(idTerapeuta, metodo) {
var $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<pedido>\n" +
"\t<metodo>" + metodo + "</metodo>\n" +
"\t<tipoPedido>" + "getTerapeutaById" + "</tipoPedido>\n" +
"\t<idTerapeuta>" + idTerapeuta + "</idTerapeu... | [
"function criarLinhaPedido(pedido){\n const linhaPedido = criarElemento('tr');\n const cliente = pedido.cliente;\n const status = pedido.status;\n const data = getDataEmDDMMYYYY(pedido.data);\n linhaPedido.incluirFilho(criarElemento('td').adicionarTexto(pedido.id));\n linhaPedido.incluirFilho(criarElemento('t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove a single counter by id | @action
removeCounter(id) {
this.counters = this.counters.filter((c) => c.id !== id);
} | [
"async function decrementCounter(id) {\n const res = await query(`\n UPDATE counters\n SET count = count - 1\n WHERE id = ${id}`);\n console.log(\"models - decrement cointer\", id);\n return res;\n}",
"remove(id) {\n if (id !== -1) {\n let index = this.getIndex(id)\n this.clients.splice(index, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
super `arrayOfArgs` is an optional array of args like one might pass to `Function.apply` TODO(sjmiles): $super must be installed on an instance or prototype chain as `super`, and invoked via `this`, e.g. `this.super();` will not work if function objects are not unique, for example, when using mixins. The memoization st... | function $super(arrayOfArgs) {
// since we are thunking a method call, performance is important here:
// memoize all lookups, once memoized the fast path calls no other
// functions
//
// find the caller (cannot be `strict` because of 'caller')
var caller = $super.caller;
// ... | [
"function $super(arrayOfArgs) {\n // since we are thunking a method call, performance is important here: \n // memoize all lookups, once memoized the fast path calls no other \n // functions\n //\n // find the caller (cannot be `strict` because of 'caller')\n var caller = $super.caller... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Data Provider for reports grouping testCases. ['User Name Field', 'Text Field', 'Date Field', 'Duration Field'], | function groupingTestCases() {
return [
{
message: 'USER FIELD: A to Z',
fieldName: 'USER NAME',
groupDirection: 'Group A to Z',
expectedGroups: ['Angela Leon', 'Chris Baker', 'Jon Neil'],
exp... | [
"function sortingReportTestCases() {\n return [\n {\n message: 'Sort by Date field in ascending order',\n sortFids: [function(row) {return getSortValue(row, 8);}],\n sortOrder: ['asc'],\n sortList: [\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Print all declared variables into the variables window | function printVars() {
var d = "";
var p = "";
var l = "";
var c = "";
var g = "";
var total = "";
for (var i = 0; i < distanceVariables.length; i++) //Add all declared distance variables to the total string
d += distanceVariables[i] + ', ';
if (d.length > 0)
total += 'Distance: ' + d + '<br>';... | [
"function printVariables()\n{\n var a = 5;\n var b = 7;\n console.log(\"a = \" + a + \"; b = \" + b + \"; c = \" + c);\n var c = 9;\n console.log(\"a = \" + a + \"; b = \" + b + \"; c = \" + c);\n}",
"function print_all_variables() {\n code += '\\n';\n\n var bools_i = 0;\n var floats_i = 0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds the committing flag to changed events before commit. | onEventBeforeCommit({ changes }) {
// Committing sets a flag in meta that during eventrendering applies a CSS class. But to not mess up drag and
// drop between resources no redraw is performed before committing, so class is never applied to the element(s).
// Applying here instead
[...changes.a... | [
"onEventBeforeCommit({ changes }) {\n const { currentOrientation, committingCls } = this;\n // Committing sets a flag in meta that during event rendering applies a CSS class. But to not mess up drag and\n // drop between resources no redraw is performed before committing, so class is never appl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
validate the user input is correct only integers in the whole number cell only integers and '/' in the fraction cell | function validate()
{
if(fraction_in.value == "" && whole_in.value == "")
{
console.log("empty input");
error_message.className = "panel panel-danger display";
error_invalid_syntax.className--;
error_empty.className += " display";
error_divide_zero.className--;
}
... | [
"function checkValid() {\n if (num === 1) {\n console.log(\"This is already a unit fraction: \" + num + \"/\" + den);\n return false;\n }\n if (num >= den) {\n console.log(\"This is not a proper fraction, please choose a numerator smaller than the denominator\")... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets the currentInstrument variable to the one that was clicked | function setInstrument(){
//sets all the instruments to black in both pages...
for(let i=0; i<=$instrumentsWrite.length-1; i++){
$($instrumentsWrite[i]).css('background-color', 'black');
}
for(let i=0; i<=$instrumentsDraw.length-1; i++){
$($instrumentsDraw[i]).css('background-color', 'black');
}
cur... | [
"setInstrument(instrument) {\n this.setState({\n pendingInstrument: instrument\n })\n\n // if changing instrument mid-recording, cues popup\n if ( instrument !== this.state.instrument ) {\n this.props.stopFunction();\n this.props.changeInstrument(\"stop\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Length check takes an input string as well as minimum and maximum length. Checks that the length of the input string is greater than or equal to the minimum length. Checks that the length of the input string is less than or equal to the maximum length. | function lengthCheck(input, min, max) {
return (input.length >= min && input.length <= max);
} | [
"function isValidLength(string, min, max) {\n\tif (string.length < min || string.length > max) return false;\n\telse return true;\n}",
"function isValidLength(string, min, max) {\n if (string.length < min || string.length > max) return false;\n else return true;\n}",
"function validateInputLength(string, le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creating footer by DOM elements | function createFooter() {
var foot = document.createElement("footer");
foot.setAttribute("class", "footer fixed-bottom mt-auto py-2");
var footDiv = document.createElement("div");
footDiv.setAttribute("class", "container-fluid");
var footDivSpan = document.createElement("span");
footDivSpa... | [
"buildFooter() {\n this.footer = document.createElement('footer');\n this.footer.appendChild(this.buildItemCounter());\n this.footer.appendChild(this.buildActivityNotifier());\n }",
"function appendFooter(){\n var footer = \"<div class='footer'>\";\n footer += \"<center><div clas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
call API to get proper greeting ============================================================================== | function _callGreetingAPI(i_sName) {
var l_oXHR = new XMLHttpRequest();
l_oXHR.open("GET", "/api/greetings/" + i_sName, true);
l_oXHR.send();
l_oXHR.onloadend = _onGreetingReceived.bind(this, l_oXHR);
} | [
"randomGreeting() {\n if (config.has('hub.display.greetings')) {\n const greetings = config.get('hub.display.greetings');\n return greetings[Math.floor(Math.random() * greetings.length)];\n }\n\n return 'hello';\n }",
"function getGreeting (name) {\n return \"Hello \" + name\n}",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the association of a condition to a specific target entity. | function ConditionTarget(condition, target, properties) {
this.condition = condition;
this.target = target;
this.properties = properties;
// Attach the condition target to the target entity.
target.meta.setCondition(this);
} | [
"function addCondition(newCondition){\n\tif (newCondition == null)\n\t\tnewCondition = policyItem.createCondition(1);\n\n\t// Add the condition in the object\n\tpolicyItem.conditions.push(newCondition);\n\t\n\t// Redraw the policy rule\n\tdrawPolicyItem();\n}",
"static hasOne(target_model_or_column, options) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fix compatibility issues with mainly IE 8 and earlier. Do this before the rest of the app loads since even common functions are missing, such as console.log | function preventCompatibilityIssues(){
/* Add trim() function for IE*/
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
/**
* Protect window.console method calls, e.g. console is not defined on IE
* unless dev too... | [
"function handleFrontPageFormIE8() {\n if (window.OLD_IE) {\n $(\"body\").addClass(\"msie8\");\n }\n }",
"function fixIE8NavBar() {\n\n function checkNavBarHidden() {\n var bottom = $(\".navbar-fixed-top\").offset().top + $(\".navbar-fixed-top\").height();\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a Bezier surface, given a mesh of 44 control points ... | function BezierSurface( name , shader , nbSamples, points , colors )
{
// Call parent constructor (mandatory !)
GenericObject.call( this , name , shader ) ;
this.nbSamples = nbSamples;
if ( !(points instanceof Array) )
throw new Error("BezierSurface shall be called with a point array!");
this.n ... | [
"function bezier_surface (controlpoints,dim,domain) {\n\tvar surface = BEZIER(dim)(controlpoints);\n\tvar mapping = ROTATIONAL_SURFACE(surface);\n\treturn MAP(mapping)(domain);\n}",
"function bezier_surface (controlpoints,dim,domain) {\n\tvar curve = BEZIER(dim)(controlpoints);\n\tvar mapping = ROTATIONAL_SURFACE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return true if event a and b is considered to be on the same row. | function onSameRow(a, b) {
return (
// Occupies the same start slot.
Math.abs(b.start - a.start) <= 30 ||
// A's start slot overlaps with b's end slot.
(a.start > b.start && a.start < b.end)
)
} | [
"function onSameRow(a, b) {\n return (\n // Occupies the same start slot.\n Math.abs(b.start - a.start) <= 30 ||\n // A's start slot overlaps with b's end slot.\n a.start > b.start && a.start < b.end\n );\n}",
"function sameRow(x1, y1, x2, y2) {\r\n return y1 == y2;\r\n}",
"function onSameRow(a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Where the magic happens! Returns a function that, when called, shows the transaction corresponding to the current wepay._txnIdx value, increments wepay._txnIdx, sets a timer for the next recursive callback to be called in interval ms, and returns true in order to terminate the callback function | function txnCallbackFactory(interval) {
return function() {
var txnG = d3.wepay._txnGs[0][d3.wepay._txnIdx];
showTransaction(txnG); // animate arcs
if (d3.wepay._counter) { // update counter if it exists
d3.wepay._counter.updateCounter(++d3.wepay._txnCt);
}
if (d3.wepay._timeline) { //... | [
"function recursiveTxnCallback() {\n\t\t// Base case: no more transactions, so will update data\n\t\tif (d3.wepay._txnIdx >= d3.wepay._txnGs.size()) { \n\t\t\treturn function() { \n\t\t\t\td3.wepay.util.updateData( d3.wepay._dataFile );\n\t\t\t\treturn true; \n\t\t\t};\n\t\t} else if (d3.wepay._txnIdx == d3.wepay._... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks the current year against the start year and returns true if current year is later than start year | function CheckDate(theYear, startYear, feet) {
if (theYear > startYear)
return true;
else return false;
} | [
"function checkYear(start, current) \n{\n\tif (start.value > current.value )\n\t{\n\t\talert(\"Current year can't be greater than enrollment year.\");\n\t\treturn false;\n\t}\n\t\n\treturn true;\n}",
"function validYear(start, end, cur) {\n return (Date.parse(start) <= Date.parse(cur)) &&\n (Date.parse(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
is passed a Config object and returns an SSAP Session object if Config object is valid. If not valid, then returns null | function getSSAPSessionObject(cConfig) {
if (!cConfig.IsValid()) {
return null;
}
try {
var oSSAPSession = new SSAPSession();
oSSAPSession.cConfig = cConfig;
}
catch (oErr) {
return null;
}
return oSSAPSession;
} | [
"function getSession() {\n if (!isConfigured) {\n configure();\n }\n return sessionFactory.currentSession;\n}",
"static createSession() {\n var sessionType = null;\n var storageDetails = {};\n if (applicationFacade.config.env.SESSION_STORAGE) {\n storageDetails = re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
assemble the github api url | function buildUrl(name) {
return "https://api.github.com/users/"+name;
} | [
"function buildApiUrl()\n {\n url = apiUrl; \t// updated in v1.4\n return url;\n }",
"function buildURL(repo, settings) {\n var path = 'repos/' + settings.organisation + \"/\" + repo + '/pulls';\n console.log(\"Fetching prs for repo\", repo);\n return {\n uri: 'https://ap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the first frag in the previous level which matches the CC of the first frag of the new level | function findDiscontinuousReferenceFrag(prevDetails, curDetails) {
var prevFrags = prevDetails.fragments;
var curFrags = curDetails.fragments;
if (!curFrags.length || !prevFrags.length) {
logger["b" /* logger */].log('No fragments to align');
return;
}
var prevStartFrag = findFirstFragWithCC(prevFra... | [
"function findDiscontinuousReferenceFrag(prevDetails,curDetails){var prevFrags=prevDetails.fragments;var curFrags=curDetails.fragments;if(!curFrags.length||!prevFrags.length){logger_1.logger.log('No fragments to align');return;}var prevStartFrag=findFirstFragWithCC(prevFrags,curFrags[0].cc);if(!prevStartFrag||prevS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make AW items drag/droppable. | function makeDraggable() {
$('.dps-aw-item').draggable({
revert: "invalid",
appendTo: 'body',
containment: 'window',
scroll: false,
helper: 'clone',
start: function(event, ui) { jQuery(this).hide(); },
stop: function(event, ui) { jQuery(this).show(); }
});
console.log("test");
} | [
"function _createDroppables() {\n\t\t$(\".item, .character\").droppable({\n\t\t\thoverClass: \"drop-hover\",\t\t// USE CLASS FOR AN ICON?\n\t\t\tdrop: function(event, ui) {\n\t\t\t\t// Lookup dragged item in Entities:\n\t\t\t\tvar dragid = $(ui.draggable[0]).children().attr(\"id\"),\n\t\t\t\t\titem = MYGAME.entitie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shows a list of active modifiers based on the selected perks. The list is grouped by modifier type. Todo: Allow removing the perk by clicking on a remove link in the modifier list | function outputModifiers() {
let modifiersHtml = {
'piloted_ship': [], 'fleet': [], 'fighters': [], 'governed_colony': [], 'hull_mod': [], 'ability': [], 'other': []
};
for (let i in skills) {
for (let pId in skills[i].perks) {
let perkObj = skills[i].perks[pId];
if (... | [
"drawModifiers() {\n // Draw the modifiers\n this.modifiers.forEach((modifier) => {\n // Only draw the dots if enabled\n if (modifier.getCategory() === 'dots' && !this.render_options.draw_dots) return;\n\n modifier.setContext(this.context);\n modifier.drawWithStyle();\n });\n }",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to find the Mean of weather conditions | function findMean(prevW){
var sum={"temp":0.0,"humidity":0.0,"wind":0.0,"fog":0.0,"snow":0.0,"rain":0.0,"pressure":0.0};
var meaners ={"temp":0.0,"humidity":0.0,"wind":0.0,"fog":0.0,"snow":0.0,"rain":0.0,"pressure":0.0};;
var daytoDayDiff = [];
for(var i=0; i<prevW.length-1; i++){
daytoDayDiff.push( {"temp":... | [
"function get_mean(){\r\n\r\n for(var i=0; i<tempdata.length;i++){\r\n tempsum += tempdata[i].tem;\r\n }\r\n var mean = tempsum/tempdata.length;\r\n console.log( 'mean_temperature > ' + mean);\r\n}",
"function get_mean(){\n var sum=0;\n var n=0;\n var mean;\n for(let i=0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function writes 'hit' or 'miss' text to screen | function hitText(text,status) {
if ($('#hitText')) {
$('#hitText').remove();
}
var $hitText = $('<h4 id="hitText"></h4>');
$hitText.text(text).addClass(status+' hitTextBox').appendTo('.results');
setTimeout(function () {
$('#hitText').fadeOut('slow');
}, 1000);
} | [
"function successfulHit() {\n hitSound.play();\n hitDom.text(hitCounter);\n}",
"function onscreenText() {\n if (keyIsDown(RIGHT_ARROW) || mouseIsPressed) {\n }\n else {\n fill(0);\n rect(width/2 - 152, height/2 + 220, 303, 500);\n var continueText = \"just keep going\";\n textAlign(CENTER,CEN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shows the dialog box for the creation of an item's barcode (see file '.html') | function showDialogBarcodeCreation() {
var title = 'Generate and Export Barcodes';
var templateName = 'barcodes';
var width = 800;
createDialog(title,templateName,width);
} | [
"function showDialogBulkBarcodeCreation() {\n var title = 'Generate Barcodes from Sheet'; \n var templateName = 'bulkBarcodes'; \n var width = 800; \n \n createDialogWithAllData(title,templateName,width);\n}",
"function ManualBarcodeEntry() {\n var text = document.getElementById(\"txt_input\").value;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reverses a string transformed using escapePropertyName() back to its original form. Note that the reverse transformation might not be 100% correct for certain unlikelytooccur strings (e.g. string contain null chars). | function unescapePropertyName(name) {
// pre-test to improve performance
if (REGEXP_IS_ESCAPED.test(name)) {
name = name.replace(REGEXP_DOT, '.');
name = name.replace(REGEXP_DOLLAR, '$');
name = name.replace(REGEXP_TO_BSON, 'toBSON');
name = name.replace(REGEXP_TO_STRING, 'toStri... | [
"function reverseInPlace(str) {}",
"function reverse(string) {}",
"function reverse(str) {}",
"function reverser(string){\r\n return string.split('').reverse().join('');\r\n}",
"function ReverseString(Expression)\r\n{\r\n if (Expression == null)\r\n return (false);\r\n\r\n var de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
take the name of manuscript and return a list of possible pages | function getPage(manu) {
var pageext =[];
for(i=0;i<manuList.length;i++){
if(manuList[i]==manu){
pageext.push(pageList[i]);
}
}
return pageext;
} | [
"function getexamplePage(manu) {\r\n var examplePage;\r\n\r\n for(i=0;i<manuList.length;i++){\r\n if(manuList[i]==manu){\r\n examplePage=fullpageList[i];\r\n break;\r\n }\r\n }\r\n return examplePage;\r\n}",
"function AllPages() { }",
"function _filterPages(result... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DATA / Evaluates the parameter spec to determine which input widget needs to be invoked, but doesn't know what the widget does. Provides the communication bus for each input to route info to the widget and out of it. In terms of widgets it looks like this: InputCellWidget inputWidgets FieldWidget textInputWidget FieldW... | function makeFieldWidget(appSpec, parameterSpec, value) {
return paramResolver.loadViewControl(parameterSpec).then((inputWidget) => {
const fieldWidget = FieldWidget.make({
inputControlFactory: inputWidget,
showHint: true,
useRowHig... | [
"function loadInputParamsWidget() {\n pRequire('nbextensions/viewCell/widgets/appParamsWidget')\n .then(function(Widget) {\n\n\n var bus = runtime.bus().makeChannelBus({ description: 'Parent comm bus for input widget' });\n\n paramsWidget = Widget.make... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
relationship_status computed: true, optional: false, required: false | get relationshipStatus() {
return this.getStringAttribute('relationship_status');
} | [
"function getRelationship(){\n\n }",
"get relationship() {\n\t\treturn this.__relationship;\n\t}",
"function followingStatus(status) {\n\n if (status !== null) {\n if (status === Relationship.CanceledFollowRequest) {\n return Relationship.NoneExist;\n } else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Limit this logic to only determining if who the controlling player is. The dice result can be passed in as separate logic. | function controllingPlayer(batter, pitcher, diceResult) {
if ((diceResult + pitcher.obc) > batter.obc) {
return pitcher;
}
return batter;
} | [
"function diceSix(otherPlayer) {\n\n if (diceNumber === 6) {\n togglePlayer();\n diceSixModal(otherPlayer); \n playerCardPosition(otherPlayer);\n return true;\n }\n return false;\n}",
"checkWinCondition() {\n for(const player of this.getPlayersInFirstPlayerOrder()) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates a string to prefix an error message about failed argument validation | function errorPrefix(fnName, argName) {
return `${fnName} failed: ${argName} argument `;
} | [
"function errorPrefix(fnName, argName) {\n return `${fnName} failed: ${argName} argument `;\n}",
"function errorPrefix(fnName, argName) {\n return fnName + \" failed: \" + argName + \" argument \";\n}",
"function errorPrefix(fnName, argName) {\r\n return fnName + \" failed: \" + argName + \" argument \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate Urls form saved session data | function validateOldUrl(oUrl){
if (sessionStorage.getItem(oldURLSessionKey) === null || sessionStorage.getItem(oldURLSessionKey) === undefined) {
oUrl = "";
sessionStorage.setItem(oldURLSessionKey, oUrl);
}
return oUrl;
} | [
"function validateNewUrl(nUrl){\n if (sessionStorage.getItem(newURLSessionKey) === null) {\n nUrl = \"\";\n sessionStorage.setItem(newURLSessionKey, nUrl);\n }\n return nUrl;\n}",
"validate({url}, second) {\n\t\tlet errors = {}\n const user = store.getState().user.get('id')\n\t\tif (!user) errors.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build HTML output, primarily the index.html file. Use gulpsrihash to compute the subresource integrity attributes on link and script tags that load our CSS and JS, respectively. | function buildHtml() {
// NOTE: sri-hash expects to find asset files referenced by the source HTML files either relative
// to the file's base Vinyl attribute (which is typically the glob base, see here:
// https://gulpjs.com/docs/en/api/concepts#glob-base) or relative to the directory containing the
// HTML fi... | [
"function createIndexHtml() {\n var pkg = getPackage();\n var plugin = getPlugin();\n\n // Setup substitutions.\n var config = {};\n\n // Substitute the plugin name.\n config.pluginName = plugin.header.name;\n config.pluginKind = plugin.header.kind;\n\n // If the plugin package includes an npm organization ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Begin the next batch of textures. | _nextBatch() {
var this$1 = this;
this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE);
this._batchIndex++;
setTimeout(function () {
if (this$1._batchIndex * Spritesheet.BATCH_SIZE < this$1._frameKeys.length) {
this$1._nextBatch();
}
... | [
"function nextbatch() {\n setPokebatch(nextPokebatch);\n setSpriteoffset(spriteoffset + 6);\n setNofind(false);\n }",
"_nextBatch() {\n this._processFrames(this._batchIndex * _Spritesheet2.BATCH_SIZE), this._batchIndex++, setTimeout(() => {\n this._batchIndex * _Spritesheet2.BATCH_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Success :: b > Result a b | function Success(value) {
return new _Result('Success', value);
} | [
"function success(result) {\n return {\n ok: true,\n result,\n };\n}",
"function isSuccess(src, dst) {\n if (!(src instanceof OpResult)) {\n return false;\n }\n if (dst instanceof OpResult) {\n dst.success = src.success;\n dst.message = src.message;\n dst.data = src.data;\n }\n return src... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads all songs in the localStorage to the page | function loadSongs() {
if (!store.getItem('songs')) createStore()
var songArray = JSON.parse(store.getItem('songs'))
for (var i = 0; i < songArray.length; i++) {
var para = document.createElement('P');
var t = document.createTextNode(songArray[i]);
para.appendChild(t);
document.querySelector('.son... | [
"function saveSongList() { // writes the song list to local storage\n localStorage.setItem('songList', JSON.stringify(allSongs));\n}",
"function loadPlaylist() {\n var ul = document.getElementById(\"playlist\");\n var playlistArray = getSavedSongs();\n var songCount = playlistArray.length;\n \n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to display cities buttons using for loop.. similar to class activities 0610 | function rendercity() {
$(`#cityList`).empty()
for (var i = 0; i < cities.length; i++) {
a = $("<button>")
a.addClass("city");
a.attr("cityName", cities[i]);
a.text(cities[i]);
$("#cityList").append(a);
}
// forecast()
} | [
"function displayButtons() {\r\n citiesDiv.innerHTML = \"\";\r\n if (cities == null) {\r\n return;\r\n }\r\n\r\n //Ensure there are no duplicates in the array...\r\n let singleCities = [...new Set(cities)];\r\n for (let i = 0; i < singleCities.length; i++) {\r\n let singleCityName = sing... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks a classifier that was found in Bluemix, to see if information about it is stored in the DB. | async function isClassifierKnown(classifier, creds, expected, expectedErrors) {
try {
const classifierInfo = await store.getClassifierByBluemixId(classifier.id);
// if the classifier wasn't found in the DB...
if (!classifierInfo &&
// ... and it isn't a classifier that everyone g... | [
"static IsClassified(Id, Class)\n\t{\n\t\tvar Index = Upgrade.GetIndexOf(Id);\n\t\tif (Index == -1)\n\t\t\treturn false;\n\t\treturn (GlobalUpgrades[Index].Class.indexOf(Class) != -1)\n\t}",
"async function handleUnknownClassifier(credentials, classifier) {\n const classPolicy = await store.getClassTenant(cred... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checkStateCode (TEXTFIELD theField [, BOOLEAN emptyOK==false]) Check that string theField.value is a valid U.S. state code. For explanation of optional argument emptyOK, see comments of function isInteger. | function checkStateCode (theField, emptyOK)
{ if (checkStateCode.arguments.length == 1) emptyOK = defaultEmptyOK;
if ((emptyOK == true) && (isEmpty(theField.value))) return true;
else
{ theField.value = theField.value.toUpperCase();
if (!isStateCode(theField.value, false))
return w... | [
"function checkZIPCode (theField, emptyOK)\r\n{ if (checkZIPCode.arguments.length == 1) emptyOK = defaultEmptyOK;\r\n if ((emptyOK == true) && (isEmpty(theField.value))) return true;\r\n else\r\n { var normalizedZIP = stripCharsInBag(theField.value, ZIPCodeDelimiters)\r\n if (!isZIPCode(normalized... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to read from IndexedDB and call the addOrder mutation | async function saveOrder() {
const cart = await idbPromise('cart', 'get'); // get all of the items in the cart
const products = cart.map(item => item._id); // map the cart items into an array of IDs
// Once we have the IDs, pass them to the mutation, then delete them from IndexedDB
... | [
"placeOrder(order) {\n return this.saveToDb([order]).then(() => {\n this.reindexTable();\n return order;\n });\n }",
"static openIndexedDB(){\r\n return idb.open('restaurantReview', 1, function(upgradeDb){\r\n switch(upgradeDb.oldVersion) {\r\n case 0:\r\n case 1:\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prefix the id with tasks so that the keys are different with respect to this app | function getId(id) {
return "tasks."+id;
} | [
"_generateTaskID() {\n return UUID.uuid4();\n }",
"static get key() {\n return 'NewTaskMail-job';\n }",
"function createId(name) {\n const clock = new Date();\n const num1 = clock.getDate().toString();\n const num2 = (clock.getMonth() + 1).toString();\n const num3 = clock.getHours().to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Select pattern(see: r3container.jsx) [type][service][path][selected item] ROLE/POLICY/RESOURCEemptyempty/pathROLE/POLICY/RESOURCE top or path under it ROLE/POLICY/RESOURCEservice nameempty"SERVICE > service name > ROLE/POLICY/RESOURCE" ROLE/POLICY/RESOURCEservice namepath"SERVICE > service name > ROLE/POLICY/RESOURCE >... | selectTreeList(treeList, service, type, path)
{
if(!r3IsSafeTypedEntity(treeList, 'array') || 0 === treeList.length){
return false;
}
if(r3IsEmptyString(type, true)){
return false;
}
let cnt;
let cnt2;
if(r3CompareCaseString(serviceType, type)){
//
// This case is under SERVICE
//
if(!... | [
"function _createNewServiceInstanceSelectServiceEntry(){\n\t\t\t_checkState(CONST_STATE_ADD_SELECT_TYPE);\n\t\t\t_removeAddEntrySelectTypeIfRequired();\n\t\t\t\n\t\t\tvar newId = _generateNewId();\n\t\t\tvar opts = {\n\t\t\t\tkey: newId,\n\t\t\t\tservices: _readPortalServices()\n\t\t\t};\n\t\t\t\n\t\t\tvar itemToIn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |