query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Lint a PR according to resolved commitlint config | async function lint(context, db) {
let { github, payload, repo } = context;
repo = repo.bind(context);
const query = {
PULL_REQUEST_SHA: payload.pull_request.head.sha,
PULL_REQUEST_NUMBER: payload.pull_request.number,
REPO_SLUG: payload.pull_request.base.repo.full_name
};
const [, task] = await db.fetch('t... | [
"async function commitlint(context) {\n // 1. Extract necessary info\n const pull = context.issue();\n const { sha } = context.payload.pull_request.head;\n const repo = context.repo();\n\n // GH API\n const { paginate, issues, repos, pullRequests } = context.github;\n\n // Hold this PR info\n const statusIn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A buffer suitable for text editor | function TextBuffer( options = {} ) {
this.ScreenBuffer = options.ScreenBuffer || ( options.dst && options.dst.constructor ) || termkit.ScreenBuffer ;
// a screenBuffer
this.dst = options.dst ;
this.palette = options.palette || ( this.dst && this.dst.palette ) ;
// virtually infinity by default
this.width = opt... | [
"_createBuffer() {\n let str = [];\n\n if (!this.dom._buffer) {\n this.dom._buffer = helper.createElement({\n tagName: 'textarea',\n selector: 'bomtable-buffer',\n parent: this.dom.wrapper\n });\n this.dom._buffer.addEventLi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Picks all vector features (e.g. GeoJSON) shown at a certain position on the screen, ignoring raster features (e.g. WMS). Because all vector features are already in memory, this is synchronous. | pickVectorFeatures(screenPosition) {
var _a, _b;
// Pick vector features
const vectorFeatures = [];
const pickedList = this.scene.drillPick(screenPosition);
for (let i = 0; i < pickedList.length; ++i) {
const picked = pickedList[i];
let id = picked.id;
... | [
"async getInViewFeatures(force) {\n\n if (!(this.browser && this.browser.referenceFrameList)) {\n return [];\n }\n\n // List of viewports that need reloading\n const rpV = this.viewportsToReload(force);\n const promises = rpV.map(function (vp) {\n return vp.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the mouseDown variable to false and set the last cell clicked variable to null | function onCanvasMouseUp() {
window.mouseDown = false;
window.lastCellClicked = null;
} | [
"function eltMouseDown()\n{\n mouseIsDown = true;\n pendStartCell = this;\n return false; // suppress default processing\n}",
"function cellMouseDown(event) {\n let cell = event.target;\n cellMouseDown.lastDownCell = cell;\n}",
"function onCanvasTouchEnd() {\n window.mouseDown = false;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
XML tree created from the sales order payload in the user event record, checks wellformed XML and removes any white space and HTML adornments etc. returns the order number if successful | function loadXMLTreefromSalesOrderPayload()
{
var returnOrderNumber = null;
var recordType = '';
var salesRecordID = 0;
var salesRecord = null;
var soRefNo = 0;
var stagingStatus = '';
var isVATEnabled = 'F';
if (debugOn)
nlapiLogExecution('DEBUG', "loadXMLTreefromSalesOrderPayload()" , "recordT... | [
"function createOrder(orderID, xmlDoc){\n var _total = eval('xmlDoc.'+_.order_total_xpath);\n var total = _total[_total.length-1].td[2].Text;\n total = total.replace('\\xa0',''); // remove spaces\n var processed = eval('xmlDoc.' + _.order_processed_xpath).Text;\n if( processed.indexOf('processed') > - 1 ) { \n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
HELPER FUNCTIONS quickly get selected genre title | function getSelectedGenre() {
return $("[data-hook='list-genres']").find("li.selected").text();
} | [
"function get_genre(params) {\n var check = ['genre'];\n var genre = '';\n for (var i = 0; i < check.length; i++) {\n if (check[i] in params && params[check[i]]) {\n genre = params[check[i]];\n }\n }\n if (genre && genre != 'unknown') {\n return genre;\n }\n\n var rfr_id =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add overview to the page | function addOverview(overviewData) {
if (overviewData.synopsis) {
var content = $("<div></div>");
content.append(createSynopsisView(overviewData.synopsis));
content.append(createStaffViews(overviewData.staff));
content.append(utils.createSubSubsection("Lectures", ... | [
"function overviewLink() {\n Dom.div(function () {\n Dom.style({\n color: Plugin.colors().highlight,\n textAlign: 'right',\n margin: '.5em'\n });\n \n // on click to the right page\n Dom.on('click', function () {\n Page.nav(['events']);\n });\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updates a doctor in the database | updateDoctor(id) {
return axios.put('/api/doctors/' + id);
} | [
"update(req, res) {\n Decision.update(req.body, {\n where: {\n id: req.params.id\n }\n })\n .then(function (updatedRecords) {\n res.status(200).json(updatedRecords);\n })\n .catch(function (error){\n res.status(500).json(error);\n });\n }",
"up... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets selection restrictions from the `[restrictselection]` attr and puts it into an object ```html ``` | function getSelectionRestrictions() {
if (!selectionRestictions) {
selectionRestictions = {};
var attrArr = $attrs.restrictSelection ? $attrs.restrictSelection.split(',').map(function (item) { return item.trim(); }) : [];
attrArr.forEach(function (key) {
selectionRestictions[key]... | [
"function makeSelection( markup ) {\n\tvar container = doc.getById( 'sandbox' );\n\treturn tools.setHtmlWithSelection( container, markup ).getRanges();\n}",
"function extractSelections(text) {\n let regex = /<\\|([\\s\\S]*?)\\|>/g;\n\n let selections = [];\n\n let match;\n let i = 0;\n\n while ((match = rege... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets all objects paths by type and number of objects by type. | function setAllObjectPaths() {
var allObjectTypes = objectTypes.objectTypes;
var allObjectsByType = new Map();
var numObjectsByType = new Map();
for (var i = 0; i < allObjectTypes.length/10; i++) {
for (var j = 0; j < 10; j++) {
var objectNum = String(i) + String(j);
v... | [
"function postAllObjectPaths() {\n [allObjectsByType, numObjectsByType] = setAllObjectPaths();\n return numObjectsByType;\n}",
"function updateAllObjectIndexKeys() {\n\n for (var objectIndex = 0, objectCount = type_metaData.type_objects.length;\n objectIndex < objectCount;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcion para crear el select en la pagina scrapperblogs a partir de todos los blogs que tenemos | makeSelect(data){
var select = document.getElementsByName("selectblog")[0];
var html;
for(var i in data){
var option = document.createElement("option");
option.setAttribute("value", data[i].ID);
option.text = data[i].name_blog;
select.add(option);
}
} | [
"function get_article_selection(inner_blog_id) {\n if(inner_blog_id){\n let new_index = find_index(blog_id)\n console.log(\"new_index: \",new_index);\n send_xmlhttprequest('frontpage','get',`article_sections=id&id=${inner_blog_id}`, (response)=>{\n //console.log(JSON.par... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Coffee class inherits from Beverage | function Coffee() {
Beverage.call(this);
this._cost = 5;
} | [
"function Coffee(type) {\n Beverage.call(this, \"coffee\", \"hot\");\n this.type = type;;\n}",
"function Coffee(type){\n\t//Call the Beverages constructor inside of\n\t//the Coffee constructor to initialize \n\t//the name and beverage properties \n\tBeverages.call(this, \"coffee\", \"hot\");\n\tthis.type = type... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function fills the resultTable with all attributes that shall be displayed. The array stores date about the route section, the length of the route section, the start and endpoints and if the route section lies in or outside the given polygon | function fillingResultTable() {
for (let index = 0; index < distancesSubsequences.length; index++) { //iterating over the subsequences
var tableRow = [];
tableRow[0] = index + 1; //index
tableRow[1] = distancesSubsequences[index]; //length of the subsquence
tableRow[2] = pointsInOrOutsideArray[interse... | [
"function populateTripsGrid(allTrips, routeId, date) {\n const tableElement = document.getElementById('all_lines');\n const trips = allTrips.gtfsTrips.reverse();\n for (let i = 0; i < trips.length; i++) {\n let background = \"info\";\n let trip = trips[i];\n let tripId = trip.siriTripI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if character c is a letter or digit. | function isLetterOrDigit (c)
{ return (isLetter(c) || isDigit(c))
} | [
"function isLetterOrDigit(c)\r\n{\r\n\treturn (isLetter(c) || isDigit(c));\r\n}",
"function isLetterOrDigit(c) {\r\n return (isLetter(c) || isDigit(c));\r\n}",
"function isLetterOrDigit (c)\n{ return (isLetter(c) || isDigit(c))\n}",
"function isDigitOrAlphabetChar(c) {\nreturn ((c>='0' && c<='9') || (c>='a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search for Points in the range | query(range, found){
if(!this.boundary.intersects(range)){
//empty array
return;
} else {
for(let i=0;i<this.points.length;i++){
if(range.contains(this.points[i])){
found.push(this.points[i]);
}
}
... | [
"queryRange(range) {\n let pointsInRange = [];\n \n if (!this.boundary.intersectsAABB(range)) {\n return pointsInRange;\n }\n \n for (let p of this.points) {\n if (range.containsPoint(p)) {\n pointsInRange.push(p);\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This will tell whether a carrier has a hub on it or not | function hasHubOnCarrier(carrier) {
return !!(carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub);
} | [
"function hasHubOnCarrier(carrier) {\n\t if (carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub) {\n\t return true;\n\t }\n\t else {\n\t return false;\n\t }\n\t}",
"function hasHubOnCarrier(carrier) {\n if (carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub) {\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calls the callback specified with the errors specified, used internally | function executeCallback(self, errorsForCallback, callback) {
callback.apply(self, [
false, //pass in a value indicating it is invalid
errorsForCallback, //pass in the errors for this item
self.items]); //pass in all errors in t... | [
"errorCallback(callback) {\n\t\tthis._cbError = callback\n\t}",
"function error(err){if(error.err)return;callback(error.err=err);}",
"function error (err) {\n if(error.err) return;\n callback(error.err = err);\n }",
"function errorCallback(callback){return function(error){callback(error);throw error;};... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update value of inputperson_primary_salutation | function update_primary(){
$('input#person_primary_salutation').val($('select#person_primary_title_id').find('option:selected').html()
+ " " + $('input#person_first_name').val()
+ " " + $('input#person_family_name').val());
} | [
"function updateSalutations(){\r\n document.getElementById(\"iSalutation\").value = salutation;\r\n document.getElementById('iSalutationLetter').value= letterSalutation;\r\n fillTotal();\r\n}",
"function updateMonthlySalary(empMonthlySalary) {\n\n $('.person').last().data(\"monthlysalary\", {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Expand all accordions + change plus/minus icons | function expandAllAccordions(expand_by_click) {
expand_by_url_param = getParameterByName('expand');
if (expand_by_click || expand_by_url_param == 'true') {
$(".accordion-body").addClass("in");
$(".accordion-toggle").children(".icon-plus").addClass("icon-minus");
$(".accordion-toggle").children(".icon-mi... | [
"expandAll() {\n this.toggleAllCollapsibleSections('expand');\n }",
"function expand() {\n if(!expanded){\n setExpanded(true);\n setIcon(\"bi-chevron-up\");\n } else {\n setExpanded(false);\n setIcon(\"bi-chevron-down\");\n }\n }",
"updateExpandIcon() {}",
"onClickExpandAll()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Log the request body. Do not log any body properties that appear in the blacklist. | function logRequestBody(request) {
let body = _.cloneDeep(request.body);
assert.ok(blacklist && blacklist.length > 0, 'Expected to have a request body blacklist, but none was found.');
removeProperty(body, blacklist);
if (body && Object.keys(body).length) {
debug(` >> Request Body: ${JSON.stringify(body)}`... | [
"function pruneGetRequestBody(request) {\r\n if (request.method &&\r\n isStringEqual(request.method, 'GET') &&\r\n request.body === '') {\r\n return undefined;\r\n }\r\n return request.body;\r\n }",
"_addBody(request, body) {\n debug('_addBody', body... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove this sprite from the group that contains it. | destroy()
{
this.parentGroup.removeSprite(this);
} | [
"removeSprite() {\n if (!this.sprite) return;\n this.remove(this.sprite);\n this.sprite.destroy();\n }",
"remove() {\n\t\tthis.destroy();\n\t\tthis.engine.scene.removeSprite(this);\n\t}",
"clearGroup(groupSprite) {\n groupSprite.clear(true, true);\n }",
"remove(name) {\n var sprite = th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Challenge Five Football Points Counter | function footballPoints(wins, ties) {
let points = 0;
points = (wins * 3) + ties;
return points;
} | [
"function tally(winner){\n total = total + 1;\n if (winner === \"Player!\"){\n pw = pw + 1;\n return\n }\n else if (winner === \"AI\"){\n cw = cw + 1;\n return\n }\n else {\n tie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: sortLength Input: arr(array[strings]) Output: Returns a new array that is the old array sorted by string length descending. If two strings are the same length, the one that is alphanumberically higher should be placed first. | function sortLength(arr){
return arr.sort((a,b) => {
if(a.length === b.length){
return b.length - a.length
}else{
return a.localeCompare(b)
}
})
} | [
"function sortByLength(arr) {\n\treturn arr.sort(function(a, b) { return a.length - b.length })\n}",
"function sortLength(strArray){\n return strArray.sort((a,b) => a.length - b.length);\n}",
"function sortByLength(strs) {\n let sortedArray = \n strs.sort((sortedArray, valueLength) => {return sorte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this navigate to the MyListView when called. | _navigateList(){
this.props.navigator.push({
name: 'MyListView', // Matches route.name
})
} | [
"goToListView(id) {\n Actions.ListView(id);\n }",
"navigateToList() {\n\t\t\twindow.location.href = '/todo';\n\t\t}",
"changeListView() {\n this.displayMovieList(this.movieObjects);\n }",
"navigateRelatedListView() {\n this[NavigationMixin.Navigate]({\n type: 'standard__recordR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove the pw before its userData is serialized/returned for any call only removes pw from request, not from the DB itself | toJSON() {
let userData = this.get();
// delete - deletes the key we give it
delete userData.password;
return userData;
} | [
"toJSON() {\n let userData = this.get() //.get built into get hte user we are working with\n delete userData.password //this removes the password so when we are passing around user info that the pw isnt a parto f that user object that gets passed between the backend and frontend..but does not remove it f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set the y axis title of the chart | function setYAxisTitleFtn(chart, index, labels) {
$log.info('setting the Y Axis title: ' + labels[index]);
chart.options.vAxis.title = labels[index];
} | [
"function appendYAxisTitle(svg, plot) {\n svg.append('text')\n .attr('id', 'yTitle')\n .attr('transform', 'translate(' + (plot.padding.left/3) + ','\n + (plot.padding.top + plot.range.y/2) + ') rotate(-90)')\n .text('Concentration %');\n }",
"setYTitle(tit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add random number of particles to the array. | function pushParticles() {
for (let i = 0; i < utils.random(1000, 5000); i++) {
particles.push({
x: utils.random(-300, canvas.width + 300),
y: utils.random(-300, canvas.height + 300),
s: utils.random(1, 3),
});
}
} | [
"function addParticle(){\n var x = Math.floor(Math.random() * cW)+1;\n var y = Math.floor(Math.random() * cH)+1;\n var size = Math.floor(Math.random() * 5)/particle.size+1;;\n particles.push({'x':x,'y':y,'size':size});\n }",
"function addParticle() {\n numParticles += 1;\n \n var x = 1-2*Math.rand... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tells if the selected filter is the active one | get isActiveFilter() {
return this._selectedFilter == "active";
} | [
"get active() {\n return !!this.filter && this.filter.isActive();\n }",
"function activeFilter(filter) {\n if (filter.active === 1){\n filter.active = 2;\n } else {\n filter.active = 1;\n }\n }",
"function isFilterActive(filter) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates the dot scores using the total material rarity scores | function calculateDotRarity() {
for (i = 0; i < tilesList.length; i++) {
if (tilesList[i].mat == 6) {
tilesList[i].dotRarity = 0
}
else {
tilesList[i].dotRarity = tilesList[i].dot / getTotalDots(tilesList[i].mat)
}
}
} | [
"function calculateResourceRarity() {\n for (i = 0; i < positions.length; i++) {\n var sum = 0;\n for (x = 0; x < positions[i].tiles.length; x++) {\n sum += positions[i].tiles[x].dotRarity\n }\n positions[i].resourceRarityScore = sum\n }\n}",
"CalcPowerScore() { \n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper methods ///////////////// / get current registry | function getCurrentRegistry(cbk) {
npm.load(function(err, conf) {
if (err) return exit(err);
cbk(npm.config.get('registry'));
});
} | [
"static get registry () { return registry }",
"function getCurrentRegistry(cbk) {\n _npm2.default.load(function (err, conf) {\n if (err) return exit(err);\n cbk(_npm2.default.config.get('registry'));\n });\n}",
"function getLocalRegistry() {\n\t\treturn httpl_registry;\n\t}",
"async setRegistry() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Call on Create button click. Move to create a curation object as specified after validating input fields | function createCuration() {
//Remove error messages if present
$('.error').hide();
//Update the input we are adding to the form programmatically
var name = $('#name');
var desc = $('#description');
var space = document.getElementById("spaceid");
var i = space.selectedIndex;
var spaceI... | [
"create() {\n console.log('[Camapign Controller] Create');\n\n let form = document.querySelector('form');\n\n this.validateFormData(form, () => {\n document.getElementById('campaign_save').disabled = true;\n\n let campaign = Campaign.createFromForm(form);\n\n app.user.campaigns.push(campaign... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies "multiplyNumbers" function when variable answer is a b. Use "alert" action to retrieve variable answer. | function multiplyNumbers (a, b) {
var answer = a * b;
alert(answer);
} | [
"function onMultiplyEnter () {\n\tvar firstValue = getFirstValue();\n\tvar secondValue = getSecondValue();\n\tvar total = firstValue * secondValue;\n\tsetAnswer(total);\n}",
"function multiplyNums(a, b, cb){\n\tproduct = a * b;\n cb(product);\n}",
"function doMultiply() {\n getSecondNumber(\"*\");\n // pos... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check is main layout | __checkIsMain() {
if (this.__isMain) {
document
.getElementById('layout')
.classList
.add('layout__main');
}
} | [
"function isLayoutOpen(){\n\tvar layout= app.activeLayout();//get the layout\n\tif(layout.layoutID >= 0)\n\t{//if layout is open\n\t\treturn true;\n\t}\n\telse{\n\t\talert(\"Please open a layout to run the script\");//if no layout is open\n\t\treturn false;\n\t}\n}",
"function isUmbrellaLayout() {\n var $conte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
delete_analysis will delete an analysis | function delete_analysis(aname, analysis_id) {
if (confirm('Are you sure you want to delete analysis: ' + aname + '?')) {
var form = $("<form>")
.attr("action", window.location.href)
.attr("method", "post")
.append($("<input>")
.attr("type", "hidden")
.attr("name", "analysis_id")
.attr("va... | [
"removeAnalysis(id) {\n let index = this.getAnalysisIndex(id);\n if (index === undefined) return undefined;\n return this.analyses.splice(index, 1);\n }",
"remove(exec = true) {\n this.dc.del(`datasets.${this.id}`)\n this.dc.ww.just('dataset-op', {\n id: this.id,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display explanation dialog popup to explain create/rename/delete record settings on User Rights | function userRightsRecordsExplain() {
$.get(app_path_webroot+'UserRights/record_rights_popup.php', { pid: pid }, function(data) {
if (!$('#recordsExplain').length) $('body').append('<div id="recordsExplain"></div>');
$('#recordsExplain').dialog('destroy');
$('#recordsExplain').html(data);
$('#recordsExpla... | [
"applyPermission() {\n if (this.permission[2] == 0) {\n this.showEditColumn(false);\n }\n if (this.permission[3] == 0) {\n this.showDeleteColumn(false);\n }\n }",
"function get_explanation_text(explanation) {\n return `\n Action allowed?: ${explanation.is_allowed}; \n Because of\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
atribui valor_reset para o input text se o mesmo contiver um valor nao inteiro | function seNaoIntReset(obj_input, valor_reset)
{
if (obj_input.value.trim() == "")
{
obj_input.value = valor_reset;
return true;
}
obj_input.value = ((isNaN(obj_input.value)) || (obj_input.value.indexOf('.') > -1) ? //ATENCAO!! Kenneth removeu "|| parseInt(vlr) == 0" daqui pq nao aceita... | [
"function seNaoFloatReset(obj_input, valor_reset)\n{ \n /*Se informar um 3º parametro, esse sera considerado boolean\n para inserção ou nao dos zeros a esquerda. Padrao true*/\n var zerosEsquerda = (arguments[2] != null ? arguments[2] : true);\n var vlr = virgulaToPonto((obj_input.value.trim() == \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
END UTILITY / advanceTimers() is responsible for the waittime before a character can attack. This will be referred to as the attack timer. | function advanceTimers() {
// Checks if the enemy timer has reached its max
if (enemy.timer >= 100) {
// flag the enemy can go and run their attack
enemyCanGo = true;
enemyAttackPlayer();
}
// if not, advance the timer
if (!enemyCanGo) {
// this should be done in one ... | [
"advanceAttackCountdown() {\n // IF attack is counting down that means you are in the state of attacking:\n if (this.attackCountdown > 0) {\n // begin cooling down:\n this.attackCountdown -= 1;\n // calculate attack position based on sprite width (right-handed) and attack animation width (lefth... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to create overlay on tetonic plate boundaries | function createOverlay(tectonicplatesData) {
// Create a GeoJSON layer containing the features array on the tectonicplatesData object
var tectonic = L.geoJSON(tectonicplatesData, {
// Update default style for polygon
style: {
color: "rgb(253,126,20)",
opacity: 1,
fill: false
}
})
... | [
"function createDarknessOverlay() {\n \n /*\n * draw the darkness overlay and move it back in z position so that it is\n * behind the plant and carrot\n */\n darknessOverlay = draw.rect(600, 800).attr({\n 'fill-opacity': 0\n }).back();\n}",
"function CreateOverlayGraphic() { \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cria um ponto no mapa | function fazPonto(ponto) {
marca = new google.maps.Marker({ position : ponto, map : map });
cordenadasAtual = ponto;
setDocumentoInfo(ponto);
map.panTo(ponto);
} | [
"function inicializarMapa(){\r\n\r\n\t\tlet mapaPropriedades = {\r\n\r\n\t\t\tcenter: {lat: -14.850347, lng: -40.844363},\r\n\t\t\tmapTypeId: google.maps.MapTypeId.ROADMAP,\r\n\t\t\tzoom: 12\r\n\t\t}\r\n\r\n\t\tmapa = new google.maps.Map( document.getElementById(\"mapa\"),mapaPropriedades );\r\n\t}// incializar ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
validates recruiter fields and registers. | function registerRecruiter(recruiter) {
if(!validateRecruiter(recruiter)){
return;
}
var promise = RecruiterService.createRecruiter(recruiter);
promise.success(onCreateRecruiterSuccess);
promise.error(onCreateRecruiterFailure);
} | [
"function registerRecruiter(recruiter) {\n\n vm.createRecruiterError = null;\n vm.createRecruiterSuccess = null;\n\n var promise = RecruiterService.createRecruiter(recruiter);\n\n promise.success(onCreateRecruiterSuccess);\n promise.error(onCreateRecruiterFailu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle a collapse chunk button being clicked. The fully collapsed representation of that chunk will be fetched and put into the diff viewer in place of the expanded chunk. Args: e (jQuery.Event): The ``click`` event that triggered this handler. | _onCollapseChunkClicked(e) {
e.preventDefault();
let $target = $(e.target);
if (!$target.hasClass('rb-c-diff-collapse-button')) {
/* We clicked an image inside the link. Find the parent. */
$target = $target.closest('.rb-c-diff-collapse-button');
}
this... | [
"_onExpandChunkClicked(e) {\n e.preventDefault();\n\n let $target = $(e.target);\n\n if (!$target.hasClass('diff-expand-btn')) {\n /* We clicked an image inside the link. Find the parent. */\n $target = $target.closest('.diff-expand-btn');\n }\n\n this._expan... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Encode and join a sequence of url components with `'/'`. | function urlJoinEncode() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
return encodeURIComponents(urlPathJoin.apply(null, args));
} | [
"function encodeURIComponents(uri) {\n return uri.split('/').map(encodeURIComponent).join('/');\n}",
"function join() {\n var parts = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n parts[_i] = arguments[_i];\n }\n // Adapted from url-join.\n // Copyright (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prepares the page with all the menus on the page shown. | prepare() { this.createTopMenu(); this.createQuickMenu(); this.showQuickMenu(); } | [
"function setUpPage(){\r\n displayHeader();\r\n displayFooter();\r\n displaySideBar();\r\n createEventListeners();\r\n}",
"function initPage(){\r\n\t\t//add head class\r\n\t\t$(\"#headAssemblyLi\").addClass(\"active\");\r\n\t\t$(\"#leftNodeSelectLi\").addClass(\"active\");\r\n\r\n\t\tresetPage();\r\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
74 NUMEV test cases | function GetTestCase_NUMEV () {
var testCases = [];
for (NN = 1; NN < 4; NN++) {
if (NN == 1) nodeNumber = 0;
if (NN == 2) nodeNumber = 1;
if (NN == 3) nodeNumber = 65535;
for (Pindex = 1; Pindex < 4; Pindex++) {
if (Pindex == 1) eventCount = 0;
if (Pindex == 2) eventCount = 1;
if (Pindex ==... | [
"function test_tagvis_tag_and_vm_combination() {}",
"function test_tagvis_cluster_and_vm_combination() {}",
"function test_crosshair_op_vm_vsphere65() {}",
"function test_tagvis_tag_cluster_vm_combination() {}",
"function GetTestCase_NVANS () {\n\t\tvar testCases = [];\n\t\tfor (NN = 1; NN < 4; NN++) {\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrap the function to track statistics such as call count, execution time etc. | wrap() {
const originalFunc = this.originalFunc;
const stats = this.stats;
// reset stats
this.stats.callCount = 0;
this.stats.callTimeMinNs = 0;
this.stats.callTimeMaxNs = 0;
this.stats.callTimeAvgNs = 0;
this.wrapper = function() {
const st... | [
"function measure(fn) {\n\t const start = exports.debugNow();\n\t fn();\n\t return exports.debugNow() - start;\n\t}",
"check_stats(){\n \n\n }",
"function measure(fn) {\n const start = exports.debugNow();\n fn();\n return exports.debugNow() - start;\n}",
"logMetrics() {\n lo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
draw wheels of ETR480 | function generateWheels480(){
var distance = 1.7;
var w1 = generateWheel480();
var w2 = T([0])([distance])(w1);
var cylB = DISK(0.08)(16);
var cyl = EXTRUDE([distance])(cylB);
var side1Temp = STRUCT([T([1,2])([-0.15,-0.3]),w1,w2,T([2])([railWidth]),R([0,2])(PI/2),cyl]);
var side1 = STRUCT([R([1,2])(PI/2),... | [
"function drawWheel(){\n\tvar wheelRadius = 360 / wheel_arr.length;\n\tfor(var n=0;n<wheel_arr.length;n++){\n\t\t//pin\n\t\tvar thisPin = itemPin.clone();\n\t\t\n\t\tgetAnglePosition(thisPin, 0, 0, 205, (wheelRadius * n));\n\t\twheelPinContainer.addChild(thisPin);\n\t\t\n\t\t//wheel\n\t\tvar thisWheel = new createj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This class defines a complete listener for a parse tree produced by SRParser. | function SRListener() {
antlr4.tree.ParseTreeListener.call(this);
return this;
} | [
"function sectealListener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}",
"function RListener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}",
"function Listener() {\n\tantlr.tree.ParseTreeListener.call(this);\n this.nodeMap = {};\n this.nodeEdges = [];\n this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when the bullet is submitted | submitBullet(event) {
// Prevents the default action of refreshing the page
event.preventDefault();
// Call the onSubmit method provided by the parent BulletList and reset the text box
this.props.onSubmit(this.state.text);
this.setState({text: ''});
} | [
"function submitBullet(formObj) {\n let bulletEdit = formObj.getRootNode().host;\n let cateEditor = document.querySelector(\"bullet-editor-page\");\n\n //Check the length of new title\n let tooLong = false;\n let legnth = bulletEdit.bullet.title.length;\n if (legnth > 20) {\n tooLong = true;\n }\n\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Incrementing the current day until it is no longer a hidden day, returning a copy. If the initial value of `date` is not a hidden day, don't do anything. Pass `isExclusive` as `true` if you are dealing with an end date. `inc` defaults to `1` (increment one day forward each time) | function skipHiddenDays(date, inc, isExclusive) {
var out = date.clone();
inc = inc || 1;
while (
isHiddenDayHash[(out.day() + (isExclusive ? inc : 0) + 7) % 7]
) {
out.add('days', inc);
}
return out;
} | [
"function skipHiddenDays(date, inc, isExclusive) {\n\t\tvar out = date.clone();\n\t\tinc = inc || 1;\n\t\twhile (\n\t\t\tisHiddenDayHash[(out.day() + (isExclusive ? inc : 0) + 7) % 7]\n\t\t) {\n\t\t\tout.add(inc, 'days');\n\t\t}\n\t\treturn out;\n\t}",
"function skipHiddenDays(date, inc, isExclusive) {\n inc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
construct a given unit and return it | construct(unit) {
constructedUnit = unit.create();
return constructedUnit;
} | [
"function newUnit() {\n return new Unit( unitConfig );\n }",
"function createUnit(tileIn){\n\tvar newUnit = new Unit(tileIn);\n\tunitArray.push(newUnit);\n\tnewUnit.name = 'Worker ' + unitArray.indexOf(newUnit);\n\treturn newUnit;\n}",
"function unitFactory(name, valueStr, unitStr) {\n var dependenci... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Command 3 The resetDevice function encodes the JSON data to a 2 bytes array downlink messsage that resets the device. | function resetDevice(data) {
if (typeof data.reset !== 'boolean' || !data.reset) {
return {
errors: ["Missing required field or invalid input: reset"],
};
}
if (data.reset) {
return [0xFF, 0x00];
}
} | [
"function autoResetDevice(data) {\n if (typeof data.count !== 'number') {\n return {\n errors: [\"Missing required field or invalid input: count\"],\n };\n }\n // \n return [0x16].concat(decimalToHexBytes(data.count));\n}",
"function resetDevice(deviceId) {\n client.shell(deviceId, 'force-stop o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PKCS1 (type 2, random) pad input string s to n bytes, and return a bigint | function pkcs1pad2(s, n) {
if (n < s.length + 11) { // TODO: fix for utf-8
throw new Error("Message too long for RSA");
return null;
}
var ba = new Array();
var i = s.length - 1;
while (i >= 0 && n > 0) {
var c = s.charCodeAt(i--);
... | [
"function pkcs1pad1(s,n) {\n \n if(n < s.length + 11) {\n\talert(\"Message too long for RSA\");\n\treturn null;\n }\n \n var ba = new Array();\n\n ba[--n] = 0; // as if adding null to the string to be padded\n\n var i = s.length - 1;\n while(i >= 0 && n > 0) ba[--n] = s.charCodeAt(i--);\n ba[--n] = 0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attach delete button to the properties in the edit task form | function attachDeleteEdit(){
$('.delete-properties').off();
$('.delete-properties').click(function(){
$(this).closest('.form-group').remove();
propertyNumEdit--;
});
} | [
"function deleteButtonClicked(event)\n{\n const id= event.target.value;\n taskManager.deleteTask(id);\n displayTask(); \n}",
"_deleteTaskById(id) {\n var task = this._getDataById(id);\n task.deleted = true;\n this._renderItems();\n }",
"function insertEditTaskDeleteLink(divId)\n{\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Requests data from the server in order to initialise the Free For All game mode | function startFreeForAll(){
hideMenu(function(){
LoadingModule.show();
var data = {};
var success = function(response){
LoadingModule.hide();
game = new Game();
game.setCards(JSON.parse(response.deck));
use... | [
"requestRawGameData () {\n\t\t// Create new request\n\t\tvar resp = new XMLHttpRequest ();\n\t\t\n\t\t// Event trigger on response answer received or timeout\n\t\tresp.onreadystatechange = function() {\n\t\t\t// Answer received \n\t\t\tif (resp.readyState == 4) {\n\t\t\t\t// Success\n\t\t\t\tif (resp.status == 200)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
2. A tree will burn if at least one neighbor is burning 3. A tree ignites with probability f even if no neighbor is burning 4. An empty space fills with a tree with probability p | function Forest(w, h) {
this.w = 16; //size of a cell
this.columns = floor(w / this.w);
this.rows = floor(h / this.w);
this.cells = []; //stores the positions of "trees"
//"T" offset config
var o = (this.w/2) - textWidth("T")/2;
//Probabilities
this.fc = 100000; //Flame chance
this.tc = 20000; //Tre... | [
"function makeNNDescent(distanceFn, random) {\n return function nNDescent(data, leafArray, nNeighbors) {\n var nIters = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10;\n var maxCandidates = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 50;\n var delta = argume... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets this component base component instance. | get baseComponent() {
return this._baseComponent;
} | [
"get componentInstance() {\n if (this._contentRef && this._contentRef.componentRef) {\n return this._contentRef.componentRef.instance;\n }\n }",
"get componentInstance() {\n const nativeElement = this.nativeNode;\n return nativeElement &&\n (getComponent(native... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: _fnApplyToChildren Purpose: Apply a given function to the display child nodes of an element array (typically TD children of TR rows Returns: (done by reference) Inputs: function:fn Method to apply to the objects array nodes:an1 List of elements to look through for display children array nodes:an2 Another list... | function _fnApplyToChildren( fn, an1, an2 )
{
for ( var i=0, iLen=an1.length ; i<iLen ; i++ )
{
for ( var j=0, jLen=an1[i].childNodes.length ; j<jLen ; j++ )
{
if ( an1[i].childNodes[j].nodeType == 1 )
{
if ( typeof an2 != 'undefined' )
{
fn( an1[i].childNodes[j], an2[i].chi... | [
"function _fnApplyToChildren(fn, an1, an2) {\n\t\t\tfor (var i = 0, iLen = an1.length; i < iLen; i++) {\n\t\t\t\tfor (var j = 0, jLen = an1[i].childNodes.length; j < jLen; j++) {\n\t\t\t\t\tif (an1[i].childNodes[j].nodeType == 1) {\n\t\t\t\t\t\tif (typeof an2 != 'undefined') {\n\t\t\t\t\t\t\tfn(an1[i].childNodes[j]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format a transaction as a buy (B) or sell (S) flag | function formatFlagsData(transaction) {
var title = (transaction.buyerId == selectedTrader.id) ? 'B'
: 'S';
return {
x : transaction.timestamp,
title : title
};
} | [
"formatString() {\n const { sats, bolt11, address } = this.props;\n\n if (!address && !bolt11) {\n return '';\n }\n\n if (!address) {\n return `lightning:${bolt11.toUpperCase()}`;\n }\n\n let str = `bitcoin:${address}`;\n\n if (sats > 0 || bolt11) {\n str += '?';\n }\n\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
(slideOffsetTops, index, items) => vertical_conentWrapper.height | function updateContentWrapperHeight(){innerWrapper.style.height=slideOffsetTops[index+items]-slideOffsetTops[index]+'px';} | [
"function updateInnerWrapperHeight(){var maxHeight=autoHeight?getMaxSlideHeight(index,items):getMaxSlideHeight(cloneCount,slideCount);if(innerWrapper.style.height!==maxHeight){innerWrapper.style.height=maxHeight+'px';}}// get the distance from the top edge of the first slide to each slide",
"getSlideHeight() {\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update project Sample Status with equipment and status | static async updateProjectSampleDetails(key, sampleStatus, equipmentId) {
try {
let criteria = {
_id: key
};
let modifiedFields = {
status: sampleStatus,
equipmentId: equipmentId
};
let result = await DatabaseService.updateByCriteria(
Collection.PROJECT... | [
"function updateProjectStatus() {\n projects.forEach(el => {\n if (el.status === 'in progress')\n el.status = 'complete';\n });\n}",
"function updateStatus() {\n api.setStatus({\n status: vm.newStatus\n }).$promise.\n then(function(result) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Devuelve los valores de costos. Costo total del excedido>[excessCosto] = [excessM3] [excessConsumo] costo>[subtotal] = [base] + [excessCosto] | Costos(excesoM3) {
this.registro.excessCosto = excesoM3 * this.registro.excessConsumo;
this.registro.subtotal = this.registro.base + this.registro.excessCosto;
this.completado = true;
} | [
"calcularCostoTotal() {\n\t\treturn (\n\t\t\tthis.calcularPrecioBase() +\n\t\t\tthis.calcularAdicionales() -\n\t\t\tthis.calcularDescuentosGrupo() -\n\t\t\tthis.calcularDescuentosPorCodigo()\n\t\t);\n\t}",
"function calcularCostoImpuesto(costoConsola,cantidad){\n \n const IMPUESTO=114;\n const SEGURO=7;\n\n l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
log function duration statistics as text table | function logStats() {
const tbl = table(config.statTableName, stats.get(), config.units);
config.logFunction(tbl);
} | [
"logMetrics() {\n logger.info(`# of files indexed: ${this._filesIndexed}`);\n logger.info(`# of directories indexed: ${this._directoriesIndexed}`);\n logger.info(`# of unknown files: ${this._unknownCount}`);\n\n const endTimer = process.hrtime(this._startTimer);\n logger.info(`Exe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The randomize data button on the nav bar | showRandomizeDataButton() {
return showPictureWithOverlay(
this.state.showFirstPage && !this.state.showLearnMode,
"Generate Random Data",
() =>
this.setState({
data: generateRandomDataState(
this.props.featureClasses,
this.props.continousClasses,
... | [
"function changeButton() {\n $('#headerbutton').on('click', function(event){\n let type = types[Math.floor(Math.random()*types.length)];\n $('#headerbutton').html(type);\n });\n}",
"function randomButtonClick(event) {\n // reroute to proper aciton on the controller that will generate \n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the user profile views. | get profileViews() {
this._logger.debug("profileViews[get]");
return this._profileViews;
} | [
"get profileViews() {\n this._logService.debug(\"gsDiggUserDTO.profileViews[get]\");\n return this._profileViews;\n }",
"function viewProfiles(){\n\n\t//set current profile to null (need to login one profile now)\n\tprofile = null;\n\n\tloadProfiles();\n\tswitchView(\"profilesPage\");\n}",
"set profileVi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Class: Legend Legend object. Cannot be instantiated directly, but created by the Plot oject. Legend properties can be set or overriden by the options passed in from the user. | function Legend(options) {
$.jqplot.ElemContainer.call(this);
// Group: Properties
// prop: show
// Wether to display the legend on the graph.
this.show = false;
// prop: location
// Placement of the legend. one of the compass directions: nw, n, ne, e, s... | [
"function Legend(options) {\n $.jqplot.ElemContainer.call(this);\n // Group: Properties\n\n // prop: show\n // Wether to display the legend on the graph.\n this.show = false;\n // prop: location\n // Placement of the legend. one of the compass directions: nw, n, ne,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Profiles Stuff Get Profile Data (profiles search) | function getProfileData(){
let headers = loadHeaders();
callAPI(server + "api/mdm/profiles/search",headers,"profilesData"); //get main profiles list
} | [
"function getProfiles() {\n $.get(\"/api/searchs\", function (data) {\n profiles = data;\n console.log(profiles)\n // initializeRows();\n });\n }",
"function getProfileData() {\r\n IN.API.Raw(\"/people/~:(firstName,lastName,siteStandardProfileRequest,emailAddre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Merges from startPatch to endPatch and returns the new patch | function mergePatches(patches, startPatch, endPatch, paragraph_index) {
if (startPatch == endPatch) {
return patches[startPatch];
}
else {
print('Merging ' + startPatch + ' to ' + endPatch);
var newPatch = prune(startPatch, 10^10); // do a deep copy of the object, 10^10 take... | [
"createPatch(patch) {\n const original = this._original;\n const cursor = this._cursor;\n if (!original || !cursor) {\n return undefined;\n }\n const { start, end } = cursor;\n const { text } = original;\n const prefix = text.substring(0, start);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
render data for type product | function renderProductType () {
fetch("http://localhost:3001/api/productsType/all").then(res => {
return res.json()
}).then(data => {
setProductType(data)
})
} | [
"function renderProduct(data, product){\n\t$.extend( product, JSON.parse( data.productdata ));\n\tif(product.db_id == null){ product.db_id = data.id };\n\t// makeSideSwitchMenu( product ); \n\tloadImage( product );\n\tloadGrid( product );\n\tloadOptionalImages( product );\n}",
"function renderProductData () {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
process the add/rm requests by modifying the root node, and the update.names request by queueing nodes dependent on those named. | [_applyUserRequests] (options) {
// these just add and remove to/from the root node
// but both mean we have to do a full walk, not just fixing problems
// and stopping when we no longer see any problems.
if (options.add || options.rm)
this[_addRm](options)
// get the list of deps that we're ... | [
"function updateNode( node, nodeName, doing ) {\n // the node's resource\n var resource = getNodeInfo( node, \"resource\" );\n // the node's database ID; gets by removing the last 4 characters (\"_[resource]\") of its JSON ID to take only the numeric part\n var resource_id = node.id.slice(0,-4);\n // the data ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create default project node adds params defined by user to the stock node saves result to project record (under "nodes") | function initNode (req, io, project, callback) {
console.log("NODE CREATION: New node id:", mongojs.ObjectId());
console.log("NODE CREATION: nodeparams:", req.params);
// callback for inserting node to db
var insertNode = function (node, cb) {
mongoquery.update("mp_projects",
{_id:mongojs.ObjectId(node.p... | [
"function newDefaultProject() {\n const defaultProject = Project(\"Create a repo\", \"Steps to create new git repository\");\n\n defaultProject.addTodo(\n \"Create a new folder\", \n \"Open your terminal and \\\n enter the command 'mkdir new_project'\",\n \"Normal\",\n \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNZIONI funzione per prendere un elemento con id univoco | function prendiElementoDaId(id_elemento)
{
var elemento;
if(document.getElementById)
{
elemento = document.getElementById(id_elemento);
}
else
{
elemento = document.all[id_elemento];
}
return elemento;
} | [
"function seleccionaArticuloEdicion(id){\n articuloSeleccionado=id;\n var arreglo = new Array();\n arreglo=articulos;\n for(var i=0;i<arreglo.length;i++){\n if(arreglo[i].idArticulo == articuloSeleccionado)\n var datosArticulo = arreglo[i];\n }\n //console.log(datosArticulo);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load Sprite Image Load a sprite graphic path path to the image sprite width width of individual frame of sprite sprite height height of indiviual frame of sprite num_sprites total number of sprites in the graphic image pixel_border border around sprite | load_sprite_image(path, sprite_width, sprite_height, num_sprites, pixel_border) {
this.sprite.width = sprite_width;
this.sprite.height = sprite_height;
if (typeof pixel_border == 'undefined')
this.sprite.pixel_border = 0;
else
this.sprite.pixel_b... | [
"function handleImageLoad() {\n // data about the organization of the sprite sheet\n var spriteData = {\n images: [\"/images/cakerush/cake.png\", \"/images/cakerush/fatBlue.png\", \"/images/cakerush/fatRed.png\",\n \"/images/cakerush/fatYellow.png\", \"/images/cakerush/fatGreen.png\"],\n frames: [\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pick who is the enemy return true if successful, false if not | pickAnEnemy(enemyIdx) {
// if already picked cant pick again
if (this.currentEnemy != undefined) {
return false;
}
// pick enemy
let audioPick = new Audio(this.audioPickStr);
audioPick.play();
if (this.characters[enemyIdx].characterIsAlive) {
... | [
"maybeEnemy(){\n\t\tlet randnum = random(200);\n\t\tif (randnum < this.prob){\n\t\t\tthis.makeEnemy();\n\t\t\t\n\t\t}\n\t}",
"is_enemy(robot) {\n return robot.team !== this.me.team;\n }",
"attackEnemy() {\n if (this.warrior.feel(this.direction).isEnemy()) {\n this.warrior.attack(this.direction);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GM_addStyle() came from which was found at: where the following GM_addStyleOpera() was found, where it was called GM_addStyle(), however Chrome kept parsing the function and loading it, even though it was in a code block trying to avoid that. (RON) The following copyright notice appears to apply not only to the (uncopi... | function GM_xmlhttpRequestOpera(details) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
var responseState = {
responseXML:(xmlhttp.readyState==4 ? xmlhttp.responseXML : ''),
responseText:(xmlhttp.readyState==4 ? xmlhttp.responseText : ''),
... | [
"function GM_addStyle(css) {\r\n \tvar head = document.getElementsByTagName('head')[0], style = document.createElement('style');\r\n \tif(head) {\r\n \t\tstyle.type = 'text/css';\r\n \t\ttry {style.innerHTML = css} catch(x) {style.innerText = css}\r\n \t\thead.appendChild(style);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prompts the user to enter a value. It checks to make sure that the value is a number, then will call the doMath function. | function getValue(operator) {
rl.question("Enter value : ", (answer) => {
if (isNaN(answer) == true){
console.log("Please enter a number.")
askForOperation();
return;
}
doMath(operator, answer);
});
} | [
"function getValue(operator){\n readline.question('Enter a number: ', userNum => {\n if (isNaN(userNum)){\n console.log(\"Please enter input as a number.\");\n \n //have program re ask for a value\n getValue(operator);\n } else {\n performMath(o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns and sets the category attribute value. | get category() {
const value = Number(this.getAttribute('category'))
if (!Number.isNaN(value)) {
return value
} else {
return ''
}
} | [
"function setCategory() {\n\n var categoryStr = getColumnValue('category');\n var categorySet = false;\n\n if (!isEmptyOrNull(categoryStr)) {\n try {\n var category = JSON.parse(categoryStr);\n var categoryId = category.EBAY_LEAF_CATEGORY;\n if (typeof categoryId !==... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For each pair of adjacent edges crossing the sweep line, there is an ActiveRegion to represent the region between them. The active regions are kept in sorted order in a dynamic dictionary. As the sweep line crosses each vertex, we update the affected regions. | function ActiveRegion() {
this.eUp = null; /* upper edge, directed right to left */
this.nodeUp = null; /* dictionary node corresponding to eUp */
this.windingNumber = 0; /* used to determine which regions are
* inside the polygon */
this.inside = false; /* is this region inside the polygon? */
this... | [
"function ActiveRegion() {\n this.eUp = null;\n /* upper edge, directed right to left */\n\n this.nodeUp = null;\n /* dictionary node corresponding to eUp */\n\n this.windingNumber = 0;\n /* used to determine which regions are\n * inside the polygon */\n\n this.inside = false;\n /* is this region inside th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns boolean indicating if GOPATH is set or not If not set, then prompts user to do set GOPATH | function isGoPathSet() {
if (!getCurrentGoPath()) {
// TODO(hyangah): is it still possible after go1.8? (https://golang.org/doc/go1.8#gopath)
vscode.window
.showInformationMessage('Set GOPATH environment variable and restart VS Code or set GOPATH in Workspace settings', 'Set GOPATH in Wo... | [
"function isGoPathSet() {\n if (!getCurrentGoPath()) {\n vscode.window.showInformationMessage('Set GOPATH environment variable and restart VS Code or set GOPATH in Workspace settings', 'Set GOPATH in Workspace Settings').then(selected => {\n if (selected === 'Set GOPATH in Workspace Settings') ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read the data from XML using Jquery for Escambia County Traffic Signals | function loadEscambiaCountySignals(){
$.get("xml/EscambiaCountySignal.xml", {}, function(data) {
$(data).find("marker").each(function() {
var marker = $(this);
var intname = $(this).attr('intname');
var intnum = $(this).attr('intnum');
var latlng = new google.maps.LatLng(parseFloat(marker.attr("lat")),p... | [
"function getXMLCountryData() {\r\n\r\n\t$.ajax({\r\n\t\turl: 'CountryData.xml',\r\n\t\tdataType: 'xml',\r\n\t\tsuccess: function(data) {\r\n\t\t\tcountry_data = $(data).find('Records').find('Record');\r\n\t\t},\r\n\t\terror: function() {\r\n\t\t\talert('There was an error retrieving the country data :( \\n' +\r\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create source buffers and exlude any incompatible renditions. | tryToCreateSourceBuffers_() {
// media source is not ready yet or sourceBuffers are already
// created.
if (
this.mediaSource.readyState !== 'open' ||
this.sourceUpdater_.hasCreatedSourceBuffers()
) {
return;
}
if (!this.areMediaTypesKnown_()) {
return;
}
const ... | [
"tryToCreateSourceBuffers_() {\n // media source is not ready yet or sourceBuffers are already\n // created.\n if (this.mediaSource.readyState !== 'open' || this.sourceUpdater_.hasCreatedSourceBuffers()) {\n return;\n }\n if (!this.areMediaTypesKnown_()) {\n return;\n }\n const codecs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove highlight from feature | removeHighlight() {
if (this._highlight) {
this._highlight.setStyle({
fillOpacity: 0,
});
}
} | [
"function removeHighlight () {\n // Check for highlight\n if (highlight !== null) {\n // Set default icon\n highlight.setIcon(getDefaultIcon());\n // Unset highlight\n highlight = null;\n }\n}",
"function unselectPreviousFeatures() {\n var i;\n for(i = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Once the Adapt config has loaded, check to see if the language picker is enabled. If it is: stop the rest of the .json from loading set up the language picker model register for events to allow us to display the language picker icon in the navbar on pages and menus wait for offline storage to be ready so that we can ch... | function onConfigLoaded() {
if (!Adapt.config.has('_languagePicker')) return;
if (!Adapt.config.get('_languagePicker')._isEnabled) return;
Adapt.config.set("_canLoadData", false);
languagePickerModel = new LanguagePickerModel(Adapt.config.get('_languagePicker'));
A... | [
"function onOfflineStorageReady() {\n var storedLanguage = Adapt.offlineStorage.get(\"lang\");\n\n if (storedLanguage) {\n languagePickerModel.setLanguage(storedLanguage);\n } else if (languagePickerModel.get('_showOnCourseLoad') === false) {\n languagePickerModel.setLangu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns whether the fragment `prop` contains a fragment pointer for the given fragment's data, warning if it does not. | function validateFragmentProp(componentName, fragmentName, fragment, prop, prevVariables) {
var hasFragmentData = __webpack_require__(501).hasFragment(prop, fragment) || !!prevVariables && __webpack_require__(223)(prevVariables, fragment.getVariables());
if (!hasFragmentData) {
var variables = fragment.getVa... | [
"function validateFragmentProp(componentName, fragmentName, fragment, prop, prevVariables) {\n var hasFragmentData = __webpack_require__(26).hasFragment(prop, fragment) || !!prevVariables && __webpack_require__(22)(prevVariables, fragment.getVariables());\n if (!hasFragmentData) {\n var variables = fragment.ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detects class members from object literal | function detect_class_members_from_object(cls, ast) {
cls["members"] = []
return each_pair_in_object_expression(ast, function(key, value, pair) {
detect_method_or_property(cls, key, value, pair);
});
} | [
"function detect_class_members_from_array(cls, ast) {\n cls[\"members\"] = [];\n return _.each(ast[\"elements\"], function(el) {\n detect_method_or_property(cls, key_value(el), el, el);\n });\n}",
"_validateInstanceVariableInitialization(node, classType) {\n if (this._fileInfo.isStubFile) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Imprime um valor de forma sinalizada ou seja, com +/ na frente). | function ImprimeSinalizado(valor, dom, imprime_zero) {
if (imprime_zero == null) {
imprime_zero = true;
}
if (dom.length == null) {
if (valor > 0) {
dom.textContent = '+' + valor;
} else if (valor == 0) {
dom.textContent = imprime_zero ? '+0' : '';
} else {
dom.textContent = val... | [
"function ImprimeNaoSinalizado(valor, dom, imprime_zero) {\n if (imprime_zero == null) {\n imprime_zero = true;\n }\n\n if (dom.length == null) {\n dom.textContent = imprime_zero ? valor : '';\n }\n else {\n for (var i = 0; i < dom.length; ++i) {\n ImprimeNaoSinalizado(valor, dom[i]);\n }\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes in a list item and its index and returns a google maps InfoWindow | function createInfoWindow(item, index) {
let content = `<a href="${item.website()}" target="_blank"><h3>` +
`${item.name()}</h3></a><p>${item.info()}<br> `+
`<div><span>Current Weather:</span><canvas id="weather-info-${index}"` +
` width="32" height="32"></canvas></div>` +
`Rating:${item.rating()}/5</p>`;
r... | [
"function getInfoWindow(which)\n{\t\n for ( var m = 0; m < gmaps4rails_data.markers.length; ++m )\n {\n var markerInfo = gmaps4rails_data.markers[m].marker_object;\n if ( markerInfo == which ) \n {\n gmaps4rails_infowindow = new google.maps.InfoWindow({content: gmaps4rails_data.markers[m].descript... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Put a spotlight on a node | function spotlight(id) {
var node = $('#' + id + ' > rect');
var width = parseFloat(node.attr('width')) / 2;
var height = parseFloat(node.attr('height')) / 2;
var x = parseFloat(node.attr('x')) + width;
var y = parseFloat(node.attr('y')) + height;
var ellipse = '<ellipse class="spotlight" cx="'.concat(x, '" cy =... | [
"function setSpotLight(position)\n {\n spotLight.position.copy(position);\n spotLight.shadow.mapSize.width = 2048;\n spotLight.shadow.mapSize.height = 2048;\n spotLight.shadow.camera.fov = degreesToRadians(20);\n spotLight.castShadow = true;\n spotLight.decay = 2;\n spotLight.penumbra = 0.05;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Switch header to search mode | switchToSearchMode() {
this.setState({
headerInput: this.defaultSearchHeaderActions,
displayMode: DISPLAY_MODE_SEARCH,
});
} | [
"headerSearch(state, payload) {\n if (payload.mode === 'on') {\n state.settings.headerSearch = true\n } else if (payload.mode === 'off') {\n state.settings.headerSearch = false\n } else if (payload.mode === 'toggle') {\n state.settings.he... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
swtich the current lyric index | switchLyricIndex(state, index) {
state.songState.currentLyricIndex = index;
} | [
"changeIndex(){\n if(this.index == this.text.length - 1) this.index = 0\n else this.index++\n }",
"updateIndex(){\n this.props.updateIndex(this.props.currentState.index + 10);\n this.props.removeAllStoriesFromSelection(true); // This is done to ensure that there are no selected stories ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes a dir path from the mapping. It makes sure the dir path ends with a slash '/' | function removeDirPathToIdMap(dirPath) {
//make sure the dir path ends with a slash
dirPath = addEndingPathSeparator(dirPath);
//delete the dir path to dir id mapping
delete pathToIdMap[dirPath];
} | [
"removeMappedPath(def, sourcePath) {\n let map = this._unmappedPaths.get(def.identifier.fqn);\n for (let i=0; i < sourcePath.length; i++) {\n const p = sourcePath[i];\n // For now, don't deal with _Concept.*\n if (p.isConceptKeyWord) {\n return;\n } else if (i == sourcePath.length-1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a function called exclaim It receives a parameter called message It logs out message + "!" e.g. If I provided "hi", it should log "hi!" | function exclaim(message) {
console.log(message.toUpperCase() + "!");
} | [
"function adam(ticket) {\n console.log(`I exchanged my ticket for a ${ticket}`)\n}",
"function motivation(firstname, lastname) {\n var welcomeText = 'You are doing awesome, keep it up '\n function message() {\n let greeting = welcomeText + firstname + lastname \n return greeting \n }\n //U... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DFUNC: The validateSummary function | function validateSummary() {
// DVARO: gets the element with the id of summary
var summary = document.getElementById('summary');
// DIFDO: If no value is entered then it say a custom message if their is a value then nothing is displayed
if (summary.validity.valueMissing) {
summa... | [
"function SummaryValidation() {\n \n var Lo_Obj = [\"ddlCollateralType\", \"txtArea\", \"ddlSummState\", \"ddlSummCity\", \"txtAge\", \"txtValue\", \"txtLocation\", \"textBusinessActivity\", \"textFuturePlanes\"];\n var Ls_Msg = [\"Collateral Type\", \"Area\", \"State\", \"City\", \"Age\", \"Value\", \"Loc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks keyframe spline data for topology errors visavis time veid is optional, defaults to undefined | check_vdata_integrity(veid) {
var spline = this.pathspline;
var found = false;
if (veid === undefined) { //do all
this.check_paths();
for (var k in this.vertex_animdata) {
var vd = this.vertex_animdata[k];
found |= vd.check_time_integrity();
}
} else {
... | [
"function checkMovement(data)\n{\n return (data?.x !== undefined || data?.y !== undefined)\n}",
"function checkVertexData(metadata, vi_key, vo_key) {\n // skip the vertices that are mapped to something different\n if(metadata.vertexMap) {\n if(metadata.vertexMap.has(vi_key)) {\n if(metadata.vertexMap.g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Frame rate calculator copied from my C code call tick() AFTER everything is done in a frame including rendering getSeconds can be used to get the time for calculating speeds etc. for movement and physics use calculateFrameRate to get a FPS value | function FrameTimer()
{
var lastFrameRate;
var frameRate;
var startTime = getTime()
var frameSpacing;
var lastTick = getTime();
var fpsLastTick = getTime();
this.getSeconds = function()
{
var r = frameSpacing / 1000;
if(r == 0 || isNaN(r))
return 0;
return r;
}
th... | [
"calculateFrame() {\n const nowTime = (new Date()).getTime();\n this.tick += 1;\n if (nowTime - this.beforeTime >= 1000) {\n console.log(`fps: ${this.tick}`);\n this.tick = 0;\n this.beforeTime = nowTime;\n }\n }",
"function frameRate(fps) {\n timer = window.setInterval(updateCa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `ForwardedIPConfigurationProperty` | function CfnWebACL_ForwardedIPConfigurationPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, bu... | [
"function CfnRuleGroup_ForwardedIPConfigurationPropertyValidator(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... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make small turns so robot will not miss out any black lines | function small_turn(dir) {
const motor_dur_small_turn = 55;
const motor_spd_forward = 500;
const motor_spd_reverse = -500;
//value of motor duration and speed corresponds to the angles that robot
//should turn. In this case, we want the robot to make small turns.
//speed of motor have... | [
"function possibleBotSmallSwitch() {\n if (\n mat[7][4].isTaken &&\n mat[7][4].piece.type == \"king\" &&\n !mat[7][5].isTaken &&\n !mat[7][6].isTaken &&\n mat[7][7].isTaken &&\n mat[7][7].piece.type == \"rook\" &&\n mat[7][4].piece.color == mat[7][7].piece.color\n ) {\n return true;\n } e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ask if the sweep is a full sweep from south pole to north pole. | get isFullLatitudeSweep() {
const a = Math.PI * 0.5;
return Angle_1.Angle.isAlmostEqualRadiansNoPeriodShift(this._radians0, -a)
&& Angle_1.Angle.isAlmostEqualRadiansNoPeriodShift(this._radians1, a);
} | [
"get isFullCircle() { return Angle_1.Angle.isFullCircleRadians(this.sweepRadians); }",
"function worthDriving (xStart, xEnd, yStart, yEnd, xDriver, yDriver) {\r\n var presentDrive = false;\r\n\r\n //check if picking passenger up from start coordinate, then dropping off, then going to driver destination is w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Click Listeners / Below three functions activate, deactivate works in accordance with the reply_click function described below Purpose: Aim is to make the wall making procedure easy to perform rather then clicking each rect to make wall[very tough]. Achieved: After creating these methods now user needs to click on an... | function activate(event){
/* Mark the initiate_coloring_walls as true so that rects can be alloted colors as if it is false then color cannot be performed */
initiate_coloring_walls = true;
/*
* Get the id of the target which is clicked using event object and if the marked is already of wall color that mea... | [
"function reply_click(event) {\n\n /* \n * initiate_coloring_walls is a boolean variable which decided whether to color the rect tag or not.\n * Purpose: It is triggered when user clicks any grid to make it wall and till the removes the click it will remain true.\n * Aim: This was done in order to achieve... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a product index based on it's name | getProduct(name) {
for (var i = 0; i < productList.length; i++) {
var thisProduct = productList[i];
if (thisProduct.name.toLowerCase() === name.toLowerCase()) {
return i;
}
}
} | [
"function getProductIndex(name) {\n for (let i = 0; i < this.length; i++) {\n if (this[i][1] === name) return i;\n }\n return undefined;\n }",
"getIndex(numIndex) {\n\t\tif (!numIndex) {\n\t\t\treturn null;\n\t\t}\n\t\tnumIndex = parseInt(numIndex, 10);\n\t\tif (!lodash.isNumber(numIndex)) {\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tries to transfer energy to container. | function transferEnergyToContainer(creep) {
let structure = creep.pos.findClosestByPath(FIND_STRUCTURES, {
filter: (s) => (s.structureType == STRUCTURE_CONTAINER
&& _.sum(s.store) < s.storeCapacity)
});
let transferReturnMessage = transferEnergyToStructure(creep, structure, true);
return transferReturnMessage;... | [
"function transferEnergyToStorage(creep) {\n\tlet structure = creep.pos.findClosestByPath(FIND_STRUCTURES, {\n\t\tfilter: (s) => (s.structureType == STRUCTURE_STORAGE\n\t\t\t// && s.energy < s.energyCapacity\n\t\t)\n\t});\n\ttransferReturnMessage = transferEnergyToStructure(creep, structure, true);\n\treturn transf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |