query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
wait and find a specific element with it's Selector and return Visible
async isElementVisible(selector) { let isVisible = true; await page .waitForSelector(selector, { visible: true, timeout: timeout }) .catch(() => { isVisible = false; }); return isVisible; }
[ "async waitForElementVisible (selector) {\n var waitFor = this.waitFor.bind(this)\n var findElement = this.findElement.bind(this)\n return new Promise(async resolve => {\n var isVisible = await waitFor(async () => {\n var el = await findElement(selector)\n return el && await el.isVisible...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create all reviews HTML and add them to the webpage.
function fillReviewsHTML(reviews = self.restaurant.reviews) { const container = document.getElementById('reviews-container'); const title = document.createElement('h2'); title.innerHTML = 'Reviews'; title.tabIndex = 0; container.appendChild(title); if (!reviews) { const noReviews = document.createEleme...
[ "function fillReviewsHTML(reviews) {\n if (!reviews) {\n reviews = restaurantInfo.restaurant.reviews;\n }\n\n const container = document.getElementById('reviews-container');\n const title = document.createElement('h2');\n title.innerHTML = 'Reviews';\n container.appendChild(title);\n\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the initial EncloseCombat board, which is a ROWSxCOLS matrix containing the initial of a certain color.
function getInitialBoard() { var board = []; for (var i = 0; i < gameLogic.ROWS; i++) { board[i] = []; for (var j = 0; j < gameLogic.COLS; j++) { board[i][j] = getRandomColor(); } } while (!CheckMovesAvaiable(board)) { ...
[ "function getBoard(){\n\tvar size = 8;\n\tvar board = new Array(size);\n\tfor (var i = 0; i < size; i++) {\n\t\tboard[i] = new Array(size);\n\t\tfor (var j = 0; j < size; j++)\n\t\t\tboard[i][j] = '*';\n\t}\n\tcreateShips(board, size);\n\tboard = flatten(board);\n\treturn board;\n}", "getRandomEmptyBoardPiece() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to change the colour of the userPos circle.
function colourChange(){ currentColour++; if(currentColour==colours.length)currentColour = 0; circle(context,halfWidth,halfHeight,step/2,true); }
[ "function drawUserPos() {\n circle(context,halfWidth,halfHeight,step/2,true);\n}", "function circlePos() {\n var color;\n switch (toggle) {\n case 0:\n color = blue;\n break;\n case 1:\n color = red;\n break;\n case 2:\n color = green;\n break;\n }\n var xCoord = map(co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function I used to have the live error message appear for credit card
function liveCreditCardError(){ //declare then modify creditError's properties (I think they're called properties) let creditError = document.createElement('p'); creditError.style.color = 'red'; creditError.style.fontSize = 'small'; // attaching the credit error message to the parent of ccNum cc...
[ "function bluesnapGetErrorText(errorCode) {\n switch (errorCode) {\n case '001':\n return Drupal.t('Please enter a valid card number.');\n\n case '002':\n return Drupal.t('Please enter a valid CVV/CVC number.');\n\n case '003':\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Limits the rate of events emitted by the signal to allow at most one event every `n` milliseconds.
throttle (n) { return throttle(n, this) }
[ "static periodic (n) {\n let id\n\n return new Signal(emit => {\n id = setInterval(() => emit.next(), n)\n return () => clearInterval(id)\n })\n }", "function emitAndSample() {\n return Rx.Observable.interval(100) // emit items every 100 ms\n .sample(500) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a [[IRectangle]] object representing a common rectangle that fits all passed in rectangles in it.
function getCommonRectangle(rectangles) { var length = rectangles.length; if (length !== 0) { var minX = void 0; var minY = void 0; var maxX = void 0; var maxY = void 0; for (var i = 0; i < length; i++) { var rectangle = rectangles[i]; minX = min(r...
[ "overlap (other = new Rectangle())\n {\n let olWidth = Math.min(this.position.x + this.width, other.position.x + other.width) - Math.max(this.position.x, other.position.x);\n let olHeight = Math.min(this.position.y + this.height, other.position.y + other.height) - Math.max(this.position.y, other.po...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all of the user's favorited restaurants.
static getFavoriteRestaurants() { return DBHelper.goGet( `${DBHelper.RESTAURANT_DB_URL}/?is_favorite=true`, "❗💩 Error fetching favorite restaurants: " ); }
[ "static getAllRestaurants() {\r\n return DBHelper.goGet(\r\n DBHelper.RESTAURANT_DB_URL,\r\n \"❗💩 Error fetching all restaurants: \"\r\n );\r\n }", "getFavorites() {\n\t\treturn apiFetch(\n\t\t\t{\n\t\t\t\tpath: '/vtblocks/v1/layouts/favorites',\n\t\t\t\tmethod: 'GET',\n\t\t\t}\n\t\t).then(\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Like ? in EBNF, a railroad node that either follows its child or an empty branch.
function maybe(child) { // \u25b6 is a right pointing arrowhead that indicates an empty transition. return or(toNode('\u25b6'), toNode(child)); }
[ "function is_node_empty(node, regardBrAsEmpty) {\n if (regardBrAsEmpty === void 0) { regardBrAsEmpty = true; }\n if (!node)\n return false;\n return (node.nodeType == Node.TEXT_NODE && /^[\\s\\r\\n]*$/.test(node.nodeValue)) ||\n (node.nodeType == Node.C...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if VideoPlayer is supported by calling device
static isVideoPlayerSupported(requestEnvelope) { return requestEnvelope.context.System.device.supportedInterfaces.VideoApp !== undefined; }
[ "function useVideoJs() {\n return !(typeof videojs === \"undefined\");\n }", "static isVideoPlaying(video){return video.currentTime>0&&!video.paused&&video.readyState>2;}", "function isMediaDevicesSuported(){return hasNavigator()&&!!navigator.mediaDevices;}", "function canEnumerateDevices(){return!!...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addRandomDot() adds one random dot to the grid
addRandomDot(){ // get random position from our list of free positions let rand_pos = this.free_pos[Math.floor(Math.random() * this.free_pos.length)]; this.addDot(rand_pos.x, rand_pos.y); }
[ "function addNewDot() {\n random(dots).setAlive();\n}", "addRandomDots(n_dots){\n for(let i= 0; i<n_dots;i++){\n this.addRandomDot();\n }\n }", "moveRandomDot(){\n //console.log(\"(moveRandomDot) called:\");\n let taken_pos = this.getTakenPositions();\n let to_r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fills a hole with a random stimulus you have to pay attention that "a random stimulus" may be also a clue
function fillHole(stimulus_name, idx) { var el = (stimulus_name === "position") ? 0 : 1; if (block[idx][el] === 0) { block[idx][el] = 1 + Math.floor(Math.random() * 8); if (block[idx - n] && block[idx][el] === block[idx - n][el]) (block[idx][el...
[ "function repeatMoles () {\r\n randHoleIdx = Math.floor(Math.random()*(holes.length)+1);\r\n holes[randHoleIdx].classList.toggle(\"mole\");\r\n}", "function setPattern() {\n //zeroArray();\n\n if(difficulty < 12) {\n difficulty = 4 + (p_score/20);\n }\n \n let tiles = 0;\n\n while(t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funcion para el Servicio de Mensajes Obtiene el id del frame del contenedor a partir de su flujoId
function obtenerIDContenedor(flujoId) { var contenedorID =null; var contenedora=false; var urlsDesconexionAux=null; var documento=null; var nombrePadre=null; var frame = null; try { try { //Se comprueba si se está en la página contenedora o en el contenedor if (urlsDesconexion!=undefine...
[ "function obtenerContenedor(flujoId)\n{\n \n var contenedor =null;\n var contenedora=false;\n var urlsDesconexionAux=null;\n var documento=null;\n var ventanasEmergentes_IdentificadoresAux=null;\n //variable para almacenar el nombre de la ventana padre\n var nombrePadre=null;\n var frame = null;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
9. Create a function called listMovies Your function should take no parameters It should loop over all of the movies in the movieQueue, and return the string: "Here are the current movies: , , "
function listMovies(){ for (var i = 0; i < movieQueue.length; i++) { return "Here are the current movies: "+ movieQueue[0]+"," +" "+ movieQueue[1]+","+" "+movieQueue[2]+", "; } }
[ "function BrowseMovies() \n{\n HideListingCriteria();\n movieCriteria = \"All\"\n movieCriteriaValue = \"Movies\";\n BuildMoviesCache(MOVIE_LISTING_URI)\n startPage = 0;\n FetchTitles(startPage)\n}", "function addMoviesToEnd() {\n var movies = [\"mac\", \"burger\", \"Slash\"];\n for (var i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Sheet | Type = Internal Function
function getSheet(sname){ var sheet = SpreadsheetApp.openByUrl(SpreadsheetURL).getSheetByName(sname); return sheet.getRange(1, 1, sheet.getLastRow(), sheet.getLastColumn()).getValues(); }
[ "function articleSheet(){\n if(!articleSheetInstance) articleSheetInstance = sheet(\"articles\")\n return articleSheetInstance\n}", "function getOtherSheet(otherShet){\n switch(otherShet){\n case \"Web\":\n return WSheet; \n break;\n case \"Graphic Design\":\n return GSheet;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert a string to a sequence of 16word blocks, stored as an array. Append padding bits and the length, as described in the MD5 standard. MD5 here is not a typo this function is borrowed from the MD5 code.
function str2blks_MD5(str) { var nblk = ((str.length + 8) >> 6) + 1; var blks = new Array(nblk * 16); for(var i = 0; i < nblk * 16; i++) blks[i] = 0; for(i = 0; i < str.length; i++) blks[i >> 2] |= str.charCodeAt(i) << ((i % 4) * 8); blks[i >> 2] |= 0x80 << ((i % 4) * 8); blks[nblk * 16 - 2] = s...
[ "function binl_md5(x, len) {/* append padding */x[len >> 5] |= 0x80 << ((len) % 32);x[(((len + 64) >>> 9) << 4) + 14] = len;var i, olda, oldb, oldc, oldd,a = 1732584193,b = -271733879,c = -1732584194,d = 271733878;for (i = 0; i < x.length; i += 16) {olda = a;oldb = b;oldc = c;oldd = d;a = md5_ff(a, b, c, d, x[i],...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates delay before next page loading.
function get_load_delay() { var current_delay = options.BASE_INTERPAGE_DELAY + Math.abs(Date.now() - status.ajax.start_time), smooth = status.ajax.load_count < 11 ? 1 - (1/ status.ajax.load_count) : -1.0; if (smooth >= 0 && Math.abs(current_delay - status.ajax.load_delay) < 2...
[ "function animationToLoadNextPage() {\n document.getElementsByTagName('body')[0].style.visibility = 'hidden'; \n document.getElementsByTagName('body')[0].className = 'loader_div';\n\n window.setTimeout(function() {\n window.location.href = \"add-patient-info.html\";\n }, 1000); \n}", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the position of the closest open (aka nonobstacle) square to the square at the given posn (if the square at the given posn is open, returns the given posn)
closestOpenPosn(posn) { //bfs starting from posn var searchQueue = [posn]; var blacklist = []; while (searchQueue.length > 0) { var searching = searchQueue.pop(); var searchingSquare = this.get(searching); //is it a posn we're looking for? if (searchingSquare && (!searchingSquare.content || !searchi...
[ "get(posn) {\n\t\tif (!this.outOfBounds(posn)) {\n\t\t\treturn this.board[posn.x][posn.y];\n\t\t} else {\n\t\t\t//console.log(\"ERROR: Cannot get value - posn out of bounds: \" + posn.x + \",\" + posn.y);\n\t\t}\n\t\t//return this.board[posn.x % this.width][posn.y % this.height]\n\t}", "function findBestMove(boar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
firstDialog() Generates a dialog box that will start the music and a chain of dialogs
function firstDialog() { // Making a variable for the dialog that appears in the div let $dialog = createDialog(narrations[0]); // Turning the $dialog variable into an actual dialog window $dialog.dialog({ // Adding an option with an anonymous function buttons: { "Let’s get to it!": function() { ...
[ "function startChoice() {\n\n //remove the prompt text and image\n $('.startImage').remove();\n heartSFX.stop;\n\n // set state of the game with this variable, 1 means the actual content of the project\n initiated = 1;\n\n // making the variable to chose the soundtrack 0, which is the ost for the riddles\n m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
answerCanvas is an array which stores one or more canvases that the user will draw an answer on questionCanvas is an array which stores one or more canvases which have a predrawn shape rotationCanvas is an array which stores a rotation canvas with rotation instructions
function Question() { this.answerCanvas = []; this.questionCanvas = []; this.rotationCanvas = []; }
[ "setupCanvas(width, height, rectMargin, rulerSize) {\n\t\tthis.canvas.width = width\n\t\tthis.canvas.height = height\n\t\tthis.rectMargin = rectMargin\n\t\tthis.rulerSize = rulerSize\n\t\tthis.rectArea = {\n\t\t\t'width':this.canvas.width - rulerSize - rectMargin,\n\t\t\t'height':this.canvas.height - rulerSize - re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
QueryRecordCallback (nID, brRecordInfo , nUserParam);
function QueryRecord(brPath, QueryRecordCallback, nUserParam) { return pixwin.QueryRecord(brPath, QueryRecordCallback, nUserParam); }
[ "function callOnReadyCallback(err, records, onReadyCallback) {\n\tif (onReadyCallback) {\n\t\tif (err) {\n\t\t\tonReadyCallback(err)\n\t\t} else {\n\t\t\tonReadyCallback(null, generateEncodedRecord(records))\n\t\t}\n\t}\n}", "function executeOnPage_Book(){\r\n\tgetCallButton();\r\n\r\n\tloadValues();\r\n\r\n\tget...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Executed on GET of page, Iterates through data set, amends: field names to suit FullCalendar tool, formats date, Renders 'book a resource' page with modelled data
function get(req, res) { const resourceId = req.params.resourceId bookingApi.getResourceBookings(resourceId) .then(function (response) { var i; for (i = 0; i < response.data.length; i++) { response.data[i].title = response.data[i]['name']; delete r...
[ "function displayData(date, month, year) {\n\tvar category = {};\n\tvar fistDay = new Date(today.getFullYear(), today.getMonth(), 1);\n\tvar lastDay = new Date(today.getFullYear(), today.getMonth() + 1, 0); \n\n\tvar groupby = \"startDate\";\n\n\tfor (var i = 0; i < schedule.length; i++) {\n\t\tif (!category[schedu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given a squad entry, return an object keyed by frame times where each value is a count of number of units attacking at that frame time
getBattleFrames(squadEntry = {}) { if (squadEntry.id === 'X' || squadEntry.id === 'E') { return {}; } const position = squadEntry.position; const { name, moveType, speedType, originalFrames, } = squadEntry.unitData; let frameDelay = ((+squadEntry.bbOrder - 1) * this.sbbFrameDelay) + (mov...
[ "function getSongCountByArtist(songs) {\n return songs.reduce((obj, song) => {\n let artist = song.artist;\n artist in obj ? obj[artist]++ : obj[artist] = 1;\n return obj;\n }, {});\n}", "getPlayersCardNums(state) {\n let players = (state || this).players, playerCardNums = {}\n fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the text font, align and baseline drawing parameters. Obj can be either a canvas context or a DOM element See [reference]( for details. font is a HTML/CSS string like: "9px sansserif" align is left right center start end baseline is top hanging middle alphabetic ideographic bottom
setTextParams (obj, font, align = 'center', baseline = 'middle') { obj.font = font; obj.textAlign = align; obj.textBaseline = baseline }
[ "setFont(font) {\n this.ctx.font = font;\n }", "function drawText(txt,x,y,maxWidth,fontHeight,center) {\n if (center === undefined) {\n center = false;\n }\n\n // we need to scale the coordinate space in order to obtain the correct\n // max width and font height (i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method : get vector
function getVector() { return this.getName() + ':' + this.value; }
[ "getVector() {\n if (this.parent) {\n let dx = this.parent.loc.x - this.loc.x;\n let dy = this.parent.loc.y - this.loc.y;\n let v = new JSVector(dx, dy);\n return v;\n }\n else return (JSVector(0, 0));\n }", "function getVector(pt1, pt2) {\n\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
preload() preload of images and font
function preload() { lemonMilk = loadFont("assets/text/LemonMilk.otf"); catN = loadImage("assets/images/cat.png"); lionN = loadImage("assets/images/lion.png"); jungleN = loadImage("assets/images/jungle.jpg"); catRetro = loadImage("assets/images/catRetro.png"); lionRetro = loadImage("assets/images/lionRetro....
[ "function preload() {\n img = loadImage('./img/body.png');\n}", "function preload(){\n\thelicopterIMG=loadImage(\"helicopter.png\")\n\tpackageIMG=loadImage(\"package.png\")\n}", "function preload()\n{\n\tpaperImage = loadImage(\"paperImage.png\")\n\tdustbinImage = loadImage(\"dustbinWHJ.png\")\n\n}", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the illuminance depending on the time of the day
function illuminance(time, callback) { var lumen, times = SunCalc.getTimes(new Date(), 60.2, 24.9); // Helsinki 60.2, 24.9 //Check Daylight Hours: var sunrise = Number(times.sunrise.getHours() + '.' + times.sunrise.getMinutes()), sunset = Number(times.sunset.getHours() + '.' + times.sunset...
[ "toLuminance() {\n return this.r * 0.3 + this.g * 0.59 + this.b * 0.11;\n }", "function _calculateColorIntensity(arrivalMinutes, maximumMinutes) {\n maximumMinutes = maximumMinutes || 15;\n\n if(arrivalMinutes <= 1) {\n return 1;\n } else if(arrivalMinutes > maximumMinutes) {\n return 0;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a gRPC credential from a Google credential object.
static createFromGoogleCredential(googleCredentials) { return CallCredentials.createFromMetadataGenerator((options, callback) => { let getHeaders; if (isCurrentOauth2Client(googleCredentials)) { getHeaders = googleCredentials.getRequestHeaders(options.service_url); ...
[ "async prepareCredentials() {\n if (this.env[DEFAULT_ENV_SECRET]) {\n const secretmanager = new SecretManager({\n projectId: this.env.GCP_PROJECT,\n });\n const secret = await secretmanager.access(this.env[DEFAULT_ENV_SECRET]);\n if (secret) {\n const secretObj = JSON.parse(secr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called by Unity Retruns gesture label
function getGestureAsString() { return poseLabel; }
[ "getLabel() { return this.labelP.innerText; }", "getInteraction( label) {\n\t\treturn Ithis.NTERACTIONS[label];\n\t}", "function CLC_Content_FindLabelText(target){\r\n var logicalLineage = CLC_GetLogicalLineage(target);\r\n var labelText = \"\";\r\n for (var i=0; i < logicalLineage.length; i++){\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fix a vue instance Lifecycle to vue 1/2 (just the basic elements, is not a real parser, so this work only if your code is compatible with both) (Waiting for testing)
function VueFixer(vue) { var vue2 = !window.Vue || !window.Vue.partial; var mixin = { computed: { vue2: function vue2() { return !this.$dispatch; } } }; if (!vue2) { //translate vue2 attributes to vue1 if (vue.beforeCreate) { mixin.create = vue.beforeCreate; delet...
[ "function resetComponentInstances() {\n Blockly.ComponentInstances = {};\n\n Blockly.ComponentInstances.addInstance = function(name, uid) {\n if (DEBUG) console.log(\"RAM ComponentInstances.addInstance \" + name);\n Blockly.ComponentInstances[name] = {};\n Blockly.ComponentInstances[name].uid = uid;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for conciseness in defining templates How to use call this function with these parameters nodeId : [0,14] id of target node ex. highlightNode(2) only 1 node can highlighted if want more node to be highlighted, contact previous programmer na ja
function highlightNode(nodeId) { var node = myDiagram.findNodeForKey(nodeId++); // console.log(node); if (node !== null) { // make sure the selected node is in the viewport myDiagram.scrollToRect(node.actualBounds); // move the large yellow node behind the selected node to highlight it highlighter...
[ "function leafContentHighlight(nodeId, treeType, clickId, contentType, viewType, predecessorId)\r\n{\r\n if(nodeId>0)\r\n {\r\n var previousClickId = document.getElementById(\"previousClickId\").value;\r\n var previousLeafContentId = document.getElementById(\"previousLeafContentId\").value; \r\n\r\n if(t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Based on the parentName, this creates a fully classified name of a property
function getPropertyName(parentName, parent, indexer) { var propertyName = parentName || ""; if (exports.getType(parent) === "array") { if (parentName) { propertyName += "[" + indexer + "]"; } } else { if (parentName) { propertyName += "."; } propertyName += indexer; } return propertyNa...
[ "function createCustomTypeName(type, parent) {\n var parentType = parent ? parent.key : null;\n var words = type.split(/\\W|_|\\-/);\n if (parentType) words.unshift(parentType);\n words = words.map(function (word) {\n return word[0].toUpperCase() + word.slice(1);\n });\n return words.join('') + 'Type';\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2.2 Function to update circles text y position with transition when change axes selection:
function updateYCircleText(circlesText, yScale2, yAxisChoice){ circlesText.transition() .duration(500) .attr('y', d=>yScale2(d[yAxisChoice])); return circlesText; }
[ "function textToCircles(text, xaxis,yaxis,x,y) {\n \n text.transition()\n .duration(1000)\n .attr(\"x\", function(d) { return x(d[xaxis])-5; })\n .attr(\"y\", function(d) { return y(d[yaxis])+2.5; })\n return text;\n\n}", "function updateXCircleText(circlesText, xScale2, xAxisChoice){\n\n circlesTex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API Function: beginReporting Description: Standard report API, gets called just before report is to be run. We check here to see if file activity is happening. If so, we warn the user and return false indicating we can't run the report right now.
function beginReporting() { if (site.serverActivity()) { alert(MSG_CantRun_FileActivity); return false; } return true; }
[ "function startReportingActivity() {\n var id = Web.setInterval(function () {\n if (self.active()) {\n ucwa.send('POST', { rel: 'reportMyActivity' }, {\n nobatch: true\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds the status object.
build() { const status = {}; if (this.code !== null) { status.code = this.code; } if (this.details !== null) { status.details = this.details; } if (this.metadata !== null) { status.metadata = this.metadata; } return stat...
[ "constructor() { \n \n LastStatusInfo.initialize(this);\n }", "function constructStatus(ref, div) {\n\tvar statusText = document.createElement(\"b\");\n\tstatusText.innerHTML = \"<h3>Status: </h3>\";\n\tdiv.appendChild(statusText);\n\tvar status = document.createElement(\"BUTTON\");\n\tstatus.add...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a ProcessLink link.
function ProcessLink(instanceId, linkId, settings) { if (!(this instanceof ProcessLink)) { return new ProcessLink(instanceId, linkId, settings); } this._external = settings.hasOwnProperty('external') ? !!settings.external : false; ProtocolLink.call(this, instanceId, linkId, settings); }
[ "function createLink(idSource, idTarget) {\n var links = JSON.parse(CacheService.getPrivateCache().get(\"links\"));\n if(links[idSource] == undefined) {\n links[idSource] = []; \n } \n var target = {};\n target[\"target\"] = idTarget;\n links[idSource].push(target);\n DocumentApp.getUi().alert('Link crea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Downloads all listed repositories data
async function downloadData() { const releases = []; for (const source of sourcesOfTruth) { // fetch all repos of a given organizaion/user const allRepos = await fetch( `${baseURL}/users/${source.username}/repos${auth}` ).then(res => res.json()); // fetch releases of every repo for (cons...
[ "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" ] ] } }
checks priv key fits description
function privkeycheck() { var privkeycheck = document.getElementById("privatekeyform"); if (privkeycheck.value.length == 64) { document.getElementById("privkeycheckbtn").disabled = false; } else { document.getElementById("privkeycheckbtn").disabled = true; } }
[ "validPrivateKey(privateKey){}", "showPrivateKey() {\n this.showKey(this.privateKey, true);\n }", "function hasValidPrivateField(manifest) {\n return manifest[ManifestFieldNames.Private] === true;\n}", "getPrivKey() {\n var output = PrivKeyAsn1.encode({\n d: this.key.priv.toStri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the data associated with a ship data includes a description of ship's ability, as well as images
function shipDetails(shipName, shipIndex) { var index = -1; var descriptions = document.getElementsByClassName('shipDes'); var ships = ['Scrambler', 'Scanner', 'Submarine', 'Defender', 'Cruiser', 'Carrier', 'Executioner', 'Artillery']; if (client.fleet[shipIndex] != shipName || prepWindow.firstSelect[shipIndex]) ...
[ "function makeShipRequest() {\n let url = API_URL+ \"?shipName=\" + this.id;\n let currentShip = this;\n fetch(url)\n .then(checkStatus)\n .then(JSON.parse)\n //.then(shipDetail)\n .then(function(response) {\n shipDetail(response, currentShip);\n })\n .catch(console.err...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Aliases an existing plugin with a new name
function alias(newName, oldPlugin) { const { name } = oldPlugin, plugin = __rest(oldPlugin, ["name"]); return Object.assign({ name: newName }, plugin); }
[ "function substitute(plugin2sub, pluginName) {\n let remappedNames = Object.keys(plugin2sub);\n return remappedNames.includes(pluginName) ? plugin2sub[pluginName] : pluginName;\n}", "function registerRenameProvider(languageId, provider) {\n return __WEBPACK_IMPORTED_MODULE_3__common_modes_js__[\"r\" /* R...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
extract photo IDs from place details object
getPhotoIDs(placeDetails) { let photoIDs = []; if (placeDetails.hasOwnProperty('photos')) { for (var i = 0; i < placeDetails.photos.length; i++) { photoIDs.push(placeDetails.photos[i].photo_reference); } } return photoIDs; }
[ "function loadPhotoIdList() {\n\t\t$.ajax({\n \t\t\turl: \"rest/Image/list\",\n\t\t\tsuccess:function(data) {\n\t\t\t\tconsole.log('rest/Image/list server response: ' + data);\n \t\t\tvar regex = /([\\d]+)/g;\n \t\t\tvar matched = null;\n \t\t\twhile ( matched = regex.exec(data) ) {\n\t\t\t\t\tloadSc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns meter target value
getMeterTargetValue(telegram) { let values = telegram.getValues(); return values.has('DATA_RECORD_3_VALUE') ? this.parseMeterValue(values.get('DATA_RECORD_3_VALUE').readUInt32LE()) : null; }
[ "function motorGetSpeed() {\n return currentSpeedRpm;\n}", "get speedVariation() {}", "calculateTurnMeter() {\n this.turnMeter += this.tickRate;\n if (this.turnMeter >= 100) {\n this.turnMeter -= 100;\n this.isTurn = true;\n } \n }", "function getRadiusMeters() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks if a request contains a valid jwt cookie with matching username returns error message, or null if authorization is successful
function authorizeRequest(cookies, urlUsername) { // if the request doesn't contain a jwt cookie if (!Object.keys(cookies).includes('jwt')) { return "Unauthorized: request doesn't contain any jwt cookie"; } // try to decode the jsonwebtoken let encodedJWT = cookies.jwt; let secretKe...
[ "function checkCookie(){\n\t// remove jwt\n\tcreateCookie(\"jwt\", \"\", 1);\n\tvar usrName = accessCookie(\"username\");\n\tvar usrPssword = accessCookie(\"usrpassword\");\n\n\tif (usrName!=\"\"){\n\t\tdocument.getElementById('inputUsername').value = usrName;\n\t\tdocument.getElementById('inputPassword').value = u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to add a grade into the array
function add(grade) { this.grades.push(grade); }//end add function
[ "addGrades(grade) {\r\n this.grades.push(grade);\r\n this.write();\r\n }", "function updateStudentGrade (studnetId,assignmentId,studentScore,gradebookData){\n gradebookData[studnetId].grades[assignmentId] = studentScore;\n\n}", "function getStudentGrade(){\n\t// Input Object\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FBXTree holds a representation of the FBX data, returned by the TextParser ( FBX ASCII format) and BinaryParser( FBX Binary format)
function FBXTree() {}
[ "function infixToBtree(expression)\n{\n var tokens = expression.split(/([\\d\\.]+|[\\*\\+\\-\\/\\(\\)])/).filter(notEmpty);\n var operatorStack = [];\n var lastToken = '';\n var queue = [];\n\n while (tokens.length > 0)\n {\n var currentToken = tokens.shift();\n\n if (isNumber(curren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function handles the instruction messages that apears when the user hovers over a button. pass in id of element and pass in option 1 to make it apear and 2 to disapear This function is used when the text hover has a fixed position.
function hoverInstructionsFixedPos(id_name,option){ if (option == "2") $(eval(id_name)).hide(); else $(eval(id_name)).show(); }
[ "function callNextToolTip(id){\n\tdestroy(id);\n\twordLablelToolTip();\n}", "function Insfunc() {\n var x = document.getElementById(\"instructions\");\n // if the is no style display assign to block i.e put the text there\n if (x.style.display === \"none\") {\n x.style.display = \"block\";\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets score on LMS. Can be expanded for more complex scoring but Currently takes in a raw score and records it.
set score(rawScore) { this._score.raw = rawScore; setValue(`cmi.objectives.${this.index}.score.raw`, rawScore); }
[ "set score(newScore) {\r\n score = newScore;\r\n _scoreChanged();\r\n }", "set score(val) {\n this._score = val;\n console.log('score updated');\n emitter.emit(G.SCORE_UPDATED);\n }", "setScore() {\n this.#gameScore += this.#rules[this.#gameLevel - 1].score\n document.dispatchEven...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whether the code is running in tests.
_isTestEnv() { const window = this._getWindow(); return window && (window.__karma__ || window.jasmine); }
[ "_is_testing() {\n return this.env != \"production\" && this.env != \"prod\";\n }", "function shouldInstrument () {\n if (process.env.CI) {\n return !!process.env.REPORT_COVERAGE;\n }\n return true;\n}", "get isSetup() {\n return this.system.hasInstance(this);\n }", "isOnServer() {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace anchor tags with routerlink components to stop page from reloading Original tag: "> New tag:
replaceLinks (text) { text = text.replace(/(<a href)([^.]*?)(>.*)(a>)/g, '<router-link to$2$3router-link>') text = text.replace(/<a xlink:href/, '<router-link to') return text }
[ "function fixAnchors (hook) {\n\n hook.afterEach(function (html, next) {\n\n // find all headings and replace them\n html = html.replace(/<(h\\d).+?<\\/\\1>/g, function (html) {\n\n // create temp node\n const div = document.createElement('div')\n div.innerHTML = html\n\n // get anchor\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copy base stats into a new object to be calculated with.
function copy_base_stats() { var ret = {}; // Should be fine as base_stats doesn't have anything fancy in. for (var attr in base_stats) { ret[attr] = base_stats[attr]; } return ret; }
[ "clone() {\n let stats = {};\n this.forEachStat((name, value) => stats[name] = value)\n return new BirdStats(stats);\n }", "buildDerivedStats () {\n\t\tthis.derivedStats['Wound Boxes'] = this.stats.Health + DigimonStages[this.stage].woundBoxes;\n\n\t\tif (Number.isInteger(this.burstIndex)) {\n\t\t\tthis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the current article Builds HTML elements from a provided JSON file in a specific format
function buildFromJSON(HTMLContainer, jsonObj) { console.log("parsing JSON object"); console.log(jsonObj); var elementToModel = null; for ( var obj in jsonObj ) { console.log("THING: "+ obj); console.log(jsonObj[obj]); switch (obj) { case '...
[ "async function buildJsonContent(file, primary, secondary, queryparams, baseurl) {\n\tconst filepath = './json/' + file + '.json';\n\tconsole.log(filepath);\n\tconst fileRequest = new Request(filepath);\n\tconst response = await fetch(fileRequest);\n\tconst jsonResponse = await response.json();\n\tlet returnContent...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getting remaining hours, real time is a must optional setting, this is just a test for now
function hoursRemain() { var totalHours = dayNumber() * 24; var hour; //added +24 hous for leap and non-leapYear to work logically if (isLeapYear()) { hour = 8808; } else { hour = 8784; } hour -= totalHours; return hour; }
[ "calcRemainingTime() {\n return (Math.round((currentGame.endTime - Date.now()) / 100));\n }", "function get_time_left() {\n return (total_paid / price_per_second) - time_spent;\n}", "function getHoursFromTemplate() {\n var hours = parseInt(scope.hours, 10);\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cancel all scheduled events greater than or equal to the given time
cancel(time) { this._event.cancel(time); return this; }
[ "cancel(time) {\n time = (0, _Defaults.defaultArg)(time, -Infinity);\n const ticks = this.toTicks(time);\n\n this._state.forEachFrom(ticks, event => {\n this.context.transport.clear(event.id);\n });\n\n this._state.cancel(ticks);\n\n return this;\n }", "function Sequence$cancel(){\n\t c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retrieves the list of Datastreams of all registered Servers
loadDataStreamList() { this._dataStreamList = []; let servers = this.dataModelProxy.getUserConfig().getDashboardConfig().getServerList(); let serverID = 0; for (let server in servers) { if (logging) console.log("Retrieving Datastreams from Server:", servers[server].url); ...
[ "function getAllStreamers() {\r\n clearElements();\r\n getStreamData(\"all\");\r\n }", "function getOfflineStreamers() {\r\n clearElements();\r\n getStreamData(\"offline\");\r\n }", "listSockets() {\n var list = this.players.map(player => player.socketID);\n list....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to hide the popup TBI
function hide_popup() { $('.overlay').hide(); $("#tooltip").toggle(); }
[ "function hidePopup() {\n // get the container which holds the variables\n var topicframe = findFrame(top, 'topic');\n\n if (topicframe != null) {\n if (topicframe.openedpopup != 1) {\n if ((topicframe.openpopupid != '') && (topicframe.popupdocument != null)) {\n var elmt =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show traffic plot instead of switch config
handleSetTrafficView(o) { this.trafficPorts = o; this.showTraffic = true; }
[ "function enableChartView() {\n for (let element of defaultViewElements) element.style.display = \"none\";\n for (let element of chartViewElements) element.style.display = \"block\";\n }", "function set_display(value)\n{\n\t//value can be: wireframe, hiddenvis, hiddeninvis, or shade //\n\tenv_st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Turn the oscillator on / off
function toggleOsc() { if (oscOn) { osc.stop(); button.html('start'); } else { osc.start(); button.html('stop'); } oscOn = !oscOn; }
[ "controlViaOnOff() {\n console.log(\"entrou ONOFF\")\n this.output = this.getTemp() < this.setpoint ? 1023 : 0;\n this.board.pwmWrite(19 , 0, 25, 10, this.output);\n }", "function initOscillator(gain){\n\tvar o = context.createOscillator();\n\to.type = \"sine\"; // sine wave by default \n\to.connect(gai...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update info card item
updateInfoCard(stepId, action, key, value, index) { var data = {}; data['update_type'] = 'card_item'; data['type'] = 'info-card'; data['_id'] = stepId; data['action'] = action; data['index'] = index; data[key] = value; //console.log(data) this.step...
[ "updateInfo(key, newValue) {\n let info = this.props.info;\n info[key] = newValue;\n this.props.updateShipInfo(info);\n }", "updateFormCard(stepId, action, key, value, index) {\n var data = {};\n data['update_type'] = 'card_item';\n data['type'] = 'form-card';\n data['_id'] =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert value to signed 16 bit.
function s16(val) { return (val << 16) >> 16; }
[ "function clampToInt16(x) {\n return Math.max(Math.min(x, 32767), -32768);\n}", "static bytes16(v) { return b(v, 16); }", "function parseToSignedByte(value) {\n value = (value & 127) - (value & 128);\n return value;\n}", "function bigInt2hex(i){ return i.toString(16); }", "readUint16() {\n const...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns names and lengths of chromosomes for an organism's bestknown genome assembly. Gets data from NCBI EUtils web API.
getAssemblyAndChromosomesFromEutils(callback) { var asmAndChrArray, // [assembly_accession, chromosome_objects_array] organism, assemblyAccession, chromosomes, asmSearch, asmUid, asmSummary, rsUid, nuccoreLink, links, ntSummary, results, result, cnIndex, chrName, chrLength, chromosome,...
[ "getProperSpeciesAndBuild(buildInfo) {\n var me = this;\n var matchedSpecies = null;\n var matchedBuild = null;\n\n if (buildInfo != null) {\n // If the bam header provided a species, make sure it matches the\n // selected species name (or latin or binomial name).\n if (buildInfo.species)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load list of URLs from a file
function loadUrls(path) { var list = fs.readFileSync(path, { encoding: 'utf8' }); return list.split('\n').map(function(cv) { return cv.trim(); }).filter(function(x) { return x.length > 0; }); }
[ "function getURLs(urls) {\n // split the contents by new line\n const lines = urls.split(/\\r?\\n/);\n\n lines.forEach((line) => {\n axios.get(line).then(function(resp) {\n doSomething(resp, line);\n })\n .catch(err => {\n console.log(`Error with url in file`)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function called product that calculates the product of an array of numbers using a for loop; then, refactor it to use each.
function product(arr) { var total = 1; for (i = 0 ; i = arr.length ; i++) { total *= arr[i]; } return total; }
[ "function multiplyAll(arr) {\n var product = 1;\n \n for (let i =0; i < arr.length; i++){\n for (let j=0; j < arr[i].length; j++){\n product*=arr[i][j]\n }\n }\n \n return product;\n }", "function productContents(array) {\r\n\tlet product = 1;\r\n\tfor (let i = 0; i < ar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is used copy the included sources requested in the docs. It parses all the docs files, finds the included sources and copy them under the `sourceDir`. Options: docsDir: the directory containing the docs files sourceDir: the directory that will contain the included sources include: list of patterns to look...
async function getIncludedSources(options) { options = { ...defaultOptions, ...options }; const { docsDir, include, sourceDir, pathPrefix } = options; const cleanedSourceDir = sourceDir.replace('./', ''); const includedSourceRe =`\`\`\`[a-z\-]+ \\(${cleanedSourceDir}/([^\\]\\s]+)\\)\n\`\`\``; // f...
[ "function collectSources(sourceDirectories, tmpDirectory, focusedSourceFiles) {\n for (let i = 0; i < sourceDirectories.length; i++) {\n let src = sourceDirectories[i];\n\n // Identify all files in source dir, recursively.\n let filesSNP = readdir(src).filter(file => /.snp/.test(file));\n let filesAS =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is called when the user selects the add location button Function: addToCache() Authors: Luke Waldren, Raymond Fu, Taylah Lucas, Abe Lawson. Since: 14/5/2016 Modified: 29/05/2016 Param list: Return list: Description: this function passes all the data that will be stored into the addlocation function. Preco...
function addToCache() { var lat = tempResults[0].geometry.location.lat(); var lng = tempResults[0].geometry.location.lng(); var nickname = document.getElementById("nickname").value; var formattedAddress = tempResults[0].formatted_address if (nickname == "") { nickname = formattedAddress; ...
[ "function addMarker(cache)\n{\n\ticonOptions.iconUrl = RESOURCES_DIR + cache.kind + \".png\";\n\ticonOptions.shadowUrl = RESOURCES_DIR + (cache.status == \"A\" \n && filters[\"Archived\"]\n && document.getElementById(\"datepicke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace occurences of v1 slot elements with v0 content elements. This does not yet map named slots to content select clauses.
function polyfillSlotWithContent(template) { [].forEach.call(template.content.querySelectorAll('slot'), function (slotElement) { var contentElement = document.createElement('content'); slotElement.parentNode.replaceChild(contentElement, slotElement); }); }
[ "function transformOldSlotSyntax(node) {\n if (!node.children) {\n return;\n }\n\n node.children.forEach((child) => {\n if (_.has(child.attribs, 'slot')) {\n const vslotShorthandName = `#${child.attribs.slot}`;\n child.attribs[vslotShorthandName] = '';\n delete child.attribs.slot;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates list of attendees whenever a checkbox is checked or unchecked
function updateAttendees(event) { var attendee_name = $(this).attr("value"); var attendee_email = ""; var contacts_list = JSON.parse(localStorage.getItem("contacts")); for(var count = 0; count < contacts_list.length; count++) { if(contacts_list[count].name === attendee_name) { attendee_email = contacts_list[c...
[ "function updateEmailMarkList() {\n\tvar isAllChecked = true;\n var chkBoxId = this.name;\n var partialchkBoxId = chkBoxId.substring(0,chkBoxId.indexOf('_'));\n var emailAllDivs = document.getElementsBySelector(\"span.citation-send\");\n\tfor(var i=0;i<emailAllDivs.length;i++){\n\t\tvar emailAll = emailAl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by KotlinParserfunctionValueParameters.
enterFunctionValueParameters(ctx) { }
[ "enterFunctionValueParameter(ctx) {\n\t}", "enterValueArguments(ctx) {\n\t}", "addChildren(valuesAdded) {\n this.children.push(new Node('()' + this.val, 'right'));\n valuesAdded.push('()' + this.val);\n this.children.push(new Node('(' + this.val + ')', 'right'));\n valuesAdded.push('(' + this.val + ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends a child element to the back of the child stack.
sendToBack(element) { return this.changeIndexTo(element, 0, false); if (index > 0) { this._children.splice(index, 1); this._children.splice(0, 0, element); } }
[ "sendBackward(element) {\n return this.changeIndexTo(element, -1, true);\n\n if (index > 0) {\n var temp = this._children[index];\n this._children[index] = this._children[index - 1];\n this._children[index - 1] = temp;\n }\n }", "pop() {\n if (this.curre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an error to be thrown when two column definitions have the same name.
function getTableDuplicateColumnNameError(name) { return Error("Duplicate column definition name provided: \"" + name + "\"."); }
[ "columnIndex(name) {\n if (_.isNumber(name) && this.headers[name]) {\n return name;\n }\n const index = this._headers.indexOf(name);\n if (index === -1) {\n throw Error(`Table.columnIndex: no column named ${name}`);\n }\n return index;\n }", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
What's this? clear all selections and final cursor position becomes head of last selection. editor.clearSelections() does not respect last selection's head, since it merge all selections before clearing.
clearSelections () { this.editor.setCursorBufferPosition(this.editor.getCursorBufferPosition()) }
[ "_clearSavedSelection() {\n this._savedSelection = null;\n }", "function clearAllSelection(){\n ds.clearSelection();\n arrDisp.length=0;\n updateSelDisplay();\n updateCurrSelection('','','startIndex',0);\n updateCurrSelection('','','endIndex',0);\n}", "clearSelect() {\n const [selection] = this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates emailstores when a response or comment is made userMakingCommentId user ID or null for anonymous survey form model counterField "responseCount" or "commentCount" hashids a dependency
function recordNewResponseOrComment(userMakingCommentId, survey, counterField, hashids) { var userMakingComment = null, emailStoreSurveyItem = null; Promise .all([ new Promise(function (resolve, reject) { if (userMakingCommentId === null) { resolve(); } else...
[ "function setUserID(){\n if(isNew){\n spCookie = getSpCookie(trackerCookieName);\n getLead(isNew, spCookie, appID);\n }\n }", "function updateTipEventCount(tipObj){\n\t\n\t\t\tconsole.log(tipObj);\n\t\t\tconsole.log(tipObj._id + \" : \" + tipObj.isEvent);\n\t\t\t\n\t\t\tvar placeObj = {};\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints the messages from Watson.
async function parseWatsonMessage(data) { const { output = {} } = data; const { text = [] } = output; text.forEach(x => printMessage(x, "watson")); }
[ "function sendToWatson(cont, inp, callback) {\n\t\t\tvar payload = {\n\t\t\t\tworkspace_id:'0a56c12b-af85-490c-8e1c-eabee681c572',\n\t\t\t\tcontext: cont,\n\t\t\t\tinput: {\n\t\t\t\t\"text\": inp\n\t\t\t\t\t}\n\t\t};\n // Conversation credentials\n\t\tvar conversation = new ConversationV1({\n\t\t\tusername:'dba0c5b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sendPageViewToGoogleAnalytics // ///////////////////////////////// Sends a request to Google Anylytics in order for it to accumulate statistics of report usage. The requst is just an indication that the report is being opened. This replaces the old counter service (for which request used to be sent with sendLiveCounter...
function sendPageViewToGoogleAnalytics(userId) { ga('create', { trackingId: 'UA-142846391-2', storage: 'none' }); ga('set', 'checkProtocolTask', function(){ }); ga('set', 'userId', userId) ga('set', 'dimension1', userId); ga('set', 'page', 'http://www.checkpoint-te-report-fak...
[ "trackCustomPageView($location) {\n ga('send', 'pageview', $location);\n }", "function pageviewTrack() {\n\t\tmyscope.$on('$locationChangeStart', function(e, next, current) {\n\t\t _gaq.push(['_trackPageview', next.replace('http://fairfield.summon.serialssolutions.com','')]);\n\t\t});\n }", "setGlobalDa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw route and vehicles
draw() { var canvas = document.getElementById("CANVAS"); var ctx = canvas.getContext("2d"); var cVehicles = this.getVehicleCount(); ctx.save(); ctx.scale(def.scale, def.scale); this._drawRoute(ctx); for (let iVehicle = 0; iVehicle < cVehicles; iVehicle ++) this._drawVehi...
[ "roadLineDrawtest()\n {\n this.direction.route({\n origin:{lng:-78,lat:39.137},\n destination:{lat:39.281,lng:-76.60},\n travelMode:google.maps.TravelMode.DRIVING\n },(r,s)=>{\n var pathPoints=r.routes[0].overview_path;\n var path=new google.ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a text cursor. The query is the search string, `from` to / `to` provides the region to search. / / When `normalize` is given, it will be called, on both the query / string and the content it is matched against, before comparing. / You can, for example, create a caseinsensitive search by / passing `s => s.toLower...
constructor(text, query, from = 0, to = text.length, normalize) { /// The current match (only holds a meaningful value after /// [`next`](#search.SearchCursor.next) has been called and when /// `done` is false). this.value = { from: 0, to: 0 }; /// Whether the end of th...
[ "constructor(text, query, from = 0, to = text.length, normalize) {\n /// The current match (only holds a meaningful value after\n /// [`next`](#search.SearchCursor.next) has been called and when\n /// `done` is false).\n this.value = { from: 0, to: 0 };\n /// Whether the end of th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replaces all Mobilize America event documents in 'collection' with those in 'documents'. First deletes all documents in the collection which have a mobilizeId and whose mobilizeId is not in 'documents'. Then upserts each document in 'documents' based on its mobilizeId.
async function replaceEventsInCollection(documents, collection) { await deleteAllBut(documents, collection); const batches = batchArray(documents, upsertBatchSize); for (batch of batches) { await upsertBatch(batch, collection); } }
[ "async function dropAllDocuments(client, dataBaseName, collectionName) {\n\t\t// Delete collection including all its documents\n\t\tlet result = await client.db(dataBaseName).collection(collectionName).drop();\n\t\t// console.log(\"drop =>\" + result);\n\n\t\t// Re-create a collection again\n\t\t// result = await c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if string contains at least one uppercase letter.
function containsUppercaseLetter(string) { return /[A-Z]/.test(string); }
[ "function isUpperCase(str) {\n\n}", "function startsWithUppercase(str) {\n return /^[A-Z]/.test(str);\n}", "function containsLowercaseLetter(string) {\n return /[a-z]/.test(string);\n}", "checkLetter(input) {\r\n return this.phrase\r\n .split(\"\")\r\n .some(letter => letter == ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get flavor params output object by ID.
static get(id){ let kparams = {}; kparams.id = id; return new kaltura.RequestBuilder('flavorparamsoutput', 'get', kparams); }
[ "static get(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('thumbparamsoutput', 'get', kparams);\n\t}", "static get(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('flavorasset', 'get', kparams);\n\t}", "static getByEntryId(entry...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the tracker's eventlisteners and binds them to its registered SDK event types. Uses the CastEventType mapping imported from cast_event_types.js.
startTracking() { this.castEventTypes.forEach((eventType) => { if (eventType.owner == EventOwner.PLAYER_MANAGER) { this.playerManager.addEventListener(eventType.event, this.handleEvent.bind(this)); } else if (eventType.owner == EventOwner.CAST_RECEIVER_CONTEXT) { this.co...
[ "function MapListeners() { }", "_addDefaultEvents () {\n\t\tthis.discord.on('error', console.error);\n\n\t\tthis.discord.on('message', (message) => {\n\t\t\t/* Ignore other bots and self */\n\t\t\tif (message.author.bot) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor (const caster of this._casters) {\n\t\t\t\tcaster.di...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sendRequest / STATECHANGE FUNCTIONS ======================== Checks the nick availability
function checkNick() { if(request.readyState == READY_STATE_COMPLETE) { if(request.status == 200) { var text = ""; //Remove the previous response (if exists) if(nickChecked.innerHTML){ nickChecked.innerHTML = text; } switch(request.responseText){ //Server ...
[ "function getServerStatus(){ \n\tvar client;\n\tclient = configureBrowserRequest(client);\t\n\tclient.open(\"POST\", \"?server-state\", true);\n\tclient.send();\n\t\n\tclient.onreadystatechange = function() {\n\t\tif(client.readyState == 4 && client.status == 200) {\n\t\t\tdocument.getElementById(\"server-status\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the displayed scoreBoard from the page
function clearScoreBoard() { let scoreBoardEl = document.querySelector(".scoreBoard"); document.body.removeEventListener("click", clearScoreBoard); scoreBoardEl.remove(); }
[ "function clearScores() {\n localStorage.removeItem(\"LastScoreBoard\"); // removes the stringified key/value of the previous ScoreBoard from localStorage\n scoreSubmissiones = []; // clears the scoreboard submissions array containing previous score entries\n scoresTableBody.innerHTML = \"\"; // clears the rende...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
router function will move the result instance variable via all functions to calculate the math problem.
router() { this.result = this.validations(this.mathProblem); this.result = this.multiplicationAndDivision(this.result); this.result = this.clearNegatives(this.result); this.result = this.additionAndSubstraction(this.result); }
[ "function reCalculateRoute(){\n\t\tcalculateRoute(lastRouteURL);\n\t}", "compute() {\n // so to compute we have already settled that both prev and main result must have a value in our operationChoice method\n let computation\n const prev = parseFloat(this.prevResult)\n const main = par...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create and return an embed containing details about the current song. Returns null if no songs.
async _buildNPEmbed() { const song = this.songs[0] if (song) { const embed = new Discord.MessageEmbed() const lang = this.langCache || Lang.en_us const progress = song.getProgress(this.timeSeconds, this.isPaused) const link = await song.showLink() embed.setDescription(utils.replace(lang.audio.music.p...
[ "function generateSong(id) {\n return {\n id,\n name: `The song ${id}`,\n artists: [\n {\n name: 'The Artist',\n },\n ],\n };\n}", "static getSong(id) {\n return SongManager.songList.find(s => s.songId == id);\n }", "function createCard(song, songNum){\n let link = do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reverses trip on map view and on the itinerary
reverseTrip() { let tripList = this.state.placesForItinerary; let markerPosList = this.state.markerPositions; this.setState({placesForItinerary: tripList.reverse()}); this.setState({markerPositions: markerPosList.reverse()}) }
[ "invertRows() {\n // flip \"up\" vector\n // we flip up first because invertColumns update projectio matrices\n this.up.multiplyScalar(-1);\n this.invertColumns();\n\n this._updateDirections();\n }", "function zoneReverseAll() {\r\n\twindow.cnt += 1; // global variable.\r\n\t// alert(window.cnt);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: extPart.getNodeParamName DESCRIPTION: get node param name from ext data ARGUMENTS: partName ext data participant filename RETURNS: node param name
function extPart_getNodeParamName(partName) { return dw.getExtDataValue(partName, "insertText", "nodeParamName"); }
[ "function extPart_extractNodeParam(partName, parameters, node)\n{\n if (extPart.getIsNodeRel(partName))\n {\n var nodeParam = extPart.getNodeParamName(partName);\n\n if (parameters[nodeParam] == null)\n {\n var location = extPart.getLocation(partName);\n if ((location.indexOf(\"firstChildOfNode...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the number of nodes expected in the chain.
function YInputChain_get_expectedNodes() { var res; // int; if (this._cacheExpiration <= YAPI.GetTickCount()) { if (this.load(YAPI.defaultCacheValidity) != YAPI_SUCCESS) { return Y_EXPECTEDNODES_INVALID; } } res = this._expec...
[ "numDescendants() {\n let num = 1;\n for (const branch of this.branches) {\n num += branch.numDescendants();\n }\n return num;\n }", "getTotalBlocks() {\n return this.chain.length;\n }", "function getSizes(nodes) {\n return nodes.map(function (layer) {\n return layer.length;\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3Change all the numbers in the array to be multiplied by two for even indexes.
function evenIndexesMult(arr) { for (var i = 0; i < arr.length; i++) { if(i % 2 ===0 ){ arr[i] = arr[i] * 2; } } return arr; }
[ "function modifyArray(nums) {\n return nums.map(s=> s%2==0 ? s*2: s*3 )\n\n\n }", "function oddProduct(arr) {\n\tlet a = 1;\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tif (arr[i] % 2 === 1) {\n\t\t\ta *= arr[i];\n\t\t}\n\t}\n\treturn a;\n}", "function numberIndexEven(array){\r\n \r\n return map(array,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fonction permettant de recuperer la valeur du meilleur score enregistree dans le cookie vraiment tire par les cheuveux pour afficher respectivement mes 2 cookies
function getMeilleurScore (nomCookie){ var valeurMeilleurScore = ''; var indexCookie; if (nomCookie == 'classique'){ indexCookie = document.cookie.indexOf("MeilleurScoreSnakeClassique"); indexCookie = indexCookie + 28; while (true){ ...
[ "function logHighscore() {\r\n\tif( totalElapse > parseInt(getCookie()) || getCookie() == \"\" ) {\r\n\t\tsetCookie( totalElapse );\r\n\t\tuiHScore.innerHTML = (Math.floor(totalElapse / 100) / 10).toString();\r\n\t}else {\r\n\t\tuiHScore.innerHTML = (Math.floor(getCookie() / 100) / 10).toString();\r\n\t}\r\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks for collision with the player's ship and an asteroid will take away a player's life if collision occurs
function playerShipAndAsteroidCollisionDetection(elapsedTime){ if(myShip.getSpecs().invincible == false){ for(var i = 0; i < myAsteroid.getAsteroids().length; i++){ var asteroid = myAsteroid.getAsteroids()[i]; var xDiff = myShip.getSpecs().center.x - asteroid.center.x; var yDiff = myShip.getSpecs(...
[ "checkCollision(player) {\n // Check if the gear and the player overlap each other\n if (this.rowPos == player.rowPos &&\n this.colPos == player.colPos) {\n // If so, then hide the gear item\n this.hasBeenCollected = true;\n this.rowPos = null;\n this.colPos = null;\n this.x = nul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
replaceInfo() END / FUNCTION btnVisibility( type ) Manage button behavior of modal box depending of initiation 1 parameter: type > The type of modal box ("confirm" or "alert")
function btnVisibility( type ) { var btnType = type; if (btnType === "confirm") { fromToClass(bAlert, "is-visible", "is-hidden"); fromToClass(bAccept, "is-hidden", "is-visible"); fromToClass(bDecline, "is-hidden", "is-visible"); } else if (btnType === "alert") { fromToClass(bAlert, "i...
[ "function confirmHide() {\n document.getElementById(\"hideWarning\").style.display = \"none\";\n data[accountGlobal.id].status = 0;\n restartUI();\n changeStory(accountGlobal.id + 1, 1);\n}", "function alertModalPass() {\n getElement('id_bh_modal').className = \"BH_MODAL\";\n getElement('myModal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
I don't like saying this: foo !=== undefined because of the doublenegative. I find this: defined(foo) easier to read.
function defined( value ) { return value !== undefined; }
[ "static isDefined(input) {\n return typeof (input) !== 'undefined';\n }", "function isUndefined(){\n return;\n}", "function isNullOrUndefined(variable) { \r\n\treturn variable === null || variable === undefined; \r\n}", "function firstDefined(){\n var undefined, i = -1;\n while (++i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies necessary changes to package.json of the example app. It means setting the autolinking config and removing unnecessary dependencies.
async function modifyPackageJson(appPath) { const packageJsonPath = path_1.default.join(appPath, 'package.json'); const packageJson = await fs_extra_1.default.readJson(packageJsonPath); if (!packageJson.expo) { packageJson.expo = {}; } // Set the native modules dir to the root folder, //...
[ "async function changePackages() {\n const packages = await getPackages()\n\n await Promise.all(\n packages.map(async ({ pkg, path: pkgPath }) => {\n // you can transform the package.json contents here\n\n if (\n pkg.files &&\n pkg.files.includes('lib') &&\n pkg.name !== 'babel-p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
unwraps the element so we can use its methods freely
function unwrap(elem) { if (elem) { if ( typeof XPCNativeWrapper === 'function' && typeof XPCNativeWrapper.unwrap === 'function' ) { return XPCNativeWrapper.unwrap(elem); } else if (elem.wrappedJSObject) { return elem.wrappedJSObject; } ...
[ "replace (element) {\r\n element = makeInstance(element);\r\n this.node.parentNode.replaceChild(element.node, this.node);\r\n return element\r\n }", "visitUnpivot_in_elements(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function closeElement(element) {\r\n element.remove();\r\n}", "destroy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is where we visualize the algorithm on the board everytime solved is clicked
visualizeAlgo() { let i = 0; // Enter a loopstep recurisve call, that will act as a setInterval const loopStep = () => { // Base case to allow us to leave the function for a reset, // or exit the recursive call when we reach the last entry in the array ...
[ "function Game(matrix = [], delay = { time: 0 }) {\n\tthis.matrix = matrix;\n\tthis.delay = delay;\n\tthis.solver = false;\n\tthis.board = false;\n\tthis.isSolving = false;\n\tthis.interactions = 0;\n\tthis.events = {};\n\n\tconst newGame = (matrix) => {\n\t\t// Create board\n\t\tthis.board = new Board(matrix);\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolve input port from requested property.
function resolveInputPort(property, value) { return resolvePort('input', property, value); }
[ "function resolvePort(type, property, value) {\n var availablePorts = type === 'output' ? outputPorts : inputPorts,\n length = availablePorts.length,\n resolvedPorts = [],\n i;\n\n // Go through each port and compare property.\n for (i = 0; i < length; i++) {\n // Check if port has the property...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse N in type[] where "type" can itself be an array type.
function parseTypeArray (type) { var tmp = type.match(/(.*)\[(.*?)\]$/) if (tmp) { return tmp[2] === '' ? 'dynamic' : parseInt(tmp[2], 10) } return null }
[ "function parseTypeExpressionList() {\n var elements = [];\n elements.push(parseTop());\n\n while (token === Token.COMMA) {\n consume(Token.COMMA);\n elements.push(parseTop());\n }\n\n return elements;\n } // TypeName :=", "consoleParseTypes(input) { return Parser.parse(i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return all triples about the given uri and its affiliated objects, stops at objects of the given type, or at the given predicates
recursiveFindAllTriples(uri, type, predicates) { //find all triples for given uri let triples = this.store.getTriplesByIRI(uri, null, null); if (predicates) { triples = triples.filter(t => predicates.indexOf(t.predicate) < 0); } if (type) { triples = tripl...
[ "function discoverTypes () {\n // rdf:type properties of subjects, indexed by URI for the type.\n\n const types = {}\n\n // Get a list of statements that match: ? rdfs:type ?\n // From this we can get a list of subjects and types.\n\n const subjectList = kb.statementsMatching(\n undefined,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handle get public URL with given bucketname and filename
function getPublicUrl (bucketName,filename) { return `https://storage.googleapis.com/${bucketName}/${filename}`; }
[ "function fetchGcsObject(bucket, objectName, responseHandler) {\n console.log('Fetching', bucket, '#', objectName);\n if (!isServingAppFromMachine()) {\n gapi.client.storage.objects.get({\n 'bucket': bucket,\n 'object': objectName,\n 'alt': 'media'\n }).then(function(response) {\n respon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PROCESS SIBYL ends FIX FILE NAME Called from saveAsEPS to remove any number from file name
function fixFileName(fileName) { // I don't need to explicitly remove extension; // Illy seems to cope with that // var fName = fileName.replace('.svg', ''); // Lose number, if any -- e.g.: ' (2)' var fName = fileName.replace(/\s?\(\d\)/,''); return fName; }
[ "function getNewName()\r{\r\tvar ext, docName, newName, saveInFile, docName;\r\tdocName = sourceDoc.name;\r\text = '_AB_nobleed_HR.pdf'; // new extension for pdf file\r\tnewName = \"\";\r\t\t\r\tfor ( var i = 0 ; docName[i] != \".\" ; i++ )\r\t{\r\t\tnewName += docName[i];\r\t}\r\tnewName += ext; // full pdf name o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all mapped NFTs which have the specified contract address and token id or FIO Address or hash.
getNfts(options, limit, offset) { const { fioAddress, chainCode, contractAddress, tokenId, hash, } = options; let nftsLookUp; if (fioAddress != null && fioAddress != '') { nftsLookUp = new queries.GetNftsByFioAddress(fioAddress, limit, offset); } if (chainCode != null...
[ "getFioAddresses(fioPublicKey, limit, offset) {\n const getNames = new queries.GetAddresses(fioPublicKey, limit, offset);\n return getNames.execute(this.publicKey);\n }", "async listTokensFromAddress (addr) {\n try {\n if (!addr) throw new Error('Address not provided')\n\n // Convert...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }