query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Evaluate the Lagrange interpolation polynomial at x = `at` using x and y Arrays that are of the same length, with corresponding elements constituting points on the polynomial.
function lagrange(at, x, y){ var sum = 0, product, i, j; for(var i=0, len = x.length; i<len; i++){ if(!y[i]){ continue; } product = config.logs[y[i]]; for(var j=0; j<len; j++){ if(i === j){ continue; } if(at === x[j]){ // happens when computing a share that is in the list of shares used ...
[ "function linear_interpolate(x, x0, x1, y0, y1){\n return y0 + ((y1 - y0)*((x-x0) / (x1-x0)));\n}", "function polyEval(evalPoint, constTerm, ...coeffs) {\n return add(constTerm, ...coeffs.map((c, j) => c.mul(scalar(evalPoint).toThe(scalar(j+1)))))\n}", "function interpolate(x, xl, xh, yl, yh) {\n var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This should fire off `ChildActivationStart` events for each route being activated at this level. In other words, if you're activating `a` and `b` below, `path` will contain the `ActivatedRouteSnapshot`s for both and we will fire `ChildActivationStart` for both. Always return `true` so checks continue to run.
function fireChildActivationStart(snapshot, forwardEvent) { if (snapshot !== null && forwardEvent) { forwardEvent(new ChildActivationStart(snapshot)); } return of(true); }
[ "function activeRoute(routeName) {\n return window.location.href.indexOf(routeName) > -1 ? true : false\n }", "function activateCurrentComponents() {\n\t\tcurrentChild.children('.koi-component')\n\t\t\t.removeClass('deeplink-component-disabled')\n\t\t\t.trigger('load-component');\n\t}", "function OnLevelWas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize the query. Calls itself recursively if there are 'dynamic' entries deeper down in the query.
_init_query(config, parent_keys) { parent_keys = parent_keys || []; if (config.one_required) { this._add_one_required(config.one_required, parent_keys); } if (!config.query) { throw `Trying to initialize datasource without query (${this.get_id()})`; } ...
[ "fillPopulations(query) {\n if(this.populations && this.populations.length) {\n this.populations.forEach(function (populateObj) {\n query = query.populate(populateObj)\n })\n }\n\n return query\n }", "_getQueryBy(callback) {\r\n var query = new Query(); // Create a new instance f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
publish to the team that the user has been added, and publish to the user that they've been added to the team
async publishAddToTeam (teamId) { // get the team again since the team object has been modified, // this should just fetch from the cache, not from the database const team = await this.data.teams.getById(teamId); await new AddTeamPublisher({ request: this, broadcaster: this.api.services.broadcaster, us...
[ "async publishPost () {\n\t\tif (!this.post.get('teamId')) { return; }\n\t\tawait new PostPublisher({\n\t\t\tdata: this.responseData,\n\t\t\trequest: this,\n\t\t\tbroadcaster: this.api.services.broadcaster,\n\t\t\tteamId: this.post.get('teamId')\n\t\t}).publishPost();\n\t}", "publish() {\n if (Meteor.isServer)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`fail` is a general way to quit when a fatal error has occurred. If `exitFn` hasn't been set, it will simply do a `process.exit`.
function fail(errcode) { if (typeof(errcode) === 'undefined') { errcode = 1; } if (exitFn) { exitFn(errcode); } else { process.exit(errcode); } return null; }
[ "function failure() {\n process.exit(ExitCode.Failure);\n}", "function failedTestFn() {\n throw new Error('test failed');\n }", "function exit(message, code = 1) {\n if (code === 0) {\n log(message);\n }\n else {\n error(message);\n }\n process.exit(code);\n}", "function ex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Preconditions: this._multiCanvas must have been set
_resetMultiCanvas() { const numFrames = parseFloat(this._range.getAttribute("max")); for (const data of this._multiCanvas) { data.context.clearRect(0, 0, data.canvas.width, data.canvas.height); data.canvas.setAttribute("width", this._canvasWidth); data.canvas.setAttribute("height", 1); d...
[ "initCanvas() {\n // Create new canvas object.\n this._canvasContainer = document.getElementById(this._canvasId);\n if (!this._canvasContainer)\n throw new Error(`Canvas \"${this._canvasId}\" not found`);\n // Get rendering context.\n this._canvas = this._canvasContaine...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: setParameter DESCRIPTION: set userdefined property in parameter object. Preserves original parameter object if performed on editable instance. See makeEditableCopy(). ARGUMENTS: name property name string value property value RETURNS: none
function ServerBehavior_setParameter(name, value) { if (this.bInEditMode) { this.applyParameters[name] = value; } else { this.parameters[name] = value; } }
[ "function Parameter(parent, name, param, mval, bval) {\n this.getClass = function() { return \"Parameter\" };\n this.parent = parent;\n this.name = name;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called if the user implicitly/explitly modifies the current shared ontologies
function _sharedOntologiesUpdated(newSharedOntologyIds, oldSharedOntologyIds) { //console.debug("_sharedOntologiesUpdated::", newSharedOntologyIds); var invalidIntegrationColumns = self.getIntegrationColumns().filter(function(column) { return newSharedOntologyIds.indexOf(column.o...
[ "handleApproachChanged() {\n if (this.currentApproachName.startsWith('RN')) {\n this.approachMode = WT_ApproachType.RNAV;\n if (this.currentLateralActiveState === LateralNavModeState.APPR) {\n this.isVNAVOn = true;\n }\n \n if (this.currentVerticalActiveState === VerticalNavModeSt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the part owner
function create_owners(attempt, username, cb) { const channel = helper.getChannelId(); const first_peer = helper.getFirstPeerName(channel); var options = { peer_urls: [helper.getPeersUrl(first_peer)], args: { part_owner: username, owners_company: process.env.part_company } }; parts_lib.regist...
[ "function create_assets(build_parts_users) {\r\n\tbuild_parts_users = misc.saferNames(build_parts_users);\r\n\tlogger.info('Creating part owners and parts');\r\n\tvar owners = [];\r\n\r\n\tif (build_parts_users && build_parts_users.length > 0) {\r\n\t\tasync.each(build_parts_users, function (username, owner_cb) {\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Preview image from saved content image path value.
_previewImageByPath() { let imagePath = $("textarea#page_content_value").val(); let mediaDetailRoute = Routing.generate('reaccion_cms_admin_media_detail_by_path'); $("div#selected_image_preview").removeClass("d-none"); // load media data $.post(mediaDetailRoute, { 'path' : imagePath }, function(response) ...
[ "function rexShowMediaPreview() {\n var value, img_type;\n if($(this).hasClass(\"rex-js-widget-media\"))\n {\n value = $(\"input[type=text]\", this).val();\n img_type = \"rex_mediabutton_preview\";\n }else\n {\n value = $(\"select :selected\", this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a number or percentage label for the national lines depending on the data being displayed
function setNationalLabel(label, nationalData) { if (label.search("Percentage") > -1) { return "National " + Math.round(nationalData * 100) + "%"; } else { return "National " + nationalData; } }
[ "function yLabelPosFormatter(y) {\n if (isNaN(y)) { return 'n/a'; }\n y = Math.round(y);\n return y === 0 ? 'P1' : 'P' + -y;\n }", "function getLargestLabel() {\n return formatData(-88000000000, 1);\n}", "labelCurrentTrack() {\n\t\tlet labl = 'empty';\n\t\tif (this.trks[tpos].usedInstrument...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cut out query items from the records array. Returns ARRAY.
function spliceArray(query, record) { return R.difference(record, query); }
[ "filterPriceArray(startInd, stopInd) {\n var array = this.priceArray.slice(startInd, stopInd);\n return array.filter((row) => { return row.Open != null;});\n }", "toArray() {\n const keys = this[ _schema ].keys,\n data = this[ _data ],\n changes = this[ _cha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the various data displays based on an input sequence.
function updateData(inputSequence) { var rnaFlag = isRNA(inputSequence); var mostFrequent = kmerMostFrequent(inputSequence, 4); $('#most-frequent').html(mostFrequent.toString()); $('#most-frequent-copy').html(mostFrequent[0]); $('#gc-content').html(Math.floor(gcContent(inputSequence) * 100) + "%")...
[ "function updateDisplayNum(){\n var totalCount = 0; // total numver of qualified anatomy annotations\n var matchCount = 0; // total matched number of filtered anatomy annotations\n var item = null;\n\n for(var i = 0; i < vm.annotationModels.length; i++){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
kebabToSnake() replace ""s with "_"s in input string
function kebabToSnake(str){ // while(str.indexOf("-") > 0) { // str = str.replace("-", "_"); // } return str.replace(/-/g, "_"); }
[ "function kebabToCamel(s) {\r\n return s.replace(/(\\-\\w)/g, function (m) { return m[1].toUpperCase(); });\r\n}", "function keyify(str) {\r\n str = str.replace(/[^a-zA-Z0-9_ -]/g, '');\r\n str = trim(str);\r\n str = str.replace(/\\s/g, '_');\r\n return str.toLowerCase();\r\n}", "function addunderscores(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
radian_oh calculates degrees using opposite and hypotenuse lengths(applies inverse sine)
function theta_oh(o,h) { console.log((Math.asin(o/h))*180/Math.PI) }
[ "function radian_ah(a,h) {\n console.log(Math.acos(a/h))\n}", "function radian_oa(o,a) {\n console.log(Math.atan(o/a))\n}", "function tan (angle) { return Math.tan(rad(angle)); }", "function omtrek (diameter) {\n return diameter * Math.PI;\n}", "function sin (angle) { return Math.sin(rad(angle)); }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all cells within a given radius of a cell at a specified resolution
function getCellsInRadius(cell, radius, resolution) { let centerCell; if (!resolution) { // Transform passed cell to default resolution centerCell = transformCellToResolution(cell, DEFAULT_RESOLUTION); } else { // Transform passed cell to passed resolution centerCell = trans...
[ "function findGridAll(x, y, radius) {\n const c = grid.cells.c;\n let found = [findGridCell(x, y)];\n let r = Math.floor(radius / grid.spacing);\n if (r > 0) found = found.concat(c[found[0]]); \n if (r > 1) {\n let frontier = c[found[0]];\n while (r > 1) {\n let cycle = frontier.slice();\n fron...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
position left and right arrows
function positionArrows() { // Position left arrow leftArrow.style.left = menu.offsetLeft - 32 + "px"; leftArrow.style.top = menu.offsetTop + menu.offsetHeight / 2 - 25 + "px"; // Position right arrow rightArrow.style.top = menu.offsetTop + menu.offsetHeight / 2 - 25 + "px"; rightArrow.style.left = menu.of...
[ "positionate () {\n foreach(arrow => arrow.positionate(), this.arrows)\n }", "displayLeft() {\n image(arrowImg[3], this.arrowLeftX, this.arrowLeftY, this.size, this.size)\n }", "function toggleButton() {\n leftPosition == 0 ? arrowLeft.hide() : arrowLeft.show();\n Math.abs(leftPosition) >= innerBo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns path of the latest URL recorded in onBeforeRequest()
function getLastHookedPath() { const path = lastHookedRequestUrl.pathname + lastHookedRequestUrl.search; window.domAutomationController.send(path); }
[ "function getLastPath() {\n if (url.path.components.length > 0) {\n return url.path.components[url.path.components.length - 1];\n }\n }", "function getPath() {\n //this gets the full url\n var url = document.location.href, path;\n // first strip \n path = url.substr(url.ind...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Commits, made by an author, and an optional different committer, contain a message, an associated :class:`gitteh::Tree`, and zero or more parent :class:`gitteh::Commit` objects. Zero parents generally indicate the initial commit for the repository. More than one parent commits indicate a merge commit. Properties: id: (...
function Commit(repository, obj) { this.repository = repository; obj.author = new Signature(obj.author); obj.committer = new Signature(obj.committer); _immutable(this, obj).set("id").set("tree", "treeId").set("parents").set("message").set("messageEncoding").set("author").set("committer"); }
[ "parentHashes(str) {\n if (Objects.type(str) === 'commit') {\n return str.split('\\n')\n .filter(line => line.match(/^parent/))\n .map(line => line.split(' ')[1]);\n }\n }", "function formatCommitInfo( line ) {\n // Result is in format e.g. d748d93 1465819027 committer@email.com A com...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide the loading layer
function hideLoading() { animate(loadingDiv, { opacity: 0 }, { duration: options.loading.hideDuration, complete: function() { css(loadingDiv, { display: NONE }); } }); loadingShown = false; }
[ "function showLoading() {\n loader.hidden = false;\n quoteContainer.hidden = true; \n}", "showLoader () {\n if (this.hideLoader) return\n this.loadingWrapper.style.display = 'flex'\n this.canvas.style.display = 'none'\n }", "function hideProcessing(){\n vm.processing = false;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
round the coordinates down for some perhaps overlyprecise input
function roundCoordinates(num) { return Math.round(num * 10000) / 10000 }
[ "function fixLatLng(latlng) {\n\t\t\tlatlng[0] = latlng[0] * 2.6232 - 80.1968;\n\t\t\tlatlng[1] = latlng[1] * 1.964 + 159.8395;\n\t\t\treturn latlng;\n\t\t}", "function convertCoordinates (ele)\r\n\t{\r\n\t\tvar gps = coordinates (ele); //gets the coordinates of the puzzle piece\r\n\r\n\t\tvar l = parseInt (gps[0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Look for a existing file from a number of alternatives.
async function findFileMatch( basePath, path, exts, defaultPath ) { // Iterate over the list of file extensions and test for each one. for( const ext of exts ) { const filePath = Path.join( basePath, `${path}.${ext}`); if( await exists( filePath ) ) { return filePath; } }...
[ "function find( filePath ){\n\tvar i,\n\t\tpathData = path.parse( filePath ),\n\t\tisAbsolute = path.isAbsolute( filePath ),\n\t\tMap = isAbsolute ?\n\t\t\t{\n\t\t\t\t'$BASE' : pathData.dir,\n\t\t\t\t'$DIR' : '',\n\t\t\t\t'$NAME' : pathData.name,\n\t\t\t\t//If no extension, then use the Current one\n\t\t\t\t'$EXT' ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
stockInfoURL() gets stock information based on stock symbol
function stockInfoURL(sym) { var queryURL; queryURL = IEXEndpoint + sym + IEXSuffix; console.log("in stockInfoURL -- queryURL: " + queryURL); $.ajax({ "method": "GET", "url": queryURL }). done((response) => { console.log("stock info response: " + JSON.stringify(response)); ...
[ "function stockInfoURL(sym) {\n var queryURL;\n\n queryURL = IEXEndpoint + sym + IEXSuffix;\n console.log(\"in stockInfoURL -- queryURL: \" + queryURL);\n\n $.ajax({\n \"method\": \"GET\",\n \"url\": queryURL\n }).\n then((response) => {\n console.log(\"stock info response: \" + JSO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate a SKILL command
function validateSkill (data, command) { var invalidMsg = 'Invalid Command - (' + command.member.displayName() + ' SKILL): '; var skill = new Skill(command.name, data); if (!command.name) { throw new Error(invalidMsg + 'command must include a skill name.'); } else if (!skill.is_set) { ...
[ "function validateItem (data, command) {\n var invalidMsg = 'Invalid Command - (' + command.member.displayName() + ' ITEM): ';\n var item = new Item(command.name, data);\n var ability;\n\n if (!command.name) {\n throw new Error(invalidMsg + 'command must include an item name.');\n } else i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility function to extract database reference from resource string
function resourceToInstanceAndPath(resource) { let resourceRegex = `projects/([^/]+)/instances/([^/]+)/refs(/.+)?`; let match = resource.match(new RegExp(resourceRegex)); if (!match) { throw new Error(`Unexpected resource string for Firebase Realtime Database event: ${resource}. ` + 'Exp...
[ "function formatDynamicDataRef(str, format)\n{\n var ret = str;\n var iStart = str.indexOf(\"<%#\", 0);\n\n if (iStart > -1)\n {\n var iEnd = str.indexOf(\"%>\", iStart+1);\n \n\tif (iEnd > -1)\n {\n \t var dataRef = dwscripts.trim(str.substring(iStart+3, iEnd));\n \n\t // Replace ([\\s\\S]+) wi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw a line on the given context from point `x1,y1` to point `x2,y2`.
function line(ctx, x1, y1, x2, y2) { ctx.beginPath(); ctx.moveTo(x1, y1); ctx.lineTo(x2, y2); ctx.stroke(); }
[ "drawLine(start_x, start_y, end_x, end_y) {\n this.ctx.moveTo(start_x, start_y);\n this.ctx.lineTo(end_x, end_y);\n }", "function renderLine(ctx, start, end) {\n ctx.save();\n\n ctx.beginPath();\n ctx.moveTo(start.x, start.y);\n ctx.lineTo(end.x, end.y);\n\n ctx.stroke();\n ctx....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a tank form JS
function addATank() { var code = $("#tankCode").val(); var label = $("#tankLabel").val(); var latitude = $("#tankLatitude").val(); var longitude = $("#tankLongitude").val(); $.post("tank", {code: code, label: label, latitude: latitude, longitude: longitude, owner: userId, sate: 'pending'}) .done(function...
[ "function tank() {\n $('#tank').show('slow', goTank)\n }", "function newTank(data){\n\tlet spawnpoint = newSpawnpoint();\n\ttanks.push(new Tank(data[\"id\"], spawnpoint.x, spawnpoint.y, tankSettings[\"width\"], tankSettings[\"height\"], spawnpoint.angle, tankSettings[\"speed\"], tankSettings[\"accelerat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get employees from team
function getTeamEmployees(teamName, response) { var query = `SELECT * FROM statusIndicator WHERE teamName='${teamName}' ORDER BY displayName`; connection.query(query, function (error, results, fields) { if (error) { var responseObject = { status: "error", ...
[ "findManagerEmployees(managerId) {\n return this.connection.query(\n \"SELECT employee.id, employee.first_name, employee.last_name, department.name AS department, role.title FROM employee LEFT JOIN role on role.id = employee.role_id LEFT JOIN department ON department.id = role.department_id WHERE manager_id...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves the User's annotations
function retrieveUserAnnotations(req, res) { let targetUserDoc = null; sec.authenticateApp(req.get('clientId')).then((result)=>{ return sec.authorizeUser(req.get('username'), req.get('accessToken')); }).then(async (userDoc)=> { // If the user specifies a target user in their request, check i...
[ "function getAnnotationsInDoc() {\n var documentProperties = PropertiesService.getDocumentProperties();\n DocumentApp.getUi().alert('Annotations in the Document Properties: ' + documentProperties.getProperty('ANNOTATIONS'));\n //DocumentApp.getUi().alert('Annotations_type in the Document Properties: ' + document...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a twopass Gaussian blur for a cubemap. Normally this is done vertically and horizontally, but this breaks down on a cube. Here we apply the blur latitudinally (around the poles), and then longitudinally (towards the poles) to approximate the orthogonallyseparable blur. It is least accurate at the poles, but sti...
function _blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) { _halfBlur( cubeUVRenderTarget, _pingPongRenderTarget, lodIn, lodOut, sigma, 'latitudinal', poleAxis ); _halfBlur( _pingPongRend...
[ "function blurImage(img){\n return imageMapXY(img, blurPixel);\n}", "function BlurPostProcess(name,/** The direction in which to blur the image. */direction,kernel,options,camera,samplingMode,engine,reusable,textureType,defines,blockCompilation){if(samplingMode===void 0){samplingMode=BABYLON.Texture.BILINEAR_SAM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Log manipulation functions +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ name of fight log Varname
function getFightLogVarname() { return "estiah_pvp_fight_log_" + getUsername(); }
[ "attackMissLog(){\n let logString = `\\n${this.name} missed their attack!`;\n this.updateBattleLog(logString);\n }", "attackHitLog(enemyName){\n let logString = `\\n${this.name} hit ${enemyName} for ${this.attack} damage!`;\n this.updateBattleLog(logString);\n }", "getLogType()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the current LED from the API
function lookupNewLed() { got(LED_URL) .then(response => { //console.log("API call finished with response: "+response.body); if (response.body) { try { temp = new Number(response.body); //console.log("Temp: "+temp); if (temp >= 0 && tem...
[ "function getCurrentLed() {\n return led;\n}", "function toggleLED(url, res) {\n var indexRegex = /(\\d)$/;\n var result = indexRegex.exec(url);\n var index = +result[1];\n \n var led = tessel.led[index];\n \n led.toggle(function (err) {\n if (err) {\n console.log(err);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ending Portion/////////////////////////////////////////////////////////////////////// function awakenFromDream() the function containing the final dialog box, prompts the user to awaken from the nightmare
function awakenFromDream() { // remove remnants of part 3 dialogs $('.question3').remove(); $('.question4').remove(); // append the new div tag to the body $('body').append("<div class = 'awakenPrompt'><div>"); // set the contents of the dialog box $('.awakenPrompt').html("You have completely restored ...
[ "finishAskTheAudience() {\n this.serverState.askTheAudience.populateAllAnswerBuckets();\n this.playSoundEffect(Audio.Sources.ASK_THE_AUDIENCE_END);\n\n // Update game is called first to make sure ask the audience end audio cue plays.\n this._updateGame();\n this.showHostRevealHotSeatChoice();\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Meshes and other visible objects
function createMeshes() { mesh_lantern1 = createLantern (); scene.add(mesh_lantern1); mesh_lantern2 = mesh_lantern1.clone(); mesh_lantern2.translateX(15.0); scene.add(mesh_lantern2); mesh_lantern3 = mesh_lantern1.clone(); mesh_lantern3.translateZ(-20.0); scene.add(mesh_lanter...
[ "initializeMeshes () {\r\n this.triangleMesh = new Mesh(this.cyanYellowHypnoMaterial, this.triangleGeometry);\r\n this.quadMesh = new Mesh(this.magentaMaterial, this.quadGeometry);\r\n\r\n // texture code\r\n this.texturedQuadMesh = new Mesh(this.texturedMaterial, this.texturedQuadGeometry);\r\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a subpatch for thunks
function thunks(a, b, patch, index) { var nodes = handleThunk(a, b) var thunkPatch = diff(nodes.a, nodes.b) if (hasPatches(thunkPatch)) { patch[index] = new VPatch(VPatch.THUNK, null, thunkPatch) } }
[ "function performBackpatching()\n\t{\n\t\t// Reference Variables (static)\n\t\tperformReferenceBackpatching();\n\t\t// Jumps\n\t\tperformJumpBackpatching();\n\t}", "function Window_ModPatchCreate() {\r\n this.initialize.apply(this, arguments);\r\n}", "function utilPatch(orig, diff) /* patched object */ {\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Using ajax this function finds the correct script from a specific folder and returns it as text. The callback converts the text to runable code, and sends it to runChart().
function loadScript(test) { $.ajax({ url: 'tests-js/'+test, success: function(data) { tst = new Function([], "return " + data); options = tst(); runChart(options, test); }, dataType: 'text' }); }
[ "function loadDivTextCharts(stockQuoteJsonUrl,stockSymbol, dividendDate, dividendAmount) {\n $.getJSON(stockQuoteJsonUrl, data2 => { renderDivTextCharts(data2, stockSymbol, dividendDate, dividendAmount)}); \n}", "async function getScripts() {\n const url = '/api/scripts';\n const response = await fetch(url);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints 3 Impartial function
function impartial(x, y, z) { return x + y + z; }
[ "function skaiciavimai(x,y,z) {\n console.log(x+2, y+4, z*2);\n}", "function printMetinisPajamuDydis() {\n\n console.log(\"Metinis atlyginiams \" + atlyginimas * 12);\n}", "function displayQualifier1() {\n var i = 1;//assignam valoarea initiala (=1) pentru contorul i, pentru parcurgerea while\n while ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tabs hook to show an animated indicators that follows the active tab. The way we do it is by measuring the DOM Rect (or dimensions) of the active tab, and return that as CSS style for the indicator.
function useTabIndicator() { var context = useTabsContext(); var { selectedIndex, orientation, domContext } = context; var isHorizontal = orientation === "horizontal"; var isVertical = orientation === "vertical"; // Get the clientRect of the selected tab var [rect, setRect] = (0, _react.useStat...
[ "function floatTab(tab, on) {\n if (on) {\n tab.node.classList.add(FLOATING_CLASS);\n }\n else {\n tab.node.classList.remove(FLOATING_CLASS);\n }\n }", "function _jsTabControl_turnTabOn(tabID) {\n\tdocumen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return absolute offset for a target
function getOffset(target) { if (target instanceof Array) { return Rect(target[0], target[1], target[2] || target[0], target[3] || target[1]); } if (typeof target === 'string') { //`100, 200` - coords relative to offsetParent var coords = target.split(/\s*,\s*/).length; if (coords === 2) { return...
[ "offsetByCanvas(canvasTarget) {\n const offset = { x: 0, y: 0 };\n let i;\n for (i = 0; i < this.indexOfTarget(canvasTarget); i += 1) {\n offset.x += this.canvases[i].getWidth();\n }\n return offset;\n }", "get tileOffset() {}", "function calculateOffsetTop(r){\n return absolute_offset(r,\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : checkObjectArray AUTHOR : James Turingan DATE : December 5, 2013 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : check if the device is already exist in the array PARAMETERS : path,myArray
function checkObjectArray(path,myArray,type){ var flag = false; if(type != 'device'){ for(var t=0; t<myArray.length; t++){ if(myArray[t].ObjectPath == path){ flag = true; break; } } }else{ for(var t=0; t<myArray.length; t++){ if(myArray[t].DeviceName == path){ flag = true; break; } ...
[ "static #checkIfObjectIsFound(array) {\n\n\t\t// Check if input is defined.\n\t\tif (!array) {\n\t\t\treturn console.log(`${array} is undefined or null.`)\n\t\t}\n\n\t\treturn array.length !== 0;\n\t}", "static isExistInArray(arr, value, index=0){\n\t\tif( typeof arr === 'object'){\n\t\t\tlet arrList = [];\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Choosing based on the number of variants and equal distribution
function getVariantURL(variants) { let distribution = new Array(variants.length).fill(Number((1/variants.length).toFixed(2))) const rand = (Math.random() * (variants.length - 1)).toFixed(2) let acc = 0 distribution = distribution.map(weight => (acc = acc + weight)) return variants[distribution.findIndex(pri...
[ "getRandomSolution() {\n var sol = []\n for (let g = 0; g < this.genesCount; g++) {\n // 0 or 1 randomly\n sol.push(Math.round(Math.random()))\n }\n\n return sol;\n }", "rank_Selection() {\n // generate ranks (n, n-1, n-2, n-3, .., 1)\n var ranks ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LLAMADO desde el Panel cada vez que se presiona al boton Modificar
function fModificar(){ //FRMPanel.fSetTraStatus("UpdateBegin"); fDisabled(false,"iEjercicio,"); FRMListado.fSetDisabled(true); }
[ "function mostrarPanelDesdeModal() {\n checarDesdeModal();\n\n setTimeout(function() {\n console.log(privilegio);\n\n if(puesto == privilegio) { //si el puesto es igual, significa que ingresaste bien tu puesto\n if(privilegio == \"Administrador\") { //si el privilegio es Administrador te muestra el pan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Emit from the edge of a circle.
get CircleEdge() {}
[ "set CircleEdge(value) {}", "function draw_circle() {\n ctxe.beginPath()\n ctxe.arc(EW_CENTER_POINT.x, EW_CENTER_POINT.y, inverseWavelength, 0, Math.PI * 2)\n ctxe.stroke()\n }", "edgeBounce() {\r\n\t\tlet margin = 100;\r\n\r\n\t\tif (this.x < margin) {\r\n\t\t\tthis.vx += turnCo;\r\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
must match test_robots.txt Count actual phantomjs processes in play, requires pgrep
function countSpawnedProcesses(cb) { var pgrep = spawn("pgrep", [spawnedProcessPattern, "-c"]); pgrep.stdout.on("data", cb); }
[ "searchTasks(str){\r\n console.log(`Search: ${str}`)\r\n let numMatches= 0;\r\n\r\n //Go through Tasks and output any partial string matches found, matching on text attribute.\r\n this.projectList.forEach(project => {\r\n project.taskList.forEach(task =>{\r\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Screen readers on IE needs to have the role application set on the body.
function ensureBodyHasRoleApplication() { document.body.setAttribute("role", "application"); }
[ "role() {\n const { disabled } = this.props;\n const role = SharedUtil.isSafari() ? 'group' : 'button';\n\n return disabled ? undefined : role;\n }", "static get noRole() { return NO_ROLE; }", "showToScreenReader() {\n this.adapter_.removeAttr(_constants.strings.ARIA_HIDDEN);\n }", "function get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserproc_decl_in_type.
visitProc_decl_in_type(ctx) { return this.visitChildren(ctx); }
[ "visitSubprog_decl_in_type(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitFunc_decl_in_type(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitType_declaration(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitType_procedure_spec(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "vis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use the /clear_orders PHP AJAX call to purge all the information about known orders. Also clears the table from order data as the update_orders() call will only add new rows, never remove old ones
function clear_orders() { reset(); $.ajax({ contentType: 'application/json; charset=UTF-8', data: null, dataType: 'json', error: function (jqXHR, textStatus, errorThrown) { failure('Failed to get clear order data', errorThrown.statusText); }, success: function (data, textStatus, jqXHR) { $('.orders ...
[ "function destroyTable() {\n if ($.fn.DataTable.isDataTable('#ordersGrid')) {\n $('#ordersGrid').DataTable().destroy();\n $('#ordersGrid').empty();\n }\n }", "function clearOrderForm(){\n $(\"#oi3PriceId\").val(\"\");\n $(\"#oi3SP\").val(\"\");\n $(\"#oi3Price\").ht...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construction du panneau des brins
buildPanneau () { let h = DOM.create('section', {id:'panneau_brins'}) let newo, listing newo = DOM.create('div', {id: 'titre_panneau_brins', class:'titre', inner: "Liste des brins"}) h.appendChild(newo) let typesTraited = [] // On conserve une liste des types qui vont être traités par /...
[ "function colocarPortaaviones(numero){\n\n for (let i=0; i < numero; i++){\n colocarBarco(new Barco(0,0,4, 'P'));\n }\n \n}", "inicializa(){\n globais.placar = criarPlacar();\n }", "function constructBan(sfen) {\n const n = sfen.length;\n\n // Pices on board\n var i;\n var ix = 0;\n var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decodes and retuns counts and weights of all cells
static getCellData({countsData, size = 1}) { const numCells = countsData.length / 4; const cellWeights = new Float32Array(numCells * size); const cellCounts = new Uint32Array(numCells); for (let i = 0; i < numCells; i++) { // weights in RGB channels for (let sizeIndex = 0; sizeIndex < size; ...
[ "static countCells(prop) {\n let n = prop.range;\n n = (n & 0x15555)+(n>>1 & 0x15555);\n n = (n & 0x3333) +(n>>2 & 0x3333);\n n = (n & 0xf0f) +(n>>4 & 0xf0f);\n return (n & 0xff)+(n>>8 & 0xff);\n }", "function weightCells(grid, row, col) {\n var cellWeight;\n\n\n if (grid[row][col].state ==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses graph_ent and graph_ret events that were inserted by the Linux kernel's function graph trace.
function KernelFuncParser(importer) { LinuxPerfParser.call(this, importer); importer.registerEventHandler('graph_ent', KernelFuncParser.prototype.traceKernelFuncEnterEvent. bind(this)); importer.registerEventHandler('graph_ret', KernelFuncParser.prototype.traceKernelFuncReturnEv...
[ "parseEvent() {\n\t\tlet addr = ppos;\n\t\tlet delta = this.parseDeltaTime();\n\t\ttrackDuration += delta;\n\t\tlet statusByte = this.fetchBytes(1);\n\t\tlet data = [];\n\t\tlet rs = false;\n\t\tlet EOT = false;\n\t\tif (statusByte < 128) { // Running status\n\t\t\tdata.push(statusByte);\n\t\t\tstatusByte = running...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether identifier is covered by this Resource Name Permission. Returns `true` when identifier matches, otherwise return `false`.
matchIdentifier(permission) { let identifier; if (_.isString(permission)) { identifier = (new RNPermission(permission)).identifier(); } else { identifier = permission.identifier(); } return globToRegex(this.identifier()).test(identifier); }
[ "hasIdentifiers() {\n return this.__getIdentifiers() !== undefined;\n }", "function hasAccessibleName(vNode) {\n // testing for when browsers give a <section> a region role:\n // chrome - always a region role\n // firefox - if non-empty aria-labelledby, aria-label, or title\n // safari - if non-empt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use truncate string algorithm I wrote for freeCodeCamp to shorten quote for Twitter (140 chars), accounts for OprahQuotes hashtag
function shortQuote(quote) { if(quote.length>250) { quote = quote.slice(0,280); return quote + "..."; } else return quote; }
[ "function truncated(input) {\n\tif (input.length > 100) {\n\t\treturn input.substring(0, 100) + \"...\";\n\t}\n\treturn input;\n}", "function shorten(string) {\n \n // MAX CHARACTER LIMIT\n var max_length = 25;\n \n // CHECK IF THE STRING IS LONGER THAN 22 CHARACTERS\n if (string.length > max_length) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Warning dialog for example project loaded
function showProjectExampleLoadedDialogue() { showDialog({ title: 'Example Project Loaded', text: 'Example project has been successfuly loaded'.split('\n').join('<br>'), negative: { title: 'Continue' } }) }
[ "function showProjectLoadTypeFailDialogue() {\n showDialog({\n title: 'WARNING: Incorrect project type',\n text: 'Reselect a <b>DSS-Risk-Analysis-</b>&lt;ProjectTitle&gt;.json file:\\nCurrent project unchanged'.split('\\n').join('<br>'),\n negative: {\n title: 'Continue'\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hardwired values for speed. Equivalent of macro GET_OPCODE
static OPCODE(instruction) { // POS_OP == 0 (shift amount) // SIZE_OP == 6 (opcode width) return instruction & 0x3f; }
[ "op (code) {\n return this.byte(code, \"op\");\n }", "function getBytecode() {\n console.log(web3.eth.getCode(crowdsale.address));\n//\"0x\"\n//data: '0x' + bytecode\n}", "indexedIndirect() {\n this.incrementPc();\n let zeroPageAddress = (this.ram[this.cpu.pc] + this.cpu.xr) & 0xff\n let l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makes a string of of exercises array for sql statement
function makeExerciseSqlStr(exercisesValuesArr) { let finalStr = ""; for (let c in exercisesValuesArr) { if (c < exercisesValuesArr.length -1) { finalStr = finalStr + makeStr(exercisesValuesArr[c]) + ','} else { finalStr = finalStr + makeStr(exercisesValuesArr[c]) } } return ...
[ "getEquationArray(amt1, eqstring='= ') {\n const line1 = this.getAmt1StringUnits(amt1);\n const line2 = eqstring + this.getAmt2StringUnits(amt1);\n return [line1, line2];\n }", "function test_utility_logSortedData(studentData) {\n\n var formattedTestString = \"[\";\n for (var i = 0; i < studentDat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether the file exists on FS
fileExists() { return fs.pathExists(this.location); }
[ "function exists(file) {\n\treturn fs.existsSync(file) && file;\n}", "isDirExists() {\t\n\t\ttry\t{\n\t\t\tfs.statSync(this.options.dir);\n\t\t} catch(e) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}", "function check_file_exist(file){\n\tvar http = new XMLHttpRequest();\n\thttp.open('HEAD',file,false)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
iterate recursively node tree to index elements by name data is an array of objects, that contains id,name,children[]
function populateTree(data) { for (let n=0;n<data.children.length;n++) { populateTree(data.children[n]); } console.log("adding node:'"+ data.name + "' id:"+data.id); nodeListByName[data.name]=data.id; }
[ "function traverseDeserialize(data) {\n if(index > data.length || data[index] === \"#\") {\n return null;\n }\n var node = new TreeNode(parseInt(data[index]));\n index++;\n node.left = traverseDeserialize(data);\n index++;\n node.right = traverseDeserializ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update the test documents using a direct update operation
async updateDocuments () { // do a direct update to change the text of our test documents const regexp = new RegExp(`^${this.randomizer}yes$`); await this.data.test.updateDirect( { flag: regexp }, { $set: { text: 'goodbye'} } ); }
[ "function updateSyncDoc(service, SyncDoc) {\n service\n .documents(SyncDoc)\n .update({\n data: { temperature: 30,\n humidity: 20 },\n })\n .then(response => {\n console.log(response);\n// console.log(\"== deleteSyncDoc ==\");\n})\n .catch(error => {\n console.log(error...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle when the selected object is edited by the editor.. this way we can fire an event and the app knows to update the source tabs
handleSelectedEdited(item){ //if this is the currently selected object, let's fire our change event if(item.ID == this.selectedClassItem) this.eventSelectionEdited.fire(item); }
[ "onSelectionEdited(func){ return this.eventSelectionEdited.register(func); }", "function on_piece_select()\n{\n\tupdate_editor();\n}", "editPointViewClick() {\n this.deselectAllTabs();\n\n this.editPointViewTab.className = \"WallEditor_EditPointViewTab selected\";\n this.viewController = th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds all transactions from the CSV data string into this bank
loadCSVData(CSVData) { let transactionStrings = CSVData.split('\n'); for(let i = 1; i < transactionStrings.length; i++) { // skip first row since it is header let lineNumber = i + 1; let transactionString = transactionStrings[i]; let transactionDet...
[ "function parseCSV (newSet, callback){\n\tvar parser = parse(function(err,data){\n\t\tif(err){\n\t\t\tconsole.log(err);\n\t\t} else {\n\t\t\tdata.shift();\n\t\t\tcallback(null,newSet,data);\n\t\t}\n\t});\n\tfs.createReadStream(__dirname + '/intercensalState.csv').pipe(parser);\n}", "function readCSV(data) {\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that removes mouse events needed for drawing new patterns
inactivatePatternCreation() { this.chartBody.on('mousedown', null); this.chartBody.on('mousemove', null); this.chartBody.on('mouseup', null); this.chartBody.on('mousemove', null); this.chartBody.on('click', null); d3.select("#fixedPattern").remove(); }
[ "removeMouseInteractions() {\t\t\t\n\t\tthis.ctx.canvas.removeEventListener(\"click\", this.towerStoreClick);\n\t\t\n\t\tthis.ctx.canvas.removeEventListener(\"mousemove\", this.towerStoreMove);\t\t\n\t}", "function disable_draw() {\n drawing_tools.setShape(null);\n}", "function mouseouthandler(event) {\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse setting groups, skips columns with empty titles returns object where fields = group names: result. == columnNumber columnNumber is absoulute, starting from 1.
function getGroups(sheet){ var topLeftRow = paramSheetStructure.groupTitle.row; var topLeftCol = paramSheetStructure.groupTitle.col; var colCount = sheet.getLastColumn() - topLeftCol + 1; // get column with parameter names. actually get 2D-range with colCount = 1 var headers = sheet.getRange(topLeftRow, topLe...
[ "function _addFieldGroups() {\n var dialog = $('#perc-folder-props-dialog');\n var fieldGroups = [\n { groupName : \"perc-folder-general-properties-container\", groupLabel : \"General\"}\n , { groupName : \"perc-user-permissions-container\", groupL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bresenham's line algo, fast but not rasterized
function drawLineBresenham(x0, y0, x1, y1, intensity, destArray) {//All the drawn pixels have the same intensity /* function draw(x,y){ if (x>=0 && y>=0 && x <sliceDimension && y < sliceDimension){ sliceGrid[x][y] += intensity; } } */ var dx = Math.abs(x1 - x0);...
[ "function drawLineBresenham(ctx, startX, startY, endX, endY, color, storeIntersectionForScanlineFill) {\n\n var x = startX;\n var y = startY;\n\n // Abstand\n var dX = endX - startX;\n var dY = endY - startY;\n\n // Beträge\n var dXAbs = Math.abs(dX);\n var dY...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create "dialog" window with iFrame
function popupDialogWindow(pageTitle, pageURL) { //var $dialog = $("#" + containerId) var $dialog = $("#custom-iframe-container") .html("<iframe src='" + pageURL + "'></iframe>") .dialog({ appendTo: "body", autoOpen: false, modal: true, height...
[ "function Dialog() {}", "function ShowFacebookDialogue(){\n\t//setup dialogues\n\tvar dialogue = $(\"#dialogue\").dialog({autoOpen: false, modal: true, draggable:false, resizable:false, bgiframe:true});\n\n\t//setup options for this dialogue\n\t$(\"#dialogue\").dialog( \"option\", \"title\", 'Facebook - Adding En...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the actual extension ID given the extension name
function getExtensionID(name){ for(i=0; i < background.extensionsList.length; i++){ if(background.extensionsList[i]['name'] == name){ return background.extensionsList[i]['id']; } } }
[ "function extension(type) {\n const match = EXTRACT_TYPE_REGEXP.exec(type);\n if (!match) {\n return;\n }\n const exts = exports.extensions.get(match[1].toLowerCase());\n if (!exts || !exts.length) {\n return;\n }\n return exts[0];\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper function to get the internal path of a node
function getInternalPath (node) { return node.getInternalPath(); }
[ "function get_path(parent_node) {\n if (parent_node === current_room) {\n //return path\n } else {\n var parent = bfs_parents[parent_node.getName()];\n path.push(parent);\n return get_path(parent);\n }\n }", "function _pathToNode(node, ancestorNo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert a byte to a signed number (e.g., 0xff to 1).
function signedByte(value) { return value >= 128 ? value - 256 : value; }
[ "function parseToSignedByte(value) {\n value = (value & 127) - (value & 128);\n return value;\n}", "function UInt8toUInt32(value) {\n return (new DataView(value.buffer)).getUint32();\n}", "function decode_int(v) {\n return bigEndianToInt(v);\n }", "function toByte(x) {\n x = Math.max(0, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
console.log(JSON.stringify(state)); } this function checks that "symbol" exists as a value in the optionsArray return false if it cannot find the symbol among any value
function SymbolIsInOptions(symbol, optionsArray) { // var IsInOptions = false IsInOptions = optionsArray.includes(symbol) return optionsArray.includes(symbol) // return IsInOptions }
[ "function isSymbolString(s) {\n return symbolValues[s] || isPrivateSymbol(s);\n }", "isAdded(stockSymbol) {\n return this.stockChart.series.some((series) => {\n return series.name === stockSymbol.toUpperCase();\n });\n }", "function check(symbol) {\n \t\t\t\t\n \t\tif (!mode....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates scale of canvas to fit window width Also updates number of hiscores shown
function updateCanvasScale() { cellSize = (window.innerWidth / 100) * gridCellSizePercent; cellsPerWidth = parseInt(window.innerWidth / cellSize); cellsPerHeight = parseInt((cellsPerWidth * 9) / 21); canvasWidth = window.innerWidth; canvasHeight = cellSize * cellsPerHeight; resizeCanvas(canvasWidth, canvas...
[ "function resizeGraph() {\r\n if ($(window).width() < 700) {\r\n $(\"#AdviceCanvas\").css({\"width\": $(window).width() - 50});\r\n $(\"#GraphCanvas\").css({\"width\": $(window).width() - 50});\r\n }\r\n}", "function updateScale(increment) {\n var ctx = document.getElementById(\"canvas\").getContext(\"2d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1 Using the varabile persons Create a function called avgAge that accept an array and return average age of this array Ex: avgAge(persons) => 41.2
function avgAge(persons) { var result = persons.reduce(function (total, elem) { return total + elem.age; }, 0); return result / persons.length; }
[ "function avgAge(persons) \n{\n var out;\nout=persons.reduce()\n\n return out\n}", "function averageAge(people){\n\tvar average = 0;\n\tfor(var i = 0; i < people.length; i++){\n\t\taverage += people[i].age;\n\t}\n\treturn average / people.length;\n}", "function average(){\n\t\t\tvar sum = 0;\n\t\t\tlist.forEac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for getV3ProjectsIdHooksHookId
getV3ProjectsIdHooksHookId(incomingOptions, cb) { const Gitlab = require('./dist'); let defaultClient = Gitlab.ApiClient.instance; // Configure API key authorization: private_token_header let private_token_header = defaultClient.authentications['private_token_header']; private_token_header.apiKey = 'YOUR AP...
[ "getV3ProjectsIdHooks(incomingOptions, cb) {\n const Gitlab = require('./dist');\nlet defaultClient = Gitlab.ApiClient.instance;\n// Configure API key authorization: private_token_header\nlet private_token_header = defaultClient.authentications['private_token_header'];\nprivate_token_header.apiKey = 'YOU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Drive the REST API to watch the item
function watch(itemNumber) { console.log("Watch " + itemNumber); var xhr = new XMLHttpRequest(); xhr.open('POST', '/rest/wishlists/' + activeDistributorID); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.send(itemNumber); }
[ "getWatchlists() {\n return new Request({\n path: '/_mobile/usercontent/watchlist',\n method: 'GET',\n headers: {\n 'X-AuthenticationSession': this.authenticationSession,\n 'X-SecurityToken': this.securityToken\n }\n });\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inject the header of mocking child_process to JS file So that its child_process can also be instrumented and collected coverage, recursively.
function inject_mockery_header(file) { var dirname = path.dirname(file), basename = path.basename(file), fs = require('fs'), new_file, orig_content, mocker_module, lines, header; new_file = path.resolve(dirname, injected_file_prefix + basename); mock...
[ "before() {\n if (process.env.START_HOT) {\n console.log('Starting Main Process...');\n spawn('npm', ['run', 'start-main-dev'], {\n shell: true,\n env: process.env,\n stdio: 'inherit',\n })\n .on('close', code => process.exit(code))\n .on('error...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=================================================================================================================== Private methods Create a number of differently seeded noise generators equal to the current number of octaves.
_recreateNoiseGenerators() { const rnd = new MersenneTwister( Math.trunc( this._noiseSeed * 0xFFFFFFFF ) ); for( let i = 0; i < this._options.noise.octaves; ++i ){ const derivedSeed = rnd.random(); const gen = this._noiseGenes[ i ]; if( gen ){ gen.seed = derivedSeed; } else { ...
[ "function createNoiseTrackerArray(){\n\tvar xLimit = 11;\n\tfor(var y=0; y<=15; y++){\n\t\tnoiseTracker[y] = [];\n\t\tnoiseTracker2[y] = [];\n for(var x=0; x<=xLimit; x++){\n\t\t\tvar noiseValue = noise(x, y);\n\t\t\tif(y == 0 || y == 15){\n\t\t\t\tnoiseValue = 0.5;\n\t\t\t}\n\t\t\tnoiseTracker[y][x] = noise...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CHECKLABEL:function protoIsConst1() CHECKNEXT:frame = [] CHECKNEXT:%BB0: CHECKNEXT: %0 = AllocObjectInst 1 : number, null : null CHECKNEXT: %1 = StoreNewOwnPropertyInst 2 : number, %0 : object, "a" : string, true : boolean CHECKNEXT: %2 = ReturnInst %0 : object
function protoIsConst2() { return {b: 3, __proto__: 10}; }
[ "function protoShorthandMix1(func) {\n var __proto__ = 42;\n return {__proto__, __proto__: {}};\n}", "function $const(x, y) /* forall<a,b> (x : a, y : b) -> a */ {\n return x;\n}", "function blockScopeBasicLetConstTestFunc() {\r\n let integer = 1;\r\n let string = \"2\";\r\n let object = { p1: 3, p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets spinners in the mod area to 0.
function resetSpinners() { "use strict"; document.getElementById("modScoreSpin").value = 0; document.getElementById("modDiceSpin").value = 0; document.getElementById("modBaseSpin").value = 0; }
[ "idleSpin() {\n this._sectors.rotation = 0;\n this.idleSpinTween = gsap.to(this._sectors, { \n rotation: Math.PI * 2, \n repeat: -1, \n duration: 12, \n ease: 'linear', \n onUpdate: this._onRotation.bind(this)\n });\n }", "hideSpinner() {\n this.spinnerVisible = false;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merge a custom breakpoint list with the default list based on unique alias values Items are added if the alias is not in the default list Items are merged with the custom override if the alias exists in the default list
function mergeByAlias(defaults, custom = []) { const dict = {}; defaults.forEach(bp => { dict[bp.alias] = bp; }); // Merge custom breakpoints custom.forEach((bp) => { if (dict[bp.alias]) { extendObject(dict[bp.alias], bp); } else { dict[bp.alia...
[ "_handleOverrideGroup(name, override, result) {\n let markerOverride = override;\n\n if (override.missing_in_dst) {\n result.push(new OverrideGroup({\n mode: 'empty'\n }));\n result.push(new OverrideGroup({\n na...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sample demonstrates how to Creates or updates the storage domain.
async function storageDomainsCreateOrUpdate() { const subscriptionId = "9eb689cd-7243-43b4-b6f6-5c65cb296641"; const storageDomainName = "sd-fs-HSDK-4XY4FI2IVG"; const resourceGroupName = "ResourceGroupForSDKTest"; const managerName = "hAzureSDKOperations"; const storageDomain = { name: "sd-fs-HSDK-4XY4FI...
[ "function setDomains( domains, callback ) {\n\tchrome.storage.sync.set( {\n\t\tdomains: domains\n\t}, callback );\n}", "function addDomain(domain){\n\n\tdb.collection('domains').insert({\"domain\": domain, \"grade\": \"Calculating\"}, function(err, result) {});\n\n\ttestSSL(domain, 0, function(grade){\n\t\tdb.col...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Command to go to the first Problem
function handleGotoFirstProblem() { run(); if (_gotoEnabled) { $problemsPanel.find("tr:not(.inspector-section)").first().trigger("click"); } }
[ "function toProblem() {\n location.href = './problem.html?id=' + this.id;\n }", "function jump_if_has_one(){\n if($scope.result.datasets != null) {\n\n if($scope.result.datasets.length == 1){\n dataset1 = $scope.result.datasets[0];\n location.href = \"#/dataset/\"+dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gallery Class: controls grid view and lighthouse view
function Gallery(gridContainers, lighthouseContainers, loadMoreButton) { this.lighthouse = new LightHouse(lighthouseContainers, this.hideLighthouseImage.bind(this)); this.grid = new Grid(gridContainers, this.showLighthouseImage.bind(this)); this.loadMoreButton = loadMoreButton; this.page = 1; // Flickr ...
[ "openGallery_() {\n // Build gallery div for the first time\n if (!this.gallery_) {\n this.findOrBuildGallery_();\n }\n this.lightboxCaption_.toggleOverflow(false);\n this.mutateElement(() => {\n this.container_.setAttribute('gallery-view', '');\n toggle(dev().assertElement(this.carous...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shall be used to parse output of any GDB machine interpreter (GDB/MI) command.
parseMIoutput(input) { return Parser.parse(input, { startRule: 'GDBMI_OUTPUT' }); }
[ "parseMIrecord(input) { return Parser.parse(input, { startRule: 'GDBMI_RECORD' }); }", "exec(text) {\n\t\tif (text.length === 0) return;\n\t\tthis.prog = text.split(/\\s+/).reverse();\n\t\tthis.prog = this.prog.map((el) => { return el.toLowerCase(); });\n\t\twhile (this.prog.length) {\n\t\t\tlet tok = this.next_c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies linear interpolation to find the correct value for traveling from value oldValue to newValue taking into account that you are (i / steps) of the way through the process
function interpolateValue(oldValue, newValue, i, steps) { return (((steps - i) / steps) * oldValue) + ((i / steps) * newValue); }
[ "function interpolateValues(values, getter, i, iteration) {\n if (i > 0) {\n var ta = iterations[i], tb = iterations[i - 1],\n t = (iteration - ta) / (tb - ta);\n return getter(values[i]) * (1 - t) + getter(values[i - 1]) * t;\n }\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
upsample our lowquality buffer by 4 via linear interpolation to get to the max sample rate for audio context
function upSample(buf) { var smallSampled = new Float32Array(buf.buf); var length = smallSampled.length * 2; var upSampled = new Float32Array(length); for (var i = 0; i < smallSampled.length; i++) { upSampled[i * 2] = smallSampled[i]; if (i + 1 < smallSampled.length) { upSampled[i * 2 + 1] = (sma...
[ "function DownSample4x (source : RenderTexture, dest : RenderTexture){\n var off : float = 1.0f;\n Graphics.BlitMultiTap (source, dest, material,\n new Vector2(-off, -off),\n new Vector2(-off, off),\n new Vector2( off, off),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a method to validate coupon code on server /api/couponCodes/123asdf1223
async validateCouponCode(code) { let response = await axios.getCatalog("http://127.0.0.1:5000/api/couponCodes/" + code); return response.data; }
[ "ValidateACodeToGenerateAssociatedCreditMovement(inputCode, serviceId) {\n let url = `/me/credit/code`;\n return this.client.request('POST', url, { inputCode, serviceId });\n }", "function checkCoupon(enteredCode, correctCode, currentDate, expirationDate){\n console.log(enteredCode + ' ' + correc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Action after done button is activated
function initDoneButton () { getId('save_user').addEventListener( 'click', function(event) { event.preventDefault(); finishAnnotationSingle(); stopAutoSave(); finished = true; sendLogs(); return false; } ); }
[ "finish() {\n this.finishBtn.click();\n }", "function done() {\n putstr(padding_left(\" DONE\", seperator, sndWidth));\n putstr(\"\\n\");\n }", "function cpsh_onFinish(evt) {\n evt.preventDefault();\n finishConfirmDialog.hidden = true;\n WapPushManager.close();\n }", "function switc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disable editable for all cell inside table
_disableEditableCell(event) { if(event.target.tagName.toLowerCase() != 'td') return; var data = []; var index = +event.target.closest('tr').dataset.index; event.target.removeAttribute("contenteditable"); event.target.classList.remove("editable"); for(var i = 0; i < event...
[ "function setEditableStatus() {\n var $cells = $(\"#notebook-container\").children();\n for (var cellIndex = 0; cellIndex < Jupyter.notebook.get_cells().length; cellIndex++) {\n if (cellShouldBeUneditable(cellIndex)) {\n Jupyter.notebook.get_cell(cellIndex).metadata[\"editable\"] = false;\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show Return Button function
function showReturn(ctx){ ctx.telegram.sendMessage(ctx.chat.id,wordsList[language].Return,{ reply_markup : { inline_keyboard: [ [{text:"\u{21A9}",callback_data:"RETURN"}], ] } }) }
[ "function returnBtnSubjectTemplate(){\n\t$('#subjectTemplatePage .btnReturn').remove();\n\tlet prevButton = $('<button>');\n\tlet icon = $('<img>');\n\ticon.attr('src', './views/Images/btnReturn.png')\n\tprevButton.append(icon);\n\n\tprevButton.addClass('btnReturn')\n\tprevButton.click(function(){\n\t\t$('#subjectT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function used during window.onload to initialize Event listeners on Skill value form fields for validation
function eventListenerInit() { // get TOTAL_FORMS element from Django management_form of Skill formset let totalSkillForms = document.getElementById("id_skill-TOTAL_FORMS"); for (i = 0; i < totalSkillForms.value; i++) { addSkillValueValidationEvent(i); } }
[ "function initialize() {\r\n var partySize = document.getElementById(\"maxPartySize\");\r\n partySize.addEventListener(\"blur\", validatePartySize);\r\n\r\n var parties = document.getElementById(\"maxParties\");\r\n parties.addEventListener(\"blur\", validateParties);\r\n}", "function skillValuesValidation() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update line, column, and offset based on `value`.
function updatePosition(subvalue) { var lastIndex = -1; var index = subvalue.indexOf('\n'); while (index !== -1) { line++; lastIndex = index; index = subvalue.indexOf('\n', index + 1); } if (lastIndex === -1) { column += subvalue.length; } else { ...
[ "function updatePosition(subvalue) {\n var lastIndex = -1;\n var index = subvalue.indexOf('\\n');\n\n while (index !== -1) {\n line++;\n lastIndex = index;\n index = subvalue.indexOf('\\n', index + 1);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function checks if the syntax for getQuestionAndAnswersByUsername
function getQuestionAndAnswersByUsername(req,res) { return onlyBy(req, 'username', true) && checkTable(req,'question_and_answer') }
[ "function isAnswer() {\r\n\tif (!answer.branches)\r\n\t\treturn false;\r\n\t\t\r\n\tvar i = 0;\r\n\tfor (i in answer.branches) {\r\n\t\tvar branch = answer.branches[i];\r\n\t\tbranch.any = true;\r\n\t\tif (branch.words) {\r\n\t\t\tvar nb = compareSet(branch,userInput.list);\r\n\t\t\t/* console.log(\"branch: \" + br...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function for starting the receiver check interval if it's not already running. This function also takes care of stopping the interval when it is done. The receiver check interval is responsible for checking stale ChunkReceivers and stale pending reports.
function startCheckInterval() { if (receiverCheckInterval) { return; } receiverCheckInterval = setInterval(() => { const oldestTimestamp = Date.now() - RCV_TIMEOUT; for (const [messageId, receiver] of chunkReceivers) { if (receiver.lastReceive < oldestTimestamp) { MsrpSdk...
[ "function initPolling() {\n if (angular.isDefined(pollingInterval)) {\n return;\n }\n\n // Activate listener\n $rootScope.$on('syncUnreadMessagesCount', poll);\n\n // Check for unread messages in intervals\n setPollingInterval();\n }", "function setBufferChecker() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finalize one payment method registration [BETA] [See on api.ovh.com](
FinalizeOnePaymentMethodRegistration(paymentMethodId, expirationMonth, expirationYear, formSessionId, registrationId) { let url = `/me/payment/method/${paymentMethodId}/finalize`; return this.client.request('POST', url, { expirationMonth, expirationYear, formSessionId, registrationId }); }
[ "function submitPaymentJSON() {\n var order = Order.get(request.httpParameterMap.order_id.stringValue);\n if (!order.object || request.httpParameterMap.order_token.stringValue !== order.getOrderToken()) {\n app.getView().render('checkout/components/faults');\n return;\n }\n session.forms.billing.paymentMe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the height in pixels of the content area the text that the user has entered.
getContentHeight() { let contentHeight = 0; if (this.ckeInstance.ui && this.ckeInstance.ui.contentsElement && this.ckeInstance.ui.contentsElement.$ && this.ckeInstance.ui.contentsElement.$.style) { const cssText = this.ckeInstance.ui.contentsElement.$.styl...
[ "get height() {\n if ( !this.el ) return;\n\n return ~~this.parent.style.height.replace( 'px', '' );\n }", "_calculateHeight() {\n\t\tif (this.options.height) {\n\t\t\treturn this.jumper.evaluate(this.options.height, { '%': this.jumper.getAvailableHeight() });\n\t\t}\n\n\t\treturn this.naturalHei...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removes item from basket list display && provides value for basketArrayItemRemove before calling it && calls updateBasketTotal
function removeBasketItem(event) { let buttonClicked = event.target; let id = buttonClicked.previousElementSibling.innerText; buttonClicked.parentElement.parentElement.remove(); let itemToRemove = { productId: id } basketArrayItemRemove(itemToRemove) updateBasketTotal(); }
[ "function removeFromBasket() {\n var id = jQuery(this).attr('data-item'); // Eg. 'x47'.\n basket.removeItem(id);\n //refreshBaskets();\n window.location.reload(true); // reload page (from server, not cache)\n }", "function removeItem() {\n \n var idxToRemove = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
scaling diplom on click
function scalingDiplom() { let img = document.querySelector(".diplom__img"); img.addEventListener("click", function () { img.classList.toggle("scaled"); }) }
[ "function _scaling ( /*[Object] event*/ e ) {\n\t\tvar activeObject = cnv.getActiveObject(),\n\t\tscale = activeObject.get('scaleY') * 100;\n\t\tif ( scale > 500 ) {\n\t\t\tactiveObject.scale(5);\n\t\t\tactiveObject.left = activeObject.lastGoodLeft;\n \tactiveObject.top = activeObject.lastGoodTop;\n\t\t}\n\t\tac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scales positive and negative data into [0, width], [0, height]
function scaleData(unscaledData, height, width) { scaledData = []; //Create the scalers with computed min/max values var x = d3.scaleLinear() .domain([X_MIN, X_MAX]) .range([0, width]); var y = d3.scaleLinear() .domain([Y_MIN, Y_MAX]) .range([0, height]); //Scale the data for (var i = 0; i ...
[ "function scale(data, chosenAxis, dir) {\n let r = [0, width]\n if (dir === height) {\n r = [height, 0]\n }\n var linearScale = d3.scaleLinear()\n .domain([d3.min(data, sd => sd[chosenAxis]) * 0.9, //0.8 and 1.2 gives us a buffer from the edges of the chart\n d3.max(data, sd => sd[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show Icon menu Grabs all bundles from InfoStats2 and appends a dom element
function showIconAddMenu() { var apps = FPI.apps.all, i, bundle, sel, name; clearinnerHTML(appList); showHideElement(appList, 'block'); appList.appendChild(createDOMElement('li', 'Disable Edit', 'name', 'Edit')); for (i = 0; i < apps.length; i++) { bundle = apps[i].bundle; sel = FPI.bun...
[ "function reshowAllGuiGenes() {\n updateGuiGenes();\n}", "function displayCoins() {\r\n $('.loadIcon').show();\r\n\r\n const coinsAPI = \"https://api.coingecko.com/api/v3/coins/list\";\r\n\r\n $.get(coinsAPI, function (response) {\r\n let objCoins = response;\r\n // let objCoins = JSON.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs an instance of ConfigurationHandler
function createInstance() { /** * Initialize the configuration. * * @method module:ConfigurationHandler#init * @param {string} region - REGION name where the App Configuration service instance is * created. * @param {string} guid - GUID of the App Configuration service. * @param {...
[ "configurationRequestHandler (context, request, callback) {\n callback(null);\n }", "constructor() { \n \n ConfigHash.initialize(this);\n }", "static create() {\n return new FastHttpMiddlewareHandler();\n }", "function Configuration(resource) {\n // defining the encoding as u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CODING CHALLENGE 619 Create a function that takes the number of daily average recovered cases recovers, daily average newCases, current activeCases, and returns the number of days it will take to reach zero cases.
function endCorona(recovers, newCases, activeCases) { return Math.ceil(activeCases / (recovers - newCases)); }
[ "function checkerdex(dates)\n{\n\tvar sum = 0;\n\n\tvar now = dates[dates.length - 1];\n\tfor (var i = 0; i < dates.length; i++)\n\t{\n\t\tvar weight = (rangeMS - (now - dates[i])) / rangeMS;\n\t\tsum += weight * baseScore;\n\t}\n\n\treturn sum;\n}", "function infectionsByRequestedTimeCalc(\n currentlyInfected,\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Measures the efficiency of the interaction from 0 to 1. Efficiency is a notion of how well we used the machine's limited resources in service of this interaction. If we used it perfectly, we would get a 1.0. If we used everything that there was to use power, memory, cpu, then we'd get a zero.
get normalizedEfficiency() { return this.normalizedCpuEfficiency; }
[ "function speedCalc() {\n\t\t\treturn (0.4 + 0.01 * (50 - invadersAlive)) * difficulty;\n\t\t}", "function total_efficiency(patients, prop){\n\tvar total_obs = 0\n\tvar\ttotal_req = 0\n\tvar pr = prop\n\tvar ignored = ['Pool','Exit']\n\tif(prop == \"waits\"){\n\t\tpr = \"waits_arr\"\n\t}\n\tpatients.forEach(funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }