query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Each day a plant is growing by upSpeed meters. Each night that plant's height decreases by downSpeed meters due to the lack of the sun heat. Initially, plant is 0 meters tall. We plant the seed at the beginning of a day. We want to know when the height of the plant will reach a certain level. Example: For upSpeed = 100...
function growingPlant(upSpeed, downSpeed, desiredHeight) { let initHeight = 0; let days = 0; while (initHeight < desiredHeight) { console.log(initHeight); initHeight += upSpeed; if (initHeight < desiredHeight) { initHeight -= downSpeed; } days++; } ...
[ "function growingPlant(upSpeed, downSpeed, desiredHeight) {\n let days = 0;\n let currentHeight = 0;\n \n while(currentHeight <= desiredHeight) {\n days++;\n currentHeight += upSpeed;\n if(currentHeight >= desiredHeight) {\n return days;\n } else {\n cur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints StringLiteralTypeAnnotation, prints value.
function StringLiteralTypeAnnotation(node) { this.push(this._stringLiteral(node.value)); }
[ "function StringLiteralTypeAnnotation(node) {\n this.push(this._stringLiteral(node.value));\n}", "static typeLiteral(value) {\n if (typeof value === 'string') {\n return TypeNames.anyType(`'${value}'`);\n }\n else {\n return TypeNames.anyType(`${value}`);\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saturation fx object. Looks for the conf value saturation which should be between 100 and 100 for it to take affect. A saturation value of 0 will stop the fx.
function SaturationFx () { if (!(this instanceof SaturationFx)) return new SaturationFx(); }
[ "saturation(val) {\n this._saturation = val;\n return this;\n }", "saturation(s = false) { // g/s\n\t\tif(isNaN(s) || s === false) return this.s;\n\t\ts = this._max(s, 0, 100);\n\t\tthis.s = Math.round(s);\n\t\tthis._from_hsl();\n\t\tif(this._cmyk) this._to_cmyk();\n\t\treturn this._resetbasecolor();\n\t}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A wrapper to processing the events from the Google sheet. This first determines the number of rows in the sheet and then calls on listRecentEvents along with the number of records to show.
function populateRecentEvents(minCount) { lastEventRecord=minCount; gapi.client.sheets.spreadsheets.values.get({ spreadsheetId: '1xn0_Qahjb2CrXrXGYAtQ3fqZCu0Ycee3xYo-AmaGTg0', range: 'Sheet1!A1:D' }).then(function(response) { lastEventRecord = response.result.values.length; l...
[ "function listRecentEvents(lastEventRecord, eventCount) {\n clearPre();\n firstEventRecord = lastEventRecord - eventCount + 1;\n // console.log(\"We have a first record \" + firstEventRecord + \" and a last record \" + lastEventRecord);\n gapi.client.sheets.spreadsheets.values.get({\n spreadsheetId...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO eg A A => no same notes returns pos 0: chord evaluation eg "Em" returns pos 1: seventh evaluation eg "M7"
function evaluatedChord(wholechord) { // calculates steps between chord notes and root eg C-E => 4, C-G => 7 let third = (notes.indexOf(wholechord[1])>notes.indexOf(wholechord[0])) ? notes.indexOf(wholechord[1])-notes.indexOf(wholechord[0]) : (12 - Math.abs(notes.indexO...
[ "function get_chord(note, chord)\n{\n var my_n = note_array.indexOf(note.toUpperCase());\n var my_c = chord_structures[chord.toLowerCase()];\n\n var my_notes = new Array();\n my_notes.push(note);\n for (var k = 0; k < my_c.length; k++) {\n my_notes.push(note_array[(my_n + my_c[k]) % note_array...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: getExpertsByID Description: Gets experts by ID so you can show the expert info Parameters: res response object, id the id of the selected expert, mysql node sql object, context results being passed to handlebars, complete function to count the number of loops through objects to we know when to render the page
function getExpertsByID(res, id, mysql, context, complete) { var sql = "SELECT * from Experts e WHERE e.id = ?"; function setC(results) { context.expert = results[0]; } executeQuery(res, sql, id, mysql, complete, setC); }
[ "function getSkillsByID(res, id, mysql, context, complete) {\n\t\tvar sql = \"SELECT s.skillID, s.SkillName, es.Experience, sk.CategoryName FROM Experts e \";\n\t\tsql += \"INNER JOIN ExpertSkills es ON es.FK_ExpertID = e.ExpertID \";\n\t\tsql += \"INNER JOIN Skills s ON s.SkillID = es.FK_SkillID \";\n\t\tsql += \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DON'T DELETE This is a check that would be nice to have, but right now there is an issue with the rights to access all the buckets and I have no time to fight AWS ;) Check if the main bucket exists on S3 for a given account.
function check_if_the_bucket_exists(container) { return new Promise(function(resolve, reject) { // // 1. List all buckets. // s3.listBuckets(function(req_error, data) { // // 1. Check for an error. // if(req_error) { return reject(req_error); } // // 2. Create a variable th...
[ "async checkBucketExist() {\n console.log('Validating AWS S3 bucket...');\n if (await awsUtil.bucketExist(this.bucket)) return true;\n else {\n console.log(this.logSymbols.warning, `Bucket ${this.colors.yellow(`[${this.bucket}]`)} not found in AWS.`);\n return false;\n }\n }", "async functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change to next theme
function next_folio() { var theme_id = 1; if (last_theme_id == -1) theme_id = 2; else { if (last_theme_id == nb_themes) theme_id = 1; else theme_id = parseInt(last_theme_id) + 1; } next_theme(theme_id); }
[ "function nextTheme() {\n var tickets = [\"first\", \"second\", \"third\", \"fourth\", \"fifth\"];\n var ticket = Math.floor(Math.random()*5);\n var key = tickets[ticket];\n var themeIs;\n if (theme_choice_global === \"natural\") {\n themeIs = natureTheme;\n }els...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds new index at the alter table window.
function newIndexAlterTable() { var v_currTabTag = v_connTabControl.selectedTab.tag.tabControl.selectedTab.tag; var v_data = v_currTabTag.alterTableObject.htIndexes.getData(); var v_object = new Object(); v_object.mode = 2; v_object.old_mode = 2; v_object.index = v_currTabTag.alterTableObject.infoRowsIndexes.le...
[ "enterAlterByAddIndex(ctx) {\n\t}", "enterAlterByAddSpecialIndex(ctx) {\n\t}", "enterAlter_index(ctx) {\n\t}", "enterNew_index_name(ctx) {\n\t}", "function addIndex(){\n $('td').each(function(index){\n $(this).append(index);\n })\n }", "enterAlterByDropIndex(ctx) {\n\t}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simple event function that unpauses the game when an unpause event is triggered.
unpause(event) { if(this.level.game.paused){ this.pauseText.destroy(); this.level.game.paused = false; } }
[ "function unpause(){\n\tgame.paused = false;\n\tpaused = false;\n}", "unpause() {\n this.raise('unpause')\n }", "function onPause(e){\n \n //sets it to its opposite value.\n gameOn = !gameOn;\n gameLoop();\n }", "function unpause()\n{\n if(Perseus.game.paused)\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shows the DOM elements for the label options and unmarks all other objects that can be marked in properties mode
function showLabelPropMenu() { propBoxLabel.show(); labCaptLabel.show(); opNameLabel.hide(); ipNameLabel.hide(); colNameLabel.hide(); outputCaptionBox.hide(); outputColorBox.hide(); inputIsTopBox.hide(); inputCaptionBox.hide(); clockspeedLabel.hide(); clockspeedSlider.hide();...
[ "function showLabels() {\n isVisible.content = true;\n isVisible.position = true;\n isVisible.statements = true;\n\n label.style(\"display\", 'inline');\n rect.style(\"display\", 'inline');\n\n hideLabelsOfNotSelectedNodes();\n\n // also show content of positions and...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
underlineTypeVars :: (TypeInfo, StrMap (Array Any)) > String
function underlineTypeVars(typeInfo, valuesByPath) { // Note: Sorting these keys lexicographically is not "correct", but it // does the right thing for indexes less than 10. var paths = Z.map (JSON.parse, sortedKeys (valuesByPath)); return underline ( typeInfo, K (K (_)), function(in...
[ "function typeVarNames(t) {\n return Z.concat (\n t.type === VARIABLE ? [t.name] : [],\n Z.chain (function(k) { return typeVarNames (t.types[k].type); }, t.keys)\n );\n }", "function typeVarNames(t) {\n return Z.concat (\n t.type === VARIABLE ? [t.name] : [],\n Z.chain (function(k) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========= MUD_SelectBankname ================ PR20230720
function MUD_SelectBankname(el_input) { console.log( "===== MUD_SelectBankname ========= "); if(el_input){ el_MUD_bankname.value = el_input.value; MUD_validate_input(el_MUD_bankname) }; }
[ "function setBankName() {\n var bankcd = document.getElementById(\"bank_cd\").selectedIndex;\n document.getElementById(\"bnk_name\").selectedIndex = bankcd;\n }", "function setBankCode() {\n var banknme = document.getElementById(\"bnk_name\").selectedIndex;\n document.getElementById(\"bank_cd\").sele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the pulse counter value. The value is a 32 bit integer. In case of overflow (>=2^32), the counter will wrap. To reset the counter, just call the resetCounter() method.
get_pulseCounter() { return this.liveFunc._pulseCounter; }
[ "function YProximity_get_pulseCounter()\n {\n var res; // long;\n if (this._cacheExpiration <= YAPI.GetTickCount()) {\n if (this.load(YAPI.defaultCacheValidity) != YAPI_SUCCESS) {\n return Y_PULSECOUNTER_INVALID;\n }\n }\n res = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Token controller (user level)
function TokenController(config) { var opts = { }; // TODO - secure this when enabling. //opts[SIS.OPT_LOG_COMMTS] = true; opts[SIS.OPT_TYPE] = SIS.SCHEMA_TOKENS; SIS.UTIL_MERGE_SHALLOW(opts, config); ApiController.call(this, opts); this.userManager = this.sm.auth[SIS.SCHEMA_USERS]; }
[ "function tokenHandler(err, token) {\n if (err){ return fn(err); }\n token.__data.user = user;\n fn(err, token);\n }", "getToken() {\n\t\treturn this._post(\"/api/user/token\");\n\t}", "function create_token(ev) {\n api.submit_login(props.login);\n }", "function tokenHandler(err,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns array of all short url IDs
#getShortUrlsArray() { let shortUrlsArray = fs.readdirSync( path.resolve(__dirname, "./DB"), "utf-8" ); return shortUrlsArray.map((url_id) => { return url_id.split(".")[0]; }); }
[ "function urlsForUser(id) {\n let myURL = [];\n for (let key in urlDatabase) {\n let userID = urlDatabase[key].userID;\n if(id === userID) {\n data = urlDatabase[key];\n data.shortURL = key;\n myURL.push(data);\n\n }\n }\n return myURL;\n}", "function urlsForUser(id) {\n let urls = []...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a layer number, returns the name of the layer as defined in either a Builtin or a User Layer in the Tags and Layers manager.
static LayerToName() {}
[ "function getXYZLayerName(xyzLayer, index) {\n return (xyzLayer.meta && xyzLayer.meta.title) || (\"layer-\" + index);\n }", "function getXYZLayerName(xyzLayer, index) {\n return (xyzLayer.meta && xyzLayer.meta.title) || `layer-${index}`;\n}", "function getLayerNameByIndex(layerIndex) { \r var la...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
events handle the main event listeners and calls retrive to get the stored movies in nomination list
function events(){ retrive() const form = document.getElementById('form') const nomination = document.getElementById('nominations') form.addEventListener('submit', getMovies) nomination.addEventListener('click', displayNominations) }
[ "function runMovies() {\n\n // using a queryUrl similar to good practice in ajax get requests.\n var queryUrl = \"http://www.omdbapi.com/?apikey=trilogy&t='\" + searchTerm + \"'&type=movie\";\n \n // setting up a default movie search if searchTerm is undefined\n if(searchTerm === ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creation a copy of canvas
function cloneCanvas(oldCanvas) { const newCanvas = document.createElement('canvas'); const context = newCanvas.getContext('2d'); newCanvas.width = oldCanvas.width; newCanvas.height = oldCanvas.height; context.drawImage(oldCanvas, 0, 0, oldCanvas.width, oldCanvas.height); return newCanvas; }
[ "copyCanvas(){\n const newCanvas = document.createElement('canvas');\n newCanvas.id = `frame${this.number}canvas${this.canvasList.length}`;\n \n const prefill = true;\n setCanvas(prefill, newCanvas, this.width, this.height);\n \n //newCanvas.style.opacity = 0.97;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Accepts a array of duplicates, identifies the master and marks each module as master or slave.
function _markMasterAndSlaves(modules) { modules.sort(function(a, b) { a = a.id; b = b.id; var output = a.length - b.length; if (output === 0) { return a > b ? 1 : -1; } return output; }); var selected, m; for (var i = 0; i < modules.length; i++) { m = modules[i]; if (!m.i...
[ "activeMasterChanged(master) {\n // another master has taken over?\n if (this.state.isActive && master && master !== this.slaves) {\n this.updateIsActive(false, false);\n }\n }", "function updateGuildMasters() {\n //reset all flags.\n for (user in users) {\n users[user].isMaster = fals...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets and formats the stats for EtherSecurityLookup.html
getStats() { var objMetaMaskList = this.getListStructure(); var objEslTools = new EslTools(); if(document.getElementById("ext-ethersecuritylookup-domain_verification_checkbox")) { document.getElementById("ext-ethersecuritylookup-domain_verification_checkbox").checked = objMetaMa...
[ "getStats()\n {\n var objTwitterWhitelist = this.getWhitelistStructure();\n var objEslTools = new EslTools();\n\n if(document.getElementById(\"ext-ethersecuritylookup-twitter_whitelist_checkbox\")) {\n document.getElementById(\"ext-ethersecuritylookup-twitter_whitelist_checkbox\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Portfolio Page Isotope filter
function simplePortfolioPageIsotope() { "use strict"; if ($('#portfolio-preview-items .filterable').length > 0) { var $container = $('#portfolio-preview-items .filterable'); $container.imagesLoaded(function() { var state = $container.mixItUp(); si...
[ "function portfolio_isotope(){\n if ( $('.portfolio_inner').length ){\n \n // Activate isotope in container\n $(\".portfolio_inner\").imagesLoaded( function() {\n $(\".portfolio_inner\").isotope({\n itemSelector: \".portfolio_single\",\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End of bamazonManagerView() Function: viewProductsForSale(runMgrView) runMgrView : true/false The app should list every available item: the item IDs, names, prices, and quantities.
function viewProductsForSale(runMgrView, cb) { // console.log("Inside viewProductsForSale()"); let queryString = "SELECT * FROM products"; let query = connection.query(queryString, function (err, res) { if (err) throw err; console.log("\n\n"); console.log("\t\t\t\t---- Products ...
[ "function viewProductsForSale() {\n\t\n\t\tprintProductsReportHeader();\n\t\tconnection.query(\"SELECT item_id, product_name, price, stock_quantity FROM products\", function(err, res) {\n\t\t\tif (err) throw err;\n\t\n\t\t\tfor (const product of res) {\n\t\t\t\tconsole.log(\n\t\t\t\t\tproduct.item_id.toString().pad...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function will go through each of the results, and, if the distance is LESS than the value in the picker, show it on the map.
function displayMarkersWithinTime(response) { let maxDuration = document.getElementById('max-duration').value; let origins = response.originAddresses; // console.log(origins); let destinations = response.destinationAddresses; // console.log(destinations); // Parse through the results, and get the distance ...
[ "function filterByDistance(response){\n\tvar withinDistance = maxMiles().miles;\n\tconsole.log(withinDistance);\n\tvar results = response.rows[0].elements;\n\tfor (var i = 0; i < results.length; i++) {\n\t\tvar meters = results[i].distance.value;\n\t\tvar miles = metersToMiles(meters);\n\t\tmarkerList[i].distance(m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
callback function for cm editor enter function
editorEnter (cm) { const cur = cm.getCursor() const { lineString, lineTokens } = this._getTokenLine(cm, cur) const [, indent, firstArrayItem] = lineString.match(/^(\s*)(-\s)?(.*?)?$/) || [] let extraIntent = '' if (firstArrayItem) { extraIntent = `${repeat(' ', this.arrayBulletIndent)}` }...
[ "function ips_editor_events()\n{\n}", "function onEnter(sel, callback, args){\n\t$(sel).keypress(function(e){\n\t\tif(e.which == 13){\n\t\t\te.preventDefault();\n\t\t\tif ($.isFunction(callback))\n\t\t\t\tcallback(args);\n\t\t}\n\t});\n}", "function onModEnter(opts, event, change, editor) {\n var value = cha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
::= PSTART PNAME PEND PARSE>TPARAM
function parseTparam(s) { var tset= {PSTART:true, PNAME: true, PEND:true} var object= {name:"tparam",pname:null} var tk= scaner(s.substr(counter),tset) if(tk.token=="PNAME"){ counter+=tk.value.length //increment counter object.pname=tk.value.trim() } if(tk.token=="PEND"){ counter+= 3 // increment count...
[ "function parse() {\n var pos = 0;\n var cons = [];\n while (pos < input.length) {\n var name = input[pos++];\n var params = [];\n while (input[pos] != \"|\" && pos < input.length) {\n params.push({type: input[pos], name: params.length});\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Approve client and reject client2
function approveClient2(req,res){ var db = require('../../lib/database')(); var db2 = require('../../lib/database')(); if(req.body.btn1 == 'approve'){ var sql = "UPDATE tbluser SET strStatus= 'Registered', datDateRegistered=? WHERE strStatus='Unregistered' AND intID = ?"; db.query(sql,[req.body.dateregist...
[ "function approveClient2(req,res){\n var db = require('../../lib/database')();\n var db2 = require('../../lib/database')();\n if(req.body.btn1 == 'approve'){\n var sql = \"UPDATE tbluser SET strStatus= 'Registered' WHERE strStatus='Unregistered' AND intID = ?\";\n db.query(sql,[req.body.clientID],function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove all patterns and values held in the instance.
clear(){ const patterns = instancePatterns.get(this); patterns.clear(); super.clear(); }
[ "function clearPattern() { \n pattern[\"BACKGROUND_count\"] = []\n pattern[\"CENTRAL_count\"] = []\n pattern[\"GROUNDING_count\"] = []\n pattern[\"LEXGLUE_count\"] = []\n pattern[\"ROLE_count\"] = []\n pattern[\"RATING\"] = []\n pattern[\"ROW\"] = []\n pattern[\"TABLE\"] = []\n pattern...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
document, with a specified name and optional attributes. Arguments: document: The Document object that the cookie is stored for. Required. name: A string that specifies a name for the cookie. Required. hours: An optional number that specifies the number of hours from now that the cookie should expire. path: An optional...
function Cookie(document, name, hours, path, domain, secure){ // All the predefined properties of this object begin with '$' // to distinguish them from other properties which are the values to // be stored in the cookie. this.$document = document; this.$name = name; if (hours) th...
[ "function Cookie(document, name, hours, path, domain, secure)\n{\n // All the predefined properties of this object begin with '$'\n // to distinguish them from other properties which are the values to\n // be stored in the cookie.\n this.$document = document;\n this.$name = name;\n if (hours)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populates HTML for employee modal
function createEmployeeModal(index) { const employeeIndex = employeeData[index]; const date = new Date(employeeIndex.dob.date); const modalHTML = ` <div class="modal-container"> <div class="modal"> <button type="button" id="modal-close-btn" class="modal-close-btn...
[ "renderEmployeeFull() {\n return `\n <div class=\"modal\" id=\"employee-${this.id}\">\n <button type=\"button\" id=\"modal-close-btn\" class=\"modal-close-btn\">×</button>\n <div class=\"modal-info-container\">\n <img class=\"modal-img\" src=\"${this.picture.medium}\" alt=\"${this.ful...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pulses Per Quarter note. This is the smallest resolution the Transport timing supports. This should be set once on initialization and not set again. Changing this value after other objects have been created can cause problems.
get PPQ() { return this._clock.frequency.multiplier; }
[ "get PPQ() {\n return this._clock.frequency.multiplier;\n }", "function getMinuteOffset() {\n var quarterTime = Tone.Transport.PPQ; // One quarter in ticks.\n var quarters = Tone.Transport.ticks / quarterTime;\n // In our simulation, each quarter note is a 'minute'.\n return Math.floor(quarters);\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Logic to register a new dynamically created role with roleresolver.
function registerNewResolver(roleName, roleId) { try{ CUSTOM_ROLES[roleName] = roleId; Role.registerResolver(CUSTOM_ROLES[roleName], function(role, context, cb) { fetchArg(context, function(err, ret) { if(!err && ret){ f...
[ "registerRole(role) { this.roles[role.key] = role; }", "async createRole(req, res) {\n\t\tconst { error } = roleModel.validateRole(req.body);\n\t\tif (error) return res.status(400).send(error.details[0].message);\n\n\t\tlet role = await roleModel.Role.findOne({ title: req.body.title });\n\t\tif (role) return res....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hides modal if the touch event is outside of it. Arguments: event the touch event
function hideModalTouchHandler(event) { var $target = $(event.touches[0].target); hideModalIfOutside($target); }
[ "onTouchStart(event) {\n if (this.outsideClick && !event.target.classList.contains('popover-body')) {\n this.hide();\n }\n }", "function outsideClick(e) {\n if (e.target == modal) {\n modal.style.display = 'none'\n }\n }", "function outsideClick(e) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles command line argument verification. Reads input file line by line and starts output once file is completley read.
function main(entryArgs){ let argV = entryArgs; //verify proper formatting if(argV.length > 3 || argV.length <= 2){ console.log("Usage: $ node coding-exercise.js <path-to-input-file>"); return; } let filePath = entryArgs.slice(2); filePath = path.resolve(filePath[0]); //verify file exists and read line by li...
[ "function readCommandLine(){\n log.debug('readCommandLine - Start');\n var myArgs = process.argv;\n var fullPathToFile;\n var normalizedFilePath;\n \n\n if (myArgs.length < 3){\n log.error('Please provide input filename, format: node ' + myArgs[1] + ' <name of input file.txt>')\n pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define an async test based on a generator function
function asyncTest(generator) { return () => Task.spawn(generator).then(null, ok.bind(null, false)).then(finish); }
[ "testAsync() {\n var test = async( function* () {\n var blah = yield wait(1000);\n log(`waited in between`);\n yield wait(2000);\n log(`finally all done!`);\n });\n\n test();\n }", "function foo() {return __asyncGen(function*(){\n yield yield{__...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate table of contest for nacp decls
function generateTocNacp() { $( "<div id='nacp-toc'><a class='toc-collapse' data-toggle='tooltip' data-placement='left' title='Згорнути'><span>Зміст декларації</span></a><h2>Зміст:</h2><ul></ul></div>" ).insertAfter( ".decl-header-wrap .sub-header" ); //lets find all text without tag = text nodes ...
[ "function create_courts_html()\r\n{\r\n var page = '<table class=\"center nopagebreak\"><caption>'+emph(tr(\"Tennis courts\"))+'</caption>';\r\n for (var i=0; i<Courts.length; i++)\r\n {\r\n page += '<tr><td class=\"nr\">'+(i+1)+'<td>'+es(Courts[i].name)+'</td>';\r\n page += '</tr>';\r\n }\r\n p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Processes verboticons to add background colors
async function processVerboticons(emojis) { await fs.ensureDir(OUTPUT_DIR) const numEmoji = emojis.length const bar = new ProgressBar('processing verboticons [:bar] :current/:total :percent :etas', { total: numEmoji, width: 80 }) for (let i = 0; i < numEmoji; i++) { const emoji = emojis[i] c...
[ "static processBackgroundImage(element,valueNew){return TcHmi.System.Services.styleManager.processBackground(element,{image:valueNew})}", "function adjustIconColorDocument() {\n $('.oi-icon').each(function(e) {\n if(!$(this).hasClass('colored')) {\n $(this).css('fill', '#3E2F24');\n $(this)....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes initial (leading) whitespace characters from s. Global variable whitespace (see above) defines which characters are considered whitespace.
function stripInitialWhitespace (s) { var i = 0; while ((i < s.length) && charInString (s.charAt(i), whitespace)) i++; return s.substring (i, s.length); }
[ "function stripInitialWhitespace (s)\r\n{\r\n\tvar i = s.indexOf(whitespace);\r\n\r\n\treturn s.substring(i, s.length);\r\n}", "function stripInitialWhitespace (s)\n\n{ var i = 0;\n\n while ((i < s.length) && charInString (s.charAt(i), whitespace))\n i++;\n \n return s.substring (i, s.length);\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get an amount of identifiers for creator where mp3s exist useful for generating a playable list or list of mp3 links
function getIdentifiersWithMp3ForCreator(creator, count, callback) { // TODO need to page this, &page=' + page + ', or insert count for big list var reqPath = 'https://archive.org/advancedsearch.php?q=creator:' + creator + '&has_mp3%281%29&fl%5b%5D=identifier&rows=' + 100 + '&output=json'; request(reqPath, functi...
[ "function getIdentifiersForCreator(creator, count, callback) {\n // TODO need to page this, &page=' + page + ', or insert count for big list\n var reqPath = 'https://archive.org/advancedsearch.php?q=creator:' + creator + '&fl%5b%5D=identifier&rows=' + count + '&output=json';\n request(reqPath, function (err, res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compute circle helper function
function computeCircle(x, centerX, y, centerY){ return Math.round(Math.sqrt(Math.pow(x - centerX, 2) + Math.pow(y - centerY, 2))); }
[ "xcircle(r) {\n }", "function computePerimeterOfACircle(radius) {\n // your code here\n return 2 * Math.PI * radius;\n}", "function circleRadius(cosRadius,point){point=cartesian(point),point[0]-=cosRadius;cartesianNormalizeInPlace(point);var radius=acos(-point[1]);return((-point[2]<0?-radius:radius)+ta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the default associated groups (Members, Owners, Visitors) and gives them the default permissions on the site. The target site must have unique permissions and no associated members / owners / visitors groups
createDefaultAssociatedGroups(siteOwner, siteOwner2, groupNameSeed) { const q = this.clone(Web_1, `createDefaultAssociatedGroups(userLogin=@u,userLogin2=@v,groupNameSeed=@s)`); q.query.set("@u", `'${encodeURIComponent(siteOwner || "")}'`); q.query.set("@v", `'${encodeURIComponent(siteOwner2 |...
[ "function installDefaultGroupsIfNotExist() {\r\n setDefaultGroup(setDefaultDials);\r\n }", "function applyDefaultPermissions(node) {\n logger.log(\"Applying Default Permissions\");\n if ((node !== null)) {\n node.setInheritsPermissions(false);\n node.removePermission(\"Consumer\", \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an instance of redirect component.
function RedirectComponent(route) { this.route = route; }
[ "addRedirect(props = {}) {\n try {\n jsiiDeprecationWarnings.aws_cdk_lib_aws_elasticloadbalancingv2_ApplicationLoadBalancerRedirectConfig(props);\n }\n catch (error) {\n if (process.env.JSII_DEBUG !== \"1\" && error.name === \"DeprecationError\") {\n Error.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A placeholder can contain a header.
function PlaceholderHeader(props) { var children = props.children, className = props.className, content = props.content, image = props.image; var classes = Object(clsx__WEBPACK_IMPORTED_MODULE_1__["default"])(Object(_lib__WEBPACK_IMPORTED_MODULE_4__["useKeyOnly"])(image, 'image'), 'header', classN...
[ "insertHeader() {}", "function PlaceholderHeader(props) {\n var children = props.children,\n className = props.className,\n content = props.content,\n image = props.image;\n var classes = classnames(useKeyOnly(image, 'image'), 'header', className);\n var rest = getUnhandledProps(Plac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scene_OmoMenuSkill The scene class of the skill screen. =============================================================================
function Scene_OmoMenuSkill() { this.initialize.apply(this, arguments); }
[ "function Scene_Skill() {\n this.initialize.apply(this, arguments);\n}", "function Scene_SkillEquip() {\n this.initialize.apply(this, arguments);\n}", "function Window_OmoMenuActorSkillEquip() { this.initialize.apply(this, arguments); }", "function Scene_OmoMenuEquip() { this.initialize.apply(this, argu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apertura del collapse dei conti.
function aperturaCollapseConti() { $(":input", "#fieldsetCollapseInserimentoConto").val(""); gestisciClassePiano(); gestisciClasseDiConciliazione(); $("#collapseInserimentoConto").collapse("show"); }
[ "function aperturaCollapseConti() {\n $(\":input\", \"#fieldsetCollapseDatiStruttura\").not(\"[data-maintain]\").val(\"\");\n $(\"#collapseDatiStruttura\").collapse(\"show\");\n }", "function aperturaCollapseConti() {\n $(\":input\", \"#fieldsetCollapseDatiStruttura\").val(\"\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updateAllElectronicBlockStatus update all ElectronicBlock's status to app.
function updateAllElectronicBlockStatus() { _logicEngine.updateAllBlockStatus(); }
[ "function updateAllBlockStatus() {\n 'use strict';\n\n var name;\n var idx;\n var values;\n for (var no = 0; no < _activeBlocksCache.length; no++){\n if (_activeBlocksCache[no] && (_activeBlocksCache[no].online)){\n name = _activeBlocksCache[no].name;\n idx = getBlockIdx(name,no);\n values = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pop up username input / Game Information functions Open Popup Function
function openPopup() { popup.style.display = "block"; usernameInput.placeholder = username; }
[ "function openPopup() {\n setup.classList.remove('hidden');\n setupPosition.left = setup.offsetLeft + 'px';\n setupPosition.top = setup.offsetTop + 'px';\n setupSimilar.classList.remove('hidden');\n document.addEventListener('keydown', onPopupEscPress);\n setupUserName.addEventListener('focus', onSetupUserNam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: _fnGetUniqueThs Purpose: Get an array of unique th elements, one for each column Returns: array node:aReturn list of unique ths Inputs: node:nThead The thead element for the table
function _fnGetUniqueThs ( nThead ) { var nTrs = nThead.getElementsByTagName('tr'); /* Nice simple case */ if ( nTrs.length == 1 ) { return nTrs[0].getElementsByTagName('th'); } /* Otherwise we need to figure out the layout array to get the nodes */ var aLayout = [], aReturn = []; ...
[ "function _fnGetUniqueThs ( nThead )\n\t\t{\n\t\t\tvar nTrs = nThead.getElementsByTagName('tr');\n\t\t\t\n\t\t\t/* Nice simple case */\n\t\t\tif ( nTrs.length == 1 )\n\t\t\t{\n\t\t\t\treturn nTrs[0].getElementsByTagName('th');\n\t\t\t}\n\t\t\t\n\t\t\t/* Otherwise we need to figure out the layout array to get the no...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete an image from an article
deleteArticleImage(key) { let vm = this; if(vm.articleImages[key].pivot) { Api.http .delete(`/articles/${vm.article.id}/images/${vm.articleImages[key].id}`) .then(response => { if(response.status...
[ "function deleteImage() {\n fs.unlink(imagefile, (err) => {\n if (err) { return console.error(err); }\n });\n}", "function deleteImage() {\n\tvar image = request.httpParameterMap.file.value;\n\tvar id = request.httpParameterMap.id.value;\n\tvar file = new File(image);\n\tfile.remove();\n\tCalls.deleteFileOnC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
yil that function originally generates letter footnote labels. It's changed to number so that international users can have an easier time to read it. private
function newAnchorLabel() { count = ++that.anchor_count; anchor_label = strval((count + 1)); //generating footnote number starting at 1 instead of 0 /* yil original letter generating label code anchor_label = ''; do { anchor_label = chr(or...
[ "function lilyNotename(i) {\n var notes = [\"c\", \"cs\", \"d\", \"ef\", \"e\", \"f\", \"fs\", \n \"g\", \"af\", \"a\", \"bf\", \"b\", \"c\"];\n var o = \",,,,,'''''\";\n var oct = \"\";\n\n if (i > 127) { \n return \" \"; \n }\n if (i > 71) { \n oct = o.substring(5, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a single checkbox and returns newly created checkbox
function createCheckBox() { return $('<input />', { type: 'checkbox' }).addClass("dd-check-boxes"); }
[ "function mkCheckbox(){\n return $(\"<input type='checkbox' />\");\n }", "function createCheckbox(isChecked) {\n var checkbox = doc.createElement('input');\n checkbox.setAttribute('type', 'checkbox');\n checkbox.setAttribute('disabled', 'disabled');\n\n if (isChecked) {\n checkbox.set...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets constraints to original values.
function resetConstraints(mode, dimension) { if (dimension) { currentConstraints[mode][dimension][0] = originalConstraints[mode][dimension][0]; currentConstraints[mode][dimension][1] = originalConstraints[mode][dimension][1]; } else { currentConstraints = JSON.parse(JSON.stringify(originalConstraints)); } }
[ "function resetBoundConstraints() {\n\t\tboundConstraints = {\n\t\t\tDefault: {}\n\t\t};\n\t}", "function resetBoundConstraints() {\n boundConstraints = {\n Default: {}\n };\n }", "reset() {\n this.clone.reset();\n this.rule.reset();\n }", "function reset() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
delete a file from s3
function deleteFile(fileKey) { var params = { Bucket: bucketName, Key: fileKey, }; s3.deleteObject(params, function (err, data) { if (err) console.log(err, err.stack); console.log('deleted!'); }); }
[ "function deleteFileOnS3() {\n\t\tparams = {Bucket: myBucket, Key: myKey};\n\t s3.deleteObject(params, function(err, data) {\n\t if (err) {\n\t console.log(err)\n\t } else {\n\t console.log(\"Successfully deleted data in \" + myBucket, data);\n\t }\n\t });\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
5. Write an `addn(..)` that can take an array of 2 or more functions, and using only `add2(..)`, adds them together. Try it with a loop. Try it without a loop (recursion). Try it with builtin array functional helpers (map/reduce).
function addnFor(...args) { let sum = 0; for(let fn of args) { sum = add2(num(sum), fn); } return sum; }
[ "function addn(arrFunc) {\n\tfuncCount = arrFunc.length;\n\tvar sum = 0;\n\tfor (var i = 0; i < funcCount; i++){\n\t\tsum = add2( foo(args[i]) + foo(sum) );\n\t}\n\treturn sum;\n}", "function addn1(fnArr) {\n var result = 0;\n for (var i = 0; i < fnArr.length; i += 2) {\n if (typeof fnArr[i + 1] === \"functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Submits the update avatar form.
function saveImage() { $('#avatar-form').submit(); }
[ "function submitAvatarUpload() {\n s.avatarSubmit.click();\n }", "function handleSubmit(evt) {\n evt.preventDefault();\n //validate edit avatar\n // editAvatarValidator.enableValidation();\n props.onUpdateAvatar(avatarRefs.current.value);\n // avatarRefs.current.value ='';\n }", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return Bounding Box From Country Name =============================================================== Description: Returns an array containing N(y), S(y), E(x) and W(x) bounding box coordinates.
function returnBoundingBoxFromCountryName(countryName) { let countriesInfo = countriesInfoFunctions.returnCountriesInfo(); let features = countriesInfo['countryBorders']['features']; let countryBoundary; for (let i = 0; i < features.length; i++) { if (features[i]['properties']['name'] == co...
[ "function BoundingBox() {\n var bounds = map.getBounds().getSouthWest().lng + \",\" + map.getBounds().getSouthWest().lat + \",\" + map.getBounds().getNorthEast().lng + \",\" + map.getBounds().getNorthEast().lat;\n return bounds;\n}", "function boundingBox() {\n var vPoints = copy.apply(undefined, argumen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simple route middleware to ensure user is authenticated, use on any protected resource. Also restores the user's Google oauth token from the session, available as req.authClient
function ensureAuthenticated(req, res, next) { if (req.isAuthenticated()) { req.authClient = new googleapis.auth.OAuth2(GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET); req.authClient.credentials = req.session.googleCredentials; return next(); } res.redirect('/'); }
[ "function ensureAuthenticated(req, res, next) {\r\n if (req.user) { return next(); }\r\n res.redirect('/login');\r\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login')\n }", "function ensureAuthenticated(req,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========= MUPS_SelectSchool_Response ================ PR20221026 PR20221121
function MUPS_SelectSchool_Response(tblName, selected_dict, selected_pk) { console.log( "===== MUPS_SelectSchool_Response ========= "); console.log( " tblName", tblName); console.log( " selected_dict", selected_dict); console.log( " selected_pk", selected_pk, typeof selected_pk)...
[ "function t_MUPS_SelectSchool_Response(tblName, selected_dict, selected_pk) {\n console.log( \"===== t_MUPS_SelectSchool_Response ========= \");\n console.log( \" tblName\", tblName);\n console.log( \" selected_dict\", selected_dict);\n console.log( \" selected_pk\", selected_pk...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initial callback that sets the payload and kicks off the recursive method if "deep" is set to true
function setNodes(data){ payload = data; if(kontx.args.deep === true){ async.eachSeries(data, loadChild, sendNext); } else { sendNext(); } }
[ "_setChildren(item,data){// find all children\nconst children=data.filter(d=>item.id===d.parent);item.children=children;if(0<item.children.length){item.children.forEach(child=>{// recursively call itself\nthis._setChildren(child,data)})}}", "function recurse(tree) {\n callback.call(tree, tree.value)\n\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a sum key for this date and period. The date should be on a boundary for this period.
getSumKey(date) { if (!this.onBoundary(date)) { throw "Not on proper boundary!"; } return this.aggregateKey + date.toISOString().substr(0, this.strLength); }
[ "_sumKey(array, begin, n) {\r\n return begin.toString() + \"-\" + n.toString();\r\n }", "function dateKey(date) {\n const d = new Date(date);\n const year = d.getFullYear();\n var month = d.getMonth() + 1;\n month = month < 10 ? \"0\" + month : month;\n var day = d.getDate();\n day = day < 1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all of the applicants that have applied for a grant.
getApplicationsForGrant(grantId) { return this.connection.getRepository(ApplicationInformationDBO_1.ApplicationInformationDBO).find({ grantId: grantId }); }
[ "function getGrantApplications() {\n return new Promise(function(resolve, reject) {\n resolve(db.find());\n });\n}", "static getAllApplicants(){\n let applicants = JSON.parse(localStorage.getItem(\"APPLICANTS\")) || [];\n return applicants;\n }", "function getApplicants(req, res){\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the height of a line, propagating the height change upwards to parent nodes.
function updateLineHeight(line, height) { var diff = height - line.height; if (diff) for (var n = line; n; n = n.parent) n.height += diff; }
[ "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n\t\t var diff = height - line.height;\n\t\t if (diff) { for (var n = line; n; n = n.parent) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given the movie title, let's make a url
function makeIMDbUrl(movietitle) { var imdburl = 'http://www.imdb.com/find?q='+ movietitle +';tt=on;nm=on;mx=20;'; return imdburl; }
[ "function titleToUrl(title){\r\n return 'https://en.wikipedia.org/wiki/' + \r\n encodeURIComponent(title.replace(' ', '_'));\r\n}", "function getMovieSearchUrl(title) {\n\treturn \"https://www.omdbapi.com/?s=\" + title.replace(\" \", \"+\") + \"&r=json\";\n}", "function makeIMDbUrl(movietitle) {\r\n\t\tv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Description: Returns true if a New Zealand NHI passes checksum validation, otherwise returns false.
function is_nz_nhi(NHI) { var passTest = false; // Validation steps 1 and 2 if (/^[A-HJ-NP-Z]{3}[0-9]{4}$/.test(NHI)) { var checkValue = 0; // Init alpha conversion table omitting O and I. A=1~Z=24 var aplhaTable = "ABCDEFGHJKLMNPQRSTUVWXYZ".split(''); for (i = 0; i < 3; i++)...
[ "function luhn_validate(fullcode) {\n return luhn_checksum(fullcode) == 0\n}", "function luhn_validate(fullcode) {\n return luhn_checksum(fullcode) == 0\n}", "static checkStandardUPCEANChecksum(s) {\n const length = s.length;\n if (length === 0) {\n return false;\n }\n\n let sum = 0;\n f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an instance of easyXDM from the parent window with respect to the namespace.
function getParentObject(){ var obj = parent; if (namespace !== "") { for (var i = 0, ii = namespace.split("."); i < ii.length; i++) { obj = obj[ii[i]]; } } return obj.easyXDM; }
[ "function getParentObject(){\n var obj = parent;\n if (namespace !== \"\") {\n for (var i = 0, ii = namespace.split(\".\"); i < ii.length; i++) {\n obj = obj[ii[i]];\n }\n }\n return obj.easyXDM;\n }", "function getParentObject(){\n var obj = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create new seeds according to the configuration file.
async function newSeed() { try{ await checkExist(seeds.tomato); await checkExist(seeds.pakchoi); await checkExist(seeds.brassica); await checkExist(seeds.cucumber); await checkExist(seeds.cabbage); }catch (err) { throw err } }
[ "seed()\n {\n for (let name in this._seeds)\n {\n this._seeds[name].seed();\n }\n }", "function Seed() {\n /**\n * Default options for reading files. Reading as a utf-8-encoded string, as\n * opposed to raw binary, allows for proper sql queries.\n * @private\n */\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
walks an array of source files, loading each of their dependencies
function walk(files, opts, callback) { var remaining = [].concat(files) , found = [] , visited = {} function insert(err, origin, deps) { if (err != null) { return callback(err) } origin.deps = deps // groom all dependencies, and schedule them for inspection for (var i = 0; i < d...
[ "function processFiles() {\n console.log(\"Processing files in \", source, \".\");\n fq.readdir(source, function (err, files) {\n if (err) throw err;\n for (var i = 0, l = files.length; i < l; i++) {\n processFile(source + files[ i ]);\n }\n });\n}", "function getSourceTre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if there is a large file that is being uploaded in chunks, this is used to display extra information about the status of the upload
updateLargeFileStatus(fileName, chunkStartIndex, chunkEndIndex, totalUploadFileSize) { // display 1 decimal place without any rounding const percentage = this.formatPercentage(chunkEndIndex, totalUploadFileSize); core_1.info(`Uploaded ${fileName} (${percentage.slice(0, percentage.indexOf('.') + ...
[ "shouldUseChunkUpload(file) {\r\n return this.chunkEnabled &&\r\n !!this.chunkOptions.handler &&\r\n file.size && file.size > this.chunkOptions.minSize;\r\n }", "function upload_progress(ev) {\n var msg;\n if (!ev.lengthComputable)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempt to delete the entities on the server failed or timedout. Action holds the error. If saved pessimistically, the entities could still be in the collection and you may not have to compensate for the error. If saved optimistically, the entities are not in the collection and you may need to compensate for the error.
saveDeleteManyError(collection, action) { return this.setLoadingFalse(collection); }
[ "saveDeleteMany(collection, action) {\n const deleteIds = this.extractData(action).map((d) => typeof d === 'object' ? this.selectId(d) : d);\n deleteIds.forEach((deleteId) => {\n const change = collection.changeState[deleteId];\n // If entity is already tracked ...\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the mask of PSR bits set by a MSR instruction.
function msr_mask(/*CPUARMState * */ env, /* DisasContext * */ s, /* int */ flags, /* int */ spsr) { var /* uint32_t */ mask; mask = 0; if (flags & (1 << 0)) mask |= 0xff; if (flags & (1 << 1)) mask |= 0xff00; if (flags & (1 << 2)) mask |= 0xff0000; if (flags & (1 << 3))...
[ "function calculMSR(pPreMSR) {\n return 255 - pPreMSR;\n}", "setReg(bitmask, register) {\n register[0] |= bitmask;\n return 8;\n }", "get active_masks() {\n const masks = this.masks;\n return this.m.map(function(m) {\n return masks[m];\n }).filter(mask => mask != undefined);\n }", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
number of total conversations , with more than 2 request counters ( a person interacted with the bot ) and less than 2 hours between first interaction and the last one ( a person could leave the pc, come back later, loosing attention span )
async function getTotalCount(){ return dbConnection.collection(collection.log).aggregate( [ { $group : { _id : "$conversation_id", conversations: { $push: "$$ROOT" } } }, ...
[ "function GetCounterChats(ultime_msg, cback) {\n\n\t// Buscando amigo usuario implicado\n\tChatsList.findOne({'chat_content_id': ultime_msg.chat_room_id}, function (err, ChatItem) {\n\t\tif(err) {\n\t\t\treturn console.log('Error al encontrar chat Item: ' + err)\n\t\t}\n\n\t\tvar user_friend_id = ''\n\n\t\t// Obten...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update the suggested path based on the location of the mouse (x,y)
function updateSuggestedPath(x,y){ var closest = findClosestInSuggestedPath(x,y); //text1.content = closest; //check if the last point in the path is the closest to the pointer, or the path should be pruned if( closest != suggestedPathPoints.length - 1){ //prune the path to the closest ...
[ "function mouseDragged(){\n if(drawingState===1){\n point={\n x:mouseX,\n y:mouseY\n }\n\n }\n currentPath.push(point);\n\n \n}", "updatePath() {\n this.isPath = true;\n const eventName = \"node-\" + this.row + \"-\" + this.col + \"-path\";\n sendEv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copyright (c) 2014 Sam Leitch. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish...
function H264bsdCanvas(canvas, forceNoGL) { this.canvasElement = canvas; if (!forceNoGL) this.initContextGL(); if (this.contextGL) { this.initProgram(); this.initBuffers(); this.initTextures(); } }
[ "function YUVCanvas(parOptions) {\n \n parOptions = parOptions || {};\n \n this.canvasElement = parOptions.canvas || document.createElement(\"canvas\");\n this.contextOptions = parOptions.contextOptions;\n \n this.type = parOptions.type || \"yuv420\";\n \n this.customYUV444 = parOptions.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Drag end event handler. This is on the element which was in Drag start = HTMLTableRowElement e = DragEvent Sets global variables noDropZone and isBkmkItemDragged
function bkmkDragEndHandler (e) { // Signal we stopped dragging an internal item isBkmkItemDragged = false; isBkmkDragActive = false; refBkmkScrollLeft = refBkmkScrollTop = -1; //let target = e.target; //console.log("Drag end event: "+e.type+" target: "+target+" class: "+target.classList); dtSignature = unde...
[ "function DIF_enddrag(e) {\r\n\tDIF_dragging=false;\r\n//\tDIF_objectDragging.style.cursor=\"auto\";\r\n\tDIF_iframeBeingDragged=\"\";\r\n}", "function dragEnd (e) {\n self.draggy.position = self.position;\n classes(self.draggy.ele).remove('activeDrag');\n self.dispatchEvent(onDrop);\n d.remov...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a chatwindow div with all the chats appended to it as children (Used for initial chat loading)
function loadChat(chat_name) { var new_chat_window = document.createElement('div'); new_chat_window.setAttribute('id', 'chat-window'); var new_chat_log = chat_log[chat_name]; for (var i = 0; i < new_chat_log.length; i++) { var message_container = newMessage(new_chat_log[i][0], new_chat_log...
[ "buildChatArea() {\n\n this.chatAreaEle = document.createElement('div');\n document.body.appendChild(this.chatAreaEle);\n this.initializeChatArea();\n }", "function createChatDiv (state) {\n // Loop through all of our messages that we synced from Firebase\n // We then build an array of virtual-dom cha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: EnableDisableAddDelBtns DESCRIPTION: Enable/disables the elemAdd and elemDel buttons ARGUMENTS: None RETURNS: Nothing
function EnableDisableAddDelBtns() { // Check if there are any columns if (ColumnsToAdd.length == 0) { _ElemAdd.setAttribute("disabled", true); _ElemAdd.src = "../Shared/MM/Images/btnAdd_dis.gif"; } else { _ElemAdd.setAttribute("disabled", false); _ElemAdd.src = "../Shared/MM/Images/bt...
[ "function enable_add_buttons(){\n\t//We disable the buttons\n\t$(\".btn_row_field_add\").attr(\"disabled\", false);\n\t$(\"#groupe_add_btn\").attr(\"disabled\", false);\n}", "function enableButtons() {\n document.getElementById('addFive').disabled = false;\n document.getElementById('subFive').disabled = false;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provide a way to "uninstall" the app Here, we write a function called "cleanup" which gets executed when this script stops running. It'll remove the app button from the tablet.
function cleanup() { tablet.removeButton(button); }
[ "function cleanup() {\r\n print(\"deleting tablet app button.\");\r\n tablet.removeButton(button);\r\n }", "function cleanup() {\n tablet.removeButton(button);\n\t}", "function unloadApp() {\n if (typeof(window.currentapp) != \"undefined\") {\n var app = window.currentapp;\n delet...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement a ConnectionChangedListener It just pass a state from native library to UI component.
function ConnectionChagnedListener(state) { console.log("ConnectionChangedListener: " + state); if(state == 'connected') { // TODO: Trigger an event to the Device Component which named "ConnectionChangedListener" with 'onConnected' var evtObjs = $app.getTriggerObjects("onConnected"); for (var i = 0; i < ...
[ "registerConnectionStateChanged (callback) {\n return this.client.registerConnectionStateChanged(this, callback)\n }", "static onDeviceConnectionStatusChanged(res){\n DeviceEventEmitter.addListener('FabacusOnDeviceConnectionChanghed', (e) => {res(e)})\n\n\n }", "onChangeListener()\n {\n const ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to update phone input to International number
function updateIntlPhone(phoneProxyId, phoneId) { // listen to "keyup", but also "change" to update when the user selects a country var $phoneProxy = $('#' + phoneProxyId); $phoneProxy.on('keyup change', function () { var intlNumber = $phoneProxy.intlTelInput('getNumber'); if (intlNumber) { if (intlNum...
[ "function refreshPhoneFormat(input, numbers) {\n let phone = \"\";\n\n // Attach area code\n phone += '(' + numbers.substring(0, AREA_CODE_LEN);\n\n // Add remaining placeholder to value if complete\n if (numbers.length <= AREA_CODE_LEN) {\n phone += PHONE_FORMAT.substring(phone.length);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates objects of the players, always 1 Human first and 1 Dealer last
static createPlayers(amountOfBots) { this.players = [new Human('MrGarrison47', 1000)]; for (let i = 0; i < amountOfBots; i++) { this.players = [...this.players, new Bot()]; } this.players = [...this.players, new Dealer()]; }
[ "function _createPlayers() {\n for (let i in playerNames) {\n players[i] = Player(playerNames[i], playerSign[i]);\n }\n }", "init(clientName, opponentName) {\n\n this.players.push(new Player(clientName));\n this.players.push(new Player(opponentName));\n\n let clien...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function that updates completed passes + total passes Updates info, screen info, bars.
function updateIncompletePasses() { var totalIncPasses = 0; if(currTeam == 1) { T1.incompletePasses += 1; //Step 1: Update total passes updateTotalPasses(); //Step 2: Update shots on goal totalIncPasses = T1.incompletePasses + T2.incompletePasses; var t1_bar = Math.floor((T1.incompletePasses / total...
[ "function updateCompletedPasses()\n{\n\tvar totalComplPasses = 0;\n\n\tif(currTeam == 1) \n\t{\n\t\tT1.completedPasses += 1;\n\n\t\t//Step 1: Update total passes\n\t\tupdateTotalPasses();\n\n\t\t//Step 2: Update shots on goal\n\t\ttotalComplPasses = T1.completedPasses + T2.completedPasses;\n\n\t\tvar t1_bar = Math....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Execute func for each node of the notes tree
function forEachNode(func) { const depthLimit = 4; const nodesLimit = 50; const nodesCount = 0; executeForNode(notesTree.root, func); function executeForNode(node, func, currentDepth) { if (!currentDepth) currentDepth = 0; if (isRecursionLimitReached(currentDepth, nodesCount)) return; func(nod...
[ "forEachNode(fn) {\n const iter = root => {\n if (root) {\n fn(root)\n if (root.children) {\n for (let cmd in root.children) {\n iter(root.children[cmd])\n }\n }\n }\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
03 Convert Double Space to Single
function convertDoubleSpaceToSingle(str) { return str.replace(/ /g," "); }
[ "function convertDoubleSpaceToSingle(str) {\n return str.replace(/\\s+/g, ' ');\n}", "function convertDoubleSpaceToSingle(str) {\n var strArr = str.split(\" \");\n var output = strArr.join(\" \");\n return output;\n}", "function convertDoubleSpaceToSingle(str) {\n // your code here\n let singleSpace = st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
inform all other clients about my details: name, email, easyrtcid these additional info along with easyrtcid (which is available in 'all_occupants_list') are used for mapping (e.g. which easyrtcid is for which emails and so on)
function informMyDetailsToAllOtherClients(occupants){ var myInfo = {'email': $("#user_email").text(), 'easyrtcid': selfEasyrtcid, 'name': $("#user_name").text()}; //notify all other clients for email for corresponding easyrtcid notifyAll('inform_my_details_to_all_other_clients', myInfo); }
[ "function addNewClientToAllOccupantsDetails(newClientDetails){\n all_occupants_details.push(newClientDetails);\n}", "function getNameForAnEasyRTCid(easyrtcID) {\n for (var i = 0; i < all_occupants_details.length; i++) {\n if (all_occupants_details[i].easyrtcid == easyrtcID) return all_occupants_details[i]....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function read neww paper
function readNewspaper() { console.log(newspaper_page + 'の' + newspaper_page + 'ページを読みました。'); }
[ "static textToPaper(text)\r\n {\r\n util.checkIsType(text, \"string\", \"text\");\r\n\r\n let words = text.trim().split(\" \");\r\n let pName = \"\";\r\n \r\n if(words.length < 4)\r\n {\r\n throw new Error(\"Invalid text format\");\r\n }\r\n\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
extract a texture face and level into its own texture
function readCubemapPixels(texture, face, level) { const device = texture.device; const width = texture.width >> level; const height = texture.height >> level; const targetTexture = new pc.Texture(device, { width: width, height: height, mipmaps: false, format: pc.PIXELFO...
[ "getTextureMap() {\r\n\r\n const t00 = [0,0];\r\n const t01 = [0,1];\r\n const t10 = [1,0];\r\n const t11 = [1,1];\r\n\r\n const tface = [t00, t11, t01, t11, t00, t10];\r\n const face3 = tface.concat(tface).concat(tface);\r\n return face3.concat(face3);\r\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends a player a recruitment offer to join the Nemesis.
async recruit(channel, targetName) { let nemesis = await sql.getNemesis(channel); let player = await sql.getPlayerById(nemesis.id); let embed = new Discord.RichEmbed(); if(targetName) { let target = await sql.getPlayer(channel, targetName); // Send an offer embed.setTitle('HENCHMAN RECRUITMENT') ...
[ "async joinNemesis(player) {\n\t\tconst channel = player.channel;\n\t\tlet nemesis = await sql.getNemesis(channel);\n\t\tlet nemesisPlayer = await sql.getPlayerById(nemesis.id);\n\t\tlet underlings = await sql.getUnderlings(channel);\n\t\tlet world = await sql.getWorld(channel);\n\t\t\n\t\tawait this.completeTraini...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns possible symptoms for a given sublocation. Parameters: subloc_id ID of a body sublocation status "man", "woman", "boy", "girl". Child becomes Adult at 12.
show_symptoms_in_sublocation(subloc_id, status, div_id) { var data = {"language": this.lang, "format": "json"}; axios.get(this.url + "symptoms/" + subloc_id.toString() + "/" + status, {headers: this.headers, params: data}) .then(response => { display_data(resp...
[ "function _addBodySublocation(sublocation, locationId) {\n if (_isValidSublocation(sublocation.ID) == false)\n return;\n\n var sublocationListElement = jQuery(\"<li/>\", {\n \"id\": \"sublocation_\" + sublocation.ID,\n \"class\": \"sublocation locat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Declare function "buildCommandName" to perform actions in order to gurantee the structural integrity of our embed when processing various commands.
function buildCommandName(bot, command) { //Deconstruct our "name" and "commandPrefix" variables from our "command.info" and "bot.settings" objects. const {name} = command.info; const {commandPrefix} = bot.settings; //Build array from the keys of bot.commands, essentially we retrieve each name of our co...
[ "changeCommandName(name) {}", "getFullCommandName() {\n return `${this.getPrefix()}${this.getCommandName()}`\n }", "get commandName() {}", "buildCommand(name) {\n return new CommandBuilder({\n listener: description => {\n if (this.#commands_.has(description.commandName...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the master function, which takes in a transformation function, inital and final parameters to transform about, and the inital points of the cube
function master(transformation, initalparam, finalparam,xinit1,yinit1,zinit1){ t = numeric.linspace(initalparam,finalparam ,10); //The linspace to generate the intermediate points frames = [] for (var i = 0 ; i < t.length ; i++) { //This loops through the linspace xrot1 = [] yrot1 = [] ...
[ "function transformCube(xPosition, yPosition, zPosition)\n{\n // Move the cubes to the correct x and z axis positions\n modelTransformMatrix = translate(xPosition, yPosition, zPosition);\n gl.uniformMatrix4fv(modelTransformMatrixLoc, false, flatten(modelTransformMatrix));\n}", "function projectionSpaceTr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This functie is called when an artikel is selected in the list
function artSelect(art){ //highlight the selected list element if (selectedArt != null) { selectedArt.className = null; } selectedArt = art; selectedArt.className = "selected"; //perform an Ajax request string = art.innerHTML; art = string.trim().substring(1).split(" - "); updateFieldsArtikel(ajax("mode=g...
[ "function artSelect(art){\n\t//highlight the selected list element\n\t\n\t\n\t//perform an Ajax request\n\t\n\n}", "function on_selection_changed() { }", "function listTypeSelected(e) {\n\n getMovieList(e.sender.selectedIndex);\n }", "function FGDepartList_SelectionChanged(sender, args) {\n SetDe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback gets JSON via $http get request and returns it in return object. Then sets it in flight object as resultsData
function getFlights(callback) { $http.get('http://ejtestbed.herokuapp.com/flights') .then(function(response) { return callback(response.data); }) .catch(function(error) { console.log("Couldn't get JSON"); }); }
[ "function getResults() {\n var content_url = refstackApiUrl + '/results/' + ctrl.testId;\n ctrl.resultsRequest =\n $http.get(content_url).success(function (data) {\n ctrl.resultsData = data;\n ctrl.version = ctrl.resultsData.meta.guideline;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Formate the ticket number with range properities
function prepareDisplayTicketNumber(transaction, PriorityRangeMaxNo, Separator) { try { let FormattedTicketNumber = ""; let displayTicketNumber = ""; let displayticketSymbol = ""; let pad = ""; if (PriorityRangeMaxNo > 999) { pad = "0000"; } else ...
[ "toRangeString() {\n return `${this.getFirst()}-${this.getLast()}`;\n }", "static getFormattedRangeDisplayText(_range) {\n if (_range >= 10) {\n return _range.toFixed(0);\n }\n\n let decimals = 0;\n if (_range < 1) {\n decimals = 1;\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use the form input to filter the data by blood type
function bloodtype(record){ return record.bloodType.toLowerCase() == inputValue; }
[ "function filterPatients(patients) {\n return patients.bloodType == inputValue;\n }", "function chechBloodType() {\r\n\tlet validBloodTypes = [];\r\n\tlet options = document.getElementById(\"blood_types\").options;\r\n\tfor (let i = 0; i < options.length; i++) {\r\n\t\tlet current = options[i].value;\r\n\t\tv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempt to bind one single element from specification.
function bindElement(spec, el, modelcule, bindings) { // Eval binding string as JS var functionBody = compile(spec); if (!functionBody) { return true; } try { var elBindingsFn = new Function(functionBody); var el...
[ "function bindElem(elem) {\r\n var attrs, key, linked;\r\n attrs = attr(elem);\r\n key = attrs(opts.selectorPrefix);\r\n linked = attrs(opts.selectorPrefix + '-linked');\r\n if (key) {\r\n // if we dont have an id set already\r\n // we set one here so that we dont step\r\n // on any ot...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scale the frequencies to be in the range 20120 (font size), but keep proportions. Values are chosen after trying different weight ranges, so they are hardcoded.
function reWeigh(words) { // It can be the case that list is empty (no countries checked). if (words.length == 0) { return words; } var highest_freq = words[0].weight; var lowest_freq = words[words.length - 1].weight; var interval = highest_freq - lowest_freq; for (var i = 0; i < wor...
[ "function changeFontWeight () {\r\n //Increment the counter (or restart at 1)\r\n counterWeight += 1;\r\n //Current weight array index number is equal to counter.\r\n let currentWeight = counterWeight % weightCount;\r\n //The next font weight is the font weight at array index is e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getIgnoreKeywords_allNumberWordthlys() Get the "numberwordthly" list of ignore words. For example: firstly, secondly, thirdly, etc..
function getIgnoreKeywords_allNumberWordthlys() { var allnumberwordths = getIgnoreKeywords_allNumberWordths(); var allnumberwordthlies = []; for(var i = 0; i < allnumberwordths.length; i++) { var numberwordth = allnumberwordths[i]; allnumberwordthlies.push(numberwordth + 'ly'); } return all...
[ "function getIgnoreKeywords_allNumberWords() {\n\t\tvar allnumberwords = [];\n\t\t\n\t\tvar onehundred = [];\n\t\tonehundred = onehundred.concat(getIgnoreKeywords_allNumberWords_firstDigit());\n\t\tonehundred = onehundred.concat(getIgnoreKeywords_allNumberWords_upToTwenty());\n\t\tonehundred = onehundred.concat(get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check that string theField.value is a valid Year. For explanation of optional argument emptyOK, see comments of function isInteger.
function checkYear (theField, emptyOK) { if (checkYear.arguments.length == 1) emptyOK = defaultEmptyOK; if ((emptyOK == true) && (isEmpty(theField.value))) return true; if (!isYear(theField.value, false)) return warnInvalid (theField, iYear); else return true; }
[ "function checkYear (theField, emptyOK)\r\n{ if (checkYear.arguments.length == 1) emptyOK = defaultEmptyOK;\r\n if ((emptyOK == true) && (isEmpty(theField.value))) return true;\r\n if (!isYear(theField.value, false))\r\n return warnInvalid (theField, iYear);\r\n else return true;\r\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retain (~reference) a user data object when an instrumentation is added. If a ``NativePointer`` is given, it will be used as raw user data and the object will not be retained.
_retainUserData(data, fn) { var dataPtr = ptr("0"); var managed = false; if (data !== null && data !== undefined) { this.#userDataPointer += 1; dataPtr = dataPtr.add(this.#userDataPointer); managed = true; } var iid = fn(dataPtr); if (m...
[ "setUserData(data) {\n this.userData = data;\n }", "_releaseAllUserData() {\n this.#userDataPtrMap = {};\n this.#userDataIIdMap = {};\n this.#userDataPointer = 0;\n }", "SetUserData(data) {\n this.m_userData = data;\n }", "_getUserData(dataPt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UploadFile inherits Tag UploadFile does the following: Arbitrary settings: item.type < automatically assigned item.id < automatically assigned item.needQuestion < False
function UploadFile(parent_id, item = {}) { item.type = "file"; item.id = item.id || "{0}_{1}".format(item.type, __INPUT_FILE++); Tag.call(this, parent_id, item); this.label_id = "label_{0}".format(this.id); this.fileType = item.fileType || "Upload a file from here"; if (!this.needQuestion && t...
[ "function testUploadItem() {\n var el = upload.container;\n\n assertEquals(String(goog.dom.TagName.DIV), el.tagName);\n var desc = goog.dom.getFirstElementChild(el);\n assertEquals(CAPTION, goog.dom.getTextContent(desc));\n var fileTypeDesc = goog.dom.getNextElementSibling(desc);\n assertEquals(String(goog.do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }