query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Calculate wait time based off of a combination of: number of currently open/claimed tickets mentors online average wait time Otherwise, "Uncertain" Based on the hypothetical scenario: If I were to put a ticket in now, how long should I expect before my ticket is claimed? A few cases: No tickets in the queue: All ticket... | function estimatedWait(){
// Get a list of the mentors who are online
var mentors = mentorsOnline();
// Get the currently active tickets
var tickets = activeTickets();
// Get the currently claimed tickets
var openTickets = tickets.filter(function(t){return t.status === "OPEN"});
var claimedTickets = ti... | [
"findTimeLeftInMempool(mempoolRequestedObject, TimeoutRequestsWindowTime) {\n let timeElapse = (new Date().getTime().toString().slice(0, -3)) - mempoolRequestedObject.status.requestTimeStamp;\n // subtract time elapsed from 5 minutes and return time left\n let timeLeft = (TimeoutRequestsWindowT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether a part ( node) and the corresponding token match. | function correctPart(token, part){
return !part.reduced && part.currentText == token.value && part.className == token.style;
} | [
"function checkTokenPart(tokenRoles, val, idx) {\n let match = false;\n tokenRoles.forEach((tokenRole) => {\n const tokenPart = tokenRole.split(\".\")[idx];\n if (tokenPart === val) match = true;\n });\n return match;\n}",
"function isPartOfNode(part, rootNode) {\n const parent = part.parent;\n\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gathers all of the elements needed for this controller | function gatherElements () {
elements = {
main: $element[0],
scrollContainer: $element[0].querySelector('.md-virtual-repeat-container'),
scroller: $element[0].querySelector('.md-virtual-repeat-scroller'),
ul: $element.find('ul')[0],
input: $element.find('input')[0],
wrap: $e... | [
"function gatherElements () {\n\n\t var snapWrap = gatherSnapWrap();\n\n\t elements = {\n\t main: $element[0],\n\t scrollContainer: $element[0].querySelector('.md-virtual-repeat-container'),\n\t scroller: $element[0].querySelector('.md-virtual-repeat-scroller'),\n\t ul: $element.find('... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Evaluates whether storage location is empty | static evalStorageLocationIsEmpty(dict) {
return (libVal.evalIsEmpty(libCom.getControlValue(dict.StorageLocationLstPkr)));
} | [
"static evalStorageLocationIsEmpty(dict) {\n return (libVal.evalIsEmpty(libCom.getListMultiplePickerValue(dict.StorageLocationLstPkr.getValue())));\n }",
"function hasLocationObjectInStorage() {\n var a = Store.getSession( constants.KEY_LOCATION );\n return a !== null && a !== undefined &&... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A query processor to be used to retrieve an event with a specified URI. | function SingleEventQueryProcessor(eventURI, eventHandler, noSuchEventHandler){
this.query = "PREFIX locn:<http://www.w3.org/ns/locn#>\n"+
"PREFIX wsg84:<http://www.w3.org/2003/01/geo/wgs84_pos#>\n"+
"PREFIX foaf:<http://xmlns.com/foaf/0.1/>\n"+
"PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>\n"+
"PREFIX... | [
"function EventQueryProcessor(eventQueryProcessor, currentDate, minDate, maxDate){\r\n\tthis.query = \"PREFIX locn:<http://www.w3.org/ns/locn#>\\n\"+\r\n\t\"PREFIX wsg84:<http://www.w3.org/2003/01/geo/wgs84_pos#>\\n\"+\r\n\t\"PREFIX foaf:<http://xmlns.com/foaf/0.1/>\\n\"+\r\n\t\"PREFIX rdfs:<http://www.w3.org/2000/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update event details. PUT or PATCH events/:id | async update({ params, request, auth, response }) {
const req = request.all()
const event = await Event.find(params.id)
if (!event) return response.notFound()
if (auth.user.cannot('edit', event)) return response.forbidden()
const updatedEvent = await this.event.edit(event, { ...req, admin: auth.us... | [
"function PutEvent(req, res, next) {\n const { knex } = req.app.locals;\n const { id } = req.params;\n const payload = req.body;\n knex('events')\n .where('event_id', id)\n .update(payload)\n .then(response => {\n if (response) {\n res.status(204).json(`Eve... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
supports_log_exports_to_cloudwatch computed: true, optional: false, required: false | get supportsLogExportsToCloudwatch() {
return this.getBooleanAttribute('supports_log_exports_to_cloudwatch');
} | [
"get enabledCloudwatchLogsExports() {\n return this.getListAttribute('enabled_cloudwatch_logs_exports');\n }",
"function Logger() {\n if(process.env.AZURE_STORAGE_ACCOUNT == undefined || process.env.AZURE_STORAGE_ACCESS_KEY == undefined) {\n\t enabled = false;\n }\n}",
"function configureCloudwatch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function `makeGridAndUpdateTooltip` gets the value of the slider updates the grid accordingly and updates in the tooltip too | function makeGridAndUpdateTooltip(){
const val = Number(slider.value);
makeGrid(val);
document.querySelector("#number").textContent = val;
} | [
"function updateTooltip(){\n //remove the tooltip\n d3.selectAll('.tooltip').remove();\n\n //create the tooltip againt\n div = d3.select('#slider-section').append(\"div\")\n .attr(\"class\", \"tooltip\")\n .style(\"opacity\", 0);\n }",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Project owner authentication. Executes pass() if the user owns the project. Executes fail() if they do not. | function authProjectOwner(id, username, pass, fail) {
db.get().collection('projects').find({ id: id, owner: username }).toArray((err, project) => {
if (err || project.length != 1) {
fail();
}
if (project.length == 1) {
pass();
}
});
} | [
"function authProjectAccess(id, username, pass, fail) {\n db.get().collection('projects').find({ id: id, $or: [{ owner: { $in: [username] } }, { collaborators: { $in: [username] } }, { viewers: { $in: [username] } }] }).toArray((err, project) => {\n if (err || project.length != 1) {\n fail();\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Try to convert old manga IDs to the latest version (e.g. when stored as bookmark). | _migratedMangaID( mangaID ) {
// /manga/8466/darwin-s-game
let v1 = mangaID.match( /^\/manga\/(\d+)\/.*$/ );
if( v1 ) {
return v1[1];
}
let v2 = mangaID.match( /^\d+$/ );
if( v2 ) {
return v2[0];
}
return mangaID;
} | [
"function replaceOldMaNames(ma){\n if(ma._id =='WG'){ma._id =\"CB\"}\n if(ma._id =='CE'){ma._id =\"CD\"}\n if(ma._id =='GS'){ma._id =\"SB\"}\n if(ma._id =='PM'){ma._id =\"NB\"}\n }",
"function fixOldSave(oldVersion){\n}",
"function unshortenID(mid) {\n // al... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
move the player character or another agent. an agent is any game object that is able to move | function move (agent) {
if (!isGameRunning) {
return; // don't calculate any movement if game is paused
}
// logic to make an agent rise and fall
checkFalling(agent);
// logic to make an agent move or the background scroll
if (agent.isLeft) {
moveLeft(agent);
} else if (agent.isRight) {
move... | [
"function move(direction) {}",
"computerMove() {\r\n const index = this.agent.policy(this.game);\r\n this.game.move(index);\r\n }",
"moveCharacter(character) {\n // ensure call shouldMove method shouldMove()\n if (character.shouldMove()) {\n const { nextMovePos, dir... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a number to guess | function generateNumber() {
numberToGuess = Math.floor(Math.random() * (max - min + 1)) + min;
console.log(numberToGuess);
return numberToGuess;
} | [
"function generateGuess() {\n\t\tvar myGuess = Math.floor(Math.random() * 100) + 1;\n\t\tconsole.log(\"Secret number: \" + myGuess);\n\t\treturn myGuess;\n\t}",
"function getRandomNum() {\n randomTarget = Math.floor(Math.random() * 101) + 19;\n $(\"#number-to-guess\").text(randomTarget);\n }",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the resource IDs of all certificates associated with a specific provisioning profile. | function getAllCertificateIdsForProfile(api, id, query) {
return api_1.GET(api, `/profiles/${id}/relationships/certificates`, {
query,
})
} | [
"function listAllCertificatesForProfile(api, id, query) {\n return api_1.GET(api, `/profiles/${id}/certificates`, { query })\n}",
"async listCerts() {\n const method = await axios({\n method: 'get',\n url: 'https://api.securesign.org/certificates',\n headers: {'authorization': this._hash}\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set north panel size | function setNorthSize(pp) {
if (!pp.length) return;
var ppopts = pp.panel('options');
pp.panel('resize', {
width: cc.width(),
height: ppopts.height,
left: 0,
top: 0
});
cpos.top += ppopts.height;
... | [
"function setNorthSize(pp){\n\t\t\tif (!pp.length) return;\n\t\t\tvar height = getPanelHeight(pp);\n\t\t\tpp.panel('resize', {\n\t\t\t\twidth: cc.width(),\n\t\t\t\theight: height,\n\t\t\t\tleft: 0,\n\t\t\t\ttop: 0\n\t\t\t});\n\t\t\tcpos.top += height;\n\t\t\tcpos.height -= height;\n\t\t}",
"function setNorthSize(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Play Again Quiz redirect | function playAgainQuiz()
{
window.location.replace('game.html');
} | [
"function gotoQuiz(e){\n\n\tif(quiz_url.length>0){\n\t\twindow.location.href = quiz_url;\n\t}\n\telse{\n\t\talert('no quiz url defined');\n\t}\n\n}",
"function backtoquiz(){\n location.reload();\n}",
"function exitQuiz() {window.location.href = \"index.html\";}",
"function restartQuiz() {\n window.locat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if we are detecting taps and have one | function didTap() {
//Enure we dont return 0 or null for false values
return !!(validateTap() && hasTap());
} | [
"function didTap() {\r\n\t\t //Enure we dont return 0 or null for false values\r\n\t\t\treturn !!(validateTap() && hasTap());\r\n\t\t}",
"function didTap() {\r\n //Enure we dont return 0 or null for false values\r\n return !!(validateTap() && hasTap());\r\n }",
"function hasDoubleTap() {\r\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Based on the config get the layout | getLayout(layout, config){
switch(layout){
case "layout1":
return <Layout1 {...config} />
case "layout2":
return <Layout2 {...config} />
case "layout3":
... | [
"static getLayout(){\n if (!this.layout || config.debug.isDebug) {\n this.layout = HTTP.call('GET', Meteor.absoluteUrl()).content;\n }\n return this.layout;\n }",
"layout() {\n return this.text(poc2go.config.design.layout.html)\n .then(htm => {poc2go.render._layout = new L... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
keyup on svg event | function d3_keyup() {
lastKeyDown = -1;
// ctrl
if (!d3.event.ctrlKey) {
rect.on('mousedown.drag', null)
.on('touchstart.drag', null);
svg.classed('ctrl', false);
}
} | [
"onElementKeyUp(event) {}",
"onElementKeyPress(event) {}",
"function keyupListener() {\n\n}",
"function keyUp(event) {}",
"svgKeyDown() {\n\t\tlet {internalFlags, constants} = this;\n\t\t// make sure repeated key presses don't register for each keydown\n\t\tif (internalFlags.lastKeyDown !== -1) return;\n\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utility function to find the player name of a given colour. | function getPlayerName(room, colour) {
var game = games[room];
for (var p in game.players) {
var player = game.players[p];
if (player.colour === colour) {
return player.name;
}
}
} | [
"function playerColor(name) {\n var playerIndex = getPlayerIndex(name);\n switch( playerIndex ){\n case 0:\n return \"blue\";\n break;\n case 1:\n return \"red\";\n break;\n default:\n return \"black\";\n break;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check it the expression end with ")" (this._methodCall) and the identifier type is an object... | getMakeMethodCall(identifier) {
return identifier.getType && (identifier.getType().type instanceof Objct) && this._methodCall;
} | [
"function is_object_expression(stmt) {\n return is_tagged_list(stmt, \"object_expression\");\n}",
"getMakeMethodCall(identifier) {\n return identifier.getType && (identifier.getType().type instanceof Objct) && this._methodCall;\n }",
"function checkCallExpression(node) {\n if (!check... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks which data attributes are defined | function checkDataAttributes(obj) {
$.each(customSettings, function (index, attribute) {
if (obj.data(attribute) != undefined) {
customSettingsObj[attribute] = obj.data(attribute);
} else {
customSettingsObj[attribut... | [
"function checkDataAttributes(el) {\n $.each(customSettings, function (index, attribute) {\n if (el.data(attribute) != undefined) {\n settings[attribute] = el.data(attribute);\n } else {\n settings[attribute] = $(defa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns estimated max height of an element. | function estimateElementMaxHeight(element) {
var maxHeightString = window.getComputedStyle(element).maxHeight;
if (maxHeightString.indexOf('%') !== -1) {
return getPercentageHeight(element, maxHeightString);
}
if (maxHeightString.indexOf('em') !== -1) {
return getEmHeight(element, maxHeightString);
}... | [
"function getHighestHeight($elem){\n var eHeight = $elem.map(function(){\n return j(this).height();\n });\n \n var maxHeight = Math.max.apply(null, eHeight);\n \n $elem.height(maxHeight);\n\n }",
"function getHeight(elem) {\n return parseInt(getSt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
region bind data to grid mtop package | function bindDataToJqGridMtopPackage(factory, plnStartDate, plnEndDate, buyer, styleInfo, aoNo) {
jQuery('#tbMtopPackage').jqGrid({
url: '/Planning/GetProductionPackage',
postData: {
factoryId: factory, startDate: plnStartDate, endDate: plnEndDate, buyer: buyer, styleInfo: styleInfo... | [
"function bindGrid() {\n grid.picker = _self;\n }",
"function loadGrid() {\n \n }",
"function _prepareGrid(data) {\n try {\n for (var i = 0; i < data.length; i++) {\n var rangeObj = Enumerable.From(vm.fieldTitleList).FirstOrDefault(null, funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes the field with the specified field internal name from the collection. | remove(fieldInternalName) {
return this.clone(ViewFields_1, `removeviewfield('${fieldInternalName}')`).postCore();
} | [
"function removeField(field)\n\t{\n\t\tvar index = _.chain(this.fields).pluck('$$hashKey').indexOf(field.$$hashKey).value();\n\n\t\tif (index > -1)\n\t\t{\n\t\t\tthis.fields.splice(index, 1);\n\t\t\tthis.status = 'Save';\n\t\t}\n\t}",
"remove(fieldInternalName) {\n return spPost(this.clone(ViewFields, `rem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generates simon Says game | function generateSimon() {
var gameInfo = {
type: "simonGame",
answer: [],
data: false
};
for (var i = 0; i < difficulty + 2; i++) {
gameInfo.answer[i] = getNum();
}
// Get a random number between 1-4 used for random sequence.
function getNum() {
... | [
"function generateSimon() {\n \n gridLevel = (level + 1) * (level + 1); \n \n simonsays = [];\n\n simonsays.push(\n buttons[Math.floor(Math.random() * (gridLevel))]\n );\n \n flashSimon(0);\n\n}",
"function simonSays() {\n let gameCount = simonSettings.getCount();\n\n //Start sequence gene... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Do not display the current line if it contains texte | doNotDisplayLineText() {
this._ignoredLine = true;
} | [
"_shouldDisplayLine(line) {\r\n return line.length > 0 && !this._ignoredLine;\r\n }",
"function textLine(line) {\n return line.charAt(0) != CONTROL;\n}",
"isPrecededByWhitespaceOnly() {\n var lineBeforeCurrent = this.text.substring(this.index - this.column + 1, this.index);\n return (/^\\s*$/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
assigns the waypoint the given type | function setWaypointType(wpIndex, type) {
var el = $('#' + wpIndex);
el.removeClass('unset');
el.removeClass('start');
el.removeClass('via');
el.removeClass('end');
el.addClass(type);
} | [
"function updateTravelType(type) {\n options.travelType = type.dataset.type;\n console.log(`TravelType updated to ${options.travelType}`)\n getRoute();\n}",
"function setWaypointType(featureId, type) {\n var feature = this.layerRoutePoints.getLayer(featureId);\n if (feature) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
scene one draws/animates a space flying and landing | function sceneOne() {
//counting scnene time elapsed
if (TIME - timer > 1) {
sceneTimers[0] += (TIME - timer);
timer = TIME;
}
if (sceneTimers[0] < 8) {
//flickering the fire
if (TIME - fireTime > 0.5 && shipCoordinates[1] > 0) {
fireTime = TIME;
... | [
"function slideShip() {\n new TWEEN.Tween(boat.position)\n .to({\n z: -5000\n }, 10000)\n .easing( TWEEN.Easing.Linear.None )\n .onStart( function() {\n boat.material.transparent = true;\n })\n .onUpdate( function() {\n renderer.render(sc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if word contains any uppercase letter | function containsUppercaseLetter(word) {
for (var i = 0; i < word.length; i++) {
var char = word[i];
if (char.toUpperCase() === char && char.toLowerCase() !== char) {
return true;
}
}
return false;
} | [
"function is_uppercase(word) {\n return (uppercase.indexOf(word.charAt(0)) != -1 ? true : false);\n}",
"function containsUpperCase(text){\r\n return /['A-Z']/.test(text);\r\n}",
"function containsUpperCase(word) {\n\tlet upperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\tlet result = false;\n\tword.split('').fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load nodes collection repository | function loadNodesCollectionRepository(containerClass) {
var filterAssigned = $('input[name="assigned"]:checked').val();
var filterPublished = $('input[name="published"]:checked').val();
var sortFilter = $('select[name="sort-by"]');
var sort = (sortFilter.length > 0)
? sortFilter.val()
... | [
"function loadNodes(){\n storage.nodes = JSON.parse(localStorage.getItem('nodes') || '[]');\n }",
"function load_tree()\n{\n RMPApplication.debug (\"begin load_tree\");\n c_debug(debug.item, \"=> begin load_tree\");\n\n // query tree collection (capi)\n var input = {};\n var options = {};... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all event objects from JSON file | function getEvents(callback){
fs.readFile('data/data.json', 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
parsedData = JSON.parse(data);
callback(parsedData.events)
});
} | [
"function parseJSON2list(jsonFile) {\n events = []\n for (let key in jsonFile) {\n var event = {\n name: (jsonFile[key].name).replace(/(\\r\\n|\\n|\\r)/gm, \"\"),\n start: new Date(jsonFile[key].start_time),\n end: new Date(jsonFile[key].end_time),\n url: \"h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generic function to fill in a table starting from an array of objects | function tableFill(table, list) {
for(const obj of list) {
const newRow = document.createElement("tr");
table.appendChild(newRow);
for(const property in obj) {
let newCell = document.createElement("td");
newRow.appendChild(newCell);
newCell.textContent = o... | [
"function fillInTable(data){\n for (index = 0; index < data.length; ++index) {\n addRowToTable(data[index]);\n }\n\n }",
"function fillTable(prevArray, emptyColArray){\n\n var keys = Object.keys(prevArray);\n indexArray.push(prevArray[\"_id\"]);//maintain an index array to know i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Question 3: Write a function addCountry that adds a European country to the countries object (inside of the continents object, inside of the countries object). The country you add should be an object with the key as name of the country and the value as an object with the keys of "capital" and "population" and their res... | function addCountry(countryName, countryCapital, countryPopulation) {
var countriesObject = nestedObject.data.continents.europe.countries;
countriesObject[countryName] = ({capital: countryCapital, population: countryPopulation});
return countriesObject;
} | [
"function addCountry(country, capital, population) {\n var countriesObj = nestedObject.data.continents.europe.countries;\n countriesObj[country] = {\n capital: capital,\n population: population\n };\n}",
"function addCountry(country, capital, population) {\n nestedObject.data.continents.eu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A setup function that uses the conference data in the spreadsheet to create Google Calendar events, a Google Form, and a trigger that allows the script to react to form responses. | function setUpConference_() {
if (ScriptProperties.getProperty('calId')) {
Browser.msgBox('Your event is already set up. Look in Google Drive!');
}
var ss = SpreadsheetApp.getActive();
var sheet = ss.getSheetByName('DemoSetup');
var range = sheet.getDataRange();
var values = range.getValues();
setUpCa... | [
"function setUpConference_() {\n if (ScriptProperties.getProperty('calId')) {\n Browser.msgBox('Your conference is already set up. Look in Google Calendar!');\n }\n \n var ss = SpreadsheetApp.getActive();\n var sheet = ss.getSheets()[0];\n var range = sheet.getDataRange();\n var values = range.getValues()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function adds a block of a given type ("text","img","artifact") | function appendBlock(blockContent, block_type) {
var container = document.createElement('div'),
keybar = document.createElement('div'),
buttons = ['top', 'bottom', 'delete', 'addmarker', 'removemarker'];
if (block_type == "artifact") {
buttons = ['top', 'bottom', 'delete', 'addmarkerArti... | [
"function addBlock(type, templateId) {\n\t// Initialize the block and add it to the block list \n\tvar block = new blockNamespace[type]();\n\tvar blockId = blockList.addBlock(block);\n\t// duplicate html into visible list\n\tvar template = $('#'+templateId).outerHTML();\n\tvar adjustedBlock = $(template).attr(\"id\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handler for saving app language list | function SetAppLanguages( appid )
{
AppsAjaxRequest( g_szBaseURL + '/apps/savelanguages/' + appid,
$('languages_form').serialize(true),
function( results )
{
StandardCallback( results, 'locOutput' );
}
);
} | [
"recordAddLanguages() {}",
"function storeLanguagesSet() {\n output('storeLanguagesSet', arguments, 'lime');\n const lngsType = ['native', 'foreign'],\n langs = {};\n // go through all (2) selects\n $(langSelects).each((index, select) => {\n langs[lngsType[index]] = $(select).val();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move to given inline | moveToInline(inline, index) {
this.currentWidget = inline.line;
this.offset = this.currentWidget.getOffset(inline, index);
//Updates physical position in current page.
this.updatePhysicalPosition(true);
} | [
"getPhysicalPositionInline(inline, index, moveNextLine) {\n let element = undefined;\n element = this.getElementBox(inline, index, moveNextLine).element;\n let lineWidget = undefined;\n if (isNullOrUndefined(element) || isNullOrUndefined(element.line)) {\n if (inline instanceo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function creation via requete ajax(create_account.php) | function creation(){
$("#créer").click(function(){
$.ajax({
url : "create_account.php",
type : "POST",
data : {
nom : $("#nom").val(),
prenom : $("#prenom").val(),
pseudo : $("#pseudo").val(),
mdp : $("#mdp")... | [
"function createAccount()\n{\n\t$.ajax({\n\t\ttype: 'POST',\t\n\t\turl: 'ajax/createAccount.php',\n\t\tdata: {\n\t\t\temail: $(\"#newEmail\").val(),\n\t\t\tdisplayName: $(\"#newDisplayName\").val(),\n\t\t\tpassword: $(\"#newPassword\").val(),\n\t\t},\n\t\tsuccess: function(data) {\n\n\t\t\tif(data.substring(0,5) ==... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates grid option from existing canvas | changeCanvasGrid(c, opt = {}){
opt.tool = this;
let rTarget = new RenderTarget(c, opt);
rTarget.calcZoom(this.pattern.width, this.pattern.texWidth);
// find this canvas in our stored canvases
let index;
const found = this.renderTargets.some((item, idx) => {
if (item.canvas === rTarget.can... | [
"function drawGrid(canvas) {\n\n}",
"function applyGridSize() {\n switch (gridSize.value) {\n case 'large':\n canvas.innerHTML = '';\n gridRows = 50;\n gridCols = 50;\n populateCanvas(gridRows, gridCols);\n saveCanvas('Z660o8DSqY-current');\n break;\n case 'medium':\n can... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get list of Header Columns for grid display from question config | function _getHeaderColumns() {
var arr = new Array($scope.questionConfig.questions.length);
var propCount = 0;
// QUick hack,,, as IsEmpty not working
for (var prm in $scope.questionConfig.param)
propCount++;
if (propCount == 0) {
arr[propCount++] = "";
... | [
"function getGridColumns() {\n var items = InquiryGeneralViewModel.Fields;\n var length = items.length;\n var cols = [];\n var numbers = [\"int32\", \"int64\", \"int16\", \"integer\", \"long\", \"byte\", \"real\", \"decimal\"];\n var groupable = InquiryGeneralViewModel.IsAdhocQuer... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start > 45 > 38 > 59 > 12 > 49 References: p, q, end end will be null in first pass it will refer last node in second pass it will refer second last node in third pass stop when end refers to second node starting point: p = start, q = p.link; so p will refer to first node and q will refer to second node Stop when p.lin... | BubbleSortExData(e) {
e.preventDefault();
if (!this.state.start) {
console.log('empty list');
return;
}
console.log('state is ', this.state);
/*var start = 'a1';
var node = {
a1: {id: 'a1', data: 45, link: 'a2'},
a2: {id: 'a2', data: 38, link: 'a3'},
a3: {id: 'a3', ... | [
"swapNodes(data1, data2) {\n let node1 = this.head;\n let node2 = this.head;\n let node1Prev = null;\n let node2Prev = null;\n \n //checks if the input data is the same\n if (data1 === data2) {\n console.log('Elements are the same - no swap needed.');\n return;\n }\n\n //used to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enable all the fields in the specified container | function enableContainer(container){
jq(container + ' :input').attr('disabled', false).fadeTo(250, 1);
jq(container + ' :input').prop('checked', false).fadeTo(250, 1);
} | [
"function enableAllFields(){\n enableField(\"helpdesk_sla_steps.em_id\");\n enableField(\"helpdesk_sla_steps.role\");\n}",
"function enableContainerByID(fieldid) {\n\t// hide the respective tbody and disable any HTML controls\n\t$(\"#\" + fieldid).show();\n\t$(\"#\" + fieldid + \" input, #\" + fieldid + \" ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcion que muestra el modal informando del usuario a eliminar. | function eliminaUsuario(login, id){
var mensaje="<h3 style='color: #f60510; text-align:center'>El usuario "+login+" será eliminado.</h3>";
var textoHTML = '<div class="modal fade" id="mostrarmodal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">'
textoHTML+='<div class="modal-dial... | [
"function Eliminar_persona(id,nom,action){\r\n var men = document.getElementById('body-modal_eliminar');\r\n var Value = 'esta seguro que desea eliminar el usuario llamano '.concat(nom, '');\r\n men.innerHTML = Value;\r\n document.getElementById('id').value=id;\r\n document.forms.delete.action=action;\r\n $(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update currentFeature when FeatureMenu triggers the callback | toggleFeature(currentFeature) {
this.setState({ currentFeature });
} | [
"function featureChangeListener() {\n if (this.selectedOptions.length > 0) {\n var selOpt = this.selectedOptions[0].value;\n selected_feature = selOpt;\n updateAll();\n }\n}",
"function updateFeatureInformation() {\n\t\t// retrieve data from form\n\t\tfeatureId = dijit.byId(\"feature_id\").attr(\"value... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
append the object and delete button to DOM | function appendDom(object){
$('.people').append('<div class="person"></div>');
var $el = $('.people').children().last();
$el.append('<h2>' + "firstname: " + object.firstname + '</h2>');
$el.append('<h2>' + "lastname: " + object.lastname + '</h2>');
$el.append('<p>' + "employee id: " + object.id + '... | [
"function addDeleteButton($element){\n $element.append('<a class=\"delete-element\" href=\"#\"><span>'+ o.deleteText +'</span></a>');\n\n $element.children('.delete-element').bind('click', function(event){\n event.preventDefault();\n deleteClone($e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Cleans up subs that ran and should run only once. | cleanup(sub) {
if (sub.isOnce && sub.isExecuted) {
let i = this._subscriptions.indexOf(sub);
if (i > -1) {
this._subscriptions.splice(i, 1);
}
}
} | [
"cleanup(sub) {\r\n if (sub.isOnce && sub.isExecuted) {\r\n let i = this._subscriptions.indexOf(sub);\r\n if (i > -1) {\r\n this._subscriptions.splice(i, 1);\r\n }\r\n }\r\n }",
"cleanup() {\n debug(\"cleanup\");\n this.subs.forEach((s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clean up the images destination folder | function runCleanImg(cb) {
del(global.getDest('img'), cb);
} | [
"function cleanDistImages() {\n return del([\"dist/img/*\"]);\n}",
"function clean_img() {\n return del('./dist/img/');\n}",
"function clean(cb) {\n rimraf(DIST + '/img', cb);\n}",
"function cleanimg() {\n return del('frontend/prod/images/**/*', { force: true })\n}",
"function delJpeg() {\r\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function that plays the next level sound at the conclusion of the level | advanceLevel() {
this.advanceLevelSound.play();
} | [
"function OnLevelWasLoaded( level : int )\n {\n if ( level == 0 ) //play music when you first enter the game\n {\n audio.Stop();\n audio.clip = secrets;\n audio.Play();\n }\n else if ( level == 10 ) //when you get to forest, change music\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION/METHOD returns underlying character if the letter has been guessed correctly or a placeholder/underscore if the letter has not been guessed | showLetter() {
if(this.isGuessed) {
return this.character;
} else {
return "_"
}
} | [
"returnChar() {\n if (this.guessed) {\n return this.char;\n }\n else {\n return (\"_\");\n }\n }",
"renderLetter() {\n return this.guess ? this.stringValue : \"_\"\n }",
"function guessLetter(letter) {\n\n}",
"returnLetter() {\n if (this.guessed) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Metodo per calcolare la trendline statica basata sul valore minimo | function getStaticMinValueTrendline(points) {
var min = Math.min(...points);
var trendline = [];
for (var i = 0; i < points.length; i++) {
trendline.push(min);
}
return trendline;
} | [
"drawTrendline() {\n let sortedData = this.data.reverse();\n let xSeries = d3.range(1, sortedData.length + 1)\n let ySeriesNumFires = sortedData.map((d) => d.numFires);\n let ySeriesTotalAcres = sortedData.map((d) => d.totalAcres);\n\n let lsqNumFires = this.leastSquares(xSeries, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getAt(idx): get val at idx. | getAt(idx) {
if(idx >= this.length || idx < 0) {
throw new Error("Invalid index.");
}
return this._get(idx).val;
} | [
"getAt(idx) {\n return this._get(idx).val;\n }",
"getAt(idx) {\n return this.val[idx]\n }",
"getAt(idx) {\n\n const currNode = this.positionToIdx(idx);\n\n return currNode.val;\n\n }",
"getAt(idx) {\n return this.getNodeAt(idx)?.val;\n }",
"getAt(idx) {\n //Checks for a valid ind... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
END PERFORMANCE CRITICAL ELEMENTS QUERY VALUES | function getCritElemsPerformance( queryConfigObj ){
} | [
"function utilPointQuery3() {\nvar query = testUtilPt.createQuery();\n\n// CP: undefined, Company: undefined\nif (cpValue === undefined && companyValue === undefined) {\nquery.where = \"1=1\";\n\n// CP: None, Company: !None\n} else if (cpValue === 'None' && companyValue !== 'None') {\nquery.where = \"Company = '\" ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the focus element id matches the passed id | function isFocusElement(id) {
var focusElement = $(':focus');
return focusElement.length > 0 && focusElement.attr("id") !== undefined && focusElement.attr("id").toLowerCase() == id.toLowerCase();
} | [
"function doesElementContainFocus(element) {\n var document = dom_1.getDocument(element);\n var currentActiveElement = document && document.activeElement;\n if (currentActiveElement && dom_1.elementContains(element, currentActiveElement)) {\n return true;\n }\n return false;\n}",
"function H... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
subscribe the store so that data can be update when Payment.downloadAllRecord no matter by init download or socket.io triggered | componentWillMount() {
this.unSub = Store.subscribe(() => {
this.filterRecord();
})
Payment.downloadAllRecord(
() => {
UI.showMessageDialog('Network Error', "Records Check");
}, () => {
console.log('download done');
... | [
"_subscribe() {\n wsocket().on('bartend-app', 'current/update', 'bartend', (update, err) => {\n if (err != null) {\n console.log(err);\n return\n }\n if (update == null) {\n return\n }\n if (update.complete !=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create Middleware to verify admin starts | function verifyAdmin(req, res, next) {
if (!!req.headers.fromweb) {
if (!req.headers.authtoken) {
return res.status(401).send({
success: false,
STATUSCODE: 4200,
message: "Unathourized Request",
response: {}
});
... | [
"function adminAuthentication (req, res, next) {\r\n console.log('Only admins')\r\n try {\r\n const token = req.headers.authorization.split(' ')[1]\r\n const payload = jwt.verify(token, firm)\r\n if (payload && payload.admin === 1) {\r\n return next()\r\n } else {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decides based on open property the display of body. | decideCollapseBodyDisplay() {
if (this.itemBodyEl) {
this.itemBodyEl.toggle(this.open);
}
} | [
"get open() {\n\t\treturn this.hasAttribute( 'open' );\n\t}",
"get open() {\n return this.hasAttribute('open');\n }",
"__setDefaultState() {\n if (!this.opened && this._contentNode) {\n this._contentNode.style.setProperty('display', 'none');\n }\n }",
"isEditorOpen() {\n return do... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle the checked state of all visible links. | function toggleAll() {
var checked = document.getElementById('toggle_all').checked;
for (var i = 0; i < visibleLinks.length; ++i) {
document.getElementById('check' + i).checked = checked;
}
} | [
"function toggleAll() {\n var checked = document.getElementById('toggleAllCheckBox').checked;\n for (var i = 0; i < visibleLinks.length; ++i) {\n document.getElementById('check' + i).checked = checked;\n }\n}",
"function toggleAll() {\r\n var checked = document.getElementById('toggle_all').checked;\r\n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
OPTIONAL CHALLENGE 1 write a function that takes in two parameters, x and n, and computes x to the nth power you may not use Math. functions | function nthpower(x, n) {
var answer = 1;
for (var i = 0; i < n; i++) {
answer *= x;
}
return answer;
} | [
"powerFunction(x, n) {\n let result = 1;\n\n for (let i = 0; i < n; i++) {\n result = result * x;\n }\n\n return result;\n }",
"function pow(x, n) { \n return x**n \n }",
"function pow(x,n) {\n return x ** n ;\n}",
"function pow(x,n) {\n var result = 1;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end upload avatar MatHang function convertArray Barcodet to string | function convertBarcodeToString(arrayBarcode) {
var barcode = '';
if (arrayBarcode && arrayBarcode.length > 0) {
angular.forEach(arrayBarcode, function (v, k) {
if (v.text && v.text != '') {
barcode += v.text + ';';
... | [
"createBarcodesPNGBuffers(codeArray) {\r\n let promise = new Promise((resolve, reject) => {\r\n let barcodeArray = [];\r\n for (var i = 0; i < codeArray.length; i++) {\r\n bwipjs.toBuffer({\r\n bcid: 'code128',\r\n text: codeArray[i].... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create interstitial ad and wait for showing trigger | function createInterstitial(){
//if(AdMob) AdMob.prepareInterstitial( {adId:defaultID.interstitial, autoShow:false} );
AdMob.prepareInterstitial({
adId: defaultID.interstitial,
isTesting: true, // TODO: remove this line when release
autoShow: false
});
} | [
"function showInterstitial(){\n removeEventListener();\n if (timeoutInstance != null) clearTimeout(timeoutInstance);\n that.$_adWrapper.slideDown('slow');\n }",
"function showInterstitial() {\n admob.isInterstitialReady(function (isReady) {\n if (isReady) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Emit a change event if the data is changed param newData the data that we're updating to private | function emitOnDiff(oldData) {
if (oldData !== data) {
changeEmitter.emit('change', data);
}
} | [
"notifyDataChanged() {\n this.hasDataChangesProperty = true;\n this.dataChanged.raiseEvent();\n }",
"function dataWatchFn(newData, oldData) {\n\t if (newData !== oldData){\n\t if (!scope._config.disabled) {\n\t scope... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Private helper for recursive depthfirst search topological sort. The 'topoArrRev' argument is a running array of reversesorted nodes. | function toposortDfs(node, topoArrRev) {
if (node._topo === Topo.TEMP) {
throw new Error('Unexpected internal error: cycle found during ' +
'topological sort of node "' + node.id + '"');
}
if (node._status !== Status.REACHABLE || node._topo === Topo.ADDED) {
return;
}
node._topo ... | [
"function traverseRevTree(revs, callback) {\n\t var toVisit = revs.slice();\n\t\n\t var node;\n\t while ((node = toVisit.pop())) {\n\t var pos = node.pos;\n\t var tree = node.ids;\n\t var branches = tree[2];\n\t var newCtx =\n\t callback(branches.length === 0, pos, tree[0], node.ctx, tree[1]);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The last IObjectPath instance added to this collection | get last() {
if (this._paths.length < 1) {
return null;
}
return this._paths[this.lastIndex];
} | [
"_saveObject() {\n if (!this._currentObject.containsSegments()) return;\n\n this._objects.push(this._currentObject);\n this._currentObject = new Line();\n }",
"get lastIndex() {\r\n return this._paths.length - 1;\r\n }",
"pop() {\r\n this._path.pop();\r\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onclick function for the 'Shuffle Class' button. Should get all the names on the list. Hint: try using document.querySelectorAll Should shuffle the names. Hint: use shuffleNamesArray Should replace original order of names with the shuffled order. | function shuffleClass() {
console.log('shuffle class was clicked!')
const shuff = document.querySelectorAll("#fellow-list > li")
const tempFellow = shuff.length
let newArray = []
for (let i=0; i< tempFellow; i++ ){
const developer = shuff.item(i).textContent
newArray.push... | [
"function shuffleClass() {\n console.log('shuffle class was clicked!')\n let namesList = document.querySelectorAll(\"#fellow-list li\")\n let allNames = []\n for(let name of namesList){\n allNames.push(name.textContent)\n }\n document.getElementById(\"fellow-list\").innerHTML = shuffleNames... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds the spell in a slot to the spell list | function addSpellFromSlot(slot) {
'use strict';
var superfix = null;
var tab = getParentTab(slot);
if (tab !== null) {
superfix = tab.getAttribute('superfix');
}
addSpell(slot.textContent, superfix, false);
} | [
"append(collection, ...things) {\n spellCore.addAtPosition(collection, spellCore.itemCountOf(collection) + 1, ...things)\n }",
"function giveSword() {\n player.items.push(items.sword)\n}",
"function giveSword() {\n target.items.push(items.sword);\n\n}",
"function addSpellShot(index) {\n spellShots.pu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
podPress_compare_v1_v2 compares to version strings or numbers | function podPress_compare_v1_v2(v1, v2) {
if ( ((typeof v1 == 'string' && false == podPress_is_emptystr(v1)) || typeof v1 == 'number') && ((typeof v2 == 'string' && false == podPress_is_emptystr(v1)) || typeof v2 == 'number') ) {
var v1_parts = String(v1).split('.');
var v2_parts = String(v2).split('.');
... | [
"function version_compare(ver1, ver2) {\n const ver1_arr = parse_ver(ver1);\n const ver2_arr = parse_ver(ver2);\n const max_length = Math.max(ver1_arr.length, ver2_arr.length);\n for (let i = 0; i < max_length; ++i) {\n const comp1 = ver1_arr[i] || 0;\n const comp2 = ver2_arr[i] || 0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prompt for checking if member exists | function promptMemberExists() {
inquirer.prompt([
{
type: 'input',
message: "Enter key:",
name: "key"
},
{
type: 'input',
message: "Enter value:",
name: "value"
}
]).then((answers) => {
console.log(me... | [
"isMember(member) {\n commonActions.click(this.membersTabPane);\n let memberName = commonActions.getUserFromKey(member);\n commonActions.pause();\n return browser.isExisting(`//div[@class=\"member-list-item-detail\"]\n /descendant::span[contains(@title,\"${memberName.username}\")]`);\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove all text and artists when appending related artists | function removeAll(){
d3.selectAll(".announcementText").remove()
d3.selectAll(".circle").remove()
d3.selectAll(".lastfmurl").remove()
d3.selectAll(".artistname").remove()
d3.selectAll(".axis").remove()
d3.selectAll(".radio").remove()
} | [
"function clearArtistAlbums(){\n var parent = document.getElementById(\"artist\");\n var children = parent.childNodes;\n var childrenToRemove = [];\n for(child of children){\n if(child.firstChild != null && child.getAttribute(\"class\") == \"innerContainer\"){\n childrenToRemove.push(c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: createFormElementStrings DESCRIPTION: This function creates the form element strings that will be used to create the final form. ARGUMENTS: none RETURNS: nothing | function createFormElementStrings(rowInfoArr)
{
var nRows = rowInfoArr.length;
var formElemStrArr = new Array();
for (var i = 0; i < nRows; i++)
{
var currRowInfoObj = rowInfoArr[i];
var fieldInfoObj = currRowInfoObj.displayAs;
fieldInfoObj.fieldName = currRowInfoObj.fieldName;
var fieldLabel... | [
"buildTaskForm() {\n const section = build.elementWithTextCreator(\"section\", undefined, \"taskSection\", undefined)\n const form = build.elementWithTextCreator(\"form\", undefined, \"buildFormTask\", undefined);\n section.appendChild(form);\n\n const labelForName = build.elementWithTextCreator(\"label... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove client by index | REMOVE_CLIENT( state, index) {
state.clients.splice(index, 1);
} | [
"function _removeByIndex (index) {\n _clients.splice(index, 1);\n }",
"handleClientDelete(index){\n\n monit.monitIn(\"CLIENTLIST\",\"handleClientDelete\",2);\n\n this.allclients.splice(index, 1); //remove element\n this.generateVisibleList();\n\n this.showToast(\"Client removed from list\");\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UPDATE: Update one Player by id, rerunning validators on any changed fields | update(req, res) {
Player.findByIdAndUpdate(req.params.id, req.body, {
runValidators: true,
new: true
})
.then(updatedPlayer => res.json(updatedPlayer))
.catch(err => res.status(400).json(err));
} | [
"function updateFields(id, playerNum) {\n let name = \"#player-\" + playerNum;\n\n $(name + \"-name-text\").val(players[id].name);\n $(name + \"-sponsor-text\").val(players[id].sponsor);\n $(name + \"-country-dropdown\").val(players[id].country);\n $(name + \"-country-dropdown\").... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a donation: Async Operations | async function createDonation() {
const donation = new Donation({
name: 'HP COMPUTER 55 4K',
categories: ['Electronics', 'Devices'],
isUsed: false
});
//Save a donation to the database
const result = await donation.save();
console.log(result);
} | [
"async donate(projectHash, amount){\n let donation = await App.contract.donate(projectHash, {from: web3.eth.defaultAccount, gas: gasAmount, value: amount})\n .on('error', console.error);\n return donation;\n }",
"function makeDonation(chargeData) {\n return axios\n .post(`${config.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch a node index based upon a position | FetchNodeIndex(position)
{
return position.x + (position.y * grid.resolution);
} | [
"posAtIndex(index, depth) {\n depth = this.resolveDepth(depth);\n let node = this.path[depth * 3], pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;\n for (let i = 0; i < index; i++)\n pos += node.child(i).nodeSize;\n return pos;\n }",
"function getNodeIndex(nodeid,domainelement) {\n //c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets the type of the given waypoint identified by its feature ID | function setWaypointType(featureId, type) {
var layerWaypoints = this.theMap.getLayersByName(this.ROUTE_POINTS)[0];
var feature = layerWaypoints.getFeatureById(featureId);
//create new feature
if (feature) {
var pt = new OpenLayers.Geometry.Point(feature.geometry.x, feature.geometry.y);
var newFeat... | [
"function setWaypointType(featureId, type) {\n var feature = this.layerRoutePoints.getLayer(featureId);\n if (feature) {\n var newFeature = new L.marker(feature.getLatLng(), {\n draggable: true,\n icon: Ui.markerIcons[type],\n icon_orig: Ui.marke... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the rights for the given type as string of rights according to the constants from the Right class. Return undefined if the rights have not been loaded yet. | function getRightsAsString(type/*:ContentType*/)/*:**/ {
var byTypeName/*:Object*/ = this.get(BY_TYPE_NAME_PROPERTY_NAME$static);
if (!byTypeName) {
return undefined;
}
// Find the most specific type for which rights are defined.
while (type) {
var typeName/*:String*/ = type.getName();
... | [
"function getArmourTypeStr(val){\n\treturn {1:\"Helmet\", 2:\"Chest\", 3:\"Gloves\", 4:\"Pants\", 5:\"Shoes\"}[val.getType()];\n}",
"getTypeAsString() {\n if (this.props.type === 'FIREPLACE') {\n return \"FIREPLACE\";\n } else if (this.props.type === 'FOUNTAIN') {\n return \"FO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Serialize the heeader/footer reference. | serializeHFReference(writer, headersFooters) {
let hfId = '';
if (headersFooters !== undefined) {
this.mDifferentFirstPage = this.section.sectionFormat.differentOddAndEvenPages;
let hf = headersFooters.firstPageHeader;
if (hf && hf.blocks && hf.blocks.length > 0) {
... | [
"serializeHeaderFooterRelations(writer) {\n this.serializeHFRelation(writer, 'EvenFooter');\n this.serializeHFRelation(writer, 'EvenHeader');\n this.serializeHFRelation(writer, 'FirstPageFooter');\n this.serializeHFRelation(writer, 'FirstPageHeader');\n this.serializeHFRelation(wr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=================================================================== from functions/threads/NewThreadLocal.java =================================================================== Needed early: Builtin Needed late: ArcThreadLocal | function NewThreadLocal() {
} | [
"function SetThreadLocal() {\r\n}",
"function ThreadLocalGet() {\r\n}",
"function ThreadLocalSet() {\r\n}",
"enterDataThreadLocalClause(ctx) {\n\t}",
"newTSO() {\n const tid = ++this.lastTid;\n let promise_resolve, promise_reject;\n const ret_promise = new Promise((resolve, reject) => {\n prom... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return favourites for a specific day | function getFavourites(day, cbSucces, cbError) {
if(localStorage['day_' + day + 'favourites'] != undefined) {
return JSON.parse(localStorage['day_' + day + 'favourites']);
} else {
return null;
}
} | [
"function addFavourite(event, day, id, cbSucces, cbError) {\n\tif (!Modernizr.geolocation) {\n\t\tcbError(\"No HTML5 geolocation available\")\n\t\treturn\n\n\t\t\n\n\t}\n\tif (localStorage['day_' + day + 'favourites'] == undefined) {\n\t\tfavouriteEvents = [];\n\t\tfavouriteEvents.push(event);\n\t\tlocalStorage['da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a new event to the specified hour block and save changes. | setEvent(hourBlock, event) {
this.schedule.events
.filter(e => e.hourBlock === hourBlock)
.forEach(e => e.event = event);
this.saveTodaysSchedule();
} | [
"function addNewEventToHourBlock() {\n\t\t// holds current hour.\n\t\tlet currentHour = moment().hours();\n\t\t// function for each class block to check if time is in the past, present or future\n\t\t$(\".hour-block\").each(function () {\n\t\t\tlet timeBlock = parseInt($(this).attr(\"id\").split(\"-\")[1]);\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a new entity directly to the cache. Does not save to remote storage. Ignored if an entity with the same primary key is already in cache. | addOneToCache(entity, options) {
this.createAndDispatch(EntityOp.ADD_ONE, entity, options);
} | [
"function addToCache(modelObj) {\n if (!modelObj.__id) {\n Object.defineProperty(modelObj, '__id', {\n value: id(),\n enumerable: false,\n configurable: false\n });\n }\n if (!cache[modelObj.__id]) {\n cache[modelObj.__id] = modelObj;\n }\n}",
"add... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cria o tr da atividade | function criarTrAtividade(){
let trAtividade = document.createElement("tr")
let tdAtividade = document.createElement("td")
let tddetalhe = document.createElement("td")
let tdprazo = document.createElement("td")
let botaodelete = criarbotaoexclusao()
let botaomodificar = criarbotaomodificar()
tdAtiv... | [
"function adicionarTr(paciente){\n corpoTabela.appendChild(montarTrPaciente(paciente));\n}",
"function montaTr(paciente){\r\n // aqui nos criamos a Tr para que ela possa ser preenchida pelas linhas dos dodos dos pacientes\r\n var pacienteTr = document.createElement(\"tr\");\r\n\r\n //com a fução criad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Population functions ,Dynamicly create elements Populates shop using the results from database request | function populateShop(data) {
data.forEach(item => {
//Model each item
var itemObj = new Item(item);
//Store The item object in a global array.
itemObjArr.push(itemObj);
//create item element for shop content
var itemElement = itemObj.createItemElement()
... | [
"function shopInit() {\n\tlet shopInventory = [];\n\tfor (let i = 0; i < shopData.itemsList.length; i++) {\n\t\tshopInventory.push(new Item_Entity(allItemsByName.get(shopData.itemsList[i])[0]));\n\t}\n\tfor (let i = 0; i < shopData.equipmentsList.length; i++) {\n\t\tshopInventory.push(new Equipment_Entity(allEquipm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
students/id/:userid Selects a student by a specific userid | function selectStudentByID(con) {
return function (req, res) {
con.query(
"SELECT * FROM User WHERE IsProfessor = FALSE AND UserID = " +
req.params.userid,
function (err, result) {
if (err) {
console.error("error connecting: " + err.stack);
res.status(500).send("Err... | [
"function getStudent(){\n let id = $routeParams.id;\n let student = $scope.students[id];\n return student\n }",
"static getStudentById(req, res) {\n const findById = students.find(\n student => student.id === parseInt(req.params.id),\n 10\n );\n\n if (findById) {\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return a date from a pubnub timetoken | function fromTimeToken (timetoken) {
return new Date(Math.ceil(+timetoken / 10000))
} | [
"function getWebmentionDate(webmention) {\n if (webmention.data.published) {\n return new Date(webmention.data.published);\n }\n return new Date(webmention.verified_date);\n }",
"static getTimeStamp(body, wxInfo) {\n // regexp to create 5 groups\n // (DD)(hh)(mm)(z... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[2] AbsoluteLocationPath::= '/' RelativeLocationPath? | AbbreviatedAbsoluteLocationPath [10] AbbreviatedAbsoluteLocationPath::= '//' RelativeLocationPath | function absoluteLocationPath(stream, a) {
var op = stream.peek();
if ('/' === op || '//' === op) {
var lhs = a.node('Root');
return relativeLocationPath(lhs, stream, a, true);
} else {
return null;
}
} | [
"function absoluteLocationPath(stream,a){var op=stream.peek();if('/'===op||'//'===op){var lhs=a.node('Root');return relativeLocationPath(lhs,stream,a,true);}else{return null;}}",
"function locationPath(stream,a){return absoluteLocationPath(stream,a)||relativeLocationPath(null,stream,a);}",
"function absoluteLoc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets values in edit company modal | function setEditValuesCompany(index) {
// generic list/ object initializer
var jsonObject = (!Array.isArray(fetchData)) ? fetchData : fetchData[index];
// general setters
document.getElementById('edit-company-title').innerText = jsonObject['name'] + " (cvr: " + jsonObject['cvr'] + ")";
document.ge... | [
"function setCompany()\n{\n\tvm.company = _companyField.value;\n}",
"function editCompany(id){\n\tjsonCompaniesObjArray[id].id = document.getElementById('cmp-id').value;\n\tjsonCompaniesObjArray[id].name = document.getElementById('cmp-name').value;\n\tjsonCompaniesObjArray[id].type = document.getElementById('cmp-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load exported .js map files | loadJS() {
if (typeof(window.TileMaps) == 'undefined') {
window.onTileMapLoaded = this.onTileMapLoaded.bind(this);
} else {
for (const map in window.TileMaps)
this.data[map] = window.TileMaps[map];
}
} | [
"function importMapResources() {\n return new Promise(function(resolve, reject) {\n\n // if resources are already loaded, resolve immediately.\n if(d3.graph_canvas && d3.graph) {\n return resolve();\n }\n\n // import map css file\n $('head').append('<link rel=\"stylesheet\" type=\"text/css\" hr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
JavaScript popup window function | function basicPopup(url) {
popupWindow = window.open(url,'popUpWindow','height=300,width=700,left=50,top=50,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes')
} | [
"function openWindow() {\n catWindow = window.open(\"backgroundPopup.html\", \"+1 Bloco Válido foi encontrado ...\");\n }",
"function popupWin(url){\n\twindow.open(url,\"PopupWindow\",\"height=600, width=870, top=0, left=0, toolbar=no, menubar=no, scrollbars=yes,resizable=no,location=no, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
determine a name for this company, based on the user's domain or email | determineCompanyName () {
// if the user previously set a company name, just use that
if (this.user.get('companyName')) {
return this.user.get('companyName');
}
// if it's a webmail user, we just name the company after the whole email,
// otherwise use the domain
const email = EmailUtilities.parseEmail(... | [
"function checkForCompanyName (buisnessEmail) {\n\n const popularEmailServiceProvider = [\"gmail\", \"outlook\", \"yahoo\", \"hotmail\"];\n const companyName = buisnessEmail.substring(buisnessEmail.lastIndexOf(\"@\") +1, buisnessEmail.lastIndexOf(\".\"));\n const checkIfNormalEmail = popularEmailServicePro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prevent input focusing prevent scrolling popup on mobile screens | function inputFocusingPreventing(selector) {
$('body').on('touchstart', function (e) {
selector.css("pointer-events", "auto");
});
$('body').on('touchmove', function (e) {
selector.css("pointer-events", "none");
});
$('body').on('touchend', function (e) {
... | [
"suppressFocusVisibility() {\n keyboardActive = false;\n refreshFocus(this);\n }",
"_ignoreFocus(event) {\n event.stopPropagation();\n event.preventDefault();\n }",
"onFocusGesture(event) {\n if (event.target === this.ownerCmp.contentElement || event.target.closest(this.itemSele... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when the component mounts: fetch data from the server endpoint set the returned plants array to this.state.plants | componentDidMount() {
axios
.get("http://localhost:3333/plants")
.then(res => {
console.log("ko: components: Plantlist.js: CDM: get data: ", res.data.plantsData)
this.setState({
plants: res.data.plantsData
})
})
.catch((err) => console.error("failure to fetc... | [
"function loadPlants() {\n API.getPlants()\n .then(res => { console.log(res); setPlants(res.data) }\n )\n .catch(err => console.log(err));\n }",
"constructor(props) {\n super(props);\n this.state = { \n plants: [{ name: \"...loading\", id: 0 }], filter: \"\" \n };\n }",
"async ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function serializes one listing | function serializeListing(listing) {
let listingHtml = "Lorem Ipsum";
return listingHtml;
} | [
"serializeLists(list) {\n return {\n id: list.id,\n name: xss(list.name),\n user_id: list.user_id\n }\n }",
"serializeNumberings() {\n if (this.document.lists.length === 0) {\n return;\n }\n let writer = new XmlWriter();\n writer.writeStar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates currents turn score of a given player Input: player's div element Output: total score on current turn | function currentTurnScore(playerDiv) {
return nthThrow(playerDiv, 0) + nthThrow(playerDiv, 1) + nthThrow(playerDiv, 2);
} | [
"getTotal (player) {\n return calcScore( player );\n \t}",
"function set_turn_score() {\n $(players[Game.current_player].roll_scores).each(function(index, value) {\n if ((index + 1) % 2 == 0) {\n players[Game.current_player].total_score -= value;\n } else {\n players[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
request station meta data | async getStationsMeta() {
try {
let result = await axios
.get(process.env.VUE_APP_STATIONS_META)
.then(function(response) {
return response;
});
return result;
} catch (error) {
return 0;
}
} | [
"@action\n getStationsMetadata() {\n this.fetchStationsMetadataState = 'pending';\n this.api()\n .get(apiURL + \"/metadata/stations\")\n .then(response => response.data)\n .then(this.getStationsMetadataSuccess)\n .catch(this.getStationsMetadataError);\n }",
"function ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unordered list animation effect | function initListAnimation(){
"use strict";
if($j('.animate_list').length > 0 && $j('.no_animation_on_touch').length === 0){
$j('.animate_list').each(function(){
$j(this).appear(function() {
$j(this).find("li").each(function (l) {
var k = $j(this);
setTimeout(function () {
k.animate({
... | [
"function qodeInitUnorderedListAnimation(){\n $j(window).on('elementor/frontend/init', function () {\n elementorFrontend.hooks.addAction( 'frontend/element_ready/bridge_unordered_list.default', function() {\n\t initListAnimation();\n } );\n });\n }",
"function rot... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SELECT role_permission_mapping.id FROM `employee` INNER JOIN `role_permission_mapping` ON employee.phone = '18801615551' AND employee.roleId = role_permission_mapping.roleId WHERE role_permission_mapping.permissionid = 2; | * checkPermission(userId, permissionId) {
const mapping = yield app.mysql.query(
'SELECT role_permission_mapping.id FROM `employee`' +
'INNER JOIN `role_permission_mapping`' +
'ON employee.phone = ? AND employee.roleId = role_permission_mapping.roleId ' +
'WHERE role_permission_mapping.permissioni... | [
"* getPermissions(userId) {\n\t\t\tconst permissions = yield app.mysql.query(\n\t\t\t\t'SELECT permission.* ' +\n\t\t\t\t'FROM `employee` ' +\n\t\t\t\t\t'INNER JOIN `role_permission_mapping` map ' +\n\t\t\t\t\t'ON employee.phone = ? AND employee.roleId = map.roleId ' +\n\t\t\t\t'INNER JOIN `permission` ' +\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ECommerce View Ingredients component's controller definition. | function IngredientController($scope, eCommerceViewApi, $sce, permissionsService,$rootScope) {
/**
* All CRUD operation controls of choice option page goes here.
*/
var self = this;
/**
* Reload eCommerce view key.
* @type {string}
*/
self.RELOAD_ECOMMERCE_VIEW = 'reloadECommerceView';
/**
... | [
"function InventoryView() {\n \n}",
"function ViewController() {}",
"function StructureGroupController(){\r\n}",
"clientComp() {\n this.res.render('pages/exx/client-comp/index', {title: 'Client/Component'});\n debug(\"Action: Create client component - OK\");\n }",
"viewCampaign(){\n\n }"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Traverse the trie with a callback function | traverse (str, callbackfn, thisArg) {
let cur = this.trie
for (let i = 0; i < str.length; i++) {
const retChar = callbackfn.call(thisArg, str[i], i, cur)
const tmp = cur.children[retChar]
if (!tmp || tmp.countPrefix <= 0) return
cur = tmp
}
} | [
"forEach(callbackfn, thisArg) {\n const boundCallbackfn = callbackfn.bind(thisArg);\n const { next } = createIterator(root);\n let { done, value = [] } = next();\n while (!done) {\n boundCallbackfn(value[1], value[0], trie);\n ({ done, value = [] } = next());\n }\n }",
"t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Echoes recieved data back to client | function echo(response,data)
{
response.write(data);
response.end();
console.log("Data Echoed.");
} | [
"function echo(req, res, next) {\n console.log(req.body);\n\n next();\n}",
"function echo(req, res, next) {\n console.log(req.body);\n next();\n}",
"function sendItBack () {\n\tapp.get('/output', function (req, res) {\n\t\tres.send(outgoingData);\n\t})\n}",
"echo(msg){\n this.sendit({method:'echo',... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
manually find the witness commitment inside the coinbase. it's in _one of_ the vout's, one that's 38 bytes long and starts with a special prefix which we need to strip out to find a 32byte hash | function findWitnessCommitment (block) {
const coinbase = block.tx[0]
for (const vout of coinbase.vout) {
const spk = vout.scriptPubKey.hex
if (spk.length === 38 * 2 && spk.startsWith('6a24aa21a9ed')) {
return Buffer.from(spk.slice(12), 'hex')
}
}
} | [
"function extractSignature(input, witness) {\n let signature = null;\n\n if (!witness) {\n for (const opcode of input.script.code) {\n if (opcode.value !== opcodes.OP_0 && opcode.data) {\n signature = opcode.data.toString('hex');\n break;\n }\n }\n } else {\n for (const data of i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |