query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Removes a set of Bluemix credentials from the DB, and any references to them.
async function deleteBluemixCredentials(credentials) { // reset scratch keys that have a copy of the credentials in them await store.removeCredentialsFromScratchKeys(credentials); // delete references to classifiers that rely on the credentials await store.deleteClassifiersByCredentials(credentials); ...
[ "function deleteAuthCredentials() {\n setAuthCredentials(null)\n request.deleteAuthCredentials()\n saveRequest()\n }", "async removeAllCredentials() {\n await this.execute(\n new command.Command(command.Name.REMOVE_ALL_CREDENTIALS).setParameter(\n 'authenticatorId',\n this.authenti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert y to screen basis from gl basis
yToScreenBasis(y) { //return y + this.canvas.centre[1] return (y + this.canvas.centre[1]) / this.smallestScreenEdge() * this.params.sy }
[ "yFromScreenBasis(y) {\n return y / this.params.sy * this.smallestScreenEdge() - this.canvas.centre[1]\n }", "yToScreenBasis(y, z) {\n //return y + this.canvas.centre[1]\n return (y + this.canvas.centre[1]) / this.smallestScreenEdge() * z\n }", "yFromScreenBasis(y, z) {\n return y / z * this.small...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
i = index, height = height of Element, color = background color of element
function visElement(i, height, color){ setTimeout(() => { divs[i].style = "height:"+height+"%; background-color:"+color+"; width:"+width+"%;"; }, currentDelay); }
[ "color(i) {\n return this.native.color(i);\n }", "function displayColor(color)\n{\n\tfor(var i=0;i<squares.length;i++)\n\t{\n \t\tsquares[i].style.background=color;\n\t}\n}", "function getColorAt(i){\n return colors[i].toRGB();\n}", "function createColorElement({ index, color, listener } = {}) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
decode_digit(cp) returns the numeric value of a basic code point (for use in representing integers) in the range 0 to base1, or base if cp is does not represent a value.
function decode_digit(cp) { return cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 : cp - 97 < 26 ? cp - 97 : base; }
[ "function decode_digit(cp) {\n\t\treturn cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 : cp - 97 < 26 ? cp - 97 : base;\n\t}", "function decode_digit(cp) {\r\n return cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 : cp - 97 < 26 ? cp - 97 : base;\r\n }", "function parseDigits(cs, base, acc) /* (cs...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the Y component of the acceleration, as a floating point number.
function YAccelerometer_get_yValue() { if (this._cacheExpiration <= YAPI.GetTickCount()) { if (this.load(YAPI.defaultCacheValidity) != YAPI_SUCCESS) { return Y_YVALUE_INVALID; } } return this._yValue; }
[ "function getSpeedY() {\n\t\treturn this.speedY;\n\t}", "function YMagnetometer_get_yValue()\n {\n if (this._cacheExpiration <= YAPI.GetTickCount()) {\n if (this.load(YAPI.defaultCacheValidity) != YAPI_SUCCESS) {\n return Y_YVALUE_INVALID;\n }\n }\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loop creating password until userchoice is matched in value to password.length
function generatePassword() { password = ''; for ( i = 0; i < userchoice; i++) { //this will run until 'i' matches the length of userchoice Char = choices[(Math.floor(Math.random() * choices.length))]; password += Char; } }//end of generatePassword()
[ "function generatePassword(){\n var passwordLength = document.getElementById(\"passLength\").value;\n if (passwordLength<8 || passwordLength>128){\n document.getElementById('mainDisplay').innerText = \"Please input password length between 8 and 128\";\n } else {\n getSelectedItems()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function sets the background color of the entire spreadsheet to white
function clearColors() { var allRange = sheet.getRange('A:Z'); allRange.setBackground('#ffffff'); }
[ "function resetColor() {\n removeListeners();\n for(i=0; i < cells.length; i++) {\n cells[i].style.backgroundColor = \"white\";\n}}", "function ApplyTopRowColor() {\n currentSpreadsheet.getRange('1:1').activate();\n currentSpreadsheet.getActiveRangeList().setBackground(titleRowColor); \n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
in case user clicked no for navigation action where a dialog was presented to make sure user wants to leave the page
abortPageNavigate() { this.confirm_navigation_level = 2; history.back(); setTimeout(function() { this.confirm_navigation_level = 1; }, 300); }
[ "function onModalUnsavedOkayButtonClicked( modalInstance ) {\n modalInstance.close();\n isNavigationApprovedByUser = true;\n self.stopListening();\n $state.go( targetState );\n //isNavigationApprovedByUser = false;\n }", "function ExitPage() {\n\t\talert('Are you sure you w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to produce an XML tag.
function tag(name, attrs, selfclosing) { var result = '<' + name; if(attrs && attrs.length > 0) { var i = 0; var attrib; while ((attrib = attrs[i]) !== undefined) { result += ' ' + attrib[0] + '="' + this.esc(attrib[1]) + '"'; i++; } } if(selfclosing) { result += ' /'; } resu...
[ "function openTag(tag,attr,raw){var s='<'+tag,key,val;if(attr){for(key in attr){val=attr[key];if(val!=null){s+=' '+key+'=\"'+val+'\"';}}}if(raw)s+=' '+raw;return s+'>';}// generate string for closing xml tag", "function xml_tag(name, attrs, selfclosing) {\n var result = \"<\" + name;\n if (attrs && attrs.le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
filtering all the pets
function filterAllPets (){ filterType = ""; filterAgeMin = 0; filterAgeMax = Number.MAX_VALUE; loadTableWithFilters(); }
[ "getFilteredPets(props) {\n let settings = props ? props.settings : this.state.settings;\n let allPets = props ? props.pets.allPets : this.state.pets.allPets;\n let savedPets = props ? props.pets.savedPets : this.state.pets.savedPets;\n\n let savedPetIds = [];\n for (let savedPet of savedPets) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new RequestLaunchTemplateData. The information to include in the launch template.
function RequestLaunchTemplateData() { _classCallCheck(this, RequestLaunchTemplateData); RequestLaunchTemplateData.initialize(this); }
[ "constructor() { \n \n RequestLaunchTemplateData.initialize(this);\n }", "function ModifyLaunchTemplateRequest() {\n _classCallCheck(this, ModifyLaunchTemplateRequest);\n\n ModifyLaunchTemplateRequest.initialize(this);\n }", "function ResponseLaunchTemplateData() {\n _classCallCheck(t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calls a method on a random peer, and retries on another peer if it times out
_request (method, ...args) { let cb = args.pop() while (!cb) cb = args.pop() let peer = this.randomPeer() args.push((err, res) => { if (this.closed) return if (err && err.timeout) { // if request times out, disconnect peer and retry with another random peer logdebug(`peer req...
[ "_request (method, ...args) {\n let cb = args.pop()\n while (!cb) cb = args.pop()\n let peer = this.randomPeer()\n args.push((err, res) => {\n if (this.closed) return\n if (err && err.timeout) {\n // if request times out, disconnect peer and retry with another random peer\n debug...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
opens infoview window at the marker mentioned in Location object 'loc' uses the global variable 'infoWindow'
function openInfoView(loc) { infoWindow.close(); //closes currently displayed infoView (if it is there). //center the map at the marker for which infoView is displayed. map.setCenter(new google.maps.LatLng(loc.lat, loc.lon)); var htmlStrings = []; htmlStrings[0] = '<div>' + '<strong>' + loc.name + '</str...
[ "OpenInfoWindow(infoWindow, map, marker) {\n infoWindow.open(map, marker);\n }", "openInfoWindow(location) {\n this.closeInfoWindow();\n this.state.infowindow.open(this.state.map, location.marker);\n this.state.infowindow.setContent(\"Looking Up . . . \");\n this.getWindowData(location);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Entering animation for quotepanel
function fadeInQuotePane() { $('#quote-panel').animateCSS('fadeInLeft', { delay: 200 }); }
[ "_startAnimation() {\n // @breaking-change 8.0.0 Combine with _resetAnimation.\n this._panelAnimationState = 'enter';\n }", "function animateIt() {\n \t\tsquare\n\t \t\t.show( \"slow\" )\n\t \t\t.addClass('box-spin box-animate')\n\t\t .animate({ left: \"+=200\" }, 500 )\n\t\t .css( \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the graph in which the nodeNumber is present for an error node
function getGraphForErrorNode(nodeNumber) { return errorGraphMap.findIndex((graph) => graph.nodes().includes(`${nodeNumber}`) ); }
[ "function getGraphForErrorNode(nodeNumber) {\n\t\t\t\treturn errorGraphMap.findIndex(function (graph) {\n\t\t\t\t\treturn graph.nodes().includes(\"\" + nodeNumber);\n\t\t\t\t})\n\t\t\t}", "function getGraphForNode(nodeNumber) {\n return graphMap.findIndex((graph) =>\n graph.nodes().includes(`${nodeNumber}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
view all Partys in database
static async viewAll() { return Database.select(new Party().table); }
[ "function viewAll() {\n connection.query(\"SELECT * FROM products\", function (err, results) {\n if (err) throw err;\n for (let i = 0; i < results.length; i++) {\n console.log(\"Item \" + results[i].item_id + \"| Dept Name: \" + results[i].department_name + \"| Product Name: \" + resul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Valida un numero de cedula ingresado
function validarCedula(inCedula) { var array = inCedula.split("") ; var num = array.length; var total; var digito; var mult; var decena; var end; if(num == 10) { total = 0; digito = (array[9]*1); for( var i = 0; i<(num-1);i++) { mult = 0; ...
[ "function validarNumero(){\r\n if(!(this.configurado===true)){\r\n\t this.displayErrorCfg();\r\n\t return false;\r\n\t} // if\r\n\telse{\r\n\t if(isNaN(this.valor)){\r\n\t if(this.displayAlert) alert('El campo debe ser numerico');\r\n\t\tif(this.displayFoco) this.setFoco();\r\n\t\treturn false;\r\n\t } //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loading all advertisements in user's cart
async function loadAdvertisements() { let userId = sessionStorage.getItem("sessionUserId"); try { let ads = await $.ajax({ url: "/api/users/" + userId + "/cartItems", method: "get", dataType: "json" }); showAds(ads); } catch (err) { let ele...
[ "async function listAds(ctx) {\n ctx.loggedIn = sessionStorage.getItem('authToken') !== null;\n ctx.username = sessionStorage.getItem('username');\n try {\n let response = await requestor.get('appdata', 'ads', 'Kinvey');\n let ads = response.reverse();\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the outerWidth and dragBarPos variables; used on initialization and window resize
function setOuterWidth() { outerWidth = wrap.offsetWidth; dragBarPos = calcDragBarPosFromCss() || Math.floor(outerWidth / 2) - 5; }
[ "function setSplitterbarPosition() {\n var screenWidth = Math.floor($(window).width());\n\n if (screenWidth < ((minPanelWidth * 2) + parseInt(splitterWidth, 10))) {\n dragEnabled = false;\n var newLeftWidth = Math.floor($(window).width() - parseInt(splitterWidthEdges, 10));\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ADICIONA MASCARA DE DATA
function mascaraData(data){ if(mascaraInteiro(data)==false){ event.returnValue = false; } return formataCampo(data, '00/00/0000', event); }
[ "function MascaraData(data) {\n if (mascaraInteiro(data) == false) {\n event.returnValue = false;\n }\n return formataCampo(data, '00/00/0000', event);\n }", "function MascaraData(data){\r\n if(mascaraInteiro(data)==false){\r\n event.returnValue = false...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
strips HTML from input, preserving BR tags
function stripHtml(input) { if (typeof input === 'undefined') { return ''; } // note this is not a good way to do this with normal HTML, but works for GW2's item db var stripped = input.replace(/<br>/ig, '\n'); stripped = stripped.replace(/(<([^>]+)>)/ig, ''); stripped = stripped.replace(/\n|\\n/g, '<br>...
[ "function strip(html)\n {\n html = html.replace(/<b>/g, \"\");\n html = html.replace(/<\\/b>/g, \"\");\n html = html.replace(/<(?:.|\\n)*?>/gm, \"\");\n return html;\n }", "function baynote_removeHtml(raw) {\n\tif (!raw) return;\n\traw = raw.replace(/\\<[^>]*\\>/g, \"\");\n\traw = ra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hook to get the current responsive mode (window size category).
function getResponsiveMode(currentWindow) { var responsiveMode = ResponsiveMode.small; if (currentWindow) { try { while (currentWindow.innerWidth > RESPONSIVE_MAX_CONSTRAINT[responsiveMode]) { responsiveMode++; } } catch (e) { // Return...
[ "function GetDisplayMode() {\n //DETERMINE WINDOW SIZE\n if ($(window).width() > 600 && ((CurrentDisplayMode == \"Mobile\") || (CurrentDisplayMode == \"\"))) { //ensure it doesnt run repeatedly on each similar call i.e. screen mode still on Desktop already (event bubbling)\n CurrentDisplayM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the function getPlayingStyle, return the team you think it has the best playing style. Run the code in the console to find out what's the secondTeam final playing style. /////////////////////// your code here
function getPlayingStyle(){ let firstTeam = [3,3,1,3]; let secondTeam = firstTeam; firstTeam[0] = 4; firstTeam[1] = 1; firstTeam[2] = 4; firstTeam[3] = 1; return secondTeam; }
[ "function chooseEnemyNPCPlayStyle() {\n let coinToss = random(100);\n if (coinToss > 50) {\n playStyle = \"aggro\"\n }\n else {\n playStyle = \"passive\"\n }\n}", "function switchTeams() {\n // Determine the current team\n if(playerOne) {\n playerColour = \"#F07167\";\n playerName =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
a value that indicate whether the current window context is a parent one
function useParentContextOrNot() { return ((nt.useParentContext == 'auto') && (parent != this)) || (nt.useParentContext == 'yes'); }
[ "function getIsParent() {\n // top level variables should not be exported for performance reasons (PERF_NOTES.md)\n return isParent;\n }", "parentFrame() {\n return this.sameTargetParentFrame() || this.crossTargetParentFrame();\n }", "get parentWindow() {\r\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If we're searching, update the filter results. (If we stop searching, we're going to end up in the onFolderDisplayMessagesLoaded notification. Mayhaps we should lose that vector and just use this one.)
onSearching(aFolderDisplay, aIsSearching) { // we only care if we just started searching and we are active if (!aIsSearching || !aFolderDisplay.active) { return; } // - Update match status. this.reflectFiltererResults(this.activeFilterer, aFolderDisplay); }
[ "updateDisplayedMessages() {\n this.setState((prevState) => {\n let { storedMessages, filterText, displayedMessages, currentFolderID } = prevState;\n displayedMessages = storedMessages.filter((messageItem) => {\n if (messageItem.subject.toLowerCase().indexOf(filterText) =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Client class proxying the incoming OData request to the upstream XSOData the incoming XSOData response to the downstream OData client and applying the added decorator types. Decorator classes are instantiated per request entity and subentity (in case of $batch requests). The tombstone filter decorator is always applied...
function Client(destination) { Object.defineProperties(this, { "request": { value: new WebRequest($.request, destination) }, "destination": { value: destination }, "decoratorClasses": { value: [TombstoneFilterDecorator] } }); }
[ "function TombstoneFilterDecorator(request, metadataClient) {\n\tif(!request) throw 'Missing required attribute request\\nat: ' + new Error().stack;\n\tif(!metadataClient) throw 'Missing required attribute metadataClient\\nat: ' + new Error().stack;\n\t\n\tvar traceTag = 'TombstoneFilterDecorator.init.' + request.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
to display admin block
function display_admin() { show(admin); hide(user); }
[ "function _displayAdmin() {\n var adminView = new BST.Admin.AdminView();\n adminView.draw(document.body);\n }", "function showAdmin(){\n addTemplate(\"admin\");\n userAdmin();\n}", "function DisplayAdmin(callback){\n\tif($(\"#adminlist\").html()=='+'){\n\t\tClearAdmins(function(){\n\t\t\tcall...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given 2 strings, a and b, return a string of the form short+long+short, with the shorter string on the outside and the longer string on the inside. The strings will not be the same length, but they may be empty (length 0).
function comboString(a, b){ if(a.length > b.length){ return b + a + b; } else{ return a + b + a; } }
[ "function shorter_reverse_longer(a, b){\n let long = a.length >= b.length ? a.split('').reverse().join('') : b.split('').reverse().join('');\n let short = a.length >= b.length ? b : a;\n return `${short}${long}${short}`;\n}", "function solution(a, b) {\n return a.length > b.length ? `${b}${a}${b}` : `${...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the keyword with keywordId is placed correctly (return true if correct & false if the keyword is still in the bank or misplaced )
isCorrectAnswer(keywordId) { var keyword = document.querySelector(keywordId); if (keyword.parentNode.id == "keywords") { return false; } var keywordId = Number(keyword.id.substring(keyword.id.length - 1)); var currentDropAreaId = Number(keyword.parentNode.id.substri...
[ "function keywordExists(keyword) {\n var kw = keyword;\n if (kw != null) {\n try{\n kwIter = AdWordsApp.keywords().withCondition(\"Text = \\'\"+kw+\"\\'\").withCondition(\"Status = ENABLED\").get();\n var exists = kwIter.totalNumEntities() > 0 ? true : false;\n if(!exists){\n kwIter = AdW...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate report to JSON
generateFinalReport() { const obj = { environment: "Dev", numberOfTestSuites: this._numberOfTestSuites, totalTests: this._numberOfTests, browsers: this.browsers, testsState: [{ state: this.standardTestState('Passed'), total: this._numberOfPassedTests }, { ...
[ "generateReport() {\n this.getData();\n reporter.write(this.options, this.data);\n }", "buildReport () {\n let self = this;\n let totalIssues = 0;\n let reportFiles = [];\n\n Object.keys(self.fileReports).forEach((file) => {\n let fileReport = self.fileReports[file];\n let linesWithIt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
|| FUNCTION: MediaClick || PARAMETERS: || RETURNS: || PURPOSE: Clicks straight through to your media URL || ||
function MediaClick() { if( LoadInNewWindow ) { URL = xMediaContent[iCurrentImage+1]; win=window.open(URL,"NewWindow",""); if (!win.opener)win.opener=self; } else document.location.href = xMediaContent[iCurrentImage+1]; }
[ "function onClick() {\n var $elem = $(this).closest('.w_medium'),\n self = wraith.lookup($elem),\n expanded = self.expanded();\n\n if (expanded) {\n // starting playback\n self.play($elem);\n\n // triggering custom event\n $elem.trigger...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates the visible top position of an element If _noOwnScroll is true, method not include scrollTop of element itself.
_getVisibleTopPosition(_id, _noOwnScroll) { return this._getVisibleLeftOrTop(_id, _noOwnScroll, 'offsetTop', 'scrollTop'); }
[ "get _visibleDocTop() {\r\n return window.pageYOffset - document.documentElement.scrollTop;\r\n }", "function viewTop() {\r\n if (self.pageYOffset)\r\n return self.pageYOffset;\r\n\r\n if (document.body && document.body.scrollTop)\r\n return document.body.scrollTop;\r\n\r\n return 0;\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Turns codeElement into "Pandaed" code element.
colorNode(codeElement) { let lang = this.identifyLanguage(codeElement); codeElement.classList && codeElement.classList.add('panda-code', 'panda-' + lang); //optional 'ignore' language for ignoring code blocks. if(lang !== 'ignore') { //send to parser. ...
[ "identifyLanguage(codeElement) {\n let regex = /(?:\\s|^)panda[_-](\\w+)(?:\\s|$)/;\n\n if (regex.test(codeElement.className)) {\n return regex.exec(codeElement.className)[1];\n }\n\n return 'default'\n }", "code(elem) {\r\n window._codelem = el...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the Host Bot tab is closed then all the tabs created by the modules running in that bot instance will be closed.
function CloseActiveModule(hostTabId) { if(typeof(_ActiveModules) !== "undefined" && _ActiveModules != null) { for (var key in _ActiveModules) { if(typeof(_ActiveModules[key]) !== "undefined" && _ActiveModules[key] != null && _ActiveModules[key].HostTabId) { if(_ActiveModules[key].HostTabId == hostTabId) ...
[ "function closeAllTabs() {\n IDE.sessions.forEach(function (session) {\n IDE.closeSession(session);\n });\n }", "function CloseAllModuleTabs() {\n\t\tif(typeof(_ActiveModules) !== \"undefined\" && _ActiveModules != null) {\n\t\t\tfor (var key in _ActiveModules) {\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `DefaultCacheBehaviorProperty`
function CfnDistribution_DefaultCacheBehaviorPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); errors.collect(cdk.propertyValidator('allowedMethods', cdk.listValidator(cdk.validateString))(properties.al...
[ "function CfnDistribution_CacheBehaviorPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an obje...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create oEmbed of first tweet via ID
function generateEmbed(tweetId) { $.getJSON('https://api.twitter.com/1/statuses/oembed.json?id=' + tweetId + '&callback=?', function(embed) { html = embed.html; $('#thetweetembed').html(html); }); }
[ "function getOEmbed (tweet) {\r\n\r\n\t\t\t\t// oEmbed request params\r\n\t\t\t\tvar params = { \"id\": tweet.id_str, \"maxwidth\": MAX_WIDTH, \"hide_thread\": true, \"omit_script\": true};\r\n\t\t\t\t// request data\r\n\t\t\t\ttwitter.get(OEMBED_URL, params, function (err, data, resp) {\r\n\t\t\t\t\ttweet.oEmbed =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function changeProv function loadDistsProv Obtain the list of districts for a specific province in the census as an XML file. Input: prov two character province code
function loadDistsProv(prov) { var censusId = document.distForm.censusId.value; var censusYear = censusId.substring(2); // get the district information file HTTP.getXML("CensusGetDistricts.php?Census=" + censusId + "&Province=" + prov, gotDistFile, ...
[ "function loadDistsProv(prov)\n{\n var censusSelect = document.distForm.Census;\n var census = censusSelect.value;\n var censusYear = census.substring(2);\n var xmlName;\n if (censusYear < \"1871\")\n { // pre-confederation\n xmlName = \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Invalidates (clears) the references collection. This should be called anytime the AST has been manipulated.
invalidateReferences() { this._references = undefined; }
[ "updateReferences() {\n for (let variable in this.referencedVariables) {\n this.referencedVariables[variable].referenced = 0;\n }\n this.currentVariables.forEach(d => this.setReferences(d.id));\n this.savedReferences.forEach(d => this.setReferences(d));\n for (let varia...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper to transform a JSX identifier into a normal reference.
function toReference(t, node, identifier) { if (t.isIdentifier(node)) { return node; } else if (t.isJSXIdentifier(node)) { return identifier ? t.identifier(node.name) : t.stringLiteral(node.name); } else { return node; } }
[ "function toReference(node) {\n var identifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (typeof node === \"string\") {\n return node.split(\".\").map(function (s) {\n return t.identifier(s);\n }).reduce(function (obj, prop) {\n return t.member...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
endregion region Test Helpers Populate a metadataStore with Northwind service CSDL metadata
function northwindMetadataStoreSetup(metadataStore) { if (!metadataStore.isEmpty()) return; // got it already metadataStore.importMetadata(northwindMetadata); metadataStore.addDataService( new breeze.DataService({ serviceName: northwindService }) ); }
[ "function moduleMetadataStoreSetup() {\n breeze.config.initializeAdapterInstance(\"modelLibrary\", modelLibrary, true);\n if (!firstTime) return; // got metadata already\n\n firstTime = true;\n moduleMetadataStore = new MetadataStore();\n stop(); // going async...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
vertices of the rocket body
drawRocketBody() { beginShape(); vertex(15, 10) vertex(0, 10) vertex(-15, 10) vertex(-26, 10) vertex(-40, 18) vertex(-40, 0) vertex(-40, -18) vertex(-26, -10) vertex(-15, -10) vertex(0, -10) vertex(15, -10)...
[ "function initVertices() {\n\tif (primitive == \"triangle\") {\n\t\tvertices = [\n\t\t\tvec2(-0.5, -0.5),\n\t\t\tvec2(0, 0.5),\n\t\t\tvec2(0.5, -0.5)\n\t\t];\n\t}\n\t// Compose square from 4 triangles\n\telse if (primitive == \"square\") {\n\t\tv1 = [\n\t\t\tvec2(-0.5, -0.5),\n\t\t\tvec2(0.5, -0.5),\n\t\t\tvec2(0.0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stop black boxing the specified source.
function unBlackBox(sourceClient) { dumpn("Un-black boxing source: " + sourceClient.actor); return rdpRequest(sourceClient, sourceClient.unblackBox); }
[ "function stopSource() {\n\tds.source.stop({\n\t\t\t\"id\": sourceDetails.id\n\t\t}, function(err, response) {\n\t\t\tif (err) \n\t\t\t\tconsole.log(err);\n\t\t\telse\n\t\t\t{\n\t\t\t\tconsole.log(\"Source stopped.\");\n\t\t\t\tdeleteSource();\n\t\t\t}\n\t\t});\n}", "removeSource(source) {\n const sour...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the argument can be converted to Tensor. Tensors, primitives, arrays, and TypedArrays all qualify; anything else does not.
function canTensorify(obj) { return obj == null || isPrimitive(obj) || Array.isArray(obj) || (typeof obj === 'object' && (obj instanceof tf.Tensor)) || tf.util.isTypedArray(obj); }
[ "function canTensorify(obj) {\n return obj == null || isPrimitive(obj) || Array.isArray(obj) || typeof obj === 'object' && obj instanceof tf.Tensor || tf.util.isTypedArray(obj);\n}", "function canTensorify(obj) {\n return obj == null || isPrimitive(obj) || Array.isArray(obj) ||\n (typeof obj === 'objec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compute the coordinates of the errorbar objects
function errorCoords(d, xa, ya) { var out = { x: xa.c2p(d.x), y: ya.c2p(d.y) }; // calculate the error bar size and hat and shoe locations if(d.yh !== undefined) { out.yh = ya.c2p(d.yh); out.ys = ya.c2p(d.ys); // if the shoes go off-scale (ie log scal...
[ "function errorCoords(d, xa, ya) {\n\t var out = {\n\t x: xa.c2p(d.x),\n\t y: ya.c2p(d.y)\n\t };\n\n\t // calculate the error bar size and hat and shoe locations\n\t if(d.yh !== undefined) {\n\t out.yh = ya.c2p(d.yh);\n\t out.ys = ya.c2p(d.ys);\n\n\t // if the shoes go...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggle visibility of modal about us on main page
function toggleAboutUsModal(){ document.getElementById("about-us").classList.toggle("is-active"); }
[ "function toggleAbout() {\n openModal('about');\n }", "function toggle() {\n setModal(!modal);\n }", "function toggle() {\n setModal(!modal);\n }", "aboutToggle(state) {\n state.aboutShow = !state.aboutShow;\n }", "function aboutUs() {\n let modal = document.getElementById(\"about...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function generateColors which can generate any number of hexa or rgb colors.
function generateColors(type, num) { let output = []; if (type === 'hexa') { for (let i = 0; i < num; i++) { let a; let r = Math.floor(Math.random() * 255).toString(16); let g = Math.floor(Math.random() * 255).toString(16); let b = Math.floor(Math.random() * 255).toString(16); a = ...
[ "function generateColors(hexa,number){\n const letters = '0123456789ABCDEF';\n let hexaNumber = '#'\n let retorno = []\n let anyt;\n for (let i = 0; i < number; i++){\n if(hexa == 'hexa'){\n for (let i = 0; i < 6; i++){\n anyt = hexaNumber + letters[Math.floor(Math.rand...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calling choicesL(choices) function to run here
function choicesL(choices) { let result = ''; //providing string to display result for (let i = 0; i < choices.length; i++) { //looping over choice values result += `<p class="userChoice" data-answer= "${choices[i]}">${choices[i]}</p>`; //setting data vaule and displaying them onto the page } ...
[ "showChoices() {\n\t\tthis.undumSystem.writeChoices(this.choiceStringArray);\n\t}", "function updateChoices() {\n currType = parseInt(Math.random() * 3);\n // currType = PRONUNCIATION;\n if (currType == MULTIPLE_CHOICE) {\n multipleChoice();\n } else if (currType == FILL_IN_THE_BLANK) {\n fillInTheBlank...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Looks for matching glob patterns or stdin
async function findFiles(globPatterns, options) { const globPats = globPatterns.filter((filename) => filename !== STDIN); const stdin = globPats.length < globPatterns.length ? [STDIN] : []; const globResults = globPats.length ? await (0, glob_1.globP)(globPats, options) : []; const cwd = options.cwd || ...
[ "let exactMatch;\n for (let pattern in globMap) {\n if (this.isGlobMatch(filePath, pattern, pipeline)) {\n exactMatch = globMap[pattern];\n break;\n }\n }", "async function findFiles(globPatterns, options) {\n const globPats = globPatterns.filter((filename) => filename...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! createStringFromCodePointArray.js Version 1.0.0
function createStringFromCodePointArray(codePoints) { // quicker than using `String.fromCodePoint.apply(String, codePoints)` // (and 32766 was the amount limit of argument for a function call). var i = 0, l = codePoints.length, code, s = ""; for (; i < l; i += 1) { code = codePoints[i]; //...
[ "function fromCodePoints(arr = []) {\n return arr.map(n => String.fromCodePoint(n)).join('');\n }", "generateCodePointArray() {\n let index = 0;\n this.codePoints = [];\n while (index < this.str.length) {\n const num = JSUtils.toCodePoint(this.str, index);\n index +=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
default config for a close button
get closeButton() { return { command: "cancel", icon: "close", label: "Cancel", type: "rich-text-editor-button", }; }
[ "handleClose() {\n this.showConfirm = false;\n }", "function closeSettings() {\n\n $settingsElement.classed(showClass, false);\n $settingsButton.classed(activeClass, false);\n }", "function settingsCancel(ev) {\r\n closeSettings();\r\n}", "function settingsClosed(event)\r\n{\r\n\tif (event.close...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method submits the request to delete a research area to server. It first checks to see that there are no pending changes that need to be persisted, and submits only if so. If there are pending changes then it will simply ask the user to either save or abandon the changes.
function deleteResearchArea(liId) { if (raChanges.moreChangeData()) { if (confirm('You must save (or abandon) all outstanding changes before attempting a delete. Do you want to save changes to Research Area Hierarchy?')) { save(); } $j("#researcharea").empty(); raChanges...
[ "function capacityDelete()\r\n{\r\n\tvar htmlAreaObj = _getWorkAreaDefaultObj();\r\n \tvar objAjax = htmlAreaObj.getHTMLAjax();\r\n var objHTMLData = htmlAreaObj.getHTMLDataObj();\r\n \tif(objAjax)\r\n \t{\r\n \t\t// Check for valid record to execute process.\r\n\t \tif(!isValidRecord(true))\r\n\t\t{\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removes the file from the import route dialogue
function handleImportRouteRemove(e) { //if the file is removed from the view, we do NOT remove the waypoints from the list, etc. //just remove the erorr message if visible showImportRouteError(false); }
[ "function cancelImport() {\n var thisImportDialog = this;\n thisImportDialog.hide();\n gOverlay.hide();\n}", "unassignFile(file) {\n delete this.files[file.srcPath.toLowerCase()];\n delete this.pkgMap[file.pkgPath.toLowerCase()];\n return file;\n }", "function handleImportRouteS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the values of the countries
function calculate_values_of_countries(wc_selection, club_selecton) { var data_plot1 = []; var data_plot2 = []; // Als 1 van de 2 een land is, dan loopt ie over de desbetreffende loop maar 1 keer, zoals gewenst var world_cup_countries = make_selection_of_world_cup_countr...
[ "function getCountryValues() {\n // Retrive selected county on dropdown menu\n const countrySelected = countryDropdownMenu.value;\n console.log(countrySelected);\n\n // Retrive the data for country selected\n const selectedCountryInformation = data.filter(\n (entry) => entry.Country === countr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adapted from Sucrase ( Polyfill for the nullish coalescing operator (`??`), when used in situations where at least one of the values is the result of an async operation. Note that the RHS is wrapped in a function so that if it's a computed value, that evaluation won't happen unless the LHS evaluates to a nullish value,...
async function _asyncNullishCoalesce(lhs, rhsFn) { return _nullishCoalesce._nullishCoalesce(lhs, rhsFn); }
[ "function orElseAsyncForMaybe(input, recoverer) {\n if (Maybe_1.isNotNullAndUndefined(input)) {\n return Promise.resolve(input);\n }\n var fallback = recoverer();\n // If this is async function, this always return Promise, but not.\n // We should check to clarify the error case if user call th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an EightBit with the current value, e.g. EightBit(255).
toEightBit() { const value = typeof this.value === 'string' ? parseInt(this.value, 16) : null; return new EightBit(value); }
[ "toEightBit() {\n const value = typeof this.value === \"string\" ? parseInt(this.value, 16) : null;\n return new EightBit(value);\n }", "toEightBit() {\n const t = typeof this.value == \"string\" ? parseInt(this.value, 16) : null;\n return new Os(t);\n }", "function highnibble(x)\n{\n return (x...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PART 5 Define a function with the identifier "splitToArray" Parameters: "word" (string) Definition: Returns the given parameter string split by individual character into an array Return type: (string array) Example: "MAD" > ["M", "A", "D"]
function splitToArray(word) { let wordCharacters = []; for (let i = 0; i < word.length; i++) { wordCharacters[i] = word[i]; } return wordCharacters; }
[ "function sentenceToArray(string){\n return string.split(\" \"); \n}", "function arrayNow(str) {\n ans = str.split(\" \");\n return ans;\n}", "function string_to_array(x){\n return x.split(\" \");\n}", "function arrayWord(word) {\n var arrayWord = [];\n for (i = 0; i < word.length; i++) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The spec says "An editing host is a node that is either an Element with a contenteditable attribute set to the true state, or a Document whose designMode is enabled." Because Safari returns "true" for the contentEditable property of an element that actually inherits its editability from its parent, we use a different d...
function isEditingHost(node) { return node && ((node.nodeType == 9 && node.designMode == "on") || (isEditableElement(node) && !isEditableElement(node.parentNode))); }
[ "function isEditingHost(node) {\n return node\n && isHtmlElement(node)\n && (node.contentEditable == \"true\"\n || (node.parentNode\n && node.parentNode.nodeType == Node.DOCUMENT_NODE\n && node.parentNode.designMode == \"on\"));\n}", "function isEditingHost(node) {\n\t\tretur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
open new page and calls parseTree for provided path and href
async function callParser({ href, name, currPath }) { const newPage = await browser.newPage(); await parseTree({ url: href, currPath: path.join(currPath, name), page: newPage, }); await newPage.close(); }
[ "async function parseTree({ url, currPath, page }) {\n console.log(`creating/recreating path: ${currPath}`);\n await page.goto(url);\n resolveFolder(currPath);\n await page.waitForSelector(\".Box-row\");\n const itemRows = await page.$$(\".Box-row\");\n const folders = [];\n // potential parallel spot\n fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling play on the element will emit playing even if the stream is stalled. If the stream is stalled, emit a waiting event.
function onPlaying() { if (element && isStalled() && element.playbackRate === 0) { const event = document.createEvent('Event'); event.initEvent('waiting', true, false); element.dispatchEvent(event); } }
[ "function onPlaying() {\n if (element && isStalled() && element.playbackRate === 0) {\n var _event = document.createEvent('Event');\n _event.initEvent('waiting', true, false);\n element.dispatchEvent(_event);\n }\n }", "play() {\n // Force asynchronous event ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
depositProfit You have deposited a specific amount of dollars into your bank account. Each year your balance increases at the same growth rate. Find out how long it would take for your balance to pass a specific threshold with the assumption that you don't make any additional deposits. Example For deposit = 100, rate =...
function depositProfit(deposit, rate, threshold) { var yr = 0; while(deposit < threshold){ deposit += deposit * (rate/100); yr ++; } return yr; }
[ "function depositProfit(deposit, rate, threshold) {\n let yearsToMature = 0\n let rateOfReturn = rate / 100\n while (deposit < threshold) {\n deposit += (deposit * rateOfReturn)\n yearsToMature++\n }\n return yearsToMature\n}", "function depositProfit(deposit, rate, threshold) {\n le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets all of the edges of a rectangle that are outside of the given bounds. If there are no out of bounds edges it returns an empty array.
function _getOutOfBoundsEdges(rect, boundingRect) { var outOfBounds = new Array(); if (rect.top < boundingRect.top) { outOfBounds.push(RectangleEdge.top); } if (rect.bottom > boundingRect.bottom) { outOfBounds.push(RectangleEdge.bottom); } if (rect.left < boundingRect.lef...
[ "function _getOutOfBoundsEdges(rect, boundingRect) {\n var outOfBounds = new Array();\n if (rect.top < boundingRect.top) {\n outOfBounds.push(RectangleEdge.top);\n }\n if (rect.bottom > boundingRect.bottom) {\n outOfBounds.push(RectangleEdge.bottom);\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decimal character reference start state
[DECIMAL_CHARACTER_REFERENCE_START_STATE](cp) { if (isAsciiDigit(cp)) { this._reconsumeInState(DECIMAL_CHARACTER_REFERENCE_STATE); } else { this._err(ERR.absenceOfDigitsInNumericCharacterReference); this._flushCodePointsConsumedAsCharacterReference(); this...
[ "_stateDecimalCharacterReferenceStart(cp) {\n if (isAsciiDigit(cp)) {\n this.state = State.DECIMAL_CHARACTER_REFERENCE;\n this._stateDecimalCharacterReference(cp);\n }\n else {\n this._err(error_codes_js_1$1.ERR.absenceOfDigitsInNumericCharacterReference);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Counts and tracks the number of external scripts currently being loaded, and when they are all loaded, calls the 'scriptsLoadFun'. This can also be used to set the scriptsLoadFun, by just passing a function in. It can also take multiple function calls.
function scriptLoad( inc ) { if ( typeof inc === 'number' ) { scriptsLoading += inc; if ( scriptsLoading === 0 && scriptsLoadFun ) { scriptsLoadFun(); scriptsLoadFun = null; } // store the fun to call it later } else if ( inc instanceof Function ) { ...
[ "function CountLoadedScript()\r\n\t{\r\n\t\t--tNbScriptToLoad;\r\n\t\t\r\n\t\tif( _callBackPercent )\r\n\t\t{\r\n\t\t\t_callBackPercent( (((tNbScriptToLoadTotal-tNbScriptToLoad)/tNbScriptToLoadTotal)*100).toFixed(1) );\r\n\t\t}\r\n\t\tif( tNbScriptToLoad != 0)\r\n\t\t\treturn;\r\n\t\t\r\n\t\t_callBackWhenDone();\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Configuration of the current Truffle project.
async function currentConfig() { let config = Config.default(); config.resolver = new Resolver(config); config.artifactor = new Artifactor(); config.paths = await contractPaths(config); config.base_path = config.contracts_directory; return config; }
[ "function config() {\n global.config.build.rootDirectory = path.join('../EquiTrack/assets/frontend/', global.config.appName);\n global.config.build.templateDirectory = path.join('../EquiTrack/templates/frontend/', global.config.appName);\n global.config.build.bundledDirectory = '.';\n indexPath = path.join(glob...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdPut / Mutates the specified pull request. This can be used to change the pull request&39;s branches or description. Only open pull requests can be mutated.
repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdPut( incomingOptions, cb ) { const Bitbucket = require('./dist'); let defaultClient = Bitbucket.ApiClient.instance; // Configure API key authorization: api_key let api_key = defaultClient.authentications['api_key']; api_key.apiKey = inc...
[ "async updatePullRequestComment(owner, repo, commentId, body, pullRequestId) {\n this.authenticate();\n const response = await this.unwrap(this.client.pullrequests.updateComment({\n pull_request_id: `${pullRequestId}`,\n comment_id: `${commentId}`,\n repo_slug: repo,\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the speed of the snai. Adds a random speed boost for a bit more variety.
setRandomSpeed() { const rand = Math.random(); this.speed = rand > .5 ? 1 + (rand / 2) // divide by two just so they don't get too far ahead : 1; }
[ "function setSpeed() {}", "function setSpeed(\r\n speed_)\r\n {\r\n speed = speed_;\r\n }", "set speedUS(speed) {\r\n this.speed = speed * 1.6;\r\n }", "setSpeed() {\n var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n\n if (!this._lottie) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to apply the sorting parameter by simply modifying the currentBrands object only the brands are needed because the products are displayed and rendered from this object only
function sort(typeOfSort, brands) { if(typeOfSort=='price-asc'){ Object.keys(brands).forEach((brand, i) => { brands[brand].sort(price_asc); });} else if (typeOfSort=='price-desc'){ Object.keys(brands).forEach((brand, i) => { brands[brand].sort(price_desc); });} else if (typeOfSort=='da...
[ "sortListByAvailability(){\n let productList = this.state.productList;\n productList.sort((a,b)=>{\n this.setState({\n sortPriceOrder:0,\n sortQuantityOrder:0\n });\n if(this.state.sortAvailabilityOrder === 1){\n this.setSta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
afficher la page Scene
RenderDeviceScenePage(){ // Clear view this._DeviceConteneur.innerHTML = "" // Clear Menu Button this.ClearMenuButton() // Add Back button in settings menu NanoXAddMenuButtonSettings("Back", "Back", IconModule.Back(), this.RenderDeviceStartPage.bind(this)) // Cont...
[ "loadScene() { }", "function Scene() {}", "displayScene() {\n // entry point for graph rendering\n var transformations = [];\n var materials = [];\n var textures = [];\n this.visitNode(this.components[this.root], transformations, materials, textures, false,0);\n\n }", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ajoute le event handler de mouseover sur un polylineForHover. Le event handler gere l'apparition du polyline et de l'infoWindowItineraire.
function ajouterPolylineForHoverMouseoverEventHandler(polylineForHover, indice, description_depart, description_arrivee, idPaire, distance, vitesseMed, tempsParcours, carte) { //attribution de propriétés au polylineForHover, permet de changer les infos présentée dans l'infoWindowItineraire ailleurs dans le ...
[ "function onPolylineMouseOver(e) {\n\tvar tooltipContent = \"\";\n\tthis.setOptions(onPolylineHoverColorOptions);\n\tif (this.linkColor != \"undefined\") {\n\t\tthis.icons[0].icon.fillColor = this.linkColor;\n\t}\n\ttooltipContent = \"<span>\" + this.linkName + \"</span><hr>number of records: \" + this.numberOfReco...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes and prepares to introduce the game, and initializes the uow audio element
function init() { canvas = document.getElementById('canvas'); context2D = canvas.getContext('2d'); uow.getAudio().then(function(a) { audio=a; dojo.publish('/org/hark/prefs/request'); introduceGame(); }); }
[ "function audioSetUp() {\n bgOST = new Howl({\n src: ['static/sounds/OST/FastDrawing.mp3'],\n autoplay: false,\n loop: true,\n volume: 0.5\n });\n\n}", "function setupAudio() {\n audioEating = loadSound('assets/sounds/eating.wav');\n audioHurt = loadSound('assets/sounds/hurt.wav');\n audioTelepor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get specific plugin details API
function getSpecificPluginDetails(plugin_id) { developer.Api('/plugins/' + plugin_id + '.json', 'GET', [], [], function (e) { logResponse(e, developer); }); }
[ "function getAllPluginDetails() {\n developer.Api('/plugins.json', 'GET', [], [], function (e) {\n logResponse(e, developer);\n });\n}", "getpluginWithID(req, res) {\n plugin.findById(req.params.pluginId, (err, plugin) => {\n if (err) {\n res.send(err);\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks for script updates.
function updateCheck() { var scriptNum = 27776; //Only check for update if using Greasemonkey and no check has been made in the last day. if( !MS_getValue('checked_update') ) { MS_setValue( 'checked_update', true, 24*3600 ); GM_xmlhttpRequest( { method: 'GET', url: 'http://userscripts.org/s...
[ "function scriptUpdateCheck() {\r\n\tif (Date.now() - scriptLastCheck >= 86400000) { // 86400000 == 1 day\r\n\t\t// At least a day has passed since the last check. Sends a request to check for a new script version\r\n\t\tGM_setValue(\"scriptLastCheck\", Date.now().toString());\r\n\t\tscriptCheckVersion();\r\n\t}\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is set up to run when the DOM is ready, if the iframe was not available during `init`.
function onDOMReady() { iframe = document.getElementById(iframeId); if (!iframe) { throw new Error('This page does not contain an iframe for Duo to use.' + 'Add an element like <iframe id="duo_iframe"></iframe> ' + 'to this page. ' + 'See https://www.duosecurity.com/docs/duoweb#3.-show...
[ "function iframeReady() {\n dw.backend.fire('vis-ready');\n var win = iframe.get(0).contentWindow;\n\n liveUpdate.init(iframe);\n\n dw.backend.on('vis-rendered', visualizationRendered);\n\n $(window).on('message', function(evt) {\n evt = evt.originalEvent;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
uc9c Show Days when Full time wage of 160 were earned using filter function
get fullTimeDays() { return this.detailedDailyWage.filter(day => day.wage===160); }
[ "function filterUnderSeventy() {\n data = data.filter(employee => {\n return employee.salary < 70000;\n });\n\n updateDOM();\n}", "function filterWealth() {\n // Run the filter method to filter and show only users with wealth > $1,000,000\n userArray = userArray.filter( user => user.wealth > 1000000 )...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
COPPER PIPES LAYER OPTIONS: rasterBar: true/false (default is false)
function draw_rasterBar() { if ( defaultFalse( currentPart.rasterBar ) ) { // If we're showing the copper pipes... rasterBar1Screen.show(); rasterBar2Screen.show(); rasterBar3Screen.show(); rasterBar1Y = 330 - Math.abs(Math.sin(rasterBar1Pos) * 200); // Calculate their...
[ "function brushMap(){\n map.setFilter('brushed', brushedPts);\n}", "function bwcartoon(position, r, g, b, outputData)\n{\n var offset = position * 4;\n if (outputData[offset] < 120)\n {\n outputData[offset] = 80;\n outputData[++offset] = 80;\n outputData[++offset] = 80;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Launch instance of Chrome headless navigator
async launch(params){ try{ /* Lancement de canary */ let isAlreadyRunning this.logDev('New attempt to launch Chrome') let portAvailable console.log("chromePort",this.chromePort) if(!this.chromePort) portAvailable = await this.getAvailablePort() else portAv...
[ "launchLocal(opts) {\n const ChromeLauncher = require('chrome-launcher')\n this.getBrowser = ChromeLauncher.launch({\n port: opts.port,\n chromeFlags: [\"--headless\", \"--disable-gpu\"]\n }).then(chrome => {\n util.writeFile(path.join(Zen.config.tmpDir, 'chrome.pid'), chrome.pid)\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add bold and italic text settings to all parent items
function labelTextSettingsFormatter(label, dataItem) { if (dataItem.numChildren()) { label.fontWeight('bold').fontStyle('italic'); } }
[ "onItalicFontButtonClick() {\n let previousFontWeight = this.get('value.options.captionFontStyle');\n this.set('value.options.captionFontStyle', previousFontWeight !== 'italic' ? 'italic' : 'normal');\n }", "onItalicFontButtonClick() {\n let previousFontWeight = this.get('_options.captionFontSty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test whether specified constraint id is NOT a stay constraint id.
function isNotStayConstraint(cid) { return (cid.substr(-3) != '#sc'); }
[ "function isStayConstraint(cid) {\n return (cid.substr(-3) == '#sc');\n }", "function check_compound_constraint(constraint_id){\n\n var reverse_constraint_lookup = \n env['reverse_constraint_lookup'];\n var compound_constraint_lookup =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hidden Bar Menu Config
function hiddenBarMenuConfig() { var menuWrap = $('.hidden-bar .side-menu'); // hidding submenu menuWrap.find('.dropdown').children('ul').hide(); // toggling child ul menuWrap.find('li.dropdown > a').each(function () { $(this).on('click', function (e) { e.preventDefault(); $(this).parent('li.dropd...
[ "function hiddenBarMenuConfig() {\n\t\tvar menuWrap = $('.main-nav-box .navigation > li.dropdown > ul');\n\t\t// hidding submenu \n\t\tmenuWrap.find('.dropdown').children('ul').hide();\n\t\t// toggling child ul\n\t\tmenuWrap.find('li.dropdown > a').each(function () {\n\t\t\t$(this).on('click', function (e) {\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates secondary character bodies
function spawnSecondaryCharacters(x, y, elementId) { var boxSd = new b2BoxDef(); boxSd.density = 0.1; boxSd.friction = 0.0; //1.0 or 1.4 boxSd.restitution = 0.1; // 0.4 boxSd.extents.Set(20, 20); // 20 30 boxSd.userData = document.getElementById(elementId); var boxBd = new b2BodyDef(); boxBd.AddShape(...
[ "function createWorld() \n{\n    //gravity vector x, y - 10 m/s2 - thats earth!!\n\tvar gravity = new b2Vec2(0, -9.8);//create a new gravity\n\n\tworld = new b2World(gravity , true );//create a new world\n\t//setup debug draw\n\tvar debugDraw = new b2DebugDraw();\n\tdebugDraw.SetSprite(document.getElementById(\"can...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For the filed that represent major, it has datamajor contains major id, take it an set text to element with major id
function setMajorNameInstadeOfId() { $("*[data-major]").each(function () { var id = $(this).data("major"); $(this).text(majorsMap[id]); }) }
[ "updateMajor() {\n const major = this.productMajorAttribute.name;\n const minor = this.productMinorAttribute.name;\n /* only if there are minors */\n if (minor) {\n Vue.set(this.selectedAttributes, minor, this.productAttributeItems[this.selectedAttributes[major]][0]);\n }\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Import module Description: Includes a raw wiki page as javascript
function importScript(page, lang) { var url = '/index.php?title=' + encodeURIComponent(page.replace(' ','_')) + '&action=raw&ctype=text/javascript&dontcountme=s'; if (lang) url = 'http://' + lang + '.wikipedia.org/w/' + url; var s = document.createElement('script'); s.src = url; s.type = 'text/ja...
[ "function import_wiki() {\n\tif (!woas.config.permit_edits) {\n\t\talert(woas.i18n.READ_ONLY);\n\t\treturn false;\n\t}\n\twoas.import_wiki();\n\twoas.refresh_menu_area();\n}", "function importScript( page ) {\n var url = wgScriptPath + '/index.php?title='\n + escape( page.replace( '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this method is used to validate and send the professor registration request, throws error message otherwise
function professorRegister(user) { vm.profError = ""; vm.profnoMatch = ""; vm.profMessage = ""; vm.profSuccess = false; checkValidation(user); if(vm.profError.length === 0){ user.role = 'professor'; if ($scope.profes...
[ "function professorRegister(user) {\n vm.error = \"\";\n vm.profNoMatch = \"\";\n vm.profMessage = \"\";\n vm.profSuccess = false;\n checkValidation(user);\n if (vm.error.length === 0) {\n if ($scope.professorForm.$valid) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the status of all related fields based on the dependency and also the count of disabled fields
updateFieldsStatus () { let service = dependencyService service.updateFieldsStatus(this.formParameters) }
[ "function correctStatusOfrelatedField(element) {\n var $related_field = $(element).closest('form').find('input[name=\"' + $(element).data('related-field') + '\"]').first();\n if (!$related_field) return;\n $related_field.prop('disabled', element.value == '1');\n $related_field.prop('required', element.v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
First player submits their turn, consisting of canvas data, sentence data, and recaptcha response.
function submitFirstTurn(e) { var img = state.canvas.toDataURL("image/png"); var email = $("email").value.trim(); var sentence = $("sentenceInput").value.trim(); // Validates sentence content. if (!validateSentence(sentence)) { return; } // Separates emails by commas or by spaces. (Would be nice t...
[ "function submit() {\n displayResponse();\n if(currentTime !== 0) {\n startChallenge();\n }\n }", "load_next_challenge() {\r\n this.success(\"Good JOB! You solved the question\", \"green\");\r\n if (this.challenges.has_next_challenge()) {\r\n const challenge = this.challeng...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set temperatures to offline status
function set_temperatures_offline(){ log_temperatures("Set temperatures offline"); $.each(temperatures, function(i, item) { if ( item.type=="text" ){ log_temperatures("Set temperatures offline - text"); $("#"+item.id).text("--"); } if ( item.type=="color" ){ log_temperatures("Set te...
[ "function setTemperature() {\n citiesService.getWeatherDataByCityId(city._id).then(\n function(data) {\n vm.currentTemperature = data.main.temp;\n city.temperature = vm.currentTemperature;\n },\n function(error) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
STICKERS FUNCTIONS check if an object is included on the favorites (array of objects) array.include() doesn't work to check this object, because facorites was stored and the array of objects only stores object references
function isFavorite(item){ for(var i=0; i< favorites.length; i++){ if(favorites[i].id === item.id) return true; } return false; }
[ "isFavoritedBy(user){\n for (let favStory of user.favorites){\n if (favStory.storyId === this.storyId) return true;\n }\n return false;\n }", "function favorited(favorites, recipe_id){\n for (var i=0; i<favorites.length; i++){\n if (favorites[i].recipe_id == recipe_id){\n return true...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a promise which resolves to the download MessagePort.
function _getDownloadServer() { // If we already have a download port, return it. if(_downloadPort != null) return _downloadPort; _downloadPort = new Promise((accept, reject) => { // Send request-download-channel to window to ask the user script to send us the // GM.xmlHttpRequest m...
[ "close() {\n return new Promise((resolve, reject) => {\n if (!this._port || this._port.isOpen === false) {\n resolve();\n return;\n }\n this._port.close((error) => {\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n });\n });...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set CSS transition time
function setTransitionTime(time) { time = time || '0'; $this.css('-webkit-transition-duration', time + 'ms'); }
[ "function setTransitionTime (timeMs){\n _screenElement.container.css({'transition-duration': timeMs + 'ms'});\n }", "addTransitionTimeToCSS(){\n\t\tdocument.getElementById(this._elementID).style.transition = 'filter '+this._transitionTime+'s';\n\t}", "function setAnimTiming() {\n var time = options.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setMinPermintaan set the minPermintaan variable with value from text input
function setMinPermintaan () { minPermintaan = document.getElementById('newMinPermintaan').value; }
[ "function setMinPersediaan(params) {\n minPersediaan = document.getElementById('newMinPersediaan').value;\n }", "function _setMinutos( min )\r\r\r\n{\r\r\r\n\tif( this.validaInt( min, \"Tempo.setMinutos( int ) - Número inválido.\" ) )\r\r\r\n\t\tthis._minutos = min;\r\r\r\n}", "set min(value){Helper....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
It generates hexadecimal sequence from a dataurl with Base64 encoded data
function hexFromDataurl(dataurl,W,H,sd){W=Math.floor(Math.abs(W)),H=Math.floor(Math.abs(H)),sd=Math.floor(Math.abs(sd));var slf=window,sd_3=sd>99999999999999?(99999999999999).toString(3):sd.toString(3),sdL=sd_3.length,buffer='',i=0,v='',L=0,seq='';v=window.atob(dataurl.replace(/data\:[^/]+\/[^/]+\;base64\,/,'')).replac...
[ "function base64url(data) {\n return Buffer.from(JSON.stringify(data))\n .toString(\"base64\")\n .replace(/=/g, \"\")\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\");\n}", "function fromBase64Url(data) {\n var input = data.padRight(data.length + (4 - data.length % 4) % 4, '=')\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ajax call find all movie
function findAllMovie(){ $("#allMovies").click(function(){ url="../MovieCalender/index.php?route=CustomerCalender/showAllMovies"; $.get(url,function(data,status){ data = JSON.parse(data); console.log(data); createList(data); }) }) }
[ "function loadMovies() {\n $.ajax({\n \turl: movieUrl\n }).done(function(response){\n console.log(response);\n \t\t insertContent(response.results);\n \t }).fail(function(error) {\n console.log(error);\n })\n }", "function get_movies() {\n\t$.ajax({\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getting element to numbeer
function gettingElementToNum(elementId){ var element=document.getElementById(elementId).innerText; elementNum=parseFloat(element); return elementNum; }
[ "function getImageNumber(element) {\n\t\tvar number = null;\n\t\tif (!imageNumberMap.has(element)) {\n\t\t\tvar numberElement = element.querySelector('.image-number')\n\t\t\tif (numberElement && numberElement.dataset.number) {\n\t\t\t\tnumber = parseInt(numberElement.dataset.number, 10);\n\t\t\t}\n\t\t} else {\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct a tonelist, then invoke the callback
function MakeToneList( a_tone_list_name, a_completion_function ) { g_toneList = new ToneList(); g_toneList.init( a_tone_list_name, a_completion_function ); }
[ "function playTone(btn,len){ \n o.frequency.value = freqMap[btn]\n g.gain.setTargetAtTime(volume,context.currentTime + 0.05,0.025)\n tonePlaying = true\n setTimeout(function(){\n stopTone()\n },len)\n}", "function createTone(){\n // create FFT\n fft = new Tone.FFT(fft_dim);\n\n // set main Buffer callb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LDAP login which will checks for all kind of external connector
function ldapLogin(req, next) { return new Promise(function (resolve, reject) { let username = cf.parseString(req.body.username); let password = req.body.password; let subdomains = req.subdomains; subdomain = licenseService.getSubdomain(subdomains); ...
[ "function ldaplogin(username, password, next) {\n ldapclient.bind('uid=' + username + \",ou=people,dc=EECS,dc=Berkeley,dc=EDU\", password, function(err, result) {\n next(err, result);\n ldapclient.unbind(next);\n });\n}", "function auth(dn, password, callback)\n{\n client = ldap.createClient({url: 'lda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wrapper around `QueryBuilder.getCost()`. This must exist because the cost returned `QueryBuilder.getCost()` and therein the Hedera Network doesn't work for any acocuntns that have been deleted. In that case we want the minimum cost to be ~25 Tinybar as this seems to succeed most of the time.
getCost(client) { const _super = Object.create(null, { getCost: { get: () => super.getCost } }); return __awaiter(this, void 0, void 0, function* () { // deleted accounts return a COST_ANSWER of zero which triggers `INSUFFICIENT_TX_FEE` // if you set that as t...
[ "getCost(client) {\n const _super = Object.create(null, {\n getCost: { get: () => super.getCost }\n });\n return __awaiter(this, void 0, void 0, function* () {\n // deleted tokens return a COST_ANSWER of zero which triggers `INSUFFICIENT_TX_FEE`\n // if you set ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new reminder If date is far enough in the future, schedules a notification
async createReminder(reminder, date, time, img, coordinates, notificationsStatus) { const localNotification = { title: "Hello", body: "You have scheduled a reminder for " + date, ios: { sound: true }, android: { sound: true, //icon (optional) (string) — URL of icon to display in noti...
[ "function createReminder() {\n\n var today = new Date();\n var alertDate = new Date();\n alertDate.setDate(today.getDate()+7);\n alertDate.setHours(12);\n alertDate.setMinutes(30);\n alertDate.setSeconds(0);\n alertDate = new Date(alertDate);\n\n $cordovaLocalNotification.schedule({\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
populating domain faculty down button dynamically using the values fetched from database
function populate_faculty_dropdown_by_query() { let select = document.getElementById("Select Faculty"); let arr= Get("api/buttonsdynamically/get/faculty"); if(select===null) alert("empty object retrieved from DOM parse"); if( select.length>1) { //alert("faculty already exist in under the...
[ "function setFacultad(ui) {\r\n nameFac = ui.item.label; // nombre de la facultad\r\n idfac = ui.item.id; // id de la facultad \r\n}", "function displayReps(apiResponse){\n $(\"#candidateListId\").empty();\n var offices = apiResponse.offices;\n for (var officeIndex=0; officeIndex<offices.leng...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var output = getProperty(obj, 'key'); console.log(output); // > 'value'
function getProperty(obj, key) { var result = undefined; for (var key1 in obj){ if (obj[key1] === obj[key]){ result = obj[key1]; } } return result; }
[ "function getProperty(obj, key) {\n for (k in obj){\n if (k == key){\n return obj[key];\n }\n }\n}", "function getPropertyValue (obj, name){\n return obj[name]\n}", "function getValue(object, key){\n var returnKey = object[key]; \n return returnKey; \n}", "function prop(name, obj) {\r\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Updates the vertical scroll bar thumb based on height of window or level height
function UpdateVerticalScrollVisual() { var levelHeightPercentage = +(_canvas.height/_heightInputBox.value).toFixed(2); if(levelHeightPercentage <= .99) { if(!_verticalScrollVisible) { _verticalScroll.style.display = "inline-block"; _verticalScrollVisible = true; ...
[ "function setScrollbar(){\n\t\t\tvar $appendEl=o.scrollAppendTo||$root;\n\t\t\t$scrollBar=$('<div />', {\"class\":\"horizontal-slider\"}).appendTo($appendEl);\n\t\t\t$handle=$('<div />', {\"class\":\"horizontal-handle hover\"}).appendTo($scrollBar);\n\t\t\trefreshScrollbar();\n\t\t}", "function sizeScrollbar() {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }