query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Remove a bucket. __Arguments__ `bucketName` _string_ : name of the bucket `callback(err)` _function_ : `err` is `null` if the bucket is removed successfully.
removeBucket(bucket, cb) { if (!validateBucketName(bucket)) { throw new errors.InvalidateBucketNameException('Invalid bucket name: ' + bucket) } this.bucketRequest('DELETE', bucket, cb) }
[ "removeBucket(bucketName, cb) {\n if (!isValidBucketName(bucketName)) {\n throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucketName)\n }\n if (!isFunction(cb)) {\n throw new TypeError('callback should be of type \"function\"')\n }\n var method = 'DELETE'\n this.mak...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populates the world with dead organisms
populateDead() { let tag = 0; this.organisms = []; for (let i = 0; i < this.grid.length; i++) { let temp = new Organism(tag, i); temp.alive = false; this.organisms.push(temp); tag++; } }
[ "function populateGameWorld () {\n\t\n\ttry {\n\t\t\n\t\toBoundaryClass.addBoundaryObjects();\n\t\toPlatformClass.addPlatformObjects();\n\t\toSpawnPointClass.addSpawnPointToEveryStaticPlatform();\n\t\toZoneDeathClass.addDeathZoneToBottomOfWindow();\n\t\toZoneWinClass.addWinZoneToTopOfWindow();\n\t \n\t}\n\tcatch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the new alert input is valid
function validAlert(){ // Check for alert text if($('#ae-new-content').val().trim() == ""){ alert('Alert text is required'); return false; } // Check for valid start date else if($('#ae-new-start').val() == ""){ alert('A start date is required'); return false; } // Check for valid end date else if($('#a...
[ "function checkAlterExamForm() {\n if (document.getElementById(\"input-title\").value.length == 0) {\n makeAlert(\"div-title\", \"alter_exam_alert\", \"考试标题不能为空!\", \"\");\n document.getElementById(\"div-title\").classList.add(\"has-error\");\n return false;\n } else if (document.getEleme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility functions for parsing metadata, migration data, and country code
function parseMetadata(d){ return { iso_a3: d.ISO_A3, iso_num: d.ISO_num, developed_or_developing: d.developed_or_developing, region: d.region, subregion: d.subregion, name_formal: d.name_formal, name_display: d.name_display, lngLat: [+d.lng, +d.lat] } }
[ "function parseCountryCodes() {\n Papa.parse(\"assets/data/country-codes.csv\", {\n download: true,\n complete: function (results) {\n createCountryOptions(results.data);\n }\n });\n}", "parseHRecord(data){\n\t\t\n\t\t\tlet datasource = data.substr(0, 1);\n\t\t\tlet subtype =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcion to confirm order if there is an order clear storage, alert of order being placed else alert them that they have no order
function placeOrder() { if (checkStorage()) { sessionStorage.clear(); alert("Order placed!") } else { alert("You have no order.") } }
[ "function confirmOrder() {\n \n inquirer.prompt([\n {\n type: \"confirm\",\n name: \"orderPlace\",\n message: \"Please confirm the order above.\",\n default: false\n }\n \n ]).then(function(order) {\n if (order.orderPlace == false)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called by the panorama's initialized event handler in response to a link being followed. Updates the location of the vehicle marker and the center of the map to match the location of the panorama loaded by following the link.
function moveCar() { currentLatLng = panoMetaData.latlng; carMarker.setLatLng(currentLatLng); map.panTo(currentLatLng); /* Now retrieve the links for this panorama so we can * work out where to go next. */ svClient.getNearestPanorama(panoMetaData.latlng, function(svData) { ...
[ "_onAnchorFound(anchorMap) {\n if (anchorMap.type != 'plane') {\n return;\n }\n\n var worldCenterPosition = [\n anchorMap.position[0] + anchorMap.center[0],\n anchorMap.position[1] + anchorMap.center[1],\n anchorMap.position[2] + anchorMap.center[2],\n ];\n this.arPlaneRef.setNati...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adding item picture to js file
async function picItem(item){ importName = path.basename(item[0]).toLowerCase().split(".jpg")[0].replace(/\s/g, ''); await exec("copy " + item[0] + " \"./kigaruweb/src/pictures/food/" + importName + '.jpg\"') await exec("py picture.py " + item[1] + " " + importName + " " + item[2]); }
[ "static get addPostImage() { return require('snapshindig/assets/add.png') }", "function createItem(img){\n componentList.push( \n {\n original: img[\"sourcejpg\"],\n thumbnail: img[\"sourcejpg\"]\n }\n )\n }", "addImage() {\n }", "function handlerPic() {\n document.getElementById('h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Internal: Filter and find all elements matching the selector. Where $.fn.find only matches descendants, findAll will test all the top level elements in the jQuery object as well. elems jQuery object of Elements selector String selector to match Returns a jQuery object.
function findAll(elems, selector) { var results = $() elems.each(function() { if ($(this).is(selector)) results = results.add(this) results = results.add(selector, this) }) return results }
[ "function findAll(elems, selector) {\n return elems.filter(selector).add(elems.find(selector));\n }", "function findAll (elems, selector) {\n return elems.filter(selector).add(elems.find(selector))\n}", "function findAll(elems, selector) {\n return elems.filter(selector).add(elems.find(selector));\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add page title and page URL to the tracked variables
function addStandardPageVars() { // Website base url tracking (eg. mydomain.com) this.addPageVar("site", window.location.hostname); // Page URL tracking (eg. home.html) this.addPageVar("url", window.location.pathname); // Page title tracking this.addPageVar("title", enc...
[ "updateGeneralPageData() {\n document.title = `${this.props.lang.about.title} | ${window.expressConfig.appName} ${window.expressConfig.env}`;\n window.events.emit('breadcrumbs', [\n {\n \"name\": this.props.lang.home.title,\n \"url\": \"/\"\n },\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loadScript tries to load the configured script. But if it can't, it falls back to the VCS copy of the script.
function loadScript(script) { // This happens if the secret volume is mis-mounted, which should never happen. if (!fs.existsSync(script)) { console.log("prestart: no script found. Falling back to VCS script") return fs.readFileSync(vcsScript, 'utf8') } var data = fs.readFileSync(script, 'utf8') if (da...
[ "loadScriptFromModule(context, script) {\n if (script) {\n return script;\n }\n this.debug('Attempting to load script from configuration module or node module');\n const moduleName = this.tool.config.module;\n const fileName = upperFirst_1.default(camelCase_1.default(co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recursive function used to break up description into list of lines
function FoldDescription(text, textArray) { var lineLength = 80; var eachLine = ""; textArray = textArray || []; if (text == null) return textArray; // If last bit of text just add it to list. if (text.length <= lineLength) { eachLine = text.trim(); if (eachLine...
[ "static process_lines(lines)\r\n {\r\n if (DEBUG) console.log(`Processing ${lines.length} lines`);\r\n let doc = new Document();\r\n let definition = null;\r\n // Lists\r\n let actual_list = null;\r\n let actual_level = 0;\r\n // Main loop\r\n for (const [i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::WAFv2::WebACL.JsonMatchPattern` resource
function cfnWebACLJsonMatchPatternPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnWebACL_JsonMatchPatternPropertyValidator(properties).assertSuccess(); return { All: cdk.objectToCloudFormation(properties.all), IncludedPaths: cdk.l...
[ "function CfnWebACL_JsonMatchPatternPropertyValidator(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 object,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The PortPointer initializes each source with the same unique itemId. These are then increased per port. So their id's stay in sync. This does give the restriction both ports should give an equal amount of output. Which is err. pretty errorprone :) Or at least it depends per node, whether it is.
function PortPointer(identifier) { // little more unique than just a number. this.id = PortPointer.uid(identifier ? identifier + '-' : ''); // the idea of this counter is increment this.counter = 0; //this.cols = cols; this.store = {}; }
[ "_count_ports_workaround ()\n\t{\n\t\t// first we fill this._poss with just the ports\n\t\tthis._patch.split(\"\\n\").forEach((line)=>{\n\t\t\tlet m = line.match(/^#X connect (.*);$/);\n\t\t\tif (!m) return;\n\t\t\tlet d = m[1].split(\" \");\n\t\t\tlet source = parseInt(d[0]);\n\t\t\tlet outlet = parseInt(d[1]);\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the actual position of the particleNode in the Scene by using the sceneMatrix
getPosition(sceneMatrix) { const pos = vec3.transformMat4(vec3.create(), vec3.create(), sceneMatrix); return pos; }
[ "getScenePosition() {\n\t\t\treturn {\n\t\t\t\tx: this.x + .5 - gridWidth / 2,\n\t\t\t\tz: this.z + .5 - gridWidth / 2\n\t\t\t};\n\t\t}", "getPosition()\n {\n let pos = vec3.create();\n mat4.getTranslation(pos, this.transform);\n return pos;\n }", "position() {\n return VrMath.getT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filling out all the fields of "5 Days" with the values and units
function fillFields(obj) { //Using my main function which gets beginning of each day and delcaring it to variable var myDate = getSecondHourOfEachDay(obj); //showing all the blocks in five days wrapper for (var i = 1; i < 6; i++) { document.getElementById("day" + i).hidden = false; } //Filling out Day...
[ "function calculateDaily() {\n gramsPerDay.value = (amount.value * timesPerDay.value);\n dailyGrams.value = (amount.value * timesPerDay.value);\n}", "function setUpNewTourDailyTotalsSection() {\n lastDate = new Date(getValue(\"N46\"));\n newDate = new Date(lastDate);\n newDate.setDate(lastDate.getDate()+1);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getShow Callback for GET /files/:id Retrieves a document based on the document's id Header params: xtoken: connection token created when user signsin Get parameters: id: document id
async function getShow(req, res) { const key = req.headers['x-token']; // get token from header const userId = await redisClient.get(`auth_${key}`); const fileId = req.params.id; let user = ''; // find and store user if (userId) user = await dbClient.client.collection('users').findOne({ _id: ObjectId(userId)...
[ "function showDocument() {\n\tvar keys = docmanager_pkeys_values;\n\tvar tableName = docmanager_tableName;\n\tvar fieldName = docmanager_fieldName;\n\tvar fileName = docmanager_autoNamedFile;\n\tDocumentService.show(keys, tableName, fieldName, fileName, '', true, 'showDocument', {\n callback: function(fileTr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the given user latitude and longitude is within the radius of the boat's longitude and latitude
function inArea(radius, boatLat, boatLong, userLat, userLong) { return differenceInLatitudeLongitude(userLat, userLong, boatLat, boatLong) < radius; }
[ "function inRadius (long, lat){\n return true;\n}", "isInRadius(inLat, inLon, rad) {\n\n var distance = geolib.getDistance({latitude: inLat, longitude: inLon}, {latitude: this._lat, longitude: this._lon});\n\n //console.log(this.id, \" \", this._lat, \" \", this._lon, \" \", distance);\n if(distance > (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
default config for a history button group: undo + redo
get historyButtonGroup() { return { type: "button-group", subtype: "history-button-group", buttons: [this.undoButton, this.redoButton], }; }
[ "function history(config = {}) {\n return [\n historyField_,\n historyConfig.of(config),\n EditorView.domEventHandlers({\n beforeinput(e, view) {\n let command = e.inputType == \"historyUndo\" ? undo : e.inputType == \"historyRedo\" ? redo : null;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Boolean$prototype$lte :: Boolean ~> Boolean > Boolean
function Boolean$prototype$lte(other) { return typeof this === 'object' ? lte(this.valueOf(), other.valueOf()) : this === false || other === true; }
[ "function Boolean$prototype$lte(other) {\n return typeof this === 'object' ?\n lte (this.valueOf (), other.valueOf ()) :\n this === false || other === true;\n }", "lte(other) { return this.cmp(other) <= 0; }", "function Nothing$prototype$lte(other) {\n return true;\n }", "function Null$proto...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
elements array (or arraylike object) of HTML elements className class name to test for include if true, only return elements with given className; if false, only return elements without given className
function filterByClass(elements, className, include) { var results = []; for (var i = 0; i < elements.length; i++) { if (hasClass(elements[i], className) == include) results.push(elements[i]); } return results; }
[ "function filterByClass(elements, className, include) {\n\t\tvar results = [];\n\t\tfor (var i = 0; i < elements.length; i++) {\n\t\t\tif (hasClass(elements[i], className) == include)\n\t\t\t\tresults.push(elements[i]);\n\t\t}\n\t\treturn results;\n\t}", "function containsAllClasses (classesToShow, allElementClas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle changes in total energy range through UI
handleChangeTotalEnergyRange(e) { this.totalEnergyEntry.value = parseFloat( e.target.value.replace(",", ".") ).toFixed(2); this.updateValues(); }
[ "updateEnergy() {\n this.kineticEnergyProperty.value = 0.5 * this.massProperty.value * this.velocityProperty.value.magnitudeSquared;\n this.potentialEnergyProperty.value = -this.massProperty.value * ( this.positionProperty.value.y - this.referenceHeightProperty.value ) * this.gravityProperty.value;\n this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace text in current search result.
replace(textToReplace) { if (this.index === -1) { return; } this.searchModule.replaceInternal(textToReplace); }
[ "replaceAll(findTerm, replaceWith, caseSensitive = true) {\n this.findOptions = new FindOptions(this.pm, findTerm, replaceWith, caseSensitive)\n\n let selections = this.findOptions.results(),\n selection, transform,\n transforms = [];\n\n while(selection = selections.shift()) {\n this.pm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add a button to the page and track clicks as likes
function addLikeBtn(){ var likeBtn = document.createElement('a'); likeBtn.classList.add('likeBtn'); likeBtn.href = '#like'; likeBtn.innerHTML = '&hearts;'; var container = document.querySelector('.actions'); container.insertBefore(likeBtn, container.firstElementChild); likeBtn.addEvent...
[ "function ListebToLikeButton() {\n const toyCollection = document.getElementById(\"toy-collection\");\n toyCollection.addEventListener(\"click\", increseLikes);\n}", "function addLike(e) {\n e.preventDefault()\n\n //Grab elements\n const captionId = parseInt(this.dataset.id)\n const memeId = parseInt(this.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
writeToFunmoneyDatabase("mikey",.25); writeToFunmoneyDatabase("yoko",.25); ////////// Write Money to fun money Database
function writeToFunmoneyDatabase(who,amount){ let junk = ''; let junkB = ''; let lostAmount = amount * -1; mikeyHistory = historyAll["mikey"].split(','); yokoHistory= historyAll["yoko"].split(','); amount = parseFloat(amount); lostAmount = parseFloat(lostAmount); if (who == "mike...
[ "function writeToFunmoneyDatabase(who,amount){\r\n let junk = '';\r\n mikeyHistory = historyAll[\"mikey\"].split(',');\r\n yokoHistory= historyAll[\"yoko\"].split(',');\r\n amount = parseFloat(amount);\r\n if (who == \"mikey\"){\r\n mikeyMoney = mikeyMoney * 1;\r\n mikeyMoney += amount;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
USE TEMPLATE LITTERALS TO PULL CARD DATA AND LOOP OVER TO BUILD OUT CARDS HELPER FUNCTION TO CREATE CARD TEMPLATE
function cardTemplate(cards){ // RETURN TEMPLATE LITERAL return ` <div class="card-base" data-carmaker="${cards.carMaker}"> <div class="card-front"> <img src="${cards.frontImg}"/> <div class="name-back"> <h3>${cards.name}</h3> ...
[ "function generateCards() {\n //for each team member in myTeam array, generate a template literal with their info\n for (const member of myTeam) {\n //get role of current member\n const role = member.getRole();\n //assign icons and special category for each role\n let icon;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the names of all selected groups.
function getSelectedGroups () { let groups = [] $('.nl-group').each((i, el) => { if (el.checked) { groups.push(el.id.split('checkbox-')[1]) } }) return groups }
[ "get groupNames() {\n return this.getListAttribute('group_names');\n }", "function getAllGroupNames() {\n return new Promise(resolve => {\n var groups = [];\n // Establish client POSTGRESQL\n const client = PostgreSQL.CreateClient();\n client.connect(function(err) {\n if (err) throw er...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clears each category div, and resets each category index to 0
function clearList() { for (i in cats) { var div = document.getElementById(i) while (div.hasChildNodes()) { var nodes = div.childNodes; div.removeChild(nodes[0]); } } drinkIdx = 0; breakfastIdx = 0; lunchIdx = 0; dinnerIdx = 0; sweetIdx = 0; clearTotal(); }
[ "function clearCatLists() {\n $('#catdTitle').remove();\n}", "_reset() {\r\n this.tag('VODCategoryList').setIndex(0)\r\n }", "function clearCategList() {\n matchedList = []\n $(\".categ_list\").empty()\n}", "function clearHtml() {\n document.querySelector('.cat-container').innerHTML = '';\n}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enables a mutation operator
function enableOperator(ID) { //Enable all operators if(!ID){ var success = operator.enableAll(); if (success) console.log("All mutation operators enabled."); else console.log("Error"); }else{ //Enable operator ID var success = operator.enable(ID); if (success) console....
[ "setMutated() {\n this._mutated = true;\n }", "setMutated() {\n this._mutated = true;\n }", "withMutations(func) {\n return func(this.copy().mutable());\n }", "function disableOperator(ID) {\n //Disable all operators\n if(!ID){\n var success = operator.disableAll()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loadCurrentOrDefaultState is a private method Description: On page Refresh, if state Url is present, it navigates to corresponding State, else to Home Page
function loadCurrentOrDefaultState() { var currentStateUrl = $location.$$url || '/home'; var currentStateUrlAndQuery = currentStateUrl.split('?'); var query = currentStateUrlAndQuery[1]; currentStateUrl = currentStateUrlAndQuery[0]; var currentStateName ...
[ "function setStateOnPageLoad() {\n console.log(\"ran\");\n var urlParams = new URLSearchParams(window.location.search);\n var hasInitialState = urlParams.has(\"initial\");\n\n if (!hasInitialState) {\n return;\n }\n\n var stateFromParam = urlParams.get(\"initial\");\n activateState(stateFr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Collects a summary of all entities which are going to be deleted and modified during the Project deleting: Project Config file, Project source files, current Device Group, the Product which contains current Device Group (if it has this one Device Group only) flagged Deployments and assigned Devices of the current Devic...
_collectDeleteSummary(summary, options) { summary.configs.push(this._projectConfig); if (options.files || options.all) { if (Utils.existsFileSync(this._projectConfig.deviceFile)) { summary.sourceFiles.push(this._projectConfig.deviceFile); } if (Utils.e...
[ "_collectDeleteForceSummary(summary, options) {\n const DeviceGroup = require('./DeviceGroup');\n return new DeviceGroup().listByProduct(this.id).\n then(devGroups => this._helper.makeConcurrentOperations(devGroups,\n (devGroup) => devGroup._collectDeleteSummary(summary, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clipPoint(point, point, rect) Uses a simplified LianBarsky algorithm to determine the clip point of a line (specified by two points) within a rectangle.
function clipPoint(p1, p2, rect){ var p = [p1.x - p2.x, p2.x - p1.x, p1.y - p2.y, p2.y - p1.y]; var q = [p1.x - rect.left, rect.right - p1.x, p1.y - rect.top, rect.bottom - p1.y]; var u1 = 0; var u2 = 1; d3.range(4).forEach(function(k){ ...
[ "function clipLine(listener) {\n var point0, // previous point\n c0, // code for previous point\n v0, // visibility of previous point\n v00, // visibility of first point\n clean; // no intersections\n return {\n lineStart: function() {\n v00 = v0 = false;\n clean...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::WAFv2::WebACL.Rule` resource
function cfnWebACLRulePropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnWebACL_RulePropertyValidator(properties).assertSuccess(); return { Action: cfnWebACLRuleActionPropertyToCloudFormation(properties.action), CaptchaConfig: cfnWeb...
[ "function cfnWebACLRulePropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnWebACL_RulePropertyValidator(properties).assertSuccess();\n return {\n Action: cfnWebACLActionPropertyToCloudFormation(properties.action),\n Priority: cdk...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
render the component based on current or selected mode
render(){ var modeComponent = <ReadProductsComponent changeAppMode={this.changeAppMode} />; switch(this.state.currentMode){ case 'read': break; case 'readOne': modeComponent = <ReadOneProductComponent id={this.state.id} ...
[ "render () {\n\n var modeComponent =\n <ReadComponent\n changeAppMode={this.changeAppMode} />;\n\n switch (this.state.currentMode) {\n case 'read':\n break;\n case 'readOne':\n modeComponent = <ReadOneComponent sweepId={this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setup Footer and Map Sections ======================================================================= Description: Creates footers and updates map layers for elements in input list.
function setupFooterAndMapSections(sectionsToUpdate, type) { for (let i = 0; i < sectionsToUpdate.length; i++) { // Update Footer and Map (if update was successful) switch (sectionsToUpdate[i]) { case 'countryPOI': footer.addFooterSection(type, 'cou...
[ "buildFooter() {\n this.footer = document.createElement('footer');\n this.footer.appendChild(this.buildItemCounter());\n this.footer.appendChild(this.buildActivityNotifier());\n }", "function setMapAndLayers() {\n if (_options.mapDivId) {\n var map = _config.getMa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sorts announcements based on current month
function sortAnnouncement() { let numVisible = dates.length; // If the date is part of the current month then set as visible, if not then invisible for (let j = 0; j < dates.length; j++) { if (dates[j].classList.contains('month_' + curMonth)) { $(dates[j]).show('slow'); dates[j].classList.add('visible'); ...
[ "function sortTodos() {\n for (var date in todos_by_month) {\n todos_by_month[date].sort(function(a, b) {\n return a.finished - b.finished;\n });\n }\n }", "_sortDataByDate() {\n this.data.sort(function(a, b) {\n let aa = a.Year * 12 + a.Month;\n let bb = b.Year * 12 + b.Month...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get blacklist() : string getter for the concatenated string blacklist
get blacklist(){ return this._blacklist; }
[ "function getBlacklist()\n {\n return blacklist;\n }", "function get_blacklist(){\n blacklist == [];\n blacklist_as_input = '';\n chrome.storage.sync.get('blacklist', function(item){\n if (item[\"blacklist\"] === undefined){\n blacklist = [];\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Labeled Point Drawing function
function labeled_point(ctx,x_p,y_p,x_l,y_l,pointsize, l_text){ ctx.moveTo(x_p,y_p) if(pointsize>0){ ctx.arc(x_p, y_p, pointsize, 0, 2 * Math.PI, false); } ctx.fillText(l_text, x_p+x_l, y_p+y_l) }
[ "function labeled_point(ctx,x_p,y_p,x_l,y_l,pointsize, l_text){\n ctx.moveTo(x_p,y_p)\n if(pointsize>0){\n ctx.arc(x_p, y_p, pointsize, 0, 2 * Math.PI, false);\n }\n ctx.fillText(l_text, x_p+x_l, y_p+y_l)\n}", "function drawPointLabels() {\n var point = 1;\n var delta = 1;\n var max = Math.round(c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates fouls stats Invoked: F Purpose: increases fouls commited
function updateFoulsCommited() { var totalFolComm = 0; //IF team 1 is in possession, foul is commited by team 2, therefore add info to team 2 if(currTeam == 1) { T2.foulsBy += 1; totalFolComm = T1.foulsBy + T2.foulsBy; var t2_bar = Math.floor((T2.foulsBy / totalFolComm) * 100); var t1_bar = 100 - t2_bar...
[ "function updateFouls(who) {\n\tvar fouls = AWAY_FOUL;\n\tif(who == HOME)\n\t\tfouls = HOME_FOUL;\n\n\tfouls = fouls % 10;\n\tonLED('#' + who + '_foul_count', SMALL_NUMBERS[fouls])\n}", "function updateStats() { updatePrimaryStats(); updateOther(); updateSecondaryStats(); updateTertiaryStats(); }", "function up...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Switch to hands symbols mode or objects symbols mode
function switchGameSymbols() { rockPaperScissors.setGameSymbolsMode(rockPaperScissors.getGameSymbolsMode() == 1 ? 2 : 1); return checkGameSymbols(); }
[ "function pen() {\n mode = \"pen\"; \n console.log(\"mode: \" + mode);\n }", "function toggleSymbols(){\n var keyboard = document.getElementById('keyboard');\n if (keyboard.classList.contains('show_symbols')){\n keyboard.classList.remove('show_symbols');\n } else {\n keyboard.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
column definitions checks componentdidmount and instantiates tabulator, manages height and other aspects of table as well
componentDidMount() { // instantiate Tabulator when element is mounted this.tabulator = new Tabulator(this.el, { height: "300px", data: this.tableData, // link data to table reactiveData: true, // enable data reactivity columns: this.columns, // define table columns });...
[ "updateTableSizes() {\n if (this.wrapper) {\n const tableWidth = this.wrapper.offsetWidth;\n const columnsDimension = this.setInitialColumnWidths(tableWidth - 10);\n this.setState({\n columnsDimension,\n tableWidth,\n });\n }\n }", "updateTableSizes() {\n if (this.wrapp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name this function so that class name will come up in debugger, etc. Note the checklistCollection will be passed for extensionCollection into parent so it can do upserts Also need itemsCollections to check for owners of items
function UpdateGPOchecklist(collections,session,config) { //Run the parent constructor first // "_id" is the updateKey used for updating checklists // "checklist" is just updateName which is text used on errors, logging, etc this.__parent__.constructor.call( this, '_id', 'checklist', //D...
[ "\"groceryLists.update\"(_id, item) {\n if (!this.userId) {\n throw new Meteor.Error(\"Not authorized\");\n }\n\n new SimpleSchema({\n item: {\n type: String,\n min: 1,\n required: true\n }\n }).validate({\n item\n });\n\n GroceryLists.update(\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Automatically calculate `mass` to body's polygon area.
autoMass() { this.mass = Math.sqrt(Op_1.Polygon.area(this)) / 10; return this; }
[ "updateMassProperties() {\n const halfExtents = Body_updateMassProperties_halfExtents;\n this.invMass = this.mass > 0 ? 1.0 / this.mass : 0;\n const I = this.inertia;\n const fixed = this.fixedRotation; // Approximate with AABB box\n\n this.updateAABB();\n halfExtents.set((this.aabb.upperBound.x -...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::Serverless::Api.CorsConfiguration` resource
function cfnApiCorsConfigurationPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnApi_CorsConfigurationPropertyValidator(properties).assertSuccess(); return { AllowCredentials: cdk.booleanToCloudFormation(properties.allowCredentials), ...
[ "function cfnHttpApiCorsConfigurationObjectPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnHttpApi_CorsConfigurationObjectPropertyValidator(properties).assertSuccess();\n return {\n AllowCredentials: cdk.booleanToCloudFormation(prop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All calls to countShowing should be protected, and only called within a callback from getDropListChildren
function countShowing (dropList) { let dropListItems = dropList.children; let n = 0; for (var i = 0; i < dropListItems.length; i++) { if (dropListItems[i].classList.contains("show")) { n++; } } return n; }
[ "_updateItemCount() {\n this.visibleItems = this._getFilteredItems().length;\n }", "_getItemCount() {\n return this.options.length + this.optionGroups.length;\n }", "function CustomCombo_getVisibleItemsCount()\n{\t\n\tvar o=this,items=o.menu.items,len=items.length,n=0\n\tfor (var i=0;i<len;i++)\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
blockRendererFn is run every time a block is rendered
blockRendererFn() { return { component: EditorLineNumber } }
[ "incrementBlock() {\n \n this.position++;\n this.render();\n \n }", "handleChange(_, changes) { if (this.blockMode) this.render(changes); }", "function update() {\n drawBlock();\n }", "function BlockRenderer(blockset, renderer, resolution) {\n var gl = renderer.co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=====================================================================\ void forget(block) \=====================================================================
function forget(block) { // Existence filter if (!block) return; // Otherwise forget block Blockly.Events.disable(); block.dispose(true); workspace.undoStack_ = workspace.undoStack_.filter((e) => e.blockId !== block.id); workspace.redoStack_ = workspace.redoStack_.filter((e) => e.blockId !== block.id); Blockly...
[ "end() {\n this.cancel();\n this.callback();\n }", "halt() {\n if (this.continuing_) {\n this.completeContinue_(false);\n }\n }", "drop() {\n assert(this.pending);\n this.pending = null;\n }", "_cleanup() {\n this.readable = false;\n delete this._current;\n delete this._wait...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dumps rooted objects, only available in native platforms
dumpRoot() {// N/A in web }
[ "function dump(object) {\n console.log(JSON.stringify(object, null, 2))\n}", "dumpObject(objIn) {\n return util.inspect(objIn, { depth: 1 });\n }", "function dump() {\n var elm;\n\n elm = d.find(\"dump\");\n if(elm) {\n elm.innerText = JSON.stringify(g.body, null, 2);\n }\n }", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the bullethit sprite
createSprite() { this.sprite = this.scene.add.sprite(this.x, this.y, 'bullet-hit'); this.sprite.setScale(SCALE); this.sprite.on('animationcomplete', this.animComplete.bind(this), this); this.sprite.setOrigin(0.5, 0.8); this.sprite.setRotation(this.flags.dir - Math.PI / 2); }
[ "createBruce() {\n\n this.bruce = new BruceSprite({\n scene: this,\n x: this.levelData.start.x,\n y: this.levelData.start.y,\n textureKey: Textures.SPRITE_ATLAS_ID,\n frameKey: Textures.SPRITES.BRUCE + '0.png'\n });\n\n this.physics.add.exi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets whether an element has a valid tabindex.
function hasValidTabIndex(element) { if (!element.hasAttribute('tabindex') || element.tabIndex === undefined) { return false; } var tabIndex = element.getAttribute('tabindex'); // IE11 parses tabindex="" as the value "-32768" if (tabIndex == '-32768') { return false; } return...
[ "function hasValidTabIndex(element) {\n if (!element.hasAttribute('tabindex') || element.tabIndex === undefined) {\n return false;\n }\n\n var tabIndex = element.getAttribute('tabindex');\n return !!(tabIndex && !isNaN(parseInt(tabIndex, 10)));\n}", "function hasValidTabIndex(element) {\n if (!element.has...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LokiEventEmitter is a minimalist version of EventEmitter. It enables any constructor that inherits EventEmitter to emit events and trigger listeners that have been added to the event through the on(event, callback) method
function LokiEventEmitter() { }
[ "function LokiEventEmitter() {}", "function EventEmitter() {\n\n\tvar self = this\n\n\tOriginalEventEmitter.call(self)\n\n\t// 'emit' property cannot be deleted because it is non-writable by default\n\t// so user code cannot avoid entering the sandbox\n\n\tObject.defineProperty(this, 'emit', {\n\t\tenumerable: tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get provider uuid from module
function getProviderUUId(module) { const metaData = getClassMetadata(constant_1.TAGGED_CLS, module); if (metaData && metaData.uuid) { return metaData.uuid; } }
[ "function getProviderId(module) {\n const metaData = getClassMetadata(constant_1.TAGGED_CLS, module);\n if (metaData && metaData.id) {\n return metaData.id;\n }\n}", "async get_provider(uuid) {\n return await this.settings.get('signalprovider', uuid, false);\n }", "function provider(st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CSI 1 ; 1 ; n '_' : select audio object. n = audio number; 164
selectAudioObject(n, asSequence = false) { return this._seqOrWrite(`${CSI}1;1;${n}_`, asSequence); }
[ "defineAudioObject(n, type, encoded, asSequence = false) {\n return this._seqOrWrite(`${CSI}1;0;${n};${type};${encoded}_`, asSequence);\n }", "function getImageAudio_DataIndex() {\n\treturn 4; \n}", "function cambiarAudio3(){\n\taudioElement.setAttribute('src', '../assets/audio/mpyc2/m8/p3.mp3');\n\ta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the document at the file path
function getDocument(filePath) { return templateCache[filePath] = templateCache[filePath] || fs.readFileSync(filePath).toString(); }
[ "read (path) {\n const normPath = this.normalizePath(path);\n return this._documents.get(normPath) || \"\";\n }", "_getDocument(url) {\n const resolvedUrl = this._resolveUrl(url);\n let document = this._analyzedDocuments.get(resolvedUrl);\n if (document) {\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change the content of the analyser panel. The id must specify the id of the element (without the 'analyser' before). E.g. if the element has the id 'analyserhelp', you will have to pass the id 'help' to the function.
function toggleAnalyserPanel(id) { var possibleIDs = ['help', 'contact', 'imprint', 'terms']; if (lastContent == '' || lastContent != id) { toggled = false; } lastContent = id; // Hide all content of the help submenus document.getElementById('analyser-help').style.display = 'none'; document.getElementById('...
[ "function showElementByIdAndRefreshContent(elementId, data, contentAppender, length = 500) {\n const element = $(elementId);\n element.show(length);\n contentAppender(element, data);\n}", "function showContent(id,content){\n\tdocument.getElementById(id).style.display='block';\n\tdocument.getElementById(i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
step1 declare a variable that is a counter with a starting value of 20 /step2 give the box5 element in the html document a function when moving around the mouse over it onmousemove /step3 declare the function in your javascript file (here) /step4 add 1 to the counter every time the funciton is triggered /step5 create a...
function mouseMove2(){ header1.style.fontSize=counter1-- +"px"; }
[ "function fifthFunction() {\n var header = document.querySelector(\"#header\");\n if (counter > 20) {\n counter -= 0.5;\n }\n\n console.log(counter);\n header.style.fontSize = counter + \"px\";\n}", "function getBigger() {\n size += 2;\n document.getElementById(\"text1\").style.fontSize = si...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by LUFileParsermoreQuestionsBody.
exitMoreQuestionsBody(ctx) { }
[ "exitMoreQuestion(ctx) {\n\t}", "visitMoreQuestionsBody(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "exitQnaAnswerBody(ctx) {\n\t}", "exitMultiLineAnswer(ctx) {\n\t}", "parse() {\n for (var i = 0; i < this.document.body.childNodes.length; i++) {\n var node = this.document.body.child...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset the bouncing animation to the marker of the currently highlighted sports center.
function resetHighlightedSportsCenterMarkerBouncingAnimation() { google.maps.event.addListenerOnce(mMap, 'idle', function (event) { setTimeout(function () { // Check whether the sports center is still highlighted after a few // hundred milliseconds. if (mHighlightedSportsCenterId != null) {...
[ "function setBounce(marker) {\r\n if (marker.getAnimation() !== null) {\r\n marker.setAnimation(null);\r\n } else {\r\n marker.setAnimation(google.maps.Animation.BOUNCE);\r\n setTimeout(function() {\r\n marker.setAnimation(null);\r\n }, 1400);\r\n }\r\n }", "function bounce(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests whether an element is a tag or not.
function isTag(elem) { return elem.type === ElementType.Tag || elem.type === ElementType.Script || elem.type === ElementType.Style; }
[ "function isTag(elem){return elem.type===ElementType.Tag||elem.type===ElementType.Script||elem.type===ElementType.Style;}", "function isTag(elem) {\n return elem.type === ElementType.Tag || elem.type === ElementType.Script || elem.type === ElementType.Style;\n}", "function isTag(elem) {\n\t return (elem.typ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
======================================== Ajax function populate products againsist selected category
function ajaxProductAction(category) { var categoryId = category.value; var ajaxRequest; // The variable that makes Ajax possible! var queryString =""; var optionValues = ""; if(categoryId != "") { try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ ...
[ "function initAjaxProductsByCategory() {\n $('[data-emthemesmodez-products-by-category]').each((i, placeholder) => {\n request($(placeholder), 'emthemes-modez/category/ajax-products-by-category-result', 'emthemesmodezProductsByCategory');\n });\n }", "function showProductsByCategory(ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
untidy name format "fullName(code)" removes "(code)"
function getTidyName(name) { return name.split("(")[0]; }
[ "function formatedName(name){\n name = name.substring(0, name.lastIndexOf(\".\"));\n if(name.indexOf(\"(\") > 0){\n name = name.substring(0, name.indexOf(\"(\"));\n }\n name = name.replace(/_/g, \" \");\n return name; \n}", "function format_name(name) {\n\t\treturn name.replace(/[ \\(\\)]/g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SeatShape used for all kind of seats shapes
function SeatShape(paper, options){ var self = this; this.paper = paper; this.shapeObject = options.shapeObject; this.seatNumber = options.seatNumber; this.shapesArr = options.shapesArr; this.changeCallback = options.changeCallback; this.selectCallback = options.selectCallback; this.dese...
[ "function Shape() {}", "function NoteShape() { }", "function CardShape() { }", "function Shape(n,s){\n this.name = n;\n this.sides = s;\n}", "function facSeat(number, align, focus, bgColor) {\n if (bgColor === null || bgColor === undefined) bgColor = \"burlywood\";\n if (typeof align ===...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UPDATE LIST add a collaborator, user needs to be the owner
"groceryLists.updateUsers"(_id, collaboratorId) { if (!this.userId) { throw new Meteor.Error("Not authorized"); } GroceryLists.update( { _id, userId: this.userId }, { $push: { collaborator: collaboratorId }, $set: { lastUpd...
[ "function addCollaboratorToCreateBoardModel(collInfo) {\n var parentUl = $('#panel-collaborators').children('ul');\n\n // Add to the collaborator list..\n var collUser = {\n username: collInfo.username,\n email: collInfo.email,\n right: \"MODIFY\"\n };\n collaboratorList.push(col...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove a bookmark from the list
function delBookmark(evt){ var lista = getListaBookmarks(true); var div = evt.target.parentNode; var divs = div.parentNode.childNodes; var num; for(num=0; div!=divs[num] && num<divs.length; num++) continue; lista.splice(num, 1); div.parentNode.removeChild(div); saveListaBookmarks(lista); evt.stopPropagation(...
[ "static removeBookmark(url) {\n //getting all children (bookmarks) of the bookmarklist\n let bookmarks = bookmarksList.children;\n for (let i = 0; i < bookmarks.length; i++) {\n //getting the data-id (that holds the url of the bookmark) of the delete button of the current \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=================== Phrase Box History Table ===================
function phraseBoxKeypress(e) { // run on each keystroke inside text box - onkeydown="navHistory(event.keyCode) - from index.html var phrPos, pBox phr = sVal() // get phrase from SearchField pBox = document.getElementById("phraseBox") phrPos = sHistory.indexOf(phr) // position of phrase in History array swi...
[ "function dom_history_table(history) {\n\t\tvar table = document.createElement('table');\n\t\ttable.className = 'row-highlight';\n\t\ttable.width='100%';\n\t\tvar thead = table.appendChild(document.createElement('thead'));\n\t\t[['', null], ['Post', 5], ['Note', 5], ['Body', 60], ['Edited By', 10], ['Date', 6], ['\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getSkipWords() Get the common words to ignore.
function getSkipWords() { if($('.ignore-common-words').is(':checked')) { return getIgnoreKeywordsHash(); } return {}; }
[ "function getIgnoreKeywords_allWords_W_Words() {\n\t\treturn [\n\t\t\t'wait',\n\t\t\t'waited',\n\t\t\t'waiting',\n\t\t\t'waits',\n\t\t\t'want',\n\t\t\t'was',\n\t\t\t'wasn\\'t',\n\t\t\t'way',\n\t\t\t'ways',\n\t\t\t'we',\n\t\t\t'we\\'d',\n\t\t\t'we\\'ll',\n\t\t\t'we\\'re',\n\t\t\t'we\\'ve',\n\t\t\t'well',\n\t\t\t'wen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::DeviceFarm::VPCEConfiguration` resource
function cfnVPCEConfigurationPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnVPCEConfigurationPropsValidator(properties).assertSuccess(); return { ServiceDnsName: cdk.stringToCloudFormation(properties.serviceDnsName), VpceConfigurati...
[ "function renderProperties(setup) {\n // print available exams\n var html = '';\n if (!('localStorage' in window)) {\n html += warning(getMessage('msg_options_change_disabled', 'Changing options is disabled, because your browser does not support localStorage.'));\n }\n for (var section in setu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Broadcasts new tweet to all connected clients
function broadcastNewTweet(data) { const parsedData = JSON.parse(data); const decodedData = redisService.decodeData(parsedData.data); kalmServer.broadcast('tweet', decodedData); }
[ "listenTweet(handler) {\n this.socket.on('tweet', handler);\n }", "function broadcast() {\r\n\t\t\tvar clength = channel.clients.length;\r\n\t\t\t/*for (var i = 0; i < clength; i++) {\r\n\t\t\t\tchannel.publish('say', getCurrentChannel().channelName,\r\n\t\t\t\t\t\tchannel.clients[i].id);\r\n\t\t\t}*/\r\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render the main axis line.
function renderAxisLine() { ctx.save(); ctx.setLineDash(renderAttrs.lineDash || []); if( renderAttrs.orientation === 'horizontal') { drawLine( ctx, { x: renderMin, y: originCrossAxisCoord }, { x: renderMax, y: originCross...
[ "function renderAxis() {\n dom.axis.x0\n .call(drag);\n\n dom.axis.x1\n .call(drag);\n\n dom.axis.x0\n .transition()\n .duration(transitionDuration)\n .call(axis.x0);\n\n dom.axis.x1\n .transition()\n .duration(transitionDuration)\n .call(axis.x1);\n\n axis.y.t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return true if a rev exists in the rev tree, false otherwise
function revExists(revs, rev) { var toVisit = revs.slice(); var splitRev = rev.split('-'); var targetPos = parseInt(splitRev[0], 10); var targetId = splitRev[1]; var node; while ((node = toVisit.pop())) { if (node.pos === targetPos && node.ids[0] === targetId) { re...
[ "function revExists(revs, rev) {\n\t var toVisit = revs.slice();\n\t var splitRev = rev.split('-');\n\t var targetPos = parseInt(splitRev[0], 10);\n\t var targetId = splitRev[1];\n\t\n\t var node;\n\t while ((node = toVisit.pop())) {\n\t if (node.pos === targetPos && node.ids[0] === targetId) {\n\t re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Legalize LLVM unrealistic types into realistic types. With full LLVM optimizations, it can generate types like i888 which do not exist in any actual hardware implementation, but are useful during optimization. LLVM then legalizes these types into real ones during code generation. Sadly, there is no LLVM IR pass to lega...
function legalizer() { // Legalization if (USE_TYPED_ARRAYS == 2) { function getLegalVars(base, bits, allowLegal) { bits = bits || 32; // things like pointers are all i32, but show up as 0 bits from getBits if (allowLegal && bits <= 32) return [{ intertype: 'value', ident: base + ('i' + bi...
[ "function ml_z_of_int32(i32) {\n return bigInt(i32);\n}", "function IntegerType() {\n}", "function castToI32(lctx) {\n const currentType = currentTempType(lctx);\n if (currentType === 'i32') {\n return '';\n }\n\n if (currentType === 'i1') {\n const currentName = currentTempName(lctx);\n const c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Manages state transition of the phone call update the UI Update internal state and execute required CRM states (creating a case, activity, searching records etc) manage Twilio connection state
set state(value) { if (this._state == value) { return; } let oldState = this._state; this._state = value; this.updateCRMPage(); if (this._state != PhoneState.CallSummary) { $("#activityLink").hide(); $("#caseLink").hide(); } ...
[ "handleToggleCall() {\n if (!this.state.onPhone) {\n this.setState({\n muted: false,\n onPhone: true\n });\n // make outbound call with current number\n const n = `+1${this.state.currentNumber.replace(/\\D/g, '')}`;\n // console.log(`Attempting to connect to: ${n}`);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reveal the hidden text
function reveal_text() { reveal_by_class("hidden-text", "block"); }
[ "function reveal() {\n //TODO\n //Teaser Preview (continued)\n //6. Restore the article contents to the original HTML\n //7. Animate the restored article to give a visual cue to the user\n}", "function hideText() {\n\t\t$(\"#text\").toggle(text_effect, function() {\n\t\t\t// Next line and toggle/show.\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert a `Vector3` to `float` (in place!) Returns the minor float vector, which is the difference of the double elements and their float counterparts.
function makeFloatVec(v) { const majorX = Math.fround(v.x); const majorY = Math.fround(v.y); const majorZ = Math.fround(v.z); const minorVec = new three_1.Vector3(v.x - majorX, v.y - majorY, v.z - majorZ); v.x = Math.fround(majorX); v.y = Math.fround(majorY); v.z ...
[ "function doubleToFloatVec(v) {\n return new three_1.Vector3(Math.fround(v.x), Math.fround(v.y), Math.fround(v.z));\n }", "function toFloat(V) {\n //Let x be ToNumber(V).\n var x = ECMAScript.ToNumber(V);\n //If x is NaN, +Infinity or -Infinity, then throw a TypeError.\n if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
numberEntries takes in spiffe id of an agent and list of entries returns number of entries in an agent
numberEntries(spiffeid, globalEntries, globalAgents) { if (typeof globalEntries !== 'undefined') { var entriesList = this.getChildEntries(spiffeid, globalAgents, globalEntries); if (typeof entriesList === 'undefined') { return NaN } else { return entriesList.length } } el...
[ "numberEntriesFromAgent(spiffeid, globalEntries, globalAgents) {\n if (typeof globalEntries !== 'undefined') {\n var entriesList = this.SpiffeHelper.getChildEntries(spiffeid, globalAgents, globalEntries);\n return entriesList.length\n } else {\n return NaN\n }\n }", "entryClusterMetadata(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this right now can only filter by posts keywords, not any user info. i would like to be able to do that.
getFilteredPosts(filter) { // filter by post const filteredPosts = this.state.postsWithUser.filter(item => { return Object.keys(item).some(key => item[key].toString().toLowerCase().includes(filter.toLowerCase()) ); }); return filteredPosts }
[ "filterPosts() {\n this.showList = this.postList.filter(post => {\n return (\n post.title.includes(this.keyword) ||\n post.description.includes(this.keyword) ||\n post.created_user.includes(this.keyword)\n );\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
WGetItem() return the contents of the requested row and column.
function WGetItem(r, c) { if ((c >= this.cols) || (c < 0)) return ""; if (this.rows == 0) return ""; if ((r >= this.rows) || (r < 0)) return ""; return this.arrdata[r * this.cols + c]; }
[ "getItem( intItem ) {\r\n\t\treturn this.objContent[intItem];\r\n\t}", "getItem (intItem) {\n return this.objContent[intItem];\n }", "function getGridItem(row, column) {\n return grid[row][column];\n }", "getItem(x,y) { return this.getCell(x,y)._mapItem;}", "get(row, column) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wrap in path separaters. (Cross platform.)
function sepwrap(wrap_me){ return path.sep + wrap_me + path.sep; }
[ "function quotePaths() {\n // Replace this comment with your code...\n\n let result = [];\n // if (arguments.length == 1) {\n // result = quotePath(arguments);\n // } else if (arguments.length > 1) {\n for (var i = 0; i < arguments.length; i++) {\n result.push(quotePath(arguments[i]));\n }\n return res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates a document in the word index. (words: array of strings)
function updateDocument(docId, words) { return Promise.resolve() .then(() => { return this.wordIndex_removeDocument(docId); }).then(() => { return this.wordIndex_addDocument(docId, words); }); }
[ "async _saveWords(name, wordsIndex) {\n const options = { upsert: true };\n for (const [word, wordInfo] of Object.entries(wordsIndex)) {\n const filter = { _id: word };\n const update = { $set: { [name]: wordInfo } };\n await this.wordsTable.updateOne(filter, update, options);\n }\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Every time a button is clicked, update the page by reading updated slide number And map data accordingly
function updateSlide(data) { map.removeLayer(toMap); map.setZoom(15); show('nav-prev'); show('nav-next'); if (currSlide == 0) { hide('nav-prev'); } else if (currSlide == slideDeck.length-1) { hide('nav-next'); } $('.slide-title').text(slideDeck[currSlide].title); $('#p1').text(slideDeck[currSlide].tex...
[ "function updateSlideNumber() {\n\n\t\t\t// Update slide number if enabled\n\t\t\tif( config.slideNumber && dom.slideNumber) {\n\n\t\t\t\t// Display the number of the page using 'indexh - indexv' format\n\t\t\t\tvar indexString = indexh;\n\t\t\t\tif( indexv > 0 ) {\n\t\t\t\t\tindexString += ' - ' + indexv;\n\t\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a random integer from the set [lowerBound, upperBound].
function randomInteger(lowerBound, upperbound) { return Math.floor(Math.random() * (upperbound + 1 - lowerBound)) + lowerBound; }
[ "function getRandomInteger(lowerBound, upperBound){\r\n\t// [0, 1) range \r\n\treturn Math.floor(Math.random() * (upperBound - lowerBound) + lowerBound);\r\n}", "function randint(lowerbound, upperbound){\n\treturn Math.floor(lowerbound + Math.random()*(upperbound-lowerb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Increment or decrement Shift Number in the center of the screen
function decrementShift() { let shiftNumber = parseInt(shiftNumberHandler.innerHTML); if (shiftNumber > 0 && shiftNumber < 27) { shiftNumber -= 1; } shiftNumberHandler.innerHTML = shiftNumber; }
[ "function shiftDown() {\n shift = true;\n initMouse = currMouse;\n }", "updateShift(delta) {\n\t\tthis.shift = constrain(this.shift+delta, -56*this.whiteKeyWidth+1199, 0);\n\t}", "shift(delta) { start+=delta }", "ShiftDown(){\n this.YPos += this.Height;\n }", "setXShift(x) {\n this.x_shi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UserController Execute our model
function UserController() {}
[ "function usermodel() {\n\n}", "function usermodel() { }", "onCreateUser() {\n this.usersController.send('onCreateUser');\n }", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page winner_singles => custom controller\");\n\t\t\tconsole....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sorts playlist based on upvote count
function sortPlaylist() { playlistArr = Object.entries(livePlaylist); if (playlistArr.length > 2) { var sorted = false; while (!sorted) { sorted = true; for (var i = 1; i < playlistArr.length - 1; i++) { if ((playlistArr[i][1].upvote < playlistArr[i + 1][...
[ "function sortSongsByUpvoteCount(playlist, cb) {\n async.sortBy(playlist.songs, function(song, callback) {\n if (!song.upvote_count) {\n song.upvote_count = 0;\n }\n callback(null, song.upvote_count);\n }, function(err) {\n cb(err, playlist);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private: Call with a method for the given strings using response middleware.
async runWithMiddleware (methodName, opts, ...strings) { const copy = strings.slice(0) const context = { response: this, strings: copy, method: methodName } if (opts?.plaintext != null) { context.plaintext = opts.plaintext } await this.robot.middleware.response.execute(co...
[ "routeString(method, path, ...args) {\n this.route(method, path, stringResponder(...args));\n }", "function routeMap(request, response, methodMap, pathMap) {\n // alias the method if in the map\n // eg head -> get, patch -> set\n var method = request.method.toLowerCase();\n if (method in methodMap)\n m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the tooltip message
function updateTooltipMessage(message) { // Update the tooltip for the next time it mouses in/out tooltipMessage = message; }
[ "function updateTooltip(text_to_display){\n\ttooltip.innerHTML=text_to_display\n\tgetpos()\n\ttooltip.style.opacity=1\n\ttooltip.style.left=x+30+\"px\"\n\ttooltip.style.top=y-30+\"px\"\n}", "_updateTooltipMessage() {\n // Must wait for the message to be painted to the tooltip so that the overlay can proper...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the cross count for the given graph.
function crossCount(g) { var cc = 0; var ordering = util.ordering(g); for (var i = 1; i < ordering.length; ++i) { cc += twoLayerCrossCount(g, ordering[i-1], ordering[i]); } return cc; }
[ "function crossCount(g){var cc=0;var ordering=util.ordering(g);for(var i=1;i<ordering.length;++i){cc+=twoLayerCrossCount(g,ordering[i-1],ordering[i]);}return cc;}", "crossingCount (_v, _degree) {\n let nCrossings = 0\n let sign = _v[0].y < 0 ? -1 : 1\n let oldSign = sign\n for (let i = 1; i <= _degree...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads up the contacts from the JSON file on the server. This will read in once jQuery is loaded; That means that we can use PHP to pull the string
function readContacts(json) { // So, I was having errors testing this on the file level. The fix is to force the MIME type to a JSON $.ajaxSetup({ async:true, beforeSend: function(xhr){ if (xhr.overrideMimeType) { xhr.overrideMimeType("application/json"); } } }); $.getJSON(json, function(data) { ...
[ "function loadContacts() {\n $.ajax({\n url: host + '.json',\n success: loadSuccess\n\n });\n }", "function loadContacts() {\n phonebookElement.innerHTML = '';\n phonebookElement.innerHTML = '<li>Loading &hellip;</li>';\n\n //By default Method is GET\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to display reservation confirm message
function reservationPrompt(eventID, eventName) { alertify.confirm("Confirm to make reservation for event \"" + eventName + "\" (" + eventID + ")" + "?", function (e) { if (e) { $('#reserve' + eventID).submit(); } }).setting({ 'transition': 'zoom', 'movable': false, ...
[ "function confirmation() {\n confirm(\"Please select OK to finalize your reservation.\");\n}", "function bookingConfirmation(){\n var firstClassQuantity = getInfo(\"firstClass\");\n var economyQuantity = getInfo(\"economy\");\n if (firstClassQuantity == 0 && economyQuantity == 0){\n alert(\"Ple...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
render the component based on current or selected mode
render(){ var modeComponent = <ReadMateriasComponent changeAppMode={this.changeAppMode} />; switch(this.state.currentMode){ case 'read': break; case 'readOne': modeComponent = <ReadOneMateriaComponent CveM={this.state...
[ "render () {\n\n var modeComponent =\n <ReadComponent\n changeAppMode={this.changeAppMode} />;\n\n switch (this.state.currentMode) {\n case 'read':\n break;\n case 'readOne':\n modeComponent = <ReadOneComponent sweepId={this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a function to convert indexes of original features into indexes of grouped features Uses categorical classification (a different id for each unique combination of values)
function getCategoryClassifier(fields, data) { if (!fields || fields.length === 0) return function() {return 0;}; fields.forEach(function(f) { requireDataField(data, f); }); var index = {}, count = 0, records = data.getRecords(), getKey = getMultiFieldKeyFunction(fields); ...
[ "function mapCategoriesToFeatureIds() {\n getVpns().then(function(vpnList) {\n var exemplarVpn = vpnList[0];\n var categoriesToFeatureIdsMap = {};\n exemplarVpn.features.forEach(function(feature) {\n if (MrlUtil.objectContainsKey(categoriesToFeatureIdsMap, feature.catego...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Examines an attributes definition array from a node to find the index of the attribute with the specified name. NOTE: Will not find namespaced attributes.
function findAttrIndexInNode(name,attrs){if(attrs===null)return-1;var selectOnlyMode=false;var i=0;while(i<attrs.length){var maybeAttrName=attrs[i];if(maybeAttrName===name){return i;}else if(maybeAttrName===0/* NamespaceURI */){// NOTE(benlesh): will not find namespaced attributes. This is by design. i+=4;}else{if(mayb...
[ "function findAttrIndexInNode(name, attrs) {\n if (null === attrs) return -1;\n for (var selectOnlyMode = !1, i = 0; i < attrs.length; ) {\n var maybeAttrName = attrs[i];\n if (maybeAttrName === name) return i;\n 0 /* NamespaceURI */ === maybeAttrNa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create wp.editor using item element
function createEditor(el) { var textarea = el.find('.item__entry'); var editorId = textarea.attr('id'); if(typeof editorId === 'undefined') { editorId = 'knife-story-editor-' + box.data('editor'); textarea.attr('id', editorId); box.data().editor++; } else { wp.editor.remove(edi...
[ "function createSnippetEditorItem(\n spanClass, desc, key, value, val, type, div, deleteLink, defaultVal) {\n if (val != null && type != 'bool') {\n createSnippetSelect(\n spanClass, desc, key, value, val, div, deleteLink, defaultVal);\n } else if (type == 'bool') {\n createSnippetRadio(\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this big mess of a function takes an announcer as an argument and goes through each channel determining whether or not an announcement should be posted or not
function announceAllDiscordChannels(announcer) { announcer.announceChannels.forEach(async discordChannel => { let entry = await getAnnounceEntry(discordChannel, announcer.name); let notified = entry.announce_sent; let onCooldown = entry.on_cooldown; let offlineSince = entry.offline_since; let ...
[ "async function processAnnouncers() {\n\n let announcers = await createAnnouncerObjects();\n announcers.forEach(announcer => {\n announceAllDiscordChannels(announcer);\n });\n\n}", "function announce_channel(message_args) {\n const ann_channel = client.channels.cache.find((channel) => channel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for systemd we can check the run folder
function checkSystemd(cb) { fs.exists('/run/systemd/container', (exists) => { if (!exists) { return cb("unknown"); } fs.readFile('/run/systemd/container', (err, buf) => { if (err) { return cb(err); } const content = buf.toString('ascii'); if (runtime_list.indexOf(content) !== -1) { retur...
[ "isDaemonUserDirectory() {\n // tslint:disable-next-line:no-require-imports\n return __webpack_require__(381).existsSync(constants_1.DAEMON_USER_DIR_PATH);\n }", "function folderCheck() {\n if (!fs.existsSync(`${process.env.LOCALAPPDATA}/gamiTask`))\n fs.mkdir(`${process.env.LOCALAPPDATA}/gam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this method is called when your extension is deactivated
function deactivate() { console.log('关闭扩展') }
[ "function deactivate() {\r\n console.log(\"Preview Extension Shutdown\");\r\n}", "function deactivate() {\n\tconsole.log(\" Remainders extension was deactivted\")\n}", "function deactivate() {\n example.deactivate();\n console.log(`Extension(${example.name}) is deactivated.`);\n}", "function deactiva...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles start button action: creates local MediaStream.
function startAction() { startButton.disabled = true; acceptButton.disabled = true; console.log("Local stream added"); navigator.mediaDevices.getUserMedia(constraints) .then(gotLocalMediaStream).catch(handleLocalMediaStreamError); }
[ "function startAction() {\n startButton.disabled = true;\n modifyButton.disabled = false;\n pauseButton.disabled = false;\n captureButton.disabled = false;\n navigator.mediaDevices.getUserMedia(mediaStreamConstraints)\n .then(gotLocalMediaStream).catch(handleLocalMediaStreamError);\n console.log('Requestin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse `argv`, settings options and invoking commands when defined.
parse(argv) { // trigger autocomplete first if some completion rules have been defined if (this.hasCompletionRules()) { this.autocomplete(argv); } // implicit help if (this.executables) this.addImplicitHelpCommand(); // store raw args this.rawArgs = argv; // guess name this._name = thi...
[ "function processArgv(argv) {\n const packageJsonPath = path.join(process.cwd(), 'package.json');\n let command = argv._[0];\n let passToModules = true;\n\n // Allow shorthand \"-v\" for version\n if (argv.v) {\n command = 'version';\n }\n\n // Allow shorthand \"-h\" for help\n if (argv.h) {\n command...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=========================================================================== The remaining code are all event handlerrs and init(). =========================================================================== handlerToSelectInkwell(event) function Given an event triggered on an inkwell object, this function selects the i...
function handlerToSelectInkwell(evt) { if (debug) console.log("handlerToSelectInkwell(): "+evt); evt.returnValue = false; selectInkwell(evt.currentTarget); }
[ "function selectInkwell(elem)\n{\n if (elem != null)\n {\n // De-highlight any previously selected inkwell...\n deselectInkwell();\n if (selectedInkwell)\n selectedInkwell.style.strokeDasharray = null;\n\n // And remember this new inkwell...\n selectedInkwell = elem;\n selectedInkwell.style...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A planner displaying the time slots with a section to input events/reminders, and a save button
function showPlanner() { for (let i = 0; i < myDay.length; i++) { const row = $("<div>"); $(row).attr("id", myDay[i].hour); $(row).attr("class", "row justify-content-center") // $(row).text("This is a test"); row.appendTo('#container'); // This div displays the hour ...
[ "function renderPlanner() {\n var currentTime = moment().format(\"H\");\n var currentClass = \"\";\n var isDisabled = \"\";\n for (i = 0; i < 9; i++) {\n var time = \"\";\n if (myStorage.getItem(\"use24hr\") == \"true\") {\n time = 9 + i;\n } else {\n time = twelveHr(9 + i);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the priority of a language.
function getLanguagePriority(language, accepted, index) { var priority = {o: -1, q: 0, s: 0}; for (var i = 0; i < accepted.length; i++) { var spec = specify(language, accepted[i], index); if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { priority = spec; ...
[ "function getLanguagePriority(language,accepted,index){var priority={o:-1,q:0,s:0};for(var i=0;i<accepted.length;i++){var spec=specify(language,accepted[i],index);if(spec&&(priority.s-spec.s||priority.q-spec.q||priority.o-spec.o)<0){priority=spec;}}return priority;}", "function $liTQ$var$getLanguagePriority(langu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }