query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Adds movie to DB if movie does not already exist
async function addToMovieTable(movie, user) { const result = await db.Movie.findOne({ where: { apiReferenceId: movie.apiReferenceId } }); if (!result) { db.Movie.create(movie).then((response) => { db.User.update( { movieOnDeckId: response.id }, { ...
[ "function addMovie(movie){\n\tlet check = false;\n\tmovieObjects.forEach(elem => {\n\t\tif(elem.title === movie.title){\n\t\t\tcheck = true;\n\t\t}\n\t})\n\tif (!check){\n\t\t// add directors\n\t\tlet addDirectors = [];\n\t\tlet directors = movie.director;\n\t\tlet directorObjects = peopleObjects.directors;\n\t\tdi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
====== Add Resources Button (btnSectionAddInput) ======
function addResourcesInput(e) { e.preventDefault(); // Variables let pageElementContainer; let resourcesCount; let parentArray; /* This is the parentArray */ let pageResourcesInput_div; let pageResourcesInput_btn; let pageResourcesInput_input; let pageResourcesInput_textarea; le...
[ "function addResource(root) {\n // Check if data source name already exists\n var resourceConfigs = root.getElementsByTagName(\"resource\");\n var resourceId = $(\"#r-addedit-opname-input\").val();\n var methodValue = $(\"#r-addedit-resourcemethod-select-original\").val();\n var resourceMethod = $(\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
attaches the internal event and processing callback within the promise to our xhr object
registerXhrCallbacks(resolve, reject) { const xhrObject = this.xhrObject; xhrObject.onabort = () => { this.onAbort(resolve, reject); }; xhrObject.ontimeout = () => { this.onTimeout(resolve, reject); }; xhrObject.onload = () => { this.on...
[ "_loadXhr() {\n // // if unset, determine the value\n // if (typeof this.xhrType !== 'string') {\n // this.xhrType = this._determineXhrType();\n // }\n // var xhr = this.xhr = new XMLHttpRequest();\n // // set the request type and url\n // xhr.open('GET', this._r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get max position of jcarousel items
function getMaxPosition() { var position = 1; jQuery('.jquery-toolkit ul li').each(function(){ position = Math.max(position, parseInt(jQuery(this).data('index'))); }); return position; }
[ "function get_highest_item( carousel ){\n var heights = [];\n carousel.find(\".owl-item\").each(function(){\n heights.push($(this).outerHeight());\n });\n\n return Math.max.apply(null, heights);\n }", "get lastItem() {\n if (this._totalItems...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
call custom handler by name extracted from list or arguments
_callHandler() { let args = [].slice.call( arguments ); let name = args.length ? args.shift() : ''; if ( name && typeof this._options[ name ] === 'function' ) { this._options[ name ].apply( this, args ); } }
[ "handler(name) {\n return externals[name].getSpecificHandler(self);\n }", "function callEventHandler(handler, args) {\n if(handler) {\n if(Array.isArray(handler)) {\n let result = [];\n for(let i in handler) {\n //handler[i](slice_i);\n result.push(handler[i].apply(null, ar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
endregion MATERIAL region BLENDSHAPES Take newBlendshapeData and update selected blendshape, properties, and the avatar blendshapes
function updateBlendshapes(newBlendshapeData, isName) { if (DEBUG) { print("New blendshape data", JSON.stringify(newBlendshapeData)); } if (!isName) { // is not named blendshape, ensure last blendshape is not selected dynamicData[STRING_BLENDSHAPES].selected =...
[ "AddBlendShapeFrame() {}", "function applyNamedBlendshapes(blendshapeName) {\n // Set the selected blendshape data in UI\n dynamicData[STRING_BLENDSHAPES].selected = blendshapeName;\n\n switch (blendshapeName){\n case \"default\":\n updateBlendshapes(BLENDSHAPE_DATA....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show the fakeloader animation.
show() { this.$fakeLoader.show(); }
[ "function showLoader() {\n\n loader.show();\n }", "function showLoader()\n {\n\t\t$('.loader-container').show();\n $('.loader-back').show();\n }", "function showLoader()\n {\n\t\t$('.loader-container').show();\n $('.loader-container').preloader({\n zIndex: 1000,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a function maxOrMin that takes three parameters: two numbers and a boolean. Have it return the larger of the two numbers if the boolean is true, otherwise have it return the lesser of the numbers.
function maxOrMin(a, b, boolean) { // if boolean is true & a is greater than b, return a if ( (boolean) && (a > b) ) { return a; // if boolean is true & b is greater than a, return b } if ( (boolean) && (b > a) ) { return b; // if boolean is not true & a is less than b, return a } else if ( (!boolea...
[ "function maxOrMin (num1, num2, islarger) {\n if (islarger) {\n var largerNum = Math.max(num1, num2);\n return largerNum;\n } else {\n var lowerNum = Math.min(num1, num2);\n return lowerNum;\n }\n}", "function max (a, b){\nif (a > b){\nreturn a;\n}else{\nreturn b;\n}\n}", "function max1(a, b){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback function to display the large image on the display page
function large_image(result){ var parsed = JSON.parse(result); var image_url = parsed.collection.items[1].href; var image_spot = document.getElementById('side_image'); document.getElementById('loading_photo').style.display = "none"; var img = new Image(); img.src = image_url; img.setAttribute('width',"100%"...
[ "function displayLargeImage(){\r\n $(\"imgLarge\").src = imgArr[viewerIndex].src;\r\n}", "function displayResult(url, large_url) {\n\t\t\tlet image = document.createElement('img');\n\t\t\timage.src = url;\n\t\t\tresults.appendChild(image);\n\t\t\timage.dataset.large_url = `${large_url}`;\n\t\t\timage.className...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The entry point of our application (constructor in Java) cashElements: the app needs to reference some elements on the dom attatchEvents: the app needs to react to some dom events (click, submit) render: we need to show things on the screen when the app start (initial/first render)
function init() { cashElements(); attachEvents(); render(); }
[ "function renderApp(){\n makeInputAutocomplete();\n watchFormSubmit(); \n newSearchClicked(); \n calculationsButtonClicked();\n xButtonClicked();\n toTop();\n toTopButtonClicked();\n}", "function renderApp(){\n var homepageData = [\n {\n adj: \"Simple\",\n desc: \"We like to k...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if we are duoing and sets if we are Takes the match, the row, and an array of player names as strings
function setDuoer(match, row, players) { // Note that the way that this checks if we are duoing checks by seeing if we have duo'd with this person before // So you WILL have to manually enter it the first time you duo with a player // Also note that if you queue into a game with multiple players on your team that...
[ "function populateDebaterList(){\n var debaterSheet=ss.getSheetByName(SHEET_DEBATER);\n var rangeName = debaterSheet.getRange(3, 1, PLAYER_NUMBER,2);\n var nameFields = rangeName.getValues();\n for(i in nameFields){\n var row = String(nameFields[i][1]);\n var duplicate = false;\n for(j in TEAM_LIST){\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Message to reload if error had occurred by hiding load message and showing current results
function reload(){ alert("An error has occurred!!") hideLoadTheMessage() showElemnt() }
[ "function displayError() {\n\t\t// Hide loading animations\n\t\tdocument.getElementById(\"loadingmeaning\").style.display = \"none\";\n\t\tdocument.getElementById(\"loadinggraph\").style.display = \"none\";\n\t\tdocument.getElementById(\"loadingcelebs\").style.display = \"none\";\n\t\t\n\t\t// Display error at bott...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implements the Color Attack Task
function _colorAttack(anime, _wkTask, params, stage, args) { switch (stage) { case ABeamer.TS_INIT: var attack = params.attack; var propName = params.prop || 'color'; var cycles = ABeamer.ExprOrNumToNum(params.cycles, 1, args); var endC...
[ "computeAttackFromColor (color) {\n\t\treturn this.computeAttack(this.getPieceList().filter((piece) => {\n\t\t\treturn piece.color === color;\t\n\t\t}));\n\t}", "function analyzeColor_random() {\n analyzeColor(randomColor);\n }", "function changeEnemyColor() {\r\n temp_rgb = \"rgb(\";\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given participant's pkfp returns active session if exists
getSession(pkfp){ return this.topicToSessionMap[pkfp]; }
[ "getSession(pkfp){\n return this.getSessionByTopicPkfp(pkfp);\n }", "isSessionActive(pkfp){\n let session = this.activeSessions[pkfp];\n //console.log(\"=============ACTIVE SESSIONS: \" + CircularJSON.stringify(this.activeSessions));\n if(session){\n for (let i = 0; i<ses...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set display Action button
SetDisplayAction(Type){ switch (Type) { case "On": this._DisplayType = Type if (document.getElementById(this._HtmlId)) { document.getElementById(this._HtmlId).style.opacity = "1" document.getElementById(this._HtmlId).style.displ...
[ "setActionButtonText(t){this.actionButtonText=t}", "setActionButtonText(t) {\n this.actionButtonText = t;\n }", "action() {\n\t\tthis.toggle();\n\t}", "function displayButton(btnToShow,btnToHide){\n btnToShow.style.display = \"inline-block\";\n btnToHide.style.display = \"none\";\n}", "set targetD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find a recipe with format 'recipen'.
function findRecipe(recipeId) { results = config.results recipes = results.recipes.concat(results.ingredients, results.myRecipe) for (let recipe of recipes) { if ('recipe-' + recipe.id === recipeId) { return recipe } } console.log('ERROR: found unknown recipe with id: ' + recipeId) return {}...
[ "function hasRecipe(clist,c) {\n if (!clist)\n return -1;\n var c2 = c.match(/(^[^+]*)\\+(.*$)/);\n if (c2) {\n c2 = c2[2] +' + '+c2[1];\n c2 = c2.replace(/\\+[\\s]*$/,'').replace(/ /g,' ').replace(/ *$/,'').replace(/^ */,'');\n }\n for (var i=0;i<clist.length;i++) {\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method builds the layout of the game. parameters: layout in the form of an array of images paths, rows, columns to define the grid dimensions and imageFactor to control the placement of each image relative to the other images
buildWorld(layout,rows,cols,imageFactor) { for (var i = 0; i <=rows; i++) { for (var j = 0; j <=cols; j++) { if (imageFactor) { this.canvas[1].drawImage(this.cache[layout[i]],j*imageFactor ,i*imageFactor); } else { this.canvas[1].drawImage(this.cache[l...
[ "function grid () {\n\n\t\t\tvar columnCount, //getColumnCount(),//Math.floor(Math.sqrt(imageCount)),\n\t\t\t\tminRows, //getMinRows(),\n\t\t\t\tcolumns = [],\n\t\t\t\tcc,// = columnCount,\n\t\t\t\timgC,// = (imageCount - (columnCount * 2)),\n\t\t\t\ttmp;\n\n\n\t\t\tvar divider = Math.floor(Math.sqrt(imageCount));\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test if given value is an rgb object
static isRgb(color) { return color && typeof color.r === 'number' && typeof color.g === 'number' && typeof color.b === 'number'; }
[ "static isRgb(color){return color&&\"number\"===typeof color.r&&\"number\"===typeof color.g&&\"number\"===typeof color.b}", "static isRgb(color) {\n return (\n color &&\n typeof color.r === \"number\" &&\n typeof color.g === \"number\" &&\n typeof color.b === \"number\"\n );\n }", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wraps type (.equals) functions to operate on each value of an array
function arrayEqualsHandler(callback) { return function handleArray(val1, val2) { var left = arrayWrap(val1), right = arrayWrap(val2); if (left.length !== right.length) return false; for (var i = 0; i < left.length; i++) { if (!callback(left[i], right[i])) return false;...
[ "function arrayEqualsHandler(callback) {\n return function handleArray(val1, val2) {\n var left = arrayWrap(val1),\n right = arrayWrap(val2);\n if (left.length !== right.length) return false;\n for (var i = 0; i < left.length; i++) {\n if (!callback(left[i],...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function maintains the height of order summary section
orderSummaryHeightAdjust() { if (this.page === pageType.cart) { if (this.isMobile() || this.isTablet()) { document.querySelector('.vx-order-summary').style.maxHeight = (window.innerHeight - 186) + 'px'; } else { document.querySelector('.vx-order-summary').style.maxHeight = ''; ...
[ "function headerHeight() {\n dataStore.wrapper.css({\n 'padding-top': dataStore.header.height()\n });\n}", "get detailHeight() {}", "function foldedItemHeight() {\n return settings.nav_summaryLines * ITEM_LINE_HEIGHT + FOLDED_ITEM_OUTER_HEIGHT_EXTRAS;\n}", "updateInnerHeightDependingOnChilds(){}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if we have selected text and in case we have shows toolpane popup
checkSelection(){ Ember.run.next(() =>{ let sel = this.getSelection(), hasSelection = !!$.trim(sel.toString()); this.$toolpane.css('visibility', hasSelection ? 'visible' : 'hidden'); if(hasSelection) { this.$toolpane.css(this.getToolpaneCoords(sel)); } }); }
[ "function checkSelectedText(e) {\n var selectedText = (document.all)\n ? document.selection.createRange().text\n : document.getSelection();\n if (selectedText.toString().length > 0) {\n //node of selected text\n var node = selectedText.baseNode.parentElement...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
global answerButton2 /global output /global players /global activePlayer /global playerMenuDisplay /global randNum /global lava LAVA EVENTS lava.randEvents = [monster];
function lavaEvent() { //output.innerHTML = "You feel the heat radiating off of the lava as you walk by."; var eventNum = randNum(0, lava.randEvents.length - 1); switch(lava.randEvents[eventNum]) { case "monster": output.innerHTML = "A large splash of huge gouts of lava splash all a...
[ "function explore() {\n var event = Math.floor(Math.random() * 7);\n switch (event) {\n case 0:\n console.log(`${player.name} explores the area and found nothing.`);\n break;\n case 1:\n console.log(`${player.name} found some herbs.`);\n player.collect...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populate HTML session table with appropriate details from db for interactions page
function populateInteractionsTable(response){ var table = document.getElementById("sessions"); console.log(response) var sessionData = JSON.parse(response); console.log(sessionData); //insert data from array into html table for (var i=0; i<sessionData.length; i++) { ...
[ "function tabular_session() {\n $('#session-log-table').html(''); // Cleaing the existing table\n\n $('#session-log-table').append(\n // Adding the header row\n dom('tr', {}, [\n dom('th', { class: 'entry-time' }, 'Time'),\n dom('th', { class: 'entry-level' }, 'Level'),\n dom('th', { class: '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
input: string input_content output: [list_string ListMdppObject, ListDiv];
function mdpp2ListDiv(input_content) { variable_manager.clearVariables(); var ListDiv = []; [preprocessed_content, parse_result, ListMdppObject] = html_preprocessing(input_content); for (var i = 0; i < ListMdppObject.length; i++) { switch (ListMdppObject[i].property) { case "markdown...
[ "function veridoc_render_list(\n data\n){\n var listType = data.listType;\n var listData = data.listData;\n var listTitle = data.listTitle;\n var listNotes = data.listNotes;\n\n document.getElementById('list-title').innerText = listTitle;\n document.getElementById('list-notes').innerText = list...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Flip Cards Content from Json Script ====================================
function drawFlipCard(cards) { _.each(cards, function(card) { var $tmplFlipCard = $($("#templateFlipCard").html()); // Set the name of the card for Google Analytics $("#data-cardname", $tmplFlipCard).html(card.name); // Set the question for the front of the card $(".question", $tmplFlipCard).h...
[ "flipCards(...cards) {\n cards.map(card => {\n //如果是背面,回傳正面\n if (card.classList.contains('back')) {\n card.classList.remove('back')\n card.innerHTML = this.getCardContent(Number(card.dataset.index))\n return\n }\n //如果是正面,回傳背面\n card.classList.add('back')\n car...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses the data contained within the given value and inserts it into the data twodimensional array starting at the rowIndex. If the data is to be inserted into a new column, a new header is added to the headers array. The value can be an object, array or scalar value. If the value is an object, it's properties are iter...
function parseData_(headers, data, path, rowIndex, value, query, options, includeFunc) { var dataInserted = false; if (isObject_(value)) { for (key in value) { if (parseData_(headers, data, path + "/" + key, rowIndex, value[key], query, options, includeFunc)) { dataInserted = true; }...
[ "function parseData_(headers, data, path, rowIndex, value, query, options, includeFunc) {\n var dataInserted = false;\n \n if (isObject_(value)) {\n for (key in value) {\n if (parseData_(headers, data, path + \"/\" + key, rowIndex, value[key], query, options, includeFunc)) {\n dataInserted = true;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the visitidePixels and similarColor debug images
function updateDebugImages(similarColorImg, visitedPixelsImg, similarColor, visitedPixels) { var nPixels, pixel, imgPixel; // Prepare the images similarColorImg.loadPixels(); visitedPixelsImg.loadPixels(); // Update the images nPixels = similarColorImg.width * similarCo...
[ "function update()\n{\n for (var i = 0; i < PIXEL_NUMBER; i++)\n {\n candy.setPixel(i, rgb.r, rgb.g, rgb.b);\n }\n candy.writePixels();\n}", "function colorChange(){\r\n const pixelNumber = height*width;\r\n var pointsChanged = 0;\r\n var imgData1 = ctxPrev.getImageData(0, 0, wid...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================================================== Sets the attack time (in msec) representing the amount of time, in seconds, required to reduce the gain by 10 dB
set attackTime( value ) { const [minValue, maxValue] = OldSmartFader.attackTimeRange; this._attackTime = utilities.clamp( value, minValue, maxValue ); this._updateCompressorSettings(); }
[ "attackTime(value){\n this.audioSynth.attackTime = value; \n }", "attackPlayer() {\n const attackValue = getMinMax(8, 15);\n setTimeout(() => {\n this.addLogMessage('monster', 'attack', attackValue);\n this.playerHealth -= attackValue;\n }, 500);\n }", "function _increaseAtta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Crossover filter INPUT + lp1 + lp2a + LOW (0) | | | | \ hp2a / | \ hp1 + lp2 MID (1) | \ hp2 HIGH (2) [f1] [f2] / Returns a crossover component which splits input into 3 bands
function xo3() { var f1 = INIT_DRC_XO_LOW; var f2 = INIT_DRC_XO_HIGH; var lp1 = lr4_lowpass(f1); var hp1 = lr4_highpass(f1); var lp2 = lr4_lowpass(f2); var hp2 = lr4_highpass(f2); var lp2a = lr4_lowpass(f2); var hp2a = lr4_highpass(f2); connect(lp1, lp2a); connect(lp1, hp2a); connect(hp1, lp2); ...
[ "function OilFilter(){\n\tthis.name = \"Oil Painting\";\n\tthis.isDirAnimatable = false;\n\tthis.defaultValues = {\n\t\trange : 3\n\t};\n\tthis.valueRanges = {\n\t\trange : {min:0, max:5}\n\t};\n\tthis.filter = function(input,values){\n\t\tvar width = input.width, height = input.height;\n\t\tvar inputData = input.d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! Helper Function 2 Pretty Percent
function pretty_percent(n){ var percent = n * 100; if(percent >= 10){ percent = parseInt(percent); } else { percent = percent.toFixed(2) } return percent }
[ "function formatPercent() {\n if (currentStat == 'percent') {\n return '%'\n }\n \n return ''\n }", "function percentof(a,b){\nconsole.log(`${a} is ${a/b*100} % of ${b}.`)\nreturn a/b*100\n}", "function formatPercentage(num) {\n const twoDecimal = Math.round(num * 100)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if white region from blend overlaps area of interest (e.g. triggers)
function checkAreas() { for (var UAYgMqRNl = 0; UAYgMqRNl < UANKaqLvcZ.length; UAYgMqRNl++){ // get the pixels in a note area from the blended image var blendedData = blendContext.getImageData( UANKaqLvcZ[UAYgMqRNl].UAyjdJxcO, UANKaqLvcZ[UAYgMqRNl].UAdDfXoBtH, UANKaqLvcZ[UAYgMqRNl].UAJmGBAbF, UANKaqLvcZ[UAYgMqR...
[ "function checkAreas() \r\n{\r\n\tfor (var b = 0; b < buttons.length; b++)\r\n\t{\r\n\t\t// get the pixels in a note area from the blended image\r\n\t\tvar blendedData = blendContext.getImageData( buttons[b].x, buttons[b].y, buttons[b].w, buttons[b].h );\r\n\t\t\t\r\n\t\t// calculate the average lightness of the bl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles the relative positions of frozen columns.
_handleFrozenColumnPositions() { const that = this, rightToLeft = that.rightToLeft, columns = that._columns; let frozenNear = [], frozenFar = [], selectionModifier = 0; function applyStyle(property, index, value, i, zIndex) { ...
[ "function updateColumnOrder() {\n let i;\n\n const q = new Profiler();\n q.addTime('Get first column');\n const firstColumn = calculateNewFirstColumn();\n\n // Order should be {hiddenColumns, fixedColumns, shownColumns}\n const hiddenColumns = [],\n fixedColumns = [],\n shownColumns = []...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
number of days or hours between two dates
function countBetweenDates(date1, date2, output) { var timeDiff = Math.abs(date2.getTime() - date1.getTime()); var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); var diffHours = Math.ceil(timeDiff / (1000 * 3600)); if (output === 'days'){ alert(diffDays + " is the day count between t...
[ "function numOfDays(date1,date2){\n\tlet d1 = date1.getTime()\n\tlet d2 = date2.getTime()\n\tconst oneDay = 24*3600*1000 \n\tlet diff = (d2-d1)/oneDay\n\treturn diff\n}", "function numDaysBetween(d1, d2) {\n\tvar diff = Math.abs(d1.getTime() - d2.getTime());\n\treturn diff / (1000 * 60 * 60 * 24);\n}", "hoursBe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saves a var declaration to the closest function scope
function saveVarsToScope(node, state) { var func = getCurrentScope(state) if (!func.scope) func.scope = {} node.declarations.forEach(function (v) { func.scope[v.id.name] = true }) }
[ "function foo() {\n a = 3;\n console.log(a); // 3\n var a; // declaration is \"hoisted\"\n// to the top of `foo()`\n}", "function foo() {\n a = 3;\n console.log(a); // 3\n var a; // declaration is \"hoisted\"\n // to the top of `foo()`\n }", "function foo() {\n a = 3;\n console.log(a); /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given options, attachSql2 will produce the correct SQL to attach a database file in sqlite3. This is for the second database file.
function attachSql2(options) { debug("attachSql1:options="+JSON.stringify(options)); // @todo possibly use something other than dbtable2 let retSql = "ATTACH DATABASE '" + options.cwd2 + options.dbfile2 + "' " + 'AS' + ' ' + options.dbtable2; return retSql; }
[ "function attachSql2(options) {\n console.log(\"attachSql1:options=\"+JSON.stringify(options));\n // @todo possibly use something other than dbtable2\n let retSql = \"ATTACH DATABASE '\" + options.cwd2 + options.dbfile2 + \"' \" + 'AS' + ' ' + options.dbtable2;\n return retSql;\n}", "function attachSq...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Circle scale control input value validate
function circValidate() { var circvalue = document.getElementById("circscale"); sum = Number(circvalue.value) if(Number(sum)) { } else { alert("Numbers only, please!"); }; }
[ "function updateCircleRadius() {\r\n let multiplyValue = timesHalfed(unit, (unit * zoom));\r\n if (multiplyValue <= -2) {\r\n circleRadiusInput.value = round(previewCircleRadius / (unit * zoom), Math.abs(multiplyValue));\r\n } else if (multiplyValue > -2 && multiplyValue < 10) {\r\n circleRad...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Intercept the /rancherversion API call wnad modify the 'RancherPrime' value if configured to do so by the environment variable PRIME
function proxyPrimeOpts(target) { const opts = proxyOpts(target); // Don't intercept if the PRIME environment variable is not set if (!prime?.length) { return opts; } opts.onProxyRes = (proxyRes, req, res) => { const _end = res.end; let body = ''; proxyRes.on( 'data', (dat...
[ "getRevisionInfo(hyper, req) {\n const rp = req.params;\n const path = [rp.domain, 'sys', 'page_revisions', 'page', rp.title];\n if (/^(?:[0-9]+)$/.test(rp.revision)) {\n path.push(rp.revision);\n } else if (rp.revision) {\n throw new Error(`Invalid revision: ${rp.r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an Angle object of "radians" radians (float).
function Angle(radians) { this._radians = radians; if (this._radians < 0.0) this._radians += (2.0 * Math.PI); }
[ "static createRadians(radians) { return new Angle(radians); }", "function Angle(radians){var _this=this;/**\n * Returns the Angle value in degrees (float).\n */this.degrees=function(){return _this._radians*180.0/Math.PI;};/**\n * Returns the Angle value in radians (float).\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CHANGE CONTENT This changes the html content of the passed in element.
function changeContent(element, message) { element.innerHTML = message; }
[ "function changeElementContent(element, content) {\n saferInnerHTML(element, content);\n}", "function changeContent(obj , content){\n\tobj.innerHTML = content\n}", "function setContent(element, text){\n\telement.textContent = text;\n}", "updateNodeContent(node, content) {\n this.getNode(node).innerHTML ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Store a file in the WASM file system. File is expected to be an absolute path, starting with wasmRootFolder.
function createInWasm(file, data, filesUploaded, wasmRootFolder, isFile = true) { // Create folders if necessary. var folders; if (isFile) { folders = file.substring(1, file.lastIndexOf(wasmPathSep)).split(wasmPathSep); } else { folders = file.substring(wasmRootFol...
[ "function saveFile(file) {\n filesystem.root.getFile(file.name, {create: true}, function(fileEntry) {\n\n fileEntry.createWriter(function(fileWriter) {\n \tconsole.log(fileWriter.fullPath);\n /*fileWriter.onwriteend = function(e) {\n // Update the file browser.\n listFiles();\n\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets idCounter to 0. Used for SSR.
function resetIdCounter() { idCounter = 0 }
[ "function resetIdCounter() {\n idCounter = 0;\n}", "reset() {\n this._nextId = 1;\n this._ids = {};\n }", "function resetLastId() {\n\t\t lastId = 0;\n\t\t}", "function resetLastId() {\n\t lastId = 0;\n\t}", "function reset() {\n setCounter(initialValue);\n }", "function clearCount...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draws exons on genes for normal view
function dispGeneExon(g, svg, track, genestrand, gene_start, width, max_len) { var disp_exon = false; var geneexons = track.Exon; if (geneexons.length > 0) { var strand = genestrand; var spanclass = ">"; if (strand == -1 || strand == "-1") { spanclass = "<"; } ...
[ "function drawEyes(nvg, x, y, w, h, mx, my, t) {\n let gloss, bg;\n const ex = w * 0.23;\n const ey = h * 0.5;\n const lx = x + ex;\n const ly = y + ey;\n const rx = x + w - ex;\n const ry = y + ey;\n let dx, dy, d;\n const br = (ex < ey ? ex : ey) * 0....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the first match use for given url.
function findUse(startPoint, method, url) { method = method.toLowerCase(); if (rootSources.hasOwnProperty(method)) { for (; startPoint < rootSources[method].length; startPoint++) { if (rootSources[method][startPoint].match(url) >= 0) { return startPoint; ...
[ "function _findUrl(response){\n\t var result = URL_REGEX.exec(response);\n\t\n\t URL_REGEX.lastIndex = 0; // Reset\n\t\n\t if(!result.length){\n\t throw new Error('Wrong response; no url found');\n\t }\n\t else if(result.length > 1){\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handles time and outputs in d/h/m/s format
function time_handle(time) { //time in seconds var day = 60*60*24; var hour = 60*60; var minute = 60; if (time <= 0) { return "No time remaining."; } var timedays = parseInt(time/day, 10); var timehours = (parseInt(time/hour, 10))%24; var timemins = (parseInt(time/minute...
[ "function format_time(time) {\n var h1 = time[0], m1 = time[1], h2 = time[2], m2 = time[3]\n return '' + expand_num(h1) + expand_num(m1) + '-' + expand_num(h2) + expand_num(m2)\n }", "formatTime(elapsed, format = undefined) {\n const unsignedElapsed = Math.abs(elapsed);\n // time in seconds\n let ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
def add(first_num, second_num): return first_num + second_num amount = add(5, 7) print(amount)
function add (firstNum, secondNum) { return firstNum + secondNum; }
[ "function add(firstNum, secondNum){\n return firstNum + secondNum\n }", "function add(firstNum, secondNum) {\n return firstNum + secondNum\n}", "function addNum(num1,num2) {\r\n console.log(num1 + num2)\r\n}", "function add (number1, number2) {\r\n// Step 2: In the function, return the sum of the para...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Picks the color of the circle based on magnitude
function circleColor(magnitude){ if (magnitude < 1) { return "#bdff20" } else if (magnitude < 2) { return "#fff941" } else if (magnitude < 3) { return "#ffc039" } else if (magnitude < 4) { return "#ff863c" } else if (magnitude < 5) { return...
[ "function circleColor(magnitude) {\n if (magnitude < 1) {\n return \"#CCFF33\"\n }\n else if (magnitude < 2) {\n return \"#FFFF33\"\n }\n else if (magnitude < 3) {\n return \"#FFCC33\"\n }\n else if (magnitude < 4) {\n return \"#FF9933\"\n }\n else if (magnitude < 5) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggles output based on a boolean: every time the function runs the boolean is switched from true to false, back to true.
function toggleBool() { if(myFlag) myFlag = false; else myFlag = true; }
[ "function toggleRunning()\r\n{\r\n running = !running;\r\n console.log('Switched running to ', running);\r\n}", "function ToggleGenerateFunny() {\n generatefunny = !generatefunny;\n}", "function toggleBoolean(x) {\n if (x) {\n x = !x;\n }\n console.log(x);\n}", "function toogle ()\n{\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
METODI PRIVATI PRESENTER Recupera i contatti e i gruppi della propria rubrica dal server tramite AJAX NB: Nella documentazione questo metodo si chiama getAddressBookData
function getAddressBookContacts() { // apro due XMLHttprequest rispettivamente per contatti e gruppi var contactRequest = new XMLHttpRequest(); var groupRequest = new XMLHttpRequest(); contactRequest.open("POST", commandURL, false); contactRequest.setRequestHeader("Content-type",...
[ "function loadContacts() {\n\n /** retrievePersonalAddressBook(success, failure)\n Retrieve all entries of the user's personal address book\n @params <function> success, <function> failure\n */\n KandyAPI.Phone.retrievePersonalAddressBook(function(results) {\n\n // results object is an a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Signs in the test user (in the host window), if not already signed in.
static async ensureSignedIn(context) { const suite = new UITestSuite(); suite.mochaContext = context; const signedIn = await suite.checkForStatusBarTitle(suite.hostWindow, suite.testAccount.email); if (!signedIn) { const userCode = await web.signIn(suite.serviceUri, 'microsof...
[ "function startSignIn() {\n startAuth(true);\n //signIn();\n}", "@action(constants.SIGN_IN)\n handleSignIn() {\n new ChromeIdentityAdapter().signIn().done(\n () => {\n this.authenticated = true;\n this.emit('change', this.getState());\n this.flux.actions.requestAssignmen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end function set() deletes dataset and resolves Promise with deleted dataset
function del() { return new Promise( ( resolve, reject ) => { if ( !userOps.isDocOpAllowed( userInfo.role, userInfo.username, data.store, data.del, 'del' ) ) { reject( 'user unauthorized' ); return; } // read existing dat...
[ "function del() {\n\n // read existing dataset\n getDataset( data.del, existing_dataset => {\n\n // delete dataset and perform callback with deleted dataset\n collection.deleteOne( { _id: convertKey( data.del ) }, () => finish( existing_dataset ) );\n\n } );\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls a function immediately if a condition is met or subscribes to an event and calls it once the event is emitted.
function onConditionOrEvent(condition, emitter, eventName, action) { if (condition === true) { action(); } else { emitter.once(eventName, () => action()); } }
[ "function callsyncIfTrue(obj, condition, f) {\n if (condition()) {\n callsync(obj, function() {\n if (condition()) {\n f();\n }\n });\n }\n}", "function runUntilTrue(func, callback) {\n runUntilTrueWrapper(func, callback)();\n}", "function when(cond, fn, params) {\n asyn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This class provides useful methods for Network communication.
function NetworkUtil(){ }
[ "function NetworkUtil(){}", "function Socket() {}", "function HTTP() {}", "function TestemSocket() {}", "function connectToServer() {\n\t\n}", "getconnection() {\n if ( os.platform() != \"win32\" ) {\n this.socket = net.createConnection(process.argv[1]);\n } else {\n le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw a big circle in the middle of the screen
function bigCircle() { context.beginPath(); context.arc(windowCenterX,windowCenterY,circleRadius,0,2*Math.PI); context.stroke(); }
[ "function centerCircle() {\n ctx.beginPath();\n ctx.arc(canvas.width / 2, canvas.height / 2, 4, 0, Math.PI * 2);\n ctx.lineWidth = 2;\n ctx.stroke();\n }", "function drawCircle(){\n //ctx.beginPath();\n ctx.arc(100, 75, 50, 0, 2 * Math.PI);\n ctx.stroke();\n }", "function drawCircle(){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The network simplex algorithm assigns ranks to each node in the input graph and iteratively improves the ranking to reduce the length of edges. Preconditions: 1. The input graph must be a DAG. 2. All nodes in the graph must have an object value. 3. All edges in the graph must have "minlen" and "weight" attributes. Post...
function networkSimplex(g){g=simplify(g);initRank(g);var t=feasibleTree(g);initLowLimValues(t);initCutValues(t,g);var e,f;while(e=leaveEdge(t)){f=enterEdge(t,g,e);exchangeEdges(t,g,e,f)}}
[ "function networkSimplex(g){g=simplify(g);initRank(g);var t=feasibleTree(g);initLowLimValues(t);initCutValues(t,g);var e,f;while(e=leaveEdge(t)){f=enterEdge(t,g,e);exchangeEdges(t,g,e,f);}}", "function rank(g){switch(g.graph().ranker){case\"network-simplex\":networkSimplexRanker(g);break;case\"tight-tree\":tightT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the length (variance) of cell in a given dimension does not work with torus!
getLengthOf( t, dim ){ // get mean and sd in x direction var stats = this.cellStats( t, dim ) return stats.variance }
[ "variance () {\n return this.sumOfSquares() / this.data.length\n }", "get dimension() { return this.length }", "get dims() {\n let dims = [], el = this.data;\n while (el instanceof Array) {\n dims.push(el.length);\n el = el[0];\n }\n return dims;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Advances the list's selectedness to the first amount of items.
selectStart(length = 1) { var firsts, items = this.getItemsArray(); if (!_isEmpty(items) && (firsts = _arrFirst(items, length))) { firsts.forEach(item => item.setActiveState(true)); } }
[ "selectNext() {\n const children = Array.from(this.children);\n if (!children || children.length === 0) {\n return;\n }\n const { selectedItem } = this;\n const prevIndex = children.indexOf(selectedItem);\n const nextIndex = prevIndex + 1 >= children.length ? 0 : prevIndex + 1;\n this.sele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Push a copy of the current modelview matrix onto the matrix stack.
function pushMatrix() { matrixStack.push( mat4.clone(modelview) ); }
[ "function _pushMatrix() {\n var copy = GlMatrix.mat4.create(_modelViewMatrix);\n _modelViewMatrixStack.push(copy);\n }", "function pushMatrix() {\n matrixStack.push(mat4.clone(modelview));\n}", "function pushMatrix() {\n matrixStack.push(mat4.clone(modelview));\n}", "function pushMatrix() {\n\t\tma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a msg in a room
function addMsg(room, msg, username) { //get the room var $room = $("#"+room); //if no window is open, make a new one if($room.length == 0){ $room = createChatWindow(username, room); //ouvre la fenetre adéquat //TODO => verifier le nb max } // append the message to the window $room...
[ "add(message) {\n if (!message.roomname || message.roomname === '') {\n message.roomname = 'lobby';\n }\n\n message.createdAt = Date.now();\n message.objectId = this.generateId();\n this._rooms.allRooms.push(message);\n if (!this._rooms[message.roomname]) {\n this._rooms[message.roomname...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HELPER FUNCTION: lock a given node with corresponding owner name
function lockNode(node, nodeOwner) { node.isLocked = true; node.currentOwner = nodeOwner; }
[ "function lockNode(node, nodeOwner){\n node.isLocked = true;\n node.currentOwner = nodeOwner;\n }", "function lockNode(node, nodeOwner) {\n node.isLocked = true;\n node.currentOwner = nodeOwner;\n }", "lock(owner) {\n if (this.owner == null || this.owner === owner) {\n this.owner = owner;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::WAFv2::RuleGroup.IPSetForwardedIPConfiguration` resource
function cfnRuleGroupIPSetForwardedIPConfigurationPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnRuleGroup_IPSetForwardedIPConfigurationPropertyValidator(properties).assertSuccess(); return { FallbackBehavior: cdk.stringToCloudFormation(...
[ "function cfnWebACLIPSetForwardedIPConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnWebACL_IPSetForwardedIPConfigurationPropertyValidator(properties).assertSuccess();\n return {\n FallbackBehavior: cdk.stringToCloudForma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display Train Schedule Function
function addTrainSched(train) { clearTable(); console.log(train); for (var i = 0; i < train.length; i++) { var trainRow = $("<tr>"); var trainListName = $("<td>"); var trainListDest = $("<td>"); var trainListFreq = $("<td>"); var trainListNextArrival = $("<td>"); var trainList...
[ "function updateTrainSchedule(train) {\n\n // create a list element to add to the table\n var tbody = $(\"#currentTrainSchedule\");\n var tr = $(\"<tr>\");\n tbody.append(tr);\n\n // add the train name to DOM \n var td = $(\"<td>\");\n td.text(train.name);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
read models in, load them into webgl buffers
function loadModels() { inputTriangles = getJSONFile(INPUT_TRIANGLES_URL,"triangles"); // read in the triangle data try { if (inputTriangles == String.null) throw "Unable to load triangles file!"; else { var whichSetVert; // index of vertex in current triangle set ...
[ "function loadModels() {\n \n inputTriangles = getJSONFile(INPUT_TRIANGLES_URL,\"triangles\"); // read in the triangle data\n\n try {\n if (inputTriangles == String.null)\n throw \"Unable to load triangles file!\";\n else {\n var whichSetVert; // index of vertex in curr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assert Merged Conditional Based on a boolean, either call assertMerged or assertNoMerge. The 'expected' argument only applies in the case where `doMerge` is true.
function assertMergedC(doMerge, statements, expected) { return doMerge ? assertMerged(statements, expected) : assertNoMerge(statements); }
[ "function isMerged(subject, base) {\n return __awaiter(this, void 0, void 0, function* () {\n const result = yield cmd_1.cmd.executeRequired(git.info.path, ['branch', '--no-color', '--contains', subject.name]);\n const branches = BranchRef.parseListing(result.stdout);\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear imprest surrender line modal
function ClearImprestSurrenderLineModal() { $("#LineNo").val(0); $("#DocumentNo").val(""); $("#ImprestSurrenderCode").val("").trigger("change"); $("#LineSurrenderDescription").val(""); $("#LineActualAmount").val(0); $("#LineGlobalDimension1Code").val("").trigger("change"); $("#LineGlobalDimension2Code").val("")....
[ "function ClearImprestSurrenderLineModal() {\n\t$(\"#LineNo\").val(0);\n\t$(\"#DocumentNo\").val(\"\");\n\t$(\"#ImprestCode\").val(\"\").trigger(\"change\");\n\t$(\"#LineDescription\").val(\"\");\n\t$(\"#LineAmount\").val(0);\n\t$(\"#LineGlobalDimension1Code\").val(\"\").trigger(\"change\");\n\t$(\"#LineGlobalDimen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a callback that once triggered, delays briefly, then passes the same args to the actual context's callback
function delay(orig_cb, ctxt, ms){ ctxt = ctxt || null; ms = ms || 100; return function(){ var args = arguments; setTimeout(function(){ orig_cb.apply(ctxt, args); }, ms); }; }
[ "function invokeCallback() {\r\n // Invoke original function.\r\n callback.apply(...leadCall);\r\n\r\n leadCall = null;\r\n\r\n // Schedule new invocation if there was a call during delay period.\r\n if (edgeCall) {\r\n proxy.apply(...edgeCall);\r\n\r\n edgeC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets the dictionary of used words to none.
reset() { this._usedWords.length = 0 }
[ "function clearDictionary(){\n console.log(\"Running clearDictionary.\");\n localDictionary = []; // clear local \n saveDictionary(); // update the remote storage from local copy\n $('#wordList').html(\" \");\n}", "function makeGlossary_clear() {\n object.length = 0;\n wordCount = {}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Execute a query for one row and return a promise for the result.
function rawOne() { return this.raw.apply(this, arguments) .then(function(data) { if (data.length !== 1) { throw new Error("Expected one row and got ") + data.length; } else { return data[0]; } }); }
[ "function selectOne(query, params) {\n return new Promise((resolve, reject) => {\n db.get(query, params, (err, row) => {\n if (err) {\n console.error(err.message);\n reject();\n }\n resolve(row);\n });\n });\n}", "async firstOne() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CN Iterate through given list of tiles and check for value matches. Combines each matched pair into a new tile and returns updated list of tiles
function checkMatches(tileList){ if(tileList.length > 1){ var updatedList = []; for (var i=0; i < (tileList.length-1); i++){ if(tileList[i].value == tileList[i+1].value){ var newTile = combineTiles(tileList[i], tileList[i+1]); updatedList.push(newTile); } else if(i==tileList.length-2){ //...
[ "getPlayableTiles() {\n const result = [];\n const boardTiles = this.getBoardTiles();\n if (boardTiles.length === 0) {\n return [this._doubleSix];\n } else {\n this.tiles.forEach((tile) => {\n for (let i = 0; i < boardTiles.length; i++) {\n const firstVal = JSON.stringify(board...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
populate alerts dropdown with tasks and time remaining
function alerts() { $("span.top-label.label.label-warning").text(todoItemsData.length); $('.dropdown-alerts').empty(); $.each(todoItemsData, (idx, item) => { let i = $('<i class="fa fa-tasks fa-fw"></i>'); let span = $('<span class="pull-right text-muted small"></span>').text( daysLeft(item....
[ "updateDurationsList() {\n const select = this.modal.getBody().find(SELECTORS.FIELD_DURATION);\n\n $.when(get_string('durationdays', 'enrol', '{a}')).then((text) => {\n for (let i = 1; i <= 365; i++) {\n $(select).append('<option value=\"' + i + '\">' + text.replace('{a}', i)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display function blanks out what is currently being displayed in the display_data area then displays the submitted user data as a list
function display(){ $('#display_data').html(''); var name = $('#user_name').val(); var nameLi = $('<li>').html(name); var age = $('#user_age').val(); var ageLi = $('<li>').html(age); var phone = $('#user_ph').val(); var phoneLi = $('<li>').html(phone) var email = $('#user_email').val(); var emailLI = ...
[ "function display(input_name, input_age, input_ph, input_email){\n clearData();\n $(\"#display_data\").append(\"<li>\"+input_name+\"</li>\");\n $(\"#display_data\").append(\"<li>\"+input_age+\"</li>\");\n $(\"#display_data\").append(\"<li>\"+input_ph+\"</li>\");\n $(\"#display_data\").append(\"<li>\"+input_ema...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: Translate Page to Spanish
function translatePageToSpanish() { $("#title").html("Bocaditos de inspiración"); $("#subtitle").html("Llenáte con inspiración al día con este pequeño proyecto para practicar idiomas.") $("#get-quote").html("Decíme otra"); $("#translate-english").show(); $("#translate-spanish").hide(); $("#translate-french"...
[ "function translatePageToEnglish() {\n $(\"#title\").html(\"Bite-Size Inspiration\");\n $(\"#subtitle\").html(\"Fill up on your daily inspiration with this mini-project for practicing languages.\")\n $(\"#get-quote\").html(\"Tell me another\");\n $(\"#translate-english\").hide();\n $(\"#translate-spanish\").sh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refetching active component price.
function refreshComponentPrice() { const selectPackages = pricingWrapper.find('.row-component .select-package:enabled'); selectPackages.each(function (index, selectPackage) { if ($(selectPackage).val()) { $(selectPackage).trigger('change'); } }); }
[ "function refresh_deal_price(elt) {\n elt\n .parents(\"#cart_items\")\n .next()\n .find(\"#deal-price\")\n .html(function (i, d_price) {\n let p_price = parseFloat(\n operation._parseLocaleNumber(\n elt.parents(\".row\").first().last().find(\".produc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test the string length unescaped function
function testStringLengthEscaped(){ var StringUtils = LanguageModule.StringUtils; var stringUtils = new StringUtils(); // Run the relevant tests var lengthEscapedFirst = stringUtils.lengthEscaped("Healthy", 1, "YUM", 0); var lengthEscapedSecond = stringUtils.lengthEscaped("HealthyYUM2345N", 1, "YUM", 0); ...
[ "function len(string){\n return string.len;\n}", "function renderStringLength(s) {\n\tlet m;\n\tlet pos;\n\tlet len = 0;\n\n\tconst re = ANSI_OR_PIPE_REGEXP;\n\tre.lastIndex = 0;\t//\twe recycle the rege; reset\n\t\n\t//\n\t//\tLoop counting only literal (non-control) sequences\n\t//\tpaying special attention to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a button for switching to the other experience (AnnData or Classic)
function getOtherChoiceButton() { const otherOption = isAnnDataExperience ? 'classic' : 'AnnData' return <button data-testid="switch-upload-mode-button" className="btn terra-secondary-btn margin-left-extra" onClick={() => setIsAnnDataExperience(!isAnnDataExperience)}> Switch to {otherOption} u...
[ "function switchToModelButton()\n{\n\tintButtonState = 1;\n\n\tchangeImage(\"confirm_r\");\n\n\tif (appTop.booMainWindow) \n\t{\n\t\tparent.objNavFrame.checkInstruction();\n\t}\n}", "function C001_BeforeClass_Amanda_Click() {\t\n\n\t// Regular interactions\n\tClickInteraction(C001_BeforeClass_Amanda_CurrentStage)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The purpose of this function is to close Role popup
function closeCreateRole() { document.getElementById("roleName").value=''; $("#roleName").removeClass("errorIcon"); document.getElementById("popupRoleErrorMsg").innerHTML = ""; $('.popupContent').find('input:text').val(''); $('.popupAlertmsg').html(''); $('#dropDownBox').html(''); $('#createRoleModal, .window')....
[ "function closeEditRolePopUp() {\n\tdocument.getElementById(\"txtEditRoleName\").value='';\n\tobjCommon.removePopUpStatusIcons('#txtEditRoleName');\n\tdocument.getElementById(\"editPopupRoleErrorMsg\").innerHTML = \"\";\n\t$('#roleEditModalWindow, .window').hide(0);\n}", "function closeDeleteRolePopup() {\n\t$('#...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies the Neighbors and Best Neighbors Strategies
function calculateNeighbors() { for (i = 0; i < positions.length; i++) { var sum = 0; var max = 0; for (x = 0; x < positions[i].neighbors.length; x++) { if (positions[i].neighbors[x] > max) { max = positions[i].neighbors[x] } sum += positio...
[ "applyRules(neighbors, data) {\n\n let cell = this;\n\n // we are using .reduce here because it's faster then .filter\n let countAlive = neighbors.reduce(function (n, cell) {\n return n + (cell.isAlive == ALIVE);\n }, 0);\n\n if( data.matchfieldLimited ) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the canonical type. This maps JS types onto their corresponding Dart Type. TODO(jmesserly): lots more needs to be done here.
function canonicalType(t) { if (t === Object) return core.Object; if (t === Function) return core.Function; if (t === Array) return core.List; // We shouldn't normally get here with these types, unless something strange // happens like subclassing Number in JS and passing it to Dart. if (t === ...
[ "function getType(type_c, parent) {\n var type_js = type_c;\n _.find(xml2js.TYPEMAPS, function(to, from) {\n var pattern = new RegExp(from, 'i');\n if (type_c.search(pattern) == 0) {\n type_js = to;\n return true;\n }\n });\n if (isPointer(type_js)) {\n var dataType = getPointerDataType(ty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On main menu item click, clear and request sub menu
function onMainMenuClick(id) { document.querySelector(".subMenu").innerHTML = ''; ipcRenderer.send('subMenu-request', id); currentCategory = id; }
[ "function clearSubNav(){\n var selectedItem = $('nav.sub-nav ul').find('li.sub-nav-menu-item-selected');\n selectedItem.removeClass('sub-nav-menu-item-selected');\n selectedItem.attr('data-selected', 'true');\n }", "function st_flush_menuByClick() {\n\n\t\tm('#menu-responsive').remove();\n\t\tm('#menu-b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ec stands for excludeColony
function ec(currentPlateAndPosition){ var tdElem = $(currentPlateAndPosition); if(!$(tdElem).prop('id')){return;} var colonyLabel=tdElem.prop('id').split('-'); var plateIndex = colonyLabel[0]; var isControl = false; if(plateIndices[plateIndex].toLowerCase().indexOf(control) == 0){ isControl=true; } // if th...
[ "function get_coleman_exclude(data_val_sheet){\n var data = data_val_sheet.getDataRange().getValues() //.getRange(\"J2:J\").getValues()//data_val_sheet.getDataRange().getValues();\n var first_row = data[0]\n var index_col = first_row.indexOf(\"DO NOT SEND TO COLEMAN - STATES\")\n Logger.log(index_col)\n if(ind...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disable whole radio group e.g. disableRadioGroup(document.formName.aRadioGroup)
function disableRadioGroup (radioGroup) { if (!radioGroup.disabled) { radioGroup.disabled = true; if (document.all || document.getElementById) { if (!radioGroup.length){ radioGroup.disabled = true; } else{ for (var b = 0; b < radioGroup.length; b++){ if (radioGr...
[ "function enableRadioGroup (radioGroup) {\n\t if (radioGroup.disabled) {\n\t radioGroup.disabled = false;\n\t if (document.all || document.getElementById) {\n\t if (!radioGroup.length)\n\t radioGroup.disabled = false;\n\t else\n\t for (var b = 0; b < radioGroup.length; b++)\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse the content inside the element as timestamp and replace with the browser's locale datetime string.
function parseTimestamp() { var el = $(this); var timestamp = parseInt(el.text(), 10); if (timestamp && !isNaN(timestamp)) { el.text(exports.utils.formatDate(timestamp * 1000)); } else { el.text(''); } }
[ "function replaceDateInDescription() {\n // Uploaded field might be at any position in the description table and has no special class name or id\n // So we have to find the field with the \"Uploaded:\" content and get the field next to it\n var dateElement = document.evaluate('//dt[text()=\"Uploaded:\"]', ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
| setVcselPulsePeriod:bool () | | Set the VCSEL (vertical cavity surface emitting laser) pulse period for the | given period type (prerange or final range) to the given value in PCLKs. | Longer periods seem to increase the potential range of the sensor. | Valid values are (even numbers only): | pre: 12 to 18 (initializ...
setVcselPulsePeriod(vcselPeriodType, period_pclks, callback){ let vcsel_period_reg = this._encodeVcselPeriod(period_pclks); const enables = this._sequenceStepEnables; this._getSequenceStepTimeouts( ( timeouts ) => { // "Apply specific settings for the requested clock period" // "Re-calculate and apply ...
[ "getVcselPulsePeriod(vcselPeriodType){\n\t\tif (type == VcselPeriodPreRange) {\n\t\t\treturn this._decodeVcselPeriod(this._readRegisters(REGISTRY.PRE_RANGE_CONFIG_VCSEL_PERIOD));\n\t\t}\n\t\telse if (type == VcselPeriodFinalRange) {\n\t\t\treturn this._decodeVcselPeriod(this._readRegisters(REGISTRY.FINAL_RANGE_CONF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When true, calls the +refreshLabel+ method whenever +self.label+ is changed.
get refreshOnLabelChange() { return true; }
[ "updateLabel() {\n this.innerHTML = this.label;\n }", "updateLabelText() { }", "refreshLabel() {\n const _elemId = this._getMarkupElemIdPart('label', 'HView#refreshLabel');\n if (this.isNumber(_elemId)) {\n ELEM.setHTML(_elemId, this.label);\n }\n return this;\n }", "updateLabel() {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a clean svelte app
function createSvelte() { var createSvelteChild = spawnSync('npm', ['init', 'svelte@next'], { shell: true, stdio: 'inherit', }); // if create svelte errord, exit the program if (createSvelteChild.status !== 0) { process.exit(1); } }
[ "static build(name, port){\n var render = views(__dirname + '/../views/', {\n map: { html: 'swig' }\n });\n\n var app = new KoaApplication(\n koa,\n route,\n render,\n assets,\n logger,\n parser,\n name,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to get the Reportee list
function getReportees(userId, isSubReportee){ if(isSubReportee) loadingSubReporteeList(); var success = function(data){ if(!isSubReportee){ loaded(); $("#reportee-list").empty(); $("#info-holder").append("<span id='info-message' class='text-center'><h5>Please select a reportee </h5></span>...
[ "getReportList(...params) {\n const { getReportList: helper } = require('./helpers/reports');\n return helper(this)(...params);\n }", "static list() {\n return $http.get('../api/sentinl/list/reports')\n .then((response) => {\n if (response.status !== 200) {\n throw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Randomly simulate network failures. It is useful to enable this during development to make sure our app works in realworld conditions.
function isNetworkFailure() { const chanceOfFailure = 0; // 0..1 return Math.random() < chanceOfFailure; }
[ "simulateConnectFailure() {\n this.simulateConnectFailure_ = true;\n }", "simulateErrorService() {\n const randNumber = Math.floor(Math.random() * 100);\n const resultError = randNumber >= 0 && randNumber <= 9;\n console.log('-------Simulate Error = ', resultError);\n return resultError;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sendMsg is a ajax wrapper, send request to index.php with App checknum mgs and params (optional)
function sendMsg(checknum,msg,parameters) { var http_request = false; var url = 'index.php'; if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); } else if (window.ActiveXObject) { try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { htt...
[ "function sendMessage(){\n var xmlhttp = ajaxRequest();\n xmlhttp.onreadystatechange=function(){\n if (xmlhttp.readyState==2){\n showLoading();\n }if (xmlhttp.readyState==4 && xmlhttp.status==200){\n showMessageSent();\n }\n }\n var title = encodeURIComponent(d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
======================================================= Add tokens based on precedence. Helper for other actions. =======================================================
function addByPrecedence() { var newToken = new tree.Token(tree.Token.functionType, nextChar); // //trace('addByPrecedence'); // newToken.printToken(); while (tempToken = stack.pop()) { if (tempToken.getPrecedence() >= newToken.getPrecedence()) postFixTokens.push(tempToken); else break; } ...
[ "function setOrder(token){\n\t\tvar order, opr = token.value, token = token;\n\t\t\n\t\tswitch(opr){\n\t\t\tcase \"*\" : token.order = 1\n\t\t\t\t\t break;\n\t\t\tcase \"/\" : token.order = 1\n\t\t\t\t\t break;\n\t\t\tcase \"+\" : token.order = 2\n\t\t\t\t\t break;\n\t\t\tcase \"-\" : token.order = 2\n\t\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads a document and initializes a Document Session
_loadDocument(documentId) { let configurator = this.props.configurator let collabClient = this.collabClient let documentClient = this.context.documentClient documentClient.getDocument(documentId, (err, docRecord) => { if (err) { this._onError(err) return } let documen...
[ "_loadDocument(documentId) {\n let configurator = this.props.configurator\n let documentClient = this.context.documentClient\n\n documentClient.getDocument(documentId, (err, docRecord) => {\n if (err) {\n this._onError(err)\n return\n }\n //let docRecord = SampleDoc\n let ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
common to both autoheirloom1 and 2 Shows you which Mod you would be best off upgrading in the heirloom window by highlighting it in blueish gray and a tooltip.
function heirloomUpgradeHighlighting() { var bestUpgrade; if(game.global.selectedHeirloom[1].includes('Equipped')) { var loom = game.global[game.global.selectedHeirloom[1]]; bestUpgrade = evaluateHeirloomMods(0, game.global.selectedHeirloom[1], true); if(bestUpgrade.index) { ...
[ "function showHelpStrip() {\n // loadInputControls();\n helpTip = $(document).tooltip({ disabled: false });\n helpTip = $(document).tooltip({ track: true });\n}", "function showHelp() \n {\n OpenBlurbWindow('/games/cc/popup/instructions.html', 440, 440, 'Help');\n }", "function showHelpTo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an A1 range, rangeRef, return the values of the corresponding cells in an NxM matrix (2d array).
getRange(rangeRef) { return this.sheet.mapRange( rangeRef, this._getCellValue.bind(this) ); }
[ "getRange(mx, center, range) { // TODO add test if range goes out of mx' bounds\n\t\tlet localMap = [];\n\t\tfor (let i = 0; i < range * 2 + 1; i++) {\n\t\t\tlocalMap[i] = new Array(range * 2 + 1);\n\t\t}\n\n\t\tfor(let y = center.y - range, i = 0; y < center.y + range + 1; y++, i++) {\n\t\t\tfor(let x = center.x -...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Still dry, and with autocompletion, but without SCREAMING_SNAKE_CASE. :( Pros: Dry. Little code. Flux Standard Action constraint. IDE autocompletion. Grepable. Cons: Little "magic" (createAction). Still indirection. In reducers, casting is needed for types. Less conventional (action types aren't in SCREAMING_SNAKE_CASE...
function action(...args) { return (type) => createAction(type, ...args); }
[ "function makeActionCreator(type) {\n for (var _len = arguments.length, argNames = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n argNames[_key - 1] = arguments[_key];\n }\n\n return function () {\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2+...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a PeeringService resource with the given unique name, arguments, and options.
constructor(name, args, opts) { let inputs = {}; opts = opts || {}; if (!opts.id) { if ((!args || args.resourceGroupName === undefined) && !opts.urn) { throw new Error("Missing required property 'resourceGroupName'"); } inputs["location"] = arg...
[ "createService(name, args, opts = {}) {\n if (args.taskDefinition) {\n throw new Error(\"[args.taskDefinition] should not be provided.\");\n }\n if (args.taskDefinitionArgs) {\n throw new Error(\"[args.taskDefinitionArgs] should not be provided.\");\n }\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
algo for finding the bottom most object
findBottomMostPlatform() { //getting all platforms as an array const platforms = this.platforms.getChildren() //pick the first one in the array as the current bottom most platform let bottomPlatform = platforms[0] //iterate over the Array and compare each plat...
[ "function getLargest(object) {\n for (var i=0; i<object.children.length; ++i) {\n var child = object.children[i];\n\n var y = child.getScreenPos().y;\n var height = child.height || 0;\n var sum = y + height;\n\n if (largestObject ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Query the twitter API and update the results div.
function updateTwitterFeed(){ hashtag = escape("#angelhack OR @angelhack"); var api_url = "http://search.twitter.com/search.json?q="+hashtag; $.getJSON(api_url+"&callback=?",function(api_results){ var results = api_results.results; if(results.length == 0) { $('#twitterfeed').innerHTML("No results to...
[ "function displayTWResults(query) {\n\tconsole.log(\"displayTWResults()\");\n\n\t$(\"#results\").empty();\n\n\tvar twitAPIEndpoint = \"1.1/search/tweets.json\";\n\tvar hashtag = \"%23\" + genreQuery;\n\tvar request = resourceURL + twitAPIEndpoint + \"?\" + \"q=\" + hashtag;\n\n\t$.ajax({\n\t\tdataType: 'jsonp',\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add Grade page. Two inputs: Name and password. If condition
function addgrade() { document.body.appendChild(name); document.body.appendChild(grade); var button = document.createElement(".button1"); button.innerHTML = "Submit"; body.appendChild(button); document.body .querySelector(".button1") .addEventListener("click", function () { document.body.appen...
[ "function assignGrade () {\r\nvar grade = document.projectThree.inputOne.value;\r\nif (grade >= 97) {\r\n return 'A+';\r\n}\r\nelse if (grade >= 93 && grade <= 96) {\r\n return 'A';\r\n}\r\nelse if (grade >= 90 && grade <= 92) {\r\n return 'A-';\r\n}\r\nelse if (grade >= 87 && grade <= 89) {\r\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructor for the Grid Excel Export module.
function ExcelExport(parent, locator) { /* tslint:disable-next-line:no-any */ this.book = {}; this.workSheet = []; this.rows = []; this.columns = []; this.styles = []; this.rowLength = 1; this.expType = 'AppendToSheet'; this.includeHiddenColumn = f...
[ "function ExcelExport(parent) {\n Grid.Inject(GridExcel);\n this.parent = parent;\n this.dataResults = {};\n this.addEventListener();\n }", "function ExcelExport$$1(parent) {\n Grid.Inject(ExcelExport);\n this.parent = parent;\n this.dataResults = {};\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to paint canvas
function paintCanvas() { ctx.fillStyle = "black"; ctx.fillRect(0, 0, W, H); }
[ "function paintCanvas() {\n\tctx.fillStyle = \"black\";\n\tctx.fillRect(0, 0, width, height);\n}", "function drawCanvas() {\n\t\tcontext.clearRect(0, 0, canvas.width, canvas.height);\n\t\tdrawCanvasBackground();\n\t\tdrawHoles(holes);\n\t\tdrawLines(existingDrawnCoords);\n\t}", "drawCanvas() {\n this.con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
using Object.assign, takes current key, assigns value to new key and deletes old key + value.
function keyCleanup(oldKey, newKey, obj) { delete Object.assign(obj, { [newKey]: obj[oldKey] })[oldKey]; }
[ "function deleteFromObjectByKey(object, key){\n //create new copy of object. \n var a = Object.assign({}, object);\n delete a.key;\n return a;\n}", "unassign( key ) {\n\n _.unset(this, key);\n\n }", "function shallowRenameKey(obj, oldKey, newKey) {\n if (!(oldKey in obj))\n return obj;\n ob...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
filters the base experience
function experienceFilters() { const filtered = pokemon.filter((pexp) => pexp.base_experience > "100"); displaydata(filtered); }
[ "filterForFrontend() {}", "function CustomFilter() {}", "function applyFilter() {\n // apply filter to source list\n _players.forEach(_applyFilterToPlayer);\n // clear out old display list\n vm.players = [];\n if(vm.filter === 'defensive') {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }