query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Set Initial State Sets the state to the data object defined inside the function. Also takes a diffs object which will set the state to the initial state with any differences passed.
setInitialState(diffs, localStorage) { let data = { token: localStorage.token && localStorage.token !== 'undefined' ? JSON.parse(localStorage.token) : null, profile: localStorage.profile ? JSON.parse(localStorage.profile) : null, provider: localStorage.provider ...
[ "setInitialState(diffs, callback) {\n let data = {\n apps: [],\n appsLoading: true,\n loading: false,\n jobs: [],\n visiblejobs: [],\n isPublic: false,\n filter: {\n pipeline: null,\n version: null\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a subscription filter for a string attribute.
static stringFilter(stringConditions) { var _b, _c; const conditions = new Array(); if (stringConditions.whitelist && stringConditions.allowlist) { throw new Error('`whitelist` is deprecated; please use `allowlist` instead'); } if (stringConditions.blacklist && string...
[ "function CustomFilterFactory(){\n return function (input){\n //Return changed input\n return input + \" AAAAAA@@@\";\n }\n }", "function createFilter(key) {\n if (typeof key == 'function')\n return key;\n\n if (typeof key == 'string')\n return event => event.key === key;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PROTECTED Updates the position of all the selected network elements and their ports.
function updateSelectedNes() { if (this.dottedSelection.x != 0 && this.dottedSelection.y != 0) { var mapScL = document.getElementById("MAP").scrollLeft; var mapScT = document.getElementById("MAP").scrollTop; for (var i = 0; i < this.selectedNetworkElements.getLength(); i++) { var ne = this.selectedNetwor...
[ "function updatePorts(items, request) {\n\tfor (var i = 0; i < items.length; i++) {\n\t var sPort = items[i];\n\t \n\t if (positioned[topoStore.getValue(sPort, 'id', '')] == 1)\n\t\tcontinue;\n\t \n\t sNode = sPort.parent[0];\n\t sPoint = [topoStore.getValue(sNode, 'x', ''),\n\t\t topoStore.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an empty array (can also assign first element)
function createArray(first) { if (!first) { return this.emptyArray.slice(); } else { var array = this.emptyArray.slice(); array[0] = first; return array; } }
[ "function createEmptyArray() {\n}", "function Array$zero() {\n return [];\n }", "function Array$empty() {\n return [];\n }", "function array(length,defaultVal=0){\n\tvar a = [];\n\tfor(var i=0; i<length; i++){\n\t\tif(typeof defaultVal === \"object\"){defaultVal = deepCopy(defaultVal)}\n\t\ta.push(def...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true for portrait, false for landscape
function isPortrait(){ switch (window.orientation) { case 0: return true; case 180: return true; case -90: return false; case 90: return false; } }
[ "function isPortrait(){\r\n switch (window.orientation) { \r\n case 0: \r\n return true;\r\n \r\n case 180: \r\n \t return true;\r\n \r\n case -90: \r\n \t return false;\r\n \r\n case 90: \r\n \t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if the key pressed is 'enter' runs the function newEntry()
function keyPress(e) { var x = e || window.event; var key = x.keyCode || x.which; if (key == 13 || key == 3) { //runs this function when enter is pressed newEntry(); } if (key == 38) { console.log("hi"); //document.getElementById("chatbox").value = lastUserMessage; } }
[ "function keyPress(e) {\nvar x = e || window.event;\nvar key = (x.keyCode || x.which);\nif (key == 13) {\n //runs this function when enter is pressed\n newEntry();\n}\n}", "function keyPress(e) {\n var x = e || window.event;\n var key = (x.keyCode || x.which);\n if (key == 13 || key == 3) {\n //runs this fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this converts temperature data that comes in Kelvin to Fahrenheit
function tempKtoF(temp){ //convert Kelvin to Fahrenheit by using this equation (K − 273.15) × 9/5 + 32 = F let fahrenheit = (temp - 273.15) * 9/5 + 32; //assigns fahrenheit to go to 2 decimal places fahrenheit = fahrenheit.toFixed(2); //returns temperature in Fahrenheit return fahrenheit; }
[ "convertKelvin(temp) {\n const C = +(temp - 273.15).toFixed(0);\n const F = Math.round((9 / 5) * (temp - 273.15) + 32);\n return (this.temperature = { C, F });\n }", "function convertToFahrenheit( kelvin ) {\n\treturn kelvin * ( 9 / 5 ) - 459.67;\n}", "function convertTemperature(kelvin){\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a replica region for the secret
addReplicaRegion(region, encryptionKey) { try { jsiiDeprecationWarnings.aws_cdk_lib_aws_kms_IKey(encryptionKey); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, this.addReplicaRegi...
[ "AddSubRegion(region){\n this.regions.push(region);\n }", "function _add_new_server_to_replica_set(params) {\n const shardname = params.shardname;\n const ip = params.ip;\n dbg.log0('Adding RS server to', shardname);\n const new_topology = cutil.get_topology();\n const shard_idx = cutil.fin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds the `for update` modifier to a select query on supported databases.
forUpdate() { return new SelectQueryBuilder({ ...this.#props, queryNode: SelectQueryNode.cloneWithEndModifier(this.#props.queryNode, SelectModifierNode.create('ForUpdate')), }); }
[ "update (queries, modifiers, options = {}) {\n let opts = Object.assign({\n multi: false,\n projections: {}\n }, options),\n cursor = this[Helpers.is(queries, 'String') ? 'findByKey' : 'find'](queries, opts.projections, !opts.multi);\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Install ghostcli & nodemon globally
function installGhostCli () { return Promise.all([ Promise.resolve().then(() => { if (shell.which("ghost")) { return "already install ghost-cli"; } return execPromise("npm install -g ghost-cli"); }), Promise.resolve().then(() => { if (shell.which("nodemon")) { return "already install nod...
[ "function initdependencies(){\n process.spawnSync('npm',['install', '--save', 'express'], { cwd: './' });\n process.spawnSync('npm',['install', '--save', 'helmet'], { cwd: './' });\n}", "installModules() {\n const modules = []\n\n if (this.options.nginxRoot && !this.#pj.dependencies?.foreman) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
define la clase PaginaIndice
function PaginaIndice(x) { // Llama al constructor primario Pagina.call(this,x); this.numero = 0;//numero de pagina this.titulo = 'Sin titulo'; this.tipo = 'Texto-Texto-Texto'; }
[ "function Pagina(x) {\n\t\tthis.attPagina=0;\n\t\tthis.titulo = 'General'; //titulo de la pagina\n\t\tthis.unidad = 'General'; //unidad de la materia\n\t\tthis.numero = x;//numero de pagina\n\t\tthis.puntaje = 1;//puntaje para evaluacion\t \n\t\tthis.tipo = 'General';\n\t\t\t\t\n\t\tPagina.prototype.GetTipo = func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the number of animation cycles.
set animationCycles(v) { this._animationCycles = v; this._enableAnimation = true; }
[ "setAnimationCount() {\n this.animation_count++;\n }", "function setCycle(){\n clearTimeout(cycleTimeout);\n cycleTimeout = setTimeout(function(){changeToNextImage()}, options.cycleTime);\n }", "function animateCount() {\n\n\tif (currentLoopIndex > ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! move the scorpian intellegently
function moveScorpian() { const down = scorpianCurrentPosition + width const left = scorpianCurrentPosition - 1 const right = scorpianCurrentPosition + 1 const up = scorpianCurrentPosition - width checkGhostMode(scorpianClass, scorpianCurrentPosition) removeGhost(scorpianCurrentPosition, scorpi...
[ "function move_from_san(move) {\r\n var to, from, flags = BITS.NORMAL, promotion;\r\n var parse = move.match(/^([NBKRQ])?([abcdefgh12345678][12345678]?)?(x)?([abcdefgh][12345678])(=?[NBRQ])?/);\r\n if (move.slice(0, 5) === 'O-O-O') {\r\n from = kings[turn];\r\n to = from - 2;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createFlightPath() draws the historic flight path of a uav/ufo on the map
function createFlightPath(polyline, colour) { var flightPath = new google.maps.Polyline({ path: polyline, strokeColor: colour, strokeOpacity: 0.8, strokeWeight: 2 }); flightPath.setMap(osmMap); return flightPath; }
[ "function makePath(){\n flightPath = new google.maps.Polyline({\n path: locationInfo,\n geodesic: true,\n strokeColor: '#FF0000',\n strokeOpacity: 1.0,\n strokeWeight: 2\n });\n flightPath.setMap(map);\n}", "drawFlightpath()\n {\n this.graphics = this.scene.add.grap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
computes the perimeter of a 4 sided object, given 4 points
function computePerimeter( x1, y1, x2, y2, x3, y3, x4, y4 ) { let line1 = computeLineLength( x1, y1, x2, y2 ); let line2 = computeLineLength( x2, y2, x3, y3 ); let line3 = computeLineLength( x3, y3, x4, y4 ); let line4 = computeLineLength( x4, y4, x1, y1 ); return computePerimeterByLength( line1, li...
[ "function perimeterQuadrilateral (s1, s2, s3, s4){\nreturn s1 + s2 + s3 + s4;\n}", "function perimeterQuadrilateral(a,b,c,d){\n return a + b + c + d;\n}", "function perimeterQuadrilateral(s1,s2,s3,s4) {\n return s1 + s2 + s3 + s4;\n}", "function computePerimeterOfATriangle(side1, side2, side3) {\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders each item as a component based on card class while passing in handleClick as a prop to be called in child components
render (){ const App = (<div id="bodyContainer"> <div id="Header"><h3>Russ Websites</h3></div> <Card classes={this.state.item1} handleClick={this.handleClick} id="item1" pname="Why Your Website Matters" content={pageContent.WhyContent()} /> <Card classes={this.state.item2} handleClick={this.handle...
[ "getCards(array) {\n return array.map(card => (\n <li key={card.name}>\n <InsuranceCard clickHandler={this.handleCardClick} data={card} />\n </li>\n ));\n }", "renderCards() {\n const {listings, view} = this.props;\n return (\n listings.map(item => {\n switch (view) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes in a JSON result, certification, and returns a formatted string of the certification result
function formatCertification(certification) { var name = certification.companyName; var region = certification.region; var country = certification.country; var status = certification.status; var solution = certification.solution; var certificationScenario = certification.certificationScenario; var outp...
[ "function formatCompletedCertification(certification) { \n\n\tvar name = certification.companyName; \n\tvar region = certification.region; \n\tvar country = certification.country; \n//\tvar status = certification.status; \n\tvar solution = certification.solution; \n\tvar certificationScenario = certification.certif...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List by date and phone
async function list(req, res) { const { date, mobile_number } = req.query; if (date) { const data = await service.listByDate(date); res.json({ data }); } else if (mobile_number) { const data = await service.listByPhone(mobile_number); res.json({ data }); } else { const data = await service.l...
[ "async function list(req, res, next) {\n const { mobile_number } = req.query;\n if (mobile_number) {\n const results = await service.search(mobile_number);\n return res.json({ data: results });\n }\n \n const { date } = req.query;\n const data = await service.list(date);\n \n res.json({\n da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove all scene objects except groundPlane
if (!this.History.inProgress()) { this.objects.all() .filter(obj => obj.name !== 'groundPlane') .forEach(obj => { this.scene.remove(obj) }); }
[ "removePlane(){\n if(this.groundPlane == null){\n return;\n }\n\n var object = this.scene.getObjectById(this.groundPlane.id);\n if(object != null){\n this.scene.remove(object);\n this.groundPlane = null;\n }\n }", "function removeObjects(){\n\tfor(v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
===========================Local Storage for Logging==============================================
function storeLogItems() { localStorage.logContents = locationUpdateLog.innerHTML; }
[ "function saveLogs() {\n var prefix = 'xshteff.betterfriends.';\n localStorage.setItem(prefix + 'logsMetadata', JSON.stringify(logsMetadata));\n localStorage.setItem(prefix + 'playerLogs', JSON.stringify(playerLogs));\n localStorage.setItem(prefix + 'dropTypeLogs', JSON.stringify(dropTyp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
str, int (start ndx), int (length in chars) outputs: str reqs: rtn a substr of the input str, starting at the 'start' ndx and running for (up to) 'length' chars rules: if start 0 if start < 0 start += str.length for 'length' chars, starting at the 'start' ndx if the str char is undefined (we have passed the eos or 'sta...
function substr(str, startNdx, length) { let newStr = ''; if (length > 0) { if (startNdx < 0) startNdx += str.length; for (let i = 0; i < length; i++) { if (str[startNdx + i] === undefined) break; newStr += str[startNdx + i]; } } return newStr + '!'; // add ! to indicate eos }
[ "function substringByStartAndLength(input, start, length) {}", "function substring(someStr, length, offset) {\n\tvar sub = \"\";\n\n\tif (offset > someStr.length || offset + length > someStr.length)\n {\n alert(\"Cannot get substring from input string.\");\n }\n\n\tfor(var i = offset; i < length + of...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get title for current active icon
getTitle() { return this.icon.parentElement.childNodes[3]; }
[ "get activedTabIcon() {\n return this.getTabText(this.activedTabIndex);\n }", "get title () {\n return new IconData(0xe264,{fontFamily:'MaterialIcons'})\n }", "getInteractionTitle(action) {\n const currentTitle = action.metadata.title; \n\n switch (currentTitle) {\n case 'Untitled Te...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function that sets event listeners on the category links.
function categoryListeners() { var categories = document.getElementById('category_nav').getElementsByTagName('a'); var category; var allCategory = categories[0]; addEvent(allCategory, 'click', displayAllCategory); //loop starts one after the first element due to the all link being done for(var i = 1; i < categ...
[ "attachMemeCategoryButtonListeners () {\n document.getElementById(\"category-bestOf\").addEventListener(\"click\", this.showBestOfMemes.bind(this));\n document.getElementById(\"category-images\").addEventListener(\"click\", this.showImageMemes.bind(this));\n document.getElementById(\"category-v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stop moving draggy object, save position and dispatch onDrop event
function dragEnd (e) { self.draggy.position = self.position; classes(self.draggy.ele).remove('activeDrag'); self.dispatchEvent(onDrop); d.removeEventListener(events.move, dragMove); d.removeEventListener(events.end, dragEnd); }
[ "function elementDropped(e){\n //e.preventDefault();\n settings.placeHolder.onmousemove = null;\n settings.placeHolder.onmouseup = null;\n settings.placeHolder.ontouchmove = null;\n settings.placeHolder.ontouchend = null;\n if(currentDropElement != null){\n var tmp = {x:currentE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
we're now the leader of the party
function party_now_leader(){ this.party_activity('now leader of party'); }
[ "assignFirstLeader() {\n // const randomNumber = Math.floor(Math.random() * Math.floor(this.players.length));\n for (let i = 0; i < this.players.length; i++) {\n if (this.players[i] != null) {\n this.players[i].leader = true;\n this.leaderIndex = i;\n this.quests[1].assignLeader({ na...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scan an annotation container and look for body of matched target uri. return promise
function findAnnotation(conturi, targeturi) { var p = axios.get(conturi, {responseType: 'text', headers:{'Accept':'text/turtle'}}) .then(parseTurtle(conturi)).then(graph => { //extract content URIs from LDP container graph //console.log(graph) var matches = graph....
[ "function findExistingAnn(cont, target, body) {\n let p = getLDPcontents(cont)\n .then(uris => {\n return promiseUntil((r, arg)=>(r !== null || arg.length === 0),\n arg=>(arg.slice(1)),\n arg=>{\n if (arg.length >0)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter for content element
getContentElement() { return this.contentEl; }
[ "get contentNode() {\n return apputils_1.DOMUtils.findElement(this.node, CONTENT_CLASS);\n }", "get contentNode() {\n return DOMUtils.findElement(this.node, CONTENT_CLASS);\n }", "get content() {\n return this._content;\n }", "get contentElement() {\n return Polymer.do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
More Bootstrap element creators Function to add tab to list
function addTab(tabTitle,tabListID, divListID,tabID, divID,tabOnClick,divHTML,tabToolTip,selected){ if(!tabToolTip){tabToolTip = ''}; var show; if(selected || selected === 'true'){show = 'active show'}else{show = ''}; $("#" + tabListID ).append(`<li class="nav-item"><a onclick = '${tabOnClick}' class="nav-li...
[ "function OperNavTabs(num) { \n var li = document.createElement('li');\n var a = document.createElement('a');\n a.setAttribute(\"id\", \"opertab\"+num); \n a.setAttribute(\"data-toggle\", \"tab\");\n a.setAttribute(\"href\", \"#oper\"+num); \n a.innerHTML = \"<strong>\"+\"Operator \"+num+\"</strong>\"; \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a destination: Database, Table, columns, and mapped class
function LoaderJobDestination() { this.database = null; this.table = ""; this.columnDefinitions = []; this.rowConstructor = null; }
[ "function Destination(city, food, landmark) {\n this.city = city;\n this.food = food;\n this.landmark = landmark;\n}", "addMapping(aArgs){const generated=util$1.getArg(aArgs,\"generated\");const original=util$1.getArg(aArgs,\"original\",null);let source=util$1.getArg(aArgs,\"source\",null);let name=util$1.getA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluator for CKEDITOR.dom.element::checkBoundaryOfElement, reject any text node and nonempty elements unless it's being bookmark text.
function elementBoundaryEval(node) { // Reject any text node unless it's being bookmark // OR it's spaces. (#3883) //如果不是文本节点并且是空的,可以继续取下一个判断边界 var c1 = node[0].nodeType != KEN.NODE_TEXT && node._4e_name() in dtd.$removeEmpty, //文本为空,可以继续取下一个判断边界 c2 = ...
[ "function elementBoundaryEval( node )\n\t{\n\t\t// Reject any text node unless it's being bookmark\n\t\t// OR it's spaces. (#3883)\n\t\treturn node.type != CKEDITOR.NODE_TEXT\n\t\t\t && node.getName() in CKEDITOR.dtd.$removeEmpty\n\t\t\t || !CKEDITOR.tools.trim( node.getText() )\n\t\t\t || !!node.getParent...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get subuser list Success
getSubUserListSuccess(state, res) { store.state.status = { got: true }; if (res.data == undefined) { state.subuser_list = []; } else { state.subuser_list = res.data.items; } if (state.subuser_list.length == 0) store.state.notification_text = 'No regist...
[ "function handler_populate_sub_user(){\n\tif(xmlHttp.readyState == 4 && xmlHttp.status == 200){\n\t\tpopulate_list_from_xml(xmlHttp.responseText, 'user_list');\n\t}\n}", "async indexbyuser({ auth, request, response, view }) {\n const { id } = auth.user\n const userp = await User.find(id)\n if (userp.perm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get announcement from annoucements sheet
function get_announcement($http, api_obj) { return load_sheet($http, api_obj, "announcements") .then((res) => { return Promise.resolve(res.data.values) }) }
[ "function retrieveAnnouncement(doc_id){\n var announcement = DocumentApp.openById(doc_id).getBody().getText();\n return announcement\n}", "function getAnnouncements() {\n var currentdate = new Date();\n var day = currentdate.getDate().toString();\n var month = (currentdate.getMonth() + 1).toString();\n mont...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function findCraftAstronauts(craftName, people) determine who of people is on the current craft. As a filter critria uses craftName.
function findCraftAstronauts(craftName, people){ let result = []; result = people.filter(function(astr){ return astr.craft.toLowerCase() == craftName.toLowerCase(); }) return result = result.map(function(astr){ return astr.name; }); }
[ "function searchByEyeColor(people){\n\n let eyeColorSearch = promptFor(\"What eye colored person list you searching for?\", autoValid);\n let foundPeople = people.filter(function(potentialMatch){\n if(potentialMatch.eyeColor == eyeColorSearch){\n return true;\n }\n else{\n return false;\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method to validate occupation
function validateOccupation(occupation) { return /^[a-zA-Z\s]+$/.test(occupation); }
[ "function checkOccupation()\n{\n indicator1.occupation = validate(document.getElementById(\"occupation\"), regOccupation, warningOccupation);\n clearErrorInSection1();\n}", "function validateOccupation(occupation, occupationOther) {\n //var occ= document.getElementById(occupation);\n if (occupation.valu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a settings button.
addSettingsButton(settingsPanel) { settingsPanel.onOpen = () => this.screenNode.classList.add(gShowingOtherPanelCssClass); settingsPanel.onClose = () => this.screenNode.classList.remove(gShowingOtherPanelCssClass); let iconSvg; switch (settingsPanel.panelType) { case Settings...
[ "addSettingsButton(settingsPanel) {\n settingsPanel.onOpen = () => this.screenNode.classList.add(gShowingOtherPanelCssClass);\n settingsPanel.onClose = () => this.screenNode.classList.remove(gShowingOtherPanelCssClass);\n let iconSvg;\n switch (settingsPanel.panelType) {\n cas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compares the addons that are currently installed to those that were known to be installed when the application last ran and applies any changes found to the database. Also sends "startupcacheinvalidate" signal to observerservice if it detects that data may have changed. Always called after XPIProviderUtils.js and exten...
processFileChanges(aManifests, aUpdateCompatibility, aOldAppVersion, aOldPlatformVersion) { let loadedManifest = (aInstallLocation, aId) => { if (!(aInstallLocation.name in aManifests)) return null; if (!(aId in aManifests[aInstallLocation.name])) return null; return aManifests[aIn...
[ "function setupAppcache(){\n\n\t\t if (window.applicationCache){\n\n\t\t \t_app.publish('device-has-appcache');\n\n\t\t window.applicationCache.addEventListener('updateready', cacheReady);\n\t\t }\n\t\t \n\t\t // new cache ready\n\t\t function cacheReady(){\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use the outer window ID as the identifier of the sandbox.
get id() { return this._frame.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindowUtils).outerWindowID; }
[ "function getWindowId(aWindow) {\n try {\n // Normally we can retrieve the id via window utils\n return aWindow.windowUtils.outerWindowID;\n } catch (e) {\n // ... but for observer notifications we need another interface\n return aWindow.QueryInterface(Ci.nsISupportsPRUint64).data;\n }\n}", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add Expense method w/object
addExpense(expense) {}
[ "function Expense(id,desc,value) {\n this.id = id;\n this.desc = desc;\n this.value = value;\n }", "function Expense(type, amount) {\n // type variable will contain \"Groceries\"\n // amount variable will contain 9.99\n\n this.type = type;\n\n this.amount = amount;\n\n this.id = idcou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the KDA variance of all champions
function kdaVariance() { var stats = {}; var s = SpreadsheetApp.getActiveSpreadsheet(); var sheet = s.getSheetByName('Data'); var roles = ['Top', 'Jungle', 'Mid', 'ADC', 'Support']; var teams = ['My ', 'Their ']; for(var i = 2; i < getFirstEmptyRow(); i++) { for(var j = 0; j < teams.length; j++) { ...
[ "variance () {\n return this.sumOfSquares() / this.data.length\n }", "function HACvar(K1) {\n\tif (K1.length === 0) return null;\n\tn=K1.length;\n\tvar out=0;\n\tvar B=Math.floor(Math.pow(n,(1/4)));\n\tvar R=[];\n\tvar w=[];\n\t\n\t//empty matrices\n\tfor(var i=0; i<B; i++) {\n\t\tR[i] = 0;\n\t\tw[i] = 0;\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new regression manually URL.
function get_manual_regression_url(db, ts, url, runID) { "use strict"; return [lnt_url_base, "db_" + db, "v4", ts, "regressions/new_from_graph", url, runID].join('/'); }
[ "function get_regression_url(db, ts, regression) {\n \"use strict\";\n return [lnt_url_base, \"db_\" + db, \"v4\", ts, \"regressions\", regression].join('/');\n}", "function _createURL() {\n return createURL(state.toggleRefinement(attributeName, isRefined));\n }", "function _createURL() {\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extraction of all titles within the page.
function extractAllTitles() { insertHeader() rawArticle += setTitleSectionSeparator('TITLES') Array.from(document.querySelectorAll('h1,h2,h3,h4,h5,h6')) .map(x => titleToSymbol(x.tagName, x.innerText, '----')) .filter(x => x.text.length > 0) .forEach(x => rawArticle += ...
[ "function getTitles() {\n var a_tags = document.querySelectorAll('.resultitem > div > a');\n return Array.prototype.map.call(a_tags, function (elem) {\n return elem.innerHTML;\n });\n}", "function obtainH1Titles() {\n const htmlTitles = document.getElementsByTagName(\"h1\");\n const titles = [...htmlTitle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
``` NameStart :: Letter `_` ```
function isNameStart(code) { return isLetter(code) || code === 0x005f; }
[ "function isNameStart(code) {\n\t return isLetter(code) || isNonAscii(code) || code === 0x005F;\n\t}", "function isNameStart(code) {\n return isLetter(code) || isNonAscii(code) || code === 0x005F;\n}", "function startLetter(name) {\n\t\tvar startLtr;\n\t\tvar length=name.length;\n\t\tstartLtr = name.charA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the sorted indices of this array, when sorting by the given function
static argSort(arr, compareFn, thisArg) { const indices = ArrayUtils.indexRange(arr.length); return indices.sort((a, b) => { return compareFn.call(thisArg, arr[a], arr[b]); }); }
[ "function sortAccordingTo(x, f) {\n\tlet index = [...Array(f.length).keys()]\n\tindex.sort((a, b) => f[a] - f[b])\n\tconst out = new Array(x.length)\n\tfor(let i = 0; i < x.length; i++)\n\t\tout[i] = x[index[i]]\n\treturn out\n}", "function arrayOrderByNum(keyFunc) {\n //var startTime = new Date().getTime(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inits view as ngtable
function initNgTableStructure() { vm.tableParams = new ngTableParams({ page: 1, // show first page count: 10, // count per page sorting: { name: 'asc' // initial sorting } }, { ...
[ "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" ] ] } }
to perform within a given time frame, given a set of activities each marked by a start time (si) and finish time (fi). The problem is to select the maximum number of activities that can be performed by a single person or machine, assuming that a person can only work on a single activity at a time. You are given n activ...
function printMaxActivities( start, finish ){ // The first activity is always selected var i = 0, result = [i]; // Consider rest of the activities for(var j = 1; j<finish.length; j++ ){ // If this activity has start time greater than or equal to // the finish time of previously s...
[ "function gIAS(arr) {\n // Sorts in increasing order of finish times the array of activities arr by using the finish \n // times stored in the array f.\n mergeSort(arr);\n // Creates a set sched to store the selected activities,\n // and initialises it with the activity arr[0] that has the earliest finish time...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Publishes list of all questions in the quiz_data variable
function publish_question_list(quiz_data) { $(".question_list").empty(); $.each(quiz_data, function(i, question) { $(".question_list").append("<div class = 'question_list_item' question_id = '"+i+"'>"+question.concept+"</div>"); }); /*Show first question by default*/ $(".question_list_item...
[ "function publish_all_quizzes() {\n\t$(\".quiz_list\").append(\"<div class = 'quiz_title'>Quizzes</div>\")\n\n\t/*Publish all questions*/\n\tvar num_quizzes = data.quizzes.length;\n\tfor(var i = 0, quiz_number = 0; i < num_quizzes; i++)\n\t\t//Display only published quizzes\n\t\tif(data.quizzes[i].isPublished) {\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the segment map based upon the given active timestep
function setActiveTimestep( j ) { activeTimestep = j; if ( json == null ) return; // incase we've not received data yet var sections = json.sections; // Next, foreach el, find the corresponding segment and update the stroke // FIXME: THIS IS A HACK ATTACK! d3.select(conta...
[ "function updateSegmentonTimeChange() {\n // if (updateSegments) {\n updateAnnotationOnChange = true;\n var starting =\n parseInt($('#annotation-start-minute').val() * 60) +\n parseInt($('#annotation-start-seconds').val()) +\n '.' +\n $('#annotation-start-milliseconds').val();\n var ending =\n pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get markup for a placeable instance.
function getPlaceableMarkup(title, replacement) { return ( '<mark class="placeable" title="' + title + '">' + replacement + '</mark>' ); }
[ "get markup() {}", "function generateHTMLDestiny(place) {\n return `<dt class=\"u-place-title sections-place-title-${place.id}\">${place.destiny}<i class=\"fas fa-caret-down\"></i></dt>\n <dd class=\"u-place-image sections-place-image--${place.id} u-place-close\">\n <p class=\"u-place-info sections-p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to find the price for javascript
function price(a){ // to print the price for javascript console.log(library[0].price); }
[ "function get_price() {\n var price_div = document.getElementById(\"priceblock_dealprice\")\n if (price_div == null) {\n var price_div = document.getElementById(\"priceblock_ourprice\")\n }\n var price_text = price_div.innerText;\n var price = Number(price_text.replace(/[^0-9.-]+/g,\"\"));\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when the full torrent metadata is received.
_onMetadata (metadata) { if (this.metadata || this.destroyed) return this._debug('got metadata') this._xsRequests.forEach(req => { req.abort() }) this._xsRequests = [] let parsedTorrent if (metadata && metadata.infoHash) { // `metadata` is a parsed torrent (from parse-torrent m...
[ "_onMetadata (metadata) {\n if (this.metadata || this.destroyed) return\n this._debug('got metadata')\n\n this._xsRequests.forEach(req => {\n req.abort()\n })\n this._xsRequests = []\n\n let parsedTorrent\n if (metadata && metadata.infoHash) {\n // `metadata` is a parsed torrent (from...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets up the MoveMesh
function MakeMoveMesh () { var MoveMesh = new Mesh(); MoveMesh.vertices = GVertices; MoveMesh.triangles = GTriangles; MoveMesh.uv = UV; MoveMeshObj.GetComponent(MeshFilter).mesh = MoveMesh; MoveMeshObj.GetComponent(MeshCollider).mesh = MoveMesh; }
[ "updateMeshPosition() {\n this.mesh.position.set( this.x + 0.5, 0.5, this.z + 0.5 );\n }", "setMesh() {\n\n this.addSphere();\n }", "setMesh() {\n\n this.addSphere();\n \n }", "addTo(scene) {\n scene.add(this.mesh);\n }", "createMesh() {\n this.geometry.updateAttrib...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert a moment string to a month display
static dateStringToDisplayMonth(dateFormat, value) { let monthIndex = dateFormat.indexOf('MM'); if (monthIndex === 5) { value = value.replaceAll("-", dateFormat[4]); } if (value.length > 7) { // Cut off any text beyond "yyyy/mm" value = value.substring(0, 7); } return value; ...
[ "function parseMonth(num) {\n switch (num) {\n case 1:\n return \"January\";\n case 2:\n return \"February\";\n case 3:\n return \"March\";\n case 4:\n return \"April\";\n case 5:\n return \"May\";\n case 6:\n return \"June\";\n case 7:\n return \"July\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if not, we'll fall back on jquery.cycle
function use_cycle() { $('#photoset_slides').cycle({ speed: 100, pause: 1, nowrap: 1, timeout: 0, startingSlide: idx, slideResize: 0, fx: 'scrollHorz', activePagerClass: 'current', pr...
[ "function initCycleCarousel() {\n\tjQuery('div.cycle-gallery').scrollAbsoluteGallery({\n\t\tmask: 'div.mask',\n\t\tslider: 'div.slideset',\n\t\tslides: 'div.slide',\n\t\tbtnPrev: 'a.btn-prev',\n\t\tbtnNext: 'a.btn-next',\n\t\tpagerLinks: '.pagination li',\n\t\tstretchSlideToMask: true,\n\t\tpauseOnHover: true,\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Functions for drawing Charts pol_red : array for pollutant reduction pareto optimal data cost : array for cost pareto optimal data single_simu_red : pollutant reduction single simulation single_simu_cost : cost single simulation user_cost : the cost entered by user for the BMP. This will be used to scale the unit cost ...
function drawChart(pol_red,cost,single_simu_red,single_simu_cost,user_cost,nutrientType,single_simu_bmp,supplementaryData){ //var cost = new Array(); //array for costs //var pol_red = new Array(); //array for pollutant reduction var hru_ids = new Array(); //array for hru_ids for a corresponding cost/pol_red valu...
[ "function drawGraph(successArr, costArr) {\r\n var successes = successArr.slice(Math.max(0, successArr.length-100), successArr.length);\r\n var costs = costArr.slice(Math.max(0, costArr.length-100), costArr.length);\r\n var width = canvasRes.width;\r\n var height = canvasRes.height;\r\n ctxRes.clearR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
games list to html parser
function gamesListToHTML(list) { let htmlString = "<table><tr id=\"titletr\"><td>Game</td><td>playerOne</td><td>playerTwo</td></tr>"; for (let i=0;i<list.length;i++) htmlString += "<tr><td>" + list[i].gameName + "</td><td>" + list[i].playerOne +"</td><td>" + list[i].playerTwo + "</td></tr>"; htmlString += "</tabl...
[ "function getAllGamesHtml(games) {\n return games.map(getGameHtml).join(\"\");\n }", "function generateHTML() {\n html = \"\"\n for(var key in games) {\n html += \"<h2>\" + key + \"</h2>\";\n for(var i in games[key]) {\n card = games[key][i];\n html += get_card(card['name'], card['icon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function converts array of column letters to column numbers. Ex: [A,B,C] > [1,2,3] If passedin 'cols' is only one letter, return one number (not in array form) returns col NUMBER not INDEX
function getColNumbersFromLetters(cols) { var objFlag = true; // set flag stating passed-in variable is not an array if (typeof(cols) !== 'object') { objFlag = false; cols = [cols]; } var colNums = []; for (var i = 0; i < cols.length; i++) { var letter = cols[i].toUpperCase(); if...
[ "static getColNumbers(m, c) {\n let colNums = [];\n for (let r = 0; r < m.length; r++) {\n colNums.push(m[r][c]);\n }\n return colNums;\n }", "function intToCol(i){\n switch (i) {\n case 0:\n return 'a';\n case 1:\n return 'b';\n case 2:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call the saveCallback or the closeCallback methods on the config dialog if present. If they call done(), save the edited element back to the tree. Emit ELEMENT_UPDATE.
handleSave () { const done = () => { const originalNode = this.originalNode this.$store.commit('config/updateNode', {editedNode: this.element}) bus.$emit(ELEMENT_UPDATE, originalNode) } if (typeof this.$refs.config.saveCallback === 'function') { this.$refs.config.saveCa...
[ "function setSaveDialogEventsForScriptEdit() {\n editDialog\n .onClickCancel()\n .onClickOK(function () {\n window.open('', 'editor');\n deleteDirectorys(function () {\n writeTreeJsonSocket.emit(projectDirectory, rootTree, function () {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Help on commands for room master only.
function getHelpMaster() { var help = "\ <br/>#b (#public, set room as public) \ <br/>#k {user} (#kick, kick a user out of current room) \ <br/>#m {user} (#master, assign another room user as master) \ <br/>#s {size} (#size, set room max size, 0 means no limit) \ <br/>#v (#private, set room as private) \ "...
[ "function cmdHelp(message, args)\n{\n var output = 'Command/Alias list:';\n for (cmd of Object.keys(commands))\n output += \"\\n\" + cmd;\n message.channel.send(output);\n}", "function helpCommand(){\n disMessage(\"<p> Hywie Martins Bash, Version 0.1.0 </P>\", true);\n disMessage(\"<p> These...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if there are no combatants Do not render the list
render() { const {CombatantList = []} = this.props if (!CombatantList) { return <div>Select a CombatantList to get started</div>; } // if there are combatants in Combatant list then render the list return <ul className="list-group">{this.renderList()}</ul>; }
[ "renderEmpty() {\n\t\treturn (\n\t\t <li className=\"list-group-item\">\n\t\t <h3>\n\t\t <span>\n\t\t <em>No saved venues yet, save your first venue from search results...</em>\n\t\t </span>\n\t\t </h3>\n\t\t </li>\n\t\t);\n\t}", "function emptyAbilities() {\n $('#abilities').fadeOut()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when a request is selected from the dropdown, loads it into the request builder
function selectRequest(selectedRequest, selectedRequestName) { $( '#requestName' ).val(selectedRequestName); var data = { request: selectedRequest, request_type: 'existing', } $.post('/selectrequestform', data, buildRequest, 'html'); }
[ "function runSelectedApiRequest() {\n var curElement = document.getElementById('api-selection-options');\n var apiRequestName = curElement.options[curElement.selectedIndex].value;\n updateApiResultEntry(apiRequestName);\n}", "function loadDistributorProduct(){\n\n // Create request object\n var data = ne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the given object is an instance of Deployment. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Deployment.__pulumiType; }
[ "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === DeploymentConfig.__pulumiType;\n }", "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Serialize a DOM element.
function serializeElement (node, context, eventTarget) { var c, i, l; var name = node.nodeName.toLowerCase(); // opening tag var r = '<' + name; // attributes for (i = 0, c = node.attributes, l = c.length; i < l; i++) { r += ' ' + exports.serializeAttribute(c[i]); } r += '>'; // child nodes ...
[ "function serializeElement(node, context, eventTarget) {\n var c, i, l;\n var name = node.nodeName.toLowerCase();\n\n // opening tag\n var r = '<' + name;\n\n // attributes\n for (i = 0, c = node.attributes, l = c.length; i < l; i++) {\n r += ' ' + exports.serializeAttribute(c[i]);\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new V1RunSchema.
constructor() { V1RunSchema.initialize(this); }
[ "constructor() { \n \n V1RunSchema.initialize(this);\n }", "constructor() {\n\n V1Run.initialize(this);\n }", "constructor() {\n\n V1Schemas.initialize(this);\n }", "constructor() { \n \n V1Schemas.initialize(this);\n }", "constructor() { \n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks the validity of mnemonic words entered in the form
function check_mnemonics() { const form = document.getElementById('form_mnemonic'); const mnemonics = form.mnemonics.value.split(' '); if (!(12 <= mnemonics.length <= 24)) { return false; } mnemonics.forEach( (mnemonic) => { mnemonic = mnemonic.toLowerCase(); if (!mnemonic.m...
[ "function valid_mnemonic(mnemonic){\n var r = true;\n if (mnemonic.split(\" \").length != 12){\n console.log(mnemonic, \"is invalid\");\n return false;\n }\n for (var i = 0; i < mnemonic.split(\" \").length; i++) {\n if (!bip39arr.includes(mnemonic.split(\" \")[i])) {\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
format all currencies in the information as a readable string and return it
function FormatCurrencies(information) { var result = "<p> Currencies: "; for (var i = 0; i < information.currencies.length; i++) { result += information.currencies[i].name + " (" + information.currencies[i].symbol + ")"; if (i + 1 < information.currencies.length) result += ", "...
[ "toString() {\n if (this.isContractual) {\n return '';\n }\n\n if (this.fixedRate) {\n return `${this.fixedRate}${this.currency}`;\n }\n\n return `${this.minRate}-${this.maxRate}${this.currency}`;\n }", "function getAllCurrencies(currencies) {\r\n console.log(currencies)\r\n let cu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FIXME, Using the real data to calculate cell size
getCellSize(pos) { return { width: this.options.cellWidth, height: this.options.cellHeight, }; }
[ "function calcCellSize() {\n return 100 / gridSize;\n}", "getCellSize() {\n return this.$cellSize;\n }", "function setCellDimensions() {\n var width = 0, height = 0;\n for (var w = 0; w < canvas.width; w += blockSize) {\n width++;\n }\n for (var h = 0; h < canvas.height; h += blockSi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for submitting income
function newIncomeSubmit() { var newIncome = { description: document.getElementById("incdesc").value, value: document.getElementById("incam").value, date: document.getElementById("incdate").value }; var xmlhttp = new XMLHttpRequest(); var url = "http://" + baseUrl + "/api/createincome"; xmlhttp.o...
[ "function budgetFromSubmit() {\r\n let budgetValue = budgetInput.val();\r\n if (budgetValue === '' || budgetValue <= 0) {\r\n\r\n setTimeout(function () {\r\n budgetFeedback.slideToggle('slow', function () {\r\n budgetFeedback.addClass('showItem');\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
= XMPP Bot =
function XMPPBot(jid, password, room_jid) { EmptyBot.call(this); var self = this; this.room_jid = room_jid; var room_nick = new xmpp.JID(jid).local; this.xmppbot = new xmpp.Client({ jid: jid, password: password }); this.xmppbot.on('error', function (err) { consol...
[ "function XMPPUtil() {\n\n\tthis.builder = function(type,stanzaVars) {\n\t\tconsole.log(\"builder>> \" + type);\n\t\tswitch (type)\n\t\t{\n\t\t\tcase \"open_stream\":\n\t\t\t\treturn '<?xml version=\"1.0\"?>\\n\\n<stream:stream xmlns:stream=\"'+stanzaVars['stream']+'\" version=\"1.0\" xmlns=\"jabber:client\" to=\"'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function 0. method returns the left,top positions of image which is clicked to popup the calendar
function findControlPos(imgId) { var Controlobj=document.getElementById(imgId); var curleftPos = 0; var curtopPos = 0; if (Controlobj.offsetParent) { do { cur...
[ "function setPositionOfOpeningCalenderControl() {\r\n\r\n jQuery(\".i_calendar\").click(function (e) {\r\n\r\n //alert('tesssting');\r\n //var offset = $(this).offset();\r\n //alert('e.clientX='+e.clientX);\r\n //alert('e.clientY='+e.clientY);\r\n //alert('offset.left='+offset....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds a random tile in the terrain folder
function findTile(){ var oneTile = parseInt(Math.random() * 14); console.log(oneTile); return oneTile; }
[ "function getRandomTile() {\n return Math.floor(Math.random() * tilecolors.length);\n }", "function getRandomTile() {\n return Math.floor(Math.random() * tilecolors.length);\n }", "function pickRandomTile() {\n\tvar tiles = getBlankTiles();\n\tchooseTile(tiles[Math.floor(Math...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load the share id into the selectedShare state
selectedShareRow({ commit }, shareId) { commit("SET_SELECTED_SHARE", shareId); }
[ "function loadShareDialog() {\r\n\tvar fileId = realtimeUtils.getParam('id');\r\n\r\n\tinit = function() {\r\n s = new gapi.drive.share.ShareClient();\r\n s.setOAuthToken(access_token);\r\n \ts.setItemIds([fileId]);\r\n }\r\n\r\n\tgapi.load('drive-share', init);\r\n}", "get shareId() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Factory method to create a gym plan object
static createInstance(owner, planNumber, issueDateTime, activeDateTime, expiryDateTime, subscriberCount, totalAwards, trainerSessions, numClasses, gymAccess, poolAccess) { return new GymPlan({owner, planNumber, issueDateTime, activeDateTime, expiryDateTime, subscriberCount, totalAwards, trainerSessions, numClas...
[ "static createInstance(owner, planNumber, planSubscriber, planMember, trainerSessions, numClasses, gymAccess, poolAccess) {\n return new GymPlanUsage({owner, planNumber, planSubscriber, planMember, trainerSessions, numClasses, gymAccess, poolAccess});\n }", "function CommissionPlanFactory() {\n\n /**...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
console.log(findSubmission(submissions, "Joe")) Declare a function named findLowestScore Parameter(s): array Functionality: return the object in the array that has the lowest score. Use the forEach method to loop through the whole array.
function findLowestScore(array) { let lowest = array[0]; array.forEach(submission => { if (lowest.score > submission.score) { lowest = submission } }) return lowest }
[ "function findLowestScore(array) {\n let lowest = null;\n\n array.forEach(function (submission) {\n\n if (lowest === null || lowest.score > submission.score) {\n lowest = submission; \n }\n });\n return lowest;\n }", "function findLowestScore(array) {\r\n let lowestScore ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Throws given message unless given actual value equals to the given expected value after both values are converted to big numbers.
function assertBNEquals (message, expected, actual) { assert ( message + " (expected: " + expected + ", actual: " + actual + ")", web3.toBigNumber(expected).eq (web3.toBigNumber (actual))); }
[ "function less_or_equal(message, actual, expected) {\n\tif(actual > expected) {\n throw new Error('Failed assertion: ' + message + '. ' + actual + ' should be <= ' + expected);\n //throw Exception(message);\n }\n}", "function assertAlmostEqual(actual, expected, accuracy = 100000) {\n const exp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
is show side arrow
isShowSideArrow(){ let len = this.getFileLength(); return len > 1 ? '' : 'hide'; }
[ "function check_arrows() {\n // if it's up is the pipeline_root the up arrow should be hidden.\n if ( this.node.up.id == 'pipeline_root' ) {\n getObject(this.id + '_arrow_up').style.display = 'none';\n getObject(this.id + '_arrow_up_disabled').style.display = 'inline';\n } else {\n get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Declare function "calcEmbedSpace" to calculate how much whitespace is needed depending on the calculated length and command name length.
function calcEmbedSpace(calculatedLength, commandNameLength) { //Return whitespace depending on the length of our longest command name subtracted by the length of the given command name. return " ".repeat(calculatedLength - commandNameLength); }
[ "measure(){\n\t\t// this.rectWidth = textWidth(this.word);\n\t}", "calcExtraPx() {\n this.setExtraLeftPx(\n this.displaced && this.stem_direction === Stem.DOWN\n ? this.getGlyphWidth()\n : 0\n );\n\n // For upstems with flags, the extra space is unnecessary, since it's taken\n // up...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Using the given docNumber and all the parameters inserted in the dialog, read the journal and take all the data, and at the end creates the report
function createReport(report, docNumber) { addFooter(report); //Table Journal var journal = Banana.document.journal(Banana.document.ORIGINTYPE_CURRENT, Banana.document.ACCOUNTTYPE_NORMAL); var totDebit = ""; var totCredit = ""; var date = ""; var description = ""; var vouchernumber...
[ "function setDocumentDetails() {\n //self.singleDoc.currentlyusedby = self.singleDoc.currentlyusedby.trim();\n //self.singleDoc.document_ext = angular.lowercase(self.singleDoc.document_ext);\n var doc_ext = getFileExtention(self.singleDoc);\n doc_ext = angular.lowercase(d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find all actions by investigating action inputoutput dependencies
_getAllActions (file) { let visited = {} let queue = [file] let actions = [] while (queue.length > 0) { const next = queue.shift() const nextActions = this._actionsByInput[next] for (let id in nextActions) { if (!nextActions.hasOwnProperty(id)) continue if (visited[id])...
[ "mapActions() {\n const key = Object.keys(this.sdfObject.sdfObject)[0];\n for (let property in this.__getRootObject().sdfAction) {\n const sdfAction = this.__getSDFObjectAction(key, property);\n let thingModelAction = this.__generateThingAction(property);\n for (let inputObjectKey in sdfAction....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the given barycentric coordinates are within their triangle.
barycentricInsideTriangle(bary) { const v = bary[1]; const u = bary[2]; return (u >= 0) && (v >= 0) && (u + v < 1); }
[ "function inTriangle(q, [p1, p2, p3]){\n // compute unclipped barycentric coordinates\n const [l1, l2, l3] = barycentricCoordinates(q, [p1, p2, p3], false);\n // inside if all coordinates are positive\n return l1 >= 0 && l2 >= 0 && l3 >= 0;\n}", "function inTriangle (x, y, x1, y1, x2, y2, x3, y3)\n{\n //ch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DestroyRenderNode Hook Called when destroying a render node
function destroyRenderNode(morph) {}
[ "onDOMNodeRemoved() {\n this.destroy();\n }", "destroy() {\n this.listen(false);\n this.parent.children.splice(this.parent.children.indexOf(this), 1);\n this.parent.controllers.splice(this.parent.controllers.indexOf(this), 1);\n this.parent.$children.removeChild(this.domElement);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates sortOrder to user input whenever there is a change to the value in the drop down menu
function handleSortOrder(e) { setSortOrder(+e.target.value) }
[ "function orderChanged(value) {\n\t\t\t\tvar item = _.find(vm.sortOptions, function (option) {\n\t\t\t\t\treturn option.value === value;\n\t\t\t\t});\n\n\t\t\t\tif (util.isUndefined(item)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvm.selectedFilters.sortOption = item;\n\t\t\t}", "_onSortOrderChange(e) {\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the disponibility checked categories
function getCatDisponibility() { var categories = ""; var listValues = getCategoryValues(["catDispoSuccursale", "catDispoEnLigne"]); if (listValues != "") categories = "(@tpdisponibilite==(" + listValues + "))"; return categories; }
[ "function getCategories() {\n \tvar categories = '';\n \tif($(\"#SL\").prop('checked')) {\n \t\tcategories += $(\"#SL\").val()+\"|\";\n \t}\n \tif($(\"#WC\").prop(\"checked\")) {\n \t\tcategories += $(\"#WC\").val()+\"|\";; \t \n \t}\n \tif($(\"#SI\").prop(\"checked\")) {\n \t\tcate...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funcion que se utiliza para obtener en que turno lectivo nos encontramos en funcion de la hora actual
_obtenerTurno(turno) { let fechaYhora = new Date(); let horas = fechaYhora.getHours() ; if ((horas >= 8) && (horas <= 10)) { turno = 1; } else if ((horas > 10) && (horas <= 12)) { turno = 2; } else if ((horas > 12) && (horas <= 14)) { turno = 3; ...
[ "_obtenerTurno(turno) {\t\n let fechaYhora = new Date();\n let horas = fechaYhora.getHours() ;\n \n\tif ((horas >= 8) && (horas <= 10)) {\n turno = 1;\n }\n else if ((horas > 10) && (horas <= 12)) {\n turno = 2;\n\t\t}\n else if ((horas > 12) && (horas <= 14)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functionLength(f) Returns the arity of function `f`.
function functionLength(f) { return f._length || f.length; }
[ "function functionLength(f) {\n return f._length || f.length;\n}", "function countArguments(func) {\n console.log(func.length);\n}", "function checkParamsCount(name, func, length) {\n\tisFunc(name, func);\n\tisNum('length', length);\n\n\tif (func.length === length) {\n\t\treturn func.length;\n\t} else {\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies settings regardless of webchat's API styling
function applySetting() { let fontSize = new CookieUtil().get("webchatFontSize"); if (fontSize) { $("#webchat > * ").css("font-size", parseInt(fontSize)); } }
[ "getChatSettings() { \n\n\t\treturn this.apiClient.callApi(\n\t\t\t'/api/v2/chat/settings', \n\t\t\t'GET', \n\t\t\t{ },\n\t\t\t{ },\n\t\t\t{ },\n\t\t\t{ },\n\t\t\tnull, \n\t\t\t['PureCloud OAuth'], \n\t\t\t['application/json'],\n\t\t\t['application/json']\n\t\t);\n\t}", "getWebchatSettings() { \n\n\t\treturn ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads the cached database
async loadDatabase() { this.__db = (await qx.tool.utils.Json.loadJsonAsync(this.__dbFilename)) || {}; }
[ "function loadDatabase() {\r\n db.loadDatabase({}, function () {\r\n databaseInitialize();\r\n });\r\n}", "async load () {\n if (!this.db) {\n await this._initDB(this.opt.dbName, this.opt.storeName).then((db) => {\n this.db = db\n }).catch((e) => {\n console.log('error init...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the sample name input form.
function set_sample_name_input(proj) { // First, set the header to say how many samples were detected. var n_samples = Object.keys(proj.samples).length; var header = $('#sample_names_header'); header.text(header.text().replace('num', n_samples)); // Set sorted names. set_sorted_names(); // Then, set th...
[ "function inputName(){\n\t\t\tuserdata.nameInput =getName.value;\n\t\t}", "set name(name) {\n this.setRequiredChildProperty(this.inputSlot, 'name', name);\n }", "TestSetName(name_input) {\n // set a default value to the name input\n name_input.value = \"test\";\n // invoke the eve...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find specified Type's color from list of Types.
function findColorFromTypeId(typeData, typeId) { for (let i = 0; i < typeData.length; i++) { if (typeData[i].id === typeId) { return typeData[i].color; } } }
[ "function getTypeRandomColor(type) {\n for (let [key, value] of types_colors.entries()) {\n if (type === value.type) {\n return value.color;\n }\n ;\n }\n}", "function find (type, text) {\n\n // Default color.\n let color = defaultColor\n\n const labelList = __WEBPAC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For each bot with the specified visualization, execute: fn(viz, bot) where: viz == board.visualize.step.bot[bot.id][visualizeKey]
function visualizeBot(board, visualizeKey, fn) { getViz(board, visualizeKey) .forEach(function(v) { fn(v.viz, v.bot) }) }
[ "function transitionBot(board, visualizeKey, fn) {\n visualizeBot(board, visualizeKey, function(viz, bot) {\n var transition = d3.select(\"#\" + botId(bot)).transition()\n fn(transition, viz, bot)\n })\n}", "forEach(fn) {\n algorithm_1.each(this._tracker.widgets, widget => {\n fn(widget)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load movie ratings saved in localStorage to this.state.myRatings
getRatingsFromLocalStorage() { const myRatings = Object.keys(localStorage).map(key => { return JSON.parse(localStorage.getItem(key)); }).sort(function (a, b) { return b.ratingDate - a.ratingDate; }); this.setState({ myRatings }); }
[ "function addRatingLS(rating) {\r\n localStorage.removeItem('movieRatings');\r\n\r\n localStorage.setItem('movieRatings', JSON.stringify(rating));\r\n\r\n averageRating();\r\n}", "async storeMoodRating() {\n\t\ttry {\n\t\t\tawait AsyncStorage.setItem('mood', JSON.stringify(this.state.rating));\n\t\t\tcon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PRIVATE Allocates the origin coordenates of the connection at the middle point of the origin port.
function allocateOrigin() { this.originX = this.originPort.x + 3 + this.originPort.ne.x; this.originY = this.originPort.y + 3 + this.originPort.ne.y; if (this.destinationX != null && this.destinationY != null) { this.allocate(); } }
[ "function allocateConnection() {\n\t\tif (document.getElementById(this.id) != null) {\n\t\t\tdocument.getElementById(MAP).removeChild(document.getElementById(this.id));\n\t\t}\n\t\tthis.points = this.originX + \",\" + this.originY + \" \";\n\t\tif (this.middlePoint == LEFT_CORNER) {\n\t\t\tvar x = Math.min(this.ori...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function will return the array of 'Bought' entries from Database
getBoughtItems() { return this.DB.bought; }
[ "function allItemsBought(buyerID) {\n return itemsBought[buyerID]\n}", "function allItemsBought(buyerID) {\n return itemsBought[buyerID];\n}", "function allItemsBought(buyerID) {\n return itemsBought[buyerID]; \n}", "function allItemsBought(buyerID) {\n if (!itemsBought[buyerID]) return [];\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check millions place [6] tens million[7]
function tensMillions(){ //check tens million if(dollarReverseArray[7] !== "0" && (typeof(dollarReverseArray[7]) !== "undefined")){ if(dollarReverseArray[7] == 1){ var tenMillionPlace = teenObject[dollarReverseArray[7]]; var tenMillionString = `${tenMillionPlace} million `; } else { if(d...
[ "function tensMillions(){\n //check tens million\n if(dollarReverseArray[7] !== \"0\" && (typeof(dollarReverseArray[7]) !== \"undefined\")){\n if(dollarReverseArray[7] == 1){\n var tenMillionPlace = teenObject[dollarReverseArray[7]];\n var tenMillionString = `${tenMillionPlace} million `;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the color of the game rating, given the game's rating
function getRatingColor(rating){ if (rating > 80){ return "limegreen"; } else if (rating > 60) { return "goldenrod"; } else { return "firebrick"; } }
[ "function get_rating_color(rating) {\n var $return = false;\n\n if (rating >= 2200) {\n // red\n $return = \"red\";\n } else if (rating >= 1500) {\n // yellow\n $return = \"yellow\";\n } else if (rating >= 1200) {\n // purple\n $return = \"purple\";\n } else if (rating >...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change page to howto.html
function goHowTo() { window.location.assign("howto.html") }
[ "function goHelp() {\n trjs.io.innerSave();\n // location.href = \"http://modyco.inist.fr/transcriberjs/doku.php?id=start\";\n fsio.openExternal(\"http://ct3.ortolang.fr/trjs/doku.php?id=doc:documentation\");\n // window.open(\"http://modyco.inist.fr/transcriberjs/\", '_blank');\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes color Nav Appear
function displayColors() { document.getElementById("colornav").style.display = "block"; document.getElementById("upgradenav").style.display = "none"; document.getElementById("main").style.display = "none"; }
[ "function setNav(){\n var i = 0;\n if (toChangeNavColor){ \n var currentViewTopEdgePosition = $(window).scrollTop();\n if (currentViewTopEdgePosition > 625){\n setNavAtContentColor();\n } else {\n for (var i=0; i<navLinkArray.length; i++){\n var lin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saves the drawing history and vertex/color data from the user's uploaded JSON file. Once saved, the drawing history is rendered to display the user's drawing.
function uploadDrawing() { let file = this.files[0]; // Gets the uploaded file if (file) { // If file exists let reader = new FileReader(); // Sets up event listener and executes event handler once readAsText is complete reader.addEventListener('load', () => { drawingHistor...
[ "function downloadDrawing() {\n // Create Float arrays whose sizes are the amounts of vertices and colors we have\n let vertices = new Float32Array(gl.currentCoordByteOffset / Float32Array.BYTES_PER_ELEMENT);\n let colors = new Float32Array(gl.currentColorByteOffset / Float32Array.BYTES_PER_ELEMENT);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=== Scene: id, name, description sequence of doors description in code as a class that inheirts from the Scene class knows when it's over it can allow for the next scene to start "when it is over" which may not necessarily be when all of it's doors have closed (i.e. maybe it will want to allow the next scene to start j...
function Scene() { this.sceneId = -1; this.sceneName = null; this.sceneDescr = ''; this.sceneTags = {}; this.resetPriorityValue = 0; // may be set to negative numbers to make less likely to be added to the queue this.incPriorityValue = 1; // used to increase the priority value of this scene by this amou...
[ "function SceneDirector() {\n this.verbs = [\n {\n verb: 'MOVE',\n alias: ['HEAD'],\n handler: move,\n actionStateComplete: moveComplete,\n requiresTargetBeforeAdverbs: false,\n adverbs: ['SLOWLY', 'QUICKLY'],\n prepositions: []\n },\n {\n ve...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add handles to the slider base.
function addHandles ( nrHandles, direction, base ) { var index, handles = []; // Append handles. for ( index = 0; index < nrHandles; index += 1 ) { // Keep a list of all added handles. handles.push( base.appendChild(addHandle( direction, index )) ); } return handles; }
[ "function addHandles ( nrHandles, direction, base ) {\r\n\r\n\t\t\tvar index, handles = [];\r\n\r\n\t\t\t// Append handles.\r\n\t\t\tfor ( index = 0; index < nrHandles; index += 1 ) {\r\n\r\n\t\t\t\t// Keep a list of all added handles.\r\n\t\t\t\thandles.push( base.appendChild(addHandle( direction, index )) );\r\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets largest blob in image if area takes up more than 0.1% of image.
function getLargestBlob(src) { let contours = new cv.MatVector(); let hierarchy = new cv.Mat(); cv.findContours(src, contours, hierarchy, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE, {x: 0, y: 0}); let maxsize = 0; let maxind = 0; for (let i = 0; i<contours.size(); i++) { let area = cv.contourArea(contours.ge...
[ "function findLargestImage(){\n // find all images on page\n var images = document.getElementsByTagName('img');\n if (images.length > 0) {\n var biggest_img = images[0];\n // for each image, do something\n for (img in images) {\n if(img.clientHeig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }