query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Function to wrap error message
function wrapError(error, name) { if (!TRANSACTION_ERROR_CODES.includes(name)) return Error(`Passed error name ${name} is not valid.`) error.code = name return error }
[ "editMessageError(options) {\n // check if a custom error was given\n if (options.error && options.error.custom_error) {\n // check which custom error\n switch (options.error.custom_error) {\n case \"remove_account\": {\n // check for user info s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create Scenario details to display
createScenarioDetails() { return this.props.activeScenario ? (<b> Scenario ID: {this.props.activeScenario.ScenarioID} | Name: {this.props.activeScenario.Name} </b>) : null; }
[ "create(req, res) {\n Scenario.create(req.body)\n .then(function (newScenario) {\n res.status(200).json(newScenario);\n })\n .catch(function (error) {\n res.status(500).json(error);\n });\n }", "show(req, res) {\n Scenario....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Maps and validates src data.
function mapSource(src) { if (types.isPlainObject(src)) { return utils.pick(src, ["content", "path"]); } if (types.isString(src)) { return src; } throw new Error("Invalid format for input file to bundle."); }
[ "loadSrcSet() {\n if(this.fredCropper.el.attributes.srcset.value === \"null\") {\n console.log('correctly null');\n return false;\n }\n let srcset = this.fredCropper.el.attributes.srcset.value.split(',');\n\n srcset.forEach(function(t){\n let width = t.su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
document.getElementById("resultado").value= resultado != undefined ? resultado : ' ';
function apresenta(valor){ document.getElementById("resultado").value=valor; }
[ "function resultado(result){\n if((calculadora.innerHTML === 0 || calculadora.innerHTML === \"0\") && valor2 === 0){\n console.log(\"debe ingresar un numero o realizar una operacion\");\n }else{\n if(operation === \"sum\"){\n sumar();\n }\n if(operation === \"rest\"){\n restar();\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a d3 callable function to make an element dropable, managed the class css 'drag_over' for hovering effects
function dropAble(mimeTypes, onDrop) { return ($node) => { $node.on('dragenter', function () { const e = __WEBPACK_IMPORTED_MODULE_0_d3__["event"]; //var xy = mouse($node.node()); if (hasDnDType(e, mimeTypes) || isEdgeDnD(e)) { Object(__WEBPACK_IMPOR...
[ "function drop(ev) {\n $('.tile').removeClass('hover');\n ev.preventDefault();\n\n const tile = $(ev.target);\n const row = tile.attr('row');\n const col = tile.attr('col');\n\n if (row !== undefined) {\n if (dragElement.attr('row') !== undefined) {\n const oldRow = dragElement.attr('row');\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Upgrades all registered components found in the current DOM. This is automatically called on window load.
function upgradeAllRegisteredInternal() { for (var n = 0; n < registeredComponents_.length; n++) { upgradeDomInternal(registeredComponents_[n].className); } }
[ "function attachOnDOM(){\n\tdocument.getElementsByTagName('body')[0].appendChild(getComponent())\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}", "setDomElements() {\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility for apply this object's scale to any xyz point.
_applyScale(point) { let scale = this.getScale() return { x: point.x * scale, y: point.y * scale, z: point.z * scale, } }
[ "static scale(_matrix, _x, _y, _z) {\n return Mat4.multiply(_matrix, this.scaling(_x, _y, _z));\n }", "get scale() { return (this.myscale.x + this.myscale.y)/2;}", "scale(scale) {\n return new Vector3(this.x * scale, this.y * scale, this.z * scale);\n }", "scale(scale) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helpers Augment an target Object or Array by intercepting the prototype chain using __proto__
function protoAugment(target,src){/* eslint-disable no-proto */target.__proto__=src;/* eslint-enable no-proto */}
[ "function extend(__proto__) {\n for (var key in __proto__) {\n if (hasOwnProperty.call(__proto__, key)) {\n this[key] = __proto__[key];\n }\n }\n return this;\n }", "function overridePrototype(prototype, methodName, func) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Like `runRandomAction`, but assigns an equal selection weight to all valid action types.
function getRandomActionByType(db, allActions){ let allPossibleByType = possibleActionsByType(db, allActions); let type = randNth(Object.keys(allPossibleByType)); return randNth(allPossibleByType[type]); }
[ "sampleAction(array) {\n this.action(sample(array.map(e => actions[e])))\n }", "function performSelectedAction(){\r\n\tswitch(selectedAction){\r\n\tcase GameScreenActionType.mainmenu:\r\n\t\tperformQuit();\r\n\t\tbreak;\r\n\tcase GameScreenActionType.hints:\t\r\n\t\ttoggleHints();\r\n\t\tbreak;\r\n\tcase Game...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shut down the program Close storage and do whatever else needs cleaning up.
function shutdown () { storage.close(function () {}); }
[ "close() {\n\t\tlogger.info('Started database closure procedure');\n\t\tthis.database.removeCollection('profiles');\n\t\tlogger.info('Removed collection from database');\n\t\tthis.database.close(() => {\n\t\t\tlogger.info('Closed database');\n\t\t\tthis.database.deleteDatabase(() => {\n\t\t\t\tlogger.info('deleted ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Grid is defined as a series of obstacles
function Grid (obstacles){ this.obstacles = obstacles; }
[ "function drawObstacles(){\n if(obstacles.length>0){\n obstacles.forEach(obstacle => {\n obstacle.draw();\n });\n }\n}", "function gridify() {\n let numDivision = ceil(Math.sqrt(obj.numOfMols));\n let spacing = (width - obj.maxMolSize) / numDivision;\n\n molecules.forEach((molecule, index) =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function finds the snapped location from the database
function findSnappedLocation(lineLocation){ var finalLocation=lineLocation; var listSize=globalPlList.size; for(var i=1;i<=listSize;i++){ var line = globalPlList.get(i.toString()); if(line!=undefined){ var startPath=line.getPath().getAt(0); var endPath=line.getPath().getAt(1); var tempCircleStart=new go...
[ "function findLocation() {\n\tuserMap.locate({setView: true, maxZoom: 5});\n}", "function locationFinder() {\n\t\t\tvar locations = [];\n\t\t\t// iterates through entries location and appends each location to\n\t\t\t// the locations array\n\t\t\tfunction appendLocations(entriesID) {\n\t\t\t\tmyData.forEach(functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RIGHTCLICK MENU //////////////////////////// Creates rightclick context menu for map
function createMapMenu() { ctxMenuForMap = new Menu({ onOpen: function(box) { // Lets calculate the map coordinates where user right clicked. // We'll use this to create the graphic when the user clicks // on the menu item to "Add Text" currentLocation =...
[ "function handleRightClick(event) {\n var target = event.target || event.toElement;\n\n if (!target) {\n return;\n }\n\n var figure = findFigure(scribe, target);\n\n if (figure) {\n event.preventDefault();\n event.st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
force mount identifier field event handler
function automountId() { let idHandle = 0; idHandle = setInterval(() => { if (!getIdentifier()) return; clearInterval(idHandle); idHandle = 0; let focusElem = document.activeElement; getIdentifier().blur(); //force state getIdentifier().addEventListener("focus", () => { mountListener...
[ "enterFieldAccess_lf_primary(ctx) {\n\t}", "enterFieldAccess_lfno_primary(ctx) {\n\t}", "_listenFieldSelected() {\n var self = this;\n self.m_fieldChangeHandler = function (e) {\n if (!self.m_selected)\n return;\n var $selected = $(e.target).find(':selected');\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compara dos numeros y retona un mensaje si son iguales o cual es el mayor
function comparar(n1,n2) { if (parseInt(n1) == parseInt(n2)){ alert("Estos numeros son iguales"); } if (n1 > n2 ){ alert("El Número 1 es mayor"); }else alert("El Número 2 es mayor"); }
[ "function compareNumber(){\n var insideInputAsAString = number.value;\n var insideInput = parseInt(insideInputAsAString);\n if (insideInput===randomNumber){\n clues.innerHTML = 'HAS GANADO, CAMPEONA';\n console.log('HAS GANADO, CAMPEONA');\n }else if(insideInput<randomNumber){\n clues.innerHTML = 'Dema...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr', nullterminated and encoded in ASCII form. The copy will require at most str.length+1 bytes of space in the HEAP.
function stringToAscii(str, outPtr) { return writeAsciiToMemory(str, outPtr, false); }
[ "function cpp2js(str) {\n const nullIndex = str.indexOf(\"\\0\");\n if (nullIndex === -1)\n return str;\n return str.substr(0, nullIndex);\n}", "function objj_string(string) {\n\treturn new _CPString2.default(string);\n}", "function stringToByteArray(string){\n var byteArray = new Uint8Array(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================================================= double x, FILE f
function readDouble(x, f) // // Input: none // Output: x = pointer to a double variable // Purpose: reads a floating point value from a hot start file // { // --- read a value from the file if ( feof(f) ) { (x) = 0.0; report_writeErrorMsg(ERR_HOTSTART_FILE_READ, ""); retu...
[ "function readFloat(x, f)\n//\n// Input: none\n// Output: x = pointer to a float variable\n// Purpose: reads a floating point value from a hot start file\n//\n{\n // --- read a value from the file\n fread(x, sizeof(float), 1, f);\n\n // --- test if the value is NaN (not a number)\n if ( (x) != (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Same as 'string'.codePointAt(pos), but works in older browsers.
function codePointAt(string, pos) { var first = string.charCodeAt(pos), second; if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { second = string.charCodeAt(pos + 1); if (second >= 0xDC00 && second <= 0xDFFF) { // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae...
[ "getChar(pos) {\n return this.document.getText(new vscode.Range(pos, pos.translate(0, 1)));\n }", "function getCodePoints(string) {\n var newArray = [];\n for (i = 0; i < string.length; i++) {\n newArray.push(string.codePointAt(i));\n\n }\n return newArray;\n}", "function returnACha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the longest tick width and height
function calcMaxLabelSizes() { calcTickLabelSizes(); maxLabelWidth = d3.max(tickDimensions, function(d) { return d.width; }); maxLabelHeight = d3.max(tickDimensions, function(d) { return d.height; }); }
[ "function maxTickLength() {\n\treturn(0.1) // Default is 1 hour which is just arbitrarily large\n}", "get minorTickEndExtent() {\n return this.i.b6;\n }", "function tickCount() {\n\t\t\tif (svgWidth <= 500) { \n\t\t\t\tbottomAxis.ticks(5);\n\t\t\t\tleftAxis.ticks(5);\n\t\t\t\t}\n\t\t\telse {\n\t\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if Mail Attachment link is shown and encryption enabled
function checkAttLink(model, view) { if (model.get('share_attachments')) { if (model.get('share_attachments').enable) { if (model.get('encrypt')) { showAttLink(view, false); } } } }
[ "function checkAttLinkChange(model) {\n if (model.get('share_attachments')) {\n if (model.get('share_attachments').enable) {\n require(['io.ox/core/tk/dialogs', 'settings!io.ox/mail'], function (dialogs, mail) {\n var dialog = new dialogs.CreateDialog({ width: 450...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets whether multiple values can be selected.
isMultipleSelection() { return this._multiple; }
[ "function isValueSelected(idx, selectedValues) {\n\t\t\t\t if ($scope.model.valuelistID) {\n\t\t\t\t \t\tif (selectedValues) {\n\t\t\t\t \t\t\tfor (var v = 0; v < selectedValues.length; v++) {\n\t\t\t\t \t\t\t\tif ($scope.model.valuelistID[idx].realValue == selectedValues[v]) {\n\t\t\t\t \t\t\t\t\treturn true;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load image from href into overlayBox
function load_image( href ) { var image = new Image(); image.onload = function() { reveal( '<img src="' + image.src + '">' ); } image.src = href; }
[ "function loadCustomLightbox(product, button) {\n var imgLocation;\n if (button === \"example\") {\n imgLocation = window.LightboxRoot + product + '-examples.jpg'\n } else if (button === \"moreInfo\") {\n imgLocation = window.LightboxRoot + product + '-box.jpg'\n } ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads the content property on the documentElement ::before pseudo element for a string of ordered, commaseparated, breakpoint names.
function readCSSBreakpoints() { return window .getComputedStyle(document.documentElement, ':before') .getPropertyValue('content') .replace(/"/g, '') .split(','); }
[ "matchBefore(expr) {\n let line = this.state.doc.lineAt(this.pos)\n let start = Math.max(line.from, this.pos - 250)\n let str = line.text.slice(start - line.from, this.pos - line.from)\n let found = str.search(ensureAnchor(expr, false))\n return found < 0\n ? null\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Unfollows a given channel with a given user.
async unfollowChannel(user, channel) { const userId = extractUserId(user); const channelId = extractUserId(channel); await this._client.callApi({ url: `users/${userId}/follows/channels/${channelId}`, scope: 'user_follows_edit', method: 'DELETE' }); ...
[ "removeUserFromChannel(username, channel){\n var index = -1;\n var ch = this.getChannelByName(channel);\n if(ch != null){\n for (var i = 0; i < ch.users.length; i++) {\n var u = ch.users[i];\n if(u.name == username){\n index = i;\n }\n }\n }\n if(index > -1 && ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: doCheckJobsProcess This function is handler for different Kue Job events. When from application, done() API gets called, then this API gets invoked
function doCheckJobsProcess () { if (!parseJobsReq.registeredJobs.length) { /* If there is no registered jobs, do not subscribe for jobs events */ return; } jobsApi.jobs.on('job complete', function (id) { logutils.logger.info("We are on jobs.on for event 'job complete', id:" + id); jobsApi....
[ "function processJobs () {\n jobs.process('url_jobs', function(job, cb) {\n fetchHTMLAndStore(job.data.URL, job.id, function(fetchError, resp) {\n if(fetchError) return cb(new Error('Job with jobId' + job.id + ' could not be processed'));\n // Job is removed from the queue after it h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Element event on focus in
onElementFocusIn(e){ e.preventDefault(); this.$parent.classList.add(this.className.focused); return false; }
[ "_handleFocusChange() {\n this.__focused = this.contains(document.activeElement);\n }", "didFocus () {\n\n }", "add_focus() {\n this.element.focus();\n }", "function elementFocus(e){\n\t\t\tapplyBg(this,\"jQueryMultipleBgFocusSelector\");\n\t\t}", "onFocusGained(cb) {\n this.on('focu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Split the values of a Tensor into the TensorArray.
split(length, tensor) { if (tensor.dtype !== this.dtype) { throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${tensor.dtype}`); } let totalLength = 0; const cumulativeLengths = length.map(len => { totalLength += len; return total...
[ "function createWebcamTensor(){\n\t// Get the img from the canvas and normalize the values\n\tlet webcamImg = [];\n\tloadPixels();\n\tfor(let j=0 ; j<height ; j++){\n\t\tfor(let i=0 ; i<width ; i++){\n\t\t\tlet pix = (i + j*width)*4;\n\t\t\twebcamImg.push(map(pixels[pix+0], 0, 255, -1, 1));\n\t\t\twebcamImg.push(ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to enable side with it's inputs and selections
function enableSides(side,dimension,color,mount){ $(side).css({"opacity":"1"}); $(side).removeAttr('disabled'); $(dimension).css({"opacity":"1"}); var dimensionInput = (dimension + " input"); $(dimensionInput).removeAttr('disabled'); $(color).css({"opacity":"1"}); ...
[ "get selectable() { return true }", "enable() {\n this._enabled = true;\n this._model = new SelectionModel(this._bufferService);\n }", "function ontoggle() {\n selected = !selected;\n logic.ontoggle(selected);\n }", "function mousePressed(){\n if(selected === null){\n let...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List the nichandle.sshKey objects [PRODUCTION] [See on api.ovh.com](
ListOfYourPublicSSHKeys() { let url = `/me/sshKey`; return this.client.request('GET', url); }
[ "function getStorageKeyList(){\n storageClient.storageAccounts.listKeys(resourceGroupName, 'saketsa', function (err, result, request, response) {\n if (err) {\n console.error('\\nERROR:' + err);\n }\n else{\n // fs.writeFileSync('./result.json', util.inspect(result) , 'utf...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: update spriteClips clientside instead. The game will have to track player's facing direction a different way
updateSpriteClip(p, action, keydown) { // Only update if grenade is live if (this.grenadeState === 0) { if (this.inputs[p].punch) { if (action === "punch" && keydown) { this.spriteClips[2 * p] = this.spriteClips[2 * p] < 4 ? 3 : 7; } } else if (keydown) { swit...
[ "frontFlip() {\n\t\tsuper.frontFlip(KEN_SPRITE_POSITION.frontFlip, KEN_IDLE_ANIMATION_TIME - 3, false, 2, MOVE_SPEED + 3);\n\t}", "update()\n {\n for(let i = 0; i < this.sprites.length; i++)\n {\n this.sprites[i].update();\n }\n }", "updateSprite() {\n\t\tif(!this.multiText...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
attempting to disable button if camera is too far
disableButton(objDistance) { //if z index of camera is close to obj --> can click // const zIndex = cameraPosition[2] // console.log("Camera2", zIndex) // // //if zVertex is within objDistance +/- 100, canClick = true // if (zIndex <= objDistance + 100 && zIndex >= objDistance - 100) { // this...
[ "toggleCamera() {\n this.controls.enable = false;\n if (this.camera === this.orthoCamera) {\n this.camera = this.perspCamera;\n this.controls = this.perspControls;\n }\n else {\n this.camera = this.orthoCamera;\n this.controls = this.orthoControls;\n }\n this.controls.enable = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
8fim 10Chaca formas de pagamentos ja cadastrada
function checaFormaPagto(formaPagtoCadastrada) { for (var i = 0; i < $scope.formaPagtosAvista.length; i++) { for (var j = 0; j < formaPagtoCadastrada.length; j++) { if ($scope.formaPagtosAvista[i].Id === formaPagtoCadastrada[j].FormaPagtoId && for...
[ "function loadFormaPagto() {\n apiService.get('/api/fornecedor/formaPagto', null,\n loadFormaPagtoSucesso,\n loadFormaPagtoFailed);\n }", "function ultimaPagina(){\n\tif(pagina_actual!=paginas_totales){\n\t\tpagina_actual=paginas_totales;\n\t\tconsole.log('Moviendon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write JS to request a redraw.
requestRedraw() { this.source += 'runtime.requestRedraw();\n'; }
[ "function redraw() {\n\tvar html = window.renderProgram(program);\n\t$(\"#editor\").html(html);\n}", "draw() {\n\t\tconst output = this.buffer.join(\",\");\n\t\tthis.style.applyCSS(output);\n\t}", "function redrawCurStep() {\r\n\r\n\r\n var fO = CurFuncObj;\r\n var sO = CurStepObj;\r\n\r\n // for all g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check the current phase
is(phase) { return this._phase == phase; }
[ "async function timeTravelToTransition() {\n let startTimeOfNextPhaseTransition = await stakingHbbft.startTimeOfNextPhaseTransition.call();\n\n await validatorSetHbbft.setCurrentTimestamp(startTimeOfNextPhaseTransition);\n const currentTS = await validatorSetHbbft.getCurrentTimestamp.call();\n currentTS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsercondition.
visitCondition(ctx) { return this.visitChildren(ctx); }
[ "function parse_BooleanExpr(){\n\t\n\tdocument.getElementById(\"tree\").value += \"PARSER: parse_BooleanExpr()\" + '\\n';\n\t\n\n\t\n\tvar tempDesc = tokenstreamCOPY[parseCounter][0]; //check desc of token\n\tvar tempType = tokenstreamCOPY[parseCounter][1]; //check type of token\n\tif (tempDesc == '('){\n\t\tmatchS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Next Reverse ORF function
function nextReverseORF() { if (needToResetORFList) { reverseArrayAndIndex = getReverseORFS(); reverseCurrentORF = reverseArrayAndIndex[0]; reverseNumORF = reverseArrayAndIndex[1]; reverseIndex = reverseArrayAndIndex[2]; if (reverseLoopCountORF >= reve...
[ "function nextForwardORF() {\n if (needToResetORFList) {\n forwardArrayAndIndex = getForwardORFS();\n forwardCurrentORF = forwardArrayAndIndex[0];\n forwardNumORF = forwardArrayAndIndex[1];\n forwardIndex = forwardArrayAndIndex[2];\n if (forwardLoopCount...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: isInCurrentSite DESCRIPTION: If there is a site currently selected and the path is in the currently selected site returns true. ARGUMENTS: path url to be checked if it is in the current site RETURNS: dom object
function isInCurrentSite(path) { var siteRoot = dw.getSiteRoot(); var inCurSite = false; if (siteRoot) { var siteRootForURL = dwscripts.filePathToLocalURL(site.getSiteRootForURL(path)); inCurSite = (siteRoot == siteRootForURL); } return inCurSite; }
[ "function isPath(path) {\n\treturn path === window.location.pathname.slice(-path.length);\n}", "function hasPathTo(v) {\n return this.visitedBfs[v];\n }", "onCurrent(element) {\n\t\tvar slide = _.getSlide(element);\n\n\t\tif (slide) {\n\t\t\treturn \"#\" + slide.id === location.hash;\n\t\t}\n\n\t\treturn fa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
on player ready event
function onPlayerReady(){ g_isPlayerReady = true; }
[ "function onPlayerReady( data ) {\n\n // Turn down the volume and kick-off a play to force load\n player.bind( SC.Widget.Events.PLAY_PROGRESS, function( data ) {\n // Turn down the volume.\n // Loading has to be kicked off before volume can be changed.\n player.setVolume( 0 );\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getNextHoursForecast() grabs data needed for Hourly section
function getNextHoursForecast(data) { // Resolves issue of stacking array elements every time user hits refresh next_hours_temp = []; next_hours_weather = []; next_hours_time = []; for(var i = 1; i < 15; i++) { var hour_temp = Math.round(data.hourly[i].temp) + "°C"; next_hours_temp.push(hour_temp); ...
[ "async function getForecast() {\n\n const response = await fetch(`https://api.openweathermap.org/data/2.5/onecall?lat=38.62&lon=-90.19&exclude=hourly,minutely,current,alerts&units=imperial&appid=${process.env.WEATHER_API_KEY}`);\n const body = await response.json();\n\n const result = body.daily.map(day => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes a query and returns a new query which returns the total count of rows which the first query returns.
function countQuery(query, opts) { opts = opts || {}; var newQuery = query.clone(); var queryBuilder; if (opts.trx) { queryBuilder = opts.trx; } else { queryBuilder = knex; } return queryBuilder .select() .count() .from( knex.raw('(' + newQuery.toString...
[ "diff(query) {\n if (this.useInitialQuery(query)) {\n return {\n result: this._INITIAL_QUERY.result,\n complete: true\n };\n }\n return super.diff(query);\n }", "function countRows() {\r\n $('#resultTable tr:not(:first-child)').each(function (i, item) {\r\n $(th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determins which lines from a range to be highlighted.
function getLineNumberHighlights(line_numbers) { var highlights = num_range = []; var start = end = num = 0; // Split line groups on comma if (line_numbers.indexOf(',') > 0) { line_numbers = line_numbers.split(","); } else { // No seperator, assume it is just a single line. line_numbers = [line_...
[ "function getLinesInRange(doc, range) {\n let line = doc.lineAt(range.from);\n const lines = [];\n while (line.from + line.length < range.to ||\n (line.from <= range.to && range.to <= line.to)) {\n lines.push(line);\n if (line.number + 1 <= doc.lines) {\n line = doc.line(lin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize the variables for the followCam
function initFollowCam(camHeight, newFollowingDistance) { followingDistance = newFollowingDistance; followCam = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 ); followCam.position.set(0, camHeight, 0); followCam.lookAt(scene.position); followCamRig = new ...
[ "initCameras() {\n this.camera = new CGFcamera(0.4, 0.1, 500, vec3.fromValues(0, 12, -15), vec3.fromValues(0, 10, 0));\n this.interface.setActiveCamera(this.camera);\n }", "constructor(info: CameraInfo) {\n const { binning_x, binning_y, roi, distortion_model, D, K, P, R } = info;\n\n if (di...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
send a binary message
function sendBinaryMessage(buffer) { lock=1; iridium.sendBinaryMessage(buffer, function(err, momsn) { if (err==null) { if (buffer) sys.log("[SBD] Binary message sent successfully, assigned MOMSN "+momsn); // check to see if there are other messages pending - if there are, send a...
[ "write(buffer) {\n this.wsSocket.send(buffer);\n }", "function send( type, data ) {\n\tServer.send( type, data );\n}", "async _sendMsg (cmd, arg1, arg2, payload) {\n let adbPacket = generateMessage(cmd, arg1, arg2, payload);\n await this.outputEndpoint.transferAsync(adbPacket);\n if (payload ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ensure all tags have a tagId and build object keyed by id
_buildTags(headTagsArray) { let tagMap = {}; headTagsArray.forEach(function (tagDefinition) { if (!tagDefinition || !VALID_HEAD_TAGS.has(tagDefinition.type)) { return; } let tagId = tagDefinition.tagId; if (!tagId) { tagId = guidFor(tagDefinition); } tagMap[ta...
[ "function saveTags(id, tags) {\n tags = tags.trim().split(\",\") //turn comma separated list into array\n tags.forEach(tag => {\n insert_tag.run(tag.trim()) //create tag if it doesn't exist\n insert_docTag.run(id, tag) //add tag to document\n });\n}", "updateTags(objectList) {\n let self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SETTING PARAGRAH VALUES You can also add a default paragraph on the DOM when you refresh the page But there is a difference that when you call the variable with value attribute instead of value you have to use "innerHTML" of "innerText"
function setPara() { var name = document.getElementById("para") name.innerText = "Hello this is an example" }
[ "set fieldValue(value){\n this.element.innerHTML = value;\n }", "function updateParagraph() {\n // get all of the input values\n let textColor = document.getElementById('textColor').value;\n let fontSize = document.getElementById('fontSize').value;\n let backgroundColor = document.getElementById...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a valid document for storage given a collection of keyvalue pairs.
static toDocument( pairs ) { var obj = {}; for(var i=0; i<pairs.length; i++ ) { var p = pairs[i]; console.log("...adding property: %o", p); if( p.name === 'id' ) obj["_id"] = p.value; else obj[p.name] = p.value; } ...
[ "create({\n name = \"New document\", width = 1000, height = 1000, layers = [], selections = {}\n } = {}) {\n if ( !layers.length ) {\n layers = [ LayerFactory.create({ width, height }) ];\n }\n return {\n id: `doc_${( ++UID_COUNTER )}`,\n layers,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change event for JS editor. Warn the user, then disconnect the link from blocks to JavaScript.
function editorChanged() { if (ignoreEditorChanges_) { return; } const code = BlocklyCode.getJsCode(); if (BlocklyInterface.blocksDisabled) { if (!code.trim()) { // Reestablish link between blocks and JS. BlocklyInterface.workspace.clear(); setBlocksDisabled(false); } } else { ...
[ "function vB_Text_Editor_Events()\n{\n}", "listenEditorToggle() {\n const editorToggleEl = h.getEditorToggleLink();\n editorToggleEl.addEventListener('click', function () {\n editor.toggle();\n event.preventDefault();\n }, false);\n }", "onHideEditorPanel()\n\t{\n\t\tthis.#postIn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End of the function which opens the photofiled input for adding post Beggining of : the function responsible for removing photo
function removePhoto(){ document.getElementById("PhotoField").disabled = true; $("#PhotoField").val(""); $("#PhotoParentDiv").hide(); $("#imageIcon").css('color',"#9ba1a7"); // for edit page document.getElementById("fileRemovedStatus").disabled = false; }
[ "function _removeImageFromBlock(e) {\n e.preventDefault();\n\n var\n $this = $(this),\n container = $this.closest('.morris-uploader'),\n fileInput = container.find('input[type=\"file\"]'),\n removeDetector = container.find('input.detached-logo'),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
new Store(options) options (Object): Store configuration options. See below. Creates new store instance. Options `get(keys, params, options, callback(err, results))` (Function): REQUIRED A getter backend `set(settings, params, callback(err))` (Function): REQUIRED A setter backend
function Store(options = {}) { this.__set__ = options.set; this.__get__ = options.get; this.__keys__ = {}; }
[ "function CassandraStore(options) {\n Store.call(this)\n\n options = (options || {})\n\n const clientOptions = Object.assign({\n contactPoints: ['127.0.0.1'],\n authProvider: new PlainTextAuthProvider(\n 'cassandra', 'cassandra'\n ),\n queryOptions: { prepare: true }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hyphenates a camelcased CSS property name, for example: > hyphenateStyleName('backgroundColor') hyphenateStyleName('MozTransition') hyphenateStyleName('msTransition') < "mstransition" As Modernizr suggests ( an `ms` prefix is converted to `ms`.
function hyphenateStyleName(name){return name.replace(uppercasePattern,'-$1').toLowerCase().replace(msPattern,'-ms-');}
[ "static toStyleClass(str) {\n return str.replace(/(\\w)([A-Z])/g, (_m, m1, m2) => m1 + \"-\" + m2).toLowerCase();\n }", "function camelize(s) {\n\t\t\t\t// Remove data- prefix and convert remaining dashed string to camelCase:\n\t\t\t\treturn s.replace(regexDataPrefix, '$1').replace(regexDashB4, function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set particle mass. mass == 0.0 is static particle.
function set_mass(particle_data, index, mass) { particle_data.mass[index] = mass; particle_data.inv_mass[index] = mass !== 0.0 ? 1.0 / mass : 0.0; }
[ "getMass() {\n return this.mass;\n }", "function Particle(initialPosition, initialVelocity) {\n this.position = initialPosition;\n this.velocity = initialVelocity;\n this.bestPosition = null;\n this.bestFitness = null;\n this.fitness = 0;\n this.dispersion = 0;\n}", "constructor(x,y,m){\n\t\tthi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes the message count and ensures its a numeric value. Uses `ngettext` to determine which message (singular or plural) should be used then uses `sprintf` to update the dynamic values within the statement. After this is all done, the DOM is updated.
function setMessage() { var inputValue = messageCountElement.value inputValue = parseInt(inputValue.trim(), 10) || 0; messageElement.innerHTML = i18nHelper.t('You have __messages__ new message.', { count: inputValue, messages: inputValue }); }
[ "function generateCountString(errorTotal, warningTotal, infoTotal) {\n var countMessage = \"\";\n\n if (errorTotal == 1) {\n countMessage = getMessage(kradVariables.MESSAGE_TOTAL_ERROR, null, null, errorTotal);\n }\n else {\n countMessage = getMessage(kradVariables.MESSAGE_TOTAL_ERRORS, nu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Carga la pagina en el 'board' de acuerdo a lo especificado en la URL
function loadBoard(page) { if (lastPage == page) { return; } lastPage = page; $('#board').load('./resource/views/' + page + '/' + page + '.html'); if (MENU.includes(page)) { MENU.forEach(link => { $('#' + link).removeClass('menu-active'); if...
[ "function loadBoardByHash()\n{\n let hash = location.hash;\n let page = hash ? hash.slice(1) : 'home';\n\n loadBoard(page);\n}", "function goToMain() {\n document.location.assign('board18Main.php');\n}", "function getBoardFromUrl(url) {\n var result = null;\n boardMap.forEach(function (brd) {\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an entry for the common ancesetor node of two paths.
common(root, path, another) { var p = Path.common(path, another); var n = Node.get(root, p); return [n, p]; }
[ "common(root, path, another) {\n var p = Path.common(path, another);\n var n = Node$1.get(root, p);\n return [n, p];\n }", "function commonAncestor(pathA, pathB, debug = false) {\n // make sure there are absolute\n if (pathA) pathA = path.resolve(pathA) \n if (pathB) pathB = path.resolv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mutates genome by updating connection weight
updateConnectionWeight () { if (!this.connections.length) { return false } this.connections[Math.floor(Math.random() * this.connections.length)].weight = Math.random() }
[ "setWeight(factor) { \n this.weightFactor = factor;\n\n this.edges.forEach(edge => {\n edge.weight = Math.pow(edge.dist, factor);\n\n this.weight[edge.target][edge.source] = edge['weight']\n this.weight[edge.source][edge.target] = edge['weight']\n });\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays the unapplied new migrations. This command will show the new migrations that have not been applied. For example, ``` jii migrate/new showing the first 10 new migrations jii migrate/new 5 showing the first 5 new migrations jii migrate/new all showing all new migrations ``` If it is `all`, all available new migr...
actionNew(context) { var limit = context.request.get(0, 10); if (limit === 'all') { limit = null; } else { limit = parseInt(limit); if (limit < 1) { throw new Exception('The limit must be greater than 0.'); } } ret...
[ "revertAll() {\n this._pendingBackupRebase = true;\n this._pendingUpdates = this._pendingUpdates.filter((update) => update.kind !== 'optimistic');\n }", "static projectListEmpty() {\r\n const template = `\r\n <div class=\"col-12 alert alert-warning\">Empty project list</div>\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this method checks if the cooldown period has passed, since the latest scale in or scale out process
function cooldownPeriodHasPassed(context) { return new Promise((resolve, reject) => { const blobService = azurestorage.createBlobService(process.env.AZURE_STORAGE_ACCOUNT, process.env.AZURE_STORAGE_ACCESS_KEY); blobService.createContainerIfNotExists(config.containerName, function (error,...
[ "checkRange() {\n if (!this.target)\n return;\n if (this.timeToNextAttack < 0)\n return;\n const dist = this.target.position.distanceTo(this.bot.entity.position);\n if (dist > this.viewDistance) {\n this.stop();\n return;\n }\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: this is only needed on the grants page, so only generate when called
function generateGrantCells() { var grants = captable.transactions .filter(function(tran) { return tran.kind == 'grant' && tran.attrs.security_type=='Option'; }); angular.forEach(grants, function(g) { var root = g; an...
[ "function grantPermission(resType, resID, perm, access_list, granter) {\n list = typeof(access_list) == 'string' ? [] + access_list : access_list\n for (var i = 0; i < access_list.length; i++) { //iterate over each email address\n // console.log(\"access_list[i]: \", access_list[i])\n if(access_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new playlist with an appropriate name, description, and image for the artist.
function makePlaylist(artistId) { var sp = getService(); var url = "https://api.spotify.com/v1/artists/" + artistId; var response = refreshToken(sp, function() { return UrlFetchApp.fetch(url, { headers: { Authorization: 'Bearer ' + sp.getAccessToken(), } }); }); var ...
[ "function createSong(playlist, artist, title, link, youtubeUrl) {\n let song = {\n artist: artist,\n title: title,\n link: link,\n youtubeUrl: youtubeUrl\n }\n playlist.songs.push(song);\n\n saveSong(playlist);\n}", "function updatePlaylist(playlist, artistName, songTitle){...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The handler function for the route '/groups/:group_name' Displays the details of a certain group.
function detailsOfGroup(req, res, next) { if (!req.group) { return next(); } res.render('groups_layouts/group_detail', { groupName: req.group.name, teams: req.group.teams, nextFixturesAmount: req.nextFixtures, lastFixturesAmount: req.lastFixtures, user: req.us...
[ "function showGroupName(){\n\tvar url = \"https://\"+CURRENT_IP+\"/cgi-bin/NFast_3-0/CGI/RESERVATIONMANAGER/FastConsoleCgi.py?action=getgroupnamelist&query={'QUERY':[{'username':'\"+globalUserName+\"'}]}\";\n\t\t$.ajax({\n\t\turl: url,\n\t\tdataType: 'html',\n\t\tmethod: 'POST',\n\t\tproccessData : false,\n\t\tasyn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse the incoming Delete Alert Request into a common object
function parseDeleteRequest(req){ var reqObj = {}; reqObj.originalUrl = req.originalUrl; reqObj.uid = req.params.guid; reqObj.env =req.params.environment; reqObj.domain = req.params.domain; reqObj._id = req.params.id; return reqObj; }
[ "function handle_delete(parsedRequest) {\n var resourceName = parsedRequest.resourceName, \n resourceId = parsedRequest.resourceId; \n\n // no data for the resource name is a 404\n if (!DATA[resourceName]) {\n return new ResponseData(404,\"did not find resource: \"+resourceName);\n };\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
promote an employee with a given id
function promoteEmployee(id,callback) { db.run("UPDATE Employees SET role='Manager' WHERE rowid=?", [id], function(err) { callback(); }); }
[ "function _promote() {\n Posts.Promote(vm.post._id)\n .then(_processPromoteData)\n .catch(function(err) {\n console.log(err);\n });\n }", "function promoteToTeacher(id)\r\n{\r\n //Find the participant in the database\r\n participant = getParticip...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the geometry of the print extent feature to match the current scale.
updatePrintExtent() { if (this.isInitiated()) { const printExtent = this.calculatePrintExtent(); if (this._extentFeature) { this._extentFeature.setGeometry(fromExtent(printExtent)); } } }
[ "onTransformScaling() {\n const scale = this.getClosestScaleToFitExtentFeature();\n this.setScale(scale);\n }", "initPrintExtentLayer() {\n if (!(this.extentLayer instanceof OlLayerVector)) {\n const extentLayer = new OlLayerVector({\n name: BaseMapFishPrintManager.EXTENT_LAYER_NAME,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
let hello = new float2(0,0)
function float2(x,y) { this.x = x; this.y = y; }
[ "function InputFloat2(label, v, format = \"%.3f\", extra_flags = 0) {\r\n const _v = import_Vector2(v);\r\n const ret = bind.InputFloat2(label, _v, format, extra_flags);\r\n export_Vector2(_v, v);\r\n return ret;\r\n }", "[symbols.call](obj=0.0)\n\t{\n\t\tif (typeof(obj) === \"strin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the user clicks on a country: 1. If a country is not selected, select it 2. If the user clicks on a selected country, deselect it 3. If a country is selected and the user selects a different country, select the different country instead
function handleCountrySelect(clickObject) { if (selectedCountry) { //case: country is selected if (selectedCountry.toLowerCase() === clickObject.target.feature.properties.name.toLowerCase()) { //case: selected country is reselected selectedCountry = ""; //deselect the country doRefer...
[ "function showcity() {\n let CS = document.getElementById(\"coutriesSelect\");\n let selectedCountry = CS.options[CS.selectedIndex].innerHTML;\n let selectedIdCountry = CS.value;\n\n //in case to prevent double-click:\n if (selectedIdCountry == last_click) {\n return;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Plays the sound clip from the appropriate key in the notes object
function playNotes() { notes[firstNote].sound.play(); console.log(notes[firstNote].sound); setTimeout(function() { notes[secondNote].sound.play(); console.log(notes[secondNote].sound); }, 700); }
[ "function playSound(id) {\n sounds[id].play();\n}", "function play(){\n\treadAndPlayNote(readInNotes(), 0, currentInstrument);\n}", "function playsound() {\r\n audio1.play();\r\n }", "function playSound(squareNum){\n var snd = new Audio(game.sounds[squareNum - 1]);\n snd.play();\n}", "handleTunin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add the board number to the board name
function createBoardName() { let createdBoardName = "My Board " + pm.environment.get("boardNumberAppended"); return createdBoardName; }
[ "hadleTileChange(id, newNumber) {\n\t\tlet boardArray = (this.state.board).split('');\n\t\tboardArray.splice(id, 1, newNumber);\n\t\tboardArray = boardArray.join('');\t\t\t\n\t\tthis.setState({\n\t\t\tboard: boardArray\n\t\t});\n }", "function changeMyName(){\n\t//console.log(\"got here.\")//task:4 test\n\t//t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear ping interval and pong timeout
_clearPingInterval () { if (this._pingInterval) { this._pingInterval = clearInterval(this._pingInterval) this._pongTimeout = clearTimeout(this._pongTimeout) } }
[ "_startPingInterval () {\n const setPongTimeout = () => {\n this._pongTimeout = setTimeout(\n () => this._reconnect(),\n this._options.pongTimeout\n )\n }\n\n this._pingInterval = setInterval(\n () => {\n this.ping()\n setPongTimeout()\n },\n this._optio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
:: Set prompt for reverse search
function draw_reverse_prompt() { prompt = '(reverse-i-search)`' + rev_search_str + "': "; draw_prompt(); }
[ "function reverse_history_search(next) {\n\t var history_data = history.data();\n\t var regex, save_string;\n\t var len = history_data.length;\n\t if (next && reverse_search_position > 0) {\n\t len -= reverse_search_position;\n\t }\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new atom. For debugging purposes it is recommended to give it a name. The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
function Atom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) { if (name === void 0) { name = "Atom@" + getNextId(); } if (onBecomeObservedHandler === void 0) { onBecomeObservedHandler = noop; } if (onBecomeUnobservedHandler === void 0) { onBecomeUnobservedHandler = noop; } var...
[ "function Atom(n) {\n\tthis.type = \"atom\";\n\tthis.name = n;\n}", "function Atom( arg , locale = null , isTmp = false ) {\n\tif ( arg && typeof arg === 'object' ) {\n\t\tthis.assign( arg ) ;\n\t}\n\telse if ( typeof arg === 'string' ) {\n\t\tthis.k = arg ;\n\t}\n\telse if ( typeof arg === 'number' ) {\n\t\tthis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a new Single that resolves to the value of this Single applied to the given mapping function.
map(fn) { return new Single(subscriber => { return this._source({ onComplete: value => subscriber.onComplete(fn(value)), onError: error => subscriber.onError(error), onSubscribe: cancel => subscriber.onSubscribe(cancel), }); }); }
[ "map(mapping) {\n let mapped = this.type.map(this.value, mapping);\n return mapped === undefined ? undefined : mapped == this.value ? this : new StateEffect(this.type, mapped);\n }", "function liftf(binaryFunction){\n\treturn function (x){\n\t\treturn function(y){\n\t\t\treturn binaryFuncti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Thin wrapper over reactaddonsupdate to apply a function at path preserving other references.
function updateIn(rootVal, paths, f) { for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { args[_key - 3] = arguments[_key]; } var ff = function ff(v) { return f.apply(null, [v].concat(args)); }; var newRootVal; if (paths.length > 0) ...
[ "transform(ref, op) {\n var {\n current,\n affinity\n } = ref;\n\n if (current == null) {\n return;\n }\n\n var path = Path.transform(current, op, {\n affinity\n });\n ref.current = path;\n\n if (path == null) {\n ref.unref();\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
After a model loads, this method sets up the custom output properties specified in the "model" section of the interactive and in the interactive. Any output property definitions in the model section of the interactive specification override properties with the same that are specified in the main body if the interactive...
function setupCustomOutputs(outputType, modelOutputs, interactiveOutputs) { if (!modelOutputs && !interactiveOutputs) return; var outputs = {}, prop, output; function processOutputsArray(outputsArray) { if (!outputsArray) return; for (var i = 0; i < outputsArray.length; i++) { ...
[ "function setupCustomParameters(modelParameters, interactiveParameters) {\n if (!modelParameters && !interactiveParameters) return;\n var initialValues = {},\n customParameters,\n i,\n parameter,\n onChangeFunc; // append modelParameters second so they're processed later (and overr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
super_fn calls the old function which was overwritten by this mixin.
function super_fn() { if (!oldFn) { return } each(arguments, function(arg, i) { args[i] = arg }) return oldFn.apply(self, args) }
[ "function super_fn() {\n if (!oldFn) {\n return\n }\n each(arguments, function(arg, i) {\n args[i] = arg\n })\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function download all the files from all the websites being tracked
function downloadAllFiles(){ websites = getAllWebsites(); for(var i=0;i<websites.length;i++){ clickDownloadFiles(websites[i]); } console.log(endDate - initDate); }
[ "function get_files_from_server(){\n //link with file containning the files and folders distribution\n fetch(\"https://raw.githubusercontent.com/Eduardo-Filipe-Ferreira/ADS-Files-Repository/main/FilesLocation.json\")\n .then(response => response.json())\n .then(json => handle_server_files(json[0]));\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parse the arr and set module for each route, it support parent module which in same time a path can has more than one handler. Module can be string of an mjs file for loading dynamic or a regular function
parse(parentPath, arr, parentHandlers, index) { let handler // check if the module is path of mjs file or a function, function can be used as a // middleware or guard switch (typeof arr[index].module) { case 'string': handler = async (outlet) => { const module = await import(...
[ "function runModule() {\n const path = $('body').data('route');\n try {\n require(`./sections/${path}`).default($(document.body));\n } catch (err) {\n // Just ignores error for now.\n console.error(err);\n }\n}", "groupingRoutes() {\n if (!this.routes || this.routes.length <= 0) {\n throw Err...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ex9 Vreau sa am o functie care sa verifice daca numarul dat este divizibl cu 3, 5 sau ambele si sa printeze "THREE", "FIVE", "BOTH" iar daca nu este cu niciunul sa returneze numarul isDiv(15) => "BOTH" isDiv(9)=> "THREE" isDiv(7)=> 7
function isDiv (number) { var number; if (number % 3 === 0 && number % 5 === 0) { return "BOTH"; } else if (number % 3 === 0) { return "THREE"; } else if (number % 5 === 0){ return "FIVE"; } else { return number; } }
[ "function dividieren(a,b) { \r\n if (b != 0) \r\n {\r\n return a / b;\r\n }\r\n \r\n return \"Teilen durch 0 nicht möglich!\";\r\n \r\n}", "function division(a, b) {\n //tu codigo debajo\n let resultado = a / b;\n return resultado;\n​\n}", "function divid(a,b){\n var z = 10;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send the ctrl+c keyboard combination to the current foreground window.
sendCtrlC() { try { var sent = wh.SendInput.apply(wh, makeInputs([ [KBD_KEY_CTRL], [KBD_KEY_C], [KBD_KEY_C, true], [KBD_KEY_CTRL, true] ])); } catch(ex) { return false; } if (sent === -1) ...
[ "static async ctrlClick(selector) {\n return JQueryAction.click(selector, {ctrlKey: true});\n }", "function KeyCut(evt)\r\n{\r\n var nKeyCode;\r\n nKeyCode = GetKeyCode(evt);\r\n switch (nKeyCode)\r\n {\r\n case 13: //enter\r\n Cut();\r\n break;\r\n default:\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create congruency array (is each trial congruent or incongruent)
function createCongruencyArray(batchSize, blockLetter){ // calc how mnay congruent/incongruent trials are needed let nConTrials = Math.ceil(getBlockCongruencies(blockLetter).ct_con * batchSize); let nIncTrials = batchSize - nConTrials; // nIncTrials = Math.ceil(getBlockCongruencies(blockLetter).fl_inc * batchSi...
[ "function generateC(){\n let CRow = []\n C = []\n for(let x = 0; x < 9; x++){\n for(let y = 0; y < 9; y++){\n CRow.push(R[y][x])\n }\n C.push(CRow)\n CRow = []\n }\n}", "nCr_wo_repitition_3(n, r) {\r\n // ht tps://www.geeks forgeeks.org/print-all-possible-combinations-of-r-elements-i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This finds a pie chart slice corresponding to the passed text value and sets the following to the suggested color: the pie slice itself. the item in the legend. the text that appears in the middle of the pie (ring) when the user hovers over a slice.
function setPieSliceColor(text, color) { //find the slice var slice = $("g.piechart-arc:contains('" + text + "')"); //the slice slice.children("path").css('fill', color); //set color for the hover text slice.children("text.piechart-center-primary").css('fill', color); //find the legend i...
[ "function create(data) {\n console.log('one pie coming up... here is data: ');\n console.log(data);\n data = data.slice(0,12);\n\n /* ------- PIE SLICES -------*/\n var slice = svg.select(\".slices\").selectAll(\"path.slice\")\n .data(pie(data))\n\n slice.enter()\n .insert(\"path\")\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
toggleMarker enable/disables shape editting
function toggleShape($li,editable) { $li.each(function() { var $parent = $(this); var index = $('.edit',$parent).attr('data-index'); var isCircle = $('.circle.button',$parent).hasClass('active'); if (isCircle) { circles[i...
[ "function toggleShapes(){\n\tif (shapesOn) {\n\t\tshapesOn = false;\n\t} else {\n\t\tshapesOn = true;\n\t}\n}", "startEditing() {\n if (this.editing) return;\n\n // Force the layer to be visible.\n if (!this.meanlines.on) {\n this.SeismogramMap.toggleLayer(this.meanlines);\n }\n\n this.meanlin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
switchroot(source); update(root); // Layout the tree initially and center on the root node update the tree source source node of the update transition whether to do a transition
function update(source, transition) { selectNode(source); if(source == root){ if (root.children) { root.children.forEach(function(child) { collapseTree(child); }); } } // console.log(flag) // var duration = tra...
[ "function adjustTree(indexMapLeft,root){\n if(root.hasOwnProperty('children')){\n //console.log(root.data.name)\n var cL=root.children[0];\n var cR=root.children[1];\n //console.log(leavesL,leavesR)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Now, we make a function that makes an Username from your email address
function makeMyUsername(email){ let username = email.slice(0,email.indexOf("@")) return username; }
[ "function getUsername() {\r\n \r\n // get's user email:\r\n var email = Session.getActiveUser().getEmail()\r\n // emails in form <username> @ mail.domain\r\n // split --> parse_emial = ['username','mail.com']\r\n var parse_email = email.split(\"@\")\r\n var username = parse_email[0]\r\n \r\n return user...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserexplain_statement.
visitExplain_statement(ctx) { return this.visitChildren(ctx); }
[ "visitSmall_stmt(ctx) {\r\n console.log(\"visitSmall_stmt\");\r\n if (ctx.expr_stmt() !== null) {\r\n return this.visit(ctx.expr_stmt());\r\n } else if (ctx.del_stmt() !== null) {\r\n return this.visit(ctx.del_stmt());\r\n } else if (ctx.pass_stmt() !== null) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks that the private data matches the expected result
function checkPrivateDataContent(privateData, expectedResults) { if (!expectedResults || Object.keys(expectedResults).length === 0) { throw new Error('you have to provide some expected results'); } if (!privateData || Object.keys(privateData).length === 0) { throw new Error('you have to provide private data to ...
[ "function isRealRoom(data) {\n const [ encName, , checksum ] = data;\n\n return getChecksum(encName) === checksum;\n}", "function blockHavePrivateDataHashes(block) {\n\t// iterate over the block to look if there is any trail of private data\n\tlet hasPrivateData = false;\n\n\tconst blockData = block.data.da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add or remove email from list of starred emails
function updateStarredList(emailID) { let newStarred = [...starredEmails]; if (newStarred.includes(emailID)) { newStarred = newStarred.filter((id) => id !== emailID); } else { newStarred.push(emailID); } setStarredEmails(newStarred); }
[ "function getEmailsIDs(id, email, item) {\n if (!pushedEmails.includes(email)) {\n let filterArray = [...filteredUser];\n let clicked = pushedEmails.concat(email);\n let eIDS = emailIDs.concat(id)\n let remove = removed.concat(filterArray.splice(item, 1))\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create custom style for Social Network view.
function getSocialNetworkStyle(socialColor) { return "" + ".material-background-nav-bar {" + " background : " + socialColor + " !important;" + " border-style : none;" + "} " + "md-ink-bar {" + ...
[ "function astra_generate_spacing_preview_social_css( index, builder_type, stack_on, spacing ) {\n\n\tlet selector = '.ast-' + builder_type + '-social-' + index + '-wrap';\n\n\tvar tablet_break_point = astraBuilderPreview.tablet_break_point || 768,\n\t\tmobile_break_point = astraBuilderPreview.mobile_break_poi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the number of steps for a full rotation of phases
getTotalStepCount () { return this.getTotalCycleCount() * this.steps; }
[ "step() {\n const r0 = this.rotors[0];\n const r1 = this.rotors[1];\n r0.step();\n // The second test here is the double-stepping anomaly\n if (r0.steps.has(r0.pos) || r1.steps.has(Utils.mod(r1.pos + 1, 26))) {\n r1.step();\n if (r1.steps.has(r1.pos)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the cylinder table, making sure we have a cylinder with the given mix
function findOrAddCyl(mix) { var cylTable = document.getElementById("addCylindersHere"); var maxDepth = parseFloat(document.getElementById("MaxDepth").value); // We need the maximum depth to do pretty much anything adjustBackGasCylSelect(); // Prune singles from the back gas select if deep if (!isNaN(m...
[ "function addCylinder(kind, deleteCB)\n{\n var cylTable = document.getElementById(\"addCylindersHere\");\n\n // Add a row\n //\n // Cells:\n // 0 - Cylinder select\n // 1 - Mix input\n // 2 - Fill pressure input\n // 3 - Reserve pressure\n // 4 - Delete checkbox\n\n var row = cylTable.insertRow(-1);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Submits the RPC call to move the page to a new render sequence
function movePage() { var moveAfterPageId = $("#moveAfterPageId").val(); var args = { pageId: $("#currentPageId").val(), successCallback: function(result) { rave.viewPage(result.result.entityId); } }; if (moveAfterPageId != MOVE_PAGE_DEFAULT_POSITIO...
[ "navigate(page, pushState=true){\n\n if(pushState)window.history.pushState(\"\", \"\", page);\n\n\n\n let cardViewer = this.getCardViewer();\n if(cardViewer!=false && (page!=\"/search\" && page!=\"/\")){\n cardViewer.view(page);\n }else{\n $(\"#content\").fadeOut(50...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
External methods. attribute boolean readOnly;
get readOnly() { return this._readOnly; }
[ "function makeReadOnlyContentCopyable() {\n try {\n if (typeof g_glideEditorArray != 'undefined' && g_glideEditorArray instanceof Array) {\n for (var i = 0; i < g_glideEditorArray.length; i++) {\n if (g_glideEditorArray[i].editor.getOption('readOnly') == 'nocursor')\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to handle the changes in the service config file. user can add new service without restarting the system
function configChangeListner(){ fs.watch(SERV_CONF_PTH, function (event, filename) { console.log('event is: ' + event); //not working delete require.cache[SERV_CONF_PTH]; serviceConfig = require(SERV_CONF_PTH); }); }
[ "async fileInputChanged () {\n Doc.hide(this.errMsg)\n if (!this.fileInput.value) return\n const loaded = app().loading(this.form)\n const config = await this.fileInput.files[0].text()\n if (!config) return\n const res = await postJSON('/api/parseconfig', {\n configtext: config\n })\n l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Watch for changes in DB and update friends list in frontend.
async watchFriendsList() { await DB.watchFriendsList(); }
[ "function updateFriendsLocations() {\n\n /* TODO: pull from the database to grab friends' locations */\n getFriendsLocation().then(response => {\n setFriends(response);\n })\n \n }", "function setFriendRequests() {\n\n LOG(\"Setting friend requests...\")\n var ref = database.ref('friends')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ensure that the selection is visible to the extent possible.
ensureSelectionIsVisible() { let treeSelection = this.treeSelection; // potentially magic getter if (!treeSelection || !treeSelection.count) { return; } let minRow = null, maxRow = null; let rangeCount = treeSelection.getRangeCount(); for (let iRange = 0; iRange < rangeCount; iRang...
[ "function showSelection() {\n iconsContainer.css(\"visibility\", \"hidden\");\n selectionContainer.css(\"visibility\", \"visible\");\n }", "function ensureSelectionInView() {\n\n //Only if open\n if (!$ctrl.isShowingResults) {\n return;\n }\n\n //Check index\n if (!$ctrl.isN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We make sure that the job id matches the identity info (org id + user id) of the logged in user. This prevents users from being able to access job information for jobs submitted by other orgs.
async function validateJobId(req,res,next){ try { //job id format 00D3h000005XLUwEAO.0053h000002JF4cAAG:usage-00N3h00000DdZSIEA3-CustomField1617213923756 let jobId = req.params.id; let identityKeyFromJob = jobId.split(':')[0]; let identityKey = getIdentityKey(req); if(ide...
[ "checkIfCurrentJob() {\n return (this.jobId === DiffDrawer.currentJobId);\n }", "function checkCurrentJob() {\n if (isCurrentJobApplied()) {\n let params = getURLParams()\n let currentJobId = params.get('currentJobId')\n\n let newAppliedJobs = getAppliedJobs()\n if (!newAp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ADD CITATIONS AND COMMENTS/// ///////////////////////////// Add the users citations to either public or private paths
function addCitations(){ $("#addnotetextarea").hide(); $("#add").toggle(); $("#addnote").die(); //The notes text area $("#addnote").live("click", function(){ $("#addnotetextarea").toggle('slow');//toggle the notes text area }) //cliclking on addpublic ...
[ "function addToPrivate(){\n $(\".addToPrivate\").die();\n $(\".addToPrivate\").live(\"click\", function(){\n var citation = $(this).attr(\"id\").split(\"_\", 2)[1];\n //alert(citation);\n sakai.api.Server.loadJSON(\"/_user\" + sakai.data.me.profile.path + \"/public/cit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
whether this grammar contains epsilon rules
containsEpsilonRules() { return this.productions.find(p => p.isEpsilon()) !== undefined; }
[ "includesEpsilonWord() {\n return includesEpsilonWord(this);\n }", "isNonterminal(symbol) {\n return this.nonterminals.includes(symbol);\n }", "containsDirectRules() {\n return this.productions.find(p => p.right.length == 1 && this.isNonterminal(p.right[0])) !== undefined;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
closes all custom contextmenus except the one for the call sites
function closeAllContextmenus() { closeNodeContextmenu(); closeEdgeContextmenu(); }
[ "function hideAllContextMenus() {\n hideContextMenu(ToolbarElement.color_menu(), ToolbarElement.color_toggle()); // hide color menu\n hideContextMenu(ToolbarElement.paragraph_menu(), ToolbarElement.paragraph_toggle()); // hide paragraph menu\n }", "function close()\n{\n\tif(menuitem) menuite...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Highlight the given [tree](common.Tree) with the given [highlighter](highlight.Highlighter).
function highlightTree( tree, highlighter, /** Assign styling to a region of the text. Will be called, in order of position, for any ranges where more than zero classes apply. `classes` is a space separated string of CSS classes. */ putStyle, /** The start of the range to highlight. */ ...
[ "function dist_syntaxHighlighting(highlighter, options) {\n let ext = [treeHighlighter],\n themeType\n if (highlighter instanceof HighlightStyle) {\n if (highlighter.module)\n ext.push(EditorView.styleModule.of(highlighter.module))\n themeType = highlighter.themeType\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
inserts new width if found in array
function InsertIntoArray(w) { //insert first element if (arrWidth.length == 0) { arrWidth[0] = w; return; } var eleExist = false; for (var i = 0; i < arrWidth.length; i++) { if (arrWidth[i] == w || arrWidth[i] + 2 == w || arrWidth[i] - 2 == w) eleExist ...
[ "function CheckArrayContainsW(w) {\r\n for (var i = 0; i < arrWidth.length; i++) {\r\n if (arrWidth[i] == w || arrWidth[i] + 2 == w || arrWidth[i] - 2 == w)\r\n return arrWidth[i];\r\n }\r\n}", "updateWidth() {\n if (this.setupComplete) {\n let width = this.headerData.get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }