query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Determine whether the given properties match those of a `ConfluenceAttachmentConfigurationProperty`
function CfnDataSource_ConfluenceAttachmentConfigurationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected ...
[ "function CfnDataSource_ConfluenceConfigurationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the necko URL for the message URI.
function neckoURLForMessageURI(aMessageURI) { let msgSvc = Cc["@mozilla.org/messenger;1"] .createInstance(Ci.nsIMessenger) .messageServiceFromURI(aMessageURI); let neckoURI = msgSvc.getUrlForUri(aMessageURI); return neckoURI.spec; }
[ "get_url() {\n\t\treturn config.zeromq.proto + '://' + config.zeromq.host + ':' + config.zeromq.port;\n\t}", "get baseMessageURI() {\n if (!this._baseMessageURI) {\n let uri = newParsingURI(this.URI);\n if (Ci.nsIURIMutator) { // TB 60 or later\n uri = uri.mutate().setScheme(\"exquilla-message...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
================ getFederationData: (fed: string with name of federation in POST format) calls a php script to fetch the data from the database and return the info in a json object for template to use ================
function getFederationData(fed) { var httpc = new XMLHttpRequest(); var url = "php/get_info.php"; httpc.open("POST", url, true); httpc.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); httpc.onload = function () { var text = this.responseText; text = text.replace(/(?:\\)/g, '\\\n'); con...
[ "function postData(federation) {\n\tvar federation = eval( \"(\" + federation + \")\");\n\tvar resultsPlaceholder = document.getElementById('infodisplay');\n\n\tvar templateSource = document.getElementById('federation-template').innerHTML;\n\tvar template = Handlebars.compile(templateSource);\n\n\tvar data = federa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(f) to generate the random values on the crystals
function randomCrystalValues () { //generate Purple Crystal random value crystalPurple = Math.ceil((Math.random() * 11) + 1); //generate Lavendar Crystal random value crystalLavender = Math.ceil((Math.random() * 11) + 1); //generate Blue Crystal random value crystalBlue = Math.ceil((Math.random() * 11) + 1)...
[ "function crystalValueRandomNumber() {\n CrystalValue_1 = Math.floor((Math.random() * 12) + 1);\n CrystalValue_2 = Math.floor((Math.random() * 12) + 1);\n CrystalValue_3 = Math.floor((Math.random() * 12) + 1);\n CrystalValue_4 = Math.floor((Math.random() * 12) + 1);\n \n}", "function random(f, t)\t{...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parameters reObj: The regular expression object used to match (Do add global flag). textNode: The node in which the text to be matched. wrapElem: The element in which the matched string to be wrapped. Return values count: The amount of matches.
async function wrapMatchedTextInNode(reObj, textNode, wrapElem) { let text = textNode.data; return reObjExecText(reObj, text) .then(matches => { return wrapMatchedTextInNodeWithMatches(textNode, wrapElem, matches); }); }
[ "async function wrapMatchedTextInNodeWithMatches(textNode, wrapElem, matches) {\n return new Promise((resolve, _) => {\n let newNodes = [];\n let text = textNode.data;\n let lastIndex = 0;\n for (let match of matches) {\n if (lastIndex < match.index) {\n let ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove a sorting level (a sorter)
removeSorter(field) { let me = this, sorterIndex = me.sorters.findIndex((sorter) => sorter.field == field); if (sorterIndex > -1) { me.sorters.splice(sorterIndex, 1); me.sort(); } }
[ "removeSorter(field) {\n let me = this,\n sorterIndex = me.sorters.findIndex(sorter => sorter.field == field);\n\n if (sorterIndex > -1) {\n me.sorters.splice(sorterIndex, 1);\n me.sort();\n }\n }", "removeSorter(field) {\n let me = this,\n sorterIndex = me.so...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new immutable instance of `Query` that is extended to also include additional query constraints.
function query(query) { var e_1, _a; var queryConstraints = []; for (var _i = 1; _i < arguments.length; _i++) { queryConstraints[_i - 1] = arguments[_i]; } var queryImpl = Object(_firebase_util__WEBPACK_IMPORTED_MODULE_2__["getModularInstance"])(query); try { for (var queryConstr...
[ "static query() {\n return new Query(this);\n }", "function query(query, ...queryConstraints) {\n let queryImpl = (0, _util.getModularInstance)(query);\n\n for (const constraint of queryConstraints) {\n queryImpl = constraint._apply(queryImpl);\n }\n\n return queryImpl;\n}", "newQuery(entity) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a color that is `percent` brighter than the source `color`.
function brighten(rgb, percent) { if (rgb) { var base = Math.min(Math.max(rgb.r, rgb.g, rgb.b), 230); //let base = Math.max(rgb.r, rgb.g, rgb.b); var step = getLightnessStep(base, percent); return { r: Math.max(0, Math.min(255, Math.round(rgb.r + step))), g: M...
[ "function lighten(color, percent) {\n\t\tvar n = parseInt(color.slice(1), 16),\n\t\ta = Math.round(2.55 * percent || 0),\n\t\t// Bitshift 16 bits to the left\n\t\tr = (n >> 16) + a,\n\t\t// Bitshift 8 bits to the left based on blue\n\t\tb = (n >> 8 & 0x00FF) + a,\n\t\t//\n\t\tg = (n & 0x0000FF) + a;\n\t\t// Calcula...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handle person selection events when a person is selected, populate the form with the data of the selected person
function handlePersonSelectChangeEvent () { var key = "", person = null; key = updateFormEl.selectPerson.value; if (key) { person = Person.instances[key]; updateFormEl.personId.value = person.personId; updateFormEl.name.value = person.name; } else { updateFormEl.reset(); ...
[ "function handleSelectChange(selected){\n renderPeople();\n}", "function populateVolunteerFromPerson(selectedPersonId, $personId) {\n // chosen nobody. Clear the existing value\n if (!selectedPersonId) {\n $personId.val(selectedPersonId);\n return;\n }\n var exis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a random polynomial of a certain degree (returns an array of constant multipliers) with constant multipliers up to a number, max Uses the secret as the degree 0 constant multiplier
function generateRandomPolynomialWithSecret(degree, max, secret) { let polynomial = [secret]; for (let i = 1; i < degree; i++) { polynomial.push(generateRandom(max)); } return polynomial; }
[ "function randomPolynomial(degree, secret_key, prime) {\n\tvar poly = [];\n\tfor (i = 0; i < degree; i++) {\n\t\tpoly[i] = getRandomInt(0, prime);\n\t}\n\tpoly[degree] = secret_key;\n\treturn poly;\n}", "function generatePolynomial(m) {\n const poly = Array(m);\n for (let i = 0; i < m; i++) {\n poly[i] = ran...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function validates the PATCH request syntax strictly adhering to contenttypes and empty payloads
async function validatePatchRequestSyntax(request){ let requestSyntaxValidator = ( request.header('Content-Type')=='application/json' && request.body.caption!=null && request.body.url!=null && request.body....
[ "function checkOperationConsumes(targetVal) {\n const { paths } = targetVal;\n const errors = [];\n if (paths && typeof paths === 'object') {\n Object.keys(paths).forEach((path) => {\n ['post', 'put'].forEach((method) => {\n if (paths[path][method]) {\n const { consumes } = paths[path][me...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the appropriate content for the given fragment identifier. This function implements a simple cache.
function getContent(fragmentId, callback) { // If the page has been fetched before, if (partialsCache[fragmentId]) { // pass the previously fetched content to the callback. callback(partialsCache[fragmentId]); } else { // If the page has not been fetched before, fetch it. fetchFile(f...
[ "function getContent(fragmentId){\n var partial = {\n dashboard: \"this is the dash board. welcome\"\n };\n \n return partial[fragmentId];\n}", "function getContent(key) {\n return cache[key];\n }", "function get_data_from_cache(id){\n\t\tif(!cache.post_contents || !cache.post_conte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function save products to the file, it first checks if the content is string if it's not it is being parsed. If file from path does'nt exist it creates one and save data to it.
function saveProductsToFile(products) { const p = path.join(rootDir, 'data', 'products.json'); if (typeof products !== 'string') fs.writeFile(p, JSON.stringify(products), err => { console.log(err); }) else fs.writeFile(p, products, err => { console.log(err); ...
[ "save() {\n //path\n const p = path.join(\n path.dirname(process.mainModule.filename),\n 'data',\n 'products.json'\n );\n //read file and add it to the product array\n fs.readFile(p, (err, fileContent) => {\n let products = [];\n if (!err) {\n //if file is not empty ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The event bus used by the AppExt
get eventBus() { return this._eventBus; }
[ "function EventBus() {\n _classCallCheck(this, EventBus);\n\n this.registry = {};\n }", "function EventBus() {\n this.events = {}; // {name: Arrays.<function>}\n}", "static get BusEvent() { return BusEvent }", "registerEvents() {\n this.messageBus.onmessage = (ev) => {\n switch (ev.d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to add K to thousands
function kFormatter(num) { return num > 999 ? (num/1000).toFixed(1) + 'k' : num; }
[ "function kstyle_number(val){\n return Math.round(val/1000) + \"K\";\n}", "function kFormatter(num) {\r\n return num > 999 ? (num/1000).toFixed(1) + 'k' : num;\r\n }", "function KFormatter(num) {\n return Math.abs(num) > 999 ? Math.sign(num) * ((Math.abs(num) / 1000).toFixed(1)) + 'K' : Math.sign(nu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checkAns clears the previous text checks to see if the correct number was typed in displays whether answer is right or wrong asks if user wants to try again if she's right or else if she's wrong
function checkAns() { document.getElementById("outputyes").innerHTML = (""); document.getElementById("outputno").innerHTML = (""); numb1 = parseInt(number1); numb2 = parseInt(number2); ansIn = parseInt(document.getElementById("check").value); var ansCor = numb1 * numb2; if (ansCor == ansIn) { document.get...
[ "function checkInputAns() {\n var clientInput = document.getElementById(\"blankInput\")\n var clientAns = clientInput.value;\n var ans = dataSet[correct.ansInDataset].fr;\n clientAns = clientAns.toLowerCase();\n ans = ans.toLowerCase();\n clientAns = clientAns.replaceAll(specialCharsReg, '');\n ans = ans.rep...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This event fires when the time indicated by the `getCurrentTime()` method has been updated.
_onTimeupdate () { this.emit('timeupdate', this.getCurrentTime()) }
[ "function onSystemTimeChanged() {\r\n updateTime();\r\n }", "function updateTime() { currentDate = new Date();}", "updateTimeUI(newTime) {\n console.log(newTime);\n }", "pollTime() {\n this.execute(() => {\n const prevTime = this.currentTime;\n try {\n this.currentTim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
===================Search for root and leaf ===================== Given a cell, search and highlight its root It ultilizes recursion When first time calling it, originalCell is null After that it is set to the cell that is being clicked on This is to prevent searching in an cyclic graph
function searchRoot(cell, originalCell){ // If cellView = originalCell, we have a cycle if (cell == originalCell){ return } // If first time calling it, set originalCell to cell if (originalCell == null){ originalCell = cell; } // Highlight it when it is a root if (isRoot(cell)){ cell.attr('.outer/stroke', '#996633...
[ "function searchLeaf(cell, originalCell){\n// If cellView = originalCell, we have a cycle\nif (cell == originalCell){\n\treturn\n}\n// If first time calling it, set originalCell to cell\nif (originalCell == null){\n\toriginalCell = cell;\n}\n\n// Highlight it when it is a leaf\nif (isLeaf(cell)){\n\tcell.attr('.out...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sample demonstrates how to Use this method to update existing IoT Security solution tags or user defined resources. To update other fields use the CreateOrUpdate method.
async function useThisMethodToUpdateExistingIoTSecuritySolution() { const subscriptionId = process.env["SECURITY_SUBSCRIPTION_ID"] || "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; const resourceGroupName = process.env["SECURITY_RESOURCE_GROUP"] || "myRg"; const solutionName = "default"; const updateIotSecuritySol...
[ "async function farmBeatsModelsUpdate() {\n const subscriptionId = \"11111111-2222-3333-4444-555555555555\";\n const resourceGroupName = \"examples-rg\";\n const farmBeatsResourceName = \"examples-farmBeatsResourceName\";\n const body = {\n tags: { key1: \"value1\", key2: \"value2\" },\n };\n const credent...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the regular song divs
function createARegularSongDiv(i, stationaryDiv) { var song = songs[i]; var theDivClass = divClass[i]; var songDivIds = songDivs[stationaryDiv]; $( songDivIds ).empty(); $( songDivIds ).append( "<img src='" + getSongImage(song) + "'>" ); $( songDivIds ).append( "<p>" + getSongName(song) + "</p>" ); $( s...
[ "function drawSongs(songList){\n var template = \"\";\n for (var i = 0; i < songList.length; i++) {\n//grab information for each song\n var title = songList[i].title;\n var albumArt = songList[i].albumArt;\n var artist = songList[i].artist;\n var collection = songList[i].collection...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Track more file like imported file. although it may not in `startPath`.
trackMoreFile(filePath) { if (this.includeFileMatcher.match(filePath)) { this.trackFile(filePath); } }
[ "async loadStartData() {\n console.timeStart('track');\n for (let document of this.documents.all()) {\n if (this.shouldTrackFile(vscode_uri_1.URI.parse(document.uri).fsPath)) {\n this.trackOpenedDocument(document);\n }\n }\n if (this.alwaysIncludeGlob...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
COMPLETE AGGREGATE EXPORT (2.27) Start export of complete aggregate packages: dataset and dashboards with deps
function exportAggregate() { /* Only data element in datasets included. Include config option for "placeholder" datasets that is only used to get dependencies, but where the actual dataset is not included in the export file. This also includes other data elements used in indicators, like those for population. ...
[ "function exportDashboard() {\n\n\tconsole.log(\"1. Downloading metadata\");\n\t//Do initial dependency export\n\tvar promises = [\n\t\tdependencyExport(\"dashboard\", currentExport.dashboardIds)\n\t];\n\tQ.all(promises).then(function (results) {\n\n\t\t//Get indicators and categoryOptionGroupSets from favourites\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inserir Medico a Clinica
function inserirMedicoClinica(inserirMedCli, res) { connection.acquire(function(err, con) { con.query("insert into Clinica_Medicos(cnpjClinica, crmvMedico) values(?,?)", [inserirMedCli.cnpj, inserirMedCli.crmv], function(err, result) { con.release(); if (err) { res.send({status: 1,...
[ "function insert_medicine(queryData, funcion){\n\tconsole.log(\"Realiza funcion insertar medicina...\");\n\tvar res = [{estado: 'true'}];\n\tvar medi = queryData.medicine;\n\tdb.medicines.find({ medicine: medi},function(err, data){\n\t\tif(Object.keys(data).length > 0){\n\t\t\tdata = data[0];\n\t\t\tif(data.enable ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a function that works like formatString, but uses the given defaultDomainId instead of an explicit domainId.
makeFormatStr(defaultDomainId) { return (messageId, values = {}) => { try { const formatter = this.makeMessageFormatter(defaultDomainId, messageId); return formatter.format(values); } catch (err) { Console.error("Resolving i18n label failed...
[ "function pxToStringFactory(defaultValue) {\n return function(value) {\n return pxToString(value, defaultValue);\n }\n}", "function defaultString(string, def) {\n return string != null ? string : def;\n}", "function default_dexter_full_name(){\n if(default_dexter_name_id){\n return \"Dexter.\" ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds search input keyup event and click events for Project name, and creator of project
function projectSearchEvent() { $("#search-input").keyup(function () { let projects; //Get all the projects projects = ($(this).parent().siblings(".projects").children(".project")) let searchTerm = $("#search-input").val() //Hide projects if Search term is given i...
[ "function projectNameUIEvents() {\n // Make the text in the project-name span editable\n $('.project-name').attr('contenteditable', 'true')\n .on('focus', () => {\n // Change the styling to indicate to the user that they\n // are editing this field\n const projectName = $('.project-name'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A handler that implements a BPMN 2.0 property update. This should be used to set simple properties on elements with an underlying BPMN business object. Use respective diagramjs provided handlers if you would like to perform automated modeling.
function UpdatePropertiesHandler( elementRegistry, moddle, translate, modeling, textRenderer) { this._elementRegistry = elementRegistry; this._moddle = moddle; this._translate = translate; this._modeling = modeling; this._textRenderer = textRenderer; }
[ "function UpdatePropertiesHandler(elementRegistry, moddle, translate, modeling, textRenderer) {\n this._elementRegistry = elementRegistry;\n this._moddle = moddle;\n this._translate = translate;\n this._modeling = modeling;\n this._textRenderer = textRenderer;\n}", "update() {\n\t\tthis.element[this.elementP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the horizontal field of view of the camera in degrees.
horizontalFov() { return this.fov; }
[ "horizontalFovInRadians() {\n return VrMath.degToRad(this.horizontalFov());\n }", "getFieldOfView() {\n return this.camera.fov;\n }", "get rotateHorizontally()\n\t{\n\t\treturn 0;\n\t}", "raw_heading() {\n this._heading = Math.atan2(this._mag[X], this._mag[Y]);\n\n if (this._headin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function downloads an XML document from the server, parses it, and presents the parsed document as a DOM tree
function load(url) { var xmlHTTP; if (window.XMLHttpRequest) { xmlHTTP = new XMLHttpRequest(); } else { xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP"); } xmlHTTP.open("GET", url, false); xmlHTTP.send(null); parser = new DOMParser(); xmlDoc = parser.parseFromString(xmlHTTP.responseText, "appli...
[ "async function fetchAndParse() {\n const response = await fetch(url);\n const data = await response.text();\n const parser = new DOMParser();\n const XMLDocument = parser.parseFromString(data, 'text/xml');\n return XMLDocument;\n }", "function loadXMLDoc(url) {\n // branch for native XMLHttpRe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine Bmi based on the latestBmi variable
determineBMICategory(latestBmi){ if(latestBmi < 16 ){ return "SEVERELY UNDERWEIGHT"; } else if(latestBmi >= 16 && latestBmi < 18.5){ return "UNDERWEIGHT"; } else if(latestBmi >= 18.5 && latestBmi < 25) { return "NORMAL"; } else...
[ "lastIsMaster() {\n const serverDescriptions = Array.from(this.description.servers.values());\n if (serverDescriptions.length === 0) return {};\n\n const sd = serverDescriptions.filter(sd => sd.type !== ServerType.Unknown)[0];\n const result = sd || { maxWireVersion: this.description.commonWireVersion }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Indicates if the pedal is down at the given time
isDown(time) { return time >= this._downTime; }
[ "function chimpIsDepartedOrAbsent(chimp) {\n return chimp.time === exports.timeLabels.absent ||\n chimp.time === exports.timeLabels.departFirst ||\n chimp.time === exports.timeLabels.departSecond ||\n chimp.time === exports.timeLabels.departThird;\n}", "function check_time(time){ // Input the unix difference\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createDispatchers Create action dispatcher wrappers with bound playerID and credentials
function createDispatchers(storeActionType, innerActionNames, store, playerID, credentials, multiplayer) { return innerActionNames.reduce(function (dispatchers, name) { dispatchers[name] = function () { var assumedPlayerID = playerID; // In singleplayer mode, if the client does not have a playerID ...
[ "function createDispatchers(storeActionType, innerActionNames, store, playerID, credentials, multiplayer) {\n return innerActionNames.reduce(function (dispatchers, name) {\n dispatchers[name] = function () {\n var assumedPlayerID = playerID;\n\n // In singleplayer mode, if the client does not have a p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for adding the new targeting to the lineItem Targeting Table
function addTargetsToLineItem(){ if (validateAddTargets()) { var valueToPrint = ""; var selectedElements = []; var level = "--"; var not= "--"; var operation = "--"; var previousRowId = $("#geoTargetsummary" , "#lineItemTargeting").find("tr:last").attr("id"); var rowBeforeLastRowId = $("#geoTarge...
[ "function updateTargetsToLineItem(trId){\r\n\tif (validateAddTargets()) {\r\n\t\tvar not = \"--\";\r\n\t\tvar selectedElements = [];\r\n\t\t$('#' + trId + \" td:nth-child(2)\").html($(\"#sosTarTypeId option:selected\").text());\r\n\t\t$('#' + trId + \" td:nth-child(3)\").html($(\"#sosTarTypeId\").val());\r\n\t\r\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If this is an invite payment made by an inviteMaker of this contract host, redeem it for the associated seat. Else error. Redeeming consumes the invite payment and also transfers the use rights.
redeem(allegedInvitePaymentP) { return E.resolve(allegedInvitePaymentP).then(allegedInvitePayment => { return redeem(allegedInvitePayment); }); }
[ "redeem(type, inbound, opts) {\n const sender = getSender(type, inbound, this.config);\n return sender.redeem(opts);\n }", "redeem(allegedInvitePaymentP) {\n return Promise.resolve(allegedInvitePaymentP).then(\n allegedInvitePayment => {\n return redeem(allegedInvitePayment);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Configures the passport.authenticate for the given provider, passing in options Operation is 'login' or 'link'
function passportCallback(provider, options, operation) { // console.log("passportCallback", provider, options, operation); return (req, res, next) => { var theOptions = Object.assign({}, options); if (provider === "linkedin") { theOptions.state = true; } var accessToken = req.qu...
[ "function Strategy(options, verify) {\n if (typeof options == 'function') {\n verify = options;\n options = {};\n }\n if (!verify) throw new Error('freepbx authentication strategy requires a verify function');\n this._usernameField = options.usernameField || 'username';\n this._passwordField = options.pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a promise for the pubic address of the context if any.
getPublicUrl (contextInstance) { const proxy = this; return new Promise( function( resolver, rejecter ) { return proxy.send( { request: "GetPublicUrl", subject: contextInstance }, resolver, FIREANDFORGET, rejecter ); }); }
[ "async function resolution() {\n //Creates a new identity, that also is updated (See \"manipulate_did\" example)\n const result = await manipulateIdentity();\n\n //Resolve a DID\n return await resolve(result.doc.id.toString(), CLIENT_CONFIG);\n}", "function getPublicGWAddressP () {\n var deferred = Q...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to insert named sections into interface
function insertSection(k,v) { $('#interface').prepend( $('<fieldset></fieldset>').attr('id',k).append( $('<legend></legend>').append(v), '<div class="btn-toolbar"><div class="btn-group"></div></div>' ) ); }
[ "addSection(header, firstTag) {\n this.sections.push({ header, firstTag })\n }", "function Section(name, Ix) {\n this.name = name;\n this.Ix = Ix;\n}", "function insertSection(k, v) {\n $('#interface').prepend($('<fieldset></fieldset>').attr('id', k).append($('<legend></legend>').append(v),...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the limits based on the query and options
function Limits(query,options) { var intlimit = options.intlimit || 10; var maxlimit = options.maxlimit || 100; if (intlimit > maxlimit) { intlimit = maxlimit; } var limit = options.limit || intlimit; if (!options.limit && query.limit && !isNaN(query.limit) && query.limit <= maxlimit && parseInt(query....
[ "function setLimit() { // reset offset when limit is changed\n if (limit != DOC.iSel(\"resultsID\").value) {\n offset = Number(\"0\");\n }\n limit = Number(DOC.iSel(\"resultsID\").value);\n}", "function setLimit(setLimit) {\n\tthis._struct.push({ type: 'limit', payload: setLimit });\n\treturn this;\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checkbox eventlistner for light switch
function addListeners(){ var s = document.getElementsByName("switch"); var i; for (i = 0; i < s.length; i++) { s[i].addEventListener('click', flipSwitch); } // document.getElementById("button").onclick = function() { canvas.width = window.innerWidth; canvas.height = window...
[ "function handleLightTLOnClick(event)\n{\n\tvar lightId = parseInt(eventMgr.doc.light.src.which.value);\n\n\tscene.lights[lightId].TL = eventMgr.doc.light.TL.checked;\n}", "function btnDarkLightMode() {\n $(\".darkLightMode\").change(() => leerCheckboxDarkLightMode());\n}", "onSwitch() {}", "function switchO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
initial fetch that takes zip and provides lat long used in next code blocks
function getLocInfo(zipInput) { fetch(geoBaseURL + zipInput) .then(response => response.json().then(data => ({ data: data, status: response.status })).then(function (getTemp) { let latLng = getTemp.data.results[0].locations[0].latLng let lat = parseFloat(latLng.lat.t...
[ "function geofromZIP(zip, callback){\n\trequest('https://maps.googleapis.com/maps/api/geocode/json?address='+zip+'&key=AIzaSyCP9syBFfHu5zfVSavGJLWS3f8bzL5mKMI', function(error, response, body){\n\t\t\tvar data = JSON.parse(body);\n\t\t\tvar latLong = [data.results[0].geometry.location.lat, data.results[0].geometry....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the data needed to make the webpage. Called from the web app Datastrucure format: [auto, tele] tele/auto: [[type, name, id, ], [type, name, id, ]] Types: Plus/Minus:0 Checkbox:1 Slider:2 Dropdown:3 Text:4 Example config var auto = [[0, "PM Ex", "pm1"],[3, "Selecty", "dd1", ["abc", "thing", "three"]]] var tele =...
function getConfigData() { var spreadsheet = SpreadsheetApp.getActiveSpreadsheet() // Get the data from the sheet var rawAutoData = getValues(spreadsheet, webpageConfig, 'B10', 'E60') var rawTeleDate = getValues(spreadsheet, webpageConfig, 'G10', 'J60') var keyData = getValues(spreadsheet, webpageConfig, 'F8'...
[ "function createLogicMenuData(confElement) {\n var templateData = [];\n\n // check whether logical operator is provided in the app config\n var findMatch = function (opertaor) {\n var operatorRegex = new RegExp(opertaor, 'ig');\n for...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clear the ./uploads folder (temporary files for uploading avatar) the files are cleared automatically after success or catched error, but on an uncaught error they'll stay.
async function clearTemporary() { const temp = path.resolve('./uploads'); // rm -rf the temp folder await fs.remove(temp); // recreate the temp folder await fs.mkdir(temp); }
[ "function flushUploads() {\n fs.readdir('course-data/uploads', (err, files) => {\n if (err) throw err;\n\n for (const file of files) {\n fs.unlink(path.join('course-data/uploads', file), err => {\n if (err) throw err;\n });\n }\n });\n}", "function clean() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hides a single element
hide (element){ element.style.display = "none"; }
[ "function hide() {\n\tthis.owner.el.style.display = 'none';\n}", "hide () {\n if (this.isVisible()) {\n this.getElement().style.visibility = \"hidden\";\n }\n }", "function hideElement(element) {\n element.css('visibility', 'hidden');\n}", "unhide() {\n this.element.style.dis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Some Redux libraries need specific accessor functions and can't use lodash. This gives the opportunity to overwrite the accessor function
function overrideAccessors(name, fn) { helperAccessors[name] = fn; }
[ "get accessor_prop() { /* function body here */ }", "get accessor_prop() {\n\t\t/* function body here */\n\t}", "getSubLayerAccessor(accessor) {\n if (typeof accessor === 'function') {\n const objectInfo = {\n data: this.props.data,\n target: []\n };\n return (x, i) => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sends an image to the user
_sendImageBuffer(imageBuffer){ utils.sendImageBuffer(this.response, imageBuffer); this._logger.trace('sent the image'); }
[ "function sendImageSocket(img){\n console.log(\"sendimagesocket\");\n socket.emit('user image', img);\n\n}", "function takePicture() {\n socket.emit('takePicture');\n}", "function sendImageMessage(recipientId){var messageData={recipient:{id:recipientId},message:{attachment:{type:\"image\",payload:{url:SERVER...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
displayImages formats the images into an array that is then given to the rendered hbs page
function displayImages(images) { var imgs = []; images.forEach(function (element, index, array) { imgs.push(encode(element.Body)); }) res.render('results', { images: imgs }); }
[ "function displayImages() {\n\n //Clears the hmtl before anything happens (for when a new game starts)\n $('#displayImages').html('');\n\n for (i=0; i < images; i++)\n $('#displayImages').addClass('displayInline').append('<img data-position=\"'+i+'\" src=' + imageArray[i].link + ' width=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parseCustomData: pattern match each line while loop: matches each pattern in the data file discards first group in the match, this is always the entire matched pattern saves the other groups, each is a row of data extracts header row to get column names for loop: transforms the rows, each row is an array ordered by col...
function parseCustomData (textFileData) { const regex = /(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)$/gm let rows = [] let m while ((m = regex.exec(textFileData)) !== null) { if (m.index === regex.lastIndex) { regex.lastIndex++ } m.shift() rows.push(m) ...
[ "function getHeaderInfo(line) {\n const headerNames = [];\n const headerLookupIdx = [];\n const info = [];\n const groups = {};\n\n // populate the header arrays\n for (let i = 1; i < line.length; i++) {\n let name = line[i];\n // default values\n let inGroup = false;\n let type = undefined;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Play sound effect for large splash when you fall in the water
function playSFXLargeSplash (event) { sfxLargeSplash.currentTime = 0; $(sfxLargeSplash).each(function(){this.play(); $(this).animate({volume:1},1000)}); }
[ "function soundEffect() {\n soundeffect.loop = true;\n soundeffect.volume = 1;\n soundeffect.play();\n}", "function splash() \n{\n document.getElementById('splash');\n animate();\n $('#progress').hide();\n $('#splash').show();\n $('.sound').show();\n \n}", "playSound() {\n let d = dist(width / 2, he...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to alert the user that deliveries are the only option due to the covid 19 precaution protocols.
function alertbox() { window.alert("Due to Covid-19 Restrictions, we only do deliveries within Nairobi at a fixed charge of 200Kshs."); }
[ "function sustainableEnergy() {\n\talert(\"SUSTAINABLE ENERGY:\\n\\nIn November of 2009, we helped the people of La Toti install solar panels on the community clinic and public toilets. Solar expert Bruce Gardiner went to La Toti with BIF members and showed local residents how to install and maintain solar panels, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the merge of any number of JSON objects pass JSON objects as comma separated parameters var newJSON = mergeJSON(a,b,c...n) note: overwrites preexisting entries from earlier passed objects
function mergeJSON () { var ret = {}; for (var a=0,len=arguments.length;a<len;a++) for (var v in arguments[a]) ret[v] = arguments[a][v]; return ret; }
[ "function mergeJSON(obj1, obj2, overwriteAt) {\n\n var attrname,\n obj2copy = JSON.parse(JSON.stringify(obj2));\n\n for (attrname in obj1) {\n if (obj2copy.hasOwnProperty(attrname)) {\n\n if (attrname === overwriteAt) {\n obj2copy[attrname] = obj...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /utils/script/meta Account's script meta
function fetchScriptMeta(base, body) { return request_1.default({ base: base, url: '/utils/script/meta', options: { method: 'POST', body: body, headers: { 'Content-Type': 'application/json' } } }); }
[ "function scriptInfo() {\r\n\treturn `[${scriptData.name} ${scriptData.version}]`;\r\n}", "function scriptInfo() {\r\n return `[${scriptData.name} ${scriptData.version}]`;\r\n}", "async function createMeta() {\n\t\ttry {\n\t\t\tvar manifestData = chrome.runtime.getManifest();\n\t\t\treturn {\n\t\t\t\t// envi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create and set datachannel for this peer connection
async function setDataChannel (pc, pid) { console.log("attempting connection to ", pid); channel = await pc.createDataChannel('mesh'); channel.onmessage = handleDataChannelMessage; channel.onopen = handleDataChannelOpen; channel.onclose = handleDataChannelClose; console.log('created data channel'); //...
[ "_createDataChannel()\n\t{\n\t\t// Create a descriptor object to track the state of our new data channel and add it to our list of channel descriptors\n\t\tlet channelIndex = this._dataChannels.length;\n\t\tthis._dataChannels.push({\n\t\t\t'local': null,\n\t\t\t'remote': null,\n\t\t\t'connected': false\n\t\t})\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
:: BCYCLE DATA STRUCTURE // Two way cycle
function BCycle(init) { var data = init instanceof Array ? init : init ? [init] : []; var pos = 0; $.extend(this, { left: function() { if (pos === 0) { pos = data.length - 1; } else { --pos; } ...
[ "function BCycle(init) {\n var data = init instanceof Array ? init : init ? [init] : [];\n var pos = 0;\n $.extend(this, {\n left: function() {\n if (pos === 0) {\n pos = data.length-1;\n } else {\n --pos;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setParticularPriceLevelValue Function set the calculated item price in the particular price level in particular pricing sublist
function setParticularPriceLevelValue(pricingSublistIntId,pricingSublistLineItemLineNo, itemPrice) { try { nlapiLogExecution('audit', 'itemprice', itemPrice); //selecting the particular line item itemRecord.selectLineItem(pricingSublistIntId, pricingSublistLineItemLineNo); //setting the item price of...
[ "function setItemPrice(iPrice) {\n\t\n}", "calculateLevel(level, price) {\n if (level == 'basic') {\n price = price * 1.30;\n } else {\n price = price * 1.50;\n }\n return price;\n }", "function updatePrice(e) {\n var parentID = $(e).parents(\"div.item...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get random recipes into a list
async function getRandomRecipes() { let idLists = []; let randomRecipes = []; let res = ""; let mealId = 0; for (let i = 0; i < RANDOM_NUM; i++) { res = await axios.get(`${MD_BASE_URL}/random.php`); mealId = res.data.meals[0].idMeal; if (!isListHasItem(idLists, mealId)) { ...
[ "function randRecipe() {\r\n let pos = Math.floor(Math.random() * recipes.length);\r\n return recipes[pos];\r\n}", "getRandomRecipe() {\n const randomRecipeNumber = this.getRandomInt(this.getChosenRecipe().length);\n return this.getChosenRecipe()[randomRecipeNumber];\n }", "function get_random () {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the details of a Stripe account.
update () { return StripeAction.extend ({ execute (req, res) { const { stripeAccountId } = req.params; const { 'stripe-account': update } = req.body; return this.stripe.accounts.update (stripeAccountId, update) .then (result => res.status (200).json ({ [this.controller.resou...
[ "function updateStripe() {\n _this.Payment\n .updateInfo(user_model.related('outlet'), trx)\n .then(resolve)\n .catch(ferror.trip(reject))\n }", "update () {\n return StripeAction.extend ({\n async execute (req, res) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for when user loses: increments losses, updates banner text, adds image/gif to the counter box
function userLost () { losses++; $("#banner").text("You lost!"); $("#counter").addClass("nickSad"); $("#counter").removeClass("nickHappy"); }
[ "function lossCounter(){\n losses++;\n $(\"#numberLosses\").text(losses);\n reset();\n }", "function userLoss() {\n alert(\"You lose!\");\n losses++;\n $(\"#losses\").text(losses);\n reset();\n }", "function lossUpdate () {\n losses ++;\n //ch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
VegaLite's main function, for compiling Vegalite spec into Vega spec. At a highlevel, we make the following transformations in different phases: Input spec | | (Normalization) v Normalized Spec (Row/Column channels in singleview specs becomes faceted specs, composite marks becomes layered specs.) | | (Build Model) v A ...
function compile(inputSpec, opt) { if (opt === void 0) { opt = {}; } // 0. Augment opt with default opts if (opt.logger) { // set the singleton logger to the provided logger set(opt.logger); } if (opt.fieldTitle) { // set the singleton field title formatter ...
[ "function compile(inputSpec, opt = {}) {\n // 0. Augment opt with default opts\n if (opt.logger) {\n // set the singleton logger to the provided logger\n _log__WEBPACK_IMPORTED_MODULE_4__[\"set\"](opt.logger);\n }\n if (opt.fieldTitle) {\n // set the singleton field title formatter\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all project references by a specific ID
function getProjectReferences(projectId) { // get all references associated with a specific project return breeze.EntityQuery .from('References') .where('Project', 'eq', "'" + projectId + "'") .using(entityManager) .execute() .then(function (data) { return ...
[ "static async getProjectsById(id) {\n let res = await this.request(`projects/${id}`);\n return res.projects;\n }", "function getProjectById(id) {\n return _.findWhere(projects, {id: id});\n }", "getProject(id) {\n return entities.Project.get({ id });\n }", "getProject(id) {\n\t\treturn _....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
estimasi waktu: 20 Menit Diberikan sebuah fungsi polynominal yang akan menerima sebuah input berupa string yang berbentuk `aljabar` contoh `2x + 2xy + 3x + 4y` dan akan mengembalikan nilai berupa bilangan yang sudah disederhanakan berdasarkan koefisiennya menjadi `5x + 2xy + 4y` Rules: tidak ada operator lain selain `+...
function polynominal(str) { if (str.length <= 1) return str; let myObj = {}; let result = []; let arr = str.split("+").map((el) => { let num, key; num = el.split(/[a-z]/)[0]; if (num === "") { num = "1"; key = el; } else { key = el.s...
[ "function exerciseElaboration(p, n) {\n let possibleZero = n > 0 ? '0' : '';\n \n return Math.pow(\n parseInt(p.toString() + possibleZero + p), 2)\n .toString()\n .split('')\n .reduce((a,b) => parseInt(a) + parseInt(b)\n );\n}", "function prepareAnswer(ans)\n {\n var co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ResetSolution: Reset the solution... null out any previously saved values, reset the initial position...
function ResetSolution () { // make the curve zero _xValues = [ ]; _yValues = [ ]; _zValues = [ ]; // reset the starting position _dCurrX = _InitalPos [ _nCurrRho ][ _CurrInitPos ][ 0 ]; _dCurrY = _InitalPos [ _nCurrRho ][ _CurrInitPos ][ 1 ]; _dCurrZ = _InitalPos [ _nCurrRho ][ _CurrI...
[ "resetSolutions() {\n this.solutions = []; \n this.numberOfSolutions = 0; \n this.requiresBrutForce = false; \n }", "function ResetSolution ()\n{\n // reset the starting position\n _dCurrX = [];\n _dCurrY = [];\n _dCurrZ = [];\n _xValues = [];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Responsively changing game (size of canvas, paddle, ball)
function changingGameProps() { if (window.innerWidth > 850) { canvas.width = 800; canvas.height = 600; brickCounts.brickRowCount = 9; brickCounts.brickColumnCount = 5; ball.x = canvas.width / 2; ball.y = canvas.height / 2; ball.size = 10; ball.speed = 4; ball.dx = 4; ball.dy = ...
[ "function draw(){\r\n\tvContext.clearRect(0,0,vCanvas.width,vCanvas.height );\r\n\tdrawBall();\r\n\tdrawPaddle();\r\n\tdrawBricks();\r\n\tbrickCollisionDetection();\r\n\t\r\n\t//if drawing goes beyond boundary of canvas, in either x or y axis, then change it's direction\r\n\t//y + dy is refering to the centre of th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
String replace / 1. String Replace Purpose : To ensure username with minimum 3 characters and not a number,replacing USERNAME with userinput and print the string.
stringReplace(username) { var input ="Hello <<username>> , how are you?"; var output = input.replace(/<<username>>/g,username); console.log(output+" : Replace string using Regex ") var output1=""; while(username.length<3 || !isNaN(username)) { var read = require('readline-sync'); ...
[ "stringReplace(username)//takes the user inputs \n {\n try {\n\n\n var fr = /[a-zA-Z]/\n /**\n * \n * condition to check username should have min 3 characters.\n * \n */\n if (username.length > 3 && isNaN(username) && fr.test...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getting all the uploads upon component mounting.
componentDidMount() { this.getUploads(); }
[ "uploads() {\n return new ArrayIterator(this._uploads);\n }", "getUploadingFiles() {\n const uploadingFiles = {};\n const {\n currentUploads\n } = this.uppy.getState();\n\n if (currentUploads) {\n const uploadIDs = Object.keys(currentUploads);\n uploadIDs.forEach(uploadID => {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Game_Map The game object class for a map. It contains scrolling and passage determination functions.
function Game_Map() { this.initialize.apply(this, arguments); }
[ "function Map() {\n\tthis.typeName = \"Map\";\n\tthis._grid = [];\n\tthis.index = {};\n\t\n\tthis.actions = [];\n\tthis.messages = [];\n\tthis.maxMessages = 10;\n\t\n\tthis.height = 0;\n\tthis.width = 0;\n\n\tthis.player = null;\n}", "function GameMap(rows, cols){\n this.rows = rows;\n this.cols = cols;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Respond to clicks by toggling whether the element is selected. Do this only if the click was not the end of a drag, by checking for motion. We also trigger a mousemove event to update the cursor.
function clickHandler( event /*: JQueryEventObject */ ) { if ( $element.hasClass( pausedDragSelectClass ) ) return; if ( $element[0].dragData.firstX == $element[0].dragData.lastX && $element[0].dragData.firstY == $element[0].dragData.lastY ) { if ( $element.hasClass( SELECTED_FOR_D...
[ "function toggleSelect() {\n var cursor = getCursor();\n if (cursor) {\n toggleSelectTask(cursor);\n } else {\n warn(\"No cursor, so can't toggle selection.\");\n }\n }", "function toggleSelect() {\n toggleSelectTask(requireCursor());\n }", "_onMouseDown(e) {\n if (e.which === ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine is a token is a special character
function isSpecial(token) { return special.indexOf(token) >= 0; }
[ "function isSpecialCharacter(str){\n return /[~`!#$%\\^&*+=\\-\\[\\]\\\\';,/{}|\\\\\":<>\\?]/g.test(str);\n}", "function isSpecialChar (ch) {\n \tvar spChar = \"`~'!@#$%^&*()_-=+{[}]|\\\\;:<,>.?/\" + '\"';\n \treturn spChar.indexOf(ch) > -1;\n }", "function hasSpecialChar(str){\n return /[~`!#$%\\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the tooltip's content. It includes: user profile picture, handle, his country and the TC registration date. Also includes his ratings for some competition tracks, which are listed in the profile object. It does not currently include the number of victories and the tracks with largest amounts of victories, as th...
function Tip({ user }) { /* const joined = moment(props.user.memberSince).format('MMM YYYY'); const rating = props.user.ratingSummary.map(item => ( <span styleName="rating" key={item.name}> <span>{item.name}</span> <span>{item.rating}</span> </span> )); */ const { photoLink } = user; let s...
[ "function displayProfile() {\n push();\n fill(255);\n textFont(`Courier`);\n textSize(18);\n // A header\n let dataString = `Dating profile\\n\\n`;\n // Loop through the data array to display the categories and answers\n for (let i = 0; i < data.length; i++) {\n // Add the current category and answer to ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use a constructor to assign player 1, player 2, the height and width of the game board, and set default values on those.
constructor(p1, p2, height, width) { // Grab the current values of these variables using 'this' this.players = [p1, p2]; this.height = height; this.width = width; this.currPlayer = p1; this.makeBoard(); this.makeHtmlBoard(); this.gameOver = false; }
[ "constructor() {\n this.boardwidth = 5;\n this.boardheight = 5;\n this.onboard = 0;\n }", "function initBoard(rows, columns) {\n createBoard(rows, columns);\n placePlayer();\n print('Creating board and placing Player...');\n}", "function _makeBoard() {\n if (players[0].getBoard...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine if the original change (disregarding changes from hooks that were already executed) included the given fieldname.
isFieldChanged(fieldname) { return this.changes.has(fieldname); }
[ "function checkFieldChanged(){\n var retVal = false;\n for(fName in initValues) {\n if(initValues[fName] !== nlapiGetFieldValue(fName)) {\n retVal = true;\n break;\n }\n }\n return retVal;\n}", "hasFieldChanges(record) {\n const fields = _.clone(record.fields);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
true Closures Real world scenario memoization
function memoization() { const cache = {}; return function (n) { if (n in cache) { return cache[n]; } else { console.log("not cached"); cache[n] = n * n; return cache[n]; } }; }
[ "function funClosureMemo(cb) {\n const cache = {};\n return function (n, ...args) {\n if (n in cache) {\n console.log('finding from cache');\n return cache[n];\n } else {\n console.log('new calculate');\n let res = cb(n, ...args);\n cache[n]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
With this function we will create formular and populate it with data from response string
function showFormular(responseString){ var documentForms = document.getElementsByTagName("form"); var formularSearchForm = documentForms[2]; var formularForm = documentForms[3]; formularForm.classList.remove("form-hidden"); var responseArray = responseString.split("~"); var dataArray = responseArray[1].split("<...
[ "function objectifyForm() {\n let formResponses = Form.getResponses();\n let currentResponse = formResponses[formResponses.length-1];\n let responseArray = currentResponse.getItemResponses();\n let form = {};\n form.user = currentResponse.getRespondentEmail(); //requires collect email addresses to be turned on...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get stored object by Id.
static getStoredObjectById(dbService, storename, id) { const store = getStore(storename)(dbService); return store.get(id); }
[ "getObjectById(id) {\n return this.idIndex.get(id)[0];\n }", "function getObject(id) {\n return objectService.getObjects([id])\n .then(function (results) {\n return results[id];\n });\n }", "function get(id) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A triangle is classified as follows: Equilateral: All three sides are of equal length. Isosceles: Two sides are of equal length, while the third is different. Scalene: All three sides are of different lengths. To be a valid triangle, the sum of the lengths of the two shortest sides must be greater than the length of th...
function triangle(side1, side2, side3) { let [shortest, middle, longest] = [side1, side2, side3].sort((a, b) => a - b); if (isValidTriangle(shortest, middle, longest)) { return getTriangleType(side1, side2, side3); } else { return "invalid"; } }
[ "function triangle(s1, s2, s3) {\n let perimeter = s1 + s2 + s3;\n let sides = [s1, s2, s3];\n let longest = Math.max(...sides);\n let shortest = Math.min(...sides);\n let mid = perimeter - longest - shortest; // ahh this is easy and smart!\n \n if (sides.includes(0) || longest >= mid + shortest) return \"in...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the number of coins collected by the player.
static getNCollectedCoins() { return this.nCollectedCoins; }
[ "async getNumOfAllCoins() {\n return this.#numOfCoins;\n }", "function collectCoin(player, Coins) {\n Coins.destroy(Coins.x, Coins.y); // remove the tile/coin\n coinSound.play();\n coinScore++;\n checkCoins();\n // show current coins collected on html\n $(\"#coinCollected\").text(coinScore);\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the token contract address from the token contract symbol. TODO: swap out with a real database.
function getTokenAddress(tokenName) { var result = null; if (tokenName == "TEST") { result = "0x875664e580eea9d5313f056d0c2a43af431c660f"; } else if (tokenName == "DAI") { result = "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"; } return result; }
[ "getAddress(symbol) {\n return ERC20_ADDRESS[symbol]\n }", "getAddress(symbol) {\n return this.symTable[symbol];\n }", "filterAddress(token) {\n var isAddress = this.web3.utils.isAddress(token.toLowerCase());\n if (isAddress) {\n return this.web3.utils.toChecksumAddress(token.toLowerCas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets classes of grid
function getGridClass(pos) { let childs = c.childNodes; let classes = childs[pos].className.split(' '); return classes; }
[ "function getGridClass() {\n\t\tswitch(currentDifficulty) {\n\t\t\tcase 'easy': {\n\t\t\t\treturn grids.easy;\n\t\t\t}\n\t\t\tcase 'medium': {\n\t\t\t\treturn grids.medium;\n\t\t\t}\n\t\t\tcase 'hard': {\n\t\t\t\treturn grids.hard;\n\t\t\t}\n\t\t\tdefault: return grids.medium;\n\t\t}\n\t}", "function getItemClass...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Distribute clipPath to svg element
clipWith(element) { // use given clip or create a new one let clipper = element instanceof ClipPath_ClipPath ? element : this.parent().clip().add(element); // apply mask return this.attr('clip-path', 'url("#' + clipper.id() + '")'); }
[ "clipWith(element){// use given clip or create a new one\nconst clipper=element instanceof ClipPath?element:this.parent().clip().add(element);// apply mask\nreturn this.attr(\"clip-path\",\"url(\\\"#\"+clipper.id()+\"\\\")\")}", "generateClipPath() {\r\n var chart = this,\r\n svg = chart.svg,\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
data to get unique from; rowNum and columnNum indexed at 1
function getUniqueDateFromColumn(data, rowNum, columnNum){ var col = columnNum - 1 ; // choose the column you want to use as data source (0 indexed, it works at array level) //var data = sheet.getDataRange().getValues();// get all data var newdata = new Array(); for(var row = rowNum - 1; row < data.length; row...
[ "function get_unique_column_node_values() {\n for (var i = 0; i < node_csv_data_t.length; i++) {\n // get unique values within row (which of course used to be a column)\n // these are the unique values in the original csv columns\n unique_node_csv_data_t[i] = getUniqueArray(node_csv_data_t[i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Carrusel Slick Portrait / Landscape
function configurarCarruselParaPortrait(){ $('.carrusel').slick("slickSetOption", "slidesToShow", 1, "refresh", true); }
[ "function applyPortraits() {\n\tsetupPortrait(1, 197, 639, 88);\n\tsetupPortrait(2, 82, 207, 317);\n\tsetupPortrait(3, 0, 0, 270);\n}", "portraitMode() {\n return window.innerHeight > window.innerWidth;\n }", "function viewLandscape() {\n if (winWidth < winHeight && winWidth < 576) {\n $(\"#sm-scr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all of a 12word phrase's identities, profiles, and Gaia connections. Returns a Promise to an Array of NamedIdentityType instances. NOTE: should be the only promise chain running!
async function getIdentityInfo(network, mnemonic, _appGaiaHub, _profileGaiaHub) { network.setCoerceMainnetAddress(true); // for lookups in regtest let identities; try { // load up all of our identity addresses and profile URLs identities = await loadNamedIdentities(network, mnemonic); ...
[ "function getIdentityInfo(network: Object, mnemonic: string, appGaiaHub: string, profileGaiaHub: string) \n : Promise<Array<NamedIdentityType>> {\n\n let identities = [];\n network.setCoerceMainnetAddress(true); // for lookups in regtest\n \n // load up all of our identity addresses and profile URLs\n cons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function will load in our genres from our API to populate the drop down
function loadGenres(){ var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(){ if(xhr.readyState==4 && xhr.status == 200){ var genres = JSON.parse(xhr.responseText); for(let i = 0; i < genres.length; i++){ var elem = document.createElement("option");...
[ "function fetchGenreList() {\n // const params=new URLSearchParams()\n // params.set('userID',)\n fetch('./api/genre')\n .then(response => response.json())\n .then(genres => {\n populateDropdown(selection1, genres);\n populateDropdown(selection2, genres);\n po...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method in its entireity from Google Cloud Engine Vision Sample Event handler for a file's data url extract the image data and pass it off.
function processFile (event) { var content = event.target.result; sendFileToCloudVision(content.replace('data:image/jpeg;base64,', '')); }
[ "function processFile(event) {\n var content = event.target.result;\n\n drawImage(content)\n\n sendFileToCloudVision(\n content.replace(\"data:image/jpeg;base64,\", \"\"));\n}", "function Base64ExtractPNG(data_url)\n{\n return data_url.substring(DATA_URL_HEADER_OFFSET);\n}", "function getImage(dataUr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses a list of queries in the format accepted by the `locatorFor` methods into an easier to work with format.
function _parseQueries(queries) { const allQueries = []; const harnessQueries = []; const elementQueries = []; const harnessTypes = new Set(); for (const query of queries) { if (typeof query === 'string') { allQueries.push(query); elementQueries.push(query); }...
[ "function splitQueries(queries) {\n return queries.map(function (query) {\n return query.split(',');\n }).reduce(function (a1, a2) {\n return a1.concat(a2);\n }).map(function (query) {\n return query.trim();\n });\n }", "function splitQueries(queries) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolve all styles functions with both props and tokens and flatten results along with all styles objects.
function _resolveStyles(props, theme, tokens) { var allStyles = []; for (var _i = 3; _i < arguments.length; _i++) { allStyles[_i - 3] = arguments[_i]; } return _fluentui_style_utilities__WEBPACK_IMPORTED_MODULE_1__.concatStyleSets.apply(void 0, allStyles.map(function (styles) { return ty...
[ "function _resolveStyles(props, theme, tokens) {\r\n var allStyles = [];\r\n for (var _i = 3; _i < arguments.length; _i++) {\r\n allStyles[_i - 3] = arguments[_i];\r\n }\r\n return styling_1.concatStyleSets.apply(void 0, allStyles.map(function (styles) {\r\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
readInput function accepts callback function. If an error is encountered it's caught and the error message is output. callbackFn is invoked with data from file if err not encountered.
function readInput(callbackFn) { const [ , , inputFile ] = process.argv; fs.readFile(inputFile, 'utf8', (err, data) => { if (err) { console.log(err.message); return; } callbackFn(data); }); }
[ "function readInput (cb) {\n\t\tvar data = \"\";\n\t\tprocess.stdin.on('data', function (chunk) {\n\t\t\tif (chunk === null) {\n\t\t\t\treturn cb (new Error(\"Nothing to read\"));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdata += chunk.toString();\n\t\t\t}\n\t\t});\n\n\t\tprocess.stdin.on('end', function () {\n\t\t\treturn c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the winning team score of the match from the server
static async getRoundWinner(tournamentId, matchScore, teamScores, round, match) { const url = ENDPOINTS.WINNER_ENDPOINT; const parameters = { tournamentId: tournamentId, teamScores: teamScores, matchScore: matchScore }; try { const winner = await HTTPRequestHandler.get(url, para...
[ "static async getMatchScore(tournamentId, round, match) {\n const url = ENDPOINTS.MATCH_SCORE_ENDPOINT;\n const parameters = {\n tournamentId: tournamentId,\n round: round,\n match: match\n };\n\n try {\n const matchScore = await HTTPRequestHandler.get(url, parameters);\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cache the uniform locations for faster reutilization
cacheUniformLocations(keys) { for (let i = 0; i < keys.length; ++i) { let type = typeof this.uniforms[keys[i]]; if (type !== "object") { this._logger.warn("Shader's uniform " + keys[i] + " is not an object."); continue; } this.uniforms[keys[i]]._location = this._gl.getUnifo...
[ "cacheUniformLocations(keys) {\n for (let i = 0; i < keys.length; ++i) {\n let type = typeof(this.uniforms[keys[i]]);\n\n if (type !== \"object\"){\n debug.warn(\"Shader's uniform \" + keys[i] + \" is not an object.\");\n continue;\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shows the full path for a given marker (outside and inside time interval)
function showPath(marker) { // clean previous path clearPath(); var points = victimsPoints[marker.nodeId]; var markerId = marker.nodeId; markerPath = marker; // get points that have the correct id var limits = $('#slider-range').slider( "values" ); for(var i = points.length-1; i >= 0; i--) { points[i].se...
[ "function showPath(targetMap) {\r\n\tvar lineSymbol = {\r\n\t\tpath: google.maps.SymbolPath.CIRCLE,\r\n\t\tscale: 8,\r\n\t\tstrokeColor: \"#FF0000\"\r\n\t};\r\n\t\r\n\tvar pathOptions = [];\r\n\tfor (var i = 0; i < shortestPath.length; i++) {\r\n\t\tpathOptions.push({\r\n\t\t\tlat: shortestPath[i].latitude,\r\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the user clicks on one of the buttons to handle avoid areas (draw, edit, delete)
function avoidAreasToolClicked(e) { var btn = e.target; var tag = e.target.tagName; if (tag.toUpperCase() == 'IMG') { //we selected the image inside the button; get the parent (this will be the button). btn = $(e.target).parent().get(0); } //will be either create, edit or remove var mainPart ...
[ "handleMouseForAnnotation() {\n return (this.state.mode !== 'MOVE'\n && this.state.mode !== 'EDITBRUSH'\n && this.state.mode !== 'DELETEBIN') \n && this.props.model.controlsactive;\n }", "function outsideClick() {\n canvas.selectAll(\".clicked\").remove();\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send AJAX request to uploadScore.php to insert the users score into the database.
function uploadScore() { var xmlhttp = new XMLHttpRequest(); var data = [name, avatarDir, score]; xmlhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { } }; xmlhttp.open("POST", "uploadScore.php?q=" + JSON.stringify(data), true); xmlhttp.se...
[ "function postScore() {\t\t\t\n\t\t\tconsole.log(\"Sending score to server\");\n\t\t\t$.ajax({\n type: \"POST\",\n url: \"space_invaders_server.php\",\n\t\t\t\t\tdata: {gscore:gscore},\n cache: false,\n success: onPostSuccess,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validates the given lat and lng to see if it is within 50 km to Dunedin's Octogan.
function validateLocation(lat, lng) { return distance(-45.866891, 170.518202, lat, lng) > 50; }
[ "function InCircle(lat,lng){\n if(Math.pow(lat-center.lat(),2)+Math.pow(lng-center.lng(),2) < Math.pow(hdist,2)){\n return true;\n }else{\n return false;\n }\n }", "function validCoodinates(lat, lng) {\n 'use strict';\n\treturn -90 <= lat && lat <= 90 && -180 <= lng && lng <= 180;\n}", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds nxtdays to date_start and returns as a SQL formatted string
function dateAddDays(date_start, nxtdays) { date_new = new Date(date_start.getTime() + nxtdays*(24*60*60*1000)); var month = date_new.getMonth()+1; if (month<10) month = "0" + month; var day = date_new.getDate(); if (day<10) day = "0" + day; return date_new.getFullYear() + '-' + month + '-' + day; }
[ "function getStartDayN(n) {\n // take the start and add n days to it ;)\n var startDayN = new Date(startDay0.getTime());\n startDayN.setDate(startDayN.getDate() + n);\n \n return startDayN;\n }", "function formatStartDay(startDay) {\r\n return new Date(startDay + \" \" +\"00:00:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates sum of syllableArray
function addSyllables(){ const reducer = (accumulator, currentValue) => accumulator + currentValue; return syllableArray.reduce(reducer); }
[ "function createSylArray(wordArrays){\n\tvar syllablesArray = [];\n\twordArrays.forEach(function(wordArray){\n\t\tvar syl = wordArray[1];\n\t\tvar word = wordArray[0];\n\t\tif (syllablesArray[syl]){\n\t\t\tsyllablesArray[syl].push(word);\n\t\t}\n\t\telse {\n\t\t\tsyllablesArray[syl] = [word];\n\t\t}\n\t});\n\tretur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the tile's bounding volume.
get boundingVolume() { return this._boundingVolume; }
[ "function TileBoundingVolume() {}", "volume() {\n return 8.0 * this.halfExtents.x * this.halfExtents.y * this.halfExtents.z;\n }", "getVolume() {\r\n\t\treturn this.width * this.length * this.height;\r\n\t}", "get contentBoundingVolume() {\n return this._contentBoundingVolume || this._boundingVolume;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the next power of two for the value.
function nextPow2(val) { --val; val = val >> 1 | val; val = val >> 2 | val; val = val >> 4 | val; val = val >> 8 | val; val = val >> 16 | val; ++val; return val; }
[ "function nextPow2(val) {\n --val;\n val = val >> 1 | val;\n val = val >> 2 | val;\n val = val >> 4 | val;\n val = val >> 8 | val;\n val = val >> 16 | val;\n ++val;\n return val;\n }", "function b2NextPowerOfTwo(x)\r\n{\r\n\tx |= (x >> 1);\r\n\tx |= (x >> 2);\r\n\tx |= (x >> 4);\r\n\tx |=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3. Write a function that plays a guessing game. pick a random number between 120 use prompt() to get user input check if guess matches or not if match > give congratulations message with of tries if fail > reprompt for next guess
function guessingGame() { var randomNumber = Math.ceil(20 * Math.random()); var guess = Number(prompt("Try a number between 1 and 20!")); var numTries = 1; if (guess === randomNumber) { alert("Congratulations! You guessed correctly on the first try."); } while (guess !== randomNumber) { guess = Number(prompt(...
[ "function guess() {\n\n // WRITE YOUR EXERCISE 4 CODE HERE\n let randomNumber = Math.floor(Math.random() * 1001) + 1;\n let numberGuesses = 0;\n let guess\n while (guess != randomNumber){\n guess = prompt('Guess the random integer from 1 - 1000.');\n while (guess < 1 || guess > 1000 || guess % 1 != 0) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start editing an existing todo.
startEditingTodo(id) { TodoDispatcher.dispatch({ type: TodoActionTypes.START_EDITING_TODO, id, }) }
[ "function _task_startEdit(task) {\n\n //First of all, close all other tasks to being edited\n _data.tasks.forEach(_task_cancelEdit);\n\n task.$$edit.title = task.title;\n task.$$edit.importance = task.importance.toString();\n task.$$state.onEditMode = true;\n }", "startEditing (task) {\n this.b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove all occurrences of path from the db (can remove multiple files) return: true if removed, false if none found or error
function removePath(path) { db.run("DELETE FROM paths WHERE path LIKE (?)", path+'%', function (err) { if (err) { console.log(err); return; } console.log("DELETE: "+this.changes); }); }
[ "remove(path) {\n let id = uuid(path, UUID_NAMESPACE);\n\n return this.db\n .get(id)\n .then(({ tags }) => {\n let name = Path.parse(path).name;\n\n //First remove from index\n\n // There shoudn't be a case where the file is not indexe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function setUnprotectField(fieldId) Unprotect the field Parameters: fieldId the field Id
function setUnprotectField(fieldId) { var field = getInputField(fieldId); if (field != null) { // make it editable field.readOnly = false; removeClassName(field,'wf_pr'); // enable the buttons disableAnchor(fieldId + BUT_PROMPT + BUT_HREF, false); disableAnchor(fieldId + BUT_OPTION + BUT_HREF, false);...
[ "function setInvisibleField(fieldId)\n{\n\tvar field = getInputField(fieldId);\n\tif (field != null)\n\t{\n\t\tvisibleObj(fieldId,false);\n\t\tvisibleObj(fieldId + ROW_SUFFIX, false);\n\t\tvisibleObj(rtvDisplayFieldFromInputField(field,'*field').id,false);\n\t}\n}", "function setProtectField(fieldId)\n{\n\tvar fi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Based on the availability of captions in currentStreamInfo build tracks in playlists and item page
reInitializeCaptions() { if (this.currentStreamInfo.captions_path) { // Place tracks button if(this.mejsUtility.isMobile()) { // after trackScrubber button in mobile devices this.player.featurePosition.tracks = this.player.featurePosition.trackScrubber + 1; } else { // afte...
[ "_captionsOptionChanged() {\n this.cc = this.__captionsOption > -1;\n Object.keys(this.loadedTracks.textTracks).forEach((key) => {\n let showing = parseInt(key) == parseInt(this.__captionsOption);\n this.loadedTracks.textTracks[key].mode = showing ? \"showing\" : \"hidden\";\n if (showing) this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }