query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Returns the number of items in your inventory for a given item name;
function num_items(name) { var item_count = character.items.filter(item => item != null && item.name == name).reduce(function(a, b) { return a + (b["q"] || 1); }, 0); return item_count; }
[ "function num_items(name)\n{\n\tvar item_count = character.items.filter(item => item != null && item.name == name).reduce(function(a,b){ return a + (b[\"q\"] || 1);\n\t}, 0);\n\n\treturn item_count;\n}", "function num_items(name) {\r\n\tvar item_count = character.items.filter(item => item != null && item.name == ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draws a cattail at a given position. A cattail is located at an arbitrary point in space, and will sway depending on the wind speed.
function drawCattail(c_x, c_y, c_z, c_sway) { /* Group: Cattail */ pushMatrix(ModelMatrix); ModelMatrix.translate(0, 0, 3); ModelMatrix.scale(4, 4, 4); ModelMatrix.translate(c_x / 4, c_y / 4, c_z / 4); ModelMatrix.rotate(90, 1, 0, 0); drawCattailHead(c_sway); updateMaterial(MATL_GRN_PLASTIC); drawSta...
[ "function drawCattail(c_x, c_y, c_z, c_sway) {\n /* Group: Cattail */\n pushMatrix(ModelMatrix);\n ModelMatrix.translate(c_x, c_y, c_z);\n\n drawCattailHead(c_sway);\n drawStalk(c_sway);\n\n /* End Group: Cattail */\n ModelMatrix = popMatrix();\n}", "function drawTail() {\n penColor(rgb(76,2...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility Functions getSiteUrl() Obtains the target site URL
function getSiteUrl() { var urlParts = $location.absUrl().toLowerCase().split('/'); var result = urlParts[0] + "/"; for (var i = 2; i < urlParts.length; i++) { if (urlParts[i] != 'surveyapp' && urlParts[i] != 'pages' && urlParts[i] !== 'sitepages' ...
[ "function getSiteURL() {\n\treturn getFormVariable(\"SiteURL\");\n}", "getSiteURL() {\n return this.siteURL ? this.siteURL : this.getServerURL();\n }", "function getSiteAbsoluteUrl() {\n return _spPageContextInfo.siteAbsoluteUrl;\n}", "getSiteUrl() {\n const siteUrl = this.configManager.getConfig('c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks4inARow in the direction of the columns
function checkColumns(){ for (var i=0; i<boardByColumns.length; i++){ check4InRow(boardByColumns[i].content) }; }
[ "function horizontalCheck () {\n for (let row = 0; row < tableRow.length; row++) {\n for (let col = 0; col < 4; col++) {\n if (\n colorMatchCheck(\n tableRow[row].children[col].style.backgroundColor,\n tableRow[row].children[col + 1].style.backgroundColor,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when we've got the project JSON that defines the levels, load each level
function projectJsonLoaded(data) { project = data; if(typeof project == 'string') project = JSON.parse(project); georeferences = project.georeferences; for(var i in project.levels) { if(!routingId) routingId = project.levels[i].source; levelLoadFunction(project, i)(); } }
[ "function projectJsonLoaded(data) {\n project = data;\n if (typeof project == 'string') project = JSON.parse(project);\n georeferences = project.georeferences;\n for (var i = 0; i<project.levels.length; i++) {\n if (!routingId) routingId = project.levels[i]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the answers for a given question, and place the correct answer at the spot marked by the correctAnswerTargetLocation variable. Note that you can have as many answers as you want but only ANSWER_COUNT will be selected.
function populateRoundAnswers(gameQuestionIndexes, correctQuestionIndex, correctAnswerTargetLocation, translatedQuestions) { const answers = []; const answersCopy = translatedQuestions[gameQuestionIndexes[correctQuestionIndex]][Object.keys(translatedQuestions[gameQuestionIndexes[correctQuestionIndex]])[0]].slic...
[ "randomizeAnswerLocation() {\n\t\t//Add correct answer to answers array\n\t\tthis.answers.push(this.correctAnswer);\t\n\t\tif (this.answers.length === 2) {\n\t\t\t//This question is a true or false, need to do special handling so order doesn't give away answer\n\t\t\tthis.answers[0] = 'True';\n\t\t\tthis.answers[1]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds the query param that indicates to the service worker that a request is a prefetch.
function maybeAddPrefetchParam(url) { if (!options.includeCacheMisses && shouldAcceptThrottling()) { appendSearchParam(url, constants_1.PREFETCH_QUERY_PARAM, '1'); } }
[ "prefetchingOn() {\n this._prefetchingOn = true;\n }", "function getPrefetchUrl(extra_params={}) {\n let params = new URLSearchParams({ uuid: token(), ...extra_params });\n return new URL(`prefetch.py?${params}`, SR_PREFETCH_UTILS_URL);\n}", "get shouldPrefetch(){\n return this.name == \"window\" || th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback for retrieving ready messages, takes callback function as parameter.
readyCallback(callback) { this._cbReady = callback }
[ "readyCallback(callback) {\n _cbReady = callback;\n\n setTimeout(function () {\n _cbReady();\n }, 7000);\n }", "function set_ready_callback(callback){\n call_when_ready = callback;\n}", "function _fireReadyEventCallbacks() {\n _callbacks.ready.forEach(function(callback) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate ChatId works cause when you are the user sending chat you take user.uid and your friend takes uid when your friend is using the app to send message s/he takes user.uid and you take the uid cause you are the friend
generateChatId() { if (this.user.uid > uid) return `${this.user.uid}-${uid}`; else return `${uid}-${this.user.uid}`; }
[ "get chatId() {\r\n const chatId = this.toId - CHAT_PEER;\r\n return chatId > 0\r\n ? chatId\r\n : undefined;\r\n }", "chatId() {\n let text = '';\n const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n for (let i = 0; i < ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a collection of Metrics to be exported.
getMetrics() { return Array.from(this._metrics.values()) .map(metric => metric.get()) .filter(Utils_1.notNull); }
[ "get metrics() {\n return this._metrics;\n }", "getMetrics() {\n let metrics = {};\n for (var i in this._metricsArr) {\n metrics[this._metricsArr[i].getFullName()] = this._metricsArr[i].get();\n }\n return metrics;\n }", "getMetrics() {\n return this._c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a new SP.FieldDateTime to the collection
addDateTime(title, displayFormat = DateTimeFieldFormatType.DateOnly, calendarType = CalendarType.Gregorian, friendlyDisplayFormat = DateTimeFieldFriendlyFormatType.Unspecified, properties) { const props = { DateTimeCalendarType: calendarType, DisplayFormat: displayFormat, ...
[ "function onAdd(item, type) {\n\n if (type === OdsComponentType.FIELD) {\n item.name = generateName(OdsComponentType.FIELD);\n if (item.type === OdsFieldType.DATETIME) {\n // var today = new Date();\n // var date = new Date(Date.UTC(today.getFullYear(), today.getMonth(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to elaborate the route received// in: map, legs, polyline, bounds, algorythm out: markers, contentStrings return value = final position
function elaborateRoute(map, legs, polyline, bounds, markers, contentStrings, totExcitement, alg){ if(alg==0) return elaborateDH(map, legs, polyline, bounds, markers, contentStrings, totExcitement); else if(alg==1) return elaborateNumSections(map, legs, polyline, bounds, marker...
[ "function getRoutePointsAndWaypoints() {\n //Define a variable for waypoints.\n var _waypoints = new Array();\n //console.log(_mapPoints.length);\n if (_mapPoints.length > 2) //Waypoints will be come.\n {\n //console.log('_mapPoints' + _mapPoints);\n for (var j = 1; j < _mapPoints.lengt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an object type UserException
function UserException(message) { this.message = message; this.name = 'UserException'; }
[ "function UserException (message){\n this.message=message;\n this.name=\"UserException\";\n}", "function UserException(message) {\n this.message = message;\n this.name = 'UserException';\n }", "function TiendaNoExistException(){\n this.name= \"TiendaNoExistenteException\";\n this.message = \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Modul: Operand eingeben | Test: ausgabe(getOp());
function getOp() { let op = prompt("Bitte + | - | * | / eingeben.") while (!isOpValid(op)) { // solange falsche eingabe --> schleife op = prompt("Bitte einen korrekten Operator eingeben!") } return op ; }
[ "function getOperand(operand) {\n if (operand === 'add') {\n currentOperand = add;\n } else if (operand === 'subtract') {\n currentOperand = subtract;\n\n } else if (operand === 'multiply') {\n currentOperand = multiply;\n\n } else if (operand === 'divide') {\n curren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
traverse the inline fragment nodes recursively for colleting the selectionSets on each type
_collectInlineFragments(parentType, nodes, types) { if (graphql_1.isListType(parentType) || graphql_1.isNonNullType(parentType)) { return this._collectInlineFragments(parentType.ofType, nodes, types); } else if (graphql_1.isObjectType(parentType)) { for (const node of nod...
[ "function handleSelections(\n sqlASTNode,\n children,\n selections,\n gqlType,\n namespace,\n depth,\n options,\n context,\n internalOptions = {}\n) {\n for (let selection of selections) {\n // we need to figure out what kind of selection this is\n switch (selection.kind) {\n // if its another ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adpated from Aryeh's code. "A whitespace node is either a Text node whose data is the empty string; or a Text node whose data consists only of one or more tabs (0x0009), line feeds (0x000A), carriage returns (0x000D), and/or spaces (0x0020), and whose parent is an Element whose resolved value for "whitespace" is "norma...
function isWhitespaceNode(node) { if (!node || node.nodeType != 3) { return false; } var text = node.data; if (text === "") { return true; } var parent = node.parentNode; if (!parent || parent.nodeType !=...
[ "function isWhitespaceNode(node) {\n return node\n && node.nodeType == Node.TEXT_NODE\n && (node.data == \"\"\n || (\n /^[\\t\\n\\r ]+$/.test(node.data)\n && node.parentNode\n && node.parentNode.nodeType == Node.ELEMENT_NODE\n && [\"normal\", \"now...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for repositoriesWorkspaceRepoSlugComponentsComponentIdGet / Returns the specified issue tracker component object.
repositoriesWorkspaceRepoSlugComponentsComponentIdGet(incomingOptions, cb) { const Bitbucket = require('./dist'); let defaultClient = Bitbucket.ApiClient.instance; // Configure API key authorization: api_key let api_key = defaultClient.authentications['api_key']; api_key.apiKey = incomingOptions.api...
[ "getComponentByComponentTID(componentTID) {\n return this.__components[componentTID];\n }", "async resolveComponentId(id) {\n const idStr = id.toString();\n const component = await this.legacyScope.loadModelComponentByIdStr(idStr);\n\n const getIdToCheck = () => {\n if (component) return i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
blurPixel(img: Image, x: number, y: number): Pixel
function blurPixel(img, x, y) { let neighbors = [[x, y], [x+1, y], [x-1, y], [x, y+1], [x, y-1], [x+1, y+1], [x-1, y-1], [x+1, y-1], [x-1, y+1]]; let values = []; for (let i = 0; i < neighbors.length; ++i) { let curr = neighbors[i]; if(curr[0] >= 0 && curr[1] >= 0 && curr[0] < img.width && c...
[ "function blurPixel(image, x, y) {\r\n let tempRed = 0;\r\n let tempGreen = 0;\r\n let tempBlue = 0;\r\n let count = 0;\r\n for(let i=x-1; i<x+2; ++i) {\r\n for(let j=y-1; j<y+2; ++j) {\r\n if(i<0 || i>image.width-1 || j<0 || j>image.height-1) {\r\n continue;\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculates the avg rating (food, service & ambience) & adds those properties to reviews object
addAverageRating(reviews) { return reviews.map((review) => { let avg = Math.round((review.food + review.service + review.ambience)/3); review.stars = avg; review.overall = avg; return review; }) }
[ "function calculateAverage(reviews) {\n let sum = 0;\n\n if (reviews.length === 0) {\n return 0;\n }\n else {\n reviews.forEach(function (element) {\n sum += element.rating;\n });\n return (sum / reviews.length);\n }\n}", "function setAverageRating() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update table of player guesses
function updateGuessTables() { console.log("update guess tables"); var i, j, p, table, d, guessIndex; // update suspect guess table table = document.getElementById("suspectGuessTable").rows; // get player suspect guess table, collection of rows for(i = 2; i < 8; i++) // iterate through rows, row header at row 0, s...
[ "function updateTable() {\n var rowCount = 5;\n if(pageId == 'page-screen')\n rowCount = 8;\n\n // Build the new table contents\n var html = '';\n for(var i = getGuessesCount() - 1; i >= Math.max(0, getGuessesCount() - row...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Serves app index.html, injecting watch mode script if watching
function serveIndexHTML(req, res, next) { if ((req.method === 'GET' || req.method === 'HEAD') && req.accepts('html')) { let index = fs.readFileSync(path.join(process.cwd(), path.sep, appIndex), 'utf-8'); if (watch) { index = index.replace('</body>', `${browserReloadScript}</body>`); } res.send(i...
[ "function serve() {\n browserSync.init({\n server: {\n baseDir: './'\n //👇 if you are running a local dev server\n // proxy: 'sandpit404:8888/'\n },\n notify:false,\n port: 8000,\n ui: {\n port: 8001\n },\n \n });\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Chase self survival mode. Chase tail, if that isn't pathable, move up body until one is. Eventually call changeTile, runEasyStar and willTheNextMoveKillMe as callbacks
function chaseSelfMode(mySnakeBody, board, currentTurn) { console.log("Entered chaseSelfMode ()"); let moveOption; let nextMove; let pathFound = false; let index = 1; let chaseSelfMove; while (pathFound === false && chaseSelfMove != mySnakeBody[0]) { chaseSelfMove = mySnakeBody[mySnak...
[ "function act_down_shaft() {\n setMazeMode(true);\n\n if (level != 0) {\n updateLog(` The shaft only extends 5 feet downward!`);\n return;\n }\n\n /*\n v12.4.5 - far too many newbie players go into the volcanic shaft, die,\n and never play again. this seemed like the least restrictive\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for extracting a single property and saving it in arrays or single values
function extractProperty(result, name, index, size, source) { var value = source[name]; if (value === undefined) { return; } if (size > 1) { if (!result[name]) { result[name] = new Array(size); } result[name][index] = value; } else { result[name] = value; ...
[ "function extractValue(obj, props) {\n return ((props.length === 0) ? obj : extractValue(obj[props[0]], props.slice(1)));\n }", "function pluck(list, propertyName) {\n\n var arr = []\n for (var i in list) {\n //console.log(list[i]);\n arr[arr.length] = list[i][propertyName];\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Animation of selected and venue showing
function selectedAnimation(e){ //Lower opacity of surrounding options $('.option').not($(e)).not($(this).siblings()).each(function(e){ $(this).addClass('not-selected-option'); }); //remove selected's sibling option from DOM $(e).siblings().addClass('hidden'); // increase size of option to ...
[ "setSelected () {\n this.selectedAnimation = true\n if (this.el.classList.contains(MenuItem.OVER_CLASS)) {\n this.animateSelected()\n } else {\n this.animateOnOver(() => {\n this.animateSelected()\n })\n }\n }", "function deSelectedAni...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show shelter layer on map
function showShelterLayer(clearLayers, keepListeners) { if (keepListeners !== true) { ClearSelectionListeners(); } if (clearLayers) { shelterLayer.clearLayers(); } map.addL...
[ "function showhallsMarkers() {\n sethallsMap(map);\n}", "function printWMS(){\r\n wmsLayer = appelWMS();\r\n \r\n //affichage de la couche\r\n wmsLayer.addTo(map);\r\n }", "function updateMap() {\n\n var lstring = Application.getPreference(\"layers\");\n if (lstrin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace lines in a specified range.
replaceLines(startRow, endRow, lines) { if (!this.transaction || !this.editBuilder) { return; } const _range = new vscode.Range(new vscode.Position(startRow, 0), new vscode.Position(endRow, 0)); const trimedLines = lines.map(line => line.trimRight()); this.editBuilder...
[ "function replaceRange (text, from, to) {\n // Precondition: to \">\" from\n var strLines = text.slice(0); // copy\n var pre = lines[from.line].slice(0, from.ch);\n var post = lines[to.line].slice(to.ch);\n strLines[0] = pre + strLines[0];\n strLines[strLines.length-1] += post;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get item response from single textarea
function GetItemResponseTextArea(){ var val = $("#ResponseTextarea, #message").val(); var returnval; if(val === null){ returnval = "N/A"; } else{ returnval = val; } return returnval; }
[ "function GetItemResponseMultiTextArea(){\n var val1 = $(\"#FormControlTextarea1\").val();\n var val2 = $(\"#FormControlTextarea2\").val();\n var val3 = $(\"#FormControlTextarea3\").val();\n var returnval1;\n var returnval2;\n var returnval3;\n if(val1 === null){\n returnval1 = \"N/A\";\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add helicopters to the environment
setupHelicopter() { const helicopterOne = new Helicopter(1); const helicopterTwo = new Helicopter(2); const max = 0; const min = Math.ceil(this.terrain.terrainHeight / 2 + 10.0); const xPos = Math.floor(Math.random() * 150.0); const yPos = this.terrain.terrainDepth + 80.0...
[ "function Helicopter() {}", "function addHeatingZones() {\n // mark zones with heating devices\n function getZonesWithHeatingDevice(zones) {\n for (var zone_id in zones) {\n if (zones.hasOwnProperty(zone_id)) {\n var zone = zones[zone_id];\n\n if (zone.parent ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
['http', 'https'] names of supported protocols
protocols() { return ['http', 'https']; }
[ "static isSupportedProtocol(urlString) {\n const supportedProtocols = ['https:', 'http:'];\n const url = new URL(urlString);\n return supportedProtocols.indexOf(url.protocol) !== -1;\n }", "vaidateProtocol(host){\r\n let protocols = ['https://', 'http://'];\r\n if (pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the current YouTube video ID from the browser URL. adapted from ScrobbleSmurf
function getYouTubeVideoId () { var regex = /(\?|%3F|&|%26)v=[^\?&#]*/gi; var matches = document.URL.match(regex); if(matches == null) { return null; } var removeRegex = /(\?|%3F|&|%26)v=/gi; var vidId = matches[0].replace(removeRegex, ""); if(vidId == null) { return; } return vidId; }
[ "function getVideoId() {\n let id_on_youtube = url.split(\"v=\")[1];\n const ampersandPosition = id_on_youtube.indexOf(\"&\");\n if (ampersandPosition != -1) {\n id_on_youtube = id_on_youtube.substring(0, ampersandPosition);\n }\n return id_on_youtube;\n}", "function getYoutubeID(url) {\n var id = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the dimensions after applying mask_s/mask_t.
get width() { return getTextureDimension(this.unmaskedWidth, this.mask_s); }
[ "function mask_size (mask) {\n\tvar w = mask[0].length\n\tvar h = mask.length\n\treturn {'width': w, 'height': h}\n}", "static calculateNetsize(mask) {\n return 2 ** (32 - mask);\n }", "function getDimCanavs() {\n w = canvas.width;\n h = canvas.height;\n }", "function getBroadcastDi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates new data source tile. Returns tile as jQuery object.
function createDataSourceTile(datasource) { var name = datasource.Name; var description = datasource.Description; var $datasource = $(_datasourceTileTemplate).clone(true, true); var $datasourceName = $datasource.find(".data-source-name"); var $datasourceDescr...
[ "function newTile(){\n\tvar Tile = {\n\t\tx: 0, // X position of this tile\n\t\ty: 0, //Y position of this tile\n\t\tlocal_x:0,\n\t\tlocal_y:0,\n\t\twidth: 0, //width and height of this tile\n\t\theight: 0,\n\t\tbaseSourceIndex: 0, //index of tile source in tile engine's source array\n\t\tdecorationIndex: 0,\n\t\tp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Problem 18. Enter a number. Find the difference between its biggest and smallest digits.
function diffBetweenDigits(n) { let min = n % 10; let max = 0; let dig; if(Math.floor(n / 10) === 0) { return 0; } while(Math.floor(n / 10) !== 0) { dig = n % 10; if(max <= dig) { max = dig; } if(min < dig) { min = dig; } ...
[ "function exercise18(number) {\n let devided = Math.abs(number)\n let min = devided % 10\n let max = devided % 10\n if (Math.floor(devided / 10) === 0)\n return 0\n while (devided > 0) {\n let digit = (devided % 10)\n if (digit < min)\n min = digit\n if (digit >...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setting position and orientation of Model Target for design and runtime
function setModelTargetLocation(modelTargetWidget, modelLocation) { if (modelTargetWidget.existing_loc) { modelTargetWidget.SetPosition( modelLocation.position.x + modelTargetWidget.existing_loc.offset.x, modelLocation.position.y + modelTargetWidget.existing_loc.offset.y, modelLo...
[ "function setModelView() {\n // viewer point, look-at point, up direction.\n e = vec3(0.0, 0.0, 8.0);\n a = vec3(0.0, 0.0, 0.0);\n vup = vec3(0.0, 1.0, 0.0);\n\n calcMAndMinv();\n}", "setToSetupPose() {\n const data = this.data;\n\n this.x = data.x;\n this.y = data.y;\n this.rotation = data.rotat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the query string from a URL
removeQuery(url) { return url ? url.replace(/\?.*$/, '') : ''; }
[ "function _removeQuery(url) {\n var n = url.indexOf('?');\n if (n >= 0) url = url.substring(0, n);\n return url;\n }", "function removeQuery(url) {\n return url ? url.replace(/\\?.*$/, '') : '';\n}", "function trimUrlQuery(url) {\n let length = url.length;\n let q1 = url.indexOf(\"?\");\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return an object usable by sequelize
convertToSequelize() { return { id: this.id, startHour: this.startHour, nbBike: this.nbBike, trailerUsed: this.trailerUsed, status: this.status, idLine: this.idLine } }
[ "convertToSequelize() {\n return {\n id: this.id,\n idRole: this.idRole,\n pseudo: this.pseudo,\n password: this.password,\n email: this.email,\n idZone: this.idZone\n }\n }", "convertToSequelize() {\n return {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Watchtask A listener that detects updates on sourch files
function watchTask() { // wich files to watch, since there are more then one we make an array //then we tell it what to do with them. // added a init for browser syncs live server browserSync.init({ server: "./pub" }); watch([files.htmlPath, files.cssPath, files.jsPath, files.imgPath, f...
[ "startWatching () {\n\t\tconst path = this.config.inboundEmailServer.inboundEmailDirectory;\n\t\tthis.log(`Watching ${path}...`);\n\t\tFS.watch(path, this.onFileChange.bind(this));\n\t}", "function watchTask(){\n\twatch([files.scssPath, files.jsPath], \n\t\tparallel(scssTask, jsTask));\n}", "function watchTask ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize Indexed DB to be used as local content manager. (Async)
function initDB() { iDB = null; if (!window.indexedDB) { log('Indexed DB not available'); iDBInit = true; return; } var dbRequest = indexedDB.open('CADV_DB', 1); // Doesn't work in FireFox during Private Mode. dbRequest.onupgradeneeded = function(event) { // createObjectStore only works in OnUpgradeNeede...
[ "function initDB() {\n // open connection to indexedDB Database and store to request\n let request = indexedDB.open('myFiles', dbVersion);\n\n // handle error request\n request.onerror = function (e) {\n console.error('Unable to open database.');\n }\n\n // handle success request\n request.onsuccess = fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
determine if for the given gameState, enough votes have been received by given player to step game
voteQuotaReached(votedPlayer, gs) { return votedPlayer.voteCountInGameState(gs) >= this.getVoteQuotaForGameState(gs); }
[ "countVotes(){\n // true means yea, false means nay\n let yeaCount = 0\n let nayCount = 0\n for (let player in this.gameState.votes){\n if(this.gameState.votes[player]){\n yeaCount++\n }\n else{\n nayCount++\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
playMusic() play music repeatedly
function playMusic() { // if music is allowed to play if (playing) { // repeat playing if (!BGM_CONCLUSION.isPlaying()) { BGM_CONCLUSION.play(); } } }
[ "function playMusic() {\n music.play();\n }", "function playMusic () {\n\t\tmusic.play();\n\t\tEvent.unsubscribe(GLOBAL.EVENT.modeChange, playMusic);\n\t}", "playMusic() {\n // Decide which music needs to go next based on the season\n this.nextMusic = window.game.scene.sound.add(this.currentSe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use placename(id, length1); instead of generate(); or namegen(length);
function placename(id, length1) { document.getElementById(id).innerHTML = namegen(length1); output_namegen = ""; }
[ "function genPackageName(baseName, randomStrLength){\n\tvar dateTime = new DateTime();\n\tvar curr = dateTime.getCurrent('yyyyMMddhhmmss');\n\n\treturn baseName + '_' + curr + genRandomString(randomStrLength);\n}", "function nameGen() {\n let first = fName[numGen(fName.length)];\n let last = lName[numGen(lN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the given date represented with a UTC timezone
function dateUTC(date) { return new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000); }
[ "toUTCDate() {\r\n return this.config.timezone === 'UTC'\r\n ? this._baseDate\r\n : new Date(this._baseDate.getTime() + this._baseDate.getTimezoneOffset() * MS_A_MINUTE)\r\n }", "function getUTCFormatDate(date){\n let dateDetails = getDateDetails(date);\n return `${dateDeta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this is overriddent only by lemma2 which /replaces this module, 'proofvsclaimvisib', with lemma2 /own modules list /todo: why it relies on "visibility" and not on display:none? / seems wrong and obsolete, /this is a basic essayCSSvisibility setup /for proof and claim essays, /it can be overridden by "modName" in lemma ...
function setModule() { cssmod[ modName ] = function( cssp, conf ) { var ret = ` /*========================================================*/ /* //|| modes */ /* establishes visibility...
[ "function propagateVisibility(showeverything) {\t\n\t/*at first hide everything*/\n\tvar fachs = document.querySelectorAll('*[data-name~=\"fach\"]');\n\tfor (var i=0; i < fachs.length; i++) {\n\t\tfachs[i].setAttribute(\"data-nocontent\",\"true\");\n\t}\n\tvar wholefachs = document.querySelectorAll('*[data-name~=\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assembles the key for a client state in WebStorage
function createWebStorageClientStateKey(persistenceKey, clientId) { assert(clientId.indexOf('_') === -1, "Client key cannot contain '_', but was '" + clientId + "'"); return CLIENT_STATE_KEY_PREFIX + "_" + persistenceKey + "_" + clientId; }
[ "function createWebStorageClientStateKey(persistenceKey, clientId) {\n assert(clientId.indexOf('_') === -1, \"Client key cannot contain '_', but was '\" + clientId + \"'\");\n return CLIENT_STATE_KEY_PREFIX + \"_\" + persistenceKey + \"_\" + clientId;\n } // The format of the WebStorage key that stores...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a map of userIds to member objects
function createMemberMap() { var membersMap = {}; for (var member in cached.members) { membersMap[cached.members[member].userId] = cached.members[member]; } return membersMap; }
[ "_fetchMembers() {\n return MEMBERS.map((m: Member) =>\n new Member(m.id, m.fname, m.lname, m.phone, m.email));\n }", "function getUserMap() {\n var userMap = {};\n for (var i = 0, l = relations.length; i < l; ++i) {\n var user = relations.getUserInfo(i);\n userMap[user.uri] = user;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decrease page font size and store it in the data store
function decreaseFont() { if (localStorage.getItem("WatsonFontSize") === null) { // this check isn't necessary (because I do it on page load), but I do it for safety localStorage.setItem("WatsonFontSize", "14"); curFontSize = 14; } else { curFontSize = parseInt(localStorage.getItem("Watso...
[ "decreaseFonts() {\n if (this.isFinished || this.isPaused) return;\n\n $('[data-size]').each(function() {\n let size = parseInt($(this).attr('data-size'));\n size -= 2;\n $(this).attr('data-size', size);\n $(this).css('font-size', size + 'px');\n });\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
4. Percentage Complete. If percentageComplete is below 30, print "Still a long way to go". If the percentageComplete is between 30 and 50, print "Slowly getting there". If percentageComplete is between 51 and 80, print "You can do it!". If percentageComplete is between 81 and 99, print "This is the last push!". If perc...
function checkPercentage(percentageComplete) { if (percentageComplete < 30) { return "Still a long way to go"; } else if (percentageComplete >= 30 && percentageComplete <= 50) { return "Slowly getting there"; } else if (percentageComplete >= 51 && percentageComplete <= 80) { return "You can do it!"; ...
[ "function percentage(percentage){\nswitch (true) \n{\n case (percentage >= 1 && percentage <= 30):\n console.log(\"Still a long way to go\");\n break;\n case (percentage >= 31 && percentage <= 50):\n console.log(\"Slowly getting there\");\n break;\n case (percentage >= 51 && percentage ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update an existing contactEmailAddress
static update(contactEmailAddress) { return __awaiter(this, void 0, void 0, function* () { try { const updateContactEmailAddress = (yield db_1.db.update.table('ContactEmailAddresses').update(contactEmailAddress).where('emailAddressId', '=', contactEmailAddress.emailAddressId).execute...
[ "async updateEmail(newEmail) {\n this.email = newEmail;\n await this.save();\n }", "_updateEmailAddressNode(emailNode, address) {\n emailNode.setAttribute(\n \"label\",\n address.fullAddress || address.displayName || \"\"\n );\n emailNode.removeAttribute(\"tooltiptext...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open helper MaterializeCSS Collapsible(s) / Requires: / helperInstance: Either a MaterializeCSS Collapsible instance, or an / Array of MaterializeCSS Collapsible instances / i: OPTIONAL. Number. Index of collapsible element to open (default is 0)
function openInputHelper(helperInstance, i = 0) { // Array of instances if (Array.isArray(helperInstance)) { // Iterate over each instance, opening the element at position i helperInstance.forEach((helper) => helper.open(i)); return; } // Single instance, so open the element at ...
[ "openCollapsible() {\n const incompleteGridWrapper = document.getElementById(\"incompleteGridWrapper\");\n if (incompleteGridWrapper) {\n const incompleteCollapsibleInstance = window.M.Collapsible.getInstance(incompleteGridWrapper);\n if (incompleteCollapsibleInstance) {\n incompleteCollapsib...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when there is componentMap, this component (with this version or other version) is already part of the project. There are several options as to what was the origin before and what is the origin now and according to this, we update/remove/don'ttouch the record in bit.map. 1) current origin is AUTHORED If the version is ...
_updateBitMapIfNeeded() { var _this$consumer2; if (this.isolated) return; if ((_this$consumer2 = this.consumer) !== null && _this$consumer2 !== void 0 && _this$consumer2.isLegacy) { // this logic is not needed in Harmony, and we can't just remove the component as it may have // lanes data ...
[ "updateComponent(componentMap, component, props, doDeepEqualCheck) {\n const clone = utils.setComponentProps(component, props);\n const equivalent = (doDeepEqualCheck ? _.isEqual(clone, component) : clone === component);\n // If no change, return the original objects.\n if (equivalent && componentMap[cl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get user's Unit balance
async function GetBalance(id) { // Finding user's balance in the bank const Balance = await Bank.findOne({ where: { UID: id } }); if (Balance) // If there is one { return Balance.units; // Return the amount of Units } else // If the user doesn't own a bank balance yet { await Bank.create( // Crea...
[ "function getUserBalance() {\r\n mainContract.methods.balanceOf(user.address).call({\r\n shouldPollResponse: false\r\n }).then(res => {\r\n user.balance = res\r\n if ($('.your-token-balance-hd')[0]) $('.your-token-balance-hd')[0].innerHTML = \"Your BUB balance: \" + (user.balance / 100000...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Will return the Arduino interface for the stepper arduino
getStepperArduino() { return this.instances.filter(arduino => arduino.getLabel() === 'STEPPER')[0] }
[ "function getArduinoPort(callback){\n\tSerialPort.list((err, ports) => {\n\t\tlet port = ports.find(p => p.manufacturer && p.manufacturer.includes('Arduino'));\n\n\t\tcallback(new SerialPort(port.comName));\n\t})\n}", "async function findArduino() {\n if (process.argv[2]) {\n return process.argv[2]\n }\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save the URL to our Google Sheets script (content service provider). Could do inline.
function saveSheetsUrl(useUrl=null) { let url = useUrl; if (url == null) { url = document.getElementById('xedx-google-key').value; } if (url == '' || url == null) { alert('You must enter the Google Sheets URL!'); return; } spreadsheetUR...
[ "function saveSheetsUrl(useUrl=null) {\n let url = useUrl;\n if (url == null) {\n url = document.getElementById('xedx-google-key').value;\n }\n if (url == '' || url == null) {\n alert('You must enter the Google Sheets URL!');\n return;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a list of build resource IDs individually assigned to a specific beta tester.
function getAllIDsForBuildsIndividuallyAssignedToBetaTester(api, id, query) { return api_1.GET(api, `/betaTesters/${id}/relationships/builds`, { query }) }
[ "function listAllBuildsIndividuallyAssignedToBetaTester(api, id, query) {\n return api_1.GET(api, `/betaTesters/${id}/builds`, { query })\n}", "function getAllAppResourceIDsForBetaTester(api, id, query) {\n return api_1.GET(api, `/betaTesters/${id}/relationships/apps`, { query })\n}", "function getAllBuil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The number of middleware installed in Composer
get length() { return this.middlewares.length; }
[ "function CountReq (req, res, next) {\n requests++;\n console.log(`Foram realizadas ${requests} requisições`);\n\n return next();\n}", "function ReqCount(req, res, next) {\r\n requests++;\r\n console.log(`Number of requests: ${requests}`);\r\n return next();\r\n}", "getMiddlewares() {\n return []\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Settings Save current layout settings to local storage.
saveSettings() { localStorage.setItem(this.localStorageKey, JSON.stringify(this.getLayout())); }
[ "static save(settings) { window.localStorage.setItem('settings', JSON.stringify(settings)); }", "function saveSettings() {\n localStorage.setItem('language', DATA.language)\n localStorage.setItem('gameMode', DATA.gameMode)\n localStorage.setItem('region', DATA.region)\n}", "function saveSettings()\r\n{\r\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updateProjectStatus(); Delete the Project according to ID...
function deleteProject(id) { let index = projects.findIndex(el => el.id === id); projects.splice(index, 1); }
[ "[DELETE_PROJECT](state, {id}) {\n state.projects.splice(state.projects.indexOf(id), 1)\n }", "function destroyProject(__id) {\n projects.splice(getProjectIndex(__id), 1);\n return \"ok\";\n}", "function deleteProject(id) {\n\tvar xhttp = new XMLHttpRequest();\n\txhttp.onreadystatechange = function(){\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
shadow the setCurrentHp in the CharacterSheet class
setCurrentHp(val, type) { if (type === 'melee') { this.currentHps -= val; } else if (type === 'heal') { this.currentHps + val > this.getMaxHp() ? this.currentHps = this.getMaxHp() : this.currentHps += val; } this.scene.registry.set('playerHps', this.currentHps) }
[ "_setHpLoss() {\n this._hpLossOnHit = this._hpBar.width * 0.1;\n }", "setNewMaxHp() {\n const modifier = this.hasFlag(FLAG_RESET_FIGHT) ? 1.5 : 1;\n\n // First level only gets base stats\n let increaseBy = this.level + this.getLevelBonus() - 1;\n\n this.maxHp = this.stats.base.maxHp + Math.floor(i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOTE: function for display edited movie in page
function displayEditedMovie(divNode, updatedMovie) { divNode.children[0].innerHTML = updatedMovie.title; divNode.children[1].innerHTML = updatedMovie.year; divNode.children[2].innerHTML = updatedMovie.rating; divNode.children[3].innerHTML = updatedMovie.genre; divNode.children[4].innerHTML = updatedMovie.use...
[ "function ShowMovie(element, e) {\n var newPageHtml =\n '<p><img src=\"' +\n imageBaseUrl +\n element.poster_path +\n '\" alt=\"' +\n element.original_title +\n '\"/></p>';\n newPageHtml += \"<p><h1>\" + element.original_title + \"</h1></p>\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter changeSet to remove unwanted ChangeSetItems. This implementation excludes null and empty ChangeSetItems.
filterChangeSet(changeSet) { return excludeEmptyChangeSetItems(changeSet); }
[ "function filterOut(original, toFilter) {\n var filtered = [];\n angular.forEach(original, function(entity) {\n var match = false;\n for(var i = 0; i < toFilter.length; i++) {\n if(scope.renderItem(toFilter[i]) == scope.renderItem(entity)) {\n matc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
recursive search by name and value and returns the match as new root
function searchBy(tree,searchName,searchValue){ if (tree[searchName] == searchValue) return tree; var temp; var children = tree.children; if (children){ for (var i in children){ temp=searchBy(children[i],searchName,searchValue); if (temp) return temp; } } return null; }
[ "function search (tree, value) {\n\n}", "function search(root, desiredName, parentMatched) {\n if (!desiredName) {\n return null;\n }\n\n var expanded = false;\n var matched = _isNameCorrect(root.name || root.text.name, desiredName);\n var children = [];\n var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if sequence number a > b, or a >= b Assumes that both a and b are incrementing counters closely following each other
function cmpSeq(a, b, isEqual = false) { if ((a & 0x8000) && !(b & 0xC000)) { //b > a rollover assumed return false; } if (!(a & 0xC000) && (b & 0x8000)) { //a > b rollover assumed return true; } return (isEqual)?(a >= b):(a > b); }
[ "function greaterOrThanEqual(a,b) {\n return a >= b;\n}", "function greaterThan(a, b) {\n if (b > a) {\n return true\n }\n return false\n}", "function greaterThan(a,b) \n{\n if (b > a) \n {\n return true; \n } else \n {\n return false; \n }\n}", "function greaterThan (a, b) {\n if (b > a) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
used to show the players assigned to a group status "edit" is used on the settings screen to add or remove players from groups status "select" is used on the players select screen of the games, does not add the edit buttons
function generateCurrentPlayersHTML(currentPlayers, status) { var htmlString = "Group: <b>" + groupName + "</b>"; for(var i=0; i<currentPlayers.length; i++){ if (status == "edit"){ htmlString += "<div class=\"highlight-blue blue-bordered\">"; } else if(status == "select"){ ...
[ "function updatePlayerStatus(status) {\r\n\t\t$(\"#missionCardLabel\").html(status.missionCard.mission);\r\n\t\tnumberOfAvailableTanks = status.availableTanks;\r\n\t\t$(\"#availableTanksLabel\").html(numberOfAvailableTanks);\r\n\t\tupdateCards(status.cards);\r\n\t\tupdateCardsCheckboxes();\r\n\t}", "function show...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the demo status text.
function setStatus(text) { status.innerHTML = String(text) }
[ "_setStatusText (text) {\n\t\tthis.$status.innerText = text;\n\t}", "function setStatusLabel(status) {\n $$('#status-desc').html(status);\n log(status);\n}", "setStatusLine(text) {\n _loader().default.setTextAndRestart(text);\n }", "setStatus(newStatus) {\n this.statusLabel.text = newStatus;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Multiple column bar chart
function multiColumnBarPlotter(e) { function darkenColor(colorStr) { // Defined in dygraph-utils.js var color = Dygraph.toRGB_(colorStr); color.r = Math.floor((255 + color.r) / 2); color.g = Math.floor((2...
[ "function multiColumnBarPlotter(e) {\n // We need to handle all the series simultaneously.\n if (e.seriesIndex !== 0) return;\n\n var g = e.dygraph;\n var ctx = e.drawingContext;\n var sets = e.allSeriesPoints;\n var y_bottom = e.dygraph.toDomYCoord(0);\n\n // Find the minimum separation betwee...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert channel names to fayecompatible format: add '/' at start of channel name and replace '.' with '!!'
function toFayeCompatible(ch) { return '/' + ch.replace(/\./g, '!!'); }
[ "function normalizeChannel(name) {\n return \"#\" + ltrim(name.toLowerCase(), \"#\");\n}", "toFayeCompatible(ch) { return '/' + ch.replace(/\\./g, '!!'); }", "function toFayeCompatible(ch) {\n return (ch[0] === '/' ? ch : '/' + ch).replace(/\\./g, '!!');\n }", "function cleanChannelName(name) {\n if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show sidebar read write
function view_sidebar_read_write (){ str = '<h5 id="sidebar_read"> Lecturas en disco: '+sel_val['number_read']+'</h5>'; $("#sidebar_read").replaceWith(str); str = '<h5 id="sidebar_write"> Escrituras en disco: '+sel_val['number_write']+'</h5>'; $("#sidebar_write").replaceWith(str); str = '<h5 id="sidebar_...
[ "function showSidebar() {\n \n var sidebarName = 'sidebar';\n\n if (getRecordUri() !== 0) {\n sidebarName = 'existing_record_sidebar'; \n }\n \n\n var ui = HtmlService.createHtmlOutputFromFile(sidebarName)\n .setTitle('Content Manager');\n DocumentApp.getUi().showSidebar(ui);\n \n\n \n \n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
starts bulkchecking params filterId [string] restricts link detection with passed id attribute
function startBulkCheck(filterId) { var cHosts = bulkHosts.length; if (cHosts == 0) //no filehostings selected return; // STEP 1 linkify the links var linkifyRegex = ''; var hostIdx = cHosts; while(hostIdx--) { linkifyRegex += bulkHosts[hostIdx].linkRegex + "|"; } linkifyR...
[ "function startBulkCheck(filterId)\r\n {\r\n var cHosts = bulkHosts.length;\r\n \r\n if (cHosts == 0) //no filehostings selected\r\n return; \r\n \r\n // STEP 1 linkify the links\r\n var linkifyRegex = '';\r\n var hostIdx = cHosts;\r\n whi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exports a chart object as a jpg. Function to be called by an onClick button event.
function exportChart(chart) { chart.exportChart({format: "jpg"}); }
[ "function exportToPNG(graphName, target) {\r\n var plot = $(\"#\"+graphName).data('plot');\r\n var flotCanvas = plot.getCanvas();\r\n var image = flotCanvas.toDataURL();\r\n image = image.replace(\"image/png\", \"image/octet-stream\");\r\n \r\n var downloadAttrSupported = (\"download\" in document...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that returns true if an object already exists in an array by matching the googlePlaceId
function objectExistsInArray(array, object) { for (var i = 0; i < array.length; i++) { if (array[i].googlePlaceId() == object.googlePlaceId) { return true; } } return false; }
[ "function objectExists(arr, id){\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tif(arr[i].id == id) return true;\n\t}\n\treturn false;\n}", "function validLocationID(locID){\n for(var i=0;i<places.length;i++){\n if(places[i].id===locID){\n return true;\n }\n }\n return false;\n}", "static testObje...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Allows addition of volumes with different units assuming base is in liters
function volumeadder(a1, a2, u1, u2) { if (u1 == 'micro liter' || u1 == 'micro liters') { a1 = a1 * Math.pow(10, -6); } if (u2 == 'micro liter' || u2 == 'micro liters') { a2 = a2 * Math.pow(10, -6); } if (u1 == 'milliliter' || u1 == 'milliliters') { a1 = a1 * Math.pow(10, -3)...
[ "function applyUnit(volume, unit) {\n return volume * unit.size;\n }", "function VolumeLogic(v,t){\n\n /*\n Volume Units\n\n All unit values are conversions of M (Cubic Meter) at the value of 1 converted into each unit.\n */\n var l = {\n ACFTUS:0.0008107...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that gets justification of text layers
function textJustVal(textDoc){ var val = textDoc.justification; //var Justification = {}; if(val == ParagraphJustification.LEFT_JUSTIFY){ return "LEFT"; }else if(val == ParagraphJustification.RIGHT_JUSTIFY){ ...
[ "function GenerateTextStylesTXT(file, filename) {\r\n\tvar layers = app.activeDocument.layers;\r\n\tvar len = layers.length;\r\n\r\n\tvar fout = File( file );\r\n\tfout.open( \"w\" );\r\n\t\r\n\tvar TextStyles = \"Text Style information for \" + filename + \"\\n\";\r\n\tTextStyles += \"============================...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove notes that have fallen out of the judgement window.
function sweepMissedNotes(state) { const elapsed = state.elapsedMs + state.initialOffsetMs; const missedNotes = state.notes.filter((note) => elapsed > note.time + maxJudgementThreshold); if (missedNotes.count() > 0) { return missedNotes.reduce((state, note) => playNote(state, note, missedJudgement), state);...
[ "function removeNote(){\n\t$('.playerNotes .notesWrapper').each(function(index, element) {\n\t\tif($(this).attr('data-array')==curNote){\n\t\t\t$(this).remove();\n\t\t}\n });\n\tgenerateArray(false);\n\thighLightNote(false);\n\tstopGame();\n}", "function clearNotes() {\n heldNotes.forEach(function (obj) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find a notification by id and delete
async findByIdAndDelete(id){ try { let deletedNotif = await Notification.findByIdAndDelete(id); return deletedNotif; } catch (error) { throw(error); } }
[ "removeNotifications(id) {\n Notification.delete(id).catch(_ => {});\n Notification.delete(id * 100000).catch(_ => {});\n }", "function handleDeleteNotification(id) {\n notificationService\n .destroy(id)\n .then(response => {\n setNotifications(response.data);\n setCount(response...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: dwscripts.getDataSourceTypes DESCRIPTION: Given an array of DataSource nodes, this function returns an array of DataSource types. The data source type is the simple file name of the data source. ARGUMENTS: arrayOfDataSourceNodes array an array of data source nodes as returned by getDataSourcesByFileName or ge...
function dwscripts_getDataSourceTypes(arrayOfDataSourceNodes) { var retVal = new Array(); if (arrayOfDataSourceNodes != null) { for (var i=0; i < arrayOfDataSourceNodes.length; i++) { retVal.push(arrayOfDataSourceNodes[i].dataSource); } } return retVal; }
[ "function dwscripts_getDataSourceNames(arrayOfDataSourceNodes)\n{\n var retVal = new Array();\n \n if (arrayOfDataSourceNodes != null)\n { \n for (var i=0; i < arrayOfDataSourceNodes.length; i++)\n {\n if (arrayOfDataSourceNodes[i].name) \n {\n retVal.push(arrayOfDataSourceNodes[i].name)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Redraw the line's text. Interacts with the background and text classes because the mode may output tokens that influence these classes.
function updateLineText(cm, lineView) { var cls = lineView.text.className; var built = getLineContent(cm, lineView); if (lineView.text == lineView.node) { lineView.node = built.pre; } lineView.text.parentNode.replaceChild(built.pre, lineView.text); lineView.text = built.pre; if (buil...
[ "function updateLineText(cm, lineView) {\n\t\t var cls = lineView.text.className;\n\t\t var built = getLineContent(cm, lineView);\n\t\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t\t lineView.text = built.pre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ngTable refresh functions ///////////////////////////// Instantiates new table params from sourceDatas array
function refreshSourceDataTable() { console.debug('Refreshing table with values', sourceDatas); $scope.tpSourceDatas = new NgTableParams({}, { dataset : sourceDatas }); }
[ "function refreshTables() {\n $scope.tpSourceDatas = new NgTableParams({}, {\n dataset : sourceDatas,\n counts : []\n // hides page sizes\n });\n $scope.tpSourceDataFiles = new NgTableParams({}, {\n dataset : $scope.currentSourceData ? $scope.currentSourceData....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recognise LUIS Entity Functions // function to recognise the the feeling of the user
function recogniseFeeling(text){ // a promise object is usedfor the return new Promise( function(resolve, reject){ builder.LuisRecognizer.recognize(text, process.env.LUIS_MODEL_URL, function(err, intents, entities, compositeEntities){ if(!err){ console.log("Now in recogniseFeeling() function")...
[ "function getIntentsAndEntities(response) {\n\t//var getIntentsAndEntities = function (response) {\n\tconsole.log(\"::: Response from LUIS ::: \", JSON.stringify(response));\n\t\n\tLUISReply.topScoringIntent = response.topScoringIntent.intent; \n\n\tfor (var i = 1; i <= response.entities.length; i++) {\n\t\tLUISRep...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Capture originator/trigger/from/to element information (if available) and the parent container for the dialog; defaults to the $rootElement unless overridden in the options.parent
function captureParentAndFromToElements(options) { options.origin = angular.extend({ element: null, bounds: null, focus: angular.noop }, options.origin || {}); options.parent = getDomElement(options.parent, $rootElement); options.closeTo = ...
[ "function captureParentAndFromToElements(options) {\r\n options.origin = angular.extend({\r\n element: null,\r\n bounds: null,\r\n focus: angular.noop\r\n }, options.origin || {});\r\n\r\n options.parent = getDomElement(options.parent, $rootElement);\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a thumbnail for a video snippet.
function createDisplayThumbnail(videoSnippet) { var titleEl = $('<h3>'); titleEl.addClass('video-title'); $(titleEl).html(videoSnippet.title); var thumbnailUrl = videoSnippet.thumbnails.medium.url; var div = $('<div>'); div.addClass('video-content'); div.css('backgroundImage', 'url("' + thumbnailUrl + '"...
[ "function createThumbnailFromElement(elt, video, callback) {\n // Create a thumbnail image\n var canvas = document.createElement('canvas');\n var context = canvas.getContext('2d');\n canvas.width = THUMBNAIL_WIDTH;\n canvas.height = THUMBNAIL_HEIGHT;\n var eltwidth = video ? elt.videoWidth : elt.w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
priority and tasks are as follows: 1. Keep boost labs filled with energy (at least half full) 2. Remove minerals from boost labs if they aren't the right type. 3. Keep boost labs filled with minerals for boosting (at least half full) 4. Remove minerals from Input lab 1 if wrong type 5. Keep Input lab 1 filled with mine...
function getChemistTask(creep) { if (creep.ticksToLive !== undefined && creep.ticksToLive < 100) { creep.memory.role = 'suicide'; return; } if (creep.room.memory.science) { if (!creep.memory.chemistry) { creep.memory.chemistry = {}; creep.memory.chemistry.tick = Game.time; } if ...
[ "function branchingProcess() {\n var implicantsPowerSet = powerSet(remainingImplicants);\n validSolutions = filterPowerSet(implicantsPowerSet); //array contains valid cominations\n var currentValidSolutions = validSolutions.slice();\n minimalSolutions = filterPossibleSolutions(currentValidSolutions); //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================================= Toggle Collection Modal =============================================================
function toggleCollectionModal () { console.log("You clicked!"); if (collectionModal.classList.contains('is-active')) { collectionModal.classList.remove('is-active'); } else { collectionModal.classList.add('is-active'); } }
[ "function collectionModal() {\n vm.collectionOnly = true;\n vm.showModal('co-modal');\n }", "function toggle() {\n setModal(!modal);\n }", "function toggle() {\n setModal(!modal);\n }", "function collectionClickHandler(collection) {\n $scope.isToggleMode ? $scope.toggle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Aggiungo al div nascosto i checboxes della modal popup faccendo il clone degli elementi serve a racogliere i dati di questi checkboxes al form della checklist quando si fa serialize dei dati
function validatecheckbox(div_hide, checkmodal){ $('#'+ div_hide).empty(); $('#'+ checkmodal +' input[type=checkbox]:checked').clone().appendTo( $('#'+ div_hide)); }
[ "function manageCloning(cloner){\r\n\t\t// get the main elements from the data attribute\r\n\t\tclone_parent = getViaAttr(cloner,'data-parent');\r\n\t\tfield = cloneField(getViaAttr(cloner,'data-field'),clone_parent);\r\n\r\n\t\t//update the inner elements of the clone element\r\n\t\tupdateModelField(field,cloner.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if class contains 'active'
function checkIfActive(classes) { return classes.includes('Plx--active'); }
[ "function isActive(element) {\n return element.classList.contains(\"active\");\n}", "isActive() {\n\t\treturn this.slide.classList.contains( 'is-active' );\n\t}", "function isActiveTab(li){\n var _class = $(li).attr(\"class\");\n if( _class === undefined || !(_class === \"active\")){\n return false;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get number of pets of owner
get num_pets() { return this.owner.pets.length }
[ "function numberOfPetsPerOwner() {\n function howManyPetsPerOwner (owner) {\n let result = {};\n result.ownerId = owner.id;\n result.numberOfPets = getPetsOwnedById(owner.id).length;\n return result;\n }\n return owners.map(howManyPetsPerOwner)\n}", "get totalPets() {\r\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LodLiveProfile constructor Not sure this is even necessary, a basic object should suffice I don't think it adds any features or logic
function LodLiveProfile() { }
[ "function ProfileData() {\r\n}", "loadProfile() {\n if (!this.profile) {\n this.profile = new Profile(this.game);\n }\n }", "function Profiler()\r\n{\r\n /**\r\n * The profiler can run in different modes, which determine which functions\r\n * are profiled. If profiling the functions attac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merge course data with user course data
mergeCourseData(courseData, userCourseData) { let modules = courseData.modules; for (let [i, moduleObj] of modules.entries()) { let topics = moduleObj.topics ? moduleObj.topics : []; let moduleTopicCompleted = 0; let total = topics.length; for (let [j, top...
[ "function merge_course_info(course_id) {\n let result = {};\n let main_info = info[course_id];\n let alt_info = extra_info[course_id];\n if (main_info != undefined) {\n for (let k of Object.keys(main_info)) {\n result[k] = main_info[k];\n }\n }\n if (alt_info != undefined)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populate SuperGroup information, presenting a list if there are several results.
function populateSuperGroups(list) { resetError($("#PB_GROUPXPB_GROUP_ID")); $("#PB_GROUPXPB_GROUP_ID").data("bean").invalidate = false; groupList = list; updateSuperGroups(groupList); }
[ "function getGroupList() {\n ApiService.groupList(user).success(function(data) {\n if(data.flag === 1) {\n vm.groupList = data.data.result.map(function(obj) {\n return {\n orgId: obj.orgid,\n name: obj.name,\n leader: obj.realname,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to bind the extend function to Object.prototype
function boundExtend() { var args, val; args = Array.prototype.slice.call(arguments); val = this.valueOf(); // jshint ignore:line args.unshift(val); return extend.apply(null, args); }
[ "function register() {\n if (Object.prototype.extend !== boundExtend) {\n oextend = Object.prototype.extend;\n Object.prototype.extend = boundExtend;\n }\n }", "function extend(baseObj, extObj) {\n for (var k in extObj) {\n if (!extObj.hasOwnProperty(k))\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parentElement; currentEnemyElement; currentPositionIndex; enemyPositionX; enemyPositionY; bulletsHitAbsorbed; isActive;
constructor(parentElement, className){ this.parentElement = parentElement; this.currentEnemyElement = document.createElement("div"); this.currentEnemyElement.classList.add(className); this.parentElement.appendChild(this.currentEnemyElement); this.isActive = false; this.b...
[ "function enemBullet(enShipX,enShipY){\n this.bColor='black'\n this.bPosX=enShipX;\n this.bPosY=enShipY;\n this.bAlive=true;\n this.bInit=function(){\n enmBullet.push(this);\n };\n this.enRender=function(){ //decides if the bullet should still be on the screen\n if(this.bAlive){\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
shows the submission successful thank you view itemId => the id of the item just created requestType => the text of the type of request just submitted
function showThankYou(itemId,requestType){ //empty the attachmentFiles array as the attachments are no longer being used and it will clear up browswer memory attachmentFiles = []; //fill in the item id and the type of request $("#intakeFormThankYou #requestType").html(requestType); $("#intakeFormThank...
[ "function successMessage() {\n setSubmitButtonMessage(\"Cocktail Saved!\");\n }", "function submitItemCallback(result)\n{\n\tif(result === false)\n\t{\n\t\tspawnModal(\"Add Item Failed\", \"<p>We had trouble adding your item.<br/><br/>Make sure you filled out all fields.<br/><br/>Want to refresh the page<br/>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the given document is a Fireworks HTML file targeted at Dreamweaver. Find the Dreamweaver string within the Fireworks comment.
function isDWStyle(theHTML) { var start, stop, target, retVal = false; start = theHTML.indexOf("<!-- Fireworks "); if (start == -1) start = theHTML.indexOf("<!--Fireworks "); if (start != -1) { stop = theHTML.indexOf("-->", start); if (stop != -1) { target = theHTML.indexOf("Dreamweaver", start...
[ "function isFireworksHTML(theHTML) {\r var start, stop, target, retVal = false;\r start = theHTML.indexOf(\"<!-- Fireworks \");\r if (start == -1){\r \tstart = theHTML.indexOf(\"<!--Fireworks \");\r }\r if (start != -1) {\r stop = theHTML.indexOf(\"-->\", start);\r if (stop != -1) {\r target = theH...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makes an array of image names matching the directory of images >>>>
function produceListOfImgNamesARRAY() { for(var imgNum = 1; imgNum < imgMax + 1; imgNum++) { // Images 1 .. 9 need a different URL structure if (imgNum < 10) { images.push("/../../static/images/pdxcg_0" + imgNum + ".jpg"); } else { // Images 10 .. 60 need a different URL structure imag...
[ "function getImageFiles(elem) {\n\tvar pic_set = [];\t\n\tfor (var j = 1; j <= NUM_PICS; j++) {\n\t\tpic_set.push('final-images/' + elem.noun + '_' + elem.order[j-1] + '.png');\n\t\t\t}\n\t\n\n return pic_set;\n}", "function createFlagImageArray(){\n let array = [];\n for (let i = 0; i < NUM_COUNTRIES;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates an addon's descriptor for when the addon has moved in the filesystem but hasn't changed in any other way.
updateDescriptor(aInstallLocation, aOldAddon, aAddonState) { logger.debug("Add-on " + aOldAddon.id + " moved to " + aAddonState.descriptor); aOldAddon.descriptor = aAddonState.descriptor; aOldAddon._sourceBundle.persistentDescriptor = aAddonState.descriptor; return aOldAddon; }
[ "addMetadata(aInstallLocation, aId, aAddonState, aNewAddon, aOldAppVersion,\n aOldPlatformVersion, aMigrateData) {\n logger.debug(\"New add-on \" + aId + \" installed in \" + aInstallLocation.name);\n\n // If we had staged data for this add-on or we aren't recovering from a\n // corrupt databa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the Atom's Particle's State's Orbit 4
function create_atom_particle_state_orbit_4() { // Creates the Geometry of the Ring representing // the Atom's Orbit #4 atom_orbit_geometry_4 = new THREE.RingGeometry(2.5, 2.52, 60); // Creates the Material of the Ring representing // the Atom's Orbit #4 atom_orbit_material_4 = new THREE.MeshB...
[ "function create_atom_particle_state_orbit_3() {\n\n // Creates the Geometry of the Ring representing\n // the Atom's Orbit #3\n atom_orbit_geometry_3 = new THREE.RingGeometry(2.5, 2.52, 60);\n\n // Creates the Material of the Ring representing\n // the Atom's Orbit #3\n atom_orbit_material_3 = ne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
coupon event listener +++
function couponChangeViewListener(event, param) { // console.log("couponChangeViewListener:"+param.targetView); if(param.targetView == DefineView.CATEGORY_LIST_VIEW) { currentSubView.onDeActive(); categoryListView.onActive(); popHistory(); } ...
[ "onCouponApplied(){\n this.couponApplied = true\n //alert('Coupon was applied.')\n }", "onDiscounted()\n {\n // TODO Add raiseEvent clause\n }", "function updateCoupons() {\n\t// Clear coupon list div\n\t$(\"#couponDetailsHolder\").html(\"\");\n\t// make the total the t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Waits to executes sql statement and returns results
function getData() { var defered = q.defer(); connection.query(sqlStatement, defered.makeNodeResolver()); return defered.promise; }
[ "async query(sql){\n const pool = this.pool;\n return new Promise(function(resolve,reject){\n pool.query(sql, function (error, results, fields) {\n if(error) reject(error);\n else resolve(results);\n });\n });\n }", "async execute(sql, pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper function to set response code and message and complete the function (context.done())
function returnSuccess(statusCode, Message, context){ var defaultstatusCode = 201; var defaultresponseBody = "Access Token Created, Email Sent"; context.res = { status : (statusCode?statusCode:defaultstatusCode), body: (Message?Message:defaultresponseBody)}; conte...
[ "function complete() {\n callbackCount++;\n if (callbackCount >= 3) {\n res.render('responses', context);\n }\n }", "complete(jqXHR, textStatus) {}", "function f_return200(req, res, next) {\n req.apiCall.setData(\"Success\").sendResponse();\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the ambulance has been sent, change the map pin to green, change the status of the incident, and change the button text
function markAsAmbulanceSent(incident) { const marker = mapMarkers[incident]; marker.setIcon('/public/incident-pin-green.png'); setTimeout(function () { marker.setAnimation(null); }, 2800); const status = document.getElementById("status" + incident); status.innerHTML = "Status: ambulanc...
[ "function switchInfoStatus()\n{\n if(disabled)\n return ;\n if(info)\n {\n document.getElementById('infoimage').src=\"images/info.gif\" ;\n form.infoon.value=\"no\" ;\n info = false ;\n }\n else \n {\n document.getElementById('infoimage').src=\"images/infoon.gif\" ;\n form.infoon.value=\"ye...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prompt for standup from those who have not submitted
function promptStandup(promptMessage) { usersService.getLateSubmitters().then(lateSubmitters => { if (lateSubmitters.length > 0) { console.log("Behold late submitters members = > " + lateSubmitters); lateSubmitters.forEach(user => { sendMessageToUser(user, promptMessa...
[ "function PromptNotActive(){}", "promptIndividualStandup() {\n let rmUserArr = [];\n this.getUsers().then(res => {\n res.forEach(res => {\n rmUserArr.push(res.username);\n });\n });\n this.getChannelMembers().then(res => {\n let allChanne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }