query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Apply changes mutation Insert current state at the end of previous state. Set current element to the new state after handling the action. Clear the next state. | [mutation.APPLY_ELEMENT] (state) {
const { prev, current, snapshot } = state
const snapshotObject = utils.CloneObject(snapshot)
if (!isEqual(snapshotObject, current)) {
state.prev = [...prev, current]
state.current = snapshotObject
state.snapshot = []
state.next = []
}
} | [
"[mutation.UNDO_ELEMENT] (state) {\n const { prev, current, next, selected } = state\n\n if (prev.length > 1) {\n state.prev = prev.slice(0, prev.length - 1)\n state.current = prev[prev.length - 1]\n state.next = [current, ...next]\n const newSelected = NodeHelpers.getElementObject(selecte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prompt for the first developer and overwrite the anonymous developer. | async function createFirstDeveloper() {
if(isStorytellerCurrentlyActive) {
try {
//prompt for the dev info
let devInfoString = await vscode.window.showInputBox({prompt: 'Enter in a single developer\'s info like this: Grace Hopper grace@mail.com'})
//if there is anything ... | [
"function overwriteAnonDev(email, first, last) {\n \n //update the default anonymous developer with some info\n anonDeveloper.firstName = first;\n\tanonDeveloper.lastName = last; \n\tanonDeveloper.email = email;\n}",
"function createAnonymousDeveloper() {\n \n //create an id for the anonymous devel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Insert sequence number into the error so we can sort later | function makeErr(err, seq) {
err._bulk_seq = seq;
return err;
} | [
"incrementSequenceNumber() {\n this.sequence = this.sequence.add(1);\n }",
"function getNextSequenceNumber() { return ++seq; }",
"function sortErrorsByMsgId(arr) {\n var temp = '';\n for (var k = 0; k < arr.length; k++) {\n for (var m = 0; m < arr.length - k - 1; m++) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disconnects a user from the live chat | userDisconnect(req, res) {
LiveChat.destroy(sails.sockets.getId(req)).exec(function (err) {
if (err) return res.json({
status: 500,
error: err
})
LiveChat.publishDestroy(sails.sockets.getId(req))
sails.broadcast(sails.sockets.getId(req), 'LiveChatDisonnect')
retur... | [
"function disconnect() {\n var obj = {}\n obj[REQUEST] = DISCONNECT\n obj[USERNAME] = this._username\n this._ws.send(JSON.stringify(obj)) // tells server to remove this user\n this._ws.close()\n this._freeClient() // free all client members\n}",
"function clientDisconnect(data) {\n\tshowNewMessa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method for updating family member | updateMember(req, res, next) {
UsersService.prototype.updateFamilyMember(req, res)
.then((result) => {
res.status(200).send(result);
})
.catch((error) => next(error));
} | [
"updateMember(req, res, next) {\n _index.UsersService.prototype.updateFamilyMember(req, res).then(result => {\n res.status(200).send(result);\n }).catch(error => next(error));\n }",
"function updateFriendInfo() {\n friendName = $(\"#friendCardName\").text();\n ref.child(userName + \"/friend/\" +... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
a fatal error see projects.h E_ERROR macro | function e_error(code) {
pj_ctx_set_errno(code);
fatal();
} | [
"function fatal_error(msg) {\n has_exited = true;\n ui_disabled = true;\n if (!GlkOte) {\n // We haven't been initialized yet, so we can only try to log the error and hope someone sees it.\n console.log('Fatal error:', msg);\n return;\n }\n GlkOte.error(msg);\n var dataobj = {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
draw bricks on canvas | function drawBricks() {
for(var c=0; c<brickColumnCount; c++){
for(var r=0; r<brickRowCount; r++){
// draw brick if brick status is 1
if ( bricks[c][r].status == 1){
var brickX = (c*(brickWidth + brickPadding)) + brickOffsetLeft;
var brickY = (r*(brickHeight + brickPadding)) + br... | [
"function drawBricks() {\n bricks.draw(context, imgBrick);\n}",
"function drawBricks() {\n\tfor(c=0; c<brickColumnCount; c++) {\n\t\tfor (r=0; r<brickRowCount; r++) {\n\t\t\tif(bricks[c][r].status == 1) {\n\t\t\tvar brickX = (c*(brickWidth+brickPadding))+brickOffsetLeft;\n\t\t\tvar brickY = (r*(brickHeight+bri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compteur de likes par medias | function compteurLikes (photographerMediaList) {
let totalCoeur = compteurTotal(photographerMediaList)
// selectionne le nombre total de likes
const totalLikes = document.querySelector('.numbers_likes')
// selectionne tous les coeurs
const allLikes = document.querySelectorAll('figure button')
// pour chaq... | [
"function addLikeonMedia(evt) {\n const selectedMediaId = +evt.currentTarget.dataset.mediaId;\n const selectedMedialike = evt.currentTarget.previousElementSibling;\n\n const selectedMedia = photographer.media.find(\n (media) => media.id === selectedMediaId\n );\n photographer.addLike(selectedMedia);\n\n ad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the specified node is leaf. param: DOM object, indicate the node to be checked. | function isLeaf(target, param){
var node = $(param);
var hit = $('>span.tree-hit', node);
return hit.length == 0;
} | [
"function isLeafNode(node) {\n return !node.childNodes.filter(n => n.nodeType != 3).length > 0\n}",
"_isLeafNode(obj) {\n return this._descendantCount(obj) <= 1;\n }",
"isLeaf(node) {\n return node.left == null && node.right == null;\n }",
"function isLeaf(target, nodeEl){\r\n\t\treturn $... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcao que atualiza na tela a quantidade de marcacoes a cada clique | function atualizaQuantidadeMarcacoes(){
var contador = document.getElementById("numeroDeErrosMarcados");// procura o local onde a quantidade de marcacao deve aparecer
contador.innerHTML = "<font color= red>" + clicked + "</font>" // Mostra a quantidade atual de marcacoes na pagina.
} | [
"function montaConjuntos(){\r\n\treturn quantidadeDeLinha() / valorDeN();\r\n}",
"function mejorVendedorMes(mes) {\n let ventaMes = 0;\n let vendedor = \"\";\n let semanaMax = mes * 4 - 1; //Por ejemplo, el mes 1 seria el intervalo de semanas de 0 a 3.\n let semanaMin = semanaMax - 3;\n let ventaSu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
LoadQuiz loads 10 questions from open trivia(opentdb api) quiz api | function LoadQuiz() {
questions = [];
// empting few div before loading new quiz
resultContainer.innerHTML = '';
document.getElementById('noquiz').innerHTML = '';
//showing loader while quiz is loading
$('#loader').show();
var apiURL = 'https://opentdb.com/api.... | [
"async function loadQuizList() {\n\tlet response;\n\tlet json;\n\ttry {\n\t\tresponse = await fetch( QUIZ_LIST_FILE );\n\t\tjson = await response.json();\n\t} catch ( e ) {\n\t\tSTORE.quizList = null;\n\t\treturn;\n\t}\n\tSTORE.quizList = json.quizzes;\n\tconsole.log( `loaded ${STORE.quizList.length} quizzes` );\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET request to Profile API endpoint | function profileReq () {
const request = apiHelper.axGet(apiUrls.profiles, authToken)
return axios(request)
} | [
"function getProfileData() {\r\n IN.API.Raw(\"/people/~:(firstName,lastName,siteStandardProfileRequest,emailAddress,id,picture-url,public-profile-url)\").result(onSuccess).error(onError);\r\n}",
"function getProfileData(){\n let headers = loadHeaders();\n callAPI(server + \"api/mdm/profiles/search\",headers,\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the preferred charsets from an AcceptCharset header. | function preferredCharsets(accept, provided) {
// RFC 2616 sec 14.2: no header = *
var accepts = parseAcceptCharset(accept === undefined ? '*' : accept || '');
if (!provided) {
// sorted list of all charsets
return accepts
.filter(isQuality)
.sort(compareSpecs)
.map(getFullChars... | [
"function preferredCharsets(accept,provided){// RFC 2616 sec 14.2: no header = *\nvar accepts=parseAcceptCharset(accept===undefined?'*':accept||'');if(!provided){// sorted list of all charsets\nreturn accepts.filter(isQuality).sort(compareSpecs).map(getFullCharset);}var priorities=provided.map(function getPriority(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
WS Functions send login data | function send_login() {
ws.send(
JSON.stringify(
{
type: 'login',
id: user.id,
name: user.name,
color: user.col,
x: user.x,
y: user.y,
room: roomName
}
)
);
} | [
"function login_to_server(){\n\t$.CurrentUser.UserName=document.forms[\"frmLogin\"][\"userName\"].value;\n\t$.CurrentUser.UserPassword=document.forms[\"frmLogin\"][\"userPassword\"].value;\n\t\n\t//Goal1.id = userObj.userName+'_Goal1';\t//Send User Name\n\tsocket.emit('UserAuthorize', $.CurrentUser);\n}",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
oh wow utils for words Returns the most common vowel in word. | function findBestVowel(word) {
var letters = word.split('');
letters.pop(); // trailing letters don't count--we're not THAT illiterate.
var bestLetters = {};
var uniqueLetters = {};
for (var i = 0, ii = letters.length; i < ii; i += 1) {
var letter = letters[i];
uniqueLetters[letter] |= ... | [
"function mostCommonVowel(string) {\n const vowels = 'aeiou';\n let vowelDistribution = string.split('').reduce( (acc, ch) => {\n if (vowels.includes(ch)) {\n if (!(acc.hasOwnProperty(ch))) acc[ch] = 0;\n acc[ch] += 1;\n }\n return acc;\n }, {});\n\n let sorted = Object.entries(vowelDistribut... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
recover a entity with pool name | static recoverItemByPoolName(poolName, entity, removeFromParent) {
if (this._pool == null) return;
const pool = this._pool[poolName];
let index = pool.indexOf(entity);
if (index == -1) {
if (removeFromParent) entity.removeFromParent();
pool.push(entity);
... | [
"getEntity(name) {\n const hasEntity = this.hasEntity(name);\n if (!hasEntity) throw new Error(`getEntity(): entity \"${name}\" not found.`);\n return this.entities.find((entity)=>entity.name === name);\n }",
"localRollback() {\n\t\t\t/* delete the entity */\n\t\t\tenv.internalOperation(()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sortPopularity function same as above but sorted by .... popularity | sortPopularity() {
const { contacts } = this.state;
const sortedPopularity = [...contacts];
sortedPopularity.sort((a, b) => (a.popularity < b.popularity ? 1 : -1));
this.setState({
contacts: sortedPopularity
});
} | [
"function sortByPopularity () {\r\n mediasForId.sort( function(a,b) {\r\n \r\n if (a.likes < b.likes) {\r\n return 1; // a after b\r\n \r\n } else if (a.likes > b.likes) {\r\n return -1; // b after a\r\n\r\n } else {\r\n\r\n // when same likes: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a tournament from the way it's saved in the Mongo database to the QBJ format | function convertToQuizbowlSchema(tournamentid, callback) {
Tournament.findOne({shortID : tournamentid}, function(err, tournament) {
if (err) {
callback(err, null);
} else if (!tournament) {
callback(null, null);
} else {
var qbjObj = {version : SCHEMA_VERS... | [
"function convertToSQBS(tournamentid, callback) {\n Tournament.findOne({shortID : tournamentid}, function(err, tournament) {\n if (err) {\n callback(err, null);\n } else if (!tournament) {\n callback(null, null);\n } else {\n sqbsString += tournament.teams.le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetches OP from campaign name(s) by iterating over campaigns in campaign iterator. OP format: OP + 7 digits (length: 9). Requires OP to be present at the begining of campaign name(s). If no OP is found, 'N/A' is returned. | function getOP(campaignIterator) {
while (campaignIterator.hasNext()) {
var OP = campaignIterator.next().getName().substring(0, 9);
if (OP.substring(0,2) == "OP") return OP;
}
return "N/A";
} | [
"function getOP(campaignIterator) {\n while (campaignIterator.hasNext()) {\n var OP = campaignIterator.next().getName().substring(0, 9);\n if (OP.substring(0,2) == \"OP\") return OP;\n else if (!(campaignIterator.hasNext())) return \"N/A\";\n }\n}",
"function getOperator() {\n for (const op in O... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Input: tokens tokens list with index pointing to the subscript token to be processed. return: if (logrithm) processed log combination. else the v_subscript. | function processSubsript(tokens, v_result)
{
var v_comma = result_element( "mtext" ,0 , ',' ) ;
var v_endBracket = result_element( "mtext" ,0 , ')' ) ;
var v_2ndPart, v_subscript;
tokens.index++;
if (tokens.list[tokens.index-2] == '\\log')
{
v_subscript = v_piece_to_mathml(tokens );
... | [
"function singleDigitScriptLogPow(tokens, v_subscript)\n{\n if (tokens.index-1 >= 0\n && tokens.list[tokens.index-1] != '}' // multi-digit base is already handled correctly witha {} grouping\n && v_subscript.content.length === 1\n && isNumberStr(v_subscript.content[0])) // token separate let... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes a Revision, removing associated versions of all Entries. | async delete(name) {
await Entry.deleteMany({ _revisionIndex: this._id })
const oldRevision = await this.remove()
setLatestRevisionIndex(await this.getLatestRevisionIndex())
return oldRevision
} | [
"function deleteItemRevision(req, res) {\n EstimateItem.findOneAndUpdate({ _id: req.body.revisionItemId }, { deleted: true }).exec(function (err, estimateddata) {\n if (err) {\n res.json({ code: Constant.ERROR_CODE, message: err });\n } else {\n res.json({ code: Constant.SUCCE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A Chart header has the chart's title and a link to it. / A dashboard's charts' headers has a menu with some additional options. / / dashboard DashboardTreeView / chartView ChartView | function ChartHeader(dashboard, chartView) {
this.dashboard = dashboard
this.view = chartView
this.chart = chartView.chart
SkyView.call(this,
{ title: sail.escapeHTML(this.chart.getTitle())
})
} | [
"function renderHeader(options) {\n\n var\n graphHeader = $('<div/>').addClass('graph-header'),\n\n // used in fleshing out our header below\n titleText;\n\n // normalize our options object for easier checks below\n options = isUndefined(options) ? {} : options;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NOTE: General patterns for retrieving data from the db and sending data to the client 1. Client requests data using a socket pulse 2. Server queries database using stream, sends data back to client via socket 3. When all data is finished being sent, server notifies client with new socket pulse 4. Server the proceeds to... | function loadShenzhenTweets(socket){
var toSend = [];
//the find query will only return documents which have a geo tag.
//this does not ensure that the tweet is within the the shenzhen region though!
var stream = shenzhen_Model.find({ "geo": { $ne: null }}).stream();
stream.on('data', function (doc... | [
"async _streamData() {\n this.currentChart = \"DISCO WORM\";\n let xVals = [];\n let yVals = [];\n\n let self = this;\n dataService.startStreaming(5, function(x, y) {\n xVals.push(x);\n yVals.push(y);\n self.graphPoints = self._convertGraphPoints(xVals, yVals);\n self._generateTab... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets FSM state to initial. | reset() {
this.state=this.initial;
this.statesStack.clear();
} | [
"reset() {\r\n this.changeState(this._initialState);\r\n }",
"reset() {\r\n this.changeState(this.initial);\r\n }",
"reset() {\r\n this.changeState(this.initialState);\r\n }",
"reset() {\n \tthis.changeState(this.initial_state);\n }",
"reset() {\r\n this.state = th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
flag to toggle showing temp in F or C | function toggleTemp() {
var t1 = 0;
var suffix = "Z";
if (showTempInCflag_ == 1) {
t1 = KtoC(tempK_);
showTempInCflag_ = 0;
suffix = "C";
}
else {
t1 = KtoF(tempK_);
showTempInCflag_ = 1;
suffix = "F";
}
document.getElementById("temperature").innerHTML = t1.toFixed(2) + suffix;
r... | [
"function toggleCF() {\n (toggle.checked) ? unit = 'c' : unit = 'f'\n tempP.textContent = (unit == 'f') ? temperatureF : temperatureC\n}",
"function toggleTemps(){\n\n if (temperatureUnit.textContent === \"F\"){\n \n temperatureUnit.textContent = \"C\";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function takes an entry currently being updated and returns a list of other entries whose backlinks property needs to change. This can happen because: this entry has been removed and it should no longer appear on the backlinks lists of other entries this entry now links to another post and it should appear on that... | function backlinksToUpdate(
blogID,
entry,
previousInternalLinks,
previousPermalink,
callback
) {
// Since this post is no longer available, none of its current or former
// links are present. Remove everything.
// Since this post exists, we need to work out which dependencies were
// added since the last time... | [
"getLinksToUpdateInfo() {\n\t\tconst newLinks = [];\n\t\tconst oldLinks = [];\n\t\tconst allCurrentLinks = this.apiPipeline.getLinks();\n\n\t\tallCurrentLinks.forEach((link) => {\n\t\t\tif (!this.isLinkToBeDeleted(link, this.linksToDelete)) {\n\t\t\t\tconst src = this.isSourceToBeDeleted(link);\n\t\t\t\tconst trg =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function permits to display the global view of the production dashboard (3 tabs) | static renderGlobalView() {
GestionPages.gestionPages("dashboard");
let contenu = `
<h5><em>Production Dashboard</em></h5>
<div id="dash">
<div id="stateorders">
<p>State of orders</p>
</div>
... | [
"function showAdminDashboard() {\n $.dashboard.setWidth('95%');\n $.dashboard.setHeight('93%');\n $.dashboard.setTop('5%');\n $.dashboard.setBottom('5%');\n $.dashboard.setRight('3%');\n $.dashboard.setLeft(20);\n $.dashboard.setOpacity('1.0');\n $.dashboard_container.setHeight(Ti.UI.FILL);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert DateTime (ddmmyyyy hhmm) to javascript DateTime Ex: 16112015 16:05 | function toJSDate(dateTime) {
var dateTime = dateTime.split(" "); // dateTime[0] = date, dateTime[1] = time
var date = dateTime[0].split("-");
var time = dateTime[1].split(":");
// (year, month, day, hours, minutes, seconds, milliseconds)
// Subtract 1 from month because Jan is 0 and Dec is 11
return new D... | [
"function mysqlDateTimeToJSDate(datetime) {\n\t// Split timestamp into [ Y, M, D, h, m, s ]\n\tvar t = datetime.split(/[- :]/);\n\treturn new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]);\n}",
"function mysqlDateTimeToJSDate(datetime) {\n // Split timestamp into [ Y, M, D, h, m, s ]\n var t = datetime.split(/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reports error if none of the labels are accessible. | validateLabel(elem, labels) {
const visible = labels.filter(isVisible);
if (visible.length === 0) {
this.report(elem, `<${elem.tagName}> element has label but <label> element is hidden`);
}
} | [
"function onLabelsError() {\n // TODO: handle error\n}",
"function checkLabelExists() {\n Logger.log(\"\\nfunction:checkLabelExists()\"); \n var label = getLabelByName(LABEL_PROCESSING);\n if( !label ) {\n AdsApp.createLabel(LABEL_PROCESSING);\n label = getLabelByName(LABEL_PROCES... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return shuffled card's list | function shuffleCards() {
let listOfCards = createListOfCards();
let shuffledListOfCards = [];
shuffledListOfCards.push(listOfCards.splice(52,1)[0]);
let listOfCardsLength = listOfCards.length;
for (let i = 0; i < listOfCardsLength; i++) {
shuffledListOfCards.push(listOfCards.splice
... | [
"function getCardList() {\n var cardList = shuffle(iconOptions).slice(0, 8);\n cardList = cardList.concat(cardList);\n return shuffle(cardList);\n}",
"function shuffleCards() {\n var shuffledCards = shuffle(cards);\n $(shuffledCards).each(function(index, value) {\n $(\".cards\").append($(value... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Destroys the current Angular platform and all Angular applications on the page. Destroys all modules and listeners registered with the platform. | function destroyPlatform() {
if (_platform && !_platform.destroyed) {
_platform.destroy();
}
} | [
"destroy() {\n if (this._destroyed) {\n throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, ngDevMode && 'The platform has already been destroyed!');\n }\n this._modules.slice().forEach(module => module.destroy());\n this._destroyListeners.forEach(listener => listener());\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function called when day element clicked; saves a clicked day as a variable | function dayClicked (event) { // pass an informaton about the element clicked into the function
var element = event.target; // save information about the element as a variable
document.getElementById("divCurrentDay").removeAttribute("id"); // remove clicked element's Id
element.parentNode.setAttribute("id", "divCurr... | [
"function dayClick(e) {\n\t\tvar day = e.target.getAttribute('data-day');\n\t\tvar current = document.querySelector('body').getAttribute('data-selected-day');\n\n\t\tif (current !== day) {\n\t\t\tdocument.querySelector('body').setAttribute('data-selected-day', day);\n\t\t\tif (document.querySelector('body').getAttr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
menu to allow Menu.js to update searchType | function handleSearchType(newSearch) {
console.log(newSearch);
setOpenMenu(!openMenu);
setSearchType(newSearch);
} | [
"function goUpdateFindTypeMenuItems()\n{\n goUpdateCommand('cmd_findTypeText');\n goUpdateCommand('cmd_findTypeLinks');\n}",
"addSearchItems(menu, menuInfo) {\n if (!menuInfo.selectionText || menuInfo.selectionText.length < 1) {\n return menu;\n }\n\n let match = matchesWord(menuInfo.selectionText... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MUA_InputSchoolname ========= MUA_InputKeyup ================ PR20200924 | function MUA_InputKeyup(el_input, event_key) {
//console.log( "===== MUA_InputKeyup ========= ");
//console.log( "event_key", event_key);
const fldName = get_attr_from_el(el_input, "data-field");
if(el_input){
if(event_key === "Shift"){
// pass
}... | [
"function MUA_InputSchoolname(el_input, event_key) {\n //console.log( \"===== MUA_InputSchoolname ========= \");\n //console.log( \"event_key\", event_key);\n\n if(el_input){\n// --- filter rows in table select_school\n const filter_dict = MUA_Filter_SelectRows(el_input.value);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is used to send an image to the Discord server, along with a message string. | function sendImage(string, image){
message.channel.send(`${string}\n`, {
files: [image]
});
} | [
"function sendImage(msg, args) {\n var attatchment;\n if (args.length < 1) {\n attatchment = new Discord.MessageAttachment('./monkey.png');\n } else {\n attatchment = new Discord.MessageAttachment(args[1]);\n }\n msg.channel.send(attatchment);\n }",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts the JSON payload for a single entity into an instance of the corresponding generated entity class. It sets the remote state to the data provided by the JSON payload. If a version identifier is found in the '__metadata' or in the request header, the method also sets it. | function deserializeEntity(json, entityConstructor, requestHeader) {
var etag = extractODataETag(json) || extractEtagFromHeader(requestHeader);
return entityConstructor._allFields // type assertion for backwards compatibility, TODO: remove in v2.0
.filter(function (field) { return odata_comm... | [
"function entityFromEntityData(id, context) {\n var entityCache = context.entityCache;\n var entityData = context.entityData;\n\n // Check if we've already converted this\n var entity = entityCache[id];\n if (entity) {\n return entity;\n }\n\n // Look json... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save the access token | function saveToken(error, result) {
if (error) { console.log('Access Token Error', error.message); }
token = oauth2.accessToken.create(result);
console.log("Access Token : " + result['access_token']);
} | [
"function saveToken(error, result) {\n if (error) { console.log('Access Token Error', error.message); }\n // create a new token\n _this._accessToken = _this._adapterInstance.AccessToken.create(result);\n // save access token in memory\n Podio.access_token = _this._accessToken.token.access_t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PROTECTED Hides the current dotted selection. | function hideDottedSelection() {
document.getElementById(this.id).style.visibility = "hidden";
} | [
"_hideCaret () {\n if (this.hasCaret && this.isCaretVisible) {\n // Hide caret line\n this.element.style.boxShadow = 'none'\n\n // Mark caret as invisible\n this.isCaretVisible = false\n }\n }",
"function hideSelection() {\n\t\tdocument.getElementById(SELECTION).style.visibility = \"hid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enable automatic Session Tracking for the node process. | function startSessionTracking() {
var hub = core_1.getCurrentHub();
hub.startSession();
// Emitted in the case of healthy sessions, error of `mechanism.handled: true` and unhandledrejections because
// The 'beforeExit' event is not emitted for conditions causing explicit termination,
// such as call... | [
"function startSessionTracking() {\n var hub = core_1.getCurrentHub();\n hub.startSession();\n // Emitted in the case of healthy sessions, error of `mechanism.handled: true` and unhandledrejections because\n // The 'beforeExit' event is not emitted for conditions causing explicit termination,\n // su... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onMouseMove() highlight items when the mouse is hovering | function onMouseMove(event) {
if (selectEventTarget(event)) {
highlightSelected(true);
}
} | [
"function mouseover() {\r\n\t// if the piece is movable, give a class name \"highlight\"\r\n\tif(movable(this)) {\r\n\t\tthis.className = \"highlight\";\r\n\t\t// if not, remove the class name \"highlight\"\r\n\t\t} else {\r\n\t\tthis.removeClassName(\"highlight\");\r\n\t}\r\n}",
"function handleMouseOverElement(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validation for IFSC code | function validate_IFSC (id) {
/*
var pass1 = document.getElementById(id).value;
if( /^[A-Za-z]{4}\d{7}$/.test(pass1) && pass1.length <= 11)
{
$('#'+id).css({'border':'1px solid #ddd'});
return true;
}
else
{
error_msg_alert('Please enter valid IFSC/Swift Code');
$('#'+id).css({'border':'... | [
"function validateIFSC(ifsc) {\n var inputVal = ifsc; // variable to store ifsc code\n var numericReg = /^[A-Za-z]{4}\\d{7}$/; // regex to validate a valid IFSC Code\n if (!numericReg.test(inputVal)) { // checking if a ifsc code is a valid one or not \n return false; // return fal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uncomment this code to be notified of playback errors in JavaScript: | function onMediaPlaybackError(playerId, code, message, detail)
{
alert(playerId + "\n\n" + code + "\n" + message + "\n" + detail);
} | [
"function onPlayerError(event) {\n /* */\n}",
"function onPlayerError(errorCode) {}",
"videoError (err) {console.log('video player error: ', err)}",
"function onSoundLoadError() { }",
"function onPlayerError(event) {\n console.log('error code:', event.data);\n playCurrentVideo(nextVideo);\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle successful result of persistence operation on an EntityAction | handleSuccess(originalAction) {
const successOp = makeSuccessOp(originalAction.payload.entityOp);
return (data) => this.entityActionFactory.createFromAction(originalAction, {
entityOp: successOp,
data,
});
} | [
"function onActionSuccess() {\n var actionResult = actionResultService.getActionResult();\n\n if ( resourceType ) {\n // Get the id of the item being operated upon\n var id = performData[idAttributeName];\n if ( actionType == actionTypes.UPDATE ) {\n actionResult.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A cmp function for determining which segments should take visual priority DOES NOT WORK ON INVERTED BACKGROUND EVENTS because they have no eventStartMS/eventDurationMS | function compareSegs(seg1, seg2) {
return seg1.eventStartMS - seg2.eventStartMS || // earlier events go first
seg2.eventDurationMS - seg1.eventDurationMS || // tie? longer events go first
seg2.event.allDay - seg1.event.allDay || // tie? put all-day events first (booleans cast to 0/1)
(seg1.event.title || '').loc... | [
"function segmentCompare(a, b) {\n\t\treturn _segmentCompare(a, b) // sort by dimension\n\t\t\t|| (a.event.start - b.event.start) // if a tie, sort by event start date\n\t\t\t|| (a.event.title || \"\").localeCompare(b.event.title) // if a tie, sort by event title\n\t}",
"function compareSegs(seg1, seg2) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all contributors except those in this sample. | function get_all_contributors_except(id) {
var contributors = get_all_contributors();
var fields = sample_contributor_fields[id];
for (var i = 0; i < fields.length; i++) {
var field = fields[i];
var contributor = field.children('input').val();
if (contributor != '' && contributor != null) {
va... | [
"function _findAllContributor() {\n contributorRestService.findAll(null, function(response) {\n vm.contributors = response;\n });\n }",
"async function populateEmptyContributors() {\n await fs.outputFile(CONTRIBUTORS_FILE_PATH, JSON.stringify([]));\n}",
"function rem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetch product by QR Code | static async fetchProductByQRCode(req, res) {
try{
const product = await Product.findOne({ qrcode: req.params.id })
res.status(200).json(product);
} catch(err) {
res.status(404).json({ message: err.message });
}
} | [
"searchDeckByQuality(quality){\n\t\tconst url = `${BASE_URL}/cards/qualities/`+quality;\n\t\treturn fetch(url, httpOptions).then(this.processResponse);\n\t}",
"function fetchDetailsForProduct() {\n if (kony.net.isNetworkAvailable(constants.NETWORK_TYPE_ANY)) {\n kony.application.showLoadingScreen(\"loadskin\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Encodes a single segment of a resource path into the given result | function encodeSegment(segment, resultBuf) {
var result = resultBuf;
var length = segment.length;
for (var i = 0; i < length; i++) {
var c = segment.charAt(i);
switch (c) {
case '\0':
result += escapeChar + encodedNul;
break;
case escapeCh... | [
"function encodeResourcePath(path) {\n var result = '';\n for (var i = 0; i < path.length; i++) {\n if (result.length > 0) {\n result = encodeSeparator(result);\n }\n result = encodeSegment(path.get(i), result);\n }\n return encodeSeparator(result);\n}",
"function encod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculate the N, U, V vector of the camera | calcNUV() {
this.N = this.viewingPoint.subtract(this.position).unit();
this.U = this.N.crossProduct(this.UP).unit();
this.V = this.U.crossProduct(this.N);
} | [
"function getCameraVectors() {\n\treturn { camera: { x: cam2map[3], y: cam2map[7], z: cam2map[11] },\n\t\t camerax: { x: cam2map[0], y: cam2map[4], z: cam2map[8] },\n\t\t cameray: { x: cam2map[1], y: cam2map[5], z: cam2map[9] },\n\t\t cameraz: { x: cam2map[2], y: cam2map[6], z: cam2map[10] }\n\t };\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
applies damage to the player | function ApplyDamage(damage : float) {
//if the player is invincible, do not apply damage
if(this.invincible) {
return;
}
} | [
"attack(player) {\r\n player.applyDamage(this.strength);\r\n }",
"applyDamage(damage){\n this.hp -= damage;\n }",
"attack() {\n this.enemy.takeDamage(this.weapon.damage);\n }",
"causeDamage() {\n this.sound.pause(); // interrupting longer sounds that lingers one iteration to the other... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO emit events: entity>children:addChild | addChild(childId) {
if (!this.hasChild(childId)) {
const child = this.getEntity(childId);
if (child && child.hasComponent(Children)) {
child.children.setParent(this.getEntity().id);
} else {
this.children.push(childId);
}
}
} | [
"_addChild(childEntity) {\n this._children[childEntity.id] = childEntity;\n childEntity.setParent(this);\n }",
"addChild(child) {\n this.children.push(child);\n child.parent = this;\n }",
"addChild(child) {\n if (this.children == null)\n this.children = [];\n let... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function makeTrays() initializes all of the tray objects. It calls the TokenSheet constructor for each mtok sheet. It also adds the trayNumb to each new tray object. Finally it initializes BD18.curTrayNumb to 0 and BD18.trayCount to the number of tray objects. | function makeTrays() {
var sheets = BD18.bx.tray;
var i=0;
var images = BD18.tsImages;
for (var ix=0;ix<sheets.length;ix++) {
if(sheets[ix].type === 'mtok') {
BD18.trays[i] = new TokenSheet(images[ix],sheets[ix]);
BD18.trays[i].trayNumb = i;
i++;
}
}
BD18.curTrayNumb = 0;
BD18.tr... | [
"function makeTrays() {\n var sheets = BD18.bx.tray;\n var i=0;\n var images = BD18.tsImages;\n for (var ix=0;ix<sheets.length;ix++) {\n if(sheets[ix].type === 'tile') {\n BD18.trays[i] = new TileSheet(images[ix],sheets[ix]);\n BD18.trays[i].trayNumb = i;\n i++;\n } else if(sheets[i].type =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a navigation scrollbar to the lower panel (i.e. x axis) | function addLowerNavigationScrollbar() {
addGraphicalScrollbar();
adjustLowerScrollbarSize();
addScrollbarHandlers();
} | [
"function addLeftNavigationScrollbar() {\n\taddLeftGraphicalScrollbar();\n\tadjustLeftScrollbarSize();\n\taddLeftScrollbarHandlers();\n}",
"function setScrollbar(){\n\t\t\tvar $appendEl=o.scrollAppendTo||$root;\n\t\t\t$scrollBar=$('<div />', {\"class\":\"horizontal-slider\"}).appendTo($appendEl);\n\t\t\t$handle=$... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if a project is visible. | isVisible() {
var { project, projectSections, projectTemplates } = this.props
if (!projectSections || !projectTemplates) { return false }
return (projectSections.test(project, 'project_section') && projectTemplates.test(project, 'project_template'))
} | [
"function isVisible() {\n return visible;\n }",
"function shouldShowProject(data) {\n return data.title && !(\"hidden\" in data);\n}",
"currentlyIsVisible() {\n return this.currentField.visible\n }",
"function isVisible() {\n var extendedSplashScreen = document.getElementById(\"splashEsten... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate the SHA1 of a raw string | function rstr_sha1(s) {
return binb2rstr(binb_sha1(rstr2binb(s), s.length * 8));
} | [
"function rstr_sha1(s) {\r\n return binb2rstr(binb_sha1(rstr2binb(s), s.length * 8))\r\n }",
"function rstr_sha1(s)\r\n{\r\n\treturn binb2rstr(binb_sha1(rstr2binb(s), s.length * 8));\r\n}",
"function rstr_sha1(s)\r\n{\r\n return binb2rstr(binb_sha1(rstr2binb(s), s.length * 8));\r\n}",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
initialize or update realworld map leaflet, arg 'isNewGame' = newGame or continue | function leafletMapInit(isNewGame) {
if(S.level.id !== 'realworld') {return;}
if(S.distMap) {S.level.distMap = S.distMap;} //just a compatibility fix...
//create marker and route
function createAccesories() {
leaflet.marker = L.marker([50, 14]).addTo(leaflet.map);
leaflet.geoJSON = L.geoJSON(S.level.rawD... | [
"function newMap(){\n\tresetVars();\n\tisNew = true;\n\n\tworld = new Array(WORLDHEIGHT);\n\n\tupdateMap();\n\tisNew = false;\n}",
"function newGame(){\n\tgame = new Game();\n\tSession.set('currScore','0 ');\n\tSession.set('currTurn',0);\n\tSession.set('points','');\n\tSession.set('distance','');\n\t$('#newGame')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End document.ready Displays an entire 'page' of EventBrite API contents. Basically calls displayFiveEvents repetitively. | function displayOnePage(current_counter, page_size, events, callback){
displayNextFewEvents(current_counter, page_size, events, function() {
$('#loading').hide('slow');
console.log('displayEvents: Callback!');
$('#follow_up_action').show('slow');
current_counter += 5;
}); //End displayEvents
$(windo... | [
"function displayNextFewEvents(initial_counter, page_size, events, callback){\n\tconsole.log('initial_counter: ' + initial_counter); \n\n\t// If there are less than five events, display those events. Not five. \n\tif (page_size-initial_counter<5){\n\t\tvar maximum_display_counter = page_size - initial_counter; \n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
xStopPropagation, Copyright 20042007 Michael Foster (CrossBrowser.com) Part of X, a CrossBrowser Javascript Library, Distributed under the terms of the GNU LGPL | function xStopPropagation(evt)
{
if (evt && evt.stopPropagation) evt.stopPropagation();
else if (window.event) window.event.cancelBubble = true;
} | [
"function xStopPropagation(evt)\n{\n if (evt && evt.stopPropagation) evt.stopPropagation();\n else if (window.event) window.event.cancelBubble = true;\n}",
"function stopPropagation(e){e.stopPropagation();}",
"function stopBubbling(evt){\n evt.stopPropagation();\n evt.cancelBubble = true;\n}",
"disabl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies default options to the dialog config. | function _applyConfigDefaults(dialogConfig) {
return extendObject(new MdDialogConfig(), dialogConfig);
} | [
"useDefaults(): DialogConfiguration {\n return this.useRenderer(defaultRenderer)\n .useCSS(defaultCSSText)\n .useStandardResources();\n }",
"function _applyConfigDefaults$1(dialogConfig) {\n\t return extendObject(new MdDialogConfig(), dialogConfig);\n\t}",
"function defaultSettings()\r\n{\r\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Static method. Given an array of WriteRecords, a filter for which ones to include, and a path, construct the tree of event data at that path. | function writeTreeLayerTree_(writes, filter, treeRoot) {
var compoundWrite = CompoundWrite.empty();
for (var i = 0; i < writes.length; ++i) {
var write = writes[i];
// Theory, a later set will either:
// a) abort a relevant transaction, so no need to worry about excluding it from calcula... | [
"function buildTree(records) {\n if (records === \"\") {\n return \"\";\n }\n \n var resObj = {},\n hash = {};\n\n records.forEach( function(record) {\n appendRecord(resObj, record, hash);\n });\n\n return resObj;\n}",
"static shiftEvents(events, path) {\n if (path) {\n events = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a new OrgApacheJackrabbitOakSecurityAuthenticationLdapImplLdapIdentityProviderProperties. | constructor() {
OrgApacheJackrabbitOakSecurityAuthenticationLdapImplLdapIdentityProviderProperties.initialize(this);
} | [
"constructor() { \n \n OrgApacheJackrabbitOakSpiSecurityAuthenticationExternalImplExProperties.initialize(this);\n }",
"constructor() { \n \n OrgApacheJackrabbitOakSecurityUserUserConfigurationImplProperties.initialize(this);\n }",
"constructor() { \n \n OrgApache... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Timer Loop Functions / set loop label to input (when not the start of a loop) | function setloopLabel(Labelnew){
loopLabel.textContent = Labelnew;
} | [
"function resetLoopIndex(){\nindexLoop = 0;\nupdateloopLabel();\n}",
"function ClearLabel(){\n\tlabelTimer=5;\n\twhile(labelTimer>0){\n\t\tlabelTimer-=Time.deltaTime;\n\t\tyield;\n\t}\n\tlabel.text=\"\";\n}",
"function timerLooping() {\n timer();\n startTimer = setTimeout(timerLooping, 1000);\n}",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
host_id must have a valid profile_id | function validHostID(req, res, next) {
Profiles.findById(req.body.host_id)
.then((profile) => {
if (profile) {
req.profile = profile;
next();
} else {
res.status(400).json({
message: 'Invalid Host ID',
});
}
})
.catch(next);
} | [
"function retrieveProfile(hosts, hostName) {\r\n\r\n if (null == hostName) {\r\n //error! lack of attribute \"profile-id\"\r\n throw new Error(\"Error! Lack of host name: \" + hostName + \".\");\r\n }\r\n\r\n\r\n var hostNodes = hosts.selectNodes(\"host\");\r\n var i;\r\n var node;\r\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Close the modal image by setting its display attribute to none | function closeModalImage() {
modal.style.display = "none";
} | [
"function closePhotoModal() {\n document.getElementById('photo-modal').style.display = \"none\";\n}",
"function closeUserAccountModalMainImage() {\n userAccountModalMainImage.style.display = 'none';\n }",
"function closeBox(){\n document.getElementById(\"modalBox\").style.display = \"none\";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ask the dir to save in at the user. It will be initialized with the last used save dir | function getBaseSaveDir()
{
// get the previous save dir
var prevSaveDir = null;
// get the previously used dir from preferences
prefs = Services.prefs.getBranch("extensions.FlickrGetSet.");
try
{
prevSaveDir = prefs.getComplexValue("saveDir", Components.interfaces.nsILocalFile);
} catch (e){}
// g... | [
"static async askSave(editor) {\n // determine default directory to save to\n let defaultPath = atom.project.getPaths()\n if (defaultPath.length > 0) {\n defaultPath = defaultPath[0]\n } else {\n defaultPath = os.homedir\n }\n // ask to choose a pathname\n pathname = await electron.re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes ticket selected by id posted by user with `userID` | function remove(ticketID, userID) {
return db("tickets").where({ id: ticketID, posted_by: userID }).delete();
} | [
"function removeTicket(id) {\n let toRemove = document.getElementById(id);\n toRemove.remove();\n removeListTicket(toRemove.id);\n}",
"function removeId() {\n delete ticket.id\n}",
"async deleteUserByID(userID) {}",
"function deleteUserHTML(userID) {\n document.getElementById(userID).remove();\n delete ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Private Eye Recall that: Public properties can be accessed from outside the class Private properties can only be accessed from within the class Using constructor notation, a property declared as this.property = "someValue;" will be public, whereas a property declared with var property = "hiddenValue;" will be private. ... | function StudentReport() {
this.grade1 = 4;
this.grade2 = 2;
this.grade3 = 1;
this.getGPA = function() {
return (this.grade1 + this.grade2 + this.grade3) / 3;
};
} | [
"function Grade(grade, teacher, student) {\n this.grade = grade;\n this.teacher = teacher;\n this.student = student;\n}",
"function GradeBook() {\n this.questions = [];\n this.passed = false;\n}",
"function StudentReport() {\r\n var grade1 = 4;\r\n var grade2 = 2;\r\n var grade3 = 1;\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fills the card with moves and moves icon, also adds DP if applicable response is the data from the API with card information whichCard refers to the either of the player 1 or 2 pokemon cards | function getMoves(response,whichCard) {
for (let i=0; i<response.moves.length; i++) {
qsa(whichCard +" .move")[i].innerHTML = response.moves[i].name;
let typeIcon = response.moves[i].type;
qsa(whichCard +" .moves img")[i].src = "icons/" + typeIcon+".jpg";
if (res... | [
"function fillCard(response, whichCard) {\n qs(whichCard +' .name').innerHTML = response.name;\n qs(whichCard +' .hp').innerHTML = response.hp + \"HP\";\n qs(whichCard +' .type').src = response.images.typeIcon;\n qs(whichCard +' .pokepic').src = response.images.photo;\n qs(whichCa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that loads and deletes the appropriate html content | function changeContent() {
$("#view").empty();
$("#view").load(this.id + ".html");
} | [
"function deletePageContents() {\n\n content.removeChild(content.lastChild);\n content.removeChild(content.lastChild);\n\n }",
"function clearcontenthtml() { // this function is to clear the page back to original clean slate before any action was taken\n var request = new XMLHttpRequest(); // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
example 2 Make a constructor function with properties: name, totalCoin, status, star, setName, gotHit, gotPowerup, gameActive cunstructor | function Player() {
this.name = this.setName();
this.setName = function ('Mario') {
// Creating a function that has 1 of 2 possibilitys
if (Math.random() <= .50) {
this.name= "Lugi";
} else {
this.name= "Mario";
}
};
this.totalCoins = 0;
this.a... | [
"constructor(name, health, speed, strength){\n this.name =name;\n this.health = 10;\n this.speed = 3;\n this.strength = 3; \n }",
"constructor(name, hood, colour, food, power) {\n this.name = name; \n this.hood = hood; \n this.colour = co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hide the selected objects | function hideSelectedObjects() {
var layers = webMap._layers;
var objectIds;
for (var i = 0; i < layers.length; i++) {
if (layers[i].active) {
objectIds = Object.keys(layers[i].highlightedObjects);
layers[i].hideObjects(objectIds);
}
}
} | [
"function _hideSelected()\r\n{\r\n\t// update selected elements map\r\n\t_selectedElements = _selectedElementsMap(\"all\");\r\n\t\r\n\t// filter out selected elements\r\n _vis.filter('all', selectionVisibility);\r\n \r\n // also, filter disconnected nodes if necessary\r\n _filterDisconnected();\r\n \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
drawOne: draw a single cartesian or paperref annotation, potentially with modifications index (int): the annotation to draw | function drawOne(gd, index) {
var fullLayout = gd._fullLayout;
var options = fullLayout.annotations[index] || {};
var xa = Axes.getFromId(gd, options.xref);
var ya = Axes.getFromId(gd, options.yref);
drawRaw(gd, options, index, false, xa, ya);
} | [
"function drawOne(gd, index) {\n var fullLayout = gd._fullLayout;\n var options = fullLayout.annotations[index] || {};\n var xa = Axes.getFromId(gd, options.xref);\n var ya = Axes.getFromId(gd, options.yref);\n\n drawRaw(gd, options, index, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[END add_new_condition] [START set_modify_parameter] | function setOrModifyParameter(template) {
// Set header_text parameter.
template.parameters['header_text'] = {
defaultValue: {
value: 'A Gryffindor must be brave, talented and helpful.'
},
conditionalValues: {
android_en: {
value: 'A Droid must be brave, talented and helpful.'
... | [
"canSetParameter(name, value) {\n return true;\n }",
"function updateParam(arg) {\n console.log('Updating Parameter');\n selParam.changeValueAsync(arg);\n let rel = tableau.extensions.settings.get('dpRelevant');\n if (rel == 'true') {\n getParamData();\n }\n}",
"changeContextPa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read and parse the state JSON file. Create the state.json file if it does not exit. | readState () {
return new Promise(function (resolve, reject) {
try {
_this.fs.readFile(_this.config.stateFileName, async (err, data) => {
if (err) {
if (err.code === 'ENOENT') {
// console.log(`${_this.config.stateFileName} not found!`)
console.log('st... | [
"load() {\n try {\n const json = fs.readFileSync(this.stateFile, \"utf8\");\n return JSON.parse(json);\n }\n catch (err) {\n if (err.code === \"ENOENT\") {\n const state = { executed: [] };\n this.save(state);\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parse nodes in FBXTree.Objects.AnimationCurveNode each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation ) and is referenced by an AnimationLayer | function parseAnimationCurveNodes( FBXTree ) {
var rawCurveNodes = FBXTree.Objects.AnimationCurveNode;
var curveNodesMap = new Map();
for ( var nodeID in rawCurveNodes ) {
var rawCurveNode = rawCurveNodes[ nodeID ];
if ( rawCur... | [
"function parseAnimationLayers( FBXTree, connections, curveNodesMap ) {\n \n var rawLayers = FBXTree.Objects.AnimationLayer;\n \n var layersMap = new Map();\n \n for ( var nodeID in rawLayers ) {\n \n var layerCurveNodes = [];\n \n var co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start Image Search Functions Starts the slide show | function startslides() {
if(imgSearch) {
imgSearch.startSlides();
}
} | [
"function js_startSlide() {\n reset();\n sliderImages[0].style.display = 'block'; // Show image 1.\n temporal[current].innerHTML = current + 1 + \"/\" + sliderImages.length; // Print number image is in current location.\n dots[current].classList.add(\"active\"); // Add class active dot current image.\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
it check the return xml it's the error msg contain if has then out put the errors msg to the outputdom, and return false | function __xmlErrorHandler($xdoc, $outputDom) {
if ($xdoc.documentElement.tagName=="error") {
if ($outputDom!=null) {
$outputDom.innerHTML = "<span style='color:red'>" + $xdoc.documentElement.childNodes[0].text + "</span>";
}else {
__alert($xdoc.documentElement.childNodes[0].text);
}
... | [
"function checkError(xml){\n\t if($(xml).find(\"state\").text()==\"0\"){\n\t //onError($(xml));\n\t console.log(\"ERRORE \"+ $(theError).find(\"error\").text() );\n\t return false;\n\t}else{\n\t\treturn true;\n\t}\n}",
"function checkError(xml) {\n console.log(\"STATE = \" + $(xml).find(\"state\").text()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mapper used to normalize the energy consumption data based on a given normalizer | function mapNormalizer(row, normalizer) {
return {Date: row.Date,
AT: row.AT / normalizer.AT,
BE: row.BE / normalizer.BE,
CH: row.CH / normalizer.CH,
DE: row.DE / normalizer.DE,
DK: row.DK / normalizer.DK,
... | [
"get convertToNormalMap() {}",
"normalize(data) {\n return Processor.normalize(this, data);\n }",
"set convertToNormalMap(value) {}",
"normalize (data) {\n if (data.coordinates.length > 2) {\n return openlayers.proj.transformExtent(data.coordinates, openlayers.proj.get(data.from), openlayers... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove a scheduled job for a project | deleteScheduledJob (jobId) {
console.log('deleteScheduledJob:', jobId);
let user = Auth.requireAuthentication();
// Validate the data is complete
check(jobId, String);
// Validate that the current user is an administrator
if (user.isAdmin()) {
ScheduledJobs.remove(jobId);
} e... | [
"function DeleteJob() {\n\t\tvar oJob,\n\t\t\tlvId;\n\n\t\tvar oIds = _getListOfJobs();\n\n\t\t//Get the Job\n\t\toJob = new $.jobs.Job({\n\t\t\turi: gvJobUri\n\t\t});\n\n\t\t//Loop at List of ID's and delete scheduled Jobs\n\t\tfor (var i = 0; i < oIds.length; i++) {\n\t\t\tlvId = parseInt(oIds[i].ID);\n\t\t\t//De... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a description of all observers. This is currently just a list of observer ids | list_observers() {
var self = this;
return _.map(_.keys(self._observers), function(observer_id) {
return {observer_id: observer_id};
});
} | [
"function getObserversInRoom() {\n var observerList = usersInRoom.filter(function(userInRoom) {\n return (userInRoom.isObserver);\n });\n return observerList;\n }",
"function ObserverList() {\n\t\tthis.observerList = [];\n\t}",
"function ObserverList() {\n this.observerList... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Navigates to a firstlevel item. | _levelOneNavigateFromLowerLevel(method, focusedItem) {
const that = this,
firstLevelItem = that[method](that._openedContainers[2].menuItemsGroup);
if (firstLevelItem) {
if (focusedItem) {
focusedItem.$.removeClass('focus');
focusedItem.removeAttri... | [
"function navigateTo(activeItem) {\n\n var text = $(activeItem).text();\n var path = $(activeItem).data(\"path\");\n var children = parseInt($(activeItem).data(\"children\"));\n\n if (children > 0) {\n\n path = path + \"\\\\\";\n $(idSearchBoxJQ).val(path);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move paddle on canvas | function movePaddle() {
paddle.x += paddle.dx;
// Wall detection
if (paddle.x + paddle.w > canvas.width) {
paddle.x = canvas.width - paddle.w;
}
if (paddle.x < 0) {
paddle.x = 0;
}
} | [
"function movePaddle() {\n paddle.x += paddle.dx\n\n if (paddle.x + paddle.w >= canvas.width) {\n paddle.x = canvas.width - paddle.w\n }\n\n if (paddle.x < 0) {\n paddle.x = 0\n }\n}",
"function movePaddle() { // Every time draw on the canvas with can re-draw with certain element\n paddle.x += paddl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define behavior when the mouse moves away from a country: | function defineMouseOutBehavior(){
d3.selectAll(".country")
.on("mouseout", function() {
// Go back to the non-highlighted stroke style:
d3.select(this).style("stroke","white");
d3.select(this).style("stroke-width", strokeScale(currentScale) + "px");
//remove the tooltip from sight on "mous... | [
"onCountryHoverOff() {\n\n if (!this.isCountryClicked) {\n document.body.classList.remove(\"pointer\");\n\n this.props.actions.setCountryName(\"\");\n\n if (!this.props.isPointHovered)\n this.toggleGlobeVisibility(0, 0.99, 1);\n }\n \n }",
"function onMouseMove(event) {\n event.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sMCSPBeta.track(); / ============== DO NOT ALTER ANYTHING BELOW THIS LINE ! =============== AppMeasurement for JavaScript version: 1.1 Copyright 19962013 Adobe, Inc. All Rights Reserved More info available at | function AppMeasurement(){var s=this;s.version="1.1";var w=window;if(!w.s_c_in)w.s_c_il=[],w.s_c_in=0;s._il=w.s_c_il;s._in=w.s_c_in;s._il[s._in]=s;w.s_c_in++;s._c="s_c";var k=w.cb;k||(k=null);var n=w,g,o;try{g=n.parent;for(o=n.location;g&&g.location&&o&&""+g.location!=""+o&&n.location&&""+g.location!=""+n.location&&g.l... | [
"function AppMeasurement(r) {\n var a = this;\n a.version = \"2.5.0\";\n var k = window;\n k.s_c_in || (k.s_c_il = [], k.s_c_in = 0);\n a._il = k.s_c_il;\n a._in = k.s_c_in;\n a._il[a._in] = a;\n k.s_c_in++;\n a._c = \"s_c\";\n var p = k.AppMeasurement.Pb;\n p || (p = null);\n va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start downloading the photos | function startDownloading()
{
if (isDownloading)
{
log("Downloading process is already busy");
return;
}
isDownloading = true;
for (var i = 0; i < simultaniousDownloads; ++i)
{
downloadNextImage();
}
} | [
"function initImageDownloadCycle(){\n images.downloadAll();\n}",
"function downloadImages() {\r\n\tif (issueImages.length == 0) {\r\n\t\t// Done\r\n\t\tfinish();\r\n\t} else {\r\n\t\t\r\n\t\t// Download file, then call recursive.\r\n\t\timage = issueImages.pop();\r\n\t\tfs.mkdirp(path.dirname(image.path));\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
register events: browserAction clicked extension update available | registerEvents() {
/*
* Activate or Open the Overview tab when extension action is clicked
* This calls the openBomTab with tabs.tab as parameter.
* If the browser action is clicked from the overview or eBay tab, then
*/
browser.browserAction.onClicked.addListener(tab => {
this.bro... | [
"function onBrowserActionClick() {\n info(\"event: browser action icon was clicked\");\n click($(_ID_STATUS));\n}",
"function onBrowserActionClick() {\n info(\"event: browser action icon was clicked\");\n click($(S_gbarToolsNotificationA));\n}",
"function attach_browser_action(){\n\tchrome.browserAction.onC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Back to Category Tab | function backToCategoryTab(){
//$("#categoryAddnew_buttun").show();
$("#categoryAddNew").hide();
$("#categoryEdit").hide();
$(".restaurantCategoryContent").show();
} | [
"function goCategory() {\n\twindow.location.assign(\"category.html\")\n}",
"function previousCategory()\n{\n var position = dojo.cookie(\"CurrentCategory\");\n\n if ((position == null) || (position == undefined))\n {\n position = 0;\n }\n\n position = Math.abs(position);\n position = posi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Execute an action on a specified interval. | function interval(msecs, action) /* forall<e> (msecs : int, action : () -> <sys/dom/types/dom|e> ()) -> <sys/dom/types/dom|e> () */ {
return _bind_interval(msecs, action);
} | [
"function Task(interval, action){\n this._interval = interval;\n this._action = action;\n}",
"schedule() {\n setInterval(this.executeTask , time);\n }",
"startSimulation() {\n this.timeoutInterval = setInterval(() => this.executeNextAction(), this.speed);\n }",
"setInterval(script, i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Links the given function to the given topic. Subsequent calls to `broadcast` with this topic will result in this function being called. Returns a function that unsubscribes as a shorthand for `unsubscribe`. | subscribe(topic, callback) {
if (!Array.isArray(this.subscribersByTopic[topic])) {
this.subscribersByTopic[topic] = [];
}
this.subscribersByTopic[topic].push(callback);
return () => {
this.unsubscribe(topic, callback);
};
} | [
"unsubscribe(topic, callback) {\n const idx = this.subscribersByTopic[topic].indexOf(callback);\n\n if (idx !== -1) {\n this.subscribersByTopic[topic].splice(idx, 1);\n }\n }",
"function subscribe(topic, func) {\n if (!subscriptions[topic]) {\n subscriptions[topic] = [];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Open Photoshop's FileOpen dialog, and return a list of filenames Potential DOM FIX | function photoshopFileOpenDialog()
{
result = new Array();
var nlist = app.openDialog();
for (var i = 0; i < nlist.length; i++)
{
var s = decodeURI(nlist[i].toString());
s = s.replace(/^file:\/\//, "");
if ($.os.match(/^Windows.*/)) // Pull off ":" from drive letter
s = s.replace(/^\/(.):\//, "/$1/");
... | [
"function openFileOrDirectory() {\n dialog.showOpenDialog(win, { \n title: \"Select File(s)\", \n defaultPath: process.env.HOME,\n buttonLabel: \"Choose File(s)\", \n filters: \n [\n { \n name: 'All Files', \n extensions: ['*'] \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear the Revoke Ship It state. This will clear the CSS classes related to the revokation. | _clearRevokingShipIt() {
this._$boxStatus.removeClass('revoking-ship-it');
} | [
"async _revokeShipIt() {\n this._$boxStatus.addClass('revoking-ship-it');\n\n const confirmation =\n RB.ReviewRequestPage.ReviewEntryView.strings.revokeShipItConfirm;\n\n if (!confirm(confirmation)) {\n this._clearRevokingShipIt();\n return;\n }\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transforms a statement and those that follow it. Returns an array of transformed statements. The transformation of a statement may involve the statements following it. For instance, if the statement contains a transformed function call, the function must be called first, and both the statement and those that follow it ... | function transform_statement(statement, subsequent_statements) {
var transformation = statement_transformations[tokens[statement.type]]
if (transformation) {
var transformed = transformation(statement, subsequent_statements)
if (transformed) {
return transformed
}
} else ... | [
"function transform_statements(statements) {\n var statement = statements.shift()\n if (!statement) return []\n \n return transform_statement(statement, statements)\n}",
"function rearrangeStatements(statements){\n\t\tvar l = statements.length,\n\t\t\tret = new Array(l),\n\t\t\n\t\t\tnonFuncStart = 0,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get tenant subscription by Id | getTenantsSubscriptionsById(id, qParams) {
return this.request.get(`/tenant-subscriptions/${id}`, qParams);
} | [
"getSubscription(id) {\n return entities.Subscription.get({ id });\n }",
"static get(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('subscriptionset', 'get', kparams);\n\t}",
"getSubscriptionById(subscriptionId) {\r\n return this._subscriptions[subscriptionId... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a customer invoice (Transaction) and adds it to the customer (Name) | function createCustomerInvoice(database, customer, user) {
const currentDate = new Date();
const invoice = database.create('Transaction', {
id: generateUUID(),
serialNumber: getNextNumber(database, CUSTOMER_INVOICE_NUMBER),
entryDate: currentDate,
confirmDate: currentDate, // Customer invoices alway... | [
"function createTransaction(companyName, companyId, invoiceNum, vendorId, total, sheetId) {\n\tdb.Transaction.create({\n\t\tcompanyName: companyName,\n\t\tcompanyId: companyId,\n\t\tinvoiceNumber: invoiceNum,\n\t\tvendorId: vendorId,\n\t\ttotal: total,\n\t\tSheetId: sheetId\n\t}).then(function(result) {\n\t\tconsol... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onSelectRevision for set value of the revision | onSelectRevision(e) {
this.setState({ Revision: e.target.value });
} | [
"_onRevisionSelected(revisions) {\n let base = revisions[0];\n let tip = revisions[1];\n\n if (base === 0) {\n /* This is a single revision, not an interdiff. */\n base = tip;\n tip = null;\n }\n\n this._navigate({\n revision: base,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Metoda ce implementeaza algoritmul pentru generarea unei variabile aleatoare N(0, 1) folosind Teorema Limita Centrala | static genereazaVariabilaNormala01() {
// Lista pentru numere aleatoare U1...U12
let U = [];
// Se genereaza cu RNG 12 numere aleatoare U1...U12
// uniforme si independente pe (0, 1)
for(let i = 0; i < 12; i++) {
// Atasam numerele in lista
U.push(Math.random());
}
// Iesire Z = U1+...+U1... | [
"function prixMulti() {\n return 20 * nbMultiplicateur;\n}",
"function maximunAllowable_Form(vari, uni){\n \n var d = get_Long(parseFloatWithCommas(vari.maximund_mal), uni.md_sel_mal, \"in\");//Maximun Depth of corroded area\n var D = get_Long(parseFloatWithCommas(vari.pipeo_mal), uni.po_sel_mal, \"in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new output plug for this node and attaches it. Returns the newly created plug. name The name of the new plug. Defaults to an empty string. type The type of the plug. Defaults to null. See NodeGraph.Plug for for information. | addOutput(name = '', type = null)
{
let plug = new NodeGraph.Plug(this, false, name, type);
this.outputPlugs.push(plug);
this.tree.repaint = true;
return plug;
} | [
"addInput(name = '', type = null)\n\t{\n\t\tlet plug = new NodeGraph.Plug(this, true, name, type);\n\t\tthis.inputPlugs.push(plug);\n\n\t\tthis.tree.repaint = true;\n\n\t\treturn plug;\n\t}",
"function generateDirective(type) {\n var directiveName = 'plugin-' + scope.plugin.slug + '-' + type;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a 2dimensional array and a smaller 2dimensional array, return the location of the first match found, or [1,1] if no match is found Ex: given: [ [12,1,4,19], [3,4,11,17], [18,72,2,10], [9,15,32,16]] and [ [11,17] [2,10]] Return [1,2] (this is the location where the inner matrix begins) setup: | function matrixSearch(matrix,search){
for(let i = 0; i < matrix.length; i++){
for(let j = 0; j < matrix[0].length; j++){
if(matrix[i][j] == search[0][0]){
console.log("We found the start of a match!");
let match = true;
//Now we need to search through the
... | [
"function multiDimArraySearch(x, y, a) {\n\tvar length = a.length;\n\tfor (var i = 0; i<length; i++) {\n\t\tif (a[i][0] == x && a[i][1] == y)\n\t\t\treturn i;\n\t}\n\treturn -1;\n}",
"function findArray(array, arrayArray) {\r\n\tfor (i = 0; i < arrayArray.length; i++) {\r\n\t\tvar totalResult = true;\r\n\t\tfor (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a method to retrieve the number of comments. This method will take the postId as a parameter and return an object | getPost(id){
return repo.findComByPost(id).then((response) => {
return { comment_count: response.length-1 }});
} | [
"get commentsCount() {\r\n return this.payload.comments;\r\n }",
"function incrementCommentCount(postId) {\n console.log(\"In incrementCommentCount for \" + postId);\n Q.ninvoke(client, 'hget', KEYS.POSTS, postId\n ).then(function(post) {\n var postJson = JSON.parse(post);\n postJson.comments =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if passed letter is in phrase | checkLetter(letter) {
if ( this.phrase.includes(letter) ) {
return true;
}
else {
return false;
}
} | [
"checkLetter(letter) {\n if (this.phrase.split('').indexOf(letter) > -1) {\n return true;\n } else {\n return false;\n }\n }",
"checkLetter(letter) {\r\n if (this.phrase.includes(letter)) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }",
"checkLetter(l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns array of excluded file and directory names, including default exclusions and global and workspace user preference exclusions. | getExcludedNames() {
const DEFAULT_EXCLUDED_NAMES = [
"node_modules", "tmp", ".git", "vendor", ".nova", ".gitignore"
];
let workspaceIgnoreNames = [];
let globalIgnoreNames = [];
if (FUNCTIONS.isWorkspace()) {
workspaceIgnoreNames = nova.workspace.config.get("todo.workspace-ign... | [
"getExcludedPaths() {\n let workspaceIgnorePaths = [];\n \n if (FUNCTIONS.isWorkspace()) {\n workspaceIgnorePaths = nova.workspace.config.get(\"todo.workspace-ignore-paths\");\n workspaceIgnorePaths = workspaceIgnorePaths.split(\",\");\n workspaceIgnorePaths = workspaceIgnorePaths.map(functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |