query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Write the charCode of `str`'s first character as an 8bit unsigned integer and move pointer forward by 1 byte. | writeChar(str) {
return this.writeUint8(str.charCodeAt(0));
} | [
"function completeBinary(str) {\n\tlet a = str;\n\twhile (a.length % 8 !== 0) {\n\t\ta = \"0\" + a;\n\t}\n\treturn a;\n}",
"function bytePad(binarystr) {\n var padChar = \"0\";\n var pad = new Array(1 + 8).join(padChar);\n return (pad + binarystr).slice(-pad.length);\n}",
"function getCodeFromLetter(str){... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function for positionEvent gets the index of the shortest event in the row only called when the shortest column in the row has space for the current event | function getShortestEventIndex(event) {
var j = event.idx;
var min = event.idx;
while (!eventCollection[j].begin) { // Check until the beginning of the row
if (eventCollection[j].column == event.column) { // Adjust the height for the current column
eventCollection[j].... | [
"getColumnIndex(): number {\n const { row, cell } = this;\n const cells = row.nodes;\n\n return cells.findIndex(x => x === cell);\n }",
"function getPosition(event) {\n var toParse = event.target.className;\n var row = toParse.substring((toParse.indexOf('row_'))+4,(toParse.indexOf('c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Collects a scenario object and templates from element | function collectScenariosFromElement(parentElement) {
var scenarios = [];
var templates = [];
var elements = parentElement.children();
var i = 0;
angular.forEach(elements, function(el) {
var elem = angular.element(el);
//if no source or no html, capture element it... | [
"function collectScenariosFromElement(parentElement) {\n var scenarios = [];\n var templates = [];\n\n var elements = parentElement.children();\n var i = 0;\n\n angular.forEach(elements, function(el) {\n var elem = angular.element(el);\n\n\n //if no source or no html, c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set new couples rotateA | function setCouplesA(){
// new couples
for(i = 0; i < (numberOfPlayers / 2) - 1; ++i) {
couples.push(new Couple(`${players[1 + i].name}`, `${players[(numberOfPlayers / 2) + 1 + i].name}`, 0));
}
} | [
"rotate() {\r\n //each piece has a different center of rotation uhoh, see image for reference\r\n //https://vignette.wikia.nocookie.net/tetrisconcept/images/3/3d/SRS-pieces.png/revision/latest?cb=20060626173148\r\n for (let c in this.coords) {\r\n this.coords[c][0] += this.rotationIn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
friendliestAuthor(authors): receives a list of authors returns the name of the author that has coauthored the greatest number of books | function friendliestAuthor(authors) {
// Your code goes here
let authorList = authors.map(author => ({
name: author.name,
books: author.books
}));
console.log(authorList);
// let bookList = authors.map()
// let multipleAuthors = books.filter(book => book.authors.length > 1);
// console.log(multi... | [
"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"
]
]
}
} |
check weapon on the tile and call replace functions (for the player's boards and for the field): | function checkWeapon(num) {
let tile = $('.box[boxID=' + num + ']');
if (tile.hasClass('weapon')) {
if (tile.hasClass('wp-1')) {
currentWeapon = 1;
replaceWeapon(ball.value, 'wp-1', num);
replaceWeaponOnBoard(ball.value);
return;
}
if (ti... | [
"function replaceWeapon(value, weapon, num) {\n let tile = $('.box[boxID= ' + num + ']');\n whoIsActive();\n tile.removeClass(weapon).addClass(playerActive.weapon);\n playerActive.weapon = weapon; \n playerNotActive.power = value; \n}",
"function weaponChange(element, player){\n let p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Merge Strategy: If remote does not exist, merge with local (First time sync) Overwrite local with remote changes. Removed, Added, Updated. Update remote with those local extension which are newly added or updated or removed and untouched in remote. | merge(localExtensions, remoteExtensions, lastSyncExtensions) {
const ignoredExtensions = this.configurationService.getValue('configurationSync.extensionsToIgnore') || [];
// First time sync
if (!remoteExtensions) {
this.logService.info('Extensions: Remote extensions d... | [
"maybeMerge()\n {\n if ( this.options.merge ) {\n try {\n this[ isMerging ] = true;\n\n const data = JSON.parse(fs.readFileSync(this.getOutputPath()));\n\n for ( const key in data ) {\n if ( ! this.has(key) ) {\n this.set(key, data[ key ]);\n }\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add one album/folder to the breadcrumb | function breadcrumbAdd( albumIdx ) {
var ic='';
if( !G.O.breadcrumbHideIcons ) {
ic=G.O.icons.breadcrumbAlbum;
if( albumIdx == 0 ) {
ic=G.O.icons.breadcrumbHome;
}
}
var $newDiv =jQuery('<div class="oneItem">'+ic + G.I[albumIdx].title+'</div>').appendT... | [
"function addCrumb(dir) {\n var crumb = '<span><a class=\"breadcrumbs-item change\" href=\"\" data-path=\"' + dir + '\">' + getDirName(dir) + '</a> / </span>';\n crumbarray.push(crumb);\n\n $('.breadcrumb').append(crumbarray[crumbarray.length - 1]);\n}",
"function fillBreadcrumb(restaurant = self.restaurant) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTIONS: PREFERENCES WINDOW // ============================== // function to disable prefernce in pref window 'pref' can be passed as string or array returns setting if needed for further changes | function disablePreference(setting, pref, revert) {
setting = document.getElementById('pref-zotfile-' + setting).value;
if(revert) setting = !setting;
if(typeof(pref)=='string') document.getElementById('id-zotfile-' + pref).disabled = !setting;
if(typeof(pref)=='object') for (var i=0;i<pref.length;i++) ... | [
"function maybeResetPref(aPrefName, aResetPref) {\n if (aResetPref) {\n Services.prefs.clearUserPref(aPrefName);\n } else {\n Services.prefs.setCharPref(\n PREF_BACKUP_PREFIX + aPrefName, getPref(aPrefName));\n }\n}",
"function storePref () {\n localStorage.setItem('pref', JSON.stringify(pref));\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
default handlers for message box buttons these should never run! | function doMsgBtnOK() {
console.log("Something went very awry with the message box Okay button.");
} | [
"function messageBoxCloseCallback() {\n logger.silly(\"Closing messagebox\");\n}",
"function goMainAfterMessage() {\r\n\tshowComModal( {type:\"error\",msg:footMLang.get( \"erroccurgomain_br\" ),closeCallbackFnc:function(){ goMain(); } } );\t// 오류가 발생하였습니다<br/>메인화면으로 이동합니다\r\n}",
"function _setMessages() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that the constructor id is the same as the breed's id | constructorNameMatchesBreedId(constructorId, breedId) {
doCheck(
constructorId.name === breedId.name,
`A constructor's identifier must match the identifier of the breed in which it is defined`
);
} | [
"constructorReturnsBreedType(constr, breed) {\n doCheck(\n this.typesAreEquivalent(constr.returnType, breed),\n `The return type of a constructor must be the breed in which it is defined`\n );\n }",
"static async checkClubIdAsId( clubId) {\n let validationResult = FootballClub.checkClubId(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get customers from database. | function getCustomers(callback) {
var query = "SELECT c.* " +
"FROM customers c " +
"ORDER BY lastName ASC";
db.query(query, function(err, rows) {
if (err) {
return callback(err, null);
} else {
return callback(null, rows);
}
});
} | [
"function getcustomers(req, res) {\n\t//Query the DB and if no errors, send all the customers\n\tlet query = customer.find({});\n\tquery.exec((err, customers) => {\n\t\tif(err) res.send(err);\n\t\t\n\t\tres.json(customers);\n\t});\n}",
"static async findBestCustomers() {\n\t\tconst results = await db.query(\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns revs of all conflicts that is leaves such that 1. are not deleted and 2. are different than winning revision | function collectConflicts(metadata) {
var win = winningRev(metadata);
var leaves = collectLeaves(metadata.rev_tree);
var conflicts = [];
for (var i = 0, len = leaves.length; i < len; i++) {
var leaf = leaves[i];
if (leaf.rev !== win && !leaf.opts.deleted) {
conflicts.push(leaf.rev);
}
}
re... | [
"function tournamentConflicts() {\r\n //Reset the errors array\r\n pub.errors.length = 0;\r\n\r\n //Get the admin table\r\n var adminTable = $(\"#adminTable\");\r\n\r\n //Reset the red rows in the admin table\r\n adminTable.children(\":last-child\").children().children().cs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the spoiler BBCode for each match (used for polls and results) | function createMatchSpoilers(LRtext, currentMatch) {
var team1 = getTeam("team1", currentMatch);
var team2 = getTeam("team2", currentMatch);
$(LRtext).append("[i]");
$(LRtext).append(team1 + " vs " + team2);
$(LRtext).append("[/i]\n");
$(LRtext).append("[spoiler][/spoiler]\n\n");
} | [
"function createMatchDaySpoilers(LRtext, currentMatchDay) {\n\tvar dateVal = getMatchDate(currentMatchDay);\n\t$(LRtext).append(\"[spoiler=\" + dateVal + \"]\\n\");\n\n\t$(\".match\", currentMatchDay).each(function() {\n\t\tcreateMatchSpoilers(LRtext, this);\n\t});\n\n\t$(LRtext).append(\"[/spoiler]\\n\\n\");\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts the leaderboard object into a sorted array, sorted by score. | sortLeaderboard () {
// Build the array to be sorted that will contain all the leaderboard information
let sortedLeaderboard = []
const leaderboard = this.state.leaderboard
for (var key in leaderboard) {
if (leaderboard.hasOwnProperty(key)) {
if (this.checkFilters(leaderboard[key])) {
... | [
"function sortPlayerScores() {\n userArr.sort(function(a, b) {\n if (a.score > b.score) {\n return -1;\n }\n if (a.score < b.score) {\n return 1;\n }\n // scores must be equal\n return 0;\n });\n}",
"function scoreSort(a, b){\n return b.score-a.score;\n}",
"function gen_sortCars... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the current list | getCurrentList(){
return this.currentList;
} | [
"getCurrentList(){\n switch (this.getListSelector()) {\n case \"Blue\":\n return this.blueList;\n break;\n case \"Red\":\n return this.redList;\n break;\n case \"Purple\":\n return this.purpleList;\n break;\n\n }\n }",
"function getCurrentListE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deleting an address data in levelDB with address key | deleteAddressData(address) {
addressdb.del(address, function(err) {
addressdb.get(address, function(err, data) {
console.log(address + " has been deleted.");
})
})
} | [
"deleteOneLocation(id) {\n return db.none(`\n DELETE FROM location\n WHERE id = $1\n `, id);\n }",
"static async deleteCollege(collegeCode){\n await pool.query('DELETE FROM has WHERE collegecode=?',collegeCode);\n await pool.query('DELETE FROM college WHERE collegecode=?... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add callback to the multicast | function add (callback) {
multicast.push(callback);
return callback;
} | [
"function Multicast(callback) {\n var self = this,\n multicast = [];\n\n if (callback) multicast.push(callback);\n\n function invoke () {\n for (var i = 0; i < multicast.length; i++) {\n multicast[i].apply(self, arguments);\n }\n }\n\n function add (callback) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Submits Entry Distribution changes to the remote destination. | static submitUpdate(id){
let kparams = {};
kparams.id = id;
return new kaltura.RequestBuilder('contentdistribution_entrydistribution', 'submitUpdate', kparams);
} | [
"static update(id, entryDistribution){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\tkparams.entryDistribution = entryDistribution;\n\t\treturn new kaltura.RequestBuilder('contentdistribution_entrydistribution', 'update', kparams);\n\t}",
"function upload_dist() {\n try {\n fs.accessSync(DIST_FILE, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If a value is given, skip, otherwise prompt user for data. | function ask(question, cbk, skip) {
if (skip) {
cbk(skip);
return;
}
self.prompt(question, function(answ) {
if (String(answ.answer).trim() === "") {
return ask(question, cbk);
} else {
cbk(answ.answer);
}
});
} | [
"function validateNone (data, command) {\n // good job!\n return true;\n }",
"function askUserInput() {\n return prompt('Enter item you want to add:');\n}",
"function promptUsername() {\n setInputFlow(submitUsername, true);\n\n print('Please enter your username in the box below');\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Si la phrase que tu prononces contient le mot "Fortnite" | function didYouSayFortnite(str) {
return str.includes('fortnite')
} | [
"function pastTensifyWord({ word }) {\n let pastTense = toIkForm(word); // get the word's ik form\n const suffixWithTe = [...'sftktchp'.split('')];\n \n // If the last letter in the verb en form (before \"en\") is included\n // in SoFTKeTCHup (ok this is a bit bullshit just imagine\n // \"ch\" is also a lette... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wait for an instance to reach a certain status. By default, we wait for the instance status to be "Running". For reference, see class InstanceStatus(object): LAUNCHING = 0 RUNNING = 1 ERROR = 2 DELETING = 3 | waitForInstance(instance, targetStatus = 1) {
return this.waitFor(instance, (instance) => instance.status === targetStatus || instance.status === 2);
} | [
"function waitForServantStartup(adviseLaunchInfo) {\n var waitLoop = setInterval(function() {\n monitorBulletinBoard(adviseLaunchInfo, waitLoop);\n }, 2000);\n}",
"waitForImage(image, targetStatus = 3) {\n return this.waitFor(image, (image) => image.status === targetStatus)\n }",
"static ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update a public API | updateApi(key, apiData, cb) {
this.request('PUT', '/api/apis/' + key, apiData, cb)
} | [
"function update()\n{\n request.open(\"get\", \"update\", true);\n request.send();\n}",
"putV3ProjectsIdServicesExternalWiki(incomingOptions, cb) {\n const Gitlab = require('./dist');\nlet defaultClient = Gitlab.ApiClient.instance;\n// Configure API key authorization: private_token_header\nlet pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate bar chart based on selected skill | function updateBarChart(skill) {
// variable
let xValues = [];
let yValues = [];
let low = 0;
let maxi = 0;
// determine which skill is selected;
if(skill == "ICT/Technology Skills"){low = 0; maxi = 5;}
else if(skill == "Social Communication Skills"){low = 5; maxi = 10;}
else if(... | [
"function selectedSkill(){\n let select = document.getElementById(\"skills\");\n let option = select.options[select.selectedIndex];\n\n document.getElementById(\"selected\").innerHTML = option.value;\n document.getElementById(\"selectedBarChart\").innerHTML = option.value;\n\n // generate bar chart based on se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the current quaternion with the multiplication of itself with the given one "q1" | multiplyInPlace(q1) {
this.multiplyToRef(q1, this);
return this;
} | [
"multiplyToRef(q1, result) {\n const x = this.x * q1.w + this.y * q1.z - this.z * q1.y + this.w * q1.x;\n const y = -this.x * q1.z + this.y * q1.w + this.z * q1.x + this.w * q1.y;\n const z = this.x * q1.y - this.y * q1.x + this.z * q1.w + this.w * q1.z;\n const w = -this.x * q1.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
wrapped dateTime2ms that: accepts ms numbers for backward compatibility inserts a dummy arg so calendar is the 3rd arg (see notes below). defaults to ax.calendar | function dt2ms(v, _, calendar) {
// NOTE: Changed this behavior: previously we took any numeric value
// to be a ms, even if it was a string that could be a bare year.
// Now we convert it as a date if at all possible, and only try
// as (local) ms if that fails.
var ms = da... | [
"function _msToTimestamp(ms) {\n var t = '';\n var MS_HOUR = 1000 * 60 * 60;\n var MS_MINUTE = 1000 * 60;\n var MS_SECOND = 1000;\n var h = Math.floor(ms / MS_HOUR);\n var m = Math.floor(ms / MS_MINUTE) % 60;\n var s = Math.floor(ms / MS_SECOND) % 60;\n if (h) t += h + ':'; // pad with extra zero only if ho... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
redirectToTrips: false, focusedInputLeftCol: START_DATE, bookedDates: [] } | function onFocusChange() {
setFocusedInputLeftCol(focusedInputLeftCol === START_DATE ? END_DATE : START_DATE);
} | [
"updateStart(event) {\n this.setState({\n startDate: event.target.value,\n endDate: this.state.endDate\n });\n this.props.updateDate(event.target.value, 'start');\n }",
"renderDateInputs() {\n return (\n <>\n <Grid.Column width={8}>\n <DateInput\n name=\"star... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move to the front layer. | goToFront() {
// This should only ever be used for sprites // used by compiler
if (this.renderer) {
// Let the renderer re-order the sprite based on its knowledge
// of what layers are present
this.renderer.setDrawableOrder(this.drawableID, Infinity, StageLayering.SPRITE_LAYER);
}
thi... | [
"frontFlip() {\n\t\tsuper.frontFlip(KEN_SPRITE_POSITION.frontFlip, KEN_IDLE_ANIMATION_TIME - 3, false, 2, MOVE_SPEED + 3);\n\t}",
"bringToFront() {\n let zIndex = '';\n const frontmost = OverlayElement.__attachedInstances.filter((o) => o !== this).pop();\n if (frontmost) {\n const frontmostZIndex = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert an area measure to a label in sqkm or sqm | function getAreaLabel(area, crs) {
var sqm = crs && crs.to_meter ? area * crs.to_meter * crs.to_meter : area;
var sqkm = sqm / 1e6;
return sqkm < 0.01 ? Math.round(sqm) + ' sqm' : sqkm + ' sqkm';
} | [
"function getZoneLabel(feature) {\n const lat = feature.geometry.coordinates[0];\n return (1 + Math.floor((lat + 180) / 6)).toFixed(0);\n}",
"function kmFormatter(v, axis){\r\n\treturn v.toFixed(axis.tickDecimals) + \" km\";\r\n}",
"function afficheFmtKML() {\n var geocoder= viewer.getVariable('geocoder');... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
run(command: Command) > ChildProcess|EventEmitter Runs a command or builtin. | function run(command, stdio) {
if (BuiltIn[command.cmd]) {
// Catch built in commands and run them differently
console.log(green(`[builtin] ${command.cmd}`))
const child = BuiltIn[command.cmd](stdio, ...command.args)
if (child && child.stdout) { return child }
return fakeChild()
}
// Othe... | [
"function Commander(cmd) {\n var command =\n (getOsType().indexOf('WIN') !== -1 && cmd.indexOf('.exe') === -1) ?\n cmd + '.exe' : cmd;\n var _file = null;\n\n // paths can be string or array, we'll eventually store one workable\n // path as _path.\n this.initPath = function(paths) {\n if (typeof paths... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a spectral line to the globally available array. | addSpectralLine(id, label, name, wavelength, air, type, enabled, shortcut, displayLines) {
if (id == null || label == null || name == null || wavelength == null || air == null || type == null) {
console.warn('Not a valid line. A null was passed in.');
return;
}
if (parseF... | [
"function drawLine (yarray) {\n var line = svg.append('path').datum(yarray.toArray())\n line.attr('d', renderPath)\n yarray.observe(function (event) {\n // we only implement insert events that are appended to the end of the array\n event.values.forEach(function (value) {\n line.datum().pus... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updateTupletStates react to a tuplet start or stop directive | updateTupletStates(tupletInfos, voice, staffIndex, voiceIndex) {
const tick = voice.notes.length - 1;
tupletInfos.forEach((tupletInfo) => {
if (tupletInfo.type === 'start') {
this.tuplets[tupletInfo.number] = {
start: { staff: staffIndex, voice: voiceIndex, tick }
};
} els... | [
"handleOneStop(){\n this.setState({\n selectstop: 1\n });\n }",
"function updateState(e){\r\n for (var i = 0; i < currentState.transitions.length; i++) {\r\n if (currentState.transitions[i].input == e.type){\r\n //based on input type and current state, do appropriate action\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Measures the scroll offset relative to the specified edge of the viewport. This method can be used instead of directly checking scrollLeft or scrollTop, since browsers are not consistent about what scrollLeft means in RTL. The values returned by this method are normalized such that left and right always refer to the le... | measureScrollOffset(from) {
const LEFT = 'left';
const RIGHT = 'right';
const el = this.elementRef.nativeElement;
if (from == 'top') {
return el.scrollTop;
}
if (from == 'bottom') {
return el.scrollHeight - el.clientHeight - el.scrollTop;
}... | [
"function getScrollOffset() {\n return {\n x: main.scrollLeft,\n y: main.scrollTop };\n\n}",
"function calculateOffsetLeft(r){\n return absolute_offset(r,\"offsetLeft\")\n}",
"function _calcScrollToOffset(size, scrollOffset) {\n\t var scrollToRenderNode = this._scroll.scrollToRenderNode || this._... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return normalized plugins and visitors | function getVisitors (rawplugins) {
const visitors = {};
// initialize plugins and visitors
[].concat(rawplugins || []).forEach(plugin => {
const initializedPlugin = Object(plugin).type === 'plugin' ? plugin() : plugin;
if (initializedPlugin instanceof Function) {
if (!visitors.afterRoot) {
visitors.aft... | [
"entryPlugins(context) {\n const plugins = this.data.map(({chunk, entry}) => (\n new (Array.isArray(entry) ? MultiEntryPlugin : SingleEntryPlugin)(context, entry, chunk)\n ));\n return {\n apply(compiler) {\n plugins.forEach(plugin => plugin.apply(compiler));\n }\n };\n }",
"col... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get item info by id | function getItemInfo(id) {
if (id in item)
return item[id]
else
throw new Error ("No item with id " + id)
} | [
"function extractItem(items, id) {\n for (var i = 0; i < items.length; i++)\n if (items[i].id == id)\n return items.splice(i, 1)[0];\n }",
"function finditembyid (id) {\n\tfor (var i = 0; i < food_pickup.length; i++) {\n\t\tif (food_pickup[i].id == id) {\n\t\t\treturn food_pickup[i]; \n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make json error msg | function jsonError(msg) {
console.log(`${RED}**** Error **** ${RESET}${msg}`);
return ("{\"error\":\"" + msg + "\"}");
} | [
"function buildError(code,message){\n return {\n \"status\" : \"error\",\n \"error\" : {\n \"code\" : code,\n \"message\" : message\n }\n };\n }",
"function format(err) {\n return JSON.stringify(asResponse(err));\n}",
"jsonErrorSchema() {\n return {\n type: \"objec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
scrape text from blog at given link | async function getBlogText(link) {
let result = null;
await Promise.resolve(axios.get(link)
.then( (res) => {
const $ = cheerio.load(res.data);
// get all the text from the post in the "post-body" class div
// replace new lines with a space
// regex code t... | [
"_getLinkText() {\n let text = this._gatherTextUnder(this.context.link);\n\n if (!text || !text.match(/\\S/)) {\n text = this.context.link.getAttribute(\"title\");\n if (!text || !text.match(/\\S/)) {\n text = this.context.link.getAttribute(\"alt\");\n if (!text || !text.match(/\\S/)) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the index number of a room given its name if there is no such room, it returns 1 | roomIndex(roomName) {
for (var i = 0; i < this.world.rooms.length; i++) {
if (this.world.rooms[i].id == roomName) {
return i;
}
}
return -1;
} | [
"function getRoomIndex(name) {\n\n let index = -1;\n\n for (i = 0; i < rooms.length; i++) {\n if (rooms[i].name === name)\n index = i;\n }\n\n return index;\n}",
"getPosition(room, floor) {\n var roomsInFloor = this.getRoomsInfloor(floor)\n var roomInFloor = roomsInFloo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SUCCESS METHOD SETS TRACKER LAT LNG fn geoSuccess() | function geoSuccess(position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
window._TRACKER.geo = `${lat}|${lng}`;
} | [
"function letsGeolocate(successCallback,failureCallback){\n\t\tvar options = {};\n\t\tvar useragent = navigator.userAgent;\n\t\tif (navigator.geolocation) {\n\t\t\tnavigator.geolocation.getCurrentPosition(function(position) {\n\t\t\t\t\tlog('kapow!');\n\t\t\t\t\tvar thisPosition \t= new google.maps.LatLng(position.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
10.Write a program that inserts a given element e on the given position p in the array a. If the value of the position is greater than the array length, print the error message. Input: e = 78, p = 3, a = [2, 2, 33, 12, 5, 8] Output: [2, 2, 33, 78, 12, 5, 8] | function insertElement(a, e, p) {
var newArray = [];
for (var i = 0; i < a.length; i++) {
if (i !== p) {
newArray[newArray.length] = a[i];
} else {
newArray[newArray.length] = e;
newArray[newArray.length] = a[i];
}
}
return newArray;
} | [
"function insert(array, start, end, v) {\n while (start + 1 < end && array[start + 1] < v) {\n var tmp = array[start];\n array[start] = array[start + 1];\n array[start + 1] = tmp;\n start++;\n }\n array[start] = v;\n }",
"function insertionSort(arr, arr_size) {\n // There should b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loops through any present process arguments and joins them together in a string seperated by a hyphen | function combine(){
var array = []
for (i=3;i<process.argv.length;i++) {
array.push(process.argv[i]);
}
return array.join("+");
} | [
"function createSearch(){\n for(i=3;i<process.argv.length;i++){\n argTwo = argTwo + String(process.argv[i]) + ' ';\n }\n}",
"function CONCATENATE() {\n for (var _len4 = arguments.length, values = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n values[_key4] = arguments[_key4];\n }\n\n // C... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Main driver function updates both general sheet and release by release sheets | function updateORP(ssheet,issues,lastORPDetails,recentReleases) {
var sprSheet=SpreadsheetApp.open(DriveApp.getFileById(ssheet))
var genSheet=makeGeneralPage(sprSheet,recentReleases,lastORPDetails)
var releases=releaseList()
for ( r in releases ) {
var release=releases[r]
var mileSheet=updateMilestoneP... | [
"function refreshWorksheetData(){\n const worksheet = props.selectedSheet;\n worksheet.getDataSourcesAsync().then(sources => {\n for (var src in sources){\n sources[src].refreshAsync().then(function () {\n console.log(sources[src].name + ': Refreshed Successf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Call PubSub Client and Get List of Topics | function list_topics(callback) {
pubsubClient.getTopics().then(results => {
let topics = results[0];
let names = [];
// console.log('Topics:');
// topics.forEach(topic => console.log(topic.name));
topics.forEach(topic => names.push(topic.name));
callback(names);
}... | [
"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"
]
]
}
} |
/ / Compute Fuel Type / / From CX2 manual: / AV GAS 6 lbs/gal / AV GAS 6.84 lbs/gal / AV GAS 7.5 lbs/gal / / Convert Unit will change Fuel Type / / | function ComputeFuelType(fuelTypeOut, fuelTypeIn) {
Equation.call(this, fuelTypeOut, fuelTypeIn);
} | [
"function fuelManage(fuelEvent) {\n\t\n\t$(\"#fuelWgt\").text(presentValues(888.45, 1))\n\n\tswitch (fuelEvent) {\n\n\t\tcase \"Set Full\": //Set Full Fuel button is pressed\n\n\t\t\tsetVolumeWeight(24);\n\t\t\tbreak;\n\n\t\tcase \"Fuel Load\": // clicks on number selector or types in a fuel value\n\n\t\t\tbreak;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`. | function taylorSeries(Ctor, n, x, y, isHyperbolic) {
var j, t, u, x2,
i = 1,
pr = Ctor.precision,
k = Math.ceil(pr / LOG_BASE);
external = false;
x2 = x.times(x);
u = new Ctor(y);
for (;;) {
t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
u = isHyperbolic ? y.plu... | [
"function _makeCosSinTable() {\n var n2 = _n >> 1,\n n4 = _n >> 2,\n n8 = _n >> 3,\n n2p4 = n2 + n4,\n t = Math.sin(Math.PI / _n),\n dc = 2 * t * t,\n ds = Math.sqrt(dc * (2 - dc)),\n c = _cstb[n4] = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get online Forwarding servers | function getOnlineRservers(){
var sql = "SELECT rserver_id,ip_address,port,state FROM info_rserver where state = 1";
var rservers = [];
executeSql(sql, null,
function(rows){
if(rows) rservers.push(rows);
},
function(err){
console.log("Error: failed when get online rservers, " + err);
}
);
return rs... | [
"listSockets() {\n var list = this.players.map(player => player.socketID);\n list.push(this.hostID);\n return list;\n }",
"getConnects() {\n var result = [];\n for (var i = 0; i < this.connectionList.length; i++) {\n result.push(this.connectionList[i]);\n }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IMGUI_API bool IsMousePosValid(const ImVec2 mouse_pos = NULL); | function IsMousePosValid(mouse_pos = null) {
return bind.IsMousePosValid(mouse_pos);
} | [
"function isMouseInRect(rect, mousePosX, mousePosY) {\r\n // x-boundary\r\n const xStart = rect.xStart;\r\n const xEnd = rect.xStart + rect.width;\r\n // y-boundary\r\n const yStart = rect.yStart;\r\n const yEnd = rect.yStart + rect.height;\r\n\r\n // is inside\r\n if (mousePosX >= xStart &&... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrap Response: The same build result can be expressed in different ways based on the URL. For example, "App.css" should return CSS but "App.css.proxy.js" should return a JS representation of that CSS. This is handled in the wrap step. | async function wrapResponse(code, hasCssResource) {
if (isRoute) {
code = wrapHtmlResponse({ code: code, isDev: true, hmr: isHmr, config });
}
else if (isProxyModule) {
responseFileExt = '.js';
code = await wrapImportProxy({
... | [
"function wrapResponse(data) {\n return {\n \"meta\": {\n \"version\": \"0.1.1\",\n \"status\": \"ok\",\n \"message\": \"Everything executed as expected.\"\n },\n \"response\": data\n }\n}",
"getOutput() {\n // Assuming it is production\n const output = {\n // Here we create a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the width of the header row. Assumes that it is called on a valid table with a header row. | getHeaderWidth() {
return this._rows[0].getWidth();
} | [
"function measureHeader() {\r\n var clonedThs = clone.thead.find(\"th\");\r\n table.thead.find(\"th\").each(function(i){\r\n //set width to clone header columns\r\n $(clonedThs[i]).width($(this).width());\r\n $(clonedThs[i]).oute... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
componentDidMount > get persal profile data from github api | componentDidMount() {
axios.get('https://api.github.com/users/toddmurphy')
.then(response => {
console.log(response.data)
this.setState({
user: response.data
})
})
.catch(error => {
console.lo... | [
"function renderProfileData(url) {\n axios.get(url)\n .then((res) => {\n const starsURL = `https://api.github.com/users/${res.data.login}/starred`;\n userInfo = res.data;\n username = userInfo.login;\n getProfileStars(starsURL);\n });\n}",
"function getGithubPerfil() {\n fetch(URL_GITHUB_PROFILE)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update the user in DB (ajaxCall) | function updateUser(user_id) {
user = {
Id: user_id,
First_name: prevName.innerHTML,
Last_name: prevLast.innerHTML,
Password: prevPassword.innerHTML,
IsAdmin: previsAdminCB.checked
}
ajaxCall("PUT", "../api/Users", JSON.stringify(user), updateUser_success, updateUser_... | [
"function ajax_update_user(){\n\tvar user_list = document.getElementById('user_list');\n\tvar uname = user_list.options[user_list.selectedIndex].innerHTML;\n\tvar uid = user_list.options[user_list.selectedIndex].id;\n\t// cleanup fields before repopulating\n\t// with new data\n\tcleanup();\n\tdocument.getElementByI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We have to do this in JavaScript rather than using a CSS :hover class because we have no single container which holds a tier column. Instead they are split between rows, so we use datatier to group them together. | function addHoverListeners() {
const elems = document.querySelectorAll(CLICKABLE);
for(let i = 0 ; i < elems.length ; i++){
elems[i].addEventListener('mouseenter', e => {
const tier = $(e.currentTarget).data('tier');
const $elemsInThisTier = $(CLICKABLE + tierSelector(tier));
... | [
"function setTdHover() {\n 'use strict';\n\n $('td').mouseover(function () {\n var courseName = $(this).html();\n if (courseName !== '') {\n var course = getCourseObject(courseName, courseObjects);\n if (course !== undefined) {\n $.each(course.getSectionTimes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new markdown cell widget. Notes If no cell content factory is passed in with the options, the one on the notebook content factory is used. | createMarkdownCell(options, parent) {
if (!options.contentFactory) {
options.contentFactory = this;
}
return new MarkdownCell(options).initializeState();
} | [
"_createMarkdownCell(model) {\n const rendermime = this.rendermime;\n const contentFactory = this.contentFactory;\n const editorConfig = this.editorConfig.markdown;\n const options = {\n editorConfig,\n model,\n rendermime,\n contentFactory,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Starting point to coalesce the data into usable, hierarchical objects the asynchronous AJAX calls need to be "timed" Also contains a function to check last AJAX calls, localStorage cache of the data to avoid hammering the NASA API server | function initAJAX() {
// This waits for the Star and Planet API calls to both finish before running the normalizeData() function to normalizing the flat data back to hierarchical data
$.when($.getJSON(urlDistinctStars), $.getJSON(urlDistinctPlanets)).done(normalizeData);
} | [
"function loadLocalData() {\r\n var xmlhttp=new XMLHttpRequest();\r\n xmlhttp.open(\"GET\",\"Buses.xml\",false);\r\n xmlhttp.send();\r\n xmlData=xmlhttp.responseXML;\r\n generateBusList(xmlData, \"SAMPLE\");\r\n loadRouteColors(); // Bus list must be loaded first\r\n displayRoutesFromTripId(tripRouteShapeRef... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show in Select Manufacturer | function showSelectManufacturer() {
var msg = callAPI(uRLBase + "Manufacturer", "GET");
$('#commodity-owner').html('<option value=""> --- Chọn nhà sản xuất ---</option>');
if(msg)
{
$.each(msg, function(key, value){
var newRow = '<option value="' + value['$class'] + '#' +value['tradeId'] + '">' + val... | [
"function loadHoseManufacturers() {\n $.get(\"/api/general/hoseManufacturers\"\n ).done(function (data) {\n var hoseManufacturer = $(\"#hoseManufacturer\");\n $.each(data.hoseManufacturers, function (index, element) {\n hoseManufacturers[element.id] = element;\n hoseManufac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all the sidenotes | function ebSidenoteConverterAllSidenotes() {
'use strict';
var sidenotes = document.querySelectorAll(options.elements);
console.log('Found ' + sidenotes.length + ' sidenotes.');
return sidenotes;
} | [
"function getSongs() {\n fetch(songsURL)\n .then((response) => response.json())\n .then((songs) => songs.forEach((song) => renderSong(song)));\n}",
"async function loadOpenedSurveys() {\n const response = await fetch(url + \"/api/surveys\");\n\n if (!response.ok) {\n throw new ResponseExcetion... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the specification for a given command. | getCommandSpec(packageId, commandId) {
return this.packages[packageId].commands[commandId];
} | [
"function getCommand(command) {\n if (client.commands.has(command)) {\n return client.commands.get(command);\n } else if (client.aliases.has(command)) {\n return client.commands.get(client.aliases.get(command));\n }\n}",
"function parseCommand(data) {\n for (const command in commands) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
goes to slide based on button clicked (slideIn) | function goToSlide(slideIn)
{
buttonPressed = true;
placeInfront = false;
if(!(currentItem == maxSlides && slideIn == 0)) //current item is changed as long as user hasn't called first slide on the last, identical one that seals the loop
currentItem = slideIn;
//resets the timer so the timer doesn't go off half-wa... | [
"function onNextButtonClick() {\n\t\tgotoNextSlide()\n\t}",
"handleClick (event) {\n minusSlides(1);\n }",
"function onPrevButtonClick() {\n\t\tgotoPrevSlide()\n\t}",
"moveToSlide( slide) {\n console.debug( \"dia-show › moveToSlide()\", slide);\n this.slide = slide != undefined ? slide : null;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Appends the item to the array and returns the array | function appendTo(array, item) {
return array.push(item), array;
} | [
"function addToEnd(array, item) {\n var index = array.indexOf(item);\n array.splice(index, 1);\n array.push(item);\n}",
"function addArray(copy, key, value) {\n\tcopy.push(value);\n\treturn copy[copy.length - 1];\n}",
"function addItemToFront(arr, item) {\n arr.unshift(item);\n return arr;\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if a value is an instance of Request. | function isRequest(input) {
return typeof input === 'object' && typeof input[INTERNALS$2] === 'object';
} | [
"static isV1Request(request, type) {\n switch(type) {\n case DaxMethodIds.getItem:\n return !DynamoDBV1Converter._isArrayEmpty(request.AttributesToGet);\n case DaxMethodIds.batchGetItem:\n if(!DynamoDBV1Converter._isMapEmpty(request.RequestItems)) {\n for(const tableName of Objec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: inspectServerBehavior DESCRIPTION: Sets the values of the form elements in the dialog box based on the given ServerBehavior object ARGUMENTS: sbObj ServerBehavior object one of the objects returned from findServerBehaviors RETURNS: nothing | function inspectServerBehavior(sbObj)
{
_input_type_text__tag.inspectServerBehavior(sbObj);
_expression1.inspectServerBehavior(sbObj);
} | [
"function applyServerBehavior(sbObj)\n{\n var paramObj = new Object();\n var errStr = \"\";\n\n if (!errStr) {\n errStr = textNode.applyServerBehavior(sbObj, paramObj);\n\n if (paramObj.textNode.tagName && paramObj.textNode.tagName.toUpperCase() == \"TEXTAREA\") {\n paramObj.MM_subType = \"textarea\";... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function displays a messgae when there are no recipes | function displayEmpty() {
blogContainer.empty();
var messageh2 = $("<h2>");
messageh2.css({ "text-align": "center", "margin-top": "50px" });
// messageh2.html("No recipes yet for this category, navigate <a href='/cms'>here</a> in order to create a new Recipe.");
blogContainer.append(messageh2);
} | [
"function displayEmpty() {\n productContainer.empty();\n var messageH2 = $(\"<h2>\");\n messageH2.attr('id', 'no-product');\n messageH2.html(\"No products have been added that match your search yet. Check back regularly to see new products! <br> Try a different <a href='/index'>search.</... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render game information and control Information: active player current phase player current treasure player available number of actions player available number of buys Controls: End phase (during action phase) End turn (during buy phase) | renderControls(G, ctx) {
let player = currentPlayer(G, ctx);
let controls = [];
controls.push(<div key='current-player'>Current player: {player.name}</div>);
controls.push(<div key='current-phase'>Current phase: {ctx.phase}</div>);
controls.push(<div key='current-treasure'>Treasure: {player.treasur... | [
"function displayGameInfo(){\n // Game Stats\n document.getElementById(\"dealer-points\").innerHTML = dealer.points;\n document.getElementById(\"player-points\").innerHTML = player.points;\n document.getElementById(\"bet-amount\").innerHTML = player.bet;\n document.getElementById(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CREATE EMPTY FORM creates Empty Form for adding / editing missions with all inputs but without button and without image | function createEmptyForm(){
var newMissionForm=$('<form class=newMissionForm></form>')
newMissionForm.append($('<input type="text" name="newMissionName" placeholder="Nazwa misji">'))
newMissionForm.append($('<p>Liczba punktów</p>'))
newMissionForm.append($('<span class="less">-</span>'))
newMissionForm.append... | [
"function showCreateForm() {\n setID(\"\");\n setFullName(\"\");\n setEmail(\"\");\n setShowForm(true);\n setShowUpdateForm(false);\n }",
"function newGame() {\n \n // ensure the form is visible\n document.getElementById('my-games-form').style.display='';\n // empty the fields on the s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Do 3 requests, such there will be 3 connections will be initialized | function initializeConnections() {
async.times(3, function (index, done) {
message(pool, 'RpbPingReq', {}, done);
}, function (err, responses) {
t.equal(err || null, null);
t.deepEqual(responses.length, 3);
t.equal(pool.connections, 3);
setTimeout(prolongConnections, 55);
});
... | [
"function multipleRequests() {\n //bad content-length\n var connection = net.createConnection(8888);\n var numReq;\n connection.on('data',function (data) {\n console.log('---Client got--------\\n'+data.toString()+'\\n---------')\n });\n\n var httpReq = \"GET /check/text.txt HTTP/1.1\\nHost:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handler for submit button for todo list item | function submitHandler(e) {
//create a new list item within a list tag
let newTodo = document.createElement('li');
//todo inner text is what is inputted within the text field
newTodo.innerText = textField.value;
//add the new todo list item to the list of tasks
tasks.appendChild(newTodo);
... | [
"submit() {\n const { currentItem, addItem, inputMode, clearCurrentItem, setItemShowInput, editItem } = this.props\n if (inputMode === 'add') {\n addItem(currentItem);\n } else {\n editItem(currentItem)\n }\n clearCurrentItem();\n setItemShowInput(fals... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
emula 1) o envio do comentario quando pressionar enter no campo do comentario ou 2) o cancelamento do comentario ao pressionar esc | function txtComentarioKeyDown(event) {
//diferentes formas de se referir aa tecla pressionada para diferentes tipos de browser
var enterPressed = (event.key=='Enter' || event.which==13 || event.keyCode==13);
var escPressed = (event.key=='Escape' || event.key=='Esc' || event.which==27 || event.keyCode==27);... | [
"function intromodalU(evento) {\n if (evento.keyCode === 13) {\n actualizarU();\n }\n}//fin funcion intro modal actulizar usuario",
"function confirmarBuscarTodos(campo, op) {\n submeter(op);\n\n /*if ((trim(campo.value) == '') || (campo.value == null)) {\n if (op == 1) {\n al... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a slightly hackedup browser only version of clarinet some features removed to help keep browser Oboe under the 5k microlibrary limit plug directly into event bus For the original go here: We receive the events: STREAM_DATA STREAM_END We emit the events: SAX_KEY SAX_VALUE_OPEN SAX_VALUE_CLOSE FAIL_EVENT | function clarinet(eventBus) {
"use strict";
var
// shortcut some events on the bus
emitSaxKey = eventBus(SAX_KEY).emit,
emitValueOpen = eventBus(SAX_VALUE_OPEN).emit,
emitValueClose = eventBus(SAX_VALUE_CLOSE).emit,
emitFail = eventBus(FAIL_EVENT... | [
"parseEvent() {\n\t\tlet addr = ppos;\n\t\tlet delta = this.parseDeltaTime();\n\t\ttrackDuration += delta;\n\t\tlet statusByte = this.fetchBytes(1);\n\t\tlet data = [];\n\t\tlet rs = false;\n\t\tlet EOT = false;\n\t\tif (statusByte < 128) { // Running status\n\t\t\tdata.push(statusByte);\n\t\t\tstatusByte = running... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
allSettled() when passed an iterable containing a single thenable that rejects should resolve to a singleelement array containing the reason | testSingleRejected() {
const expectedReason = new Error('expected reason');
const expectedResults = [newRejectedReason(expectedReason)];
function subtest(iterable) {
return new AllSettledTestCaseBuilder()
.setInputIterable(iterable)
.setExpectedResults(expectedResults)
.... | [
"testSingleFulfilled() {\n const expectedValue = {};\n\n function subtest(iterable) {\n return new AllSettledTestCaseBuilder()\n .setInputIterable(iterable)\n .setExpectedResults([newFulfilledValue(expectedValue)])\n .test();\n }\n\n return Promise.all([\n subtest([e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
places installation confirmation after the breadcrumb | function insertInstallationConfirmation()
{
helpDivNode.id = "helpDivNode";
document.getElementsByClassName("chapter-navigation")[0].parentNode.insertBefore(helpDivNode, document.getElementsByClassName("chapter-navigation")[0]);
var showHelpTarget = document.createElement("span");
... | [
"function installNotice() {\n\n\t// check if not already set ...\n\tchrome.storage.sync.get(CONSTANTS.INSTALL_KEY, function(result) {\n\n\t\t// and .. ?\n\t\tif(!result.install) {\n\n\t\t\t// get current timestamp\n\t\t var now = new Date().getTime();\n\n\t\t // params to save\n\t\t params = {};\n\n\t\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Override the execute function; if we already have a redirect result, then just return it. | async execute() {
let readyOutcome = redirectOutcomeMap.get(this.auth._key());
if (!readyOutcome) {
try {
const hasPendingRedirect = await _getAndClearPendingRedirectStatus(this.resolver, this.auth);
const result = hasPendingRedirect ? await super.execute() : null;
readyOutcome =... | [
"function redirecting_dispatch(dispatch, result)\n{\n\treturn (event) =>\n\t{\n\t\tswitch (event.type)\n\t\t{\n\t\t\t// In case of navigation from @preload()\n\t\t\tcase Preload:\n\t\t\t\t// `throw`s a special `Error` on server side\n\t\t\t\treturn result.redirect = location_url(event.location)\n\t\t\n\t\t\tdefault... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates an expression that rotates a vector by a given angle | function rotate(vec, angle) {
return new RotateExpr(vec, expr_1.wrapInValue(angle));
} | [
"function rotateVec(vec, angle){\n mag = vecLength(vec);\n ang = vecAngle(vec);\n vec.x = Math.cos(ang + angle) * mag;\n vec.y = Math.sin(ang + angle) * mag;\n}",
"function rotate_vector3_y(vector, angle_in_degrees) {\n var r = deg2rad(angle_in_degrees);\n var s = Math.sin(r);\n var c = Math.cos(r);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
colorCard changes color of activity card based on category | function colorCard(){
const mindfulness = document.querySelectorAll("[data-activity-name='mindfulness']")
const workout = document.querySelectorAll("[data-activity-name='workout']")
const meal = document.querySelectorAll("[data-activity-name='meal']")
mindfulness.forEach((div)=>{
div.style.backgr... | [
"function changeColour(){\n \t var myColour = document.getElementsByClassName('card');\n\n \t var valuesThree = values[2];\n\n \t\t if(valuesThree === 'celadon'){\n myColour[0].className = ' card celadonBackground';\n } else if (valuesThree === 'graphite'){\n myColour[0].classN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Examples: / binaryToBaseTen(100101) should return 37. / binaryToBaseTen(100201) should return false. | function binaryToBaseTen(binaryNumber) {
//your code here
} | [
"decimaltobinary(n) {\n\n\n bin = '';\n while (n > 0) {\n bin = (n % 2) + bin;\n n = Math.floor(n / 2)\n\n }\n var output = parseInt(bin)\n console.log(output)\n return bin\n }",
"function convertBase( str, baseOut, baseIn, sign ) { ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
====================================================================================== / Programming Quiz Solution: Laugh it Off Write a function called `laugh` with a parameter named `num` that represents the number of "ha"s to return. Note: make sure your the final character is an exclamation mark ("!") make sure tha... | function laugh(num) {
let ha = "";
for (let i = 0; i < num; i++) {
ha += "ha";
}
return ha + "!";
} | [
"function countSheep () {\nn = 0;\nwhile (n < 42) {\n\tn++,\n\tconsole.log(n + \" sheep\");\n}\n}",
"function hungry(hunger){\n \nreturn hunger <= 5 ? 'Grab a snack': 'Sit down and eat a meal';\n}",
"function sayHelloBye(name, num) {\n\treturn (num === 1) ? `Hello ${name[0].toUpperCase() + name.slice(1)}` : ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setup an [`IntersectionObserver`]( on a DOM Element that returns it's entries as they arrive. | function useIntersectionObserver(element, callbackOrOptions, maybeOptions) {
let callback;
let options;
if (typeof callbackOrOptions === 'function') {
callback = callbackOrOptions;
options = maybeOptions || {};
} else {
options = callbackOrOptions || {};
}
const {
threshold,
root,
ro... | [
"initIntersectionObserver() {\n if (this.observer) return;\n // Start loading the image 10px before it appears on screen\n const rootMargin = '10px';\n this.observer = new IntersectionObserver(this.observerCallback, { rootMargin });\n this.observer.observe(this);\n }",
"_observeEntries() {\n th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or the reader's lock is released before the stream finishes closing. | get closed() {
if (!IsReadableStreamBYOBReader(this)) {
return promiseRejectedWith(byobReaderBrandCheckException('closed'));
}
return this._closedPromise;
} | [
"function lowWrite(stream, data) {\n return new Promise((resolve, reject) => {\n if (stream.write(data)) {\n process.nextTick(resolve);\n } else {\n stream.once(\"drain\", () => {\n stream.off(\"error\", reject);\n resolve();\n });\n stream.once(\"error\", reject);\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParserout_of_line_part_storage. | visitOut_of_line_part_storage(ctx) {
return this.visitChildren(ctx);
} | [
"visitOut_of_line_constraint(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitOut_of_line_ref_constraint(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitInto_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitWithin_or_over_part(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to add a role to player when they level up | function AddLevelRole(member, level) {
// Check level of user
switch (level) {
case 1: {
// Add role
member.addRole(member.guild.roles.get(serverProperties.Bandwagon_Beamers.id));
// Return
return "You have also earned the role of **" + serverProp... | [
"function advanceLevel(){\n\n\t\t\tjewel.audio.play(\"levelUp\"); //p.306\n\n\t\t\tgameState.level++;\n\t\t\tannounce(\"Level \" + gameState.level);\n\t\t\tupdateGameInfo();\n\t\t\t//level value on gameInfo obj is 0 at beginning of game\n\t\t\tgameState.startTime = Date.now();\n\t\t\tgameState.endTime = jewel.setti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_Listener for the ChangeMenuVideo function, since we want to be able to remove the eventListener associated to it sometimes. | function ChangeMenuVideo_listener(e) {
// The DOM query selector does not create arrays, but nodeLists. They can be iterated with forEach but there
// are many array functions they do not have. Some of them can be solved by transforming to an Array like in the following method.
var index = Array.prototype.indexOf... | [
"function toggleAddVideoMenu() {\n setYTAppsDisplay(false)\n setAddVideoDisplay(!addVideoDisplay)\n setNotificationsDisplay(false)\n }",
"function configurarBarrasVideo(){\n\n ///////////////////////PROGRESO//////////////////////\n //Listener para cuando el usuario arrastre la barra de progreso\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates an array of active players' Ids | setActivePlayersIds() {
let activePlayersIds = [];
this.table.players.forEach((player) => {
if (player.active) {
activePlayersIds.push(player.id);
}
});
this.activePlayersIds = activePlayersIds;
} | [
"function getIdPlayers(){\n let { players } = state\n let playersId = []\n \n for (const playerId in players) {\n playersId.push(playerId) \n }\n return playersId \n }",
"function playerIdsInMatches(matches) {\n const playerIdSet = new S... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Usage : uses the mutation tool to mix around the matrices Arg : muteRate chance of mutation Return: | mutate(muteRate) {
this.hiddensInputs.mutate(muteRate);
this.hiddenshiddens.mutate(muteRate);
this.hiddensOutputs.mutate(muteRate);
} | [
"mutate() {\n this._genes.forEach((gene, idx) => {\n if (probability(this._mutationRate)) {\n if (idx) {\n this._genes[idx] = randomInArray(alphabet);\n } else {\n this._genes[0] = Math.random() * 10;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Custom type guard for StatusCodeString. Returns true if node is instance of StatusCodeString. Returns false otherwise. Also returns false for super interfaces of StatusCodeString. | function isStatusCodeString(node) {
return node.kind() == "StatusCodeString" && node.RAMLVersion() == "RAML08";
} | [
"function isStringType(node) {\n const objectType = typeChecker.getTypeAtLocation(service.esTreeNodeToTSNodeMap.get(node));\n return (0, util_1.getTypeName)(typeChecker, objectType) === 'string';\n }",
"function sc_isString(s) { return (s instanceof sc_String); }",
"isString() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets to the cache along with the timestamp | function setCache(key, value, fn) {
// the timestamp key
var timestamp_key = key + '.timestamp';
// params to set
var params = {};
// add in
params[key] = JSON.stringify(value);
params[timestamp_key] = new Date().getTime();
// get by the key
chrome.storage.local.set(params, function(){
// signal that we... | [
"_setCacheExpiry() {\n const oThis = this;\n\n oThis.cacheExpiry = 86400; // 24 hours\n }",
"set(file) {\n this.cache.set(file.path, file);\n }",
"setCache (state, args) {\n state.cache[args.property].args = args\n }",
"setCacheField() {\n return self.apos.migration.eachDoc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Crea un body a partir de una lista de objetos, ubicando los datos en la columna correspondiente | function CrearBody(listaObjetos, listaColumnas) {
var tabla = $("#tabla");
var tBody = $("<tbody></tbody>");
tBody.prop('id', 'tbody');
listaObjetos.forEach(function (vehiculo) {
var fila = $("<tr></tr>");
//Uso map para tomar el valor
var columnasTbod... | [
"function CrearBody(listaObjetos, listaColumnas) {\n var tabla = $(\"#tabla\");\n var tBody = $(\"<tbody></tbody>\");\n tBody.prop('id', 'tbody');\n listaObjetos.forEach(function (persona) {\n var fila = $(\"<tr></tr>\");\n //Uso map para tomar el valor\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Xpath for Form Tab | get formTab() {return browser.element("~Form");} | [
"get horseProfile_Form_Class() {return browser.element(\"//android.view.ViewGroup[3]/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup[1]/android.widget.TextView[1]\");}",
"get horseProfile_Form_Condition() {return browser.element(\"//android.view.ViewGroup[3]/android.view.ViewGroup/android.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
baynote_getUrlParamValue Get the value of a URL parameter Parameters paramName:the name of the parameter Return String that is the parameter value or the empty string if it is not found. | function baynote_getUrlParamValue(paramName) {
var url = window.location.href;
var regex = new RegExp("[\\?&\/]"+paramName+"=([^&#\/]*)");
var match = regex.exec(url);
if (!match){ return "";}
else{ return match[1];}
} | [
"function GetURLParameter(param)\n\t{\n\t\tvar pageURL = window.location.search.substring(1);\n\t\tvar urlVariables = pageURL.split(\"&\");\n\t\t\n\t\tfor (var i = 0; i < urlVariables.length; i++)\n\t\t{\n\t\t\tvar parameterName = urlVariables[i].split(\"=\");\n\t\t\t\n\t\t\tif (parameterName[0] == param)\n\t\t\t{\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calls GET /instance/:id with the given id then immediately calls PUT as a noop to restart the instance | restartInstance(instance) {
return $.ajax({
url: `${config.apiUrl}/instance/${instance._id}`,
method: 'PUT',
headers: {
'Girder-Token': this.get('tokenHandler').getWholeTaleAuthToken()
},
data: JSON.stringify(instance),
data... | [
"updateById(id, data) {\n return this.post('/' + id + '/edit', data);\n }",
"function startResourceGet(id) {\n return { type: START_RESOURCE_GET,\n id: id};\n}",
"function load (req, res, next, id) {\n Task.findOne({ id })\n .then((Task) => {\n req.Task = Task; // eslint-disable-line no-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Makes a shallow copy of region object | function copyRegionObject(copyFrom, copyTo) {
copyTo.vertical = copyFrom.vertical;
copyTo.children = copyFrom.children;
copyTo.widgets = copyFrom.widgets;
copyTo.width = copyFrom.width;
copyTo.height = copyFrom.height;
copyTo.owner = copyFrom.owner;
} | [
"getCopy(){\n\t\t/*Plan:\n\t\t1. Make a new State object\n\t\t2. Copy the points over using the Point constructor and setting endpoint state (leave strands array empty)\n\t\t3. Copy the strands over, using the Strand constructor to refer to newly created points and over/under stuff. Only need to directly set the id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Genera un objeto a partir de los campos dela seccion de Comidas de Representacion, donde los atributos son los inputs, verifica los valores y cuando sean vacios o 0, asigna un "N/A" | function generaObjetoInvitados(){
var contexto = $("#invitados_table");
var objetoFormulario = {
"nombreInvitado": $("#nombre", contexto).val(),
"puestoInvitado": $("#puesto", contexto).val(),
"empresaInvitado": $("#empresaInvitado", contexto).val(),
"tipoInvitado": $("#tipoInvitado", con... | [
"function validarCampo() {\n if (\n id_a.value == \"\" ||\n owner_a.value == \"\" ||\n capacity_a.value == \"\" ||\n cat_a.value == \"\" ||\n nombre_a.value == \"\"\n ) {\n return true;\n } else {\n return false;\n }\n}",
"function validaComidasRepresentacion(){\r\n\t\tvar idConceptoComid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get deactive HAC list | function getDeactiveHacs(){
var sql = "SELECT * FROM info_hac where activation_code is null or activation_code = 'NULL'";
var hacs = [];
executeSql(sql, null,
function(rows){
if(rows) hacs.push(rows);
},
function(err){
console.log("Error: failed when get deactive HAC list, " + err);
}
);
return hac... | [
"function getOfflineHacs(){\n\tvar sql = \"SELECT * FROM info_hac where state <> 1\";\n\tvar hacs = [];\n\texecuteSql(sql, null, \n\t\tfunction(rows){\n\t\t\tif(rows) hacs.push(rows);\n\t\t}, \n\t\tfunction(err){\n\t\t\tconsole.log(\"Error: failed when get offline HAC list, \" + err);\n\t\t}\n\t);\n\treturn hacs;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run the crunchy tool with credentials and config If the args prop is given, do not run batch operations | function runCrunchy(...args) {
crunchy(
(process.argv = [
'--user',
config.settings.crunchyroll.username,
'--pass',
config.settings.crunchyroll.password,
'--nametmpl',
'{SERIES_TITLE} - s{SEASON_NUMBER}e{EPISODE_NUMBER}',
'--output',
fs.realpathSync(config.settings.... | [
"run(config, compilerOptions) {\n\n let Uploader = this;\n\n // Set output to compiler output object.\n this.output = compilerOptions.output;\n\n // If options are passed, sync with class options.\n if (config.options) {\n this._syncOptions(config.options);\n }\n\n if (!this.options.autoRu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fill $els with body and window elements called on enter | initializeElements () {
this.$els = {
window,
body: document.body
}
} | [
"initAndPosition() {\n // Append the info panel to the body.\n $(\"body\").append(this.$el);\n }",
"function createElements() {\r\n _dom = {};\r\n createElementsForSelf();\r\n if (_opts.placement.popup) {\r\n createElementsForPopup();\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Waits for an element to exist, and be visible. | async waitForElementVisible (selector) {
var waitFor = this.waitFor.bind(this)
var findElement = this.findElement.bind(this)
return new Promise(async resolve => {
var isVisible = await waitFor(async () => {
var el = await findElement(selector)
return el && await el.isVisible()
})... | [
"async waitForElementNotVisible (selector) {\n var waitFor = this.waitFor.bind(this)\n var findElement = this.findElement.bind(this)\n return new Promise(async resolve => {\n var isHidden = await waitFor(async () => {\n var el = await findElement(selector)\n return !el || !await el.isVis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add root authorities to response. This is only used when no answer could be produced by us or the remote lookup. | function addRootAuthorities(resp) {
rootAuthorities.forEach(function (authority) {
resp.authority.push(dns.NS({
name: '',
data: authority + '.',
ttl: 518400
}));
});
} | [
"function annoyEveryoneWithResponse(res) {\n var target = res.message.room.toLowerCase();\n roomAssociations.forEach(function (association, i, associations) {\n association.rooms.forEach(function (room, j, rooms) {\n if (room.name.toLowerCase() == target || (room.old_name && room.old_name.toLowerC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Button Handler for saving Colour | function SaveColor(picker)
{
newColor = picker.toHEXString()
StoreColor(newColor)
} | [
"function Save_Username_Color (type) {\n if (type === \"save\") {\n var usercolor_llama = document.getElementById(\"llama_clear_usercolorsrc\").value\n document.documentElement.style.setProperty(\"--thememode-usernamecolor\", usercolor_llama)\n body.classList.add(\"usercolor\")\n localStorage.setItem(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcion que calcula la tasa de interes, a partir del monto mensual , los meses y el monto total | function tasaSimple(meses, monto_total, monto_men){
// var i = 0.05;
var resigual = monto_total / monto_men;
var res = 0;
i = 0.00;
// alert("resigual: " + resigual);
do{
i += 0.01;
res = (1 - (Math.pow((1 + i), -1 * meses))) / i ;
// alert(res);
}while(res>resigual);
// if ((Math.round(res* 100)... | [
"function extraer_tiempototal(horaini, horaact) {\n var diff;\n\n var fecha1 = horaini.substring(6, horaini.length - 2);\n var fecha2 = horaact.substring(6, horaini.length - 2);\n\n diff = fecha2 - fecha1;\n // calcular la diferencia en segundos\n var diffSegundos = Math.abs(diff / 1000);\n\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the parent content type of the content type. | get parent() {
return ContentType(this, "parent");
} | [
"get parent() {\n return tag.configure(ContentType(this, \"parent\"), \"ct.parent\");\n }",
"get parentFolder() {\n return Folder(this, \"parentFolder\");\n }",
"parent() {\n var selection = this.selected.anchorNode;\n // prevent '#text' node as element\n if (selection &... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getFromCache Prefetch is doing reference counting, if get a texture from Prefetch via getFromCache, must also call removeFromCache or removeTextureFromCache when the releasing the texture. | static getFromCache(uri) {
const key = RCTPrefetch.uriKey(uri);
if (RCTPrefetch.cache && RCTPrefetch.cache[key]) {
RCTPrefetch.cache[key].refs++;
return RCTPrefetch.cache[key].texture;
}
return null;
} | [
"static removeKeyFromCache(key) {\n if (RCTPrefetch.cache && RCTPrefetch.cache[key]) {\n RCTPrefetch.cache[key].refs--;\n if (RCTPrefetch.cache[key].refs <= 0) {\n RCTPrefetch.cache[key].texture.dispose();\n delete RCTPrefetch.cache[key];\n }\n }\n }",
"static addToCache(uri, t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sequentially fills the title categories | function fillTitles() {
setTimeout(() => catOneTitle_button.innerText = getRandomCategory(), 1000);
setTimeout(() => catTwoTitle_button.innerText = getRandomCategory(), 2000);
setTimeout(() => catThreeTitle_button.innerText = getRandomCategory(), 3000);
setTimeout(() => catFourTitle_butt... | [
"function build(videos,categories){\r\n for(var i=0;i<categories.length;i++){\t\t\t\t\t// Iterate through all the categories.\r\n var box = crappend(\"div\",document.body);\t\t\t// Create a div element for the category.\r\n box.className = \"box\";\t\t\t\t\t\t\t\t// Set the element to it's class.\r\n var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |