query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
driverNamesWithRevenueOver() This function works the same way as driversWithRevenueOver(). The difference is that it returns an array of strings representing the name of each driver who has a revenue greater than the specified amount. For example, driverNamesWithRevenueOver(drivers, 2000) will return ['Sammy'], as Samm...
function driverNamesWithRevenueOver(drivers, revenue){ return driversWithRevenueOver(drivers, revenue).map((driver) => driver.name) }
[ "function driverNamesWithRevenueOver(drivers, revenue) {\n array = drivers.filter(driver => driver.revenue > revenue)\n return array.map(driver => driver.name)\n}", "function driverNamesWithRevenueOver(drivers, revenue){\n return driversWithRevenueOver(drivers, revenue).map(function(driver){\n return driver...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function prints the value of index1 at the bottom of the while loop when it is modified
function bottomindexprt(data3) { console.log('The content of index index1 at the bottom of the while loop is ' + data3) }
[ "function topindexprt(data2) {\n console.log('The content of index index1 at the top of the while loop is ' + data2)\n\n}", "function topindexprt(data2) {\n console.log('The content of index index1 at the top of the while loop is ' + data2)\n\n}", "function bottomindexprt(data3) {\n console.log('The cont...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles opening of the autocomplete list. Sets current state (taht autocomplete list is opened) for future purposes.
onResultsOpen() { state = 'opened'; run(() => { debug(`Flexberry Lookup::autocomplete state = ${state}`); }); }
[ "onResultsOpen() {\n state = 'opened';\n Ember.Logger.debug(`Flexberry Lookup::autocomplete state = ${state}`);\n }", "open() {\n this._shouldBeOpen = true;\n if (this.disabled || !this.collapsed || this.target.children.length === 0) {\n return;\n }\n // i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Poner todos los valores entre 0 y 1 del fitness
function normalizarFitness() { var sum = fitness.reduce((acc, curr) => acc + curr); fitness = fitness.map(val => val / sum); }
[ "function normalizamosElFitness() {\n let sum = 0;\n for (let i = 0; i < fitness.length; i++) {\n sum += fitness[i];\n }\n for (let i = 0; i < fitness.length; i++) {\n fitness[i] = fitness[i] / sum;\n }\n}", "resetFitness() {\n this.genomes.forEach((genome) => {\n genome.lastFitness =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if all of the history items have been selected like the default status.
hasNonSelectedItems() { let sanitizeItemList = document.querySelectorAll( "#historyGroup > [preference]" ); for (let prefItem of sanitizeItemList) { if (!prefItem.checked) { return true; } } return false; }
[ "isAllSelected() {\n if (this._selectionType !== SelectionType.Multi || !this._items.displayed) {\n return false;\n }\n // make sure to exclude the locked items from the list when counting\n const displayedItems = this._items.displayed.filter(item => {\n return this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
output "B" after a random time between 0 & 3 seconds
function outputB() { var randomTime = Math.floor(Math.random() * 3000) + 1; setTimeout(function(){ console.log("B"); }, randomTime); }
[ "function outputA()\n {\n var randomTime = Math.floor(Math.random() * 3000) + 1;\n\n setTimeout(function(){\n console.log(\"A\");\n }, randomTime);\n }", "function outputC()\n {\n var randomTime = Math.floor(Math.random() * 3000) + 1;\n\n setTimeout(function(){\n console.log(\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a nonnegative integer, return an array containing a list of independent digits in reverse order. Example: 348597 => [7,9,5,8,4,3]
function numToArray(int) { var str = int.toString(); var rev = str.split("").reverse(); var fin = rev.join(""); return fin }
[ "function digitList(num) {\n let resultArr = [];\n\n while (num > 0) {\n let numToPush = num % 10;\n resultArr.push(numToPush);\n num = Math.floor(num / 10);\n }\n\n resultArr.reverse();\n\n return resultArr;\n}", "function digitize(n) {\n //code here\n let reversed= n.toString().split('').reverse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to add user specific url to urlDatabase
function addUrlToUser(userId, shortUrl, longUrl) { let userUrls = urlDatabase[userId]; if (!userUrls) { userUrls = {}; userUrls[shortUrl] = longUrl; urlDatabase[userId] = userUrls; } else { userUrls[shortUrl] = longUrl; } }
[ "function addURL() {\n if (!current_user) {\n alert('please log in');\n return;\n }\n\n const url = document.getElementById(\"user_url\").value;\n const description = document.getElementById(\"user_description\").value;\n var exists = false;\n var upvotes = 0;\n\n // check if url exis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CompositePromise fires when all the promises given us are fired
function CompositePromise() // pass list of promises here { Promise.apply(this); this.members = []; if(arguments.length) { this.addPromise(arguments); } }
[ "function callAllEventListeners() {\n\t\t\tpendingPromises.forEach(function (pendingPromise) {\n\t\t\t\tcallCapturedEventListeners(pendingPromise.eventArguments);\n\t\t\t});\n\n\t\t\tcallCapturedEventListeners(eventArguments);\n\t\t}", "onComplete(promises, cb) {\n Promise.all(promises).then(() => cb(), () => ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tool: [large]...[/large] (large font)
function editor_tools_handle_large() { editor_tools_add_tags('[large]', '[/large]'); editor_tools_focus_textarea(); }
[ "function editor_tools_handle_small() {\n editor_tools_add_tags('[small]', '[/small]');\n editor_tools_focus_textarea();\n}", "function smallText(t, x, y) {\n noStroke();\n fill(200);\n textSize(12);\n textStyle(NORMAL);\n text(t, x, y);\n}", "function displaySmallText(string) {\n push();\n fill(wh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Section Feature: Filtering / Function: _fnFeatureHtmlFilter Purpose: Generate the node required for filtering text Returns: node Inputs: object:oSettings dataTables settings object
function _fnFeatureHtmlFilter ( oSettings ) { var nFilter = document.createElement( 'div' ); if ( oSettings.sTableId !== '' && typeof oSettings.aanFeatures.f == "undefined" ) { nFilter.setAttribute( 'id', oSettings.sTableId+'_filter' ); } nFilter.className = oSettings.oClasses.sFilter; var sSpac...
[ "function _fnFeatureHtmlFilter ( oSettings )\n\t\t{\n\t\t\tvar nFilter = document.createElement( 'div' );\n\t\t\tif ( oSettings.sTableId != \"\" )\n\t\t\t{\n\t\t\t\tnFilter.setAttribute( 'id', oSettings.sTableId+'_filter' );\n\t\t\t}\n\t\t\tnFilter.className = \"dataTables_filter\";\n\t\t\tnFilter.innerHTML = oSett...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function used for updating bars group with new tooltip
function updateToolTip(data, chosenYAxis, barsGroup) { if (chosenYAxis === "total_bottle_sold") { var label = "Total Bottles Sold: "; } else if (chosenYAxis === "total_volume_l") { var label = "Total Liters Sold: "; } else if (chosenYAxis === "total_sale") { var label = "Sale Dollars: "; } v...
[ "function updateToolTip(chosenXAxis, barsGroup) {\n\n if (chosenXAxis === \"homewin\") {\n var label = \"Home Win Rate\";\n } else {\n var label = \"Average Home Score\";\n }\n\n var toolTip = d3.tip()\n .attr(\"class\", \"d3-tip\")\n .offset([20, 20])\n .html(function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Formats |time| to be displayed according to the |format|. The |time| is expected to be a UNIX timestamp in millisecond granularity in the UTC timezone.
static format(time, format) { const localDate = DateUtils.toTargetTimezone(time); switch (format) { case DateUtils.FORMAT_ISO_8601: return DateUtils.formatDate(localDate) + 'T' + DateUtils.formatTime(localDate, true /* includeSeconds */) + ...
[ "function formatTime(time, format)\r\n{\r\n var resultTime = time;\r\n // Set the right time separator.\r\n if (resultTime) {\r\n if (format.indexOf(\":\") > -1)\r\n resultTime = resultTime.replace(/\\./g, ':');\r\n else if (format.indexOf(\".\") > -1)\r\n resultTime = resultTime.replace(/:/g, '....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cell click handeler which finding selected item, index amd passing to the possibleMove function
function onItemClick(ev) { const itemIndex = puzzleData.findIndex(item => item.el === ev.currentTarget); const possibleMoveIndex = possibleMove(itemIndex); if (possibleMoveIndex === false) { return; } moveItem(puzzleData[itemIndex], possibleMoveIndex, itemIndex); ...
[ "selectMove(index, place) {\n\t\tconst side = place === 1 ? 'L' : 'R';\n\t\tthis.$('#resultMove' + side + (index+1)).click();\n\t\tthis.$('#resultMove' + side + (index+1)).click();\n\t}", "function possibleMovements() {\n // this is the cells id that was clicked\n var id = this.id;\n \n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the part of the token after the first nonvowel following a vowel
function getR1(token) { var match = token.match(/[aeiouyæåø]{1}[^aeiouyæåø]([A-Za-z0-9_æøåÆØÅäÄöÖüÜ]+)/); if (match) { var preR1Length = match.index + 2; if (preR1Length < 3 && preR1Length > 0) { return token.slice(3); } else if (preR1Length >= 3) { return match...
[ "function getFirstVowel(value) {\n\n}", "function firstVowelIndex(str){\n for (var i = 0; i < str.length; i++) {\n if (isVowel(str.charAt(i))) {\n return i; \n }\n }\n //no vowels were found, so return middle index of word\n return Math.floor(str.length/2);\n}", "function en...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Supporting functions for searching hashtable buckets
function searchBuckets(buckets, hash) { var i = buckets.length, bucket; while (i--) { bucket = buckets[i]; if (hash === bucket[0]) { return i; } } return null; }
[ "function searchBuckets(buckets, hash) {\n var i = buckets.length, bucket;\n while (i--) {\n bucket = buckets[i];\n if (hash === bucket[0]) {\n return i;\n }\n }\n return null;\n }", "function search...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to delete a url by it's key in Redis
redisDelete(url) { client.del(url.shortURL, (err, reply) => { if (err) reject(err); }); }
[ "static removeUrl( key, index, callback ) {\n /* 複数Urlに対応 */\n //対応しようと思ったのだが、hdelはarrayでフィールド指定ができないため一括削除することをデフォルトで想定していないと見た。\n\n let url; //削除するurl(swap用)\n client.multi()\n .hkeys( key, function( err, _urlArray ) {\n //本来ならばここで_urlArray[index] !== undefined の判定が必要だが、これをあえて見逃すことでundefinedとい...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open print preview in popup window to enable simple printing for the user.
function openPrintPreview(type, id, child_id, revision, print_action) { // configure window size using cookies or default values if there are no cookies var width = getCookie("ReqPopupWidth"); var height = getCookie("ReqPopupHeight"); var windowCfg=''; var feature_url = print_action; if (width == null) { ...
[ "function PrintPreview() {\n var toPrint = document.getElementById('printSection');\n var popupWin = window.open('', '_blank', 'width=550,height=350,location=no,left=200px');\n popupWin.document.open();\n popupWin.document.write('<html><title>::Print Preview::</title></head><body\">')\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends a float (4 bytes) value to the dps
async SendValueFloat(id, command, value) { var floatBuf = new Float32Array(2); floatBuf[0] = value; var byteBuf = new Uint8Array(floatBuf.buffer); var packet = new DpsPacket(id, DpsConstants.sender, command, [...byteBuf]); return await this.PacketIO(packet); }
[ "writeFloat(value){return this.__writeFloatingPointNumber(value,4),this}", "set floatValue(value) {}", "writeBinaryFloat(n) {\n this.writeUInt8(4);\n const buf = this.reserveBytes(4);\n buf.writeFloatBE(n);\n if ((buf[0] & 0x80) === 0) {\n buf[0] |= 0x80;\n } else {\n // We complement t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if all visible images are loaded and update container height if it's done
function doAutoHeight () { var imgs = getImageArray.apply(null, getVisibleSlideRange()); raf(function(){ imgsLoadedCheck(imgs, updateInnerWrapperHeight); }); }
[ "function runAutoHeight() {\n // get all images inside visible slider items\n var current = getCurrent(), images = [];\n\n for (var i = sliderCountUpdated; i--;) {\n if (i >= current && i < current + items) {\n var imagesTem = sliderItems[i].querySelectorAll('img');\n for (va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Minifying images by imagemin
function imgMinify() { // return src('src/img/*') return src(files.imgPath) .pipe(imagemin([ imagemin.gifsicle({ interlaced: true }), imagemin.jpegtran({ progressive: true }), imagemin.optipng({ optimizationLevel: 5 }), imagemin.svgo({ plugins: [ { removeViewBox: true }...
[ "function imageMin() {\n return gulp\n .src([\"assets/img/*\", \"!assets/img/compact/\", \"!assets/img/webp/\"])\n .pipe(\n imagemin([\n imagemin.gifsicle({ interlaced: true }),\n imagemin.mozjpeg({ quality: 20, progressive: true }),\n imagemin.optipng({ optimizationLevel: 5 }),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set operator sign to calculate
setSign(sign) { if (!this.operator) { this.operator = sign; } else if (!this.lastValue) { this.operator = sign; } else { this.getResult(sign); } this.displayOperator = (this.operator === '*') ? 'x' : this.operator; var displayHtml = (t...
[ "function changesign() {\n if( op === \"none\") {\n x = -1 * x;\n document.getElementById(\"monitor\").innerHTML = x.toString();\n }\n else {\n y= -1 * y ;\n document.getElementById(\"monitor\").innerHTML = x.toString() + op +\"(\"+ y.toString()+\")\";\n }\n}", "get sign() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Spawn a number of particles
addParticle(num) { num = typeof num === 'undefined' ? 1 : num; for (let i = 0; i < num; i++) { let p = new Particle(this.pos.x, this.pos.y, this.minSpeed, this.maxSpeed); applyTemplate(p, this.particleTemplate); p.init(); this.particles.push(p); } ...
[ "function add_particles(x, y, num) {\n for (var j = 0; j < num; j++) {\n spawn(x, y);\n }\n}", "function generateParticles() {\r\n\tfor(var i = 0; i < startingParticles; i++) {\r\n\t\t//var position = new Position(200,200);\r\n\t\tparticles[i] = new Particle(new Position(), randomVelocity(), particle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An array to track all the avaliable image types / Start Presentation This method sets the current slide to a blank, default page and the next slide to the first slide in the deck. The next slide is buffered in the hidden frame, ready to be displayed once loaded.
function startPresentation() { var delay = 200; //The delay, in MS, before buffering the next slide var index = 0; //Tracks the position of the next slide in the slide deck //Show elements $("#transitionDiv").show(); $("#currentSlideHeading").show(); $("#nextSlideHeading").show(); //D...
[ "function setup_slideshow() {\n slide_count = img_array.length;\n current_slide_index = 0;\n set_current_slide(img_array[0].src);\n play();\n}", "function js_startSlide() {\n reset();\n sliderImages[0].style.display = 'block'; // Show image 1.\n temporal[current].innerHTML = current + 1 + \"/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a snowFlake and HTMLelements containing the flake image.
function createFlake(x,y){ var i; // Creates a new snowFlake object with location and id: flake=new snowFlake(x,y, "snowFlake"+1); // Creates an img element for the flake and appends it to body: var flakeElem = document.createElement("img"); // Creates and sets an src attribute to the flakeElem: var s...
[ "function generateSnowflakes() {\n\n // get our snowflake element from the DOM and store it\n var originalSnowflake = document.querySelector(\".snowflake\");\n\n // access our snowflake element's parent container\n var body = originalSnowflake.parentNode;\n bod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
grab story code from player details
function getStoryCode() { playerStoryCode = playerDetails.storyCode; }
[ "function getLocCode() {\r\n\tplayerLocCode = playerDetails.locCode;\r\n}", "function get_story_data(e) {\n response = $.ajax({\n type: 'GET',\n url: '/editor/open_story/' + e.target.id,\n async: false\n });\n\n if (response['status'] != 200) {\n story_data = editor.getOpenSto...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Uploads splashImg to server using collateral api and request form post. Returns relative path to the splash image used by createMiniReel.
function createSplashImage() { var postOpts = { url: uploadUrl, headers: { 'Cookie': authCookie } }, deferred = q.defer(); if (!fs.existsSync(splashImg)){ return q.reject('Cannot find splashImg file: ' + splashImg); } console.log('Upload splash image (...
[ "function createMiniReel(splashPath) {\n\n // Set the splash image using path obtained via createSplashImage\n newMiniReel.data.collateral.splash = '/' + splashPath;\n\n var postOpts = {\n url: expUrl,\n json: newMiniReel,\n headers: {\n 'Cookie': authCookie\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Language: dsconfig Description: dsconfig batch configuration language for LDAP directory servers
function dsconfig(hljs) { var QUOTED_PROPERTY = { className: 'string', begin: /"/, end: /"/ }; var APOS_PROPERTY = { className: 'string', begin: /'/, end: /'/ }; var UNQUOTED_PROPERTY = { className: 'string', begin: '[\\w-?]+:\\w+', end: '\\W', relevance: 0 }; var VALUELESS_PRO...
[ "function dsconfig(hljs) {\n var QUOTED_PROPERTY = {\n className: \"string\",\n begin: /\"/,\n end: /\"/\n };\n var APOS_PROPERTY = {\n className: \"string\",\n begin: /'/,\n end: /'/\n };\n var UNQUOTED_PROPERTY = {\n className: \"string\",\n begin: \"[\\\\w-?...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle Network Setup screen "Add WiFi network" button.
openAddWiFiNetworkDialog_() { chrome.send('launchAddWiFiNetworkDialog'); }
[ "add() {\n // Create a network\n let buffer = execSync( WPA_USER_PREFIX + '\"wpa_cli add_network\"' );\n this.id = buffer.toString(\"utf-8\").split(\"\\n\")[1];\n\n // Enter the ssid\n execSync( WPA_USER_PREFIX + '\"wpa_cli set_network ' + this.id + ' ssid \\'\\\\\\\"' + this.ssid...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
construct the model transform matrix, based on model state
function makeModelTransform(currModel) { var zAxis = vec3.create(), sumRotation = mat4.create(), temp = mat4.create(), negCtr = vec3.create(); // move the model to the origin mat4.fromTranslation(mMatrix,vec3.negate(negCtr,currModel.center)); // scale for highlighting if neede...
[ "function computeModelTransform( state ) {\n\n\t\tvar modelTranslation = state.modelTranslation;\n\n\t\tvar modelRotation = state.modelRotation;\n\n\t\tvar translationMat\n\t\t\t= new THREE.Matrix4().makeTranslation(\n\t\t\t\tmodelTranslation.x,\tmodelTranslation.y, modelTranslation.z );\n\n\t\tvar rotationMatX =\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the critical tvalue
tCrit() { // This doubles as an "undefined" check if (this.tCrit.alpha != self.psig || this.tCrit.df != this.terms[0].col().shape[0] - this.terms.length) { this.tCrit.alpha = self.psig; this.tCrit.df = this.terms[0].col().shape[0] - this.terms.length; this.tCrit.t = tdistr(this.tCrit.df, this....
[ "getValue(t) {\n if (this.solutionType === SolutionType.CRITICALLY_DAMPED) {\n assert && assert(this.angularFrequency !== undefined);\n return (this.c1 + this.c2 * t) * Math.exp(-this.angularFrequency * t);\n } else if (this.solutionType === SolutionType.UNDER_DAMPED) {\n assert && assert(this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls all pending callbacks with an exception (process exited before receving callback) and forwards the given error to child_exit_callback. Also clears ping interval.
onExit(e) { this.onExit = null; if (this.pingIntervalId) { clearInterval(this.pingIntervalId); this.pingIntervalId = null; } if (this.init_cb) { this.init_cb(new Error(this.log_prefix + "Process exited before response_init from child was received.")); ...
[ "_exitHandler(childProcess) {\n winston.log('debug', 'childProcess with pid just exited', childProcess.pid)\n var index = this._forks.indexOf(childProcess);\n this._forks.splice(index, 1);\n winston.log(\"debug\", \"Forks open \", this._forks.length);\n this._run();\n\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Above it generates two random numbers between 0 and 19 for two text boxes.
function randomWholeNum() { document.getElementById("boxa").value = a; document.getElementById("boxb").value = b; var a = randomNumberBetween0and19a; var b = randomNumberBetween0and19b; }
[ "function generate() {\n setLengthAndReadability();\n\n var readableSubstringLength = Math.floor(((readabilityVal / 100) * lengthVal) - 1);\n\n // if readability is -1, set to 0 so its an empty string\n if (readableSubstringLength < 0) {\n readableSubstringLength = 0;\n }\n\n var unreadable...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Atul : this function scans all model collection and find out models which are customized load model JSON and merge model definitions
function mergeCustomizedModels(allModels, modelPathMap, options) { let customizedModels = Object.keys(allModels).filter(function (k) { return (allModels[k].customModel || allModels[k].customizedModel || allModels[k].isCustomized); }); for (let i = 0; i < customizedModels.length; ++i) { let mergedModel = ...
[ "function generateModels() {\n var att = '',\n name = '',\n schemaName = '',\n schema = {},\n modelName = '',\n modelParent = null,\n modelExt = null,\n modelDef = null,\n model = {},\n models = {},\n mergedModel = {},\n parents = [],\n length = 0,\n i = 0,\n j = 0,\n n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the current token to the pile and reset the buffer.
function addToken() { token.end = { line: line, col: column }; DEBUG && debug('addToken:', JSON.stringify(token, null, 2)); tokens.push(token); buffer = ''; token = {}; }
[ "function addToken() {\n token.end = {\n line: line,\n col: column\n };\n\n tokens.push(token);\n\n buffer$$1 = '';\n token = {};\n }", "function addToken() {\r\n token.end = {\r\n line: line,\r\n col: column\r\n };\r\n\r\n DEBUG && debug('addToken:', JSON.stringify(to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the handler for DOM events that would lead to a change in the model (i.e. change, sometimes, input, and occasionally click and keyup)
function handleDomEvent () { this._ractive.binding.handleChange(); }
[ "function handleDomEvent () {\n\t\tthis._ractive.binding.handleChange();\n\t}", "function handleDomEvent () {\n\tthis._ractive.binding.handleChange();\n}", "function handleDomEvent() {\n this._ractive.binding.handleChange();\n}", "elementUpdated() {\n this.model.trigger('el:change');\n }", "function Ha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the text value in three viewport of bar chart
setTextValues() { const dataset = this.settings?.dataset; if (!dataset || (dataset && dataset.constructor !== Array)) { return; } const elems = this.element[0].querySelectorAll('.bar-chart .axis.y .tick text'); const brief = {}; if (this.ellipsis.use) { brief.maxWidth = this.element....
[ "setBarLabel(text) { this._behavior('set bar label(text)'); }", "function addBarValues () {\n\t\t\textraChartGroup.append(\"g\").selectAll(\"text\")\n\t\t\t .data(clickedData)\n\t\t\t .enter()\n\t\t\t .append(\"text\")\n\t\t \t\t .attr(\"class\",\"barValues\")\n\t\t\t \t .style(\"font-size\", 11 * sc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to flip the Cards by toggling 'active' class
function flipCard(self) { $(self).toggleClass('active'); }
[ "function cardFlip(){\n card.classList.toggle('is-flipped');\n}", "function toggleFlippedCards() {\n\t for (var i = 0; i < flippedCards.length; i++) {\n\t flippedCards[i].classList.toggle('flipped');\n\t }\n\t}", "function flipCard() {\n if(disableDeck) return;\n if(this===firstCard)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Instruct class to generate a refresh token when generating the jwt token.
withRefreshToken() { this._generateRefreshToken.set(true) return this }
[ "async function generateTokenFromRefreshToken(currentUser, refreshToken, accessTokenLength) {\n\n return jwt.sign({currentUser: currentUser}, process.env.ACCESS_TOKEN_SECRET, {expiresIn: accessTokenLength}); \n \n}", "generateJwtRefreshToken(payload) {\n try {\n return jwt.sign(payload, pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a string. base path of the css folder in the build
function getCSSPath() { return getAssetsPath() + config.build.cssPath; }
[ "get dest() {\n return configs.basePaths.dest + 'css';\n }", "function getProjBasePath() {\n return getHomePath() + '/prjbase';\n}", "function getAssetsPath()\n\t{\n\t\tvar generatorConfigFile = new File(\"~/generator.js\");\n\t\tvar cfgObj = {};\n\t\tvar gao = {};\n\t\tvar baseDirec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Bar Chart Data Compound Takes CSV and generates totals per day
function gatherBarChartDataCompound(interval){ let outputData = []; //generate blank data based on interval rate //first entry let timeDatum={}; timeDatum.date = new Date() timeDatum.date = minimumDate; timeDatum.compoundValue=0; outputData.push(timeDatum) while(outputData[outp...
[ "function fillBarChartData(){\r\n var dailyBudgetForBarChart =\r\n {\r\n label: 'Daily Budget',\r\n fillColor: '#382765',\r\n data: []\r\n };\r\n\r\n var amountSpentForBarChart =\r\n {\r\n label: 'Amount spent',\r\n fillColor:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Configuration for highchart's pie chart
function configureHighchartsPie() { self.chartConfig = { options: { chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false, type: 'pie' ...
[ "function highChartRoundPercentage(arrCategories,arrPercentage){\n Highcharts.chart('story-chart', {\n\n title: {\n text: 'Percentage of number of matches in season with respect to All IPL seasons'\n },\n\n xAxis: {\n categories: arrCategories\n },\n\n series: [{\n type: 'pie',\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updown rotation is restricted to [pi/2, pi/2] to make the camera easier to control.
rotateUp(radians) { const minAngle = -.5 * Math.PI; const maxAngle = -minAngle; this.yzAngle = Math.max(Math.min(this.yzAngle + radians, maxAngle), minAngle); this.applyRotation(); }
[ "rotateUp(radians) {\n const minAngle = -.5 * Math.PI;\n const maxAngle = -minAngle;\n this.yzAngle = Math.max(Math.min(this.yzAngle + radians, maxAngle), minAngle);\n }", "rotateUp () {\n let move = glMatrix.quat.create ();\n let rotation = glMatrix.quat.clone ( this.orientation );\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Calculate aircraft totals for the edited op and display the result on the / Air Ops tab.
function saveAirOperation() { var op = editingOpIdx == -1 ? newOp : airOps[editingOpIdx], ttotal = 0, ftotal = 0, dtotal = 0; op.AircraftTotals = ""; for (var i = 0; i < op.AirOpSources.length; i++) { ttotal += op.AirOpSources[i].TSquadrons; ftotal += op.AirOpSource...
[ "function CalculateAPTotal () {\n\tcurrentTotalAP = Number(artifactLevelCost[currentArtifactLevel][1]) + Number(currentAPinLevel);\n}", "function displayTotalcalories() {\n //Get total calories\n const totalCalories = ItemCtr.getTotalCalories();\n //add total calories to UI\n UICtrl.showTotalCalories(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isMonth (STRING s [, BOOLEAN emptyOK]) isMonth returns true if string s is a valid month number between 1 and 12. For explanation of optional argument emptyOK, see comments of function isInteger.
function isMonth (s) { if (isEmpty(s)) if (isMonth.arguments.length == 1) return defaultEmptyOK; else return (isMonth.arguments[1] == true); return isIntegerInRange (s, 1, 12); }
[ "function isMonth(s) {\r\n if (isEmpty(s))\r\n if (isMonth.arguments.length === 1) return defaultEmptyOK;\r\n else return (isMonth.arguments[1] === true);\r\n return isIntegerInRange(s, 1, 12);\r\n}", "function isMonth (s)\r\n{ if (isEmpty(s))\r\n if (isMonth.arguments.length == 1) return defaultEmpt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a data block for the help_list.html/help_list.txt templates
function getHelpListData(commandsData, context) { commandsData.commands.forEach(addParamGroups); var heading; if (commandsData.commands.length === 0) { heading = l10n.lookupFormat('helpListNone', [ commandsData.prefix ]); } else if (commandsData.prefix == null) { heading = l10n.lookup('helpListAll');...
[ "function buildHelpContents()\n\t{\n\t\tvar pageTpl = '<div class=\"cke_accessibility_legend\" role=\"document\" aria-labelledby=\"' + id + '_arialbl\" tabIndex=\"-1\">%1</div>' +\n\t\t\t\t'<span id=\"' + id + '_arialbl\" class=\"cke_voice_label\">' + lang.contents + ' </span>',\n\t\t\tsectionTpl = '<h1>%1</h1><dl>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the type of the loggedin user or null. The result can be "Practitioner", "Patient" or "RelatedPerson".
getUserType() { const profile = this.getFhirUser(); if (profile) { return profile.split("/")[0]; } return null; }
[ "function getType() {\n\t\t\tvar ans = null;\n\t\t\tif (_this.user.id) {\n\t\t\t\tans = _this.user.tipo;\n\t\t\t}\n\t\t\treturn ans;\n\t\t}", "userType(){\n return (\n JSON.parse(localStorage.getItem('user')).user\n ? JSON.parse(localStorage.getItem('user')).user['usertype'] :\n null);\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get license by user
static getLicenseByUser(params){ return new Promise(async (resolve, reject) => { try { let command = 'getLicenseByUser'; let res = await axios.post(url + command, params); resolve(res.data); }...
[ "function getLicense({license}) {\n //Make a call to get the license\n axios.get(githubCommonLicenses.find(x => x.name === license).url)\n .then((result) => {\n writeToFile('LICENSE.txt', result.data.body);\n })\n // /licenses/\n //Generate the license.txt file\n}", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the accounting period from process date
function setAccountingPeriodFromProcessDate() { if (nlapiGetFieldValue('custpage_2663_process_date') && nlapiGetFieldValue('custpage_2663_postingperiod')) { var accountingPeriod = getAccountingPeriod(nlapiGetFieldValue('custpage_2663_process_date'), true); if (accountingPeriod) { ...
[ "setTimePeriod (state, data) {\n console.log(\"time period setter:\" + data);\n state.timePeriod = data;\n }", "handleHoldPeriodChange(event) {\r\n this.currentHoldPeriodInDays = event.detail.value;\r\n \r\n\r\n this.currentReservationExpirationDate=new Date();\r\n \r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use the given json of nodes and edges to make a force directed graph
function CreateForceDirectedGraph(json) { force .nodes(json.nodes) .links(json.edges) .start(); var edge = svg.selectAll("line.edge") .data(json.edges) .enter().append("line") .attr("class", "edge") .style("stroke-width", function(d) { ...
[ "function createGraphFromNodeEdge(nodes, edges, seriesModel, directed, beforeLink) {\r\n // ??? TODO\r\n // support dataset?\r\n var graph = new data_Graph(directed)\r\n\r\n for (var i = 0; i < nodes.length; i++) {\r\n graph.addNode(\r\n retrieve(\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check to see if all cardmatched variable is less than 7 if so remove card only otherwise remove card and end game
function removeTookCards() { if (cardsmatched < 7){ cardsmatched++; $(".card-removed").remove(); }else{ $(".card-removed").remove(); uiCards.hide(); uiGamerestart.hide(); uiGameInfo.hide(); uiLogo.hide(); uiComplete.show(); var gamecomplete = document.getElementById("gameComplete").getElementsByCl...
[ "function removeTookCards() {\n playSound('match');\n if (cardsmatched < 8){\n cardsmatched++;\n $(\".card-removed\").remove();\n } else {\n $(\".card-removed\").remove();\n EndGame();\n }\n}", "function removeTookCards() {\n\tif (cardsmatched < 8){\n\t\tcardsmatched++;\n\t\t$(\".card-removed\").r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get user condition input field and output to an array of object
function getCondition() { let condition = []; if($("#form1_greaterValue").val()) { var data = { type: "greater", value: Number($("#form1_greaterValue").val()) }; condition.push(data); } if($("#form1_lowerValue").val()) { var data = { type: "lower", value: Number($("#form1...
[ "function setupConditions(conditionType, conditions, $fieldToShow) {\n\n\t\t// find attribute data-show-if or data-required-if\n\t\tvar selector = $fieldToShow.attr('data-' + conditionType + '-if');\n\n\t\t// if attribute wasn't present, skip...\n\t\tif(!selector || selector.length < 1) {\n\t\t\t// consoleLog('#' +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format the a game is over response.
function formatAGameIsOver(bot, target, context) { return "{white.name} vs {black.name} in {leagueName} is over. The result is {result.result}.".format(context); }
[ "function renderGameOver() {\n if (player.lives === 0) {\n var grd = ctx.createLinearGradient(0, 0, 500, 606);\n grd.addColorStop(0, '#b3b3ff');\n grd.addColorStop(1, '#b3e6cc');\n ctx.fillStyle = grd;\n ctx.globalAlpha = 0.8;\n ctx.fillRect(0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
restore last game from stack
restoreGame() { if (this._stack.length === 0) return false; var game = this._stack.pop(); this.board = game.board.clone(); return true; }
[ "function restoreGame() {\n if(!bak) return;\n emit('undo');\n undo_fig = state.next;\n setState(bak);\n bak = null;\n state.undo_enable = false;\n }", "restore() {\n\t\t\t\tthis.position = this.savedStates.pop();\n\t\t\t}", "restoreGame() {\n let saveGame = getStorage('game');\n if (sa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculating ratio from iPhone breakpoints const ratioX = x < 375 ? (x < 320 ? 0.75 : 0.875) : 1; const ratioY = y < 568 ? (y < 480 ? 0.75 : 0.875) : 1 ; Calculate relative width to different iPhone size
function ratioX() { if (x < 375) { return x < 320 ? 0.75 : 0.875 } else if (375 <= x && x < 414) { return 1; } else if (414 <= x && x < 768) { return 1.1; } else if (768 <= x && x < 1024 ) { return 1.5; } else { return 2; } }
[ "function adjustToScreenAspectRatio(){\n\n\tvar iDistance = height / 483.5814286;\n\tvar rDistance = width / 533.33333;\n\n\tminI = -iDistance;\n\tmaxI = iDistance;\n\tminR = -0.4 - rDistance;\n\tmaxR = -0.4 + rDistance;\n}", "function ratioScreen() {\n screenWidth = screen.width;\n screenHeight = screen.he...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Don't modify input layers (mergeDatasets() updates arc ids inplace)
function mergeDatasetsForExport(arr) { // copy layers but not arcs, which get copied in mergeDatasets() var copy = arr.map(function(dataset) { return utils.defaults({ layers: dataset.layers.map(copyLayerShapes) }, dataset); }); return mergeDatasets(copy); }
[ "updateLayers() {\n this.layers = this.canvas.getObjects();\n }", "function mergeLayers() {\r\n var baseRect = base_canvas.getBoundingClientRect();\r\n var baseCtx = base_canvas.getContext(\"2d\");\r\n [...document.querySelectorAll(\"canvas\")].forEach(canvas => {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: getInstructionType(instruction) This function takes an instruction and breaks it down into components. Parameters: instruction trimmed instruction line from assembly code
function getInstructionType(instruction){ // Make each element uppercase and remove any whitespace on the ends instruction = instruction.toUpperCase(); var parsed = instruction.trim().split(/[\s,]+/); var instructionObject; // Memory Instruction if (parsed[0] == "L.D"){ var regVal = pars...
[ "static decodeInstructionType(instruction) {\n this.checkProgramId(instruction.programId);\n const instructionTypeLayout = BufferLayout.u32('instruction');\n const typeIndex = instructionTypeLayout.decode(instruction.data);\n let type;\n\n for (const [ixType, layout] of Object.entries(STAKE_INSTRUCTI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prevents doublesubmits by waiting for a cookie from the server.
function blockResubmit() { var downloadToken = setFormToken(); $('#page-spinner').show(); downloadTimer = window.setInterval(function () { var token = getCookie("downloadToken"); if ((token == downloadToken) || (attempts == 0)) { ...
[ "function blockResubmit() {\n\t\t\tdownloading = true;\n\t\t\tvar downloadToken = setFormToken();\n\t\t\tsetCursor('wait', 'wait');\n\t\t\tdownloadTimer = window.setInterval(function () {\n\t\t\t\tvar token = getCookie('downloadToken');\n\t\t\t\tif ((token === downloadToken) || (attempts === 0)) {\n\t\t\t\t\tunbloc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private Method: altersingle moves neuron i towards biased (b,g,r) by factor alpha
function altersingle(alpha, i, b, g, r){ network[i][0] -= (alpha * (network[i][0] - b)) / initalpha; network[i][1] -= (alpha * (network[i][1] - g)) / initalpha; network[i][2] -= (alpha * (network[i][2] - r)) / initalpha; }
[ "function altersingle(alpha, i, b, g, r) {\n\n // alter hit neuron\n var n = network[i];\n var alphaMult = alpha / initalpha;\n n[0] -= alphaMult * (n[0] - b) | 0;\n n[1] -= alphaMult * (n[1] - g) | 0;\n n[2] -= alphaMult * (n[2] - r) | 0;\n }", "function altersingle(alpha, i, b, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if there is a PacDot or PowerPellet for PacMan to eat
function checkPacDot (){ if (squares[currentPacManIndex].classList.contains("pac-dot")) { squares[currentPacManIndex].classList.remove("pac-dot") updateScore(pacDotScoreValue) pacDotCount++ } else if (squares[currentPacManIndex].classList.contains("power-pellet")) { squares[cu...
[ "pacmanEatDot(pacman, dot, scene){\n\n dot.disable();\n dot.isEaten = true;\n\n pacman.score += 10;\n\n // if super dot, give super power\n if(dot.typeDot === \"super\")\n {\n scene.sounds[\"pacman_extrapac\"].play();\n\n // super state\n pacman.setColor(0xfd6a02); // TODO: to implm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define function to draw one balloon
function drawBalloon(bln) { fill(bln.color) ellipse(bln.x, bln.y, bln.width, bln.height) }
[ "function drawBalloon(x) {\n ctx.fillStyle = \"lightgreen\";\n ctx.beginPath();\n //draws the string\n ctx.moveTo(x, y - 100);\n ctx.lineTo(500, y);\n ctx.stroke();\n //draws the circle\n ctx.beginPath();\n ctx.arc(x, y - 150, 50, 0, 2*Math.PI);\n //draws the knot\n ctx.moveTo(x, y - 100);\n ctx.lineTo(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
endregion region Panel : Random Article
function initializePanel_randomArticle() { panel_randomArticle.show(true); panel_randomArticle.initializeButtons(null, panel_randomizeArticle); panel_randomizeArticle(); }
[ "function RandomizeArticles()\n\t{\n\t\t//rerolls article numbers\n\t\tran1 = Random.Range(1,11);\n\t\tran2 = Random.Range(1,11);\n\t\tran3 = Random.Range(1,11);\n\t\tran4 = Random.Range(1,11);\n\t\tran5 = Random.Range(1,11);\n\t\tran6 = Random.Range(1,11);\n\t\tran7 = Random.Range(1,11);\n\t\tran8 = Random.Range(1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var popupSuccess = '\ Combined ShapeCreated with Avocode.\ ' + data.msg + '\ '; var popupCollapse = '\ Combined ShapeCreated with Avocode.\ ' + data.msg + '\ '; Contact form success var ctimer;
function ContactFormSuccess(data) { console.log('ContactFormSuccess start') // clearTimeout(ctimer) // if(data.rez == true){ // showRezPopups(popupSuccess); // }else{ // showRezPopups(popupCollapse); // } // тест проверка // data.rez = true; // function showRezPopup(rez) { // + i...
[ "function ctt_popupbox() {ct_popupbox(\"err\",\"Test popup box. The quick brown fox jumps over the lazy dog. Something something that is really long. Sprinkles on kittens and raindrops on noses something idk. Test popup box. The quick brown fox jumps over the lazy dog. Something something that is really long. Sprin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a procedure histogram() that takes an array of integers and prints a histogram to the screen. For example, histogram([4, 9, 7]) should print the following:
function histogram(arr) { arr.forEach(function (val) { console.log("*".repeat(val)); }); }
[ "function Histogram(){}", "function hist(array) {\r\n\tvar histogram = [];\r\n\tfor (var i = 0; i < array.length; i++) {\r\n\t\thistogram.push(numOccurrences(array, i));\r\n\t}\r\n\treturn histogram;\r\n}", "function histogram(values = []) {\n for (let i = 0; i < values.length; i++){\n let line = \"\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
organize enabled if !runningOrganize && organizeEnabled disable organize runningOrganize true if runningOrganize runningOrganize false
function organizeCallback() { captchaRetry = 1; if (!runningFollowers && !runningParty && !runningEdit && !runningOffer) { if (!runningOrganize) { if (sortable) { if (sortable.options.disabled) { organizeButtonsEnable(true); } else { organizeButtonsEnable(false); ...
[ "function switchOrganizerFunc(switchOrg) {\r\n switchOrganizer = switchOrg;\r\n if (switchOrg === true) {\r\n console.log(`Organizer has been switched on. You can use all available functionalities.`);\r\n } else {\r\n console.log(`Organizer has been switched off. In order to use it, please sw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the subject should be changed. If it is already changed allow send. Otherwise change it. MessageSend event passed from the calling function.
function shouldChangeSubjectOnSend(event) { mailboxItem.subject.getAsync( { asyncContext: event }, function (asyncResult) { addCCOnSend(asyncResult.asyncContext); //console.log(asyncResult.value); // Match string. var checkS...
[ "function subjectOnSendChange(subject, event) {\n mailboxItem.subject.setAsync(\n subject,\n { asyncContext: event },\n function (asyncResult) {\n if (asyncResult.status == Office.AsyncResultStatus.Failed) {\n mailboxItem.notificationMessages...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
printMatrix(): prints a matrix
function printMatrix(name,matrix) { // matrices are stored column-major, although matrix.set() uses row-major console.log('Matrix ',name); var e = matrix.elements; console.log(e[0], e[4], e[8], e[12]); console.log(e[1], e[5], e[9], e[13]); console.log(e[2], e[6], e[10], e[14]); conso...
[ "function printMatrix(name,matrix) { // matrices are stored column-major, although matrix.set() uses row-major\n console.log('Matrix ',name);\n var e = matrix.elements;\n console.log(e[0], e[4], e[8], e[12]);\n console.log(e[1], e[5], e[9], e[13]);\n console.log(e[2], e[6], e[10], e[14]);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
private functions called when start date is changed
function OnStartDateChanged(sender, eventArgs) { ClearTimeIfNoDate(startDatePickerId, startTimePickerId); FireDateRangeValidator(); }
[ "onStartChanged(start) {\n this.start = start;\n this.loadCalendar();\n }", "_onStartDateChange(e, date) {\n this._generateFieldChangeEvent('startDate', date)\n }", "function _aDateStartDateOnSetTime() {\n vm.$scope.$broadcast('ass-start-date-changed');\n }", "function _...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
WithFade adds behavior for to hide and appear your child
function WithFade({ visible, type, onclickFade, children }) { const classVisible = visible ? 'show' : 'hidden'; const containerElement = document.createElement('div'); const handlePRopagation = (event) => { event.stopPropagation(); } const content = ( <div className={`withFadeComponent ${classVisib...
[ "fadeIn() {\n const self = this;\n const $el = $(this.newContainer);\n // Hide old Container\n $(this.oldContainer).hide();\n\n $el.css({\n visibility: 'visible',\n opacity: 0\n });\n\n TweenMax.to($el, 0.4, {\n opacity: 1,\n onComplete: () => {\n this.done();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the link rule in the given subtree pair that is unsatisfied
function findBadLink(subtreePair, unsatisfiedImplication) { if (unsatisfiedImplication.indexOf("allink") == 0) { unsatisfiedImplication = unsatisfiedImplication.substring(2); } for (var i = 0; i < subtreePair.links.length; i++) { if (subtreePair.links[i].id == unsatisfied...
[ "function findSatisfyingSubtree(subtreePairs, nextRule) {\n if (subtreePairs.length < 1) return null;\n \n for (var j = 0; j < subtreePairs.length; j++) {\n var nextPair = subtreePairs[j];\n \n if (nextPair.transactions === undefined) continue;\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the right square with integer coordinates:
function getSquare(coord) { const x = coord[0]; const y = coord[1]; return document.getElementById((y).toString().concat(" ").concat((x).toString())); }
[ "function squareCoordinates(id) {\n switch(id) {\n case 'square1':\n return 1;\n case 'square2':\n return 2;\n case 'square3':\n return 3;\n case 'square4':\n return 4;\n case 'square5':\n return 5;\n case 'square6':...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to stop print
function stop() { var that = this; printerInterface.stop({}, function (err) { if (err) { setError(err); } requestUpdate(); }); }
[ "function printClosing(){\n\t console.log(\"Goodbye... this is goodbye for good :-:\")\n }", "function jzebraDonePrinting() { }", "function StopPrintService_Click() \n {\n \tSetPrintControlStatus('Pending');\n\t\tif(!IsPrintThreadLocked())\n\t\t{\t \n\t\t\tEnablePrintThreadLock();\n\t\t\tdocument...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pulls out the first item from the first row of results
function extractFirstResult (neoData) { return extractFirstRow(row => row[0], {})(neoData); }
[ "getFirstResultItem() {\n return this.resultItem.first();\n }", "function extractFirstItem (result) {\r\n const data = extractAllItems(result);\r\n if (!data) return null;\r\n \r\n if (data.length > 1) throw new Error(`service.find expected 0 or 1 objects, not ${data.length}. (extractFirstItem)`);\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Click WebElement using Javascript
JsClick(element) { if (typeof element !== 'undefined') { element.isDisplayed().then(() => { element.isEnabled().then(() => { browser.executeScript("arguments[0].click()", element); return this; }); }); ...
[ "function clickElement(ID){\r\n\tdocument.getElementById(ID).click();\r\n}", "static click(element) {\n browser.waitForVisible(element, EXPLICIT_TIMEOUT);\n browser.click(element);\n }", "click() {\n this.node.querySelector('a').click();\n }", "function clickElement(id) {\n document.getEleme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
minify the css bundle
function minify_css() { return gulp.src(paths.dist + 'bundles/app.css') .pipe(minifyCSS({ keepSpecialComments: 0 })) .pipe(gulp.dest(paths.dist + 'bundles/')); }
[ "function minifyCss() {\n return src(paths.css.files)\n .pipe(cssmin({root: paths.css.root}))\n .pipe(dest(paths.dest));\n}", "function minifyAndCompressCSS() {\n return src(paths.css.src)\n .pipe(cleanCSS())\n .pipe(rename({ extname: '.min.css' }))\n .pipe(gulpBrotli(brotliOptions()))\n ....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reconnect tooltips after ajax load
function reconnectTooltips() { $(".tooltip, .tooltip-default").tipTip(); $(".tooltip-ajax").tipTip({ content: function (data) { $.ajax({ url: $(this).attr("href"), success: function (response) { data.content.html...
[ "function loadTooltips() {\n $('.hover-tooltip').tooltip({\n title: hoverGetData,\n html: true,\n container: 'body',\n placement: 'left',\n delay: {\n \"show\": 100,\n \"hide\": 1500\n }\n });\n}", "function load_tooltips() {\n $('[data-toggle=\"tooltip\"]').tooltip()\n}", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `IotSiteWiseProperty`
function CfnAlarmModel_IotSiteWisePropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but receive...
[ "function CfnDetectorModel_IotSiteWisePropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an objec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getPublish Callback for PUT files/id/publish sets isPublic to true on a file document given its id Header params: xtoken: connection token created when user signsin Request params: id: id of document to modify
async function putPublish(req, res) { const key = req.headers['x-token']; // get token from header const userId = await redisClient.get(`auth_${key}`); let user = ''; // find and store user if (userId) user = await dbClient.client.collection('users').findOne({ _id: ObjectId(userId) }); else res.status(401).j...
[ "static async putPublish(request, response) {\n FilesController.setIsPublic(request, response, true);\n }", "async function putUnpublish(req, res) {\n const key = req.headers['x-token']; // get token from header\n const userId = await redisClient.get(`auth_${key}`);\n\n let user = ''; // find and store use...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createCustomStyle will change a style of view while view changing. Parameter : stateName = name of state that going to change for add style of that page.
function createCustomStyle(stateName) { var customStyle = ".material-background {" + " background-color : " + appPrimaryColor + " !important;" + " border-style : none;" + "}" + ".spinner-android {" + ...
[ "function createCustomStyle(stateName) {\n var customStyle =\n \".material-background {\" +\n \" background-color : \" + appPrimaryColor + \" !important;\" +\n \" border-style : none;\" +\n \"}\" +\n \".s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a function that invokes f with its arguments asynchronously as a microtask, i.e. as soon as possible after the current script returns back into browser code.
function async(f) { return function () { var argsToForward = []; for (var _i = 0; _i < arguments.length; _i++) { argsToForward[_i] = arguments[_i]; } promiseimpl.resolve(true).then(function () { f.apply(null, argsToForward); }); }; }
[ "function async(f) {\r\n\t return function () {\r\n\t var argsToForward = [];\r\n\t for (var _i = 0; _i < arguments.length; _i++) {\r\n\t argsToForward[_i] = arguments[_i];\r\n\t }\r\n\t resolve(true).then(function () {\r\n\t f.apply(null, argsToForward);\r\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setup the FacetHandler options.
function getFacetOptions() { var options = paheService.getFacetOptions(); options.scope = $scope; // Get initial facet values from URL parameters (refresh/bookmark) using facetUrlStateHandlerService. options.initialState = facetUrlStateHandlerService.getFacetValuesFromUr...
[ "function setupOptionsPage(options, fresh = true) {\n removeExistingLists();\n removeExistingListStyles();\n setupKeyboardShortcutHandler(options.keyboardShortcut);\n\n addExistingLists(options);\n addExistingListStyles(options);\n // These handlers should only be ran once.\n if (fresh) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
====================================================================== Creates a container for point list indices.
function PointIndices() { /** * The list of indices for points. * Each index is a point. * @private * @type {Array} */ this._indicesPoints = []; }
[ "function PointIndexSet() {\n this._set = {};\n }", "function PointIndex(point, index) {\r\n this.point = point;\r\n this.index = index;\r\n}", "static createIn(container) {\n return internal.instancehelpers.createElement(container, Index, \"indexes\", true);\n }", "function crea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns latest tag. If no tags are created, returns one of root commits WARNING: This task does not care of dryrun switch
function gitLatestTag() { var command = 'git describe --tags --abbrev=0'; return utils.run(command, {silent: true}) .then(function(stdout) { if (!stdout) { var err = new Error('Unexpected tag returned: ' + stdout); err.recoverable = false; throw err; } ...
[ "function latestTag(done) {\n //Get tags sorted by date\n cp.exec(\"git describe --tags `git rev-list --tags --max-count=1`\", function(err, stdout, stderr) {\n if (err) {\n getFirstCommit(done);\n } else {\n done(null, String(stdout).trim());\n }\n });\n}", "static async getTag() {\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the normalized form of a vectortype, by single or triple input
static Normalized(x, y, z) { let vec = new Vec3(x, y, z); if (vec.Magnitude() === 0) return new Vec3(0); return vec.Divide(vec.Magnitude()); }
[ "function normalise_vec3 (v) {\r\n\tvar length = length_vec3 (v);\r\n\treturn [v[0] / length, v[1] / length, v[2] / length];\r\n}", "function normalizeTwoDimensionalVector(vector) {\n\n}", "normalize(outVector, inVector) {\r\n // @todo\r\n }", "function normalized3(vec3){\n var mag = mag3(vec3);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function OnCollissionEnter checks if the lower boundary collides with the ball then transform it to the starting position
function OnCollisionEnter(_other : Collision) { if(_other.gameObject.tag == "Ball") { _other.rigidbody.velocity = Vector3.zero; _other.transform.position = startingPos; } }
[ "handleCollision(climber) {\n\n // distance\n //\n // to calculate the distance between the avalanche and climber\n let d = dist(this.x, this.y, climber.x, climber.y);\n\n // dist()\n //\n // To keep track of the avalanche and the avatar are in contact\n if (d < this.width / 2 + climber.widt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Body View Description view
renderDescView() { const { data } = this.state; return ( <View key="desc" style={styles.descViewContainer} > <View style={styles.descTopContainer} /> <View style={styles.descMainContainer}> <DescView style={styles.descTextContainer} n...
[ "function _addDescriptionBox() {\n\tvar gap = new View();\n\tthis.descriptionMainView = new View();\n\n\tthis.stepDescriptionBoxSurface = new TextareaSurface({\n\t\tplaceholder: 'Enter task description here...'\n\t});\n\n\tvar stepDescriptionBoxModifier = new StateModifier({\n\t\talign: [0.5, 0],\n\t\torigin: [0.5,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get applicable intervals and next change time
function intervalHelper(intervals, time) { var applicable = []; var next = Number.POSITIVE_INFINITY; for (var i = 0; i < intervals.length; i++) { var interval = intervals[i]; var valid = true; if (interval.start) { valid = valid && interval.sta...
[ "constructTimeIntervals() {\n for (var i = 0; i < this.keyFrames.length - 1; i++) {\n this.timeIntervals[i] = this.keyFrames[i + 1].instant - this.keyFrames[i].instant;\n }\n }", "get actualInterval() {\n return this.i.k8;\n }", "function getInterval() {\n let curTime = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete a token by id
function deleteToken(req, res, next) { Token.deleteOne({ _id: req.params.id, user: res.locals.user }) .then(function(token) { if (token.deletedCount === 0) { res.status(404).json({ error: { code: 404, message: `No such token: ${req.params.id}` } ...
[ "async deleteToken(id) {\n const token = await this.getToken(id);\n token.destroy();\n }", "deleteToken({ AccessorID }, callback) {\n return this.request.deleteAsync({\n uri: esc`acl/token/${AccessorID}`,\n })\n .bind(this)\n .asCallback(callback);\n }", "deleteToken (request) {\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Final success handler, success on update with the HLS rendition.
function onUpdateSuccess(data) { console.log("update success!"); console.log(data); var jsonData = $.parseJSON(data); var results = $('<h2>'); results.html("Created Video ID: " + jsonData.result.id); $('#results').append(results); $('#results').css('backgroundColor', '#AFFFB4'); }
[ "function onCreateSuccess(data) {\n console.log('success!');\n console.log(data);\n\n var jsonData = $.parseJSON(data);\n\n if (jsonData.result) {\n createHlsRendition(jsonData.result);\n }\n}", "function updateSuccess() {\r\n /*\r\n close();\r\n createMediaLis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return needed credits for given major/outside
neededCredit(part){ if(part=="major1"){ return Math.max(this.credit1-this.sumCredit(this.major1Courses),0); } else if(part=="major2"){ return Math.max(this.credit2-this.sumCredit(this.major2Courses),0); } else if(part=="outside"){ return Math.max(this.creditOutside-this.sumCredit(this.outsideCourses...
[ "calculateCredits(){\n var localCredits = 0;\n for(var i = 0;i < this.awesomeThings.length; i++){\n\n for(var j = 0 ; j < this.awesomeThings[i].courses.length; j++){\n if(this.awesomeThings[i].courses[j].grade !== \"IP\" && this.awesomeThings[i].courses[j].grade !== \"F\") {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build homogenous transformation matrix. following based on htma[] and sol[] T0[] is the 'T' transform with reference to node at index 0 (zero). T0n is the 'T' matrix for last node with reference to node at index 0 (zero).
function TMhs(htma,sol,T_BaseFrame){ var T0 = []; for(var i=0;i<n;i=i+1){ var RPY = RPYangles(htma[i]); //get old roll angle (RPYangles() returns [[roll],[pitch],[yaw]]) var phiB = RPY[0][0]; //roll var Tb = htma[i]; //transform beform the update var Tz = trotz(sol[15][i][0] + -1...
[ "function TM(nodePath,T_BaseFrame){\n var htma = [];\n var T0 = [];\n for(var i=0;i<(nodePath.length - 1);i=i+1){\n var T = getT(nodePath[i],nodePath[i+1]);\n htma[i] = T;\n if(i == 0){\n var T0n = [\n [T[0][0], T[0][1], T[0][2], T[0][3]],\n [T[1][0], T[1][1], T[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funcion resetear Borrar los integrantes anteriores eliminarIntegrantesAnteriores(); Ocultar los botones de calculo Ocultar los integrantes Ocultar texto resultados
function resetear() { eliminarIntegrantesAnteriores(); ocultarbotonCalculo(); ocultarIntegrantes(); ocultarTextoResultado(); vaciarValorInput(); }
[ "function resetear () {\n borrarIntegrantesPasados();\n ocultarBotonCalculo();\n ocultarIntegrantes();\n ocultarTextoAnalisis();\n}", "function resetear(){\n borrarMiembrosAnteriores();\n ocultarBotonCalculo();\n ocultarResultados();\n}", "function resetTabuleiro(){\n t.celulas = [0, 1, 2, 3, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prompt for confirmation on STDOUT/STDIN
function confirm(msg, callback) { var rl = readline.createInterface({ input: process.stdin, output: process.stdout }); rl.question(msg, function(input) { rl.close(); callback(input == '' || /^y|yes|ok|true$/i.test(input)); }); }
[ "function confirmStdin() {\r\n\tprocess.stderr.write('Would you like to continue? (y/N) ');\r\n\treturn new Promise((resolve) => {\r\n\t\tconst stdin = process.openStdin();\r\n\t\tstdin.addListener('data', (data) => {\r\n\t\t\tconsole.log();\r\n\t\t\tconst input = data.toString().trim().toLowerCase() || 'n';\r\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear old suggestions within list
function clearOldSuggestions(){ const el = document.querySelector('.list-group'); while (el.firstChild) el.removeChild(el.firstChild); }
[ "function ACCclear_suggestions()\n{\n suggestions_list = [];\n}", "function resetSuggestions() {\n suggestions = [];\n $suggestionsContainer.html(\"\");\n $suggestionsContainer.addClass(\"hidden\");\n }", "function clearList() {\n unselect();\n while (elSuggestLi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method to set tile origin and display size
adjustTile(sprite) { // set origin at the top left corner sprite.setOrigin(0); // set display width and height to "tileSize" pixels sprite.displayWidth = this.tileSize; sprite.displayHeight = this.tileSize; }
[ "function setTileSizes() {\n halfTile = settings.tileSize / 2;\n tilesX = cWidth / settings.tileSize;\n tilesY = cHeight / settings.tileSize;\n}", "function resizeTilesetMap(){\r\n\t\tvar scale = scale_convert[currentScale];\r\n\t\tvar h = Math.round((current_data.tiles.bg_h * current_data.tiles.bg_w)/16...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine if all right columns selected
function hasAllRightColumnsSelected() { var allSelected = true; for( var i = 0; i < vm.rhSourceItems.length; i++ ) { if(!vm.rhSourceItems[i].selected) { allSelected = false; break; } } return allSelected; ...
[ "function hasAllRightColumnsDeselected() {\n var allDeselected = true;\n for( var i = 0; i < vm.rhSourceItems.length; i++ ) {\n if(vm.rhSourceItems[i].selected) {\n \tallDeselected = false;\n break;\n }\n }\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends POST request containing json data for the move being made
function postMove(jsonData) { $.ajax({ method : 'POST', url : 'makeMove.html', data : jsonData, dataType : 'json', complete: function(data) { updateBoard(data['responseJSON']); } }); }
[ "function sendBoard(){\n postXhr.open(\"POST\", \"/board\", true);\n postXhr.setRequestHeader(\"Content-type\", \"application/json\");\n postXhr.responseType = 'text';\n postXhr.send(JSON.stringify(state));\n}", "function submitMove() {\n console.log(\"it worked\");\n\n const moveData = {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a base card
constructor() { this.types = new Set(["card"]); this.name = "Base Card"; this.value = 0; this.cost = 0; this.abilities = {}; }
[ "function CreateBasicCard(front,back){\n\t\tthis.front = front;\n\t\tthis.back = back;\n\t\tthis.entireCard = \"[frontCard] , [backCard]\";\n\t}", "function cardGen(){\n\t\t card = $(\"<div class='card float-left'>\");\n\t\t cardImage = $(\"<img class='card-img-top'>\");\n\t\t cardBody = $(\"<div class='card-body...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
"returns only the sentences containing the specified string
function findSentencesContaining(sentences, str) { if (!sentences) throw new Error("sentences is required"); if (!str) throw new Error("str is required"); const upperStr = str.toUpperCase(); let sentence = sentences.filter(n => n.toUpperCase().includes(upperStr)); return sentence; }
[ "function find(stg)\n{\n return sentence.includes(stg);\n}", "function searchInSentence(searchTerm) {\n return sentence.includes(searchTerm);\n}", "function searchString(searchTerm) {\n return sentence.includes(searchTerm);\n}", "function spEng(sentence){\n return sentence.toLowerCase().includes(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
areObjects() returns true if both parameters are objects
function areObjects(obj1,obj2) { return isObject(obj1) && isObject(obj2); }
[ "function objectsAreEqual(obj1, obj2) {\n if (obj1 == undefined || obj2 == undefined) {\n return false;\n }\n\n // scalar values\n if (obj1 == obj2) {\n return true;\n }\n\n // both pointers\n if (obj1.objectId !== undefined && obj1.objectId == obj2.objectId) {\n return true;\n }\n\n // both objec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }