query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Retrieve the feature's parent in the FM if it exists | function getParent(feature, fm) {
for (var i=0; i < fm.edges.length; i++) {
var edge = fm.edges[i];
if (edge.source == feature) {
return edge.target;
}
}
return null;
} | [
"get parent() {\n return tag.configure(ContentType(this, \"parent\"), \"ct.parent\");\n }",
"getParentProduct() {\n return this.parent;\n }",
"get parentFolder() {\n return Folder(this, \"parentFolder\");\n }",
"get parent() {\n return new Path(this.parentPath)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Every so often we scan through our users and force log everyone out who has not found a share in the last ~16.666666... hours. | function logOutInactive() {
console.log("logging out inactive")
for(user of users) {
if(Date.now() - users[user].lastFoundTime > 6000000) {
Users.findOneAndUpdate({
username: new RegExp('^' + users[user].username + '$','i')
}, {
$set: {
loginCookies: []
... | [
"function removeDeadUsers() {\n users = users.filter(function(user) {\n return Math.round((Date.now()-user.time)) < 20000;});\n console.log(\"Removed dead users\");\n}",
"function userAddedToBagWithinLast20MinutesBeforeLinkshareReferralArrival() {\n for (var i = 0; i < splitCook... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adding the study Table | function addStudyToTable(studyItem) {
var study = null;
showSideBarEmptyStates(true);
//check if item is assignedstudy or just study
if (checkNested(studyItem, "elasticId")) {
study = studyItem.study;
} else {
study = studyItem;
}
var c... | [
"function addTable(r, c) {\n var b = idoc.body || idoc.find('body')[0];\n $(b).html(table.html(r,c))\n }",
"function initTable(num){\n\n // Filter dataset by OTU id\n var filteredDate=dataset.metadata.filter(sample=>sample.id.toString()===num.toString())[0];\n\n\n // Create an li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filtering by one property: create a variable to hold the members array of data back in App.js, we're passing the prop of search to the Table component, and calling on it here by 'this.props.search' to get the value of the search input if the search input is empty, then the original members array will be displayed if th... | render() {
let char = members;
if (this.props.search === "") {
char = members;
}
else {
char = members.filter((c) => {
console.log(this.props.search);
return c.color.includes(this.props.search);
});
}
// Sorting by ID
const sortedIDs = char.sort((a, b) => ... | [
"function renderFilteredCards(e) {\n e.preventDefault()\n const searchQuery = e.target.value\n const filteredPokemon = POKEMON.filter(singlePokemon => singlePokemon.name.includes(searchQuery))\n renderManyPokemonCards(filteredPokemon)\n}",
"function App() {\n const [filter, setFilter] = useState()\n const [... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Who has the most titles? | function mostTitle(characters) {
let count = 0;
let name = [];
let nameWithSameNumbers = [];
characters.forEach(function (array) {
if (array.titles.length > count) {
count = array.titles.length;
name = array.name;
}
});
characters.forEach(function (array) ... | [
"function mostProlificAuthor(authors) {\n // Your code goes here\n\n let x = bookCountsByAuthor(authors);\n // console.log(x);\n\n const compare = (a, b) => {\n let comparison = 0;\n if (a.bookCount > b.bookCount) {\n comparison = 1;\n } else if (a.bookCount < b.bookCount) {\n comparison = -1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fires when seekbar is changed | function ChangeTheTime() {
audio.currentTime = seekbar.value;
} | [
"updateSeekBar(seekBar, seekBarValue) {\n seekBar.value = seekBarValue;\n \n }",
"function volumeBarClickedDown(changeVolume) {\n volumeBarInterval = setInterval(changeVolume, 100);\n}",
"seek(position) {\r\n if (this.isSeeking)\r\n this.progress = position * 100;\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=> boolean isStringType(DOMString contentType); | function isStringType(contentType){
var stringTypes = ['text/plain', 'application/javascript', 'text/html', 'text/css', 'application/json',
'application/ld+json','application/manifest+json', 'image/svg+xml'];
return stringTypes.includes(contentType);
} | [
"function isStringType(node) {\n const objectType = typeChecker.getTypeAtLocation(service.esTreeNodeToTSNodeMap.get(node));\n return (0, util_1.getTypeName)(typeChecker, objectType) === 'string';\n }",
"function isStringType(columnname, metadata){\n\t\n\t\tvar retVal = false;\n\t\tfor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get analytics for the user account. If ad_account_id is set, get user analytics associated with the specified Ad Account. | async get(ad_account_id) {
if (ad_account_id) {
this.attrs.ad_account_id = ad_account_id;
}
try {
return await this.api_object.request_data(`\
/v5/user_account/analytics?\
${this.uri_attributes('metric_types', false)}`);
} finally {
delete this.attrs.ad_account_id;
}
} | [
"async get_ad_account(ad_account_id) {\n return await this.request(`/v5/ad_accounts/${ad_account_id}/analytics?`);\n }",
"async get_ad(ad_account_id, _campaign_id, _ad_group_id, ad_id) {\n return await this.request(`\\\n/v5/ad_accounts/${ad_account_id}/ads/analytics\\\n?ad_ids=${ad_id}&`);\n }",
"ListOf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3. create a function that returns only the extension filename of a string, or false | function fileExtension(str){
// code goes here
var result = "" || false;
function each(collection, callback){
if(typeof collection === "string"){
for(var i = 0; i < collection.length; i++){
callback(collection[i], i, collection);
}
}
}
... | [
"function has_extension(e) {\n\t//if(process.env.DEBUG_MVC) {\n\t//\tdebug.log('has_extension(', e, ')');\n\t//}\n\tdebug.assert(e).is('string');\n\treturn function has_extension_2(p) {\n\t\treturn PATH.extname(p) === e;\n\t};\n}",
"function getExt(filename) {\n if (!filename) return \"\";\n var par... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the sign bit of the given buffer. | function getSign(buffer) {
return buffer[buffer.length - 1] >>> 7;
} | [
"function signTest() {\n var signFlag1 = (numbers[0].indexOf('-') !== -1); //true if there, false if not there\n var signFlag2 = (numbers[1].indexOf('-') !== -1);\n \n //If numerator and denominator are both negative, or both positive, return empty string\n if (signFlag1 === true && signFlag2 === tru... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the current locked by user | async getLockedByUser() {
const u = await spGet(File(this, "lockedByUser"));
if (u["odata.null"] === true) {
return null;
}
else {
return u;
}
} | [
"get locked() { return false }",
"get locker() {\n return this._locker || (this._locker = new InMemoryLock())\n }",
"function lockOut() {\n return authVault.lock();\n }",
"visitUser_lock_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"get user() {\n this._logger.debug(\"user[get]\");\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends a request to the client for keys for a state object. | stateKeysRequest (path) {
this.send('state.keys.request', { path })
} | [
"stateValuesRequest (path) {\n this.send('state.values.request', { path })\n }",
"function getMapState() {\n // Call a 'local' CGI script that outputs data in JSON format\n var query = \"out.json\";\n log(\"Debug: getMapState: Calling cgi script \\\"\" + query + \"\\\"\" );\n var doreq = MochiKit.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============= = Flag flap = ============= | function flagFlap () {
var x = 1;
var max = 2;
setInterval(function () {
$("#flag-" + x).fadeOut(200);
x++;
if (x > max) {
x = 1;
};
$("#flag-" + x).fadeIn(200);
},0);
} | [
"flag(tile) {\n\n\t\tthis.actions++;\n\t\ttile.toggleFlag();\n\n }",
"Reveal() {\n if (!(this.Revealed || this.Flagged)) {\n if (this.Mine) {\n return true;\n } else {\n this.Revealed = true;\n return false;\n }\n }\n return false;\n }",
"function flags(evt) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saves html report to cwd reports/html_reporty directory | function saveHtmlResults(html){
let templateDir = path.join(path.resolve(__dirname,'reports','html_template'));
App.Utils.Log.msg(['Saving html report to ', htmlReportingDirectory],true);
fs.copySync(templateDir,htmlReportingDirectory);
fs.outputFileSync(path.join(htmlReportingDirectory,'index.html'),h... | [
"generate() {\n if (!fs.existsSync(this.outputPath)) {\n fs.mkdirSync(this.outputPath);\n }\n\n fs.writeFile(`${ this.outputPath }/index.html`, this.report, (err) => {\n if (err) {\n return logger.error(err);\n }\n });\n }",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Numbersucc() > Number Returns the successor of the current Number, as defined by current + 1. Used to make numbers compatible with ObjectRange. | function succ() {
return this + 1;
} | [
"addNumToBack(num) {\n if (this.isNumAllowed(num)) this.numList.enqueue(num);\n // return this.numList[this.numList.length - 1];\n return this.numList.tail.value;\n }",
"function nextNumber(incomingNumber){\n if(isLastNumber(incomingNumber)){\n activeNumber = cohort[0].number;\n return activeNumb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Migrate descriptors from direct reference of local storage to settings, which may be server or local persistence | migrateDescriptors_() {
var str = window.localStorage.getItem(this.getDescriptorKey());
if (str) {
var list = /** @type {Array} */ (JSON.parse(str));
Settings.getInstance().set(this.getDescriptorKey(), list);
window.localStorage.removeItem(this.getDescriptorKey());
}
} | [
"persistDescriptors_() {\n var list = [];\n var aliasesSeen = {};\n var now = Date.now();\n var threshold = now - 30 * 24 * 60 * 60 * 1000;\n\n for (var key in this.descriptors_) {\n if (!(key in aliasesSeen)) {\n var d = this.descriptors_[key];\n if (!d) {\n // descriptor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this filter ensures that the custom tags dont have contenteditable put on them by tinymce | function contentEditableFilter (nodes) {
nodes.forEach((node) => {
if (!!node.attr('contenteditable')) {
node.attr('contenteditable', null)
node.firstChild.unwrap()
}
})
} | [
"removeNonEnTags(){\r\n\t\tif (this.data.hasOwnProperty(\"tags\")){\r\n\t\t\tvar tagsStr = \"\";\r\n\t\t\tvar tagsArray = this.data.tags.tags;\r\n\t\t\tfor (var i = 0; i < tagsArray.length; i++){\r\n\t\t\t\tif(tagsArray[i].hasOwnProperty(\"translation\")){\r\n\t\t\t\t\tif(tagsArray[i].translation.hasOwnProperty(\"e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Question 4 Why does the alert show "Jack" first and then undefined? | function identity() {
var name = 'Jack';
alert(name);
return
name
} | [
"function exerciseFour() {\n const name = prompt('What is your name?');\n const lowercaseName = name.toLowerCase();\n const uppercaseName = name.toUpperCase();\n console.log(lowercaseName, uppercaseName);\n }",
"function sayName() {\r\n console.log(splitName[0]);\r\n}",
"function askForName() {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Report nonstrict (nonLaTeXcompatible) input. Can safely not be called if `this.strict` is false in JavaScript. | reportNonstrict(errorCode, errorMsg, token) {
let strict = this.strict;
if (typeof strict === "function") {
// Allow return value of strict function to be boolean or string
// (or null/undefined, meaning no further processing).
strict = strict(errorCode, errorMsg, token);
... | [
"useStrictBehavior(errorCode, errorMsg, token) {\n let strict = this.strict;\n\n if (typeof strict === \"function\") {\n // Allow return value of strict function to be boolean or string\n // (or null/undefined, meaning no further processing).\n // But catch any exceptions th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
after student selected get their chat | get_selected_student_chat(student) {
this.spinner = true;
if (this.selected_student) {
this.live_session_chat_service.leave({
room_id: this.selected_student.student_id + this.selected_student.batch_id,
});
}
this.selected_student = student;
... | [
"function showchatUserSelect(){\n if(userChat==null)\n {return;}\n /*eventAddChat(message);*/\n $(\".inyect-commit\").html(\"\");\n $(\"#bienvenida\").hide();\n listOfChat.forEach(function(message){\n if((message.name.id==userChat.id && message.userSend.id==JSON.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load Consumer Addresses and dispatch action with the results. | function loadConsumerAddresses(recipientId, consumer) {
if (consumer == null)
return;
return function (dispatch) {
return new parse_1.default.Query(ParseModels_1.ConsumerAddress).equalTo('consumer', consumer).find().then(function (addresses) {
dispatch({ type: types.CONSUMER_ADDRESSE... | [
"function loadAddresses() {\n // Make an Ajax GET call to the 'addresses' endpoint in our RESTcontroller\n // upon success we have a function takes in a data array and checks status\n $.ajax({\n url: \"addresses\"\n }).success(function (data, status) {\n fillAddressTable(data, status);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
all five solo missions at last ping function! Create AND draw Missions Interface | function createMissions() {
rx = width * 0.5;
ry = height * 0.5;
rw = 700;
rh = 750;
//Frame, title and buttons of Mission Interface;
push();
missionFrame = new OnScreenFrame(
rx,
ry,
rw,
rh,
false,
Secondary,
15,
ImageMissionInterfaceFrame
);
singleMissionsBtn = new ... | [
"function drawMultiplayerMissions() {\n rx = width * 0.5;\n ry = height * 0.5;\n rw = 700;\n rh = 750;\n\n if (mmissionEnable === true) {\n missionFrame.drawScreen();\n missionFrame.drawExtendedFrame();\n singleMissionsBtn.drawButton();\n multiMissionsBtn.drawButton();\n missionExitBtn.drawExitB... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Triggers scrollx & scrolly events on scroll (dragging with mouse, moving with scrollbars, etc.). | function onScroll(e) {
// this.scrollLeft/Top is faster then $(this).scrollLeft/Top()
var newLeft = this.scrollLeft;
var newTop = this.scrollTop;
var xVector = newLeft - e.data.left;
var yVector = newTop - e.data.top;
if (xVector)
$(this).trigger('scrollx', xVector);
if (yVector)
$(this).trigger(... | [
"_listenToScrollEvents() {\n this._viewportScrollSubscription = this._dragDropRegistry\n .scrolled(this._getShadowRoot())\n .subscribe(event => {\n if (this.isDragging()) {\n const scrollDifference = this._parentPositions.handleScroll(event);\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Close the TCP sockets. | close() {
// Close all live sockets
this.sockets.forEach(socket => {
if (!socket.destroyed) socket.end();
});
this.sockets.clear();
} | [
"close() {\n this[_socket].close();\n\n if (this[_timeout] !== null) {\n clearTimeout(this[_timeout]);\n }\n }",
"function onSocketClose() {\n this[owner_symbol].destroy();\n}",
"close(callback) {\r\n debugLog(\"ServerSecureChannelLayer#close\");\r\n // close socket\r\n this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If Ok and f(this.value) is also Ok, return Ok(f(this.value)). Otherwise, return Err(this.value) | andThen(f) {
if(this.isOk) {
return f(this.value);
} else {
return this;
}
} | [
"function okDo(f) {\r\n return function (result) {\r\n if (isOk(result)) {\r\n f(result.ok);\r\n }\r\n return result;\r\n };\r\n}",
"function firstOk(results) {\r\n return results.find(isOk) || error(null);\r\n}",
"async promiseAndThen(p, f) {\n const r = await p;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set note button callback REBENITSCH: ACTION | function set_note_button_callback() {
songList.name = song_title_box.value;
if ( !(songList.notes.length == 0) ) {
var n = note_production_label.note;
alert(songList.notes[songList.length - 1]);
commandStack.execute(new SetNoteCommand(new Note(n.pitch, n.length),
... | [
"function clickonnote(){\r\n\t\t$(\".noteheader\").click(function(){\r\n\t\t\tif(!editMode){\r\n\t\t\t\t//update activenote variable to id of note\r\n\t\t\t\tactivenote = $(this).attr(\"id\");\r\n\t\t\t\t// fill text area\r\n\r\n\t\t\t\t$(\"textarea\").val($(this).find(\".text\").text());\r\n\t\t\t\tshowHide([\"#no... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set event handlers for token | function setTokenHandlers(token){
// Handle clicking on exit button
$(token).find('button.exit').on('click', function(event){
// Renumber other token names
let tokenNo = $(token).prevAll('.token').length;
$(token).nextAll('.token').each(function(){
... | [
"#registerEventListeners() {\n this.#addOnFocusEventListener();\n this.#addOnHelpIconClickEventListener();\n }",
"setupServerEventHandlers() {\n const self = this;\n\n this.server.onTitleScreenUpdates(function(info) {\n self.enableSelectingGuesser(!info['guess_disable']);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply the damage percentage to the weapons | _setDamagePercentage(percentage) {
this.primaryWeapon.setDamagePercentage(percentage)
this.secondaryWeapon.setDamagePercentage(percentage)
} | [
"handleDefence(weaponDamage) {\n // When player chooses to defend themselfves,\n // they get hit at half strength of opponnent's weapon\n this.health = this.health - (weaponDamage / 2);\n }",
"boostDamage(duration, percentage) {\n if (!this._isActive)\n return\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a legend in the specified element with graph information | function createLegend(choiceContainer, infos) {
// Sort series by name
var keys = [];
$.each(infos.data.result.series, function(index, series){
keys.push(series.label);
});
keys.sort(sortAlphaCaseless);
// Create list of series with support of activation/deactivation
$.each(keys, fu... | [
"function drawLegend() {\n var legend = $(\"#legend\");\n legend.empty();\n\n var legendContainer = $(\"<div>\");\n legendContainer.addClass(\"legendContainer\");\n\n // Nur die Labels, die wir auch anzeigen!\n for(var lbl of usedLabels.entries()) {\n var catId = lbl[0];\n var catego... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function create the center ( Three.js vector3 ) of all country, and add the center to "basicCountryData" object | function createCountryCenter () {
var rad = 100;
for ( var s in basicCountryData ) {
var country = basicCountryData[ s ];
var lon = country.lon - 90;
var lat = country.lat;
var phi = Math.PI / 2 - lat * Math.PI / 180 - Math.PI * 0.01;
var ... | [
"static center(scene, camera, controls, axis, caf, inverse) {\n let BbMaxx = -Infinity;\n let BbMaxy = -Infinity;\n let BbMaxz = -Infinity;\n let BbMinx = Infinity;\n let BbMiny = Infinity;\n let BbMinz = Infinity;\n for (let i = 0; i < scene.children.length; i++) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UTILITY FUNCTION: GIVEN A PASSWORD ARRAY, VERIFY THAT IS DOES NOT CONTAIN ANY OF THE FORBIDDEN LETTERS GIVEN IN CONSTANTS | function validateForbiddenChar(password) {
for (const c of password) {
if (FORBIDDEN_CHAR.has(c)) return false;
}
return true;
} | [
"function checkSafePassword()\n{\n if (this.pass.length < 7) notSafe();\n var passwordArray = pass.split(\"\");\n var containBigLetter = false;\n var containSmallLetter = false;\n var containNumber = false;\n for(var i = 0; i<this.pass.length; i++)\n {\n if(passwordArray[i] >= 'A' && pas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
4. Create a function called changeMovie Your function should take two parameters. The first parameter should be an index, and the second should be the name of the movie to add It should add the new movie name to the movieQueue array at the given index. Finally it should return the movie name it just added | function changeMovie(index , movie){
movieQueue[index]=movie;
return movie;
} | [
"function addMovieToFront(movie){\n movieQueue.unshift(movie);\n return movie;\n }",
"function addMovieToEnd(movie){\n movieQueue.push(movie);\n return movie;\n }",
"function getMovie(getMovie) {\n if (getMovie < movieQueue.length) {\n return movieQueue[getMovie];\n }\n else {\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dismisses the modal with an optional `reason` value. The `NgbModalRef.result` promise will be rejected with the provided value. | dismiss(reason) {
if (this._windowCmptRef) {
if (!this._beforeDismiss) {
this._dismiss(reason);
}
else {
const dismiss = this._beforeDismiss();
if (dismiss && dismiss.then) {
dismiss.then(result => {
... | [
"attemptDismiss() {\n\t\tif(this.state.currentModal.props.dismissible) this.state.currentModal.props.onDismiss();\n\t}",
"cancel () {\n this.close();\n this._reject(new Error('User closed dialog.'));\n }",
"dismiss(data, role, id) {\r\n return dismissOverlay(document, data, r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find the mesh object that the vertex/edge/face belongs to (if any) should be declared with an InVS/InFS/InES statement in substance, assuming a valid substance program with parg order preserved | function findMesh(name, json, objs) {
// first find the name of the mesh, then look it up in the objects we made
// TODO: write a "find" function
let meshNames = json.constraints.predicates
.filter(o => isInPred(o.pname) && name === o.pargs[0].Left)
.map(o => o.pargs[1].Left);
if (meshNames.l... | [
"contains(vertex) {\n\n // Throw an error if vertex is not a Vertex\n // Validate({ vertex, Vertex });\n\n // Find the vertex within the face\n const match = this.vertices.find(v => v.toString() == JSON.stringify(vertex));\n\n // Return true if the vertex is in the face\n return Boolean(match);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getting active mainPin location | function getActivePinLocation(evt) {
formAddressField.value = evt.clientX + (MAIN_PIN_WIDTH / 2) + ' , ' + (evt.clientY + MAIN_PIN_HEIGHT);
} | [
"function findLocation() {\n\tuserMap.locate({setView: true, maxZoom: 5});\n}",
"function getPinInfo() {\t\t\n\treturn cachedPinInfo;\n}",
"function getLocationName() {}",
"setActiveLocation(location, showDataEntry) {\n let countryInfo = this.queryFeatures([location.lng, location.lat], this.refs.country.le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
internal methods = helper for when the first indexVault() fails emit an error, and (if it's a timeout) keep looking for the vault | async function onFailInitialIndex (e, db, vault, {watch}) {
if (e.name === 'TimeoutError') {
debug('Indexer.onFailInitialIndex starting retry loop', vault.url)
db.emit('source-missing', vault.url)
while (true) {
veryDebug('Indexer.onFailInitialIndex attempting load', vault.url)
// try again ev... | [
"initializeIndex() {\n if (NylasEnv.config.get('threadSearchIndexVersion') !== INDEX_VERSION) {\n return this.clearIndex()\n .then(() => this.buildIndex(this.accountIds))\n }\n\n return this.buildIndex(this.accountIds);\n }",
"function lockOut() {\n return authVault.lock();\n }",
"emptyS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the department with matching name; throws error if wrong type/number of arguments were provided. | async function getDeptByName(deptName) {
//validates number of arguments
if (arguments.length != 1) {
throw new Error("Wrong number of arguments");
}
//validates arguments type
if (!deptName || typeof deptName == "undefined" || typeof deptName != "string" || deptName.length == 0) {
t... | [
"function getDepartmentId(departments, departmentName) {\n for (let i=0; i<departments.length; i++) {\n if (departments[i].name === departmentName) {\n return departments[i].id;\n };\n };\n }",
"function toDepartmentCode(name) {\n var name = trim(name).toUpperCase();\n for (v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
scale vector xs by scalar f. | function scale(f, xs) {
return xs.map(x => f * x);
} | [
"scale (scalar = 1)\n {\n return new Vector(this.x * scalar, this.y * scalar);\n }",
"static mxScale(it,s) { \r\n\t\tvar res = new mx4(); \t\t\r\n\t\tfor (var i=0; i<16; ++i) { res.M[i] = it.M[i] *s; }\r\n\t\treturn res; \r\n\t}",
"function createScaleFunction(factorArgument) {\n return function(v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Modul: Subtraktion a b | Test: ausgabe(subtrahieren(2.0,1.1)); ausgabe(subtrahieren(2,10)); ausgabe(subtrahieren(2,0)); | function subtrahieren(a,b) {
return a - b;
} | [
"function subb(a, b) {\n return b - a;\n}",
"static vSub(a,b) { return newVec(a.x-b.x,a.y-b.y,a.z-b.z); }",
"function polySub(a, b) {\r\n for (var i = 0; i < paramsN; i++) {\r\n a[i] = a[i] - b[i];\r\n }\r\n return a;\r\n}",
"function subNumbers(num1, num2){\n\tlet product = num1 - num2;\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the array of receivers | function updateReceivers(sample) {
for(var cRadio = 0;
cRadio < sample[$scope.transmitterId].radioDecodings.length;
cRadio++) {
var receiverTemp = sample[$scope.transmitterId].radioDecodings[cRadio].identifier.value;
if(!(receiverTemp in $scope.receivers)) {
... | [
"function updateTransmitters(sample) {\n for(var transmitterTemp in sample) {\n if(!(transmitterTemp in $scope.transmitters) && ($scope.numTransmitters < $scope.maxNumberOfTransmitters)) {\n $scope.transmitters[transmitterTemp]; // Adding new transmitters as they come.\n $scope... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
retrieves all events from indexedDB and displays then on map | function getAllEvents() {
if (dbPromise) {
dbPromise.then(function (db) {
var transaction = db.transaction('EVENT_OS', "readonly");
var store = transaction.objectStore('EVENT_OS');
var request = store.getAll();
return request;
}).then(function (request... | [
"function getEventSearch(eventName) {\n if (dbPromise) {\n dbPromise.then(function (db) {\n var transaction = db.transaction('EVENT_OS', \"readonly\");\n var store = transaction.objectStore('EVENT_OS');\n var index = store.index('title');\n var request = index.g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the width and position of the gap in the outline. Only relevant for the outline appearance. | updateOutlineGap() {
const labelEl = this._label ? this._label.nativeElement : null;
if (this.appearance !== 'outline' || !labelEl || !labelEl.children.length ||
!labelEl.textContent.trim()) {
return;
}
if (!this._platform.isBrowser) {
// getBoundingCl... | [
"ensureLineGaps(current) {\n let gaps = [];\n // This won't work at all in predominantly right-to-left text.\n if (this.heightOracle.direction != Direction.LTR)\n return gaps;\n this.heightMap.forEachLine(this.viewport.from, this.viewport.to, this.state.doc, 0, 0, li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
deletes last row from table | function removeLastRow() {
let rows = $('#table tr');
if (rows.length > 1) {
rows.last().remove();
}
rowIndex--;
} | [
"deleteRow() {\n let table = this.getParent();\n if (table !== null) {\n let rowIndex = table.getContentRowIndex(this);\n let contentRows = __WEBPACK_IMPORTED_MODULE_7__utils__[\"a\" /* convertInputToNumber */](table.getValue('contentRows'));\n if (rowIndex !== -1 && c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Warmups Write a function called squareNumericValues that takes an object as a parameter and returns an object with all of the numeric values in the object squared psuedocode write a function named squareumericValues input will be an object function will identify numeric keys in the object function will square numeric k... | function squareNumericValues(object1) {
var squared = [];
for (var x in object1) {
if (typeof object1[x] === 'number') {
squared.push(Math.pow(object1[x], 2));
}
else squared.push(object1[x]);
}
return squared;
} | [
"function checkFrequecySquare(arr,sqareArr){\n const obj = {};\n const obj2 = {};\n for(ele of arr){\n let square = ele*ele;\n obj[square] = obj[square]||0\n }\n \n for(ele of sqareArr){\n obj2[ele] = obj2[ele]||0\n }\n console.log(\"obj>>>\",obj)\n console.log(\"obj2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Registers the gamelogs/ route on a given Express app. | function registerRouteGamelogs(app) {
const lobby = server_1.Lobby.getInstance();
/**
* @api {get} /gamelogs Gamelogs
* @apiName Get Gamelogs
* @apiGroup API
* @apiDescription Gets a list of gamelog ids (filenames) that are
* available to get.
*
* @apiSuccessExample {json} Gam... | [
"mountOnto(expressApp) {\n this.routes.forEach(route => {\n const method = route.method.toLowerCase();\n const handler = makeExpressHandler(this.appId, route.handler);\n expressApp[method].call(expressApp, route.path, handler);\n });\n return expressApp;\n }",
"function setupRoutes(app) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParsertablespace_retention_clause. | visitTablespace_retention_clause(ctx) {
return this.visitChildren(ctx);
} | [
"visitLob_retention_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitPermanent_tablespace_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitPartitioning_storage_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitMv_log_purge_clause(ctx) {\n\t return this.visitChildre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculate the compare displays font size | calcCompFontSize(num) {
// num is the main display size in digits
const d1 = 4; // minimum display size
const d2 = 32; // maximum display size
const f1 = 10; // minimum font size
const f2 = 30; // maximum font size
let f = f1 + (d2 - num) * ((f2 - f1) / (d2 - d1));
f = f.toFixed(1);
f = ... | [
"function get_font_size(obj)\n {\n // Standard way:\n if(window.getComputedStyle)\n return window.getComputedStyle(obj, \"\").getPropertyValue(\"font-size\");\n\n // MS IE way:\n if(obj.currentStyle)\n return obj.currentStyle.fontSize;\n\n return \"16px\";\n }",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show the WYSIWYG buttons | function show_wysiwyg_button(cell) {
cell.element.find(".wysiwyg-toggle").show();
cell.element.find(".wysiwyg-done").show();
} | [
"function attach_buttons() {\n var all_cells = Jupyter.notebook.get_cells();\n $.each(all_cells, function(i, cell) {\n add_wysiwyg_button(cell);\n });\n }",
"function add_wysiwyg_button(cell) {\n if (cell.cell_type === \"markdown\" && cell.rendered) {\n // Get ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an instance of CacheManager and check if the internal implementation is of expected type | function createInstance(env, sExpectedImplementation) {
if (CacheManager._instance) {
CacheManager._instance._db.close();
CacheManager._instance = undefined;
}
CacheManager._bSupportedEnvironment = null;
// Act
return CacheManager._getInstance().then(function(cmImpl) {
// Assert
... | [
"async function createCacheInstance() {\n // TODO - accept configured caches through environment variables (or other?)\n return CacheInstance;\n}",
"isCachedInMemory(keypath) {\n // See if we have it already in the first level of cache\n var found = this.getFromMemory(keypath)\n\n if (found === undefin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
p : plot x : xPos y : yPos | constructor(p, x, y){
super("plot", x, y, "Hoe");
this.plot = p;
} | [
"function plot(can,ctx,x,y,xwidth,ywidth,options){\n\n}",
"function showMousePosition(x, y){\n if(!(x > canvasWidth || x < 0 || y > canvasHeight || y < 0)){\n mouseParagraph.html(\"x: \"+ Number.parseFloat(x).toFixed(0) + \" y: \" + Number.parseFloat(y).toFixed(0)); \n } else{\n mouseParagraph.html(\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
position object to FEN string returns false if the obj is not a valid position object | function objToFen (obj) {
if (!validPositionObject(obj)) return false
var fen = ''
var currentRow = 8
for (var i = 0; i < 8; i++) {
for (var j = 0; j < 8; j++) {
var square = COLUMNS[j] + currentRow
// piece exists
if (obj.hasOwnProperty(square)) {
fen = fen + ... | [
"function isValidPosition(position) {\n\t\t\treturn ((position[0] >= 0) && (position[1] >= 0) && (position[0] <= 4) && (position[1] <= 4));\t\n\t\t}",
"getDataString( unixtime, fromPosition ) {\n\n\t\t// home planet\n\t\tif ( this === Viewer.getViewer().homePlanet ) {\n\n\t\t\treturn this.name;\n\n\t\t}\n\n\t\tth... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[END pubsub_delete_topic] [START pubsub_list_subscriptions] | function listSubscriptions() {
// Lists all subscriptions in the current project
return pubsub.getSubscriptions().then(results => {
const subscriptions = results[0];
console.log('Subscriptions:');
subscriptions.forEach(subscription => console.log(subscription.name));
return subscriptions;
});
} | [
"function listTopicSubscriptions(topicName) {\n\n\t// References an existing topic, e.g. \"my-topic\"\n\tconst topic = pubsub.topic(topicName);\n\n\t// Lists all subscriptions for the topic\n\treturn topic.getSubscriptions().then(results => {\n\t\tconst subscriptions = results[0];\n\n\t\tconsole.log(`Subscriptions ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
assertS3 (options: Object) => Object | function assertS3(options) {
const s3 = options.s3;
if (!s3 || typeof s3 !== 'object') {
throw new TypeError('"s3" object must be provided');
}
S3_METHODS.forEach(method => {
if (typeof s3[method] !== 'function') {
throw new TypeError(`provided "s3" object missing "${method}" method`);
}
});
return optio... | [
"function uploadObjectToS3(params, typeOfFile, callback){\n\tvar bucketName = params.Bucket;\n\tvar keyName = params.Key;\n\t//Variable for Logging the messages to the file.\n\tvar logger = log.logger_rfq;\n\n\ts3.putObject(params, function(err, data) {\n\t\t if (err){\n\n\t\t\t resJson = {\t\n\t\t\t\t\t \"htt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Post: Returns the index of vertex in vertices. | IndexIs(vertices, vertex) {
let index = 0;
while (!(vertex == vertices[index])) index++;
return index;
} | [
"getVertexIndices() {\n throw new Error('getVertexIndices() not implemented.');\n }",
"get index() {\n\n // Check if the face is bound to a mesh and if not throw an error\n if (!this.mesh) throw new Error(`Cannot compute the index - the face is not bound to a Mesh`);\n\n // Return the index of th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert regions given by border into lists of cells. | function cells_of_regions(w, h, regions){
// Create an array of cells initialized with [-1].
var cells = new Array(w);
for(var x = 0; x < w; x++){
cells[x] = new Array(h);
for(var y = 0; y < h; y++){
cells[x][y] = -1;
}
}
function is_empty(x, y){
return cells[x][y] == -1;
}
// For ... | [
"_generateIssueCells() {\n var issueCells = [];\n var lanes = {};\n for (let i = 0; i < this.props.chart.issues.length; i++){\n let issue = this.props.chart.issues[i];\n let issueLane = issue.lane;\n let issueLaneKey = issueLane.toString();\n if (! _.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SystemJS Plugin Support Supports plugin syntax with "!" The plugin name is loaded as a module itself, and can override standard loader hooks for the plugin resource. See the plugin section of the systemjs readme. | function plugins(loader) {
if (typeof indexOf == 'undefined')
indexOf = Array.prototype.indexOf;
loader._extensions.push(plugins);
var loaderNormalize = loader.normalize;
loader.normalize = function(name, parentModuleName, parentAddress) {
var loader = this;
var parentName = parentModuleName;
... | [
"uses(){\r\n\t\tif( KonektiMain !== undefined ) this.plugin.load(arguments, KonektiMain)\r\n\t\telse this.plugin.load(arguments)\r\n\t}",
"async onPluginRegistered() {\r\n // noop\r\n }",
"function loadPlugin(name, options) {\n return require(resolvePlugin(name, options) || name);\n}",
"function in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a new ``bytes27`` type for %%v%%. | static bytes27(v) { return b(v, 27); } | [
"static bytes25(v) { return b(v, 25); }",
"static bytes(v) { return new Typed(_gaurd, \"bytes\", v); }",
"static bytes23(v) { return b(v, 23); }",
"static bytes26(v) { return b(v, 26); }",
"static bytes28(v) { return b(v, 28); }",
"static bytes29(v) { return b(v, 29); }",
"static bytes22(v) { return b(v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a value in milliseconds, for the given position in pixels and the given timescale, where tickSize corresponds to 1 second on a 1.0 timescale factor | function posToMs(x, timescale, tickSize)
{
// tickSize : 1000 * timescale = x : result
return parseInt(x * (1000 * timescale) / tickSize);
} | [
"function timeToSize(time, timescale, tickSize)\n{\n return ((time * tickSize) / 1000) / timescale;\n}",
"ticksPerSec () {\n const dt = this.ticks - this.startTick\n return dt === 0 ? 0 : Math.round(dt * 1000 / this.ms()) // avoid divide by 0\n }",
"function timeGetNoteDuration(frameCount, framerate) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Focuses the first selected chip in this chip listbox, or the first nondisabled chip when there are no selected chips. | focus() {
if (this.disabled) {
return;
}
const firstSelectedChip = this._getFirstSelectedChip();
if (firstSelectedChip && !firstSelectedChip.disabled) {
firstSelectedChip.focus();
}
else if (this._chips.length > 0) {
this._keyManager.se... | [
"focusFirstItem() {\n if (this.items.length === 0) {\n return;\n }\n\n this.items[0].focus();\n }",
"_focusActiveOption() {\n var _a;\n if (!this.useActiveDescendant) {\n (_a = this.listKeyManager.activeItem) === null || _a === void 0 ? void 0 : _a.focus();\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize page while loading the page based on page mode | function initPage(sMode) {
bindGrid();
setDefaultValues();
var sPageTitle = getPageTitle();
el("hdnPageTitle").value = sPageTitle;
el("lstBack").style.display = "none";
el("lstFirst").style.display = "none";
el("lstPrev").style.display = "none";
el("lstNext").style.display = "none";
... | [
"function initPage(){\r\n\t\t//add head class\r\n\t\t$(\"#headAssemblyLi\").addClass(\"active\");\r\n\t\t$(\"#leftNodeSelectLi\").addClass(\"active\");\r\n\t\tresetPage();\r\n\t\t$(\"#messageAlert, #messageLane\").hide();\r\n\t}",
"function showInitialPage(){\n\t// other initiations here\n\tformMessageReset();\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the correct tabindex for the option depending on disabled state. | _getTabIndex() {
return this.disabled ? '-1' : '0';
} | [
"_getTabIndex() {\n if (this.disabled) {\n return -1;\n }\n return this.useActiveDescendant || !this.listKeyManager.activeItem ? this.enabledTabIndex : -1;\n }",
"focusedTabIndex() {\n\t\tvar index = this.tabs.findIndex(function(tab) {\n\t\t\treturn tab === document.activeElemen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Download data as text file | function download(data) {
var el = document.createElement('a');
el.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(data, null, 4)));
el.setAttribute('download', 'weatherdata.txt');
el.style.display = 'none';
document.body.appendChild(el);
el.click();
documen... | [
"function downloadJSON() {\r\n\t// Save the data object as a string into a file\r\n\tsaveTextAsFile(2);\r\n}",
"function download() {\n\tvar currName = getId('song-name').value;\n\tvar fName = currName + '.json';\n\tvar json = JSON.stringify(getObjects(songObj, 'name', currName)[0]);\n\n\t// IE\n\tif (navigator.m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
finish selection and link terms | function endSelection(alignment) {
var relId = $(alignment)[0].relId;
$(alignment).find('.rel' + relId + 'a').val(selectionIndex($(alignment).find('#passage1')));
$(alignment).find('.rel' + relId).before('<span class=\'term rel' + relId + 'term\'>' + $(alignment).find('#passage1 #selection .w... | [
"function endSelection() {\n var typeId = $('.eventextraction')[0].typeId;\n\n // add terms in relation selection\n $('.ev' + typeId + 'a').val(selectionIndex($('.eventextraction').find('#passage')));\n $('#opinion' + typeId + ' .term').text($('#passage #selection .word').not(\":last\").append(\" \").en... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hides round 1 text and shows round 2 text Called by removeDoor | function hideR1showR2() {
// Set DOM selection variables based on state of the page
var r1, r2;
if (strategyPage) {
r1 = ".strategyR1";
r2 = ".strategyR2";
} else {
r1 = ".round1";
r2 = ".round2";
}
$text.detach();
$text.find(r1).addClass("hidden"); // Hide round 1 text
$text.find(r2).removeClass("hi... | [
"function toggleLocationText() {\n isOneBoxChecked(locationTypes)\n ? (locationsText.style.display = 'none')\n : (locationsText.style.display = 'block');\n}",
"function _hideHello() {\n Main.uiGroup.remove_actor(text);\n text = null;\n}",
"function showHideAuthor () {\n\n //chair description is hidd... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
toggles the quickpoll section | function pollsToggleQuickOptions()
{
$jq( '#tikiPollsQuickOptions' ).toggle();
} | [
"toggleWishlistPanel () {\n this.toggleWishlist()\n }",
"function toggleHelp () {\n if (domClass.contains(\"helpUnderlay\", \"help-isVisible\")) {\n closeHelp();\n } else {\n openHelp();\n }\n }",
"function togglePlaylistOptions() {\n\thasPermission(\"playli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finish the content processing by copying the supporting files into place and then passing each file off to the template engine for full processing. | function finishContent(siteIndex, siteConfig) {
// Copy supporting files.
fileHandlers.copyHandler(siteConfig);
// Loop through our pages, process each and copy its content into place.
siteIndex.content.forEach((file) => {
templates.processTemplate(file, siteIndex, siteConfig);
});
} | [
"async function all() {\n await meta.parseTemplateGlobAndWrite(include, output, options);\n console.log(\"FINISH\");\n}",
"templateFiles() {\n return Promise.map(this.files, file => {\n debug( 'templating file', file )\n return this.templateFile(file)\n .then( newdata => this.writeTemplateFi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CODING CHALLENGE 366 Create a function which takes a sentence and returns its abbreviation. Get all of the words over or equal to n characters in length and return the first letter of each, capitalised and overall returned as a single string. | function abbreviate(sentence, n = 4) {
return sentence.split(" ").map(x => x.length >= n ? x[0].toUpperCase() : "").join("");
} | [
"function capitalWords(word) {\n word = word.charAt(0).toUpperCase() + word.slice(1);\n return word;\n\n}",
"function reducer(sentence) {\nlet splittedArray = sentence.split(' ');\nlet newWord = splittedArray.reduce(function(initialValue, currentValue){\n\tif(splittedArray(currentValue).length === 3) {\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by Python3Parsercompound_stmt. | visitCompound_stmt(ctx) {
console.log("visitCompound_stmt");
if (ctx.if_stmt() !== null) {
return this.visit(ctx.if_stmt());
} else if (ctx.while_stmt() !== null) {
return this.visit(ctx.while_stmt());
} else if (ctx.for_stmt() !== null) {
retur... | [
"compoundStatement() {\n this.eat(tokens.BEGIN);\n\n const nodes = this.statementList();\n this.eat(tokens.END);\n\n const root = new Compound();\n for (const node of nodes) {\n root.children.push(node);\n }\n return root;\n }",
"visitCompound_expression(ctx) {\n\t return this.visitChi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create new ViewCompetitionCompetition instance | function ViewCompetitionCompetition(parameters) {
var announcement_url = parameters.announcement_url, directions = parameters.directions, end_date_pretty = parameters.end_date_pretty, icon = parameters.icon, id = parameters.id, is_ems = parameters.is_ems, name = parameters.name, registration_cta_configuration =... | [
"static new (projet_id)\n {\n return new Projet(projet_id)\n }",
"function createNoGamesView() {\n $.newChallenge.add(Ti.UI.createLabel({\n width : Ti.UI.FILL,\n text : Alloy.Globals.PHRASES.noGamesTxt+ \" \",\n left : 60,\n top : 40,\n font : Alloy.Globals.getFontCustom... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return the exit points of this pipe | exitPoints() {
// start pipe
if (this.type === 'start' || this.type === 'startWet') {
return [[this.column + 1, this.row]];
// straight pipe
} else if (this.type === 'straight' || this.type === 'straightWet') {
if (this.rotation === 0 || this.rotation === 2) {
return [[this.column - 1, this.row], [th... | [
"outputs() {\n return this.stack.outputs();\n }",
"exitExceptionTypeList(ctx) {\n\t}",
"getExits() {\n\t\t\tswitch (currentRoom) {\n\t\t\t// Returns True or False for Exits in order [North, East, South, West]\n\t\t\t\tcase 0:\n\t\t\t\t\treturn ['EAST', 'SOUTH'];\n\t\t\t\tcase 1:\n\t\t\t\t\treturn ['SO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Email me if any errors occur | function emailOnError(error) {
var transporter = nodemailer.createTransport(SMTP_CONFIG);
var mailOpts = {
from: EMAIL_FROM_NAME,
to: process.env.ERROR_EMAIL,
subject: 'Error occured when running Balance Update Script',
text : error
};
// Send email
transporter.sendMail(mailOpts, function (err) {
if (err... | [
"function errmail(e, opt, callback) {\r\n\t \tif(!e) {\r\n\t \t\te= new Error(\"a default error created.\")\r\n\t \t} \r\n\t \tif(!callback) callback=smt.ffn\r\n\t\t//opt.req.session.destroy\r\n\t\topt.mailPrefix= opt.mailPrefix || \"[Error]\"\r\n\t\topt.errSMS = opt.errSMS || 'problem with feed request: ' + e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Createas a room, get roomCode from getRoomName function | function createRoom() {
const roomCode = getRoomName();
if (serverState.rooms[roomCode] != null) { // If not null, create it again
return createRoom()
}
// Server state is a const with a rooms hash inside
// Set that rooms hash, to have a players array, a code and a turn number
serverState.rooms[roomC... | [
"function createRoom(){\n\t\t\tconsole.log(\"creating room\");\n\t\t\t$scope.rooms.$add({\n\t\t\t\tplayer1: userId,\n\t\t\t\tplayer2: 0,\n\t\t\t\tproblemCode: null,\n\t\t\t\tready1: false,\n\t\t\t\tready2: false,\n\t\t\t\tlang1: \"not set\",\n\t\t\t\tlang2: \"not set\", \n\t\t\t\ttime: 5,\n\t\t\t\tstatus: 0,\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When we become the leader we must recalculate the topology. | function becomeLeader(newTopology) {
if (turnCount === 0) {
Application.onFirstTurn(myPid);
}
newTopology.leader = myPid;
onTopologyUpdate(newTopology);
broadcastTopology(newTopology);
} | [
"function onTopologyUpdate(newTopology) {\n console.log('got topology ' + newTopology);\n // 1. Remember the topology.\n topology = newTopology;\n\n Utility.logTopology(topology, [FORWARD, BACKWARD]);\n\n // 2. Start checking my new neighbour.\n Utility.assert(topology[FORWARD][myPid] !== undefine... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a new Vector3 located for "amount" on the CatmullRom interpolation spline defined by the vectors "value1", "value2", "value3", "value4" | static CatmullRom(value1, value2, value3, value4, amount) {
const squared = amount * amount;
const cubed = amount * squared;
const x = 0.5 *
(2.0 * value2.x +
(-value1.x + value3.x) * amount +
(2.0 * value1.x - 5.0 * value2.x + 4.0 * value3... | [
"static CatmullRom(value1, value2, value3, value4, amount) {\n const squared = amount * amount;\n const cubed = amount * squared;\n const x = 0.5 *\n (2.0 * value2.x +\n (-value1.x + value3.x) * amount +\n (2.0 * value1.x - 5.0 * value2.x + 4... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
inform player the game is over and how many points they scored | function gameOver() {
update($question, "Game Over. You scored " + score + " points.");
} | [
"function winOrLose() {\n if (playerScore === randomNum) {\n winsCounter++;\n $(\"#wins\").html(\" \" + winsCounter);\n startGame();\n } else if (playerScore > randomNum) {\n lossCounter++;\n $(\"#losses\").html(\" \" + lossCounter);\n startGame();\n }\n }",
"function winLo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrap an Array into an iterable | function ArrayIterable(arr){
this.arr = arr
} | [
"function makeIterable(i) {\n function* iterate() {\n for (let r = i.next(); !r.done; r = i.next()) {\n yield r.value;\n }\n }\n return isIterable(i) ? i : iterate();\n}",
"map(fn, iterable) {\n return (function*() {\n for (let val of iterable) {\n yield fn(val);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SystemJS Global Format Supports metadata.deps metadata.init metadata.exports Also detects writes to the global object avoiding global collisions. See the SystemJS readme global support section for further information. | function global(loader) {
loader._extensions.push(global);
function readGlobalProperty(p, propValue) {
var pParts = p.split('.');
var value = propValue;
while (pParts.length)
value = value[pParts.shift()];
return value;
}
function createHelpers(loader) {
if (loader.has('@@global-hel... | [
"function generateGlobalConfig(gc) {\n trace(whoAmI,\"generateGlobalConfig\",true);\n\n utils.writeToFile(gc.configFiles.globalConfig.path, JSON.stringify(gc, null, 2), rw_r__r__);\n gc.configFiles.globalConfig.exists = true;\n\n trace(whoAmI,\"generateGlobalConfig\",false);\n}",
"function parseGlobal() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to get box by its row and col | function getBox(rows, cols){
return document.getElementById('box-'+rows+'-'+cols);
} | [
"function getBoxFromMouseLocation() {\n\tfor(box in boxes) {if(boxes[box].sprite.position.x <= mouseX) {\n\t\t\tif(boxes[box].sprite.position.x + boxes[box].sprite.width > mouseX) {\n\t\t\t\tif(boxes[box].sprite.position.y <= mouseY) {\n\t\t\t\t\tif(boxes[box].sprite.position.y + boxes[box].sprite.height > mouseY) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Class VersionBound Defines a boundary for a version range, which associates a Version object with a flag for whether it is an inclusive or exclusive boundary. | function VersionBound(version, inclusive)
{
this.version = version;
this.inclusive = inclusive;
} | [
"function VersionRange(lowerBound, upperBound)\n{\n\tthis.lowerBound = lowerBound;\n\tthis.upperBound = upperBound;\n}",
"function versionIsRange(version) {\n return version.includes('-');\n}",
"function BoundingBox2D(min, max) {\n if (typeof min === \"undefined\") { min = new Vapor.Vector2(); }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calls function cb for each object in the list | forEach(cb) {
for (var item = this._head; item; item = item.next) {
cb(item.data);
}
} | [
"function getAllItemsCallback(response){\n\t\n}",
"iterateVertices(callback) {\n this._vertices.forEach(callback);\n }",
"some(cb) {\n for (var item = this._head; item; item = item.next) {\n if (cb(item.data)) {\n return true;\n }\n }\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Centers the given window based on the parent window. If the parent window is null, then the window will be centered on the screen. | function aeCenterWindow(aWin, aParentWindow)
{
if (!aWin || aWin == null)
{
return;
}
var childW = aeGetWindowWidth(aWin);
var childH = aeGetWindowHeight(aWin);
var parentW = (aParentWindow && aParentWindow != null) ? aeGetWindowWidth(aParentWindow) : aWin.screen.width;
var parentH... | [
"centerInParent() {\n this._x = (100 - this._width) / 2;\n this._y = (100 - this._height) / 2;\n }",
"function ecs_createCenterWindow(_wid, _title, _width, _height) {\n\tvar _newwin = ecs_createWindow(_wid, _title, _width, _height);\n\t_newwin.center();\n\treturn _newwin;\n}",
"function centerP... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Example 19: currency conversor | function currencyConversor(value, currency) {
let upperCaseCurrency = `${currency}`.toUpperCase();
console.log('Last value update: July 10th 2021');
if (value != Number) {
console.log('The value typped is not a number');
return;
}
switch (upperCaseCurrency) {
case 'AMERICAN DOLLARS':
let a... | [
"function coinCombo(cents) {\n return 'TODO'\n}",
"function CurrencyHandler() {\n\t\tthis.type = 'currency';\n\t}",
"function normConv(rate, symbol) {\n curPrice = parseFloat(basePrice * rate).toFixed(2);\n curDaily = parseFloat(baseChange * rate).toFixed(2);\n $price.text(symbol + curPrice);\n $... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
boatInfo.fliporBounce (coll: Collision2D ARF 4.16.14 INPUT: Accepts a Collision2D object RETURN: TRUE if object flips; FALSE if object bounces FEEDBACK: >Poorly skilled clients should not be assigned to low stability boats >Low values for client health, skill and boat stability result in higher rate of flip | function flipOrBounce(coll: Collision2D)
{
//TODO: Add additional logic to chance percentages based on collision with different object types
//if (coll.gameObject.tag == "rock")
//SET variables
var results = calcSum("flip");
var sumTest =results.x; //the sum of all factors for the flip decision [0-30]
va... | [
"checkBallBounce() {\n var ballCoords = this.ball.getCoordinates();\n var sliderCoords = [this.player1.getCoordinates(), this.player2.getCoordinates()];\n\n // Checks if the ball has bounced with a slider\n this.checkBallSliderBounce(ballCoords, sliderCoords[0]);\n this.checkBallSliderBounce(ballCoor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrapper around pdf js to load a document async | function loadPdf(url){
console.log("Load pdf document: ", url);
// Asynchronously downloads PDF.
PDFJS.getDocument(url).then(function (pdfDoc_) {
pdfDoc = pdfDoc_;
console.log("PDF ", url, " is ready to be rendered");
console.log("Render page: ", DigiMag.currentBucketPag... | [
"function loadAndCachePdf(url, canvas, context){\n PDFJS.getDocument(url).then(function getPdfHelloWorld(_pdf) {\n debugger;\n pdf = _pdf;\n //Render all the pages on a single canvas\n for (var pNum = 1; pNum <= pdf.numPages; pNum++) {\n pdf.getPage(pNum).then(function getPage(page) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compare a title to each page object in response.path and return the matching page object's code number | function getPathCode(title) {
for (var i = 0; i < response.path.length; i++) {
if (response.path[i].title == title) {
return response.path[i].code;
}
}
} | [
"function pageExists( title )\n{\n if (FILE.file_exists( pagePath( title ) ) || isSpecial( title ) ){\n return true;\n }else{\n return false;\n }\n}",
"function baynote_getPageId() {\n\tvar tagId = document.getElementById(\"PageId\");\n\tif (!tagId){ return \"\";}\n\t\n\tvar value = tagId.a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
select game type set questions to 0 set score to 0 display first question run game type | function runGame(type) {
if (type === 'general') {
questions = questions_general;
} else if (type === 'trivia') {
questions = questions_trivia;
} else if (type === 'oscars') {
questions = questions_oscars;
} else if (type === 'quotes') {
questions = questions_quotes;
... | [
"function switchGameType(gameType) {\n\t\tvm.displayData = $filter('filter')(vm.data, { \"game\" : vm.currentGameType }, false);\n\t\tvm.gamesPlayedCount[vm.currentGameType] = vm.displayData.length; \n\t\tvm.currentPlayCount = vm.gamesPlayedCount[vm.currentGameType];\n\t}",
"function reset() {\n\t\t// go to next ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make sure we can & should like the video, then clickity click the button | attemptLike() {
this.waitForButtons(() => {
/*
If the video is already liked/disliked
or the user isn't subscribed to this channel,
then we shouldn't do anything.
*/
if (this.isVideoRated() || (this.options.like_... | [
"attemptLike() {\n this.log('waiting for buttons...');\n\n this.waitForButtons(() => {\n /*\n If the video is already liked/disliked\n or the user isn't subscribed to this channel,\n then we don't need to do anything.\n */\n if (this.isVideoRated()) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
resources can be a single resource or an array ; same code as postAllData same for putAllData() optional : success, error | function putAllData(resources, success, error, optionalHeaders, handlerOptions) {
if (!(resources instanceof Array)) { // single resource
resources = [ resources ];
}
var swaggerParams = {body:JSON.stringify(resources, null, null),
Authorization:getAuthHeader()};
if (optionalHeaders) {
... | [
"_addResources(resources, forceUpdate = false) {\n for (const id in resources) {\n this.layerManager.resourceManager.add({\n resourceId: id,\n data: resources[id],\n forceUpdate\n });\n }\n }",
"function putResources(files) {\n\n var host = options.host || defaultOptions.hos... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Makes all elements in the body that have been hidden by `hideApp` visible again to screenreaders. | function showApp() {
if (!isHidden) {
return;
}
Object(__WEBPACK_IMPORTED_MODULE_0_lodash__["forEach"])(hiddenElements, function (element) {
element.removeAttribute('aria-hidden');
});
hiddenElements = [];
isHidden = false;
} | [
"bodyHide () {\n document.body.addEventListener(this.bodyEvent, ev => {\n this.hide()\n }, false)\n\n this.wrap.addEventListener(this.bodyEvent,\n ev => ev.stopPropagation() || ev.preventDefault(),\n false\n )\n }",
"function testDeveloperElementsAreHidden(item) {\n testElementsVisi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saving session choices for package type | function savePackageType(id, key) {
var packageType = document.getElementById(id).value;
window.sessionStorage.setItem(key, packageType);
} | [
"function loadPackageType(key) {\n if (window.sessionStorage.getItem(key) == \"SingleUnit\") \n document.getElementById(\"SingleUnit\").checked=true;\n if (window.sessionStorage.getItem(key) == \"6pack\")\n document.getElementById(\"6pack\").checked=true;\n}",
"function save_type() {\n\tvar t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace the given Node along with its entire subTree by the give newNode and its subTree | replaceSubTree(node, newNode = null) {
if (node.parent !== null) {
const direction = (node === node.parent.left) ? 'left' : 'right';
node.parent[direction] = newNode;
} else {
this.root = newNode;
}
if (newNode !== null) {
newNode.parent = ... | [
"replaceWith (node) {\n node.path = this.path\n node.name = this.name\n if (!node.isLink)\n node.realpath = this.path\n node.root = this.isRoot ? node : this.root\n // pretend to be in the tree, so top/etc refs are not changing for kids.\n node.parent = null\n node[_parent] = this[_parent]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes any lobbies with no players in them | function prune()
{
for (i = 0; i < lobbies.length; i += 1)
{
if (lobbies[i].players.length == 0)
{
lobbies.splice(i, 1);
i -= 1;
}
}
} | [
"function clearEmptyGames() {\n\n }",
"clear() {\n this._players = [];\n }",
"function removeGame() {\n\t//todo: add formal message telling client other player disconnected\n\tsocket.emit('delete game', gameID);\n\tclient.fleet = ['temp2', 'temp3', 'temp4', 'temp5'];\n\tenemyFleet = new Array(4);\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Standard method to dispose a media stream object. | static disposeMediaStream(stream){stream.getVideoTracks().forEach(x=>x.stop());stream=undefined;} | [
"[kStreamClose](id, code) {\n const stream = this.#streams.get(id);\n if (stream === undefined)\n return;\n\n stream.destroy();\n }",
"closeMedia(){\n \n if (this.currentScene == null){\n\n logger.warn('Request to close media session without registering scene, \\\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Play sound, but only when the icon is checked | function playSound(sound) {
if ($('#sound').is(':checked') === true) { //Check if the checkbox 'sound' is checked by the player
sound.play (); //If so, you can play sounds :). Each sound that needs to be played will trigger this function
}
} | [
"function playButtonSound() { \nsound.src = 'music/click.mp3'\nsound.play() }",
"function soundEffectSuccessFun() {\n soundEffectSuccess.play();\n}",
"function addSongNameClickEvent()\n {\n var song=$('audio');\n if (document.getElementById(\"player\").paused==true){\n song[0].p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: getForceMultipleUpdate DESCRIPTION: ARGUMENTS: none RETURNS: boolean true if force multiple update | function ServerBehavior_getForceMultipleUpdate()
{
return this.bForceMultipleUpdate;
} | [
"function ServerBehavior_setForceMultipleUpdate(bForce)\n{\n this.bForceMultipleUpdate = bForce;\n}",
"get isCompleteUpdate() {\n // XXX: Bug 514040: _ums.isCompleteUpdate doesn't work at the moment\n if (this.activeUpdate.patchCount > 1) {\n var patch1 = this.activeUpdate.getPatchAt(0);\n var pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When this component mounts dispatch a request to the server for a list of ways hops can be used in brewing. | componentDidMount() {
const action = { type: 'FETCH_HOP_USAGE' };
this.props.dispatch(action);
} | [
"componentDidMount() {\n this.props.fetchShip()\n this.props.fetchCrew()\n }",
"componentDidMount() {\n this.props.actions.loadPackageDetailsAction(this.props.packageId);\n this.props.actions.loadPackageDependenciesAction(this.props.packageId);\n this.props.actions.loadPackageParentsAction(this.pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
where pie chart is created and animated from bottom to top, also where area's chart values are animated to bend around pie. | function stage0() {
if (!piechart) {
piechart = mainContainer.createChild(am4charts.PieChart);
piechart.zindex = 15;
piechart.hiddenState.properties.opacity = 0; // this makes initial fade in effect
piechart.width = 400;
piechart.x = am4core.percent(50);
piechart.hori... | [
"function renderPieChart() {\n var i, x, y, r, a1, a2, set, sum;\n\n i = 0;\n x = width / 2;\n y = height / 2;\n r = Math.min(x, y) - 2;\n a1 = 1.5 * Math.PI;\n a2 = 0;\n set = sets[0];\n sum = sumSet(set);\n\n for (i = 0; i < set.length; i++) {\n ctx.fillStyle = getColorForIndex(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
True iff all benchmarks and their corresponding iterations in the given run can be parsed | static canParse( testName ) {
const benchmarkParserKey = Utils.getBenchmarkParserKey(testName);
if(benchmarkParserKey) {
return true;
}
return false;
} | [
"function areValidRuns(){\n // Check consistency of file types\n var re = /(?:\\.([^.]+))?$/; // Regex for file type\n var ext = re.exec(importPaths.runs)[1];\n var is_consistent = true;\n\n if (importPaths.runs.length) {\n for (let i = 0; i < importPaths.runs.length; i++) {\n let t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clears the annotations stored into the cache | function clearAnnotationsInCache() {
if(CacheService.getPrivateCache().get('annotations') != null) {
var annotations = JSON.parse(CacheService.getPrivateCache().get('annotations'));
var types = Object.keys(annotations);
var emptyAnnotations = {};
for (var i = 0; i < types.length; i++) {
emptyA... | [
"function clearAnnotationsInDoc() {\n var documentProperties = PropertiesService.getDocumentProperties();\n documentProperties.deleteProperty('ANNOTATIONS');\n documentProperties.deleteProperty('ANNOTATIONS_TYPE'); \n documentProperties.deleteProperty('ID'); \n documentProperties.deleteProperty('LINKS'); \n /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_ESAbstract.ToIntegerOrInfinity / global ToNumber 7.1.5. ToIntegerOrInfinity ( argument ) | function ToIntegerOrInfinity(argument) { // eslint-disable-line no-unused-vars
// 1. Let number be ? ToNumber(argument).
var number = ToNumber(argument);
// 2. If number is NaN, +0𝔽, or -0𝔽, return 0.
if (isNaN(number) || number === 0 || 1/number === -Infinity) return 0;
// 3. If number is +∞𝔽, return +∞.
if (... | [
"function toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n const sign = value < 0 ? -1 : 1;\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}",
"function orZero(num, infini... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |