query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
arr[0]=aa.value; arr[1]=bb.value; arr[2]=cc.value; arr[3]=dd.value; /console.log(arr); var n=arr.includes("kaviya"); console.log(n); let table=document.getElementById("hai"); let row=table.insertRow(i++); let col1=row.insertCell(0); let col2=row.insertCell(1); let col3=row.insertCell(2); let col4=row.insertCell(3); col...
function loop() { document.getElementById('mytable').style.visibility='visible'; let rows=''; arr.forEach(obj=> { const tr=`<tr> <td>${obj.a1}</td> <td>${obj.a2}</td> <td>${obj.a3}</td> <td>${obj.a4}</td> </tr>`; rows+=tr; }); document.getElementById("hai").innerHTML=row...
[ "function createTable()\n{\nrowNo = window.prompt(\"Enter the number of rows\", 1);\ncolumnNo = window.prompt(\"Enter the number of columns\",1);\n \n for(let i=0;i<parseInt(rowNo,10);i++)\n {\n var x=document.getElementById('customTable').insertRow(i);\n for(let j=0;j<parseInt(columnNo,10);j++) \n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Plugins Mock API used by app
function Plugins() { /** * Mocked {Plugins#load}. */ this.load = function(done) { done(); }; /** * Mocked {Plugins#getAll}. */ this.getAll = function() { return []; }; /** * Mocked {Plugins#get}. */ this.get = function(type) { return []; }; }
[ "function generateMockPlugin() {\n\n function deferredResponse(callback, data) {\n\n $log.info(\"*** USING MOCK \" + PLUGIN_NAME.toUpperCase() + \" PLUGIN: Set USE_MOCK_PLUGIN to false in inboxOutbox.fct.js if you expect to use the real plugin ***\");\n\n var FAKE_DELAY = 50...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============= GATHER INPUTS =============
function gatherInputs() { // Nothing to do here! // The event handlers do everything we need for now. }
[ "function gatherInputs() {}", "function gatherInputs() {\n}", "function gatherInputs() {\n\n}", "function gatherInputs() {\n // Nothing to do here!\n // The event handlers do everything we need for now.\n}", "function gatherInputs() {\n // Nothing to do here!\n // The event handlers do everything we...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Activate the switcher (go to the next card).
activate_() { getCardSlider().selectCard(this.nextCardIndex_(), true); }
[ "function activateSwitch(player, switch1) {\n switchDown = false;\n arrow.setVisible(true);\n arrow.anims.play('arrowUp', true);\n}", "function nextCard(){\n if(lastCard()){\n if(window.confirm(\"Start Over\")){\n setStudy({\n ...study,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function docPos(event) returns the position in the document of a mouse event.
function docPos(event) { var posx = 0; var posy = 0; if (!event) return; if (event.pageX || event.pageY) { posx = event.pageX; posy = event.pageY; } else if (event.clientX || event.clientY) { posx = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; posy = event.clientY +...
[ "function _eventDocPos(e){\n\tvar p = {};\n\t/*if(ge.isOpera){\n\t\tp.x = e.clientX + document.body.scrollLeft;\n\t\tp.y = e.clientY + document.body.scrollTop;\n\t}else */\n\tif(ge.isIE){\n\t\tif(ge.isIE < 8){// if(e.x){\n\t\t\tp.x = e.x + document.body.scrollLeft + document.documentElement.scrollLeft;\n\t\t\tp.y =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update list after sync catalog rule price
updateListAfterSyncCatalogRulePrice(catalogrule_prices = []) { if (catalogrule_prices && catalogrule_prices.length) { let items = ProductListService.prepareItemsToUpdateListAfterSyncCatalogRulePrice( catalogrule_prices, this.state.items ); if (items !== false)...
[ "updateListAfterSyncDeletedCatalogRulePrice(ids = []) {\n if (ids && ids.length) {\n let items = ProductListService.prepareItemsToUpdateListAfterSyncDeletedCatalogRulePrice(\n ids, this.state.items\n );\n if (items !== false) {\n this.addItems(it...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle change of the appropriate time value (Sesion/Break/Long Break) on click at +/ element
changeTimeValue(e, timeValue) { if (e.target.textContent === '+') { timer[timeValue]++; ui.updateUiElement(ui[timeValue], timer[timeValue]) console.log(timer[timeValue]); } else { timer[timeValue]--; if (timer[timeValue] < 1) { timer[timeValue] = 1; ...
[ "function updateBreak() {\n // on clicking the break-minus button\n $(\"#break-minus\").click(function() {\n if(break_time === 0) console.log(\"break_time is already 0\");\n else {\n break_time--;\n $(\"#break-time\").html(break_time);\n }\n });\n\n // on clicking the break-plus button\n $(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Internal: Synchronously run each test case one after the other, outputting on the console if the test case passes or fails. Also resets the app after each test case by changing the component key to force React to rerender the entire component tree.
async run() { if (this.startDelay) { await this.pause(this.startDelay); } const start = new Date(); console.log(`Cavy test suite started at ${start}.`); for (let i = 0; i < this.testCases.length; i++) { let {description, f} = this.testCases[i]; try { await f.call(this...
[ "async function runTests () {\n try {\n // Cleanup old data and prepare for a new run of tests.\n utils.clearUutDir()\n utils.clearLogs()\n utils.log(`Prepared bch-stack-monitor for new run.`)\n\n // Initialize the logs.\n const startTime = new Date()\n await utils.logAll(`bch-stack-monitor te...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SUPPORTING FUNCTIONS This function returns an object with the roles of a certain user with a given id The array contains the id, the name and description of the roles
function getUserRoles(id){ return RoleMapping.find({where:{principalId:id}}) .then(function(roleMappings){ var roleIds=_.uniq(roleMappings.map(function(roleMapping){ return roleMapping.roleId; })); var conditions=roleIds.map(function(roleId){ return {id:roleId}; }); return Role.find({where:{o...
[ "static listUserRoles(id) {\n\t\treturn RestService.get(`api/users/${id}/roles`);\n\t}", "getRolesByUserId(request = {}) {\n let url = \"/web/userroles/roles/\" + request.userId;\n return restApi.doGetRequest(url)\n }", "findRolebyId(roleId) {\n return this.connection.promise().query(\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getting the starting possitions of the touch event
function touchStartHandler(event){ var e = event.originalEvent; if(isReallyTouch(e)){ var touchEvents = getEventsPage(e); touchStartY = touchEvents.y; touchStartX = touchEvents.x; } }
[ "function touchStartHandler(event){\n var e = event.originalEvent;\n\n if(isReallyTouch(e)){\n var touchEvents = getEventsPage(e);\n touchStartY = touchEvents['y'];\n touchStartX = touchEvents['x'];\n }\n }", "function beginTouch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
change the survey mode from developing to production
function change_mode() { var msg = "\nYou are about to change the survey mode from development to production.\n" + "Are you sure to continue this operation?\n"; var url = "dev2prod?s=" + sid; if (confirm(msg)) location.replace(url); else return; }
[ "isProduction() {\n return environment.BUILDTYPE === ENVIRONMENTS.VAGOVPROD;\n }", "function isProduction() {\n return ENVIRONMENT == 'production';\n}", "checkProductionMode() {\n if (this._installConfig.production) {\n if (this.production) {\n // user still want production mode, do nothing\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to bootstrap the game. Create the canvas Wire up event listeners for up and down arrow keys Request animation frame to update and draw the paddles and ball
function main() { /* create canvas and get the context */ canvas = document.createElement('canvas'); canvas.width = WIDTH; canvas.height = HEIGHT; ctx = canvas.getContext('2d'); document.body.appendChild(canvas); /* set up event listeners for up and down arrow keys */ keystate = {}; ...
[ "function setup() {\n////////////////////////////////////////////////////// FIX\n// typo with crateCanvas, supposed to write createCanvas\n createCanvas(640,480);\n noStroke();\n // Create a ball\n/////////////////////////////////////////////////////// FIX\n// lower velocity of the ball\n ball = new Ball(width/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3.2 WebVTT metadata header syntax
function parseHeader(input) { parseOptions(input, function (k, v) { switch (k) { case "Region": // 3.3 WebVTT region metadata header syntax parseRegion(v); break; } }, /:/); }
[ "function parseHeader(input) {\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"Region\":\n // 3.3 WebVTT region metadata header syntax\n parseRegion(v);\n break;\n }\n }, /:/);\n }", "function parseID3v1Metadata(footer) {\n var title ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UPDATE property by ID
function update(id, property) { return db("property") .where("id", "=", id) .update(property); }
[ "update(id, property) {\n\t\tthrow new Error(\"Not yet implemented\");\n\t}", "function update_property(row_id){\n create_property_list(row_id, from='update');\n}", "function update(id, params, callback) {\n core.api('PUT', '/properties/' + id, params, callback);\n }", "function update_property_row(row...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Goes from the back of the string and returns the first nonwhitespace character that is found. If an escape character is found with newline characters, the escape character will not be considered a nonwhitespace character and its index in the string will not be returned.
findTrailingNonWhitespace(content) { // loop back to find the first non-whitespace character let index = content.length; whitespaceCheck: for (let i = content.length - 1; i >= 0; i--) { switch (content.charAt(i)) { case ' ': case '\t': ...
[ "function string_indexOfUnescapedChar(text, findChar, bx )\n{\n let ix = bx || 0 ; // start of search.\n let foundIx = -1 ; // find result. init to not found.\n while (ix < text.length)\n {\n const ch1 = text[ix];\n\n // current char escapes the next char. advance past next char. \n if (ch1 == '\\\\'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make sure gapY correctly correspond to gapYRatio
gapY(length, ratio) { const solver = this.solver; const state = this.plotSegment.state; const props = this.plotSegment.object.properties; const attrs = state.attributes; const [gapY, y1, y2] = solver.attrs(attrs, [ "gapY", this.y1Name, this.y2N...
[ "function adjustToY() {\n\t\t\t\tnewHeight = startHeight - moveDiffY;\n\t\t\t\tnewWidth = Math.round( newHeight * ratio );\n\t\t\t}", "function ySpacingCalc(spaceHeight, vidHeight, numberY) {\n var fringeLeftover = spaceHeight - vidHeight*numberY;\n return (fringeLeftover / numberY);\n}", "#adjustValue(dy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide empty section if the container where the card was before the click is empty, hide it
function hideEmptySection() { if (!otherContainer.hasChildNodes()) { otherContainer.parentNode.style.display = 'none'; } else { container.parentNode.style.display = 'block'; } }
[ "function hideEmptyContainer() {\n $('.empty-container').hide();\n }", "function hideCard() {\n $(\"#no-article-card\").hide();\n }", "function showCard() {\n $(\"#no-article-card\").show();\n }", "function click() {\n const contenedorCarta = document.querySelector('#contenedorCarta')\n contened...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
user has select a call rating
function set_call_rating(e) { if (!e) var e = window.event; //-- ie var tmpEle = getEventSourceElement(e); if(tmpEle) { //-- user selected radio option //-- get row from original selected rating <p> var aRow = get_parent_owner_by_tag(currentCratingP,"TR"); if(aRow) { varKey= aRow.getAttribut...
[ "function rate(rating) {\n let current = JSON.parse(getLocal(profilecount));\n rating === 'like' ? current.liked = 1 : current.liked = -1;\n setLocal(profilecount, JSON.stringify(current));\n profilecount++;\n setLocal('profilecount',profilecount);\n checkClick();\n}", "function tmm_star_rating(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AJAX loading of submissions for each student
function loadSubmissions() { // Do something when all the AJAX calls are done? var ajaxCalls = 0; function ajaxDone() { ++ajaxCalls; } for (semester of window.CST.semesters) { // 10.02.2019 tps Top level loop is semesters for (term of semester.term_courses) { // for (term of window.CST.terms) ...
[ "function loadSubmissions() {\n\n function ajaxDone() {\n // There's just one ajax call when the page loads \n }\n\n // alert('Found ' + window.terms.length + ' terms for this faculty member.');\n for (term of window.CST.terms) {\n for (student of term.students) {\n getSubmissionsByStudent(term.cour...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1) Find sections, addClass and create anchor for each
findSACA(i, footer){ // Search sections var finder = $('body').find('section'); var a = 1; if (i >= a) { for (var find of finder) { // Add class for each section if (i >= a) { $(find).addCla...
[ "function addActiveClass(){\n for(const section of sections){\n if(checkCurrentPosition(section)){\n section.classList.add('your-active-class');\n const anchor = document.querySelector(`a[href=\"#${section.id}\"]`);\n console.log('an...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Launcher, o + simultaneously to open .
function launch(from, ...args) { return [ { from: { simultaneous: [ { key_code: colemak('o'), // mnemonic: "[o]pen") }, { key_code: from, }, ], simultaneous_options: { key_down_order: 'strict', key_up...
[ "function launch() {}", "function open (args, mus, done) {\n var folder = mus.search.getFolderByNum(args[0])\n\n mus.server.start(function () {\n var url = mus.server.url + folder.path.substring(2)\n console.log('OPEN', url)\n exec('open \"' + url + '\"', function () {\n })\n done()\n })\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts dBm to quality
function signalQualityToPernect (dBm) { var quality; if (dBm <= -100){ quality = 0; } else if (dBm >= -50){ quality = 100; } else { quality = 2 * (dBm + 100); } quality = parseFloat((quality / 100).toFixed(2)); return quality; }
[ "function percTodBm(quality) {\n const max = -30;\n const min = -90;\n return (max - min) * (quality/100) + min;\n // Alternative quality to dBm conversion\n // var dBm = (quality / 2) - 100;\n}", "set quality(value) {}", "function convertToMbps(value) {\n return value / 125000;\n}", "function bpm_to_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends information for a new book to server to be stored in JSON file
function storeBook(title, author, photoURL, subject, vendorURL, favorite) { var req = new XMLHttpRequest(); req.open('POST', '/'); req.setRequestHeader('Content-Type', 'application/json'); req.addEventListener('load', function (event) { if (event.target.status !== 200) { var me...
[ "async addBook () {\r\n await this.webServices.sendRequest(\r\n '/api/books/save',\r\n { _id : this.newTitle, description : this.newDescription }\r\n );\r\n await this.loadBooks();\r\n }", "function acceptBookInfo() {\n // today's date for the timestamp\n const today = new Date(Date.now(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change src's size to newParam, size may be smaller (will crop the src) The pointer of src won't change if is toCopy, only copy part contained within a viewport size
resizeImageData(src,newParam,toCopy) { if(src.width==newParam.width&&src.height==newParam.height) { if(toCopy){ if(src.left==newParam.left&&src.top==newParam.top){ // No need to change return; } } else{ // simply move src.left=newParam.left; src.top=newParam.top; src.validArea={ // c...
[ "function resize(src, dst, width, height, callback) {\n\tconsole.log(\"src: \" + src);\n\tconsole.log(\"dst: \" + dst);\n\tlet dim = width + 'x' + height;\n\tconsole.log(\"dim: \" + dim);\n\n\tconst { exec } = require(\"child_process\");\n\texec(path.join(__dirname, 'aspectcrop.sh') + \" -a 4:3 \" + src + \" \" + d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::Serverless::Function.IdentitySAMPT` resource
function cfnFunctionIdentitySAMPTPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnFunction_IdentitySAMPTPropertyValidator(properties).assertSuccess(); return { IdentityName: cdk.stringToCloudFormation(properties.identityName), }; }
[ "function cfnFunctionFunctionSAMPTPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnFunction_FunctionSAMPTPropertyValidator(properties).assertSuccess();\n return {\n FunctionName: cdk.stringToCloudFormation(properties.functionName),\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the style due to the valid state
_getValidStyle() { if(this.props.invalid) { if(this.props.invalid.value === undefined || this.props.invalid.value === null) { throw new Error('invalid prop should have a value property'); } var invalid = this.props.invalid.value; if(invalid) { ...
[ "_getValidStyle() {\n if(this.props.invalid) {\n if(this.props.invalid.value === undefined || this.props.invalid.value === null) {\n throw new Error('invalid prop should have a value property');\n }\n if(this.props.invalid.value && (this.props.feedback === true...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use applescript to save image from clipboard and get file path
static saveClipboardImageToFileAndGetPath(imagePath) { return __awaiter(this, void 0, void 0, function* () { if (!imagePath) return; const script = { win32: "win32_save_clipboard_png.ps1", darwin: "mac.applescript", linux: "...
[ "function saveClipboardImageToFileAndGetPath(imagePath, callback) {\n\tif (!imagePath) return;\n\n\tlet platform = process.platform;\n\tif (platform === \"win32\") {\n\t\t// Windows\n\t\tconst scriptPath = path.join(__dirname, \"../res/pc.ps1\");\n\n\t\tlet command =\n\t\t\t\"C:\\\\Windows\\\\System32\\\\WindowsPow...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exits the new book form.
function exitNewBookForm() { form.reset() form.style.visibility = 'hidden' }
[ "function exitEditBookForm() {\n editForm.reset()\n editForm.style.visibility = 'hidden'\n allowPointerEvents()\n}", "function closeForm() {\r\n document.getElementById(\"book-form\").style.display = \"none\";\r\n}", "function exitFromTheForm(){\n removeChoosedFromAllCustomCard();\n choosedRoomI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
allows for extending another trick
function extendTrick(trickProps, mixins) { /* this = some trick function */ // the class we inherit from directly is the first item in the array var newClass = trick(trickProps, true); classExtender(newClass, this); // mixin the other extendees if(typeof mixins !== 'undefined') for(var i = 0; i < mixins.length...
[ "function applyTrickProps(newTrick, trickProps) {\n\n\tif(typeof trickProps === 'undefined')\n\t\treturn newTrick;\n\n\t// rip out defaults\n\tif(typeof trickProps.defaults !== 'undefined') {\n\t\tvar defaults = trickProps.defaults;\n\t\tdelete trickProps.defaults;\n\t}\n\n\t// if newTrick already has private varia...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Author: [M.C] Name: _initialiseAppBarLabel Description: initialise app bar globalisation Params: no one Return: no one
function _initialiseAppBarLabel() { listenAgain.winControl.label = WinJS.Resources.getString("bottomAppBar_listenAgain").value; skip.winControl.label = WinJS.Resources.getString("bottomAppBar_skip").value; }
[ "function _initialiseAppBarLabel() {\n cmdDelete.winControl.label = WinJS.Resources.getString(\"bottomAppBar_delete\").value;\n cmdModify.winControl.label = WinJS.Resources.getString(\"bottomAppBar_modify\").value;\n cmdNewDashboard.winControl.label = WinJS.Resources.getString(\"bottomAppBar_ne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to create random spatial bounds
function randomLatLngBounds() { var lat1 = randomLat(); var lat2 = randomLat(); var lng1 = randomLng(); var lng2 = randomLng(); return new leaflet_1.LatLngBounds(new leaflet_1.LatLng(lat1 < lat2 ? lat1 : lat2, lng1 < lng2 ? lng1 : lng2), new leaflet_1.LatLng(lat1 < lat2 ? lat2 : lat1, lng1 < lng2 ? ...
[ "generateRandomPoints(number, boundingBox){\n let sites = [];\n for(let i = 0; i < number; i++){\n let randX = getRandomInt(0, boundingBox.xr);\n let randY = getRandomInt(0, boundingBox.yb);\n let site = {\n x: randX,\n y: randY\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts the input time and date in MSDOS format into a JavaScript Date object.
function msdos2date(time, date) { // MS-DOS Date // |0 0 0 0 0|0 0 0 0|0 0 0 0 0 0 0 // D (1-31) M (1-23) Y (from 1980) var day = date & 0x1F; // JS date is 0-indexed, DOS is 1-indexed. var month = ((date >> 5) & 0xF) - 1; var year = (date >> 9) + 1980; // MS DOS Time // |0 0 ...
[ "function msdos2date(time, date) {\n\t // MS-DOS Date\n\t // |0 0 0 0 0|0 0 0 0|0 0 0 0 0 0 0\n\t // D (1-31) M (1-23) Y (from 1980)\n\t var day = date & 0x1F;\n\t // JS date is 0-indexed, DOS is 1-indexed.\n\t var month = ((date >> 5) & 0xF) - 1;\n\t var year = (date >> 9) + 1980;\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set icons to view with matching customType View must be visible or pending
setCustomIcons(customType, icons) { const view = this._getCustomView(customType); if (view !== null) { view.setIcons(icons); return true; } return false; }
[ "set type(type) {\r\n this.setIcon(type);\r\n }", "function shouldShowIcon(t) {\r\n return trackTypesVisible.includes(t[\"tracktype\"]);\r\n}", "_setupIcons() {\n const customIcons = getWithDefault(this, 'customIcons', {});\n var newIcons = smartExtend(customIcons, defaultIcons);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates BALANCE data by CATEGORY by for'ing through each account and matching the account.subtype to a category then adding its available balance to the appropriate entry in the running category total array.
function createCategoryBalanceData(userData){ //['Checking','Savings','Investments','Credit'] return new Promise(function(resolve, reject) { var categoryData = [0,0,0,0]; for (var institution = 0; institution < userData.length; institution++) { if(userData[institution].error_code){ ...
[ "function getBalanceByCategoryInPeriod (transactions, category, start, end) {\n var totalAmount = 0;\n //Returns matched elements of transactions array filtered by category key\n var transactionListByCategory = _.filter(transactions, ['category', category]);\n \n //Traverse through each element of the array tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
kLog 4 (Panel ID: TER19260034) raw range: 700 to 650
function kLog4 (kRaw) { var kLogConverted4; if (kRaw <= 0 || kRaw >= 3300) { kLogConverted4 = null; } else if (kRaw > 770) { kLogConverted4 = 0.0001; } else if (kRaw < 710) { kLogConverted4 = 0.01; } else { kLogConverted4 = (Math.pow(10, ((kRaw-682.24)/-22.30))/1...
[ "function kLog2 (kRaw) {\n var kLogConverted2;\n \n if (kRaw <= 0 || kRaw >= 3300) {\n kLogConverted2 = null;\n } else if (kRaw > 1270) {\n kLogConverted2 = 0.0001;\n } else if (kRaw < 1200) {\n kLogConverted2 = 0.01;\n } else {\n kLogConverted2 = (Math.pow(10, ((kRaw-1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set available map types
function mapTypes(map, isMainMap) { const PROVIDERS = { GOOGLE: "google", KARTVERKET: "kartverket", }; const types = [ {provider: PROVIDERS.GOOGLE, id: "roadmap"}, {provider: PROVIDERS.GOOGLE, id: "terrain"}, {provider: PROVIDERS.GOOGL...
[ "set typeMap(val)\n {\n this._typeMap = val;\n }", "function addMaptypes(map) {\n\t\t// OSM map, see more here: http://openstreetmap.ru\n\t\tmap.mapTypes.set('OSM', new google.maps.ImageMapType(\n\t\t{\n\t\t\tgetTileUrl: function(coord, zoom) {\n\t\t\t\tvar tilesPerGlobe = 1 << zoom;\n\t\t\t\tvar x =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create invisible input for form.
function createInvisibleInputDiv(invisibleInputObj){ // Exceptions var func = arguments.callee.toString().match(/function ([^\(]+)/)[1]; if (typeof invisibleInputObj!='object' || invisibleInputObj['objClass']!='Input'){ throw `${func}: invisibleInputObj must be an input o...
[ "_hideRealInput() {\n\t\t// hide the base input\n\t\tthis.style.position = 'absolute';\n\t\tthis.style.left = '-4000px';\n\t\tthis.style.opacity = 0;\n\t}", "function createHiddenInputElement() {\n const form = document.getElementById(\"single-conversation-topic-form\");\n console.log(form);\n const conversati...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given the server has requested character details, we can safely assume we're missing them/have never set them
handleRequestCharacterDetails() { // Almost guaranteed this is a data validation issue, missing player/character data. this.viewController.pageController.handleCharacterDetailsMissing(); }
[ "_prepareCharacterData(actorData) {\n\t\tif (actorData.type !== 'character') return;\n\t\tconst data = actorData.data;\n\t}", "function badCharacterDeviceControlOne(context) {\n const charCode = 17;\n return {\n character({ chr, i }) {\n if (chr.charCodeAt(0) === charCode) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw a stacked column bar chart.
function SVGStackedColumnChart() { }
[ "function stackedBarChart(selector, userSettings) {\n var labelText;\n var element = d3.select(selector)[0][0];\n\n var settings = Object.assign(\n { width: element.clientWidth, height: element.clientHeight },\n chartDefaults,\n userSettings\n );\n\n var innerHeight =\n settings.h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::KafkaConnect::Connector.FirehoseLogDelivery` resource
function cfnConnectorFirehoseLogDeliveryPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnConnector_FirehoseLogDeliveryPropertyValidator(properties).assertSuccess(); return { DeliveryStream: cdk.stringToCloudFormation(properties.deliveryStr...
[ "function cfnConnectorCloudWatchLogsLogDeliveryPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnConnector_CloudWatchLogsLogDeliveryPropertyValidator(properties).assertSuccess();\n return {\n Enabled: cdk.booleanToCloudFormation(prope...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all animation groups of this avatar. Applies fixes first, if any.
getAnimationGroups(animationGroups = this.character.animationGroups) { if (!this.animationGroups) { var loopAnimations = true; if ( this.fixes && typeof this.fixes.loopAnimations !== 'undefined' ) { loopAnimations = this.fixes.loopAnimations; } if ( this.fixes && this.fixes.animation...
[ "static createAllAnimations() {\n return [\n this.artboardAnimation(),\n this.plusiconAnimation0(),\n this.plusiconAnimation1(),\n this.plusiconAnimation2(),\n this.plusiconAnimation3(),\n this.plusiconAnimation4(),\n this.redlayerA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handle a get request at '/archive' endpoint.
function getArchive(request, response){ var findTimeLineYears = function getTimelineYears(entry) { return new Promise((resolve, reject) => { Archive.findYears((err, data) => { if (err) { if (err.kind === "not_found") { reject(`Not found...
[ "function analyseArchiveHandler(req, res){\n console.log(\"I got\",req.url);\n var myDateRegEx = /([0-9]{4})-([0-1]{0,1}[0-9]{1})-([0-3]{0,1}[0-9]{1})/;\n // The expression is quite bad bit it is better than nothing\n try {\n parameterCheck(req);\n //Parameter check done\n\n getDBConnection(req.query, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If orders may contain both adds and removes, this method will handle all in one go instead of using addOrders / removeOrders separately. The benefit is not having to recalculate wall levels twice. Note: For performance reasons this method assumes the input object may be mutated at will. Clone it before if you need to.
processOrders (orders) { orders = [].concat(orders) // Ensure array orders.forEach((order) => { const isAdd = this.isAddCheck(order); if (isAdd) { this.addOrder(order); } else { this.removeOrder(order); } }) this.notifyUpdates() }
[ "function normalizeOrders(orders) {\n if (typeof orders == 'undefined') return { bids: [], asks: [] };\n return ['bids', 'asks'].reduce((out, side) => {\n out[side] = orders[side].map(o => {\n return new Order(o, side);\n });\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Looking up means returning an inmemory representation that can be modified and may be enriched with values like a Player holding a reference to its socket or Game. This is achieved by: 1) reading from the "DB", enriching into an inmemory model, and caching the inmemory model. 2) writing to the cached inmemory model, an...
function fetchGame(gameId) { if (gameId in MemStore.games) { // Fetch from cache. return MemStore.games[gameId]; } if (gameId in Data.games) { // Fetch from DB, enrich to a modifiable version, then cache. const gameRecord = Data.games[gameId]; const game = new Game(gameRecord); MemStore.games[gameId] = ...
[ "async getObject() {\n let source;\n\n // try to get from memory store\n let attributes = await this.getFromMemoryStore();\n\n if (attributes) {\n // cache found in memory\n source = 'memory';\n } else {\n // no cache in memory store\n // try to get from firestore\n attribute...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new `EmptyIterator`.
function EmptyIterator() { if (!(this instanceof EmptyIterator)) return new EmptyIterator(); AsyncIterator.call(this); this._changeState(ENDED, true); }
[ "function empty() {\n return new EmptyIterator();\n}", "function empty() {\r\n\t return new EmptyIterator();\r\n\t}", "function EmptyIterator() {}", "function EmptyIterator() {\n }", "function EmptyIterator() {\r\n\t }", "function EmptyIterator() {\r\n }", "static empty() {\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Using `put.resolve` will wait until the promsie resolve/reject before resuming. It will be helpful to organize multieffects in order, and increase the reusability by seperate the effect in standalone pieces.
function putResolve(action) { var type = action.type; assertAction(type, 'sagaEffects.put.resolve'); return sagaEffects.put.resolve((0, _objectSpread2.default)({}, action, { type: (0, _prefixType.default)(type, model) })); }
[ "function putResolve(action) {\n\t var type = action.type;\n\t assertAction(type, 'sagaEffects.put.resolve');\n\t return sagaEffects.put.resolve((0, _objectSpread2.default)({}, action, {\n\t type: (0, _prefixType.default)(type, model)\n\t }));\n\t }", "function putResolve(action) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
initQueryParamListener() Check query params
checkQueryParam() { let paramLayer = getParameterByName('layer'); let paramProperty = getParameterByName('property'); if (paramLayer) { if (paramProperty) { this.updateLayer(paramLayer, paramProperty); } else { ...
[ "initQueryParamListener() {\r\n // console.log('method: initQueryParamListener');\r\n\r\n this.checkQueryParam();\r\n\r\n window.onpopstate = history.onpushstate = (event) => {\r\n this.checkQueryParam();\r\n }\r\n\r\n }", "function QueryParameters...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
= Description = Parameters All parameters are optional. +_priority+:: The priority, a number between 1 and Infinity. Smaller number means higher priority, affects onIdle polling. +_label+:: A label for the application; for process managers.
constructor(_priority, _label) { super(); this.elemId = 0; // document.body // Special null viewId for HApplication instances, // they share a system-level root view; the document object this.viewId = null; // storage for views this.views = []; // storage for dom element id's in vie...
[ "SetApplicationPriority(string, int, bool) {\n\n }", "function updatePriorityLabel(priorityLabel, priority) {\n priorityLabel.classList.remove(...priorityLabel.classList);\n priorityLabel.classList.add(`priority-${priority}`);\n priorityLabel.innerText = priority;\n }", "startApp(_appId, _priority)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Post a transaction to the portfolio Endpoint: /api/portfolios/:portfolioID/transactions
function postTransaction(portfolioID, ticker, transactionType, quantity) { return $http.post( '/api/portfolios/' + portfolioID + '/transactions/', { ticker: ticker, transaction_type: transactionType, quantity: quantity } ); }
[ "function storeTransaction() {\n return new Promise((resolve, reject) => {\n // create a promise for user's portfolio\n getPortfolio().then(response => {\n portfolio = response;\n // check if there is a stock in the portfolio\n let found = fa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a string from the first n elements of a, joined by '.'
function make_name(a, n) { var sub = []; for (var i = 0; i < n; i++) { sub.push(a[i].toString()); } return sub.join('.'); }
[ "function addDots(n)\r\n{\r\n\tn += '';\r\n\tvar rgx = /(\\d+)(\\d{3})/;\r\n\twhile (rgx.test(n)) {\r\n\t\tn = n.replace(rgx, '$1' + '.' + '$2');\r\n\t}\r\n\treturn n;\r\n}", "function join(a) {\n var newString = \"\";\n for (var i = 0; i < a.length; i++) {\n if (isFinite (a[i]) && a[i] !== null /* ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
redirects user to $scope.user.openIdUrl param
function handleOpenIdRedirect () { windowLocation.href($scope.user.openIdUrl); }
[ "openCurrentUser() {\n window.location.href = window.location.origin + '/users?name=' + this.state.currentUser.firstName + ' ' + this.state.currentUser.lastName;\n }", "function gotoUser(uid)\n{\n window.location='user.html?uid='+uid;\n}", "function goToProfile(user) {\n $location.path(`/use...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Splits a container in to two equal parts stacked vertically.
function split() { if (!scope.splittable) { return; } var height = scope.control.renderingHeight; var halfHeight = height; if (height) { halfHeight = Math.ceil(height / 2); sco...
[ "createSplits() {\n if (this.opSplit !== null) {\n this.opSplit.destroy();\n }\n if (this.ioSplit !== null) {\n this.ioSplit.destroy();\n }\n\n this.opSplit = Split([\"#opPane\", \"#ioPane\"], {\n sizes: [20, 80],\n minSize: 200\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_ESAbstract.IsConstructor / global Type 7.2.4. IsConstructor ( argument )
function IsConstructor(argument) { // eslint-disable-line no-unused-vars // 1. If Type(argument) is not Object, return false. if (Type(argument) !== 'object') { return false; } // 2. If argument has a [[Construct]] internal method, return true. // 3. Return false. // Polyfill.io - `new argument` is the ...
[ "function isConstructor(f) {\n try {\n Reflect.construct(function(){}, [], f);\n } catch (e) {\n return false;\n }\n return true;\n}", "function IsConstructor(argument) { // eslint-disable-line no-unused-vars\n\t// 1. If Type(argument) is not Object, return false.\n\tif (Type(argument) !...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle a single quest
function gotQuest(err, quest) { if (err) return next(err); _self.quest = quest; // Gather current level info quest.levels.forEach(function(level, i) { level.users.forEach(function(user) { if (user._id.toString() === req.user._id.toString()) { _self.levelNo = i; _self.l...
[ "function answerQuest(err, quest) {\n var body = {\n question : 'Foo?',\n quest : quest._id,\n tags : ''\n };\n common.requestPost(app, '/api/wouso-quest/add', body, checkQuest);\n }", "handleQuest(questGoal) {\n let player = this.players.player1,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
enable an option after required components were detected
function enableoption(option) { if (defined(widget)) { _F('enableoption', option); var checkbox = widget.find('input[data-option='+option+']'); if (checkbox.length) { checkbox.removeClass('di...
[ "enableEnforce(enable) {\r\n this.enabled = enable;\r\n }", "static option(element,skip = false) {\n var type = element.id;\n if (!skip) {\n this.options[type] = !this.options[type];\n }\n if (!this.options[type]) {\n element.children[1].children[0].innerHTML = \"Enable\";\n e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw level on canvas
function drawLevel(){ ctx.font = fontType; ctx.fillStyle = "#009547"; ctx.fillText("Level "+level, canvas.width/2 - 30, 20); }
[ "function draw(){\n //LEVEL\n ctx.font = \"15px Verdana\";\n ctx.fillStyle = 'black';\n /**\n *.fillText\n * @param maxTicks holt sich Wert aus Global maxTicks\n * @param 7, 15 = Positionierung in x- und y-Richtung\n */\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SQL stuff var pw = $("psw").val();
function checkPw() { pw = $("#psw").val(); un = $("#un").val() console.log(pw); //currently checks if password has at least 2 digits, 2 letters, and is at least 6 //characters long. Putting bracket thing on end results in an error. Maybe I should ask //stack overflow if (pw.match(".*\\d{2}.*") && pw.ma...
[ "get inputPassword () { return $('#form-login-password') }", "function passwordValue() { return passewordDiv.value }", "function getPassword(){\n\tvar pass = (document.getElementById(\"password\")).value;\n\treturn pass;\n}", "function CFDataSourceMenu_getPassword()\r\n{\r\n var retVal = \"\";\r\n \r\n var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UPDATECONSTRUCTION update points based on a changed cell
function updateConstruction (cell) { // console.log(cell); if (cell == null) { console.log("Cell altered ... but value was NULL."); return; } console.log("Cell altered ... searching for matching construction."); var aPoint = getPointFromCell(cell); var fieldname = cell.get...
[ "function update(cell){\n\n tracker.particles.forEach(p => {\n if(utils.pointInRect(p.x, p.y, {x: cell.x, y: cell.y, width: cell.width, height: cell.height})){\n cell.state.particle = true\n console.log(cell.state)\n }\n })\n}", "updateCells() {\n // Flatten 2D cel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2. Count Word Buatlah sebuah fungsi yang dapat mengembalikan ( return ) jumlah kata yang ada di dalam kalimat, fungsi ini hanya dapat menerima argument tipe data string, dan mengembalikan tipe data number contoh test case "pratama" > return 1 "hellohello" > return 1 "hello hello hello" > return 3 "" > return 0 "hore ye...
function countWord(word) { if (typeof word !== 'string'){ return 'error input bukan string'; } else if (word === "") { return ''; } else { let count = 1 for (let j = 0; j < word.length; j++) { if (word[j] === ' ' && word[j+1] !== ' ') { count++ ...
[ "function howManyWord(s){\n\n\n\n let jumlahKata = 0 \n\n if(s[0] == ' '){\n jumlahKata = 'Masukkan kalimat dengan benar'\n return jumlahKata\n }\n\n for(let i = 0 ; i < s.length ; i++){\n\n if(s[i] == ' '){\n jumlahKata += 1\n }\n\n }\n\n\n if(s[s.length-1] ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
strip DOM and Shebang
function stripCode(content) { return stripShebang(stripBOM(content)); }
[ "function stripShebang (module, content) {\n return content.replace(/^\\#\\!.*/, '');\n}", "function stripShebang (content) {\n // Remove shebang\n var contLen = content.length\n if (contLen >= 2) {\n if (content.charCodeAt(0) === 35/* # */ &&\n content.charCodeAt(1) === 33/*! */) {\n if (contL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If service is configured to not allow unauthenticated access, then don't allow it to be deployed to GKE which doesn't support that method through crbt.
function checkGkeUnauthViolation() { let allowUnauthenticated = true; try { allowUnauthenticated = JSON.parse(fs.readFileSync(customizationFile)).options['allow-unauthenticated']; } catch (e) {} if (typeof allowUnauthenticated !== 'boolean') allowUnauthenticated = true; if (!allowUnauthentic...
[ "function PreauthorizationService() {\n\n}", "restrictToUnauthenticated (to, from, next) {\n feathers.authenticate()\n .then(() => { next(false); })\n .catch(() => { next(); });\n }", "auth(ctx, doc) {\n winston.warn(\n `${this.constructor.name} does not implement auth, disallowing.`\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find any variants matching the target variant in the given family's segregation. Any matching variant pushes its family onto the associations array as a side effect
function surveyFamily(family, targetVariant, associations) { if (family.segregation && family.segregation.variants) { var matchingVariant = _(family.segregation.variants).find(function(variant) { return variant.uuid === targetVariant.uuid; }); // Found a matc...
[ "function surveyIndividual(individual, targetVariant, associations) {\n // Search for variant in individual matching variant we're looking for\n var matchingVariant = _(individual.variants).find(function(variant) {\n return variant.uuid === targetVariant.uuid;\n });\n\n // Fou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
;; camDetectEnemyBase(base label) ;; ;; Plays the "enemy base detected" message and places a beacon ;; for the enemy base defined by the label, as if the base ;; was actually found by the player. ;;
function camDetectEnemyBase(blabel) { var bi = __camEnemyBases[blabel]; if (bi.detected || bi.eliminated) { return; } camTrace("Enemy base", blabel, "detected"); bi.detected = true; if (camDef(bi.detectSnd)) { var pos = camMakePos(bi.cleanup); if (!camDef(pos)) // auto-detect sound position by group objec...
[ "function MirrorEnemy() {\n}", "function TestEnemy() {}", "function onEntityInVision(entity, entity2) {}", "hit() {\r\n }", "onRegularAttack(src, weapon, targets) { }", "function C101_KinbakuClub_BlindMansBuff_Run() {\n\tBuildInteraction(C101_KinbakuClub_BlindMansBuff_CurrentStage);\n}", "function Sh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calcula as dependencias do numero de slots para uma classe por nivel.
function _DependenciasNumeroSlotsParaClassePorNivel( chave_classe, nivel, num_slots_nivel, feiticos_por_nivel, array_bonus_feiticos_atributo, bonus_atributo_chave, possui_dominio, escola_especializada) { // Slots de feiticos. var personagem_slots_nivel = gPersonagem.feiticos[chave_classe].slots[nivel]; pe...
[ "function _GeraFeiticosClasseNivel(classe_personagem, nivel, conhecidos_nivel, slots_nivel, ordem_magias, lista_feiticos_classe_nivel) {\n // Preenche conhecidos para ter referencia.\n if (!tabelas_feiticos[classe_personagem.classe].precisa_conhecer) {\n conhecidos_nivel.length = ordem_magias.length;\n }\n f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolve a "webDependencies" input value to the correct absolute file location. Supports both npm package names, and file paths relative to the node_modules directory. Follows logic similar to Node's resolution logic, but using a package.json's ESM "module" field instead of the CJS "main" field.
function resolveWebDependency(dep) { // if dep points directly to a file within a package, return that reference. // No other lookup required. if (path.extname(dep) && !validatePackageName(dep).validForNewPackages) { const isJSFile = ['.js', '.mjs', '.cjs'].includes(path.extname(dep)); return { type...
[ "function resolveWebDependency (dep) {\n const nodeModulesLoc = path.join(cwd, 'node_modules', dep)\n let dependencyStats\n try {\n dependencyStats = fs.statSync(nodeModulesLoc)\n } catch (err) {\n throw new ErrorWithHint(\n `\"${dep}\" not found in your node_modules directory.`...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Postfix function calls with ts _ids
postfix(src, m, call_id) { let target = this.get_args(this.fdef(m[2])).length let m0 = this.parentheses(m[0]) // First closed pair let args = this.get_args_2(m0) for (var i = args.length; i < target; i++) { args.push('void 0') } // Add an unique time-series ...
[ "callcallbacks(...args) {\n for (let id of Object.keys(this.callbacks)) {\n this.callbacks[id](...args);\n }\n }", "call(operationID, ...args) {\n if (this.hooks[operationID]) {\n for (let hook of this.hooks[operationID]) {\n args = hook(...args);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that gets the amount that can be deposited into the Escrow
function amountThatCanBeDepositedInEscrow() { return new Promise (async (resolve, reject) => { try { resolve(await baseLogic.getFixedDepositAmount()) } catch (error) { console.log('error in amountThatCanBeDepositedInEscrow : ', error) reject({ stat...
[ "disbursedAmount() {\n if (util.trimAndLower(this.functionType) === \"premium\") { return 0; }\n if (util.trimAndLower(this.functionType) === \"surrender\") { return this.currentAccountValue() - this.surrenderCharge() }\n return (this.withdrawalAmount - this.surrenderCharge());\n }", "get ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls the server API function validPlay that checks if a certain move is valid depending on the player, board and coordinates
checkValidPlay(startRow,startColumn,endRow,endColumn){ validPlay(this.boardState, this.playerTurn, startColumn, startRow,endColumn, endRow, data => this.validPlayHandler(data,startRow,startColumn,endRow,endColumn)); }
[ "function play(command) {\n let coords;\n try {\n coords = command.split(' ')[1].split(',');\n } catch (err) {\n console.log(`Invalid input - must be in format \"play x,y\"`);\n return false;\n }\n\n if (coords.length !== 2) {\n console.log(`Invalid input - must be in format \"play x,y\"`);\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ends the sceren share and puts back the user video on the localstream.
async function end_screen_share() { video_list.find(sender => sender.track.kind === 'video').replaceTrack(localStream.getTracks().find(track => track.kind === 'video')); document.querySelector('#localVideo').srcObject = localStream; stopShare.disabled = true; startShare.disabled = false; }
[ "function endVideo() {\r\n\tvideoSession.close();\r\n}", "function trackVideoEnd() {\n\n flushParams();\n correlateMediaPlaybackEvents();\n s.Media.stop(videoFileName, videoStreamLength);\n s.Media.close(videoFileName);\n }", "async function onStopScreenShare(){\n\n //If local ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fills the array with other arrays inside to create a bidimensional. The 0's represents blank spaces. TODO: cambiar a un nombre mas descriptivo
_fillThis() { for (let row = 0; row < this.length; row++) { this[row] = []; for (let newCol = 0; newCol < 4; newCol++) { this[row][newCol] = 0; } } }
[ "function fill2DEmptyArray(){\n\t\n\tarr =[];\n\tfor(var i = 0; i < max_row; i ++){\n\t\tarr.push(['']);\n\t\tfor(var j = 0; j < max_col; j ++){\n\t\t\tarr[i][j] = '';\n\t\t}\n\t}\n\tconsole.log(max_row);\n\tconsole.log(max_col);\n\tconsole.log(arr.length);\n\tconsole.log(arr);\n}", "function fillArray () {\n\tfo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
recommend this client application
function startRecommendApp(token) { var action = 'startRecommendApp'; var jsonStr = '{}'; cmread.callBackClient(action, jsonStr, token); }
[ "function get_recommend(){\n $.mortar_data.api.get_recommend( \n get_query(),\n '',\n fire_show_details,\n fire_detail_error\n );\n }", "async getRecommendation() {\n \n if (this.recsList.length === 0 || this.currentProposalIndex >= this.recsList.length) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UPDATE LIST ADD ITEM item needs to be a string with more than 1 character, is required, user needs to be either owner or collaborator
"groceryLists.update"(_id, item) { if (!this.userId) { throw new Meteor.Error("Not authorized"); } new SimpleSchema({ item: { type: String, min: 1, required: true } }).validate({ item }); GroceryLists.update( { $or: [ { _...
[ "function addOrUpdateItem(user, listId, listName, item) {\n if (!(NAME in item)) {\n console.log(\"addItem: item parameter doesn't have a name field, skipping\");\n return false;\n }\n\n item[LAST_UPDATE] = now();\n\n console.log(\"addOrUpdateItem: item =\" + JSON.stringify(item));\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fncChangeCountry =============== Load selected country home page or "Select Language" page for selected country Parameters Return value
function fncChangeCountry() { //Get selected country from dropdown var intCountry = document.frmFooter.cboCountries.selectedIndex; intCountry = parseInt(document.frmFooter.cboCountries[intCountry].value); var objTemp = gobjCountryArray[intCountry]; // For March 31, 2001 deadline, // Set country & lan...
[ "function ChangeCity(){\r\n\t\t\thtmlid=\"city\";\r\n\t\t\tvar item_country = 1;\r\n\t\t\tif(item_country != \"\"){\r\n\t\t\t\txmlobj =getHTTPObject();\r\n\t\t\t\tif(xmlobj==null){\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tdocument.getElementById('khan').innerHTML = \"<option value='0'> -- District -- </option>\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if the ArrayBuffer represents a JSON string. Search the first and last 5 entries for evidence of being a JSON buffer
function isJSONStringTypeArray(arr) { let firstChar = arr.slice(0, 5).find(entry => entry >= 0x20); let lastChars = arr.slice(-5); // Buffer.slice() does not make a copy, but we need one since // we call reverse() if (lastChars instanceof Buffer) { lastChars = Buffer.from(lastChars); } let lastChar ...
[ "function isJsonBuffer(obj) {\n return obj && obj.type === 'Buffer' && Array.isArray(obj.data);\n}", "function isJSON(obj) {\n if ('string' == typeof obj) return false;\n if (obj instanceof Stream) return false;\n if (Buffer.isBuffer(obj)) return false;\n return true;\n}", "function IsJsonArray(JsonObject)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the height of the game (based on the scene)
_getGameHeight() { return this.scene.scene.manager.game.config.height; }
[ "_getGameHeight() {\n return this.scene.sys.game.config.height;\n }", "_getGameHeight() {\n return this.scene.sys.game.config.height;\n}", "getGameHeight() {\n return 600;\n }", "static get screenHeight() {\n if (Engine.client === exports.Client.Electron)\n return GameWindow.bro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies "volumeOfRectangle" function when variable answer is w l h. Console log prints "volumeOfRectangle" function.
function volumeOfRectangle(w, l, h) { console.log(w * l * h); }
[ "function volumeRectangular(length, width, height){\nlet vR = (length * width * height);\n return vR;\n}", "function volumeOfBox(width, length, height) {\n return width * length * height;\n}", "function volumeOfRectPrism(length, width, height) {\n let volume = length * width * height\n return volume\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PARSE FIXED HEADER: Populates magic, // identifies type of tile type, // String version of magic version, byteLength
function parse3DTileHeaderSync(tile, arrayBuffer, byteOffset = 0) { const view = new DataView(arrayBuffer); tile.magic = view.getUint32(byteOffset, true); byteOffset += SIZEOF_UINT32; tile.version = view.getUint32(byteOffset, true); byteOffset += SIZEOF_UINT32; tile.byteLength = view.getUint32(byteOffset...
[ "decode(data) {\n var header = {};\n var headerBuffer = Buffer.from(data);\n header.headLength = headerBuffer.readInt32BE(0, true);\n header.clientVersion = headerBuffer.readInt32BE(4, true);\n header.cmdId = headerBuffer.readInt32BE(8, true);\n header.seq = headerBuffer.re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine if given options received during program invocation, this would indicate regular mode operation. The requirement is that all regular options have to be specified. If at least one regular mode option is missing, then this is not considered regular mode.
function isModeRegularOperation(options, regularOptions) { let allPresent = true; let firstMissing; for (let i = 0; i < regularOptions.length; i++) { // expectedOptions.forEach((element) => { let element = regularOptions[i]; let hasIt = options.hasOwnProperty(element); allP...
[ "function noRegularOperationOptions(options, regularOptions) {\n debug('noRegularOperationOptions:start');\n let retValue = true;\n for (let i=0; i < regularOptions.length; i++) {\n let element =regularOptions[i];\n let hasIt = options.hasOwnProperty(element);\n if (hasIt){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the flower elements
function createFlower() { const flowerContainer = document.getElementById("flower-container"); // Create the stem element const stem = document.createElement("div"); stem.classList.add("stem"); // Create the flower center element const flowerCenter = document.createElement("div"); flowerCenter.classList...
[ "function drawMiniFlowers() {\n\n for (let i = 0; i < 6; i++) {\n push();\n let pLen = 60.0;\n let xpos = random(pLen, displayWidth - pLen);\n let ypos = random(pLen, displayHeight - pLen);\n translate(xpos, ypos);\n drawFlower(2.0, step, numpetals, ro, tilt, tht + i * 20, pLen, flowerCol);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a 2 item array in the format [directory, file] (Ex. "bot/a/b/fred.txt" > ["bot/a/b/", "fred.txt"])
function splitPath(filepath){ return splitFromBack(filepath, '\\'); }
[ "function getDirectoriesPathArray(filePath) {\n const filePathArray = filePath.split(\"/\");\n return filePathArray.slice(0, filePathArray.length - 1);\n}", "breakPath(fullPath) {\n return fullPath.split('/').reduce((res, path, idx) => {\n res.push(idx === 0 ? path : `${res[idx - 1]}/${path}`);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggle access token data field
function toggleAccessToken() { toggleElement('accessTokenData'); }
[ "function toggleAccessToken() {\n toggleElement('accessTokenData');\n}", "function setToken(token) {\n access_token = token;\n }", "setAccessToken() {\n\t\t let accessToken = this.getParameterByName('access_token');\n\t\t localStorage.setItem(this.ACCESS_TOKEN_KEY, accessToken);\n\t\t}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PROTECTED Releases the current map selection and unselects the currently selected network elements.
function releaseMapSelection() { if (this.selectedNetworkElements != null) { for (var i = 0; i < this.selectedNetworkElements.getLength(); i++) { this.selectedNetworkElements.get(i).unselect(); } } if (this.dottedSelection != null) { this.dottedSelection.release(); } this.selectedNetworkElements ...
[ "function clearSelection() {\r\n map.deselectCountry();\r\n pc1.deselectLine();\r\n donut.deselectPie();\r\n sp1.deselectDot();\r\n }", "unselect_neuron() {\n this.selected_layer = null;\n this.selected_index = null;\n this.paint();\n }", "Unselect() {\r\n this.ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
USAGE var exists = checkTriggerExists_('test_getSets', 'SPREADSHEETS')
function checkTriggerExists_(nameFunction, triggerSourceType) { var triggers = ScriptApp.getProjectTriggers(); var trigger = {}; for (var i = 0; i < triggers.length; i++) { trigger = triggers[i]; if (trigger.getHandlerFunction() == nameFunction && trigger.getTriggerSource() == triggerSourceType) return ...
[ "function checkTriggerExists(nameFunction, triggerSourceType)\n{\n var triggers = ScriptApp.getProjectTriggers();\n var trigger = {};\n\n \n for (var i = 0; i < triggers.length; i++) {\n trigger = triggers[i];\n if (trigger.getHandlerFunction() == nameFunction && trigger.getTriggerSource() == triggerSourceT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
refreshBooks will get all books from the server and render to page
function refreshBooks() { $.ajax({ type: 'GET', url: '/books' }).then(function (response) { console.log(response); renderBooks(response); }).catch(function (error) { console.log('error in GET', error); }); }
[ "function refreshBooks() {\n $.ajax({\n type: 'GET',\n url: '/books',\n })\n .then(function (response) {\n console.log(response);\n renderBooks(response);\n })\n .catch(function (error) {\n console.log('error in GET', error);\n });\n}", "function refreshBooks() {\n $.ajax({\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Release the Select button
*releaseButtonSelect() { yield this.sendEvent({ type: 0x01, code: 0x13a, value: 0 }); }
[ "unselect() {\n this.selected = false;\n }", "static mouseReleased() {\n UI.selected = null;\n }", "unselect() {\n this.selected = false;\n }", "unselect(){\n this.selected = null;\n }", "deselect(){this.isSelected = false;}", "deselect() {\n this.selectItem(-1);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
xHasPoint, Copyright 20012007 Michael Foster (CrossBrowser.com) Part of X, a CrossBrowser Javascript Library, Distributed under the terms of the GNU LGPL
function xHasPoint(e,x,y,t,r,b,l) { if (!xNum(t)){t=r=b=l=0;} else if (!xNum(r)){r=b=l=t;} else if (!xNum(b)){l=r; b=t;} var eX = xPageX(e), eY = xPageY(e); return (x >= eX + l && x <= eX + xWidth(e) - r && y >= eY + t && y <= eY + xHeight(e) - b ); }
[ "function xHasPoint(e,x,y,t,r,b,l)\n{\n if (!xNum(t)){t=r=b=l=0;}\n else if (!xNum(r)){r=b=l=t;}\n else if (!xNum(b)){l=r; b=t;}\n var eX = xPageX(e), eY = xPageY(e);\n return (x >= eX + l && x <= eX + xWidth(e) - r &&\n y >= eY + t && y <= eY + xHeight(e) - b );\n}", "hasPoint(x, y) {\n return t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show onetime notification about reloads for responsive emulation.
showReloadNotification() { if (Services.prefs.getBoolPref(RELOAD_NOTIFICATION_PREF, false)) { showNotification(this.browserWindow, this.tab, { msg: l10n.getFormatStr("responsive.reloadNotification.description2"), }); Services.prefs.setBoolPref(RELOAD_NOTIFICATION_PREF, false); } }
[ "_displayBundleChangedNotification() {\n if (!this._assetsChangedNotificationId) {\n // Wrap the notification inside a delay.\n // The server may be overwhelmed with recomputing assets\n // We wait until things settle down\n clearTimeout(this._b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates checkbox or radio inputs from given array and places them in the given jquery object prefix is used for parsing form data
function populateInputs($area, array, type, prefix) { // make sure type is checkbox or radio if (!(type === "checkbox" || type === "radio")) { throw new Error(`Input type must be either 'checkbox' or 'radio', received ${type}`); } // iterate of array items array.forEach((item, index) => { let itemName ...
[ "function createInputElements( p_name, p_type, p_fieldName, p_values, p_desc ){\n\t// Create a div element to group the checkboxes or radio buttons\n\tvar group_div = document.createElement(\"div\"); \n\tgroup_div.setAttribute(\"class\", p_type + \"_container\");\n\t//group_div.id = p_name + \"_checkboxes\";\n\tif(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========================================================================= MethodName: Constructor Description: Instantiate a Processor Object Arguments: config Table : a method will read it from DB Return Value: none ===========================================================================
constructor(configTable, locationTable) { this.PredefinedLocation = locationTable; // MySQL location Table this.ConfigTable = configTable; // MySQL config Table this.DateBase = require('../libs/database.js'); // used for DB this.axios = require('axios'); }
[ "function Process() {\r\n var id = null;\r\n this.getId = function () {return id;};\r\n\r\n if (1 == arguments.length && arguments[0][rhoUtil.rhoIdParam()]) {\r\n if (moduleNS != arguments[0][rhoUtil.rhoClassParam()]) {\r\n throw \"Wrong class instantiation!\";\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stretch model based on mouse position. Work in progress.
function stretch() { window.addEventListener('mousemove', function(e) { mX = mouse3D.x * .01; mY = mouse3D.y * .01; mZ = mouse3D.z * .01; if (mouseDown == 1) { if (mY <= 0) { model.scale.y = .01 - (-.04 * mY); ...
[ "function mouseDragged(){\n\toffsetX -= (pmouseX - mouseX) * 0.5;\n\toffsetY -= (pmouseY - mouseY) * 0.5;\n\n\tgrid.offsetY = offsetY;\n\tgrid.offsetX = offsetX;\n\n //Update offsets for every model\n for (let i = 0; i < models.length; i++)\n models[i].setOffsets(offsetX, offsetY);\n}", "function zoomPostPro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_ESAbstract.TrimString / eslintdisable nocontrolregex / global RequireObjectCoercible, ToString TrimString ( string, where )
function TrimString(string, where) { // eslint-disable-line no-unused-vars // 1. Let str be ? RequireObjectCoercible(string). var str = RequireObjectCoercible(string); // 2. Let S be ? ToString(str). var S = ToString(str); // 3. If where is "start", let T be a String value that is a copy of S with leading whi...
[ "function TrimString(string, where) { // eslint-disable-line no-unused-vars\n // 1. Let str be ? RequireObjectCoercible(string).\n var str = RequireObjectCoercible(string);\n // 2. Let S be ? ToString(str).\n var S = ToString(str);\n // 3. If where is \"start\", let T be a String value that is a copy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
______ js2DOMlight ___//License code: BSD 2 modified (3 additions). From prismalide.com, js2DOMlight v.0.9 gitHub for details
function js2DOMlight ( firstData ) { //pseudo constructeur de js2DOMcore //!-closure:js2DOMlight //!-bringVar: var ObjKeys = Object.keys ///__ private data for js2DOMcore __\\\ var html = htmlDefault, id = idDefault var dom, inner, tagtxt, postTag, level, markers = {}, se...
[ "function DOMid2js ( ) { //!-use:resCom-light //!-use:setJs-light\n //!-single:\n //!-var:\n var settings = {}\n //!-init:\n// resources = resComlight ( resourcesTypes(), resources, {} )\n resources = resComlight ( resourcesTypes(), resources, {} )\n settingOptions = setting...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
indents the file by given amount
function indent(file, indentAmount) { var split = file.split('\n'), actualIndent = indentAmount || ' ', i = 0, l = split.length; for (; i < l; i++) { split[i] = actualIndent + split[i]; } return split.join('\n'); }
[ "_toEndOfFile(from, action) {\n for (let i = from; i <= this.lastLine; i++) {\n action(i);\n }\n }", "function adjustCount(amount){\n\t\t\titemCount = itemCount + amount;\n\t\t}", "setFileWidth (state, width) { \n state.fileWidth = width + 35;\n }", "enterMultipleFilePositi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to receive "zin in" integer which is now a string, with parseInt turned back into a plain integer to use in D3.js
function answersToNumbers(data) { zininInts = data.map(v => { return parseInt(v.zinin); }); }
[ "function ml_z_to_int(z1) {\n return bigInt(z1).toJSNumber();\n}", "function toInt (str) {\n\n}", "function ml_z_of_nativeint(z) {\n return ml_z_of_int(z)\n}", "function int(data) {\n // menghilangkan . pada nominal\n let int = parseInt(data.replace(\".\", \"\"));\n return int;\n}", "function c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
input validate for edit a simple portal packet
function inputValidation() { var portalPacketTitle = document.getElementById("portalPacketTitle"); var portalPacketContent = document.getElementById("portalPacketContent"); var portalPacketFooter = document.getElementById("portalPacketFooter"); var error = ""; if (portalPacketTitle.value.length == 0) { err...
[ "isInputValid(input) {\n if(input.includes(\"inventory\")){\n this.displayInventory();\n return false;\n };\n if(input.includes(\"status\")){\n this.displayStatus();\n return false;\n };\n let item = this.location.roomInventory(input) || this.playerInventory(input);\n if (item)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Repositioned opened infowindow for new zoom level
function repositionInfoWindow(zoom) { if(!$['mapsettings'].hasOpenInfoWindow) return true; if(typeof($['mapsettings'].infoWindowLocation[zoom]) != 'undefined') { offset = $['mapsettings'].infoWindowLocation[zoom]; } else { point = $['mapsettings'].infoWindowLocation[sets.zoom]; offset = getPointZoo...
[ "function infoWindowOnZoomFinished() {\n var m = activeMarkers[0];\n window.setTimeout(function() {\n infowindow.open(map, m);\n }, 250); // 250ms\n}", "function zoomOnFirstLocation() {\n map.setZoom(4);\n map.panTo(infoWindows[0].position);\n}", "function infoWindowAction() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Requests and waits for employee data from the server, then parses the results and calls generateHTML to work with the data.
async function fetchEmployeeData() { const response = await fetch( "https://randomuser.me/api/?results=12&nat=US&noinfo" ); await response.json().then((result) => { generateHTML(result); }); }
[ "function getEmployees() {\n $.ajax({\n type: 'GET',\n url: '/employees',\n success: function(response) {\n console.log(\"Got from server:\", response);\n appendDom(response);\n }\n });\n}", "function retrieveRequestsByEmployee(){\n\tvar xhr = new XMLHttpRequest();\n\t\n\txhr.onreadystatec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a function that takes an array of 10 numbers (between 0 and 9) and returns a string of those numbers formatted as a phone number (e.g. (555) 5555555).
function formatPhoneNumber(numbers) { var phoneNumber = [] phoneNumber.push('(', numbers[0], numbers[1], numbers[2], ')') phoneNumber.push(' ', numbers[3], numbers[4], numbers[5]) phoneNumber.push('-', numbers[6], numbers[7], numbers[8], numbers[9]) console.log(phoneNumber.join('')) return phoneNumber.join(...
[ "function formatPhoneNumber(arr) {\n var phoneStr = \"(\";\n // Loop through digits\n for (var k = 0; k< arr.length; k++) {\n phoneStr += arr[k];\n if (k == 2) {\n phoneStr += \") \"; // Add closing parentheses after 3rd digit (2nd index)\n } else if (k == 5) { // Add hyphen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
make state updated with current video progress so that progress bar can also be updated
_updateProgress() { if (this.videoPlayer && this.state.playing) { const playedTime = Math.floor(this.videoPlayer.currentTime); const progress = playedTime / this.videoDuration; this.setState({progress}); if (this.props.onProgressTick) { this.props...
[ "function setProgress() {\n\n //update progressBar\n video.currentTime = progress.value * video.duration / 100;\n}", "function setProgress() {\n video.currentTime = progress.value * video.duration / 100;\n }", "function setVideoProgress() {\n video.currentTime = (progress.value * video.duration) / 1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a relative path, returns an absolute url using the instance base URL
relative(path) { return new URL(path, this.getUrl().href).href; }
[ "function absoluteUrl(baseUrl, relative) {\n let baseUrlStr = baseUrl.toString();\n // console.debug(baseUrl, relative);\n // console.trace();\n if (relative.startsWith(\"http\") || relative.startsWith(\"file\") || relative.startsWith(\"/\")) {\n return relative;\n }\n\n let baseWithoutIntraPageLink = base...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }