query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
function to change output panel bgcolor when details are correct | function showgreen() {
var o_panel_info = document.getElementById("outputpanel").classList
if(o_panel_info.length > 1){
o_panel_info.remove("redbg", "darkbg", "lightbg");
}
o_panel_info.add("greenbg");
} | [
"function showred() {\r\n var o_panel_info = document.getElementById(\"outputpanel\").classList\r\n if(o_panel_info.length > 1){\r\n o_panel_info.remove(\"greenbg\", \"darkbg\", \"lightbg\");\r\n }\r\n o_panel_info.add(\"redbg\");\r\n}",
"function printColor(){\n\tlet colorChange = getColor();\n\treturn do... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process the queue, set the ready flag, fire the callback | function onReady() {
// Signal if there was a fault
if (this._readyError) {
if (callback != null)
callback(this._readyError)
return;
}
// Process the queue
this._ready = true;
async.series(deferredQueue, function(err,result){
// NOT passing any errors since these shoul... | [
"async processQueue() {\n let message;\n while (this.queue.length) {\n if (!message || this.needsTaskBoundaryBetween(this.queue[0], message)) {\n await async_1.timeout(0);\n }\n message = this.queue.shift();\n if (!... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
doc ready removeItem() removes an item from the shopping cart rerenders the cart after removing | function removeItem() {
var idxToRemove = $('.remove-from-cart').attr('data-index');
cart.items.splice(idxToRemove, 1);
renderCart(cart, $('.template-cart'), $('.cart-container'));
} | [
"function removeFromCart(item){\n if(cart.hasOwnProperty(item)) {\n delete cart[item]\n }\n else{\n console.log(`That item is not in your cart`)\n }\n}",
"function removeCart() {\n\tconsole.log(\"removing from cart\");\n\ttotal -= 1;\n\t$(\"#cartName\").html(\"cart (\" + total + \")\");\n\n\tlet itemDiv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the server that's being used | get server() {
return this._server;
} | [
"getCurrentServer() {\n let retval = {};\n\n // If we have one explicitly set, use it\n if(!isEmpty(this.currentServer)){\n retval = this.currentServer;\n }\n\n // If we don't have one explicitly set, use the first in the list:\n try{\n if(isEmpty(retval) && this.serverList.length > 0)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send seat id and user id to backend | pickSeat(seatID) {
const socket = socketIOClient(this.state.endpoint);
socket.emit("seat changed", seatID, this.state.user.id);
} | [
"async changeUserSeatState(seatID, userID) {\n if (userID === this.state.user.id) {\n let userID = this.state.user.id;\n let username = this.state.user.username;\n let newSeats = this.state.user.userSeats;\n if (newSeats.includes(seatID))\n newSeats = newSeats.filter(e => e !== seatID)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return true if a rev exists in the rev tree, false otherwise | function revExists(revs, rev) {
var toVisit = revs.slice();
var splitRev = rev.split('-');
var targetPos = parseInt(splitRev[0], 10);
var targetId = splitRev[1];
var node;
while ((node = toVisit.pop())) {
if (node.pos === targetPos && node.ids[0] === targetId) {
return true;
}
var branche... | [
"async checkIfRefExists(ref) {\n try {\n await this.api.git.getRef({ ...this.userInfo, ref });\n return true;\n }\n catch (error) {\n return false;\n }\n }",
"function verify(proof, j) {\n const path = proof.path.toString('hex');\n const value = p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
are there any handles in position i of handlers hss? | function anyhandles(i,hss) {
if (hasLength(hss) && i < hss.length) {
var hs = hss[i];
return hasLength(hs) && hs.length > 0;
};
return false;
} | [
"function getHandle()\n\t{\n\t\treturn \"h\" + handleID++;\n\t}",
"onEventHandlerHas(room, handler, identifier) {\n return (this.handlers.hasOwnProperty(handler)\n && this.handlers[handler].hasOwnProperty(identifier));\n }",
"function addHandles ( nrHandles, base ) {\n\n var index, handles... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The function returns the families recipes of the user | function getFamilyRecipes(username) {
return DB.execQuery(`SELECT personal_recipes.recipe_id, personal_recipes.username, personal_recipes.recipe_name,
personal_recipes.ready_in_minutes, personal_recipes.aggregate_likes, personal_recipes.vegetarian, personal_recipes.vegan, personal_recipes.gluten_free, personal... | [
"function getFamilyNames() {\n\treturn new Promise(async(resolve, reject) => {\n\t\tlet retVal = {};\n\t\t\n\t\tlet request = {\n\t\t\ttable: \"Users\",\n\t\t\tcols: [\"group_concat(firstName || ' ' || lastName, ', ') AS names\", \"familyId\"],\n\t\t\tgroup: \"familyId\"\n\t\t}\n\n\t\ttry {\n\t\t\tlet rows = await ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Export module `mod` extended with `exp`. Modifies `exp` in place and assigns to mod | function _export(mod,exp) {
for(var prop in mod) {
if (exp[prop] === undefined) {
exp[prop] = mod[prop];
}
}
return exp;
} | [
"function expmod2(base, exp, m) {\n const toHalf = expmod2(base, exp / 2, m); //the constant declaration appears outside the conditional expression, it is executed even when the base case exp === 0 is reached\n return exp === 0\n ? 1\n : isEven(exp)\n ? (toHalf * toHalf) % m\n : (base * expmod2(base, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function which combines the two previous functions which results in a background change before the next quote is loaded | function changeQuote() {
setBgColor();
getQuotes();
} | [
"function displayQuoteAndColor() {\n\n printQuote();\n displayBgColor();\n}",
"function intervalFunction() {\n\n displayQuoteAndColor();\n setInterval(displayQuoteAndColor, 13000);\n}",
"function printQuote() {\n var randomQuote;\n do { randomQuote = getRandomQuote(); } while (randomQuote === currentQuote... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a DOM element that matches the given selector. Only single element selector are supported (without operators like space, +, >, etc). | function selectorToElement(selector) {
var _a = parseSimpleCssSelector(selector), tag = _a[0], attributes = _a[1];
var element = document.createElement(tag !== null && tag !== void 0 ? tag : 'div');
for (var _i = 0, _b = Object.keys(attributes); _i < _b.length; _i++) {
var name_1 = _b[_i];
e... | [
"function createSelector() {\n for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {\n args[_key7] = arguments[_key7];\n }\n\n var selector = _reselect.createSelector.apply(undefined, args);\n selector.$$factory = function () {\n return _reselect.crea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculate the path to a given 'nodename' through a graph given by 'edges' | function getPathToNode(nodename, edges) {
// calculate path to the given node
let runner = nodename;
let pathSegments = [];
while (runner !== 'root') {
pathSegments.unshift(runner);
runner = edges[runner];
}
pathSegments.unshift('');
return pathSegments.join('/');
} | [
"function gotoPath(rawNodes, pathList) {\n\t console.log(Math.floor(Date.now() / 1000), \"start gotoPath\", rawNodes, pathList);\n\t \n\t try {\n\t \n\t if (pathList) {\n\n\t\t\t// use list to to generate new node graph\n\t\t\tvar pathNodes = []\n\t\t\tfor (var n=0; n<pathList.length; n++) {\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
first, checks all potential initial moves, legal or not, given your currently clicked space and side comes up with any of 2 immediate grid id's ("A7") that could possibly be moved to (one row up or down) (new) then checks if those spaces are currently occupied (innerText==="") now also takes in boolean to check if it's... | function checkAllLegalMoves(oldPosition, faction, isFirstTurn){
let oldPositionDiv = document.getElementById(oldPosition)
let splitPosition = oldPosition.split("")
let letter = splitPosition[0]
let number = splitPosition[1]
//black goes up; black is 0 and K
//kings and q... | [
"function checkMoveValid()\n\t{\n\t\t// Converted the position of the empty space variables\n\t\t// to integers to be able to easily manipulate them later\n\t\tvar tempX = parseInt(blankX);\n\t\tvar tempY = parseInt(blankY);\n\n\t\t// Resets the array and clears the previous valid moves\n\t\tvalidMoves = new Array(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[END basic_write] Cleanups the UI and removes all Firebase listeners. | function cleanupUi() {
// Remove all previously displayed posts.
recentPostsSection.getElementsByClassName('posts-container')[0].innerHTML = '';
userPostsSection.getElementsByClassName('posts-container')[0].innerHTML = '';
// Stop all currently listening Firebase listeners.
listeningFirebaseRefs.forEach(fu... | [
"detachFirebaseListeners () {\n this.ref.off('child_added', this.onAdded, this)\n this.ref.off('child_removed', this.onRemoved, this)\n this.ref.off('child_changed', this.onChanged, this)\n }",
"static detachListener(cb) {\n firebase.database().ref(BASE).off(\"value\", cb);\n }",
"function r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
choose your local type appartement / bungalow / room local type choice | function chooseYourLocal() {
let index = localTypeSelect.value;
console.log(index);
// -------------------------------------------------------
// ----------------- appartement choice ------------------
// -------------------------------------------------------
if (index == "Appartement") {
... | [
"function update_vm_form_fields_from_ostype() {\n var selected = $('.ostype-select').filter('select').find(\":selected\").text().toLowerCase();\n if(selected.match(/zone/)) {\n $('.hvm-type-only').hide();\n $('.zones-related').show();\n } else {\n $('.hvm-type-only').show();\n update_vm_form_fields_f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setup network on Gonk if needed and execute test once network is up | function startNetworkAndTest(onSuccess) {
if (!isNetworkReady()) {
SimpleTest.waitForExplicitFinish();
var utils = getNetworkUtils();
// Trigger network setup to obtain IP address before creating any PeerConnection.
utils.prepareNetwork(onSuccess);
} else {
onSuccess();
}
} | [
"function networkSetup() {\n\tvar i;\n\tncomputers = networkOn(level);\n\tif (computers !== null) {\n\t\tcomputers.length = 0;\n\t}\n\tif (cables !== null) {\n\t\tcables.length = 0;\n\t}\n\tfor (i = 0; i < ncomputers; i+=1) {\n\t\tcomputers[i] = new Computer();\n\t\tif (!computerSetup(computers[i], i)) {\n\t\t\tnco... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Trap for property access (setting). | set(target, property, value, receiver) {
const updateWasSuccessful = trap.set(target, property, value, receiver);
return updateWasSuccessful;
} | [
"get(target, property, receiver) {\n return trap.get(target, property, receiver);\n }",
"set value(_) {\n throw \"Cannot set computed property\";\n }",
"ensureProperty(obj, prop, value) {\n if (!(prop in obj)) {\n obj[prop] = value;\n }\n }",
"function ServerBehavior_handleParamC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updates variables after operation & sets first number to the result | function updateVariables() {
secondNumber = null;
firstNumber = displayValue;
operation = null;
} | [
"function update(temp) {\n result.sum += parseFloat(temp);\n result.l++;\n result.data[result.data.length] = temp;\n}",
"function calculate() {\n\tlet result = document.getElementById(\"result\");\n\n\tif(savedOperation == \"1\") {\n\t\tresult.value = eval(savedNum) + eval(displayedNum);\n\t} else if(sav... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws a stroked circle | function strokedCircle(ctx, x, y, radius) {
ctx.beginPath();
ctx.arc(x, y, radius, 0, 2 * Math.PI, false);
ctx.stroke();
} | [
"function drawPt(x, y, color,isFill,radius) {\n \n\tctx.fillStyle = color;\n ctx.beginPath();\n \n\tctx.arc(x, y, radius, 0, 2*Math.PI);\n ctx.closePath();\n ctx.stroke();\n if(isFill)\n {\n \tctx.fill();\n }\n ctx.fillStyle = \"black\";\n}",
"function draw_circle() {\n ctxe.b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shifts a range by that `much`. | function shift(_a, much) {
var start = _a.start, end = _a.end;
return { start: start + much, end: end + much };
} | [
"function adjustRangeDamage (luckySign, luckModifier) {\n var adjust = 0;\n if (luckySign.luckySign != undefined && (luckySign.luckySign === \"Born on the battlefield\" || luckySign.luckySign === \"Hawkeye\")){\n adjust = luckModifier;\n }\n\treturn adjust;\n}",
"forwardHeavyPunch() {\n\t\tthis.up... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a function to check if the letter is in multiple positions Returns an array with the position of the letter in the word | function checkMultiplePositions(letter, word) {
return word.split('')
.reduce((acc, l, index) => l === letter ? acc + index : acc, '')
.split('')
.map(val => parseInt(val));
} | [
"function checkLetter(solution, thisLetter) {\n var indexes = [];\n solution.split('').forEach(function(item, index){\n if(item == thisLetter) {\n indexes.push(index);\n }\n });\n return indexes.length > 0 ? indexes : false;\n}",
"checkLetter(pressedLetter)\n {\n let clickedLetter = pressedLe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize controllers for route handling | function initControllers() {
CONTROLLERS.forEach(loadController)
} | [
"function initializeControllers() {\n let instances = [];\n controllers.forEach(x => {\n instances.push(new x.Controller());\n });\n return instances;\n}",
"_initialize() {\n if ( this._initialized ) {\n return;\n }\n\n this._log(2, `Initializing Routes...`);\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructor for instance of DocFinder. The dbUrl is expected to be of the form mongodb://SERVER:PORT/DB where SERVER/PORT specifies the server and port on which the mongo database server is running and DB is name of the database within that database server which hosts the persistent content provided by this class. | constructor(dbUrl) {
this.dbURL = dbUrl
this.client = null
this.db = null
this.Mongo_Collections = []
this.content_mongo = []
this.content = new Map()
this.local_memory = new Map()
this.noise_words = new Map()
/*
* DATABASE NAMES
*/
this.contentTB = "content"
this.noisewordsTB = "... | [
"constructor(dbFilePath) {\n if (dbFilePath) {\n //embedded\n this.db = new Datastore({ filename: dbFilePath, autoload: true });\n } else {\n //in memory \n this.db = new Datastore();\n }\n }",
"function extractMongoDbOptions(dbUrl) {\n const {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
search all cites by date an returns cites no registered | static findAllByDate(area, date) {
return new Promise((resolve, reject) => {
if (!area)
return reject({ msg: 'No area', code: 400 });
if (!date)
return reject({ msg: 'No date', code: 400 });
CiteModel.find({ area: area, date: date }, 'hour'... | [
"findEventsByDate(findDate) {\r\n searchDate = new Date(findDate);\r\n\r\n let results = []\r\n\r\n // Assuming same timezone for now\r\n for (let event of Event.all) {\r\n if (\r\n event.date.getMonth() == searchDate.getMonth()\r\n && event.date.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stores a sequence of commits for a given document id. | function update_old(id, newCommits, cb) {
// No commits supplied. Go ahead
if (newCommits.length === 0) {
cb(null);
return true;
}
var commitsKey = id + ":commits";
var commits = self.redis.asList(commitsKey);
// Note: we allow to update the document with commits p... | [
"commit(transaction_id) {\n this.sendCommand('COMMIT', {'transaction': transaction_id});\n this.log.debug(`commit transaction: ${transaction_id}`);\n }",
"function pushToDb() {\n setInterval(function () {\n while(global.instruObj.length){\n // Until the global instruObj is empty, add data to the i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper to construct and test an api client. Returns an jsipfsapi instance or null | async function maybeApi ({ apiAddress, connectionTest, httpClient }) {
try {
const ipfs = httpClient(apiAddress)
await connectionTest(ipfs)
return { ipfs, provider: PROVIDERS.httpClient, apiAddress }
} catch (error) {
// Failed to connect to ipfs-api in `apiAddress`
}
} | [
"function initClient() {\n \n const keys = {\n // fill\n };\n\n return new Gdax.AuthenticatedClient(\n keys[\"API-key\"],\n keys[\"API-secret\"],\n keys[\"Passphrase\"],\n keys[\"Exchange-url\"]\n );\n}",
"function buildClient(){\n if(!client){\n\n const {acmE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
call handler once after stream has become active, then gone idle | function onStreamIdle(stream, delay, handler) {
const nextDataHandler = debounce(onIdle, delay)
stream.on('data', nextDataHandler)
function onIdle(chunk) {
stream.removeListener('data', nextDataHandler)
handler()
}
} | [
"function onStreamActive(stream, handler) {\n stream.once('data', handler)\n}",
"gr(t) {\n return e => {\n this.Oe.enqueueAndForget(() => this.sr === t ? e() : (k(\"PersistentStream\", \"stream callback skipped by getCloseGuardedDispatcher.\"), Promise.resolve()));\n };\n }",
"function substreamOnA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
iterates through the list and rips out the oldest one... savage on the test listing though | function removeOldestTest(listItem, final){
var values = listItem.values;
if(tempNode == null){
tempNode = listItem;
oldest = tempNode;
}else{
// created before , and no accesstime, set
if(values.dateTimeCreated <= oldest.values.dateTimeCreated && values.dateTimeAccessed == undefined){
conso... | [
"function removeOldestMain(listItem, final){\n var values = listItem.values;\n if(oldest == null){\n oldest = listItem;\n }else{\n if(values.dateTimeCreated <= oldest.values.dateTimeCreated){\n oldest = listItem\n }\n if(final == true){ // on final call... declare the poor soul BANISHED mwahahah... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the cache of the specified item with the specified content. | function updateCache(id, status, content)
{
// set cache if preview was created
switch (status)
{
// delete cache entry that the request is done again
case STATUS_PENDING:
delete cache[id];
break;... | [
"addToCache(key, value) {\n assert.isString(key)\n this._cache[key] = value\n }",
"function updateCache() {\n request('https://hypno.nimja.com/app', function (error, response, body) {\n if (error) {\n console.log(error);\n }\n var data = JSON.parse(body);\n if (dat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Task Given a string representing a simple fraction x/y, your function must return a string representing the corresponding mixed fraction in the following format: [sign]a b/c where a is integer part and b/c is irreducible proper fraction. There must be exactly one space between a and b/c. Provide [sign] only if negative... | function mixedFraction(s){
//Split into array of two numbers
var numbers = s.split('/');
//If denominator of fraction is zero, throw error
if (numbers[1] === '0') {
throw "zero division error";
//If numerator of fraction is zero, return 0
} else if (numbers[0] === '0') {
return '0';
//If there ... | [
"function divide(str1, str2) {\n var end = endNumber(str1);\n var start = startNumber(str2);\n //if missing a value or divisor is 0 evaluation is impossible\n if(start.value === undefined || end.value === undefined) {\n throw new Error(\"malformed expression\");\n }\n\n if (start.value === 0)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create checksum of string | function checksum (str, algorithm, encoding) {
return crypto
.createHash(algorithm || 'sha256')
.update(str, 'utf8')
.digest(encoding || 'hex');
} | [
"function checksum(str) {\n\n str = str.replace(/(\\r|\\n)/g, \"\"); // HACK\n\n var chksum = 0;\n for(var i = 0; i < str.length; i++) {\n chksum = chksum ^ str.charCodeAt(i);\n }\n\n return chksum;\n}",
"function generateChecksum(str) {\n\tvar buff = new buffer.Buffer(str);\n\n\tvar num = 0;\n\n\tfor(var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Since the Google Feed API returns feed items from RSS feeds, some feeds might be duplicate. This function returns only unique feeds. | function getUniqueFeeds(feeds){
var found = {},
uniqueFeeds = [];
angular.forEach(feeds, function(feed){
if (!found[feed.url]){
uniqueFeeds.push(feed);
found[feed.url] = true;
}
});
return uniqueFeeds;
... | [
"function getFeedItems(feed) {\n\t\t$.ajax({\n\t\t url: urlBase + 'articles/' + encodeURIComponent(feed.feed),\n\t\t\tdataType: \"json\",\n\t\t\tsuccess: function (data) {\n\t\t\t\tko.utils.arrayForEach(data, function(item) {\n\t\t\t\t\tvm.displayedItems.push( new Item(feed, item) );\n\t\t\t\t\t\n\t\t\t\t\tvar b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Increments the current directive id value. For example we have an element that has two directives on it: dirOne>hostBindings() (index = 1) // increment dirTwo>hostBindings() (index = 2) Depending on whether or not a previous directive had any inherited directives present, that value will be incremented in addition to t... | function incrementActiveDirectiveId() {
activeDirectiveId += 1 + activeDirectiveSuperClassHeight;
// because we are dealing with a new directive this
// means we have exited out of the inheritance chain
activeDirectiveSuperClassDepthPosition = 0;
activeDirectiveSuperClassHeight = 0;
} | [
"#nextId() {\n const nextId = \"id_\" + this.#currentId;\n this.#currentId++;\n return nextId;\n }",
"generateId() {\n const newId = `dirId-${Directory.nextId}`;\n Directory.nextId++;\n return newId;\n }",
"arrangeId() {\n const rootNode = this.parent.contentDom.document... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Encodes a keyvalue pair, where a value can be an array. | function urlEncodePair(key, value, str) {
if (value instanceof Array) {
value.forEach(function (item) {
str.push(encodeURIComponent(key) + '[]=' + encodeURIComponent(item));
});
}
else {
str.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
... | [
"function createEncodedParam (key,value) {\n return {\n key: percentEncode(key),\n value: percentEncode(value)\n }\n}",
"encodeData(type, value) {\n return this.getEncoder(type)(value);\n }",
"static encode(domain, types, value) {\n return (0, index_js_4.concat)([\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds subfolds and finish fold in progress | function addSubFoldsAndEnd(lines, l, currentFold, level, offset) {
var foldLines, subFolds;
// If there is a current fold, otherwise nothing to do
if (currentFold !== null) {
// set end property which is current line + offset
currentFold.end = l - 1 + offset;
// If it's not too deep
... | [
"fold (f, a) {\n return fold(f, a, this)\n }",
"fold() {\n this.cards = [];\n this.positionState.isLeave = true;\n console.log(this.name + ' folds cards');\n }",
"function getFolds(lines, level, offset) {\n var folds = Object.create(null);\n var currentFold = null;\n var key... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ballCollision() sets out arguments for the ball colliding with the top and bottom of the canvas | function ballCollision() {
if(ball.yPos > height - ball.radius) {
ball.yPos = height - ball.radius;
ball.vy *= -1;
}
else if(ball.yPos < ball.radius/2) {
ball.yPos = ball.radius/2;
ball.vy *= -1;
}
} | [
"function Mainball() {\n \t\n\n this.leftEdge = 0;\n this.rightEdge = this.canvasWidth;\n this.topEdge = 0;\n this.bottomEdge = this.canvasHeight;\n\n /******************** added by beeb **************/\n this.ballRegion = null;\n this.ballMovingDown = false;\n this.ballMovingRight = false;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
8. The call back should loop through the response and console.log every Location name | function getAllLocationsCallback(response){
} | [
"function getGrouponLocations() {\n\n var grouponRequestTimeout = setTimeout(function() {\n return self.searchStatus('Failed to retrieve Groupon data.');\n }, 8000);\n\n $.ajax({\n url: 'https://partner-int-api.groupon.com/division.json?country_code=UK',\n dataType: 'jsonp',\n success... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format dynamoDBItems for batch deletion | function formatDynamoBatchDelete(dynamoDBItems) {
return dynamoDBItems.map((item)=> {
return {
DeleteRequest: {
Key: {
number: item.number
}
}
}
})
} | [
"function deleteItem(i) {\n \treturn this.each(function() {\n \t\tvar d = getSavedData($(this));\n\n \t\tif(d) {\n\t \t\tfor(it in i)\n\t \t\t\td.delItems.push(i[it]);\n\n\t \t\tsaveData($(this), d);\n\t \t}\n\t });\n }",
"handleDeleteItems(e){\n\t\tconst id = e.target.attributes.keyset... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if this symbol is an export for the entry point being analyzed. | get exported() {
return this.exportNames.size > 0;
} | [
"isSimpleExportVar() {\n let tokenIndex = this.tokens.currentIndex();\n // export\n tokenIndex++;\n // var/let/const\n tokenIndex++;\n if (!this.tokens.matches1AtIndex(tokenIndex, _types.TokenType.name)) {\n return false;\n }\n tokenIndex++;\n while (tokenIndex < this.tokens.tokens.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set here the base of the relative path for all app views | function basepath(uri) {
return 'app/views/' + uri;
} | [
"getViewUrl(viewID) {\n return appEnv.rootPath + \"View/\" + viewID;\n }",
"static get baseRoute () {\n throw new Error('Not implemented')\n }",
"baseURL () {\n return config.api.baseUrl;\n }",
"function setAssetPaths() {\n if (window.location.hostname == 'thedataface.com') {\n return 'h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return an object that has the URL's pathPrefix and param as properties. the param is whatever is after the last / (if there is more than one / in the original path. extract the parameter value from the path. the parameter is defined as being whatever is after the last '/' in the path... | function parsePath (path) {
// path #/insertUser --> {param:"", pathPrefix: "#/insertUser" }
// path #/updateUser/43 --> {param:"43", pathPrefix: "#/updateUser" }
// start out assuming that this is a parameterless path (URL)
var obj = {
param: "",
pathPrefix: path
... | [
"function parsePath() {\n var pathname = location.pathname;\n\n // We have a hash based route. Replace the hash with a slash, and append to\n // our existing path\n if (location.hash) {\n pathname += location.hash.replace('#', '/');\n }\n\n if (pathname.split('/')[PathPart.PROJECTS] !== 'p' &&\n pathn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds and sets possible expressions at the given depth as combinations of possible expressions at lower depths | function findPossibleExpressionsAtDepth(depth) {
if (depth <= 1) {
// Look for productions that result in terminals
for (let nonterminal of Object.keys(productions_)) {
expressionsAtDepth_[1][nonterminal] = [];
for (let replacement of productions_[nonterminal]) {
if (replacement.every(isTe... | [
"function recursiveRandomExpression(depth, nonterminal) {\n if (expressionsAtDepth_[depth][nonterminal].length <= 0) {\n throw (`${depth}: No possible replacements for ${nonterminal}.`\n + 'If this is NOT the first level of recursion then we have a problem.');\n }\n let potentialExpressions = expressionsAt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function adds a layer showing the route linestring between origin and destination originCoordinates and destinationCoordinates are both an array of [lng,lat] coordinates. mode is the mode of transportation according to the MapBox Directions API (e.g. 'walking', 'cycling'). originName and destName are station names... | function showDirectionLineAndDetails(originCoordinates, destinationCoordinates, originName, destName, mode, name) {
var directionQuery = generateDirectionQuery(mode,
originCoordinates[0], originCoordinates[1],
destinationCoordinates[0], destinationCoordinates[1]);
var layerName = 'directions-' + name;... | [
"function showDirection(location, mode){\n\t//If there is already a direction line on the map then remove it\n\tif(directionDisplay){\n\t\tdirectionDisplay.setMap(null);\n\t}\n\t//Create a new instance of DirectionsService\n\tvar directionService = new google.maps.DirectionsService();\n\t//Create a new instance of ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get streamIds of fields that should be unique | static getUniqueAccountStreamsIdsWithoutDot () {
if (!SystemStreamsSerializer.uniqueAccountStreamsIdsWithoutDot) {
let uniqueStreamIds = Object.keys(getStreamsNames(SystemStreamsSerializer.getAccountStreamsConfig(), uniqueStreams));
SystemStreamsSerializer.uniqueAccountStreamsIdsWithoutDot =
uni... | [
"static getAccountStreamsIdsForbiddenForReading () {\n if (!SystemStreamsSerializer.accountStreamsIdsForbiddenForReading) {\n let allStreams = SystemStreamsSerializer.getAllAccountStreams();\n let readableStreams = SystemStreamsSerializer.getReadableAccountStreams();\n SystemStreamsSerializer.acco... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for postV3ProjectsIdBoardsBoardIdLists | postV3ProjectsIdBoardsBoardIdLists(incomingOptions, cb) {
const Gitlab = require('./dist');
let defaultClient = Gitlab.ApiClient.instance;
// Configure API key authorization: private_token_header
let private_token_header = defaultClient.authentications['private_token_header'];
private_token_header.apiKey = ... | [
"function saveBoard(model) {\n console.assert(model && model.board);\n\n // Make an entity with only the bits we want to save.\n\n var b = model.board;\n var e = spEntity.fromJSON({\n id: b.idP,\n name: b.name,\n boardCardTempl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Purge all stored watchers (and clear the local watch list) | purge() {
this.clear();
this.stateStorage.update(Watch.constants.WATCH_STORE, []);
channel.appendLocalisedInfo('purged_all_watchers');
} | [
"clear() {\n\t\tthis.watchList.forEach((item) => this.remove(item.uri));\n\t\tthis.watchList = [];\n\n\t\tchannel.appendLocalisedInfo('cleared_all_watchers');\n\t\tthis._updateStatus();\n\t}",
"function cleaAllCaches(){\n\n self.addEventListener('activate', function(event) {\n event.waitUntil(\n ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
x and y are location of the circle in the canvas end is the ending Percent you want the circle to load to inText is text inside the circle title is title above the circle | function createCircle(x, y, end, inText, title, callback) {
var radius = 75;
var endPercent = parseInt(end, 10)
var curPerc = 0;
var counterClockwise = false;
var circ = Math.PI * 2;
var quart = Math.PI / 2;
//Set your color here
context.strokeStyle = '#000000';
context.ImageSmoothin... | [
"function textToCircles(text, xaxis,yaxis,x,y) {\n \n text.transition()\n .duration(1000)\n .attr(\"x\", function(d) { return x(d[xaxis])-5; })\n .attr(\"y\", function(d) { return y(d[yaxis])+2.5; })\n return text;\n\n}",
"function draw_circle() {\n ctxe.beginPath()\n ctxe.arc(EW_CENTER_P... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Synchronously execute listeners with the defined arguments. If a listener returns `false`, the loop with be aborted early, and the emitter will return `true` (for bailed). | emit(args, scope) {
constants_1.debug('Emitting "%s%s" as bail', this.name, scope ? `:${scope}` : '');
return Array.from(this.getListeners(scope)).some(listener => listener(...args) === false);
} | [
"_callEventListeners(event, args = []) {\n // Make args an array if it's not\n const arrayArgs = Array.isArray(args) ? args : [args];\n if (this._eventListeners[event]) {\n for (const handler of this._eventListeners[event]) {\n handler.apply(null, a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the diagram in the given inline image and returns the new inline image. | function updateDiagram(id, page, scale, elt)
{
var img = null;
var result = fetchImage(id, page, scale);
var isOK = false;
if (result != null)
{
var blob = result[0];
var w = result[1] / scale;
var h = result[2] / scale;
if (blob != null)
{
isOK = true;
// There doe... | [
"function addInline(payload, inline) {\n return addAttachment(payload, inline, true);\n }",
"function updateImageReader() {\r\n var newImageUrl = document.getElementById('image-search').value;\r\n\r\n clearImageSelection();\r\n\r\n if (mode == READ_MODE) {\r\n refreshAnnotations(newImage... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create table using DynamoDB | createTable() {
Birthday.dynamodb.createTable(Birthday.schema, (err) => {
if (err) {
console.error('Unable to create table. Error JSON:', JSON.stringify(err, null, 2));
return;
}
});
} | [
"function createImageTableDynamoDB(){\n\treturn ddb.createTable({\n\t\tTableName: CONFIG.ddb_image_table,\n\t\tBillingMode: \"PROVISIONED\",\n\t\tProvisionedThroughput: {\n\t\t\tReadCapacityUnits: 5,\n\t\t\tWriteCapacityUnits: 5\n\t\t},\n\t\tAttributeDefinitions: [\n\t\t\t{\n\t\t\t\tAttributeName: 'eventt',\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get covid stats for all countries | function casesByCountry (){
let today = dateToday();
let endPoint = 'https://api.covid19tracking.narrativa.com/api/'
let queryCountriesUrl = endPoint + today;
let URL = {
url: queryCountriesUrl,
method: "GET"
}
// making request to pull all Covid data by countrie... | [
"function getCovidStatState () {\n\n let stateCompleteData=[];\n let stateCompletePositionData=[];\n let stateDataMerge=[];\n\n let today = dateToday();\n \n // https://api.covid19tracking.narrativa.com/api/2020-10-12/country/us\n \n let queryUrl = `https://api.covid19tracking.narrativa.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1. Previous slide is unset. 2. What was the next slide becomes the previous slide. 3. New index and appropriate next slide are set. 4. Fade out action. | performSlide() {
if (this.prevSlide) {
this.prevSlide.removeClass('prev fade-out')
}
this.nextSlide.removeClass('next');
this.prevSlide = this.nextSlide;
this.prevSlide.addClass('prev');
this.currentIndex++;
if (this.currentIndex >= this.slides.lengt... | [
"slideNext() {\n super.slideNext();\n this.slides[this.lastSlide].style.opacity = 0;\n this.slides[this._index].style.opacity = 1;\n }",
"function moveslideback(){\n\tclearTimeout(timer)\n\tclearTimeout(fadingtimer);\n\tchangeImage()\n\top = 1\n\t\tif (!document.images){\n\t\t\treturn\n \t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use the AWS CloudFormation AWS::DAX::SubnetGroup resource to create a subnet group for use with DAX (DynamoDB Accelerator). Documentation: | function SubnetGroup(props) {
return __assign({ Type: 'AWS::DAX::SubnetGroup' }, props);
} | [
"function DBSubnetGroup(props) {\n return __assign({ Type: 'AWS::Neptune::DBSubnetGroup' }, props);\n }",
"function SubnetGroup(props) {\n return __assign({ Type: 'AWS::ElastiCache::SubnetGroup' }, props);\n }",
"function ClusterSubnetGroup(props) {\n return __assi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParsersearch_clause. | visitSearch_clause(ctx) {
return this.visitChildren(ctx);
} | [
"visitSearched_case_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitLocal_xmlindex_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function STLangVisitor() {\n STLangParserVisitor.call(this);\n this.result = {\n \"valid\": true,\n \"error\": null,\n \"tree\": {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called on frmNewPayPersonKA preShow on payPerson.js | function loadNewPayPersonData() {
frmNewPayPersonKA.fromColorAccount1.backgroundColor = account1.color;
frmNewPayPersonKA.fromNameAccount1.text = account1.name;
frmNewPayPersonKA.fromAmountAccount1.text = account1.avlBalance;
frmNewPayPersonKA.fromColorAccount2.backgroundColor = account4.color;
frmNewP... | [
"function showCreateForm() {\n setID(\"\");\n setFullName(\"\");\n setEmail(\"\");\n setShowForm(true);\n setShowUpdateForm(false);\n }",
"function show_payment_form() {\n var $payment_el = $(this); // Using `this` is gross.\n var $form = $payment_el.parents('form');\n var pay... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[SECTION] Example App: Property Editor / ShowExampleAppPropertyEditor() Demonstrate create a simple property editor. | function ShowExampleAppPropertyEditor(p_open) {
SetNextWindowSize(new ImVec2(430, 450), ImGuiCond.FirstUseEver);
if (!Begin("Example: Property editor", p_open)) {
End();
return;
}
HelpMarker("This example shows how you may implement a property editor using t... | [
"SetCompatibleWithEditor() {}",
"setupEditor() {\r\n this.fancyEditor = CodeMirror.fromTextArea(this.source.get(0), {\r\n mode: 'python',\r\n theme: this.theme,\r\n lineWrapping: true,\r\n lineNumbers: this.lineNumbers,\r\n tabSize: 2,\r\n a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a single resume of a specific format. | function single( fi ) {
try {
var f = fi.file, fType = fi.fmt.ext, fName = path.basename( f, '.' + fType );
var fObj = _fmts.filter( function(_f) { return _f.ext === fType; } )[0];
var fOut = path.join( f.substring( 0, f.lastIndexOf('.') + 1 ) + fObj.ext );
_log( 'Generating ' + fi.fmt.name.... | [
"function generateResume() {\n html2pdf(areaCv, opt);\n}",
"function gen( src, dst, theme, logger, errHandler ) {\n\n _log = logger || console.log;\n _err = errHandler || error;\n _opts.theme = (theme && theme.toLowerCase().trim()) || 'modern';\n\n // Load input resumes...\n if(!src || !src.leng... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given an array on integers and a number k, find a max in each sliding window of k elements A = [4,6,5,2,4,7] and K = 3, windows are as follows: [4,6,5,2,4,7] : Max = 6 [4,6,5,2,4,7] : Max = 6 [4,6,5,2,4,7] : Max = 5 [4,6,5,2,4,7] : Max = 7 Output: 6,6,5,7 | function slidingWindowMax(arr, k) {
const result = []
const window = new QueueWithMax
for (let i = 0; i < k; i++) {
window.add(arr[i])
}
result.push(window.max())
for (let j = k; j< arr.length; j++) {
window.remove()
window.add(arr[j])
result.push(window.max())
}
return result
} | [
"function slidingWindow(arr, k) {\n let currentSum = 0;\n let startWindow = 0;\n const outputArr = [];\n for (let i = 0; i < arr.length; i++) {\n if (i < k - 1) currentSum += arr[i];\n else {\n currentSum += arr[i];\n outputArr.push(currentSum / k);\n currentSum -= arr[startWindow];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds the locale data for a given locale. | function findLocaleData(locale) {
var normalizedLocale = normalizeLocale(locale);
var match = getLocaleData(normalizedLocale);
if (match) {
return match;
}
// let's try to find a parent locale
var parentLocale = normalizedLocale.split('-')[0];
match = getLocaleData(parentLocale);
... | [
"function getLocale () {\n return locale\n}",
"function _getLocale(name) {\n\treturn _locales[name] || _locales.$def;\n}",
"async getLocales(req, _id) {\n const criteria = {\n aposDocId: _id.split(':')[0]\n };\n if (!self.apos.permission.can(req, 'view-draft')) {\n criter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Text for the form field hint. | get hintLabel() { return this._hintLabel; } | [
"function getHintValue() {\n hint = ((category == \"dictionary\") ?\n ((hintCollection.length >= 1) ? hintCollection[Math.floor(Math.random() * hintCollection.length)] : `First letter in this word is: ${firstLetter}`) :\n hint);\n }",
"function printHint() {\n $('#hint').text(cu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
continue the active stroke: append mouse point to active stroke | function continueStroke(evt) {
// we need an active stroke
if (!stroke) return;
// laser stroke?
if (isLaserStroke) {
if (!stroke.classList.contains("laser")) {
stroke.classList.add("laser");
}
}
// collect coalesced events
let events = [evt];
if (evt.getCoalescedEv... | [
"startPencil(event){\n this.art.push({\n tool: 'polyline',\n points: `${event.clientX},${event.clientY} `,\n width: this.strokeWidth != 0 ? this.strokeWidth : 1,\n stroke: this.stroke\n });\n }",
"function sketchpad_mouseDown... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Neither useref nor htmlreplace does the complete job, so combine them First use htmlreplace to rename the bundle file, then have useref concat the dependencies | function writeHtml() {
return gulp.src('index.html')
.pipe(htmlreplace({
'js-bundle': 'bundle.js'
})).pipe(useref())
.pipe(gulp.dest('build/'));
} | [
"revReplace() {\n if (this.css.length > 0) {\n this.css.forEach((css, index, arry) => {\n if (this.images.length > 0 && css.assets.length > 0 && !css.isInBundle) {\n const images = this.images;\n const rewriter = new URLRewriter(function (url) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes the program dropdown box on the admin page with all programs. | function initAdminProgramDropdown() {
var dropdown = document.getElementById("programDropdown");
//if the dropdown box exists
if(dropdown) {
//clear the dropdown box
dropdown.options.length = 0;
//add every program to the dropdown box
var i;
for(i in programs) {
var program = programs[i];
dropdown... | [
"function initAdmin() {\n\tinitAgenciesAndPrograms();\n\tinitAdminAgencyDropdown();\n\tinitAdminProgramDropdown();\n\talert('You have selected the \"Administrator\" option. Use this option only to add, delete, or edit programs or agencies and their descriptions.');\n}",
"function createDropDown() {\t\r\n\t\tif(do... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send an image using the Send API. | function sendImageMessage(recipientId,senderId,imageUrl){var messageData={recipient:{id:recipientId},message:{attachment:{type:"image",payload:{url:imageUrl}}}};return callSendAPI(messageData,senderId);} | [
"function sendImage(e) {\n \n var uri = '',\n data = {};\n\n if (!isAndroid && cv.toDataURL) {\n uri = cv.toDataURL();\n }\n else {\n uri = (Canvas2Image.saveAsBMP(cv, true, cWidth, cHeight)).src;\n }\n\n data.imageData = uri;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load properties from a Message object | function loadMessageProps(item) {
$('#message-props').show();
$('#attachments').html(buildAttachmentsString(item.attachments));
$('#cc').html(buildEmailAddressesString(item.cc));
$('#conversationId').text(item.conversationId);
$('#from').html(buildEmailAddressString(item.from));... | [
"function loadProps() {\n var item = Office.context.mailbox.item;\n\n $('#dateTimeCreated').text(item.dateTimeCreated.toLocaleString());\n $('#dateTimeModified').text(item.dateTimeModified.toLocaleString());\n $('#itemClass').text(item.itemClass);\n $('#itemId').text(item.itemId);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the aggregate instance is in the cache, we can use a much simpler procedure. | function cacheLoad(){
return cacheProvider.getAggregateInstance(aggregateType, ARID);
} | [
"visitResult_cache_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"async function main() {\n\n // Login to GDN and Create cache (if not exists)\n fabric = new Fabric(fed_url)\n await fabric.login(guest_email, guest_password)\n await fabric.useFabric(geo_fabric)\n const cache = new Cache(fabric)\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the user tries to roll before they enter a score, alert them to the need to enter a score. | function RollAlert(){
alert("You must enter a score before continuing.");
} | [
"function checkScore() {\n if (totalScoreNumber === currentGoalNumber && currentGoalNumber != 0) {\n wins++;\n $(\"#wins\").text(\"Wins: \" + wins);\n setNumbers();\n }\n else if (totalScoreNumber > currentGoalNumber) {\n losses++;\n $(\"#l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
date from string and array of format strings | function makeDateFromStringAndArray(string, formats) {
var output,
inputParts = string.match(parseMultipleFormatChunker) || [],
formattedInputParts,
scoreToBeat = 99,
i,
currentDate,
currentScore;
for (i = 0; i < formats.length; i++... | [
"parseFormat(dateString){\n\t\tlet format;\n\t\tlet validFormats = new Set(Object.getOwnPropertyNames(FORMAT));\n\t\tvalidFormats.forEach(valid => {\n\t\t\tlet regex = new RegExp(FORMAT[valid]['regex'], 'g');\n\t\t\tif(regex.test(dateString)){\n\t\t\t\tformat = valid;\n\t\t\t}\n\t\t});\n\t\tif(! format) \n\t\t\tthr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the height of the menu Parameters: pHeight: The height of the menu | function DDLightbarMenu_SetHeight(pHeight)
{
if (typeof(pHeight) == "number")
{
if ((pHeight > 0) && (pHeight <= console.screen_rows))
this.size.height = pHeight;
}
} | [
"function setMenuMaxHeight() {\n \tvar outerHeight = $(pDiv+jq(config.CSS.IDs.divBottomWrapper)).outerHeight(true);\n \tvar docHeight = $(pDiv+ jq(\"divMainJsmol\")).height();//TODO fix\n \t$(pDiv+ jq(config.CSS.IDs.divMenu)).css('max-height',docHeight - outerHeight );\n\t}",
"set requestedHeight(value) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get start Node and target node | function getStartAndTargetNode(allNodes){
// check that exist
var startNodeElement = $('.element.startNode');
var targetNodeElement = $('.element.targetNode');
if(startNodeElement.length==0 || targetNodeElement.length==0){ return [null, null, false];}
// get elements with start and target classes
var startNode... | [
"getRangeStart() {\n return ChromeVoxState.instance.getCurrentRange().start.node;\n }",
"function findHighlightTarget(start) {\n let target = start;\n\n while (target.nodeName === 'tspan') target = target.parentNode;\n\n if (target.nodeName === 'text') target = target.parentNode;\n\n if (target.nodeName =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets all checked items and returns them in array need to pass id of container where to get items tests or suites | function getAllCheckedItems(container) {
var wrapper = document.querySelector(container);
var chckbox = wrapper.querySelectorAll('input');
var testCollection = [];
chckbox.forEach(element => {
if (element.checked) {
var _parent = elem... | [
"get checkedItems() {\n return this.composer.queryItems((item) => {\n return this.isItemChecked(item) && (!this.manageRelationships || !this.getItemChildren(item).length);\n }, Infinity);\n }",
"function getAllItems(){\n\n}",
"function getCheckboxesFrom(targetElement)\n{\n\tvar resul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function handles the visual output. It checks whether the user device has a screen and renders a template if it does as well as rendering a card in the Alexa app. If not it only outputs to a card in the Alexa app. No data is returned. Parameters: playStatus should be either 'play' or 'stop' Be sure to include keyw... | function makeTemplate(playStatus){
if (playStatus == 'play'){
//Construct image file URLs - Check for special case of A440
//This is redundant and inefficient since I'm constructing the URLs, putting them in
//the objNotePackage object, then immediately reading them into another variable.
//With th... | [
"function displayGameplay() {\n image(backgroundImg, width / 2, height / 2, 1500, 800);\n\n // Handle input for the player\n player.handleInput();\n\n // Move all the supplies\n player.move();\n for (let i = 0; i < supply.length; i++) {\n supply[i].move();\n // Handle the bee eating any of the supply\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a PathMatch object if the given pattern matches the current URL. This is useful for components that need to know "active" state, e.g. . | function useMatch(pattern) {
!useInRouterContext() ? false ? 0 : UNSAFE_invariant(false) : void 0;
let {
pathname
} = dist_useLocation();
return React.useMemo(() => matchPath(pattern, pathname), [pathname, pattern]);
} | [
"function matchPath(ctx) {\n const pathname = parseurl_1.default(ctx).pathname;\n const cookiePath = cookieOptions.path || \"/\";\n if (cookiePath === \"/\") {\n return true;\n }\n if (pathname.indexOf(cookiePath) !== 0) {\n // cookie path not match\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
inputArray is the array buffer first convert the array buffer to in16 then we need to conver the int16 to float32 return float32array | function int16ToFloat32(inputArray) {
let int16arr = new Int16Array(inputArray)
var output = new Float32Array(int16arr.length);
for (var i = 0; i < int16arr.length; i++) {
var int = int16arr[i];
var float = (int >= 0x8000) ? -(0x10000 - int) / 0x8000 : int / 0x7FFF;
... | [
"function fract32 (arr) {\r\n\tlet fract = new Float32Array(arr.length)\r\n\tfract.set(arr)\r\n\tfor (let i = 0, l = fract.length; i < l; i++) {\r\n\t\tfract[i] = arr[i] - fract[i]\r\n\t}\r\n\treturn fract\r\n}",
"get f32() { return new Float32Array(module.memory.buffer, this.ptr, this.len); }",
"static FromFlo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if target is a string | check(target) {
const targetType = typeof target;
assert('string' === targetType, 'Type error, target should be a string, ' +
`${targetType} given`);
} | [
"function sc_isString(s) { return (s instanceof sc_String); }",
"isString() {\n return (this.type === \"string\");\n }",
"function ISTEXT(value) {\n return 'string' === typeof value;\n}",
"isString(expression) {\n doCheck(\n this.typesAreEquivalent(expression.type, StringType),\n \"Not... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called after selected page has been changed. According to selected page it shows / hides add application action (_addAction). | _onSelectedChanged() {
if (this._selected !== 'appsco-application-add-search') {
this.$.addApplicationAction.style.display = 'block';
this.playAnimation('entry');
this._addAction = true;
}
else {
this._addAction = false;
this.playAnimat... | [
"_onApplicationSelect() {\n this._selected = 'appsco-application-add-settings';\n }",
"_onAddApplication() {\n this._showLoader();\n this.$.appscoApplicationAddSettings.addApplication();\n }",
"function afterChange() {\n\n\t\t\t// Make current page inactive\n\t\t\tcurrentContentPage.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instance variables: browser Reference to the browser eventLoop Reference to the browser's event loop queue FIFO queue of functions to call expecting These are holding back the event loop timers Sparse array of timers (index is the timer handle) eventSources Additional sources for events (SSE, WS, etc) nextTimerHandle V... | function EventQueue(window) {
_classCallCheck(this, EventQueue);
this.window = window;
this.browser = window.browser;
this.eventLoop = this.browser._eventLoop;
this.queue = [];
this.expecting = 0;
this.timers = [];
this.eventSources = [];
this.nextTimerHandle = 1;
} | [
"function oneEventQueue() {\n console.log('\\n***Begin single queue, event-based test\\n')\n\n start = new Date()\n lr = new Limireq(1)\n .push({ url: 'http://www.google.com' })\n .push({ url: 'http://www.android.com' }, function(err, res, body) {\n console.log('Status Code:' + res.statusC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
input commenti CAMBIARE NOME | input_comment(int){
var user = $("#user_in" + int).val();
var comment = $("#text_in" + int).val();
if(user == ""){
user = "Anonimo";
}
if(comment == ""){
}else{
var testo_sopra = "<b>"+ user + "</b> scrive:";
var nuovoDiv = $('<div cla... | [
"comments(node, { value: text, type }) {\n return type === 'comment2' && bannerRegex.test(text)\n }",
"function onCommentChange(event) {\n setCommentText(event.target.value);\n }",
"function publishComment(comment, badWords, censorFunction, printFunction) {\n\n\n}",
"function addCo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper method that returns index of client object based on the user id | function indexOfUser(clients, user) {
let ind = -1;
clients.forEach((clientIt, index) => {
if (clientIt.userId == user) {
ind = index;
}
});
return ind;
} | [
"function indexOfClient(clients, client) {\n let ind = -1;\n clients.forEach((clientIt, index) => {\n if (clientIt.clientId == client) {\n ind = index;\n }\n });\n return ind;\n}",
"function getClientById(id){\n var count = users.length;\n var client = null;\n for(var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getSaveRep() gets the save representation of the current program as a JavaScript object | function getSaveRep() {
return topBlock.getRep();
} | [
"saveToJSON () {\n\t\tlet digimonJSON = JSON.stringify(this);\n\n\t\treturn digimonJSON;\n\t}",
"function savedSavingObject(){\n\t//returns the saved saving object from local storage\n\tvar savingObject = localStorage[\"savingObject\"];\n\tif(savingObject != undefined){\n\t\tsavingObject = JSON.parse(savingObject... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
==================== 1 saleForm check ==================== /++++++++++++++++++++ 2 ticketForm check ++++++++++++++++++++ | function chk_ticketSale(home, devicetype, ticket_num)
{
var custom = $("input[name='custom']").val();
var custom_arr = custom.split('nycuni');
var pid = custom_arr[0];
var flag_zero = ticket_num;
var flag_nozero = -1;
for ( var k = 1; k <= ticket_num; k++)
{
if ( $("#quantity_"+k).val() == 0 )
{
--flag... | [
"function validateInstallmentsFee(){\n\tvar enable=true;\n\t\n\tfor ( var i = 0; i < feeHeadCount; i++) {\n\t\t\n\t\tvar headFee=0;\n\t\tvar headTotal=0;\n\t\t\n\t\tif(!isNaN( jQuery.trim( $(\"#fee_head_\"+i).html())) && jQuery.trim( $(\"#fee_head_\"+i).html())!=0) {\n\t\t\theadFee=parseInt(jQuery.trim( $(\"#fee_he... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parses (UTC) IMAP dates into UTC timestamps. IMAP dates are DDMonYYYY. | function parseImapDate(dstr) {
var match = reDate.exec(dstr);
if (!match)
throw new Error("Not a good IMAP date: " + dstr);
var day = parseInt(match[1], 10),
zeroMonth = MONTHS.indexOf(match[2]),
year = parseInt(match[3], 10);
return Date.UTC(year, zeroMonth, day);
} | [
"parseDates(data) {\n if (data.length && 'Date' in data[0]) {\n for (let i = 0; i <= data.length-1; i++) { data[i].Date = moment.utc(data[i].Date, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); }\n return data;\n } else if (data.length && 'startDt' in data[0]) {\n for (let i = 0; i ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetches all the students from the student table | function getAllStudents() {
return __awaiter(this, void 0, void 0, function* () {
try {
return yield db_1.Student.findAll();
}
catch (err) {
console.error(err);
}
});
} | [
"static async allStudents(limit,offset){\n const results=await pool.query('SELECT * FROM student,studdata WHERE student.email=studdata.email ORDER BY studentid LIMIT ?,?',[Number(offset),Number(limit)]);\n return results;\n }",
"function list() { console.log(students); }",
"static async selectC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to initalise the analyser. | function initAnalyser() {
//Creates an AnalyserNode
analyser = audioContext.createAnalyser();
/*A value from 0 - 1 where 0 represents no time averaging with the last analysis frame. The default value is 0.8 */
analyser.smoothingTimeConstant = SMOOTHING;
//The size of the FFT used for frequency-domain analysis. Must... | [
"function init() {\n checkBiquadFilterQ().then(function(flag) {\n hasNewBiquadFilter = flag;\n context = new AudioContext();\n hasIIRFilter = context['createIIRFilter'] ? true : false;\n });\n\n const magStyle = document.querySelector('#mag-select');\n magStyle.addEventListener('change', (event) => {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
append to file, overwrite last block | function appendToFileOverwritingLastBlock(file, initContent, content) {
let blockSizeInBytes = 16;
let fileSizeInBytes = 0;
if (fs.existsSync(file)) {
fileSizeInBytes = fs.statSync(file)["size"];
} else {
fs.closeSync(fs.openSync(file, 'w'));
content = Buffer.concat([initContent, content]);
}
l... | [
"function writeIt() {\n if (index < LOG.length) {\n fs.appendFile('log.txt', LOG[index++] + \"\\n\", writeIt);\n }\n }",
"saveChunk() {\n console.log(\"Saving Chunk for \" + this.name + \" @ \" + this.path + \"/fullLog.json\");\n\n // Load the Full Log.\n let fullLogRaw = fs.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get oauth request token from Twitter API | function getRequestToken(){
console.log('Fetching request token from Twitter..');
client.fetchRequestToken( 'oob', function( token, data, status ){
if( ! token ){
console.error('Twitter failure: status '+status+', failed to fetch request token');
process.exit(... | [
"function getTwitterAuth() {\n\n // Settings for requesting OAuth.\n var twitterCredentials = config.twitterCredentials;\n var key = twitterCredentials.key;\n var secret = twitterCredentials.secret;\n var reqUrl = 'https://api.twitter.com/';\n var reqPath ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This will count the amount of strings in any variable with an array. | function numStrings(list) {
var count = 0;
for(i = 0; i < list.length; i++) {
//loops through each string, counting amount.
if( typeof list[i] == "string") {
count++;
}
}
return count;
} | [
"function countCharacters(arr) {\n\treturn arr.join(\"\").length;\n}",
"function countOfNumStr(arr) {\n const num = arr.filter(item => typeof (item) === \"number\").length;\n const str = arr.filter(item => typeof (item) === \"string\").length;\n console.log(`Numbers: ${num}, String: ${str}`);\n}",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Note that for FakeXMLHttpRequest to work pre ES5 we lose some of the alignment with the spec. To ensure as close a match as possible, set responseType before calling open, send or respond; | function FakeXMLHttpRequest() {
this.readyState = FakeXMLHttpRequest.UNSENT;
this.requestHeaders = {};
this.requestBody = null;
this.status = 0;
this.statusText = "";
this.upload = new UploadProgress();
this.responseType = "";
this.response = "";
i... | [
"function succeed(response, type, content) {\n var typeHeader = {\n 'Content-Type': type\n };\n response.writeHead(OK, typeHeader);\n response.write(content);\n response.end();\n}",
"function createClient(xhr) {\n const { flag, properties } = xhr;\n const urlObj = new URL(flag.uri);\n con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This opens the Info.plist as an XML document, navigates to the / part that has the version number, and returns it, thus ensuring / the version displayed is never out of sync with the Info file. | function version(){
var xmlReq = new XMLHttpRequest();
xmlReq.open("GET", "Info.plist", false);
xmlReq.send(null);
var xml = xmlReq.responseXML;
var keys = xml.getElementsByTagName("key");
var ver = "0.0";
for (i=0; i<keys.length; ++i) {
if ("CFBundleVersion" == keys[i].firstChild.data) {
... | [
"parseVersion() {\n var version = this.map_['info']['version'];\n var parsed = '';\n if (goog.isString(version)) {\n parsed = parseInt(version, 10);\n if (isNaN(parsed)) parsed = version;\n else parsed = parsed.toString();\n this.version = parsed;\n }\n }",
"function _getSIPmlVers... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
One of the most complicated functions in this project that will attempt to position an element relative to another container element while still being visible within the viewport. Below is the logical flow for attempting to fix the element to the container: No Container: If there is no container element, return the pro... | function getFixedPosition(_a) {
var container = _a.container, element = _a.element, _b = _a.anchor, propAnchor = _b === void 0 ? {} : _b, initialX = _a.initialX, initialY = _a.initialY, _c = _a.vwMargin, vwMargin = _c === void 0 ? 16 : _c, _d = _a.vhMargin, vhMargin = _d === void 0 ? 16 : _d, _e = _a.xMargin, xMarg... | [
"styleFixedElement(element, computedStyle = null) { \n const { hasFixedPosition, leftPx, rightPx } = this.getFixedPosition(element, computedStyle);\n if (!hasFixedPosition) {\n if (element.classList.contains(StyleClass.FixedElement)) { \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
7. find the best profit you can make in a week | function best_profit(prices) {
if (!prices.length) return 0;
// Algorithm: Step through potential selling days. If the price
// is lower than our current buying day, switch to a new buying
// day. If the price diff between buying and selling days is
// greater than our current best, it's our new best.
let b... | [
"function solution_1 (prices) {\n let buy1 = buy2 = -Infinity; // these store your best net gain after executing the first buy and the second buy, respectively\n let sell1 = sell2 = 0; // these store your best net gain after executing the first sell and the second sell, respect... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes a link by type | function deleteLinkByKind(linkKind) {
return spPost(SPInstance(this, "deleteLinkByKind"), request_builders_body({ linkKind }));
} | [
"static async remove(id, item_type, link, ownershipCheck) {\n // Compose the query to find the comment.\n const query = {\n id,\n 'tags.tag.name': {\n $eq: link.tag.name,\n },\n };\n\n // If ownership verification is required, ensure that the person that is\n // assigning the ta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes a given Leave | async function Delete(id, leave) {
const Leave = await getDB();
let result = null;
try {
if (Util.IsEqual(id, leave._id))
if (Util.IsObjectId(id))
if (await LeaveExists(id))
result = await Leave.findByIdAndDelete(id, {
useFindAndModify: false,
});
else th... | [
"async delete ({ params, response }) {\n const event = await Event.find(params.id)\n\n await event.delete()\n\n return response.status(200).json({\n message: 'Event deleted successfully.'\n })\n }",
"static async deleteCourseCollege(collegeCode,courseCode){\n await pool.query('DELETE FRO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change handlers Toggles stretch tabs class and updates inkbar when tab stretching changes | function handleStretchTabs (stretchTabs) {
angular.element(elements.wrapper).toggleClass('md-stretch-tabs', shouldStretchTabs());
updateInkBarStyles();
} | [
"function initTabbar() {\n _debug();\n if ($('#tabbar').length) {\n _debug(' #tabbar exists');\n\n // Find current class or 1st page in #jqt & the last stylesheet\n var firstPageID = '#' + ($('#jqt > .current').length === 0 ? $('#jqt > *:first') : $('#jqt > .current:first')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a random trash tile. | function randomTrashTile() {
const illegalTiles = [0,1,3,5,14,15,17,28,31,39,40,43,44,45,48,53,54,104,131];
let result;
do {
result = 0|Math.random()*140;
}
while (illegalTiles.includes(result));
return result;
} | [
"function getRandomTile(){\n\treturn allTiles[ Math.floor( Math.random() * allTiles.length ) ].id;\n}",
"randomInitTile() {\n let randX = this.getRandomInt()\n let randY = this.getRandomInt()\n while (this.isOccupied(randX, randY)) {\n randX = this.getRandomInt();\n rand... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set custom getter for book image using URL | get(){
const image = this.getDataValue('image');
return "/img/"+image;
} | [
"get imageURL() {\n this._logger.debug(\"imageURL[get]\");\n return this._imageURL;\n }",
"get imageUrl() {\n return this._imageUrl\n }",
"set imageURL(aValue) {\n this._logger.debug(\"imageURL[set]\");\n this._imageURL = aValue;\n }",
"addImage(url) {\n \n }",
"set imageUR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates if minute or hour indicator is in the place where user clicked. If true, enables to change position of corresponding indicator. | function onMouseDownEvent()
{
let clickedTime = calculateClickedTime();
let minute = (30 * clock.indicators.m.angle) / (Math.PI + 15);
let hour = (6 * clock.indicators.h.angle) / (Math.PI + 3);
let threshold = 0.25;
if((clickedTime[0] < minute + threshold) && (clickedTime[0] > minute - threshold))
{
c... | [
"isElementShowing(e) {\n return this.props.time >= e.start_time &&\n this.props.time <= e.end_time;\n }",
"function checkPosition() {\n\tconst heart = document.getElementById(\"profile-heart\");\n\tconst cross = document.getElementById(\"profile-cross\");\n\tconst qmark = document.getElement... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Accepts a new TCP connection and yields all HTTP requests that arrive on it. When a connection is accepted, it also creates a new iterator of the same kind and adds it to the request multiplexer so that another TCP connection can be accepted. | async *acceptConnAndIterateHttpRequests(mux) {
if (this.closing)
return;
// Wait for a new connection.
const { value, done } = await this.listener.next();
if (done)
return;
const conn = value;
// Try to accept anothe... | [
"async *iterateHttpRequests(conn) {\n const bufr = new bufio_ts_2.BufReader(conn);\n const w = new bufio_ts_2.BufWriter(conn);\n let req;\n let err;\n while (!this.closing) {\n try {\n req = await readRequest(conn, bufr);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates two new LOD geometries and creates meshes for all levels of detail. | generate() {
let level, scale, geometry, material;
// Clean up.
if(this.previousResolution !== this.resolution) {
// Make new geoemtries and delete the old ones.
if(this.centerGeometry !== null) { this.centerGeometry.dispose(); }
if(this.surroundingGeometry !== null) { this.surroundingGeometry.d... | [
"function createMeshes() {\r\n mesh_lantern1 = createLantern ();\r\n scene.add(mesh_lantern1);\r\n\r\n mesh_lantern2 = mesh_lantern1.clone();\r\n mesh_lantern2.translateX(15.0);\r\n scene.add(mesh_lantern2);\r\n\r\n mesh_lantern3 = mesh_lantern1.clone();\r\n mesh_lantern3.translateZ(-20.0);\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setter for fieldValue (modifies element text on change) | set fieldValue(value){
this.element.innerHTML = value;
} | [
"updateValue() {\n [...this.template.querySelectorAll('lightning-input')].forEach(\n (element) => {\n element.value = this._value;\n }\n );\n\n this._updateProxyInputAttributes('value');\n\n /**\n * @event\n * @name change\n * ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |