query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Create a post and store in JSON file
function createPost(text, author, comments){ fs.readFile('data/data.json', 'utf8', function (err, data) { if (err) { return console.log(err); } parsedData = JSON.parse(data); var id = parsedData.posts[parsedData.posts.length-1].id + 1 var post = new Post(text, author, comments, id...
[ "function createPost() {\n var post = new Post(null, txtTitle.value, txtBody.value, owner, null, true);\n\n posts.push(post);\n\n var request = new XMLHttpRequest();\n request.open('POST', urlBase + '/posts', true);\n request.setRequestHeader('Content-Type', 'application/json;char...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies modifications the javascript prior to sending to codepen. Currently merges js files and replaces the module with the Codepen module. See documentation for replaceDemoModuleWithCodepenModule.
function processJs(jsFiles) { var mergedJs = mergeFiles(jsFiles).join(' '); var script = replaceDemoModuleWithCodepenModule(mergedJs); return script; }
[ "function processJs(jsFiles) {\n var mergedJs = mergeFiles(jsFiles).join(' ');\n var script = replaceDemoModuleWithCodepenModule(mergedJs);\n return script;\n }", "function replaceDemoModuleWithCodepenModule(file) {\n var matchAngularModule = /\\.module\\(('[^']*'|\"[^\"]*\")\\s*,(\\s*\\[(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cache the node selectors
function cacheSelectors() { nodes = { htmlEl: document.querySelector(selectors.htmlEl), navToggle: document.querySelectorAll(selectors.navToggle), }; }
[ "static get selectors() {\n return (0, _reselectTree.createNestedSelector)({\n ast: _selectors4.default,\n data: _selectors2.default,\n trace: _selectors6.default,\n evm: _selectors8.default,\n solidity: _selectors10.default,\n session: _selectors12.default\n });\n }", "static...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate provider profile html accordion
function generateProviderProfileHtml( ProfileObj ) { var profileStr = ""; var VerticalTabObject = {"Information":"Profile information","FAQ" : "Providers FAQ Details"}; profileStr += '<div class="row">'; profileStr += CreateVerticalTabs( VerticalTabObject ); profileStr += '<div class="col-xs-9"...
[ "function createProfileCard() {\n const profileCardIconText = 'Click this tooltip to show more info about the user';\n const contributionGraphClass = '.js-calendar-graph';\n\n const showGraphIcon = new ToolTipIcon(\n 'H4',\n 'helpIcon graph-tooltip',\n profileCardIconText,\n contributionGraphClass\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bind the event to handlers specified as a string of handler names on the target object
function bindFromStrings(target, entity, evt, methods){ var methodNames = methods.split(/\s+/); _.each(methodNames,function(methodName) { var method = target[methodName]; if(!method) { throw new Error("Method '"+ methodName +"' was con...
[ "function bindFromStrings(target, entity, evt, methods){\n var methodNames = methods.split(/\\s+/);\n \n _.each(methodNames, function(methodName) {\n \n var method = target[methodName];\n if(!method) {\n throwError(\"Method '\"+ methodName +\"' was configured as an event handler, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an optional schema. The optional schema allows 'undefined' or the values allowed by the given 'schema'.
function optional(schema) { return { type: function () { return "Optional<" + schema.type() + ">"; }, validateBeforeMap: function (value, ctxt) { return value === undefined ? [] : schema.validateBeforeMap(value, ctxt); }, validateBeforeUnmap: function (value, ctxt) { ...
[ "function optional(schema) {\n return {\n type: function type() {\n return \"Optional<\" + schema.type() + \">\";\n },\n validateBeforeMap: function validateBeforeMap(value, ctxt) {\n return value === undefined ? [] : schema.validateBeforeMap(value, ctxt);\n },\n validateBeforeUnmap: funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is used to validate required fields before adding
function validateRequiredFieldForAdd(){ var factoryCode= $("#addFactoryDialog").find("#txtFactoryCode").val(); if(factoryCode.trim() === '' || factoryCode == null) return false; var shortName= $("#addFactoryDialog").find("#txtShortName").val(); if(shortName.trim() === '' || shortName == null) return fa...
[ "function validateRequiredFieldForAdd(){\n\t\tvar fabricSupplierCode= $(\"#addFabricSupplierDialog\").find(\"#txtFabricSupplierCode\").val();\n\t\tif(fabricSupplierCode.trim() === '' || fabricSupplierCode == null)\n\t\t\treturn false;\n\t\t\n\t\tvar shortName= $(\"#addFabricSupplierDialog\").find(\"#txtShortName\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert RAID type Request
function sendConvertRAIDType(cardchar) { //collect data from web UI var NewRAIDType = document.getElementById("RAIDType"+cardchar).selectedIndex - 1; var GUID = $("#GUID"+cardchar).html(); //store the command which is in progress $("#cardProgCmd"+cardchar).html(JS_CONVERT_RAID_TYPE_REQ); //console.log("Convert ...
[ "convertToGivenParameterType(paramData, requestData) {\n let res;\n switch (paramData.type) {\n case \"number\":\n res = Number(requestData);\n // set error response if a parameter is specified in request but is not an integer\n if (isNaN(res)) {\n return;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is triggered when users click on a button to change the status of a project in firebase. It looks for the class of the button and sets the new status accordingly using the updateStatus function.
function changeProjectStatus() { console.log('project selected: ' + this.id) if (this.classList.contains("new-status-active")){ updateStatus(this.id, "active") console.log("new status: active") } else if (this.classList.contains("new-status-inactive")) { updateStatus(this.id, "inactive") console...
[ "function updateProjectStatus() {\n projects.forEach(el => {\n if (el.status === 'in progress')\n el.status = 'complete';\n });\n}", "setProjectStatus({ commit }, { id, status }) {\n commit(types.UPDATE_PROJECT, [id, \"status\", status]);\n }", "function changeStatus(){ \n it...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a regular expression which will match against 1 or more occurrences of a class name
function classMatchingRegex(className) { return new RegExp("\\b" + className + "\\b"); }
[ "function classRE(cls) { return new RegExp(\"\\\\b\" + cls + \"\\\\b\") }", "function _classNameMatcher(ary) {\r\n return RegExp(\"(?:^| )(\" + ary.join(\"|\") + \")(?:$|(?= ))\", \"g\");\r\n}", "function classRegex(name) {\n return new RegExp(\"(^|\\\\s+)\" + name + \"(\\\\s+|$)\");\n }", "classNameMa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
called when user clicks on the tile
function tileClick() { moveOneTile(this); }
[ "function tileClicked(event) {\n\tselectTile(event.target);\n}", "function tile_tap(event) { root.tile_tap(event.currentTarget.id) }", "function clickTile() {\n let tileId = this.getAttribute(\"data-id\");\n let image = this.getAttribute(\"src\");\n let tile = tileArray.find(tile => tile.img===image);\n mov...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read the project build.gradle
function readProjectBuildGradle() { var target = path.join("platforms", "android", "build.gradle"); return fs.readFileSync(target, "utf-8"); }
[ "function readRootBuildGradle() {\n\treturn fs.readFileSync(buildGradleFile, \"utf-8\");\n}", "function writeProjectBuildGradle(contents) {\n var target = path.join(\"platforms\", \"android\", \"build.gradle\");\n fs.writeFileSync(target, contents);\n}", "async function loadConfigGypi () {\n let data\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the listener on caracteristics
set_listener_on_caract(list) { for (var i in list.Player_Def.caract) { if (list.Player_Def.caract.hasOwnProperty(i)) { let tmp = null; tmp = jQuery("#" + i); tmp.data("owner", i); tmp.on('change', () => { list.Player.caract[tmp.data("owner")] = -1 * (list.Player_Def.caract[tmp.data("owner")]...
[ "function setDataListener(callback){\n getIcecommInstance().on('data', callback);\n }", "setUpListeners(bluetooth, osc){\n this.listener.setMainAnalyzers(bluetooth, osc);\n }", "function setCharacteristic(){\r\n\t\t\tfontCharacteristic = document.getElementById('characteristic').value;\r\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets class name of object.
function getClassName(obj) { var funcNameRegex = /function\s+(.+?)\s*\(/; var results = funcNameRegex.exec(obj['constructor'].toString()); return (results && results.length > 1) ? results[1] : ''; }
[ "static getClassName(object) {\r\n if (object === null || object === undefined) {\r\n return undefined;\r\n }\r\n const constructor = typeof object === \"function\" ? object.toString() : object.constructor.toString();\r\n const results = constructor.match(/\\w+/g);\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the players color on their socket id and removes the ID
function disconnectUser(id) { let coloruser = colors.find((color) => color.socketID === id); if (coloruser) { coloruser.socketID = ''; } }
[ "function removeColors()\n{\n\tfor(var i = 0;i < colors.length;i++)\n\t\tif(playerColor != colors[i])\n\t\t\tdocument.getElementById(colors[i]).style.visibility = \"hidden\"\t\t\n}", "removePlayer(socketId){\n for(var index=0; index<this.players.length; index++){\n if(this.players[index].playerI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end of Image ====================================================================== ItemSpec
function ItemSpec( name, itemName, email, reportDate, phone, loc, img, description ) { this.reporter = new Name(name); this.itemName = new ItemName(itemName); this.email = new Email(email); this.reportDate = new ReportDate(reportDate); ...
[ "function createItem(img){\n componentList.push( \n {\n original: img[\"sourcejpg\"],\n thumbnail: img[\"sourcejpg\"]\n }\n )\n }", "function updateItemImage(req, res) {}", "endDrag(props, monitor, component) {\n if(!monitor.didDrop()){\n return;\n }\n \n //use the function whe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
close the proxy server
close() { // clear recorder cache return new Promise((resolve) => { if (this.httpProxyServer) { // destroy conns & cltSockets when closing proxy server for (const connItem of this.requestHandler.conns) { const key = connItem[0]; const conn = connItem[1]; logUt...
[ "close() {\n //close the http server\n this.server.close();\n }", "close() {\n localTunnelService.close(this._socket);\n }", "close() {\n if (this.server) this.server.close();\n this.server = null;\n }", "async function closeProxy() {\n return currentOsProxy.closeProxy()\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the symetric of a relation
function getSymetricRelation(relation) { switch (relation) { case (Relation.hasSkill): return Relation.isSkillOf; case (Relation.isSkillOf): return Relation.hasSkill; case (Relation.hasKnowledge): return Relation.isKnowledgeOf; ...
[ "function getRelationship(){\n\n }", "get relationship() {\n\t\treturn this.__relationship;\n\t}", "getRelation(name){\n return(this.relation[name]);\n}", "getRelation(relation) {\n const relationship = this.relations[relation];\n if (!relationship) {\n throw new Error(`Cannot s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use the API Loader script to load google.picker and gapi.auth.
function onApiLoad() { gapi.load('auth', {'callback': onAuthApiLoad}); gapi.load('picker', {'callback': onPickerApiLoad}); }
[ "function loadPicker() {\n gapi.load('auth', {'callback': onAuthApiLoad});\n gapi.load('picker', {'callback': onPickerApiLoad});\n }", "function loadPicker() {\r\n gapi.load('auth', {'callback': onAuthApiLoad});\r\n gapi.load('picker', {'callback': onPickerApiLoad});\r\n}", "function loadPicker() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Accumulate timeline and state events in a room.
accumulateJoinState(roomId, data, fromDatabase = false) { // We expect this function to be called a lot (every /sync) so we want // this to be fast. /sync stores events in an array but we often want // to clobber based on type/state_key. Rather than convert arrays to // maps all the time, just keep priv...
[ "_accumulateJoinState(roomId, data, fromDatabase) {\n // We expect this function to be called a lot (every /sync) so we want\n // this to be fast. /sync stores events in an array but we often want\n // to clobber based on type/state_key. Rather than convert arrays to\n // maps all the time, just keep pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DoLoad Called when the document is loaded. This function calls any function registered with AddOnLoadFunction().
function DoLoad() { for (var i = 0; i < _g_onload_functions.length; ++i) { if ("function" == typeof(_g_onload_functions[i])) { _g_onload_functions[i](); } } _g_is_loaded = true; }
[ "function callDocumentReadyHandlers() {\n\t\tvar o = g_arrHandlersToCallOnLoad.pop();\n\t\twhile (o) {\n\t\t\tcallHandlers(o[0], o[1]);\n\t\t\to = g_arrHandlersToCallOnLoad.pop();\n\t\t}\n\t\t\n\t\tg_bDocumentLoaded = true;\n\t}", "function doLoad()\n{\n\tdocument.body.addEventListener( 'click', doBodyClick );\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updown rotation is restricted to [pi/2, pi/2] to make the camera easier to control.
rotateUp(radians) { const minAngle = -.5 * Math.PI; const maxAngle = -minAngle; this.yzAngle = Math.max(Math.min(this.yzAngle + radians, maxAngle), minAngle); }
[ "rotateUp(radians) {\n const minAngle = -.5 * Math.PI;\n const maxAngle = -minAngle;\n this.yzAngle = Math.max(Math.min(this.yzAngle + radians, maxAngle), minAngle);\n this.applyRotation();\n }", "rotateUp () {\n let move = glMatrix.quat.create ();\n let rotation = glMatrix.quat.clo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns array of words seperated from input string
words (inputString) { let wordArray = inputString.split(' '); return wordArray; }
[ "words(string){\n return string.split(' ');\n }", "function arrOfWords(str){\n var arr = str.split(\" \");\n return arr;\n}", "words(string) {\n return string.split(' ');\n }", "function getAllWords(str) {\n var output = [];\n if (str.length > 0) { \n output = str.split(' ');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests if check10Row does nothing when no rows are complete
function test23() { reset(); check10Row(); return score === 0; }
[ "function checkRows() {\n for (let i=0; i < 3; i++) {\n if (getCellValue(i,0) == getCellValue(i,1) &&\n getCellValue(i,1) == getCellValue(i,2) &&\n getCellValue(i,0) != EMPTY_CELL)\n return getCellValue(i,0);\n }\n\n return EMPTY_CELL;\n}", "function checkRow(row, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert links to select tasks
function insertSelectLinks(divId) { if(!$("selectTasksDiv")) { var selectTasksDivId = "selectTasksDiv"; addDivTo(divId, selectTasksDivId); addTextToDiv(selectTasksDivId, "Select:", "padding-right: 5px; font-weight: bold;"); // Comment out the following lines to change which links...
[ "function insertSelectTasksByTag(divId)\n{\n if (prefs.getPref(\"SHOW_SELECT_NO_TAG_LINK\"))\n addLinkToDiv(divId, selectTasksWithNoTag, \"Select All Tasks With No Tag\", \"No Tag\");\n if (prefs.getPref(\"SHOW_SELECT_TAG_LINK\"))\n addLinkToDiv(divId, promptSelectTasksWithTag, \"Select All Task...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Win condition helper (Count Down/Right)
function countDownRight(x,y){ for(let i = y; i < rows - 1; i++){ for(let j = x; j < columns - 1; j++){ if(boardArray[x + y * columns] == boardArray[(j + 1) + (i + 1) * columns]){ winConditionCount++; } else { return; } if(i + 1 < rows - 1){ i++; } else { return; } } } }
[ "function countDown(x,y){\n\tfor(let i = y; i < rows - 1; i++){\n\t\tif(boardArray[x + y * columns] == boardArray[x + (i + 1) * columns]){\n\t\t\twinConditionCount++;\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\t}\n}", "function countUpRight(x,y){\n\tfor(let i = y; i > 0; i--){\n\t\tfor(let j = x; j < columns - 1; j++)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inflate notes from the database, converting between versions if necessary.
function convertNotes(notes, sub) { self.log("Notes ver: " + notes.ver); if (notes.ver >= TBUtils.notesMinSchema) { if (notes.ver <= 5) { notes = inflateNotes(notes, sub); } else if (notes.ver <= 6) { notes = decompressBlob(notes); ...
[ "function convertNotes(notes) {\n // ver 2 is pretty close to the in-memory format.\n if(notes.ver <= 2) {\n notes.users.forEach(function(user) {\n user.notes.forEach(function(note) {\n if(note.link && note.link.trim()) {\n // get jus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the current game and get updates from that game from the DB
set currentGame(game) { this._currentGame = game; if (game) { this.gameStorage.onGameChange(this._currentGame.gameID, (snapshot) => { if (snapshot) { this._currentGame.setData(snapshot, this.mapManager); this.onGameChange(); } }); } else { this._hasJoine...
[ "function gameSync() {\n var gameData = currentGame.game.getData();\n gamesModel.game({gameId: currentGame.gameId, game: gameData});\n fire.child('games').child(currentGame.gameId).set(gameData);\n}", "function updateGame() {\n\n return Game.updateOne({\n _id: req.params.gameurl\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makes a call to the Pet Api and builds the gallery
function generatePetGallery(baseURL, term, element) { const apiPromise = fetch(baseURL); const gallery = document.querySelector(`.${element}`); apiPromise .then(handleErrors) .then(data => data.json()) .then(data => { try{ if(!data[term]) return; const dataArr ...
[ "static displayMainGalleryList() {\n const queryUrl = `${url}search?q=sunflowers`;\n const galleryList = fetch(queryUrl)\n .then((res) => {\n if (res.ok) {\n return res.json();\n } else {\n console.log('Something went wrong !');\n }\n })\n .then((data) => ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the next painter
findNewPainter() { // find remaining players with player.turns < this.App.game.settings.turns let remainingPlayers = this.App.setGetters.getRemainingPlayers(); if(remainingPlayers && Object.keys(remainingPlayers).length <= 1) { this.resetRoom(); return; } // find the index of the current painter in th...
[ "getNext() {\n var nextEl = null;\n // if we reach the last element reset to the first element\n if(this.lightBoxCurrent.count >= this.els.length) {\n nextEl = this.els[0];\n }\n // set element to previous element\n else {\n nextEl = this.els[this.ligh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[String] getDCCAddrAndMotorSubAddr([String] objID) Returns the DCC address and motor subaddress as encoded in the object ID. ID is assumed to be of the form: tttaaa, where t is the object type, are numeric characters, and aaa is an optional alphabetic submotor address This function thus returns aaa (e.g. TO450A will re...
function getDCCAddrAndMotorSubAddr(objID) { var position = objID.search("[0-9]"); var positionOfDot = objID.search("[.]"); if((position != -1) && (positionOfDot == -1)) { var lastChar = objID.substring(objID.length-1); if((lastChar == 'R') || (lastChar == 'r') || (lastChar == 'N') || (lastCh...
[ "function getDCCAddr(objID)\n{\n\tvar dccMotorAddr = getDCCAddrAndMotorSubAddr(objID);\n\t\n if(dccMotorAddr != null)\n {\n var position = dccMotorAddr.search(\"\\\\D\");\n\t\n if(position != -1)\n return dccMotorAddr.substring(0, position);\n\t\n return dccMotorAddr;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
They can only have a maximum of 32 hours of comp time banked In order to enforce this maximum, we need to know how many comp time hours they already have banked $scope.timecard.bankedComp is how many hours they have banked Also important to realize is that the hours they are banking are multipled by 1.5, so we'll need ...
function updateEligibleOT() { var compTimeUsed = getComptimeUsed(); var ct = ($scope.compTimeMax - $scope.timecard.bankedComp + compTimeUsed); var maxCompTimeHours = $scope.formatNumber(ct / 1.5); var maxcth = parseFloat(maxCompTimeHours); ...
[ "function C012_AfterClass_Bed_Climax() {\n\tCurrentTime = CurrentTime + 50000;\n\tC012_AfterClass_Bed_PleasureUp = 0;\n\tC012_AfterClass_Bed_PleasureDown = 0;\n\tif (PlayerHasLockedInventory(\"VibratingEgg\")) C012_AfterClass_Bed_NextPossibleOrgasmTime = CurrentTime + 1800000;\n\telse C012_AfterClass_Bed_NextPossib...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
yjw add add params to tab's targetUrl paramNames as "A,B,C" , paramValues as "a,b,c"
function addParams2TabsUrl(tabset , paramNames, paramValues){ var _paramNames = paramNames.split(","); var _paramValues = paramValues.split(","); for(var i=0; i<tabset.cells.length; i++){ if(typeof(tabset.cells[i].targetUrl)!="undefined"&&tabset.cells[i].targetUrl!=""){ for(var j = 0;j<_paramNames.length;j...
[ "function setURLParameters(paramobjs) {\n let nurl = new URL(window.location.href);\n let first = true;\n for (let key in paramobjs) {\n if (first) {\n nurl.searchParams.set(paramobjs[key].paramname, paramobjs[key].paramvalue);\n first = false;\n } else {\n nu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
turn a list of points back into triangles Procedure TriangulatePseudoPolygon (P:VertexList, ab:Edge, T:CDT)
function triangulate_polygon(poly, edge, triangles) { //console.log("triangulate_polygon", poly, edge); // var new_triangles = []; var a = edge[0]; var b = edge[1]; var c = 0; var use_tri = null; //If P has more than one element then if (poly.length > 1) { // c:=First vertex of P // For each vertex v in P d...
[ "Triangulate(vertices) {\n const triangles = [];\n // First, create a \"supertriangle\" that bounds all vertices \n var st = this.createBoundingTriangle(vertices);\n triangles.push(st);\n // begin the triangulation one vertex at a time\n for (var i in vertices) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function calculates what happens, when the block moves & rotates in currentCalculationArea
function moveBlockInCalculationArea(direction){ let xOnCalculationArea; let yOnCalculationArea; let x; let y; let xCalculationAreaModifier = 0; let yCalculationAreaModifier = 0; let rotationModifier = 0; let isRectangleFilled; let numberOfRotation...
[ "function calculateCurrentGravityCalculationArea() {\n\n let x;\n let y;\n\n // clear currentGravityCalculationArea\n const numberOfRows = currentGravityCalculationArea.length;\n const numberOfColumns = currentGravityCalculationArea[0].length;\n for (y = 0; y < numberOfRows...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get extension for icon. For visible difference in icons list, replace BEMspecific files extensions to other.
getExtForIcon(filePath /*:string*/) /*:string*/ { const customExtensions = { '.deps.js': '.apib', '.bemhtml.js': '.bemjson.js', '.priv.js': '.node' }; for (const ext in customExtensions) { if (customExtensions.hasOwnProperty(ext) && filePath.endsW...
[ "get icon() {\n // TODO: refactor this away from here.\n const defaultIcon = `https://static.bit.dev/extensions-icons/default.svg`;\n return this.env.icon || defaultIcon;\n }", "getIcon(extension){\n let fileType;\n\n switch(extension){\n case 'pdf':\n fileType = 'file-pdf-o';\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds 'selected=false' key to all indexed elements in an object.
function addSelectedKeys(obj) { if (obj instanceof Object) { // iterate through keys for (var key in obj) { // if it is a numeric string (JSON only accepts that) if (!isNaN(parseInt(key))) { // then add selected key obj[key].selected = false; } addSelectedKeys(obj[key]); } } }
[ "setSelected(storedData) {\n storedData.forEach((point) => {\n const tag = this.state.body[point[0]][point[1]];\n if (typeof tag !== 'undefined') {\n Object.assign(tag, { checked: true });\n }\n });\n }", "toggleSelectAll () {\n if (this.selectedObjects.length < this.objects.le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Operation set blob generation from 'response' for operation set
function createBlob(response) { var documentValue = "" var operations = ['ll', 'sotf', 'drill', 'panorama', 'spanorama', 'drive', 'navcamsave', 'scienceimage'] var drillNum = "" for(i = 0; i < Object.keys(response).length; i++) { for(j=0; j < operations.length ; j++) { if(response[i][...
[ "get blobType() {\n return this.originalResponse.blobType;\n }", "getBlob() {\n\t\treturn this.outputBlob;\n\t}", "async function operationsListMinimumSetGen() {\n const credential = new DefaultAzureCredential();\n const client = createComputeManagementClient(credential);\n const options = {\n q...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Multiply two compatible matrices
static multiply(mat1, mat2) { //check compatibility if (mat1.width !== mat2.height) { throw new Error('Incompatible matrices for multiplication.'); } const height = mat1.height; const width = mat2.width; const result = new Matrix(height, width); for (l...
[ "static multiply(m1, m2) {\n //matrix product\n if (m1.cols !== m2.rows) {\n print(\"Multiplication error\");\n return undefined;\n }\n let result = new Matrix(m1.rows, m2.cols);\n\n let a = m1.data;\n let b = m2.data;\n\n //multiply\n for (let i = 0; i < result.rows; i++) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function creates the individual card for each car part
function createCard(i) { var cardCreate = document.querySelector('#cardCreation'); var card = document.createElement('div'); card.className = 'card'; var imgDiv = document.createElement('div'); imgDiv.className = 'imgCreate'; var img = document.createElement('img'); imgDiv.appendChild(img); /*Create the...
[ "function createCards() {\n cardsData.forEach((data, index) => createCard(data, index));\n }", "function cardGen(){\n\t\t card = $(\"<div class='card float-left'>\");\n\t\t cardImage = $(\"<img class='card-img-top'>\");\n\t\t cardBody = $(\"<div class='card-body'>\");\n\t }", "function createCards() {\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculate slices 'up' and 'down' with the active frame in the middle
calcSlices(newActiveIndex) { const {frames} = this.state; const {rangeUp, rangeDown} = this.calcRangeUpAndDown(newActiveIndex); const up = frames.slice(newActiveIndex - rangeUp, newActiveIndex); const down = frames.slice(newActiveIndex, newActiveIndex + rangeDown); return {up, do...
[ "get sliceLeft(){ return this.__bg.sliceLeft; }", "get sliceTop(){ return this.__bg.sliceTop; }", "blocksTravelled() {\n let begVert = this.beginningLocation['vertical'] * 1;\n let endVert = this.endingLocation['vertical'] * 1;\n let vertical = endVert - begVert;\n \n let begHorz = this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert calendar as a string, then save it to disk
function exportCalendar() { var calendarString = JSON.stringify(window.appointmentList); console.log(calendarString); // write string to localStorage // http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_webstorage_local if (typeof(Storage) != "undefined") { // Store loc...
[ "function saveCalendarData () {\n localStorage.setItem (\"GDOG-Work-Day-Scheduler\", JSON.stringify(calendarDayText));\n }", "function createFile() {\n const data = `BEGIN:VCALENDAR\\r\\nVERSION:2.0\\r\\nCALSCALE:GREGORIAN\\r\\n${createVevent()}END:VCALENDAR`;\n const file = new Blob([data], { type: '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new `Querybox component`. Creates a new `Coveo.Magicbox` instance and wraps the Magicbox methods (`onblur`, `onsubmit` etc.). Binds event on `buildingQuery` and before redirection (for standalone box).
function Querybox(element, options, bindings) { var _this = _super.call(this, element, Querybox.ID, bindings) || this; _this.element = element; _this.options = options; _this.bindings = bindings; if (element instanceof HTMLInputElement) { _this.logger.error('Querybox ...
[ "function Querybox(element, options, bindings) {\n var _this = _super.call(this, element, Querybox.ID, bindings) || this;\n _this.element = element;\n _this.options = options;\n _this.bindings = bindings;\n if (element instanceof HTMLInputElement) {\n _this.logger.error...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move the selected index up or down.
onMoveUp() { if (this.state.selectedIndex > 0) { this.selectIndex(--this.state.selectedIndex); // User is at the start of the list. Should we cycle back to the end again? } else if (this.props.cycleAtEndsOfList) { this.selectIndex(this.state.items.length-1); } }
[ "moveUp(){\n if ( this.selected && (this.selected.source.num > 1) ){\n this.order(this.selected.source.num, this.selected.source.num - 1, this.selected);\n }\n }", "moveSelectionUp () {\n var newSelectedIndex = this.state.selectedIndex - 1\n\n // prevent index out of bounds\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cancel any pending promises and discard states controlled by the layer.
discard() { super.discard(); this.discardStates(); this._promises.weight.cancel(); delete this._promises; }
[ "@action\n cancel() {\n this._promiseTask.cancelAll();\n }", "cancel() {\n return new Promise((resolve, reject) => {\n if (this._state !== \"open\") {\n resolve();\n return;\n }\n this._state = \"cancellationRequested\";\n this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move all the faces from the 'faceObject' to 'f' > (see the initElementArrays function in scene_design.js for descriptions)
function initFaces(){ f = []; for (var o=0; o<faceObject.length; o+=1){ for (var i=0; i<faceObject[o].length; i+=1){ f.push(faceObject[o][i]); } } }
[ "function setObjFaces() {\n for (const obj of objects) {\n obj.setFace(Util.getFace(obj.x, obj.y, hedges))\n }\n}", "_updateFaces() {\n\n\t\tconst faces = this.faces;\n\t\tconst activeFaces = new Array();\n\n\t\tfor ( let i = 0, l = faces.length; i < l; i ++ ) {\n\n\t\t\tconst face = faces[ i ];\n\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
inp.style('top', '580px'); inp.style('left', '528px');
function inputStyle(){ inp.style('text-align', 'center'); inp.attribute('placeholder', 'search name + press enter'); inp.style('width', '206px'); inp.style('height', '40px'); inp.style('font-size', '15px'); inp.style('position', 'absolute'); inp.style('left', '1017px'); inp.style('top', ...
[ "function moveTextBox (xpos, ypos) {\n document.getElementById(\"datain\").style.top = ypos + document.getElementById(\"application\").offsetTop - document.getElementById(\"framecontain\").scrollTop + 'px';\n document.getElementById(\"datain\").style.left = (xpos - 2.5) - document.getElementById(\"framecontain\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
send data to error queue
function errorQueue (eventsData, type, col, method, callback){ var obj = { method : method, col : col, type : type, events : eventsData, key : "errors" }; dataProducer.writeDataToSQS(obj, function(status){ if(callback){ return callback(status)...
[ "function sendError(err, data) {\n var msg = err;\n if (data && data !== \"\") {\n msg += \": \" + data;\n }\n return postVTPMMessage(vtpmComm.worker.ST_ERROR, msg);\n }", "function sendError (job, errorMessage) {\n job.error = errorMessage;\n job.success = false;\n process....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reload music list from api
reloadMusicList() { this._musicListService.getFavoriteMusic().then(musicList => { this._musicList = musicList; }); }
[ "function refreshPlaylists() {\r\n const PLAYLISTS = \"https://api.spotify.com/v1/me/playlists\";\r\n callApi(\"GET\", PLAYLISTS, null, handlePlaylistsResponse);\r\n}", "function updateTrendMusicData() {\n \n get(`https://theaudiodb.com/api/v1/json/1/trending.php?country=us&type=itunes&format=singles&...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to get contract address after add comment transaction mined successfully
function getContractAddressforaddcomment(transactionHash) { $.ajax({ type: 'POST', url: $scope.webserviceUrl, async: false, data : '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["'+transactionHash+'"],"id":1}', dataType: 'json', contentType: 'a...
[ "async getAddress () {\n await this.init()\n return this._contractAddress\n }", "get address () { return this.contractAddress }", "function getContractAddressforaddcomment(transactionHash)\n\t{\n\t\t$.ajax({\n type: 'POST',\n url: $scope.webserviceUrl,\n\t\t\tasync: false,\n\t\t\tda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Increment a REDIS hash
async incrHashBy(key, field, num) { // this.log(`Incr ${key}#${field} by ${num}`); await this.client.hincrby(key, field, num); }
[ "incrby(key, val) {\n return this.store.incrby(this.prefix + key, val);\n }", "function incr(){\n return client.incrAsync('id');\n}", "function increaseStatsCounter(counterKey, docClient, done, hashKey) {\n// Increase counters...\n var params = {\n TableName: 'dnaStats',\n Key: {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called from within stopLetterSelect and both tints the BitmapText word on the righthand side, and also tints each tile that was matched. If you're going to use a different kind of effect, then you probably want to edit or skip most of this function.
highlightCorrectWord(result) { const highlightTint = this.getHighlightColour() // result contains the sprites of the letters, the word, etc. const word = this.wordList[result.word] word.text.fill = '#' + highlightTint.toString(16) word.text.stroke = '#000000' this.selectFeatureWord(word.text...
[ "function updateCurrentWord() {\r\n var i, j;\r\n var hWord = \"\"; // horizontal word temp value\r\n var vWord = \"\"; // vertical word temp value\r\n var multH = 1; //multiplier values for horizontal and veritical words\r\n var multV = 1;\r\n var tempLScore = 0; //temp value for the score of the letter that...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set ship address fields into record field
function setShipAddressFields(record, shipAddress){ if(!!shipAddress) { nlapiLogExecution('DEBUG', 'f3_setShipAddressFields', JSON.stringify(shipAddress)); record.setFieldValue('shipcountry', shipAddress.shipcountry); record.setFieldValue('shipattention', shipAddress.shipattention)...
[ "function setAddressRelatedFieldValues(record){\r\n record.setFieldValue('billaddresslist', record.getFieldValue('billaddresslist') || '');\r\n record.setFieldValue('billaddress', record.getFieldValue('billaddress') || '');\r\n record.setFieldValue('shipaddresslist', record.getFieldValue('shipaddresslist')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To strikethrough completed task.
function taskComplete() { var taskDone = document.querySelector('li'); taskDone.setAttribute("style","text-decoration:line-through;"); }
[ "setTaskTextDecoration(taskId) {\n const { tasks } = this.state\n this.setState({\n ...this.state,\n tasks: tasks.map(task => task.id === taskId\n ? (({\n ...task,\n bIsDone: !task.bIsDone,\n textDecoration: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
appends list array and checks input for duplicate or empty values and corrects it
function appendListIfInputValid(input) { // info: slice() slices the string and returns it starting from the given index // toUpperCase() converts a string to uppercase letters. // toLowerCase() converts a string to lowercase letters. input = input.charAt(0).toUpperCase() + input.sl...
[ "function findDuplicates(list) {\n newList = {}\n // console.log(newList)\n //go through the list\n // console.log(list.length)\n for (var i = 0; i < list.length; i++) {\n // look at item\n // if it matches a previous return true\n if (newList[list[i]] != undefined){\n return true\n } else {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shortcircuit `replaceInContext` method to prevent it from crossing context boundaries. Bound functions have the same context.
replaceInContext(child, replacement) { if (this.bound) { return super.replaceInContext(child, replacement); } else { return false; } }
[ "replaceInContext(child, replacement) {\n if (this.bound) {\n return super.replaceInContext(child, replacement);\n } else {\n return false;\n }\n }", "unguarded(callback, context) {\n context = context || null;\n\n if (_.isFunction(callback)) {\n const before...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads a register with memory from HL
ldRegMem(register) { register[0] = MMU.rb(regHL[0]); return 8; }
[ "function loadRegister(cpu, registerName, value) {\n} //step 3 & 4", "load_word(register, address) {\n assert(register && VM.REGISTERS[register] && address);\n\n let data = this.read(address, 2); // data is stored in 2 bytes\n this[VM.REGISTERS[register]] = data;\n }", "function loadRegisterFromMemory...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper to get a typed SimpleDbStore for the client metadata object store.
function clientMetadataStore(txn) { return txn.store(DbClientMetadata.store); }
[ "function clientMetadataStore(txn) {\n return getStore(txn, DbClientMetadata.store);\n}", "function clientMetadataStore(txn) {\n return txn.store(DbClientMetadata.store);\n}", "function getMetadataStore() {\n\n var metadataStore = metadata.createMetadataStore();\n\n // convenience me...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses the environment variables and command line args export creatorNodeEndpoint= export delegatePrivateKey=f0b743ce8adb7938f1212f188347a63... NOTE: DO NOT PREFIX PRIVATE KEY WITH 0x
function parseEnvVarsAndArgs () { if (!CREATOR_NODE_ENDPOINT || !PRIVATE_KEY) { let errorMsg = `creatorNodeEndpoint [${CREATOR_NODE_ENDPOINT}] or delegatePrivateKey [${PRIVATE_KEY}] have not been exported. ` errorMsg += "Please export environment variables 'delegatePrivateKey' (without leading 0x) and 'creato...
[ "function parseEnvVarsAndArgs () {\n if (!CREATOR_NODE_ENDPOINT || !PRIVATE_KEY) {\n let errorMsg = `creatorNodeEndpoint [${CREATOR_NODE_ENDPOINT}] or delegatePrivateKey [${PRIVATE_KEY}] have not been exported. `\n errorMsg += \"Please export environment variables 'delegatePrivateKey' and 'creatorNodeEndpoin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reseller.get_task [PRODUCTION] [See on api.ovh.com](
GetTaskInformationGivenItsId(serviceName, taskId) { let url = `/hosting/reseller/${serviceName}/task/${taskId}`; return this.client.request('GET', url); }
[ "async getTask(input = { taskId: '0' }) {\n\n return await this.request({\n name: 'task.get',\n args: [input.taskId],\n page: Page.builder(input.pagination)\n });\n\n }", "getTask(id) {\n let task = this.tasks.find((task) => task.id === id);\n if(!task) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a total for number of times account has borrowed books
function getTotalNumberOfBorrows(account, books) { let total = 0; books.forEach((book) => book.borrows.forEach((borrow) => { if(borrow.id === account.id) total++ } ) ) return total; }
[ "function getTotalNumberOfBorrows(account, books) {\n if (!account || !books || books.length === 0) return 0;\n const totalBorrowCount = books.reduce((totalForAccount, book) => {\n const borrows = book.borrows;\n const filteredBorrows = borrows.filter(\n (borrow) => borrow.id === account.id\n );\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
para modificar los programas
function modificar_programas(id) { $('#obj_codigo, #obj_nombre').html(''); $('#obj_nombre').html('<span class="editable" name="x" id="edit_nombre"></span>'); $('#obj_codigo').html('<span class="editable" name="y" id="edit_codigo"></span>'); $.ajax({ url: 'data/programas/app.php', type: 'post', dataType...
[ "function modificaRiga() {\r\n }", "function procesarComando ( comando ) {\n var comandoParametros = comando.value.split(\" \");\n\n addConsola (objSistema.usuarioActual + \"@\" + objSistema.maquinaActual + \" $\");\n\n comandoExe = comandoParametros[0].substring(0, 2);\n archivoExe = comandoParametros...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copy longitude, latitude to clipboard
copyLnglat () { const lnglat = `${this.place.lng}, ${this.place.lat}` if (this.copyToClipboard(lnglat)) { this.showSuccess(this.$t('placeDetails.lnglatCopied'), { timeout: 2000 }) } }
[ "map_copy_chords() {\n let text = this.long_lat\n clipboard.writeText(text.toString())\n }", "copyLatlng () {\n const latlng = `${this.place.lat}, ${this.place.lng}`\n if (this.copyToClipboard(latlng)) {\n this.showSuccess(this.$t('placeDetails.latlngCopied'), { timeo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
paralexHeight sets paralex variables for each background image
function paralexHeight() { var urlRegex = /url\(['"]*(.*?)['"]*\)/g; jQuery(".paralex .foreground").each(function(i) { if (jQuery(this).parent(".paralex").hasClass("full")) { paralexPercentDisplayHeight[i] = 1; if (jQuery(this).parent(".paralex").hasClass("slow")) { paralexBackgroundSpeed[i]...
[ "getBackgroundImageHeight(){return this.__background.imageHeight}", "function setBackgroundImageHeigh() {\n var BackgroundImage = $('.js-background-image');\n BackgroundImage.height($(window).height());\n }", "getBackgroundImageHeightUnit(){return this.__background.imageHeightUnit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Click 'today' in schedule. Only does anything if schedule is open.
function scheduleToday() { withScheduler( 'scheduleToday', (scheduler) => { withUniqueTag( scheduler, 'button', matchingAttr('data-track', 'scheduler|date_shortcut_today'), click, ); }); }
[ "click_racingHub_RaceMeetings_TodayTab(){\n this.racingHub_RaceMeetings_TodayTab.waitForExist();\n this.racingHub_RaceMeetings_TodayTab.click();\n }", "function inCalendarPage() {\n\n return Q.fcall(function () {\n\n // 1. Locate Day button\n return uia.root().findFirst(funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines whether a codepoint matches the ``RESTRICTED_CHAR`` production.
function isRestrictedChar(c) { return (c >= 0x1 && c <= 0x8) || c === 0xB || c === 0xC || (c >= 0xE && c <= 0x1F) || (c >= 0x7F && c <= 0x84) || (c >= 0x86 && c <= 0x9F); }
[ "function isRestrictedChar(c){return c>=0x1&&c<=0x8||c===0xB||c===0xC||c>=0xE&&c<=0x1F||c>=0x7F&&c<=0x84||c>=0x86&&c<=0x9F;}", "function isCharAndNotRestricted(c){return c===0x9||c===0xA||c===0xD||c>0x1F&&c<0x7F||c===0x85||c>0x9F&&c<=0xD7FF||c>=0xE000&&c<=0xFFFD||c>=0x10000&&c<=0x10FFFF;}", "function isRestrict...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: findServerBehaviors DESCRIPTION: ARGUMENTS: RETURNS:
function TagMenu_findServerBehaviors(paramObj) { // no op }
[ "function findServerBehaviors()\n{\n _ParamName.findServerBehaviors();\n _Default.findServerBehaviors();\n if (_ParamType) _ParamType.findServerBehaviors();\n\n sbArray = dwscripts.findSBs();\n\n return sbArray;\n}", "function RecordsetColumnMenu_findServerBehaviors(paramObj) {\r\n // no op\r\n}", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get temporary saved data Saved in "us_temp_info" attributes
function us_getTempData(name) { if (document.getElementById("us_temp_info").getAttribute(name)) { var value = document.getElementById("us_temp_info").getAttribute(name); return value; } else { return 0; } }
[ "function getTempSetting(){\n\t\t\treturn Model.get('tempSetting');\n\t\t}", "function getTemp() {\r\n\t// files in '/sys/bus/w1/devices/28-000006a35e72/w1_slave'\r\n\t//temps = tempsensor.get(Tsensors);\r\n\tvar tempObj = tempsensor.getAll();\r\n\tio.sockets.emit('tempState', tempObj);\r\n}", "getTemp() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a function getIt that does not accept a parameter. The function should bind a click event to the p tag. When the paragraph is clicked, the function should alert "Hey!".
function getIt() { $('p').click(function(){ alert("p has been clicked!"); }); }
[ "function getIt(){\n $('p').on(\"click\", function(){\n alert(\"Hey!\")\n })\n}", "function getIt() {\n $('p').on('click', function() {\n alert('hey!')\n })\n}", "function makeAlerts(p){\n\n\n\t// put event listener for each selected tag\n\n\talert(p);\n\t\n}", "function click1(){\n console.log(\"C...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new SQL Server Standard Edition instance engine.
static sqlServerSe(props) { try { jsiiDeprecationWarnings.aws_cdk_lib_aws_rds_SqlServerSeInstanceEngineProps(props); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, this.sqlServerS...
[ "static of(sqlServerFullVersion, sqlServerMajorVersion) {\n return new SqlServerEngineVersion(sqlServerFullVersion, sqlServerMajorVersion);\n }", "static oracleSe(props) {\n return new OracleSeInstanceEngine(props.version);\n }", "static sqlServerEx(props) {\n try {\n jsiiD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A helper function to check for numbers > 1000
function checkForSize(numberArray) { // An array to keep track of numbers > 1000 var validSizeArray = []; var j = 0; // Iterate through number array and add numbers smaller or equal to 1000 to it. for (var i = 0; i < numberArray.length; i++) { if (parseInt(numberArray[i]) <= 1000) { validSizeArray[j] = pars...
[ "function numLessThan1000(val) {\n val = Number(val);\n var hundredPlace = parseInt(val / 100),\n result;\n if (val % 100 == 0) {\n result = oneToTen[hundredPlace] + \" hundred \";\n } else {\n result = oneToTen[hundredPlace] + \" hundred \" + numLessThan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
readonly attribute nsISimpleEnumerator subFolders; Returns an enumerator containing a list of nsIMsgFolder items that are subfolders of the instance this is called on.
get subFolders() { if(!this._initialize) { this._isServer && this.server.msgStore.discoverSubFolders(this, true); var filePath = this.filePath; var FolderFlags = Ci.nsMsgFolderFlags; if(filePath.isDirectory()) { this.flags = FolderFlags.Mail | FolderFlags.Directory | FolderFl...
[ "get subfolderIds() {\n if (!this._subfolderIds)\n this._subfolderIds = new StringArray();\n return this._subfolderIds;\n }", "function getSubFolders( folder ) {\n\tlet folders = []\n\tfolders.push( folder )\n\tif ( folder.hasOwnProperty('subFolders')) {\n\t\tfor ( let i = 0; i < folder.subFolders.len...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method allows an app which is already insatlled to be upgraded on a web
upgrade() { return this.clone(App, "Upgrade").postCore(); }
[ "function notifyUpgrade() {\n\t\t\t// Let's get the current version of the webapp\n\t\t\tvar webAppVersion = $('[name=app-version]').attr('content');\n\n\t\t\t// If the version of the framework that loaded the webapp is old\n\t\t\tif (GlobalTools.compareVersionNumbers(clientAppVersion, webAppVersion) < 0) {\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the parent value of this cursor. returns null if this is the root cursors.
function parent(cursor) { if (cursor == null) { return null } const root = cursor._rootData const onChange = cursor._onChange const keyPath = cursor._keyPath if (keyPath.length === 0) { return null // root } const newPath = keyPath.slice(0, -1) return Cursor.from(root, newPath, onChange) }
[ "get parent() {\n var _a;\n const row = this.grid.getRowByKey((_a = this.treeRow.parent) === null || _a === void 0 ? void 0 : _a.rowID);\n return row;\n }", "get parent() { return this.getParentKey(); }", "function parent() {\n return this[0] ? this[0].parent : null;\n}", "get paren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add the click information from remote client
function remoteAddClick(clickInfo){ remote_clickX.push(clickInfo.clickX); remote_clickY.push(clickInfo.clickY); remote_clickDrag.push(clickInfo.clickDrag); remote_userDrawer.push(clickInfo.userDrawer); //redraw redraw(); }
[ "function saveClicks() {\r\n\t\t\r\n\t\tlet sessionId = getSessionIDfromCookie();\r\n\t\t\r\n\t\tconst fetchOptions = makeFetchOptions(\"updateClicks\", sessionId, \"\", \"\", buttonClicks);\r\n\t\t\r\n\t\tlet url = SERVER_ADDRESS;\r\n\t\t\r\n\t\tfetch(url, fetchOptions)\r\n\t\t\t.then(checkStatus)\r\n\t\t\t.then(f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sort movieList array using proper compare function based on sortMethod
function sortMovies(sortMethod) { if (sortMethod === "az") { movieList.sort(azCompare); } else if (sortMethod === "za") { movieList.sort(zaCompare); } else if (sortMethod === "up") { movieList.sort(upCompare); } else if (sortMethod === "down") { movieList.sort...
[ "function sortMovies(movieArr, order) {\n if (!order) {\n return;\n }\n else if ( order === \"rating_desc\" ) {\n movieArr.sort( function(a, b) {\n return b.imdbRating - a.imdbRating;\n });\n }\n else if ( order === \"rating_asc\" ) {\n movieArr.sort( functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check for flex gap support
function checkFlexGap() { // create flex container with row-gap set var flex = document.createElement("div"); flex.style.display = "flex"; flex.style.flexDirection = "column"; flex.style.rowGap = "1px"; // create two, elements inside it flex.appendChild(document.createElement("div")); flex.appendChild(docume...
[ "function checkFlexGap() {\n var flex = document.createElement(\"div\");\n flex.style.display = \"flex\";\n flex.style.flexDirection = \"column\";\n flex.style.rowGap = \"1px\";\n \n flex.appendChild(document.createElement(\"div\"));\n flex.appendChild(document.createElement(\"div\"));\n \n doc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
crossfilterServer.dimension.dispose() Removes this dimension (and its groups) from its crossfilter.
function dispose() { delete filters[dimensionName]; delete datasets[dimensionName]; }
[ "dispose() {\n for (const filter of this._filters) filter.dispose()\n\n this._filters.length = 0\n super.dispose()\n }", "disposeColumnFilters() {\r\n // we need to loop through all columnFilters and delete them 1 by 1\r\n // only trying to make columnFilter an empty (without looping) woul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
distribute roles via DM
async function distributeRolesViaDM(player, role, spec, gameid,token) { let roleBlocks; if (role === "villager" && spec === "none") { roleBlocks = [ { type: "divider" }, { type: "section", text: { type: "mrkdwn", text: "*You are a Village...
[ "assignRoles() {\n const available = roles[this.players.length];\n\n shuffle(available);\n\n this.players.forEach((player, i) => {\n player.role = available[i];\n });\n }", "initRoles() {\n const roles = []\n const n = this.players.length\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function, given a piece ID will return which letter it represents. parameters: an ID of a tile returns: the letter that tile represents. On error, returns "1".
function find_letter(given_id) { // Go through the 7 pieces, for(var i = 0; i < 7; i++) { // If we found the piece we're looking for, awesome! if(game_tiles[i].id == given_id) { // Just return its letter! return game_tiles[i].letter; } } // Or try looking in the completed word array ...
[ "function find_letter(given_id)\n{\n // Go through the 7 pieces,\n for(var i =0; i < 7; i++)\n {\n // check if the tiles are at right place\n if(tiles_on_track[i].id == given_id) {\n // retrun the letter\n return tiles_on_track[i].letter;\n }\n }\n return -1;\n}", "function letterToId(piec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the worm index by the color
function getWormIndexByColor(color) { switch(color) { case "red": return 0; break; case "blue": return 1; break; case "green": return 2; break; case "purple": return 3; break; case "cyan": return 4; break; case "yellow": return 5; break; default:...
[ "function cidx(color) {\n const i = index[color]\n return i || 0\n}", "getIndexOfColor(color) {\n return this.availableColors.indexOf(color);\n }", "get colorIndex () {\n return this._colorIndex;\n }", "function findSwatchIndex(paletteResolver, swatch) {\n return (designSystem) =>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save to local storage and render lib
function saveLocalAndRender() { localStorage.setItem("myLib", JSON.stringify(myLibrary)); render(myLibrary); }
[ "function saveLocalAndRender() {\n localStorage.setItem(\"myLib\", JSON.stringify(myLibrary));\n render();\n}", "function saveAndRender(){\r\n save()\r\n render()\r\n}", "function saveAndRender() {\n save();\n render();\n}", "function saveDataLocal() {\n const libraryObj = JSON.stringify(myLibrary);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Obtain the instance type
get type() { const { constructor } = this; const { type } = constructor; return type; }
[ "type() {\n return this.#type || (this.#type = this.constructor.type(this.#value))\n }", "static getClass(instance) {\r\n return instance.__proto__.constructor;\r\n }", "getType() {\n return this._type;\n }", "get _type() {\n let result = \"LinkEntity\";\n if (this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dynamicly removes a step section from the procedure editor form where the '' button is pressed. The following steps are decremented (number and id) as well as the current step counter.
function removeStep(btn) { var stepSection = btn.parentNode.parentNode.parentNode.parentNode; var removedNum = parseInt(stepSection.getElementsByTagName('SPAN')[0].innerText, 10); var currentSection = stepSection.nextElementSibling; if (currentSection.nextElementSibling == null && stepSection.previousElementSib...
[ "function deleteStep() {\n\t// doesn't do anything right now. The delete step button should reference here\n}", "function deleteStep() {\n if (confirm(\"WARNING: You cannot undo deleting a step.\")) {\n builder.dialogs.method.hide();\n builder.storage.set('save_required', true);\n var node = doc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves a localized number symbol that can be used to replace placeholders in number formats.
function getLocaleNumberSymbol(locale,symbol){var data=findLocaleData(locale);var res=data[13/* NumberSymbols */][symbol];if(typeof res==='undefined'){if(symbol===NumberSymbol.CurrencyDecimal){return data[13/* NumberSymbols */][NumberSymbol.Decimal];}else if(symbol===NumberSymbol.CurrencyGroup){return data[13/* NumberS...
[ "function getLocaleNumberSymbol$1(locale, symbol) {\n var data = findLocaleData$1(locale);\n var res = data[13 /* NumberSymbols */][symbol];\n if (typeof res === 'undefined') {\n if (symbol === NumberSymbol$1.CurrencyDecimal) {\n return data[13 /* NumberSymbols */][Num...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attach Puppeteer to an existing Chromium instance. Augments the original `puppeteer.connect` method with plugin lifecycle methods. All registered plugins that have a `beforeConnect` method will be called in sequence to potentially update the `options` Object before launching the browser.
async connect(options) { this.resolvePluginDependencies(); this.orderPlugins(); // Give plugins the chance to modify the options before connect options = await this.callPluginsWithValue('beforeConnect', options); const opts = { context: 'connect', options }; // Let'...
[ "setup() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._options.browser)\n this._browser = this._options.browser;\n else\n this._browser = yield puppeteer_1.default.launch();\n if (this._options.page)\n this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reference to audio source Engine Methods Do on script load
function Awake() { _audio = GetComponent(AudioSource); }
[ "function audioSource() {\n audio3.play();\n audioSrc = jdata[counter].src;\n audio.src = audioSrc;\n audio.addEventListener('canplaythrough', playHandler, false);\n audio.addEventListener('error', errorHandler);\n }", "function setupAudio() {\n audioEating = loadSound('asse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refresh the time counter.
refreshTime() { if (this._game.isRun()) { this._view.setValue("time", this._game.timeElapsed); } }
[ "function timerRefresh(){\n\tmyTimerObj.timeInSec -= 1;\n\tlet minutes = Math.floor(myTimerObj.timeInSec / 60);\n\tlet seconds = myTimerObj.timeInSec - (minutes * 60);\n\t\n\t// Add leading a zero for when there are less than 10 seconds left\n\tif (seconds < 10) {\n\t\tmyTimerObj.remaining = minutes.toString() + \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read qstring from input.
read_qstring() { // Get string size. let size = this.read_varint32(); // Read string. let text = this.read_string(size); let qstr = new QString(text); this.refs.push(qstr); // Read qualifier. qstr.qual = this.read(); return qstr; }
[ "readQString() {\n // Get string size.\n let size = this.readVarint32();\n\n // Read string.\n let text = this.readString(size);\n let qstr = new QString(text);\n this.refs.push(qstr);\n\n // Read qualifier.\n qstr.qual = this.read();\n return qstr;\n }", "function readString(){\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes a new instance of RecoTwStatistics class with parameters.
function RecoTwStatistics(users, entryLength, dataTable) { this.users = users; this.entryLength = entryLength; this.dataTable = dataTable; }
[ "constructor() { \n \n MediaStats.initialize(this);\n }", "constructor() { \n \n SongMetricsRepetitionBow.initialize(this);\n }", "constructor(twitterConfig) {\r\n this.tweetsArray = [];\r\n this.T = new Twit(twitterConfig);\r\n this.userid = '';\r\n }", "function S...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
spawn incr timer, spawn asteroid if timer == spawn, reset timer, randomize next spawn time limit
function updateAsteroids() { timer++; if (timer >= spawn && !paused) { generateAsteroid(); timer = 0; spawn = Math.floor(Math.random() * (500 - 400 + 1) + 500); // set spawn to random number between 5 and 10 } }
[ "function generateRandomMovement(){\n if (run == true){\n randomTime = Math.random();\n timeoutBetweenMovement = randomTime * 3000 + 2000; // so moveBomb runs bewteen 3-6s\n setTimeout(moveBomb, timeoutBetweenMovement);\n }\n}", "function spawnEnemy() {\n if (Date.now() - lastEnemy >...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
build a randomColor function that takes min and max arguments for r,g, and b, and alpha arguments and returns an rgba value as a string
function randomColor(rmin, rmax, gmin, gmax, bmin, bmax, alpha){ var r = randomNumber(rmin,rmax); var g = randomNumber(gmin,gmax); var b = randomNumber(bmin,bmax); return 'rgba('+r+','+g+','+b+','+alpha+')'; }
[ "function getRandomColorRGBA() {\n return 'rgba(' + calcRndGen(255, true).toString() + \",\" + calcRndGen(255, true).toString() + \",\" + calcRndGen(255, true).toString() + \",\" + Math.random().toString() + ')';\n }", "function getRandomRGBA(){\n var red = getRandomNumber();\n var gree...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructor of Wheel id: ID of the wheel element slice_num: Number of slice in the wheel time_quantum: time interval to update position of wheel friction_sec: intialal friction in degree second^2 minimum_friction_sec: minium friction omega_base_sec: Rate of change of angle in degree / second omega_var_sec: Range of var...
function Wheel(id, slice_num, time_quantum, friction_sec, minimum_friction_sec, omega_base_sec, omega_var_sec, clockwise, safe_ratio) { this.id = id; this.element = document.getElementById(id); this.jquery_obj = $('#' + id); this.slice_num = slice_num this.time_quantum = time_quantum; this.frict...
[ "function WheelElement(id)\n{\n this.wheel =document.getElementById(id);\n this.sign = 0; //sign indicates direction of upward or downward movement: -1 => MoveDown, +1 => MoveUp\n this.y =0; // y coordinate of the mouse position on the wheel\n this.addedFaces=0; // number of faces turned in a single m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A required docking point has lost its only link. We must find a link that can replace it.
requiredWasUnlinked(dockingPoint) { this.generateIngoingKCForDockingPoint(dockingPoint); }
[ "setIngoingDockingPoint(dockingPoint) {\n this.inPoint = dockingPoint;\n }", "dock() {\n return;\n }", "addIngoingDockingPoint(kcData) {\n let point = new DockingPoint(this, getInputPoint,\n {x:0,y:this.height + this.dockPointsReq.length*this.thickness+this.thickness/2},kcD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save user search filter to localstorage.
function saveSearchFilter() { var searchOptions = {}; searchOptions[HOTEL_SEARCH_FILTER] = filterParams; searchOptions[HOTEL_SEARCH_BODY] = filterBody; searchOptions[HOTEL_SEARCH_ADVANCE] = filterAdvance; $localStorage[HOTEL_SEARCH_OPTIONS] = searchOptions; ...
[ "function saveSearch() {\n\n var filters = [];\n self.filters.forEach(function(v, i) {\n var filter = {key: v.key, value: v.value};\n filters.push(filter);\n });\n\n var widgets = [];\n self.widgets.forEach(function(v, i) {\n var widget = { id: v.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes animate.css classes from AndroidNotification to reenable :hover effects
function removeAnimationAndroidNotification() { document.querySelector('.androidNotification').className = "androidNotification"; }
[ "function unhover() {\n textAnimation.style = '';\n // textAnimation.style.backgroundColor = 'var(--primary)';\n \n textAnimation.classList.add('text-animation');\n backgroundAnimation.classList.add('background-animation');\n textAnimation.classList....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUBLIC functions [stop stops the timer and resets the counters. Dispatch stopped event]
function stop () { stopTimerAndResetCounters(); dispatchEvent('stopped', eventData); }
[ "function stop() {\n stopTimerAndResetCounters();\n dispatchEvent('stopped', eventData);\n }", "function stop() {\r\n\tstopTimer();\r\n\tms = 0;\r\n\ts = 0;\r\n\tm = 0;\r\n\tstwatch.textContent = getTimer();\r\n}", "function stop(){\n clearInterval(counter);\n }", "stop() {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show/Hide the arrows of the neighbour splitter bars
_updateNearSplitterBars() { const that = this; if (that.previousElementSibling instanceof JQX.SplitterBar) { that.previousElementSibling.showFarButton = that.collapsible; } if (that.nextElementSibling instanceof JQX.SplitterBar) { that.nextElementSibling.showNea...
[ "_setSplitterBarVisibility() {\n const that = this,\n splitterBars = that.$.itemsContainer.getElementsByTagName('smart-splitter-bar');\n\n for (let i = 0; i < splitterBars.length; i++) {\n that.hideSplitterBars ? splitterBars[i].hide() : splitterBars[i].show();\n }\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set filter categories mode
[consts.SET_CATEGORY_FILTER_MODE](state, val) { state.categoryFilterMode = val; state.categoryFilterText = ""; }
[ "function toggleTagsAndCategoryFilter() {\n\n\tcategoriesAndTags = !categoriesAndTags;\n\t\n\tapplyTagsAndCategoryFilter();\n\t\n\tstore('categoriesAndTags', categoriesAndTags);\n\t\n\tif (filterByCategoryEnabled && filterByTagsEnabled) {\n\t\tloadImages();\n\t}\n}", "set filterMode(value) {}", "function catego...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make sure namespace exists (for keys with dots in name) TODO key parts that start with numbers quietly fail. i.e. month.short.1=Jan
function checkKeyNamespace(key) { var regDot = /\./; if(regDot.test(key)) { var fullname = ''; var names = key.split( /\./ ); for(var i=0; i<names.length; i++) { if(i>0) {fullname += '.';} fullname += names[i]; if(eval('typeof '+fullname+' == "undefined"')) { eval(fullname + '={};'); }...
[ "function checkKeyNamespace(key) {\n\n\t var regDot = /\\./;\n\t if (regDot.test(key)) {\n\t var fullname = '';\n\t var names = key.split(/\\./);\n\t names.forEach(function (name, i) {\n\n\t if (i > 0) {\n\t fullname += '.';\n\t }\n\t fullna...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }