query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Remove all registered rule and clear messages. | resetRules() {
this.ruleContextAgent.removeAllListeners();
this.ruleManager.resetRules();
} | [
"clearRules()\n {\n this._rules.length = 0;\n }",
"cleanUp()\n {\n // grammar empty\n if (!this._rules.length) \n {\n this.clear();\n }\n\n // to remove duplicate rules, we make use of the toString method and Set data Structure.\n let rule = thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Swap the books' weight before: [asks] index [bids] 10 8 6 currentPrice 10 8 6 after: [asks] index [bids] 6 8 10 currentPRice 6 8 10 | function weighBooks() {
if (currentHeavy == 'bid') {
for (let i = 0; i < mmConf.ORDERAMOUNT; i++) {
mmQue.push(createOrderObj('changeOrder', round((mmConf.ORDERAMOUNT - i) * mmConf.FIRSTAMOUNT), asks[i], 1));
mmQue.push(createOrderObj('changeOrder', round((i + 1) * mmConf.FIRSTAMOUNT... | [
"function moveUp() {\n\n // Buying other traders' limit asks\n if (trade.orderBook[1][0].price <= asks[0] - mmConf.SPREAD) {\n\n let indexToOrderSpread = round(index - trade.orderBook[1][0].price);\n if (indexToOrderSpread > mmConf.TAKERFEE * index) {\n\n let amountToBuy = round(Math.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create 10 log files with text and print the names of them to the console | function create_log_files() {
if (path.basename(process.cwd()) == 'logs') {
let file_name;
console.log(`All files in /${path.basename(process.cwd())}`);
for (let i = 0; i < 10; i++) {
file_name = `textfile${i + 1}.txt`;
fs.writeFile(file_name, `This is the text for ... | [
"function createNewLogFile() {\n var basePath = (global.TYPE.int === global.TYPE_LIST.CLIENT.int ? \"./\" : path.join(__dirname, \"..\")); //Get base path\n if (fs.existsSync(path.join(basePath, \"Timbreuse.10.log\"))) //If log 10 exists, delete\n fs.unlinkSync(path.join(basePath, \"Timbreuse.10.log\"));\n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
delete route required data: token in header. cart_id (which is index of item in cart list to be removed) optional data: none | delete(req,callback){
var token = typeof(req.headers["x-token"]) == "string" && req.headers["x-token"].trim().length == config.token_length ? req.headers["x-token"].trim() : false;
var cart_id = typeof(req.body.cart_id) == "number" ? req.body.cart_id : false;
// specifically checking cart id fo... | [
"function deleteCart(req,res,next){\n cartService.remove(req.params.id)\n .then(() => \n res.status(200).json({\n message: \"Cart deleted successfully\"\n }))\n .catch((err) => next(err))\n}",
"function deleteCart(req, res) {\n\tDB.Cart.findOneAndRemove({ _id: req.params.id }).exec((err, dCa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns JSX of the rules for a specified selector | getRules(selector, selectorNum) {
// Generate the options for the category dropdown
var categoryOptions = ["All", "Chicken","Beef","Salad","Soup","Stew","Pasta","Egg","Pork","Fish","Sandwich","Seafood","Baked","Fried","Bread","Pizza"].map(category => {
return(<option value={category}/>)
... | [
"getSelectors() {\n var selectors = []\n\n // First check that the ruleset exists and there are selectors in it\n if (this.state.rulesets.length > 0 && this.state.rulesets[this.state.currentRuleset]) {\n var i = -1\n\n // Iterate through each selector in the ruleset\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
print connection track string, and only record the leading and the trailing TRACK_MAX_SIZE / 2 | dumpTrack() {
const strs = [];
const perSize = Math.floor(TRACK_MAX_SIZE / 2);
const tracks = (this._tracks.length > TRACK_MAX_SIZE) ?
this._tracks.slice(0, perSize).concat([' ... ']).concat(this._tracks.slice(-perSize)) :
this._tracks;
let ud = '';
for (const el of tracks) {
if (e... | [
"function printTracks(tracks) {\n\n if (tracks.length > 1)\n console.log(\"-----TRACKS-----\");\n else\n console.log(\"-----TRACK-----\");\n\n for (var j = 0; j < tracks.length; j++) {\n\n var artists = \"\"\n\n for (var i = 0; i < tracks[j].artists.length; i++) {\n a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
eslintdisable norestrictedsyntax Create a function objFilter that accepts an object and a callback. objFilter should make a new object, and then iterate through the passedin object, using each key as input for the callback. If the output from the callback is equal to the corresponding value, then that keyvalue pair is ... | function objFilter(obj, callback) {
const newObj = {};
for (const key in obj) {
if (callback(key) === obj[key]) {
newObj[key] = obj[key];
}
}
return newObj;
} | [
"function filterFunction(obj, key, value){\n\tif(obj[key] === value) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}",
"function pickBy(obj, cb){\n let result = {};\n for (let key in obj){\n if(cb(obj[key])) result[key]=obj[key];\n }\n return result;\n}",
"function filter(object, property, cal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the thumbnail width. | set width(aValue) {
this._logService.debug("gsDiggThumbnailDTO.width[set]");
this._width = aValue;
} | [
"set originalWidth(aValue) {\n this._logService.debug(\"gsDiggThumbnailDTO.originalWidth[set]\");\n this._originalWidth = aValue;\n }",
"function setThumbnailContainerSize(thumbnailContainer){\n \n // If parent is more than 3 200px thumbnails, set width of thumbnail container as interval of 200px + 5... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
! patientName: event[1], ! patientState: event[2], ! appointmentExplanation: event[3], ! appointmentNotes: event[4], ! appointmentDentist: event[5], | function Event({ event }) {
let eventArr = event.title.split('-');
return (
<span style={{ width: '100%' }}>
<div className="eventPatientName">Hastanın Adı: {eventArr[1]}</div>
{/* <div className="eventPatientState">{eventArr[2]}</div> */}
<div className="eventAppointmentExplanation">Tedavi: ... | [
"function eventInfoPrepper(body){\n var event_id = (body.event_id) ? body.event_id : null;\n var user = (body.user_id) ? body.user_id : null;\n var start = (body.start_datetime) ? body.start_datetime : null;\n var end = (body.end_datetime) ? body.end_datetime : start;\n var title = (body.title) ? bod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updateJQuery // set $.bridget for v1 backwards compatibility | function updateJQuery( $ ) {
if ( !$ || ( $ && $.bridget ) ) {
return;
}
$.bridget = jQueryBridget;
} | [
"function addButtonClickHandlers()\n {\n \n $(\"#perc-wb-button-new\").unbind().click(function(){\n handleWidgetNew();\n });\n $(\"#perc-widget-save\").on(\"click\",function(){\n handleWidgetSave();\n });\n $(\"#perc-widget-close\").on(\"click\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add archived status to all completed todos | archiveAllTodos() {
let todos = this.state.todos.forEach(todo =>
todo.status === 'complete' ?
this.completeTodo({...todo, status: 'archived'}) :
todo
)
} | [
"completeAllTodos() {\n let todos = this.state.todos.forEach(todo =>\n todo.status === 'complete' ||\n todo.status === 'archived' ?\n todo :\n this.completeTodo({...todo, status: 'complete'})\n )\n }",
"completeAllItems() {\n this.items.forEach(item => {\n item.s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CODING CHALLENGE 776 Create a function that replaces "the" in the sentence with "an" or "a". Remember that if the next word begins with a vowel, use "an". In the case of a consonant, use "a". | function replaceThe(str) {
const a = [];
for (let i = 0; i < str.split(" ").length; i++) {
if (str.split(" ")[i] === "the" && /[aeiou]/.test(str.split(" ")[i+1][0])) {
a.push("an");
} else if (str.split(" ")[i] === "the" && /([b-df-hj-np-tv-z])/.test(str.split(" ")[i+1][0])) {
a.push("a");
} else a.push(s... | [
"function owofied(sentence) {\n\tconst a = sentence.replace(/i/g, \"wi\");\n\tconst b = a.replace(/e/g, \"we\");\n\treturn b + \" owo\";\n}",
"function encodeConsonantWord(word) {\n\n \n word = word.toLowerCase();\n let firstletter = word[0];\n let cons_phrase = \"-\";\n \n\n while\n (firstletter !== \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle VV8 log postprocessing if any files are available | async function postprocVv8Logs(log, workDir) {
const vv8logs = await asyncGlob(`${workDir}/vv8-*.log`).catch((err) => console.error(`visitPage: glob(...) threw '${err}'`));
const logDoc = {
logs: 0,
proc: false,
};
if (vv8logs && vv8logs.length) {
// Run the post-processor (uses ... | [
"function logFileChange(event) {\n\t\tvar fileName = require('path').relative(__dirname, event.path);\n\t\tconsole.log('[' + 'WATCH'.green + '] ' + fileName.magenta + ' was ' + event.type + ', running tasks...');\n\t}",
"consumeLogs () {\n try {\n this.tail = new Tail(this.logPath)\n } catch (err) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParsercolumn_name. | visitColumn_name(ctx) {
return this.visitChildren(ctx);
} | [
"visitXml_column_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitNew_column_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitParen_column_list(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitAdd_column_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitRename... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public function `lessOrEqual`. Returns true if `lhs` is a number less than or equal to `rhs`, false otherwise. | function lessOrEqual (lhs, rhs) {
return number(lhs) && lhs <= rhs;
} | [
"function lessOrEqual (data, value) {\n return number(data) && data <= value;\n }",
"function greaterOrEqual (data, value) {\n return number(data) && data >= value;\n }",
"lt(other) {\n return this.boolOps(other, \"lt\");\n }",
"function less (data, value) {\n return number(data... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Class: wfExpandLayout Extends for expanding the map layout, so that no overlapping shapes are shown in the map. Example: (code) var layout = new wfExpandLayout(graph, true, 10, true); layout.execute(graph.getDefaultParent()); (end) Constructor: wfExpandLayout Constructs a new expand layout layout for the specified grap... | function wfExpandLayout(graph, spacing, ltrEdges) {
mxGraphLayout.call(this, graph);
this.spacing = spacing || 0;
this.ltrEdges = ltrEdges;
} | [
"function pmaLayout(graph)\n\t{\n\t\tmxGraphLayout.call(this, graph);\n\t}",
"function WideSVG(svg, expandElement) {\n this.svg = svg;\n this.helper = new SVGHelper(svg);\n\n if (expandElement instanceof Node)\n this.expandElement = expandElement;\n else if (expandElement)\n this.expandE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates a grammar file into the dist folder for each view. The grammar file defines the voice commands that will cause the associated Application Event to be fired when the voice command is recognized by the device. If there are no application events with an associated voice alias, the generation of the grammar files... | function compileVoiceRecGrammarFiles(saveConfig) {
let viewsDistPath = path.join(saveConfig.destTargetRoot, 'app', 'components');
fs.ensureDirSync(viewsDistPath);
const dataFile = fs.readJsonSync(path.join(saveConfig.srcSharedRoot, 'components', 'Data.json'));
// find all twx-app-event elements that have a non... | [
"function compileVoiceRecGrammarFiles(saveConfig) {\n let viewsDistPath = path.join(saveConfig.destTargetRoot, 'app', 'components');\n fs.ensureDirSync(viewsDistPath);\n\n const dataFile = fs.readJsonSync(path.join(saveConfig.srcSharedRoot, 'components', 'Data.json'));\n // find all twx-app-event elements that ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UNIVERSAL update totals function looks for products, donations, subscriptions, and membership populates appropriate hidden fields and updates totals screen | function updateTotals(initialTotal){
var tempTotal = 0.00;
var donsTotal = 0.00;
var membershipTotal = 0.00;
var subsTotal = 0.00;
var subItems = '';
var cartItems = '';
if(initialTotal != undefined){
tempTotal = parseFloat(initialTotal);
}
//all subscription type items
//cycles thorugh all items where cl... | [
"function update_totals() {\r\n\r\n var shipping_container = software_$('.shipping');\r\n var total_container = software_$('.total');\r\n\r\n // If the shipping container or total container does not exist, then we don't need to\r\n // update totals.\r\n if (!sh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw shapes on a grid, automatically adjusting grid layout to centre and maximise space parameters: shapeFn: callback (takes no params) to draw a shape at 0, 0, with a size as promised by originalSizeAsScreenFraction paddingAsShapeFraction: desired distance BETWEEN TWO instances, as fraction of shape's size. This is NO... | function drawOnGrid(shapeFn, originalSizeAsScreenFraction, paddingAsShapeFraction) {
const smallestDim = min(width, height);
const largestDim = max(width, height);
const calcPaddedSize = (screenFraction) => screenFraction * (1 + paddingAsShapeFraction) * smallestDim;
const originalSizeWithPadding = calcPaddedSize(... | [
"function drawBoard(size) {\r\n if (size <= 1) {\r\n alert(\"Specified grid size MUST >= 2!\");\r\n return;\r\n }\r\n \r\n var startx = GAP_SIZE;\r\n var starty = GAP_SIZE;\r\n\r\n for (var row = 0; row < size; ++row) {\r\n for (var col = 0; col < size; ++col) {\r\n drawLine(startx, starty + UNI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute estimate of malt polyphenols in finished beer, in ppm. This estimate of actual polyphenols is not accurate, but it should be a reasonable estimate of how these malt polyphenols affect IBUs. | function compute_maltPP_beer(ibu) {
var factor = 0.0;
var IBU_malt = 0.0;
var IBU1 = 0.70;
var pH = ibu.pH.value;
var points = 0.0;
var PP_malt = 0.0;
var preBoilIBU = 0.0;
var preBoilpH = ibu.pH.value;
var preOrPostBoilpH = ibu.preOrPostBoilpH.value;
var slope = 1.7348;
// If user specifies pre-... | [
"function airprops(t, p, phi) {\r\n var result = {};\r\n result[\"Relative Humidity (%)\"] = phi * 100;\r\n result[\"Sat Water Pressure (psia)\"] = pws(t); //Pressure of saturated pure water psia\r\n result[\"Sat Humidity Ratio\"] = Ws(t, p); //Saturation humidity ratio\r\n //Equation used to solve h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function called on response finish that sends stats to statsd | function sendStats() {
if (hostname.indexOf("local") != -1) {
cleanup();
return;
}
var app = options.app;
// Status Code
var statusCode = res.statusCode || 'unknown_status';
// Increment
sendData("serve... | [
"function successfullScrape() {\n fs.readFile('./stats.json', 'utf-8', function(err, data) {\n if (err) discordErrorMsg(err)\n var statsArray = JSON.parse(data);\n var today = Date.now()\n statsArray.lastPosted = today;\n statsArray.totalSuccessful++\n fs.writeFile('./st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function allows you to test whether every value in an object matches a certain criteria. For example, is every value greater than 100? The function receives an object and a tester function. If all values in the object pass the tester function, true is returned. Otherwise, return false. | function every(obj, func) {
let result = false;
for (let key in obj) {
let match = func(obj[key]);
if (match) {
result = true;
}
else { return false; }
}
return result;
} | [
"function checkAge(arr) {\n if(arr.every(function (person) {\n return (person.age > 18);\n })) {\n return true;\n }\n return false;\n}",
"function filterFunction(obj, key, value){\n\tif(obj[key] === value) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}",
"_potIsGood... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get string for check practice or test | function getStringCheck(scenarioOrVocabulary) {
var modeString;
var practiceOrTest;
if (memoryWritingConversation == "memory") {
modeString = "Memory";
} else if (memoryWritingConversation == "writing") {
modeString = "Writing";
} else {
modeString = "Conversation";
}
if ($("#practice_test").val() == "pra... | [
"function getCurrentTitle(level){\n if(level === 1){\n currentTitle = \"Multiple Choice Test\";\n }else if(level === 2){\n currentTitle = \"True or False Test\";\n }else{\n currentTitle = \"Fill in the Blank Test\";\n }\n \n return currentTitle; \n }",
"getTranslationStr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts pulses to the watt unit. | function pulsesToWatt(pulses) {
return pulsesToKwh(pulses * 1000);
} | [
"function pulsesToKwh(pulses) {\n return (pulses / 3600.0) / 468.9385193;\n}",
"function SpectrumToWaves(notePowers){\n\n // This function takes in notePowers, which attributes to each note to a given 'power'. \n\n // For each octave these powers are normalize. \n var normedOctaves = []; \n // Looping thro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiates a back ease easing | function BackEase(/** Defines the amplitude of the function */amplitude){if(amplitude===void 0){amplitude=1;}var _this=_super.call(this)||this;_this.amplitude=amplitude;return _this;} | [
"constructor(tbx, tby, scalex, scaley, ax, ay, arrowx, arrowy, direction){\n\t\tif(currentLevel > 2){\n\t\t\ttbx = tbx * 16;\n\t\t\ttby = tby * 16;\n\t\t\tscalex = scalex * 16;\n\t\t\tscaley = scaley * 16;\n\t\t\tscalex = (scalex - tbx)/402;\n\t\t\tscaley = (scaley - tby)/352;\n\t\t\tarrowx = arrowx * 16;\n\t\t\tar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copy dependencies to ./public/libs | function copy_libs(cb) {
// Copy all the libraries under @bower_components to libraries/.
gulp.src([
"./node_modules/@bower_components/**/*.**",
], {base: "./node_modules/@bower_components"})
.pipe(gulp.dest('./app/libraries'));
// Copy the minified @m-lab/ndt7 js files to libraries/.
gulp.src([
... | [
"function copyAssets(done) {\n var assets = {\n js: [\n \"./node_modules/jquery/dist/jquery.js\",\n \"./node_modules/bootstrap/dist/js/bootstrap.bundle.js\",\n \"./node_modules/metismenujs/dist/metismenujs.min.js\",\n \"./node_modules/jquery-slimscroll/jquery.sl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CLASS LayoutProvider DESCRIPTION Private class that provides layout building blocks for the application UI. SAMPLE USAGE N/A (internal use only) | function LayoutProvider () {
/**
* Turns a certain HTML element into a CSS box.
* @method
* @public
* @param target { HTML Element }
* The HTML element that is to be set up as a CSS box. This
* implies both out-of-page-flow(1) positioning and fixed
* dimensions(2).
* @param... | [
"function setupLayout() {\n\t$('body').layout({\n\t\twest__showOverflowOnHover : true,\n\t\tresizable : false,\n\t\tclosable : false\n\t});\n\n\t$('.ui-layout-west a').click(function() {\n\t\tvar id = $(this).attr('id');\n\t\tif (id == 'upload') {\n\t\t $('#uploadForm :input').val('');\n\t\t\t$('#errorBox').html... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds three event listener to the modal, takes the index/idnumber of the array object referenced in the modal. Close listener closes the modal when an x button is clicked. Back button listener shows a modal for the previou semployee. Next button listener shows modal for the next employee. | function addEventListenersToModal(idNumber) {
// close button listener
$('.close').click(function() {
$('.modal').css('display', 'none');
$('.modal-content').remove();
})
// back button listener
$('.back').click(function() {
let last = idNumber - 1;
if (idNumber > 0) {
$('.modal-content... | [
"function displayEmployeeModal(index) {\n let employee = employees[index];\n let firstName = capitalize(employee.name.first);\n let lastName = capitalize(employee.name.last);\n let address = formatAddress(employee);\n let dob = formatDateOfBirth(employee.dob);\n let modalContent = '<div class=\"modal-content\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
4.8 Fills polygones settings panel | function dml_Fill_Polygon_Settings_Panel(myPolygonID, myPolygonBorderColor, myPolygonFillColor, myPolygonDescription, myPolygonImage, myPolygonVideoCode, myPolygonLinkText, myPolygonLinkUrl, myPolygonLat, myPolygonLng, myPolygonFillHoverColor) {
// Clears content of panel
jQuery("#dmlEssSettingsModalBody").html("");
... | [
"startPolygon() {\n //TODO\n }",
"function drawEditionElements() {\n if (editionCheckbox.checked) {\n // Draw points\n for (var ptIndex = 0; ptIndex < customPoints.length; ptIndex++) {\n ctx.fillStyle = \"#f00\";\n ctx.fillRect(customPoints[ptIndex].x - (pointWidth / 2), customPoints[pt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Represents a collection of errors for the purpose of consumers that generally only deal with one error. Callers can extract the individual errors contained in this object, but may also just treat it as a normal single error, in which case a summary message will be printed. | function MultiError(errors)
{
mod_assertplus.array(errors, 'list of errors');
mod_assertplus.ok(errors.length > 0, 'must be at least one error');
this.ase_errors = errors;
VError.call(this, {
'cause': errors[0]
}, 'first of %d error%s', errors.length, errors.length == 1 ? '' : 's');
} | [
"errors() {\n return ys(this.rawErrors, (e) => e.join(`\n`));\n }",
"getErrorsAsString() {\n\t\tif (!this.items || !this.items.error || this.items.error.length <= 0) {\n\t\t\treturn \"\";\n\t\t}\n\t\tconst str = this.items.error.join(\". \");\n\t\treturn str;\n\t}",
"rawErrors() {\n return p.valida... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
APPSERVER_CLUSTER MESSAGE & REQUEST | function send_central_app_server_request(plugin, collections,
mbody, auth, method, next) {
ZH.l('|->(C): ' + method);
var id = ZDelt.GetNextAgentRpcID(plugin, collections);
var data = {device : {uuid : ZH.MyUUID},
body : mbody};
var jrpc_... | [
"function pushMessage(text) {\n if (kony.net.isNetworkAvailable(constants.NETWORK_TYPE_ANY)) {\n kony.application.showLoadingScreen(\"\", \"\", constants.LOADING_SCREEN_POSITION_ONLY_CENTER, true, true, null);\n mobileFabricConfiguration.integrationObj = mobileFabricConfiguration.konysdkObject.getI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Accepts an Array, and returns an Array with only the deepest Arrays (that is, Arrays containing Strings, not other Arrays) uniquified. | function arrayUniqDeep(array) {
if (Array.isArray(array[0])) {
array.forEach(function(item, i) {
array[i] = arrayUniqDeep(item);
});
return array;
} else {
return arrayUniq(array);
}
} | [
"function uniteUnique(...uniqueArray) {\n// spreads ([1], [2,[1,0]], [3, 2,[1,0]]) to ([1], [2,1,0], [3,2,1,0])\n console.log(\"uniqueArray: \" + uniqueArray);\n \n // .reduce() with .concat() ([1], [2,1,0], [3,2,1,0]) to ([1], [2,1,0], [3,2,1,0])\n return uniqueArray.reduce(function(accumu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Intantiates a VirtualJoysticksCamera. It can be usefull in First Person Shooter game for instance. It is identical to the Free Camera and simply adds by default a virtual joystick. Virtual Joysticks are onscreen 2D graphics that are used to control the camera or other scene items. | function VirtualJoysticksCamera(name,position,scene){var _this=_super.call(this,name,position,scene)||this;_this.inputs.addVirtualJoystick();return _this;} | [
"function VirtualJoystick(leftJoystick) {\n var _this = this;\n if (leftJoystick) {\n this._leftJoystick = true;\n }\n else {\n this._leftJoystick = false;\n }\n VirtualJoystick._globalJoystickIndex++;\n // By default left & right arrow keys are... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if you want to do it in constant space (other than the output), you could abuse the O(n) output you're allowed to create as a substitute for `productsToRight` | function solution_2 (nums) {
const output = Array(nums.length).fill(1); // we never have to create a new `productsToRight` array
for (let i = nums.length - 2; i >= 0; i--) {
output[i] *= output[i + 1] * nums[i + 1]; // e.g. [24, 12, 4, 1]
}
let productToLeft = 1; // th... | [
"function accumulatingProduct(arr) {\n\tconst a = [];\n\tif (arr[0]) a.push(arr[0]);\n\tfor (let i = 1; i < arr.length; i++) {\n\t\ta.push(arr[i] * a[a.length - 1]);\n\t}\n\treturn a;\n}",
"function productOfArray(arr){\n if (arr.length === 1) return arr[0]\n return arr[0] * productOfArray(arr.slice(1))\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function newComputePi: only difference required is calling different calcChargeAtpH routine using ACDE... objects | function newComputePi() {
// Start at pH 7. Determine charge, contributed by N and C termini and charged amino acid side chains (performed by calcChargeAtpH).
// Adjust pH upward or downward by currentStep and recompute the charge. Step in the correct direction again, this
// time stepping 1/2 as far.
// Continue w... | [
"function compute_concent_wort(ibu) {\n var AA_dis = 0.0; // concentration of dissolved AA, in ppm\n var AA_dis_mg = 0.0; // dissolved AA, in mg\n var AA_init = 0.0; // [AA]_0, in ppm\n var AA_init_mg = 0.0; // initial amount of AA added, in mg\n var AA_limit_func_A = 0.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check User's Pattern If user's currently pressed color matches the corresponding color of the same index in gamePattern, continue. | function checkAnswer(currIndex) {
if (userClickedPattern[currIndex] === gamePattern[currIndex]) {
// If userClickedPattern = gamePattern entirely, then go to next sequence.
if (userClickedPattern.length === gamePattern.length) {
userClickedPattern = [];
setTimeout(function() {
... | [
"displayPattern(index, prevColor, pattern, patternDisplaySubscription) {\n //check values\n //first case: the index is pattern.size; exit out of bounds\n let that = this;\n //remove prev color if exists\n if (prevColor !== undefined) {\n console.log(\"Deactivating Color... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getDirectionIndex get the current directionIndex | getDirectionIndex() {
return this.directionIndex;
} | [
"defineDirection() {\n var posRoad = this.road[this.partRoad];\n if (Number(this.pos.getx()) == Number(posRoad.getx())) {\n if (Number(this.pos.gety()) < Number(posRoad.gety())) {\n return SOUTH;\n } else {\n return NORTH;\n }\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns all registered Scrollables that contain the provided element. | getAncestorScrollContainers(elementRef) {
const scrollingContainers = [];
this.scrollContainers.forEach((_subscription, scrollable) => {
if (this._scrollableContainsElement(scrollable, elementRef)) {
scrollingContainers.push(scrollable);
}
});
retu... | [
"function Scrollable(element) {\n if (!(this instanceof Scrollable)) return new Scrollable(element);\n this.element = element;\n this.scrollElement = Scrollable.fn.getScrollElement(element);\n this.scroller = {\n '1': new Smooth(this.scrollElement, 'scrollLeft'),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When we we've read the first dash inside a comment, it may signal the end of the comment if we read another dash | function stateCommentEndDash(char) {
if (char === '-') {
state = 18 /* CommentEnd */;
}
else {
// Wasn't a dash, must still be part of the comment
state = 16 /* Comment */;
}
} | [
"hasDocstring(line){\n if (typeof line == 'undefined'){ return false;}\n return line.indexOf('*/')>=0\n}",
"function next() {\n\n\tvar c = getc();\n\tif(c == '/') {\n\t switch(peek()) {\n\t\tcase '/':\n\t\t for(; ; ) {\n\t\t\tc = getc();\n\t\t\tif(c <= '\\n') {\n\t\t\t return c;\n\t\t\t}\n\t\t }\n\t\t brea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
dirRange range for all entries in a dir | function dirRange(path)
{
path = String(path);
if (!this instanceof dirRange)
return new dirRange(path);
this.path = path;
this.c_path = ffi.nullPtr;
this.ptr = ffi.nullPtr;
this._empty = true;
return this;
} | [
"getEntryNames(dir = \".\") {\n return (new fs.Dir(this.dst, dir)).getEntryNames();\n }",
"function readdirSyncR(dir) {\r\n\r\n var results = []\r\n var list = fs.readdirSync(dir)\r\n list.forEach(function(file) {\r\n file = dir + '/' + file\r\n var stat = fs.statSync(file)\r\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This exists to process buffer updates in order. As interacting with neovim is async and may cause new redraw calls to occur while a batch is processing we want to capture things as they happen and then delay processing until previous updates have been processed. I'm not sure this is entirely sound but resolved issues t... | processNextBufferUpdate(editor:atom$TextEditor) {
const bufferNumber = editor[$$textEditorBufferNumber];
invariant(bufferNumber != null, 'Expected processNextBufferUpdate to be called only once editor has buffer matched to it');
const updates = this.queuedBufferUpdates[bufferNumber] || [];
... | [
"batchUpdate() {\n let { row, colStart, colEnd } = this.pendingUpdate;\n const { cursor } = this.screen;\n\n this.pendingUpdate.row = cursor.row;\n this.pendingUpdate.colStart = this.pendingUpdate.colEnd = cursor.col;\n\n // Skip cells up to number column width so we don't output ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Trim the height of the tree, according to DOI This is not implemented yet. It's not strictly necessary, if we allow panning and give breadcrumbs. | function trim_height(tree_var) {
return tree_var;
} | [
"get height() {\n if ( !this.el ) return;\n\n return ~~this.parent.style.height.replace( 'px', '' );\n }",
"get estimatedHeight() {\n return -1\n }",
"_calculateHeight() {\n\t\tif (this.options.height) {\n\t\t\treturn this.jumper.evaluate(this.options.height, { '%': this.jumper.getA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the height in inches | function getHeightInInches(sideInput){
return storeInputValues(sideInput, 'getHeightInInch');
} | [
"getHeight() {\r\n let original = this.height; //in decimetres\r\n let meters = original / 10;\r\n let feet = Math.floor(meters * 3.28084); //rounds down to the nearest foot\r\n let inches = (meters * 3.28084 - feet) * 12; //takes the remainder of the foot and converts it to inches\r\n let inchesRoun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clears the loaded object object | Clear()
{
this._loadedObjects = {};
} | [
"UnloadAndClear()\n {\n for (const path in this._loadedObjects)\n {\n if (this._loadedObjects.hasOwnProperty(path))\n {\n this._loadedObjects[path].Unload();\n }\n }\n this._loadedObjects = {};\n }",
"clearAllObject() {\r\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the input `node` is definitely immutable. | function isImmutable(node) {
if (t.isType(node.type, "Immutable")) return true;
if (t.isIdentifier(node)) {
if (node.name === "undefined") {
// immutable!
return true;
} else {
// no idea...
return false;
}
}
return false;
} | [
"isNotReadOnly(lvalue) {\n doCheck(!lvalue.isReadOnly, \"Assignment to read-only variable\");\n }",
"function isEditable() {\n return (current && current.isOwner && !current.frozen);\n}",
"_validateNode(node) {\n if (node == null) {\n throw new Error('previous node cannot be null')\n }\n\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a word from a high and low byte. | function word(highByte, lowByte) {
return ((highByte & 0xFF) << 8) | (lowByte & 0xFF);
} | [
"function hs_wordToWord64(low) {\n return [0, low];\n}",
"readWord(address) {\n const lowByte = this.readByte(address);\n const highByte = this.readByte(address + 1);\n return word(highByte, lowByte);\n }",
"popWord() {\n const lowByte = this.popByte();\n const highByte ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fonction d'ajout d'un lien | function ajouterLien(element) {
return ajouterEncadrement(element, "[", "]", "lien");
} | [
"ajouterLettresJouees(lettre) {\n this.lettresJouees.push(lettre);\n if (this.difficulte != DIFFICULTE_DIFFICILE) {\n window.conteneurLettresJouees.innerHTML += lettre + \" \";\n }\n }",
"function addList (){\n const isiList = document.getElementById('form-list');\n const n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks whether a valid tile which can be played exists within tilePositions and returns an object which specifies the positionToPlay and a property that determines at which end of the game state should the position be played if positionToPlay equals 1; then no valid position exists. | validTileExists(tilePositions){
let positionToPlay = -1;
let isLastEnd = true;
let isFirstEnd = false;
let positionsToPlay = [];
if(this.gameState.length>=0)
{
//checking both ends of the game state for a valid position to play
let firstEnd = this.... | [
"playTile(tilePositions){\n let checkValidPosition = this.validTileExists(tilePositions);\n let tileToPlay = [];\n if(checkValidPosition.positionToPlay!==-1){\n \n tileToPlay = this.stock[checkValidPosition.positionToPlay];\n \n if(checkValidPosition.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
===================================================== HELPER METHODS ===================================================== / Ensures that the given name and password are valid (ie. neither are null or undefined, and the name contains only letters, numbers, and underscores (this prevents SQL injections)). This returns a... | function check_everything_is_here(name, password){
//Check name exists and is valid
if(name == undefined || name == null || !(ensure_only_letters_numbers_and_spaces(name))){
return "ERROR: Missing a valid name.";
}
//Check password exists and is valid
if(password == null || password == undefined){
return "ERRO... | [
"function _noUsernameError() {\n\tthrow new Error('A username is required, for example \"dfox\"');\n}",
"function check_for_kart(name, id){\n\t//Check for valid name.\n\tif(name == undefined || name == null || !ensure_only_letters_numbers_and_spaces(name)){\n\t\treturn \"ERROR: invalid name.\";\n\t}\n\t//Check fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a point, normal, and a bias, compute and return a biased point to avoid selfintersection | function biasedPoint(point, normal, bias) {
return vec3.add(vec3.create(), point, vec3.scale(vec3.create(), normal, bias));
} | [
"function PHSK_BFeld( draht, BPoint) {\n\tif ( GMTR_MagnitudeSquared( GMTR_CrossProduct( GMTR_VectorDifference(draht.a ,draht.b ),GMTR_VectorDifference(draht.a ,BPoint ) )) < 10E-10)\n\t\treturn new Vec3 (0.0, 0.0, 0.0);\n\n\n\tlet A = draht.a;\n\tlet B = draht.b;\n\tlet P = BPoint;\n\t\n\tlet xd = -(GMTR_DotProd... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Selector cannot have '/' or '$' in them | function escapeSelector(sel) {
return sel.replace(/[/$]/g, '\\$&');
} | [
"function getSanitizedSelector (selector) {\n return selector\n .replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); })\n .replace(/\\[|]/g, \"\");\n }",
"function createSelector() {\n for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to update all the dots all the apertures and then draw them | function updateAndDraw(){
//Clear the canvas by drawing over the current dots
clearDots();
//Update the dots
updateDots();
//Draw on the canvas
draw();
} | [
"function setAllDotsToRandom(){\r\n\t\t\tfor(var i = 0; i < nDots; i++){\r\n\t\t\t\tdot = dotArray[i];\r\n\t\t\t\tdot.updateType = 'random direction';\r\n\t\t\t}\r\n\t\t}",
"incDotCounter() {\n if (!this.penType) {\n this.incGhostsDots();\n } else {\n this.incGlobalDots();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
:: (yngwieElement > BOOLEAN) > [yngwieElement] Returns all the elements that, when the given function is applied to this elements and it's desendants, that function returns TRUE: | getElementsBy(fn) {
return this.parse((node, result) => {
if (node instanceof YngwieElement) {
if (fn(node) === true) {
result.push(node);
}
}
return result;
}, []);
} | [
"filter(fn) {\n let newSet = new SpecialSet();\n // copy over elements that pass the filter\n for (let item of this) {\n if (fn(item) === true) {\n newSet.add(item);\n }\n }\n return newSet;\n }",
"get not() {\n return {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change team's name in database | changeName(newName) {
this.name = newName;
updateTeam(this._id, "name", this.name);
} | [
"function teamNameChanged(event, teamName){\n self.teamName = teamName;\n }",
"disbandTeam(teamName) {\n this.entrants.forEach((entrant) => {\n if (entrant.team === teamName) {\n entrant.team = \"\";\n }\n });\n }",
"update(name){\r\n\t\tva... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ViewModel for combined filament speed sensor chart | function CombinedFilamendSpeedViewModel (parameters) {
var self = this
self.measured = parameters[0]
self.calculated = parameters[1]
// Chart configuration starts here
self.index = 90
self.chartElementSelectors = [
{ selector: '#model-filament-speed', chart: null }
]
self.chartData = [
createDa... | [
"function CombinedPowerSensorViewModel (parameters) {\n var self = this\n self.reflected = parameters[0]\n self.forward = parameters[1]\n\n // Chart configuration starts here\n self.index = 90\n self.chartElementSelectors = [\n { selector: '.combinedPowerSensorChart', chart: null }\n ]\n self.chartData =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
decrament the counter return 1 when no more words left. Param: the block we are currently decramenting. | decramentFaceCounter(blockIndex) {
let valueToCheck = this.cubeFaceCounter[blockIndex];
//Decrament the block
valueToCheck -= 1;
//last case no more words
if (blockIndex == 0 && valueToCheck == -1 ) {
return false;
}
//most used case the counter needs to be decramented
if (this.c... | [
"function decrementCount(key) {\n if (counts[key] < 2) {\n delete counts[key];\n } else {\n counts[key] -= 1;\n }\n }",
"function matchedWordsLeft() {\n gameState.wordsLeftToMatch--;\n if (gameState.wordsLeftToMatc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: known bug: if 1) add a new paragraph at the end of the proposal (it's fine if the paragraph is added in the middle), 2) download the proposal, then the new paragraph will beome invisible in the text area (the sorrounding spans are removed somehow), but it will appear if refresh the page (i.e. the paragraph itself... | function prepareProposalDownload() {
var content = '';
for (var i = 0; i < $scope.activeParagraphs.length; ++i) {
var paragraph = $scope.activeParagraphs[i];
var citations = $scope.paragraphCitation[i].map(function(c) {
return c.index;
}).sort();
content += paragrap... | [
"function generateParagraph() {\n // Clear the current text\n $('#content').text('');\n // Generate ten sentences for our paragraph\n // (Output is an array)\n let sentenceArray = markov.generateSentences(20);\n // Turn the array into a single string by joining with spaces\n let sentenceText = sentenceArray.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wraps an event listener so its host view and its ancestor views will be marked dirty whenever the event fires. Necessary to support OnPush components. | function wrapListenerWithDirtyLogic(view, listenerFn) {
return function (e) {
markViewDirty(view);
return listenerFn(e);
};
} | [
"setEventListeners() {\n this.on('edit',this.onEdit.bind(this));\n this.on('panelObjectAdded',this.onPanelObjectAdded.bind(this));\n this.on('panelObjectRemoved',this.onPanelObjectRemoved.bind(this));\n }",
"removeChangeListener(callback) {\n this.removeListener(AppConstants.CHANGE_EVEN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update sample data in store (after positive API response) | update_sample(state, { sampleId, data }) {
let index = -1;
if (sampleId) {
index = state.samples.findIndex((sample) => sample.id === sampleId);
}
// For new samples we depend on an internal timestamp
if (index === -1) {
index = state.samples.findIndex(
(sample) => sample.creati... | [
"function setSample(db, cb) {\n\tvar key = 'sample';\n\tvar val = {id: Math.round(Math.random()*100)};\n\tdb.set(key, val, cb);\n}",
"update ( data ) {\n this.store.update(data);\n }",
"add_unsaved_sample(state, copyIndex = 0) {\n let sample_new = new SampleModel({\n sample: {},\n stored: false... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Agustin: edits to a_project1Select() and a_newPSelect() for small transformations | function a_project1Select()
{
} | [
"function onProjectSelect() {\n\t\tself.tableData = (self.resourceMap && self.resourceMap[self.project.id]) || [];\n\t\tself.gridOptions.data = self.tableData;\n\t\tself.gridApi.grid.clearAllFilters();\n\t\tself.gridApi.pagination.seek(1);\n\t\tvar rowCount = Math.min(10, self.tableData.length);\n\t\tangular.elemen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
finding student profiles using string | static async findProfile(string){
const result=await pool.query("select *,LOWER(fname),INSTR(LOWER(fname),?) FROM student,studdata WHERE INSTR(LOWER(fname),?)>0 AND student.email=studdata.email ORDER BY INSTR(LOWER(fname),?);",[string,string,string]);
return result;
} | [
"function findPidByName(nameString, studentList, org) {\n if (!nameString)\n return false;\n\n const activeStudents = studentList.filter((doc) => doc.profile);\n\n for (let i = 0; i < activeStudents.length; i++) {\n const doc = activeStudents[i];\n // activeStudents.forEach((doc) => {\n if (doc.profi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set attribute with namespace for a node. The attribute value can be either string or Trusted value (if application uses Trusted Types). | function setAttributeNS(node, attributeNamespace, attributeName, attributeValue) {
node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
} | [
"function setNamespace() {\n var namespace = _scriptTag.getAttribute('data-namespace');\n if (namespace) {\n if (constants.NAMESPACE_REGEX_VALIDATION.test(namespace)) {\n _config.namespace = namespace;\n } else {\n throw new Error(Errors.INVALID_NAMESPACE);\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The pattern adaptor listens for newListener and removeListener events. When patterns are added or removed it compiles the JSONPath and wires them up. When nodes and paths are found it emits the fullyqualified match events with parameters ready to ship to the outside world | function patternAdapter(oboeBus, jsonPathCompiler) {
var predicateEventMap = {
node:oboeBus(NODE_CLOSED)
, path:oboeBus(NODE_OPENED)
};
function emitMatchingNode(emitMatch, node, ascent) {
/*
We're now calling to the outside world where Lisp-style
lists will... | [
"function Router(){\n\n let routes = [];\n let final = () => {};\n\n /**\n * Called when the router wants to handle an incoming connection.\n * When specify blocking routes.\n * That means that if the next callback is not a 'if' the regular expression\n * is not even tested.\n */\n this.when = (regex, callback... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start to measuring Heart Rate and making the data to JSON per 5 sec | function startHR() {
heartRateArray = new Array();
window.webapis.motion.start("HRM", function onSuccess(hrmInfo) {
if (hrmInfo.heartRate > 0)
HR = hrmInfo.heartRate;
});
//sendingInterval = setInterval(sendHR, 5000);
sendingInterval = setInterval(makeJsonHR, 5000);
} | [
"_startPollingData() {\n this._pollDataInterval = setInterval(() => this._getBalance(), 3000);\n\n // We run it once immediately so we don't have to wait for it\n this._getBalance();\n }",
"function handleHeartRateNotifications(event) {\n // In Chrome 50+, a DataView is returned instead of an ArrayBuff... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete Extension is True delete px , is false delete in | function del_ext(cad, px) {
var tmp = 0;
if (px) {
tmp = cad.split('px')[0];
} else {
tmp = cad.split('in')[0];
}
if (isNaN(tmp)) {
return cad
}
return tmp
} | [
"function deleteExtensionStorage() {\n var deleteStorageContent = document.getElementById(\"deleteExtStorage\");\n deleteExtStorage.addEventListener(\"click\", function() {\n chrome.storage.local.clear();\n location.reload();\n });\n}",
"function deleteFormat(format)\r\n{\r\n}",
"function removeDot() {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
following two functions are for sgsceneactor management (by actor name) | addActor(scene, name, actor) {
//console.log(`\n@@@ narrative.addActor ${name} actor=${actor}:`);
//console.dir(actor);
//console.log(`addActor: et = ${devclock.getElapsedTime()}`);
if (scene && actor && name && name.length > 0) {
if (cast[name]) {
narrative.r... | [
"function selectActor(id) { // from html tree\n \"use strict\";\n if(id === null) {\n eventHandler.selectActor(null);\n } else {\n var root = dali.stage.getRootLayer();\n var actor = root.findChildById(id);\n if (actor) {\n eventHandler.selectActor(actor);\n }\n root.delete(); // wrapper\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this method to find an account number | function find(inputAcount) {
if (accountNumber ===inputAcount) {
return true;
}
return false;
} | [
"async getAccount(accountNo) {\n try {\n const accounts = await this.getAccounts();\n return accounts.find(account => account.accountNo == accountNo);\n } catch (err) {\n throw err;\n }\n }",
"getAccount(pin){\n for (let i = 0; i < this.accounts.len... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to toggle between the different colors for the scale | function color_toggle() {
console.log(counter);
svg.selectAll("g").remove();
if (counter%2 == 0) {
/* Color scheme from light blue to dark blue */
color.range(d3.schemePuBu[9]);
tract_counter -= 1;
tract_toggle();
} else {
/* Color scheme from light yellow to dark... | [
"changeColor() {\n this.currentColor = this.intersectingColor;\n }",
"function changeColors() {\n rdmNumber1 = getNumber();\n rdmNumber2 = getNumber();\n\n $div1.css('background-color', colors[rdmNumber1]);\n $div1.css('transition', 'all 0.2s ease');\n $div2.css('background-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Using a query ordering array, compare object to the index represented by orderInfo. If object should come before the current index, return 1; if it should come after, return 1. If the two are equivalent in ordering, the function returns 0. | function compareObjectOrder(queryOrder, object, orderInfo) {
for (var i = 0; i < queryOrder.length; i++) {
var column = queryOrder[i];
var multiplier = 1;
if (column[0] === '-') {
column = column.substring(1);
multiplier = -1;
}
if (object[column] < orderInfo[column]) {
return mu... | [
"function getIndex(array, index, key, order) {\n var value = array[index][key],\n tempIndex = index;\n for (var i = index + 1; i < array.length; i++) {\n if (order === \"asc\" && array[i][key] < value || order === \"desc\" && array[i][key] > value) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A type of BasicBlock for time we are free | function FreeBlock(startTime, endTime) {
BasicBlock.call(this, startTime, endTime);
} | [
"has_block(type) { return (this.tracking_block(type)) ? this.blocks[type] : false; }",
"tracking_block(type) { return this.blocks[type] !== undefined; }",
"newBlockFromBag(){\n const blockType = this.bag.shift();\n\n this.blocks.currentBlock = new blockType(3, 0);\n this.updateGhostBlock();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
searches for domain if the enter key is hit on search bar | searchBarOnKeyPress(e){
if(e.key === 'Enter'){
this.searchForDomain();
e.target.value = '';
}
} | [
"function doSiteSearchKeyPress(e) {\n // look for window.event in case event isn't passed in\n e = e || window.event;\n if (e.keyCode == 13) {\n document.getElementById(_pSiteSearchButton).click();\n }\n}",
"function searchHandler(event) {\n if (event.keyCode == 13) {\n var inputValue... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets all children of clicked cluster as well as geolocation address of cluster and updates state with data | clusterChildren(a) {
const { updateCluster, updateMapDate, updateAddress } = this.props
// Gets all markers contained within cluster
let children = a.layer.getAllChildMarkers()
// Gets coordinates of cluster bounding box
let bounds = a.layer.getBounds()
// Hashs number of visits and price for... | [
"_addDataToCluster (nextProps) {\n const {markers: oldMarkers} = this.props\n const map = this.context.map\n\n const markers = Object.assign({}, oldMarkers)\n\n // add markers to cluster layer\n if (nextProps.newMarkerData && nextProps.newMarkerData.length > 0) {\n const newMarkers = []\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
array to hold odd multiples of 5 from 1 to 100 | function fiveMultiples(arr,start)
{
if((start*5)<=100) // creating multiples of 5 till '100'
{
arr.push(start*5);
return fiveMultiples(arr,start+1); //recursive loop to keep creating multiples of 5
}
else
{
return arr;
}
} | [
"function arrayOfOdds (arr){\n var arr = [];\n for(var i = 0; i <= 50; i++){\n if(i % 2 !== 0){\n arr.push(i);\n }\n }\n return arr;\n}",
"function arrayodd() {\n var oddarray = [];\n for (var i = 1; i <= 50; i = i + 2) {\n oddarray.push(i);\n }\n return odd... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compileMappings sort the mappings so that mappings for the same attribute and value go consecutive and inside those, those that change attributes appear first. | function compileMappings(oldMappings) {
var mappings = oldMappings.slice(0);
mappings.sort(function(map1, map2) {
if (!map1.attribute) return 1;
if (!map2.attribute) return -1;
if (map1.attribute !== map2.attribute) {
return map1.attribute < map2.attribute ? -1 : 1;
}
... | [
"function generate_canonical_map ( mod ) {\n var map = scope.make ( );\n function add_secondary_name ( obj, name ) {\n if ( obj.secondary_names !== undefined ) {\n obj.secondary_names = [];\n }\n obj.secondary_names.push ( name );\n }\n // We want the alphabetically first (\"smallest\") name.\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return TRUE if wp_bearing is within +/ sector_size/2 degrees of leg_bearing I.e. if aircraft has waypoint at wp_bearing_deg and next leg from waypoint is in direction leg_bearing and the sector opposite the leg to next waypoint is sector_size degrees wide. E.g. sector_size could be 180 for a start line, or 90 for a tur... | static in_sector(leg_bearing, wp_bearing, sector_size) {
let sector_deg = leg_bearing - sector_size / 2;
if (sector_deg < 0) {
sector_deg += 360;
}
// Delta is the angle +/- 180
let delta = sector_deg - wp_bearing;
if (delta < -180) {
delta += 360;... | [
"function hasTankCollidedWithBarrier(tank){\n barriers.forEach(barrier => {\n //Work out barrier edges\n let leftEdge = stageX + (barrier.x * stageDivPathWidth);\n let rightEdge = leftEdge + (barrier.length * stageDivPathWidth);\n let topEdge = stageY + (barrier.y * stageDivPathHeight... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
===[ Rune functions ]=== Extracts runes from currently selected character's inventory | function sniffRunesFromInventory(runesFound) {
if (!runesFound || (runesFound.hasOwnProperty('runes') && !runesFound.runes)) {
$('#no-runes-found').show();
return;
}
let runes = runesFound.runes.toString().split(',');
runes = runes.map(rune => getRuneId(rune));
runes.sort((a, b) => a - b... | [
"function calculateRuneExpGiven(runeIndex) {\r\n\t// recycleMult accounted for all recycle chance, but inversed so it's a multiplier instead\r\n\tlet recycleMultiplier = calculateRecycleMultiplier();\r\n\r\n\t// Rune multiplier that is summed instead of added\r\n\tlet allRuneExpAdditiveMultiplier = Math.floor(sumCo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether a column exists on the schema. | hasColumn(tableName, column) {
this.pushQuery({
sql: `show columns from ${this.formatter.wrap(tableName)}` +
' like ' + this.formatter.parameter(column),
output(resp) {
return resp.length > 0;
}
});
} | [
"hasColumn(tableName, column){\n this.pushQuery({\n sql: `select i.rdb$field_name as \"Field\" from ` +\n `rdb$relations r join rdb$RELATION_FIELDS i ` +\n `on (i.rdb$relation_name = r.rdb$relation_name) ` +\n `where r.rdb$relation_name = ${this.formatter.wrap(tableName)}`,\n outpu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper function to get quanity and unit from an observation resoruce. | function getQuantityValueAndUnit(ob) {
if (typeof ob != 'undefined' &&
typeof ob.valueQuantity != 'undefined' &&
typeof ob.valueQuantity.value != 'undefined' &&
typeof ob.valueQuantity.unit != 'undefined') {
return Number(parseFloat((ob.valueQuantity.value)).toFixed(2)) + ' ' + ob.valueQuantity.unit;
... | [
"function unit_type(unit)\n{\n return unit_types[unit['type']];\n}",
"function getUnit(filter) {\n\t\tvar unit = units[filter];\n\t\treturn isUndefined(unit) ? \"%\" : unit;\n\t}",
"function getUserUnit() {\n let userUnit = document.getElementById('units');\n unit = userUnit.value;\n}",
"function unitV... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compose a single credential provider function from multiple credential providers. The first provider in the argument list will always be invoked; subsequent providers in the list will be invoked in the order in which the were received if the preceding provider did not successfully resolve. If no providers were received... | function chain() {
var providers = [];
for (var _i = 0; _i < arguments.length; _i++) {
providers[_i] = arguments[_i];
}
return function () {
var e_1, _a;
var promise = Promise.reject(new _ProviderError__WEBPACK_IMPORTED_MODULE_1__["ProviderError"]("No providers in chain"));
... | [
"function chain() {\n var providers = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n providers[_i] = arguments[_i];\n }\n return function () {\n var e_1, _a;\n var promise = Promise.reject(new ProviderError(\"No providers in chain\"));\n var _loop_1 = function (provi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Author: Sesha Sai Srivatsav Description: deletes a position for a given position ID function:deletePosition | function deletePosition(req,res) {
positionModel
.deletePosition(req.params.positionId)
.then(function (stats) {
res.send(200);
},
function (error) {
res.statusCode(404).send(error);
});
} | [
"function deleteToDo(position){\r\ntoDos.splice(position, 1);\r\ndisplayToDos();\r\n}",
"function borrarRegistro(){\n \n /*aId.splice(posicion,1);\n aDireccion.splice(posicion,1);\n aLatitud.splice(posicion,1);\n aLongitud.splice(posicion,1);\n */\n\n aContenedor.splice(posicion,1)\n conta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the camera to its original position | resetCamera() {
this._camera.position.set(1, 1, 1);
} | [
"setFrontView() {\n\t\t'use strict';\n\t\tvar ratio = 6;\n\t\tvar camera = new THREE.OrthographicCamera(window.innerWidth / - ratio, window.innerWidth / ratio, window.innerHeight / ratio, window.innerHeight / - ratio);\n\n\t\tcamera.position.set(window.innerWidth / - 6, 45, 0); //Camera is set on the position x = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Declare Global Variables Load nextPiece images | function preload() {
game.images.IPiece = loadImage('assets/tetrisI.png');
game.images.JPiece = loadImage('assets/tetrisJ.png');
game.images.LPiece = loadImage('assets/tetrisL.png');
game.images.OPiece = loadImage('assets/tetrisO.png');
game.images.SPiece = loadImage('assets/tetrisS.png');
game.images.TPiec... | [
"function loadNextImage() {\n let next = games.splice(0, 1)[0];\n\n document.getElementById(\"background\").src = next.img;\n document.getElementById(\"jakob\").getElementsByTagName(\"span\")[0].innerText = next.name;\n}",
"function preload(){\n\thelicopterIMG=loadImage(\"helicopter.png\")\n\tpackageIMG=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if there is already a watcher on a parent path modifies `watchPath` to the parent path when it finds a match | function watchedParent() {
return Object.keys(FSEventsWatchers).some(function(watchedPath) {
// condition is met when indexOf returns 0
if (!realPath.indexOf(sysPath.resolve(watchedPath) + sysPath.sep)) {
watchPath = watchedPath;
return true;
}
});
} | [
"isParent(path, another) {\n return path.length + 1 === another.length && Path.compare(path, another) === 0;\n }",
"isAncestor(path, another) {\n return path.length < another.length && Path.compare(path, another) === 0;\n }",
"function modify(e) {\n\t\tvar fullPath = path.join(e.watch, e.name);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
init Tan14 flash player options | function initFlashOptions (source, flsOptions) {
videojs.options.flash.swf = "../../dist/GPlayer/swf/TanVodPlayer.swf";
videojs.options.flash.flashVars = {
'autostart': 'true',
'streamtype': 'MP4',
'reportplaytime': '1',
'isvr': source.isvr,
// TODO: what is videoid
'videoid': 'dbdf4ac3bed84... | [
"function createOptions(game) {\n // Data\n var music = game._music;\n var playerData = game._playerData;\n\n // Background\n fadeSceneIn(game, null, null, true);\n game.add.image(0, 0, 'game-bg').setOrigin(0, 0);\n\n\n // Menu sounds\n var sounds = {\n select: game.sound.add(\"menu-select\", { volume: 0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
go to next screen in course lesson (not for tests) | function goNext( relatedToScreen ) {
disable();
if(currentScreenNo < noOfScreens) {
autobookmark();
currentScreenNo++;
var contentFolder = ( typeof(relatedToScreen) != "undefined" && relatedToScreen )
? ''
: getContentFolderName() + '/';
frames['myFrame'].location.href = contentFolder + currentScreenNo+... | [
"goNextScene() {\r\n this.scene.launch(this.nextScene).launch();\r\n this.scene.stop(this.scene.key);\r\n }",
"function onboardingFollowCoursesNextStepButton() {\n $(\"#onboarding-follow-courses-modal\").modal(\"hide\"); // hide the modal\n $(\"#onboarding-follow-courses-modal\").re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Regenerate all bg tiles in the correct size | function draw_bg_tiles() {
// remove previous bg tiles
bg_tile_ids.forEach(function(bg_tile_id) {
remove_element(bg_tile_id);
});
bg_tile_ids = [];
// add new background tiles
for (var x = 0; x < grid_size[0]; x++) {
for (var y = 0; y < grid_size[1]; y++) {
// crea... | [
"rescaleTiles() {}",
"function initTiles() {\n let body = document.getElementsByTagName(\"body\")[0];\n const dimension = (1 / GRID_SIZE) * 100;\n for (let i = 1; i <= noTiles; i++) {\n let newTile = document.createElement(\"div\");\n newTile.classList.add(\"tile\");\n newTile.classL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the position on the line segment AB which is closest to the reference point P. | function getClosestPosition(P, A, B, target) {
subtract$2(P, A, tmpVectorAP);
subtract$2(B, A, tmpVectorAB);
const lengthSquaredAB = lengthSquared(tmpVectorAB);
const dotProductAPAB = dot(tmpVectorAP, tmpVectorAB);
const distanceRatioAX = dotProductAPAB / lengthSquaredAB;
if (distanceRatioAX <= ... | [
"function nearestPointOnLine(px,py,x1,y1,x2,y2){\n\n\tvar lx = x2 - x1;\n var ly = y2 - y1;\n\t\n if ( lx == 0 && ly == 0 ) {//If the vector is of length 0,\n\t\t//the two endpoints have the same position, so the nearest point is at that position\n return {\n\t\t\tx: x1,\n\t\t\ty: y1\n\t\t};\n } els... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remover um item da lista de selecionados | function removerItem(index) {
const finded = selecionados.indexOf(index);
if (finded !== -1) {
selecionados.splice(finded, 1)
}
if (selecionados.length === 0) excluirBtn.disabled = true
} | [
"function removeItem(event) {\n var id = event.target.id;\n var listName = id.split('_')[0];\n var listItem = id.split('_')[1];\n \n var index = items[listName].indexOf(listItem);\n items[listName].splice(index, 1);\n onLoad();\n}",
"function removeChecklistItem() {\n\t\tremoveFromChecklistAr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function gets the master list of customer GDUNs from the ECS repo. It returns that list as the 'GDUNS' array. | function getCustomerList(source, callback) {
console.log('entering getCustomerList function')
// get json data object from ECS bucket
var GDUNS = [];
var params = {
Bucket: 'installBase',
Key: source
};
ecs.getObject(params, function(err, data) {
if (err) {
callback(err, null); // this is the ca... | [
"_getClientNames() {\n const names = [];\n for (let key in this.clients) {\n names.push(this.clients[key].name);\n }\n return names;\n }",
"function getAllQuestMasters( viewer ) {\r\n\tvar vMasters = [];\r\n\tfor (var _autoKey in global.vQuests) {\r\n\t\tvar quest = global.vQuests[_autoKey];\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that there is either 0 or 1 constructor Note: PawvaScript currently only supports having at most one constructor per TypeDeclaration. In future iterations, we hope to implement method overloading in PawvaScript, which would allow us to have multiple constructors for a single BreedType. | noMoreThanOneConstructor(constructors) {
doCheck(
constructors.length <= 1,
`A type declaration can define at most one constructor`
);
} | [
"constructorReturnsBreedType(constr, breed) {\n doCheck(\n this.typesAreEquivalent(constr.returnType, breed),\n `The return type of a constructor must be the breed in which it is defined`\n );\n }",
"constructorNameMatchesBreedId(constructorId, breedId) {\n doCheck(\n constructorId.name =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
string "code" appears anywhere in the given string, except we'll accept any letter for the "d", so "cope" and "cooe" would also count | function countCode(str) {
output = 0
for (let i = 0; i < str.length; i++) {
if (str.substring(i, i + 2) === "co" && str[i+3] === "e") {
output++;
}
}
return output
} | [
"function countCons(str) {\n str = str.toLowerCase();\n var cons = 'bcdfghjklmnpqrstvwxyz'\n var numCons = 0;\n for (var i=0; i<str.length; i++) {\n if (cons.includes(str[i])) {\n numCons++;\n }\n }\n return numCons;\n}",
"function check(str, char){\n var count = 0;\n var length = str.lengt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check zipcode on get an offer button click | function checkForCustomerInfoPopupOnGetAnOffer(zipCode) {
$rootScope.disableButtons();
$rootScope.operationType = 1;
var zc = $("#locationTabZipCode").val();
checkZipCode(zc);
$rootScope.enableButtons();
} | [
"function checkZipCodeBeforeQuestionnaireOnGetABetterOffer(zipCode) {\n $rootScope.disableButtons();\n $rootScope.operationType = 2;\n var zc = $(\"#locationTabZipCode\").val();\n checkZipCode(zc);\n homeControllerVM.homeZipCode = zc;\n $rootScope.en... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all users with same either firstname or lastname | searchUserByName(name) {
const users = this.getUsers(); //Returns the collection of Users
//Filter each user name based on the name we are interested in.
const results = users.filter(
user => user.firstName === name || user.lastName === name
);
return results.length === 0 ? false : results; ... | [
"function searchDatabaseFirst(firstNameFind) {\n for (let people = 1; people < users.length; people++) {\n if (users[people].firstName.toLowerCase() === firstNameFind.toLowerCase()) {\n return true;\n }\n }\n return false;\n}",
"function getFirstNames() {\n return _.map(users, function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The sever secure context is the SecureContext specified when calling listen. It is the context that will be used with all new server QuicSession instances. | get serverSecureContext() {
return this.#serverSecureContext;
} | [
"getContext() {\n let ctx = {};\n if (this.server) {\n const serverDescription = this.server.describe();\n ctx = Object.assign({ \n /* Main Server */\n server: this.server }, serverDescription.context);\n }\n // Return the repl context\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create multiple documents inside the collection inside the database inside the cluster documents => collection => database => cluster | async function createMultipleDocuments(client, dataBaseName, collectionName, collData) {
// let collData = [ { name: "Jay", wins: 5, location: { city: "Chennai", country: "India"} },
// { name: "Sridhar", wins: 9, location: { city: "London", country: "UK"}},
// { name: "Sumitha", wins: 7, location: {... | [
"async createCollection(name) {\n\t \tthis.db.createCollection( name )\n\t}",
"createNewCollection(){\n // return this.db.createCollection(name)\n }",
"async function buildDatabaseAndCollections(error, database) {\r\n\t// If we have an error...\r\n\tif (error) {\r\n\t\t// Log it\r\n\t\tconsole.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This options update the power line global list | function updateGlobalPowerLineList(powerLineId,toDelete){
var dataAttributes= {
powerLineId : powerLineId,
}
var options= {
toDelete : toDelete,
}
ajaxRequest("updatePowerLine", dataAttributes, updatePowerLineCallBack, options);
} | [
"function updatePowerLineCallBack(data, options){\n\tvar toDelete=options['toDelete'];\n\tvar powerLine = data.split(\"!\");\n\tvar location = powerLine[0];\n\tvar color=powerLine[1];\n\tvar powerLineId=powerLine[2].trim();\n\tvar startLat = location.split(\"^\")[0].split(\"~\")[0].replace(\"[\",\"\").replace(\",\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a HTML element of the contributors of a repository. | function createRepositoryContributors({ contributors }) {
function filterContributorsByAboveContributions(
parameterContributors,
parameterContributions) {
const filteredContributors = []
for (contributor of parameterContributors) {
if (contributor.contributions > parameterContribu... | [
"function createRepositoryDetail({ repository, issuesHTML, contributorsHTML, backToRepositoriesCallback }) {\n const { name, description, created_at } = repository\n const validDescription = description\n ? description\n : '(sem descrição)'\n\n function createNavTabHTML() {\n const navItemIs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if targetSite is killable kill its atom (replace with empty) | killAtom(targetSite) {
let kill = Math.random() * 100 < targetSite.atom.elem.destroyability;
if (kill) {
targetSite.atom = new _Atom__WEBPACK_IMPORTED_MODULE_1__["Atom"](_ElementTypes__WEBPACK_IMPORTED_MODULE_2__["ElementTypes"].EMPTY);
}
} | [
"function removeFromKillFile(name) {\r\n\tvar curKF = GM_getValue(KILLFILE, \"\").split(KF_DELIMITER);\r\n\tvar newKF = new Array();\r\n\tfor(var i=0; i<curKF.length; i++) {\r\n\t\tif(curKF[i] != name)\r\n\t\t\tnewKF.push(curKF[i]);\r\n\t}\r\n\tGM_setValue(KILLFILE, newKF.join(KF_DELIMITER));\r\n}",
"function uns... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate Byram's (1959) flame length (ft+1) given a fireline intensity. | function flameLength (fli) {
return fli <= 0 ? 0 : 0.45 * Math.pow(fli, 0.46)
} | [
"function flameLengthThomas (fli) {\n return fli <= 0 ? 0 : 0.2 * Math.pow(fli, 2 / 3)\n} // Active crown fire heat per unit area,",
"function firelineIntensityFromFlameLength (flame) {\n return flame <= 0 ? 0 : Math.pow(flame / 0.45, 1 / 0.46)\n}",
"function surfaceFireFirebrandHeight (firelineIntensity, u20... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RULES EVALUATION ENGINE Simple forward chaining inference machine Version 0.1 Beta Written by J.M. Ayala Wilson June 25th, 2012 | function RulesEvaluationEngine(ruleset,askcallback,solcallback,logcallback,withSteps)
{
// Current question
this.__currentQuestion = -1;
// Stack evaluation
this.__stack = null;
if (withSteps){
this.__stack = new Array();
}
// Ask callback
this.__askcallback = askcallback;
... | [
"rulesLoad(filename) {\n var fp = new File(filename, \"r\");\n if(!fp.open)\n error(\"fatal\", \"Unable to open grammar file \\\"\" + filename + \"\\\" for reading.\", \"SimpleGrammar.rulesLoad\");\n var tmp = fp.read();\n tmp = tmp.split(/\\n+/);\n var lines = [ ];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |