query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
create Java Book model in DB | function createJavaBooks(cb) {
mongoDs.automigrate('JavaBook', function(err) {
if (err)
return cb(err);
// var bookArray = loadBookJson(function(err, content) {
// console.log(content)
// })
var bookArray = loadBookJson()
for (var i = 0; i < bookArray.length; i++) {
// here jsonObject['sync... | [
"function createBook(title) {\n return new Promise((resolve, reject) => {\n let bookToSave = new Books({ title });\n bookToSave.save((err, data) =>\n err ? reject(null) : resolve(data));\n });\n }",
"function Book(id,name,author,price,genre){\n this.id = id;\n this.name = name;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds timestamp date from a date | function buildDateFromDate(date){
var year = date.getFullYear();
var month = date.getMonth();
var day = date.getDate();
var hour = date.getHours();
var dDate = new Date(year, month, day, hour);
var sDate = Date.parse(dDate);
return sDate;
} | [
"function buildDateStamp(date) {\n if (date === void 0) { date = new Date(); }\n var year = \"\" + date.getFullYear();\n var month = (\"\" + (date.getMonth() + 1)).padStart(2, '0');\n var day = (\"\" + date.getDate()).padStart(2, '0');\n return [year, month, day].join('-');\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get crewroles description: contracts[].crewRoles.desc; for a given contract id. This will be loaded as drop down for crew roles. | getCrewRoles(contractId) {
return this.mapIntoObject(this.rawData.contracts[0].crewRoles);
} | [
"function getRoles() {\n connection.query(\n \"SELECT title AS role, id FROM role;\",\n (err, res) => {\n if (err) throw err;\n currentRoles = res;\n selectMenuOption();\n });\n}",
"function rolesGetListForMerchantWithRights() {\r\n var url = getBaseURL() + \"Roles/Merchant/Wit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loop through playlist and get the specific video Save the video in the localStorage to reuse on load | function getResult(){
var result;
playlist.items.some(function(item) {
if(item.videoId === videoId){
$window.localStorage.setItem('detailStore', JSON.stringify(item));
result = {video: item, pgparam: pagingToken};
}
});
return result;
} | [
"function getPlaylistData (id) {\r\n\tlet http = new XMLHttpRequest();\r\n\tlet videoUrl = `https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=${id}&key=AIzaSyAlz0tMpkgRIQsZcWK9F7iz3vWpMziyNzg&maxResults=50`;\r\n\tlocalStorage.setItem('playlistRequestUrl', videoUrl);\r\n\thttp.responseType ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sort the list! by = 0 order by text (default) by = 1 order by value by = 2 order by color by = 3 order by background color by = 4 order by class name by = 5 order by id num = if true sorts numbers e.g. 2 before 10 cs = casesensitive e.g. a before Z | function listsort(obj, by, num, cs) { /*updated from version 1.2*/
obj = (typeof obj == "string") ? document.getElementById(obj) : obj;
by = (parseInt("0" + by) > 5) ? 0 : parseInt("0" + by);
if (obj.tagName.toLowerCase() != "select" && obj.length < 2)
return false;
var elements = new Array();
for (var i=0; i<ob... | [
"set sortingOrder(value) {}",
"sort () {\r\n this._data.sort((a, b) => a.sortOrder !== b.sortOrder ? b.sortOrder - a.sortOrder : a.value.localeCompare(b.value))\r\n }",
"function sortWords() {\n sortedList = Object.entries(counts).sort((a, b) => {\n // sort values descending\n if (b[1] > a[1]) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clamps a number between zero and a maximum. | function clamp$1(value, max) {
return Math.max(0, Math.min(max, value));
} | [
"function clamp$1(value, max) {\n return Math.max(0, Math.min(max, value));\n}",
"function clamp01(val){return Math.min(1,Math.max(0,val));}",
"function clamp01(val) {\n return mathMin(1, mathMax(0, val));\n }",
"function clampValue(value){return Math.max(0,Math.floor(value));}",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
works to take in any click resource (wood, stone, iron, food) and add to civ | gatherResource(e) {
e.preventDefault()
let resource = e.data.id
//finding the key inside of civ class that matches the resource clicked then increasing it
let increaseResource =Object.keys(civ).find(x => x === `${resource}`)
civ[`${increaseResource}`]++
//updating DOM to... | [
"function clickSection () {\n addSpecialService()\n addExtraWeight()\n otherWeight()\n pet()\n }",
"function clickSection()\n {\n addSpecialService();\n addExtraWeight();\n otherWeight();\n pet();\n }",
"function C002_FirstClass_Sidney_Click() {\t\n\n\t// Keep the ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the document in the DB | function updateDoc(doc, db){
db.update({ _refObjectUUID: doc._refObjectUUID }, doc, {}, function(err, count){
//console.log('Update: ', count);
});
} | [
"function updateDocument() {\n var id = getObject(\"field-documentId\").value;\n\n var title = getObject(\"field-documentTitle\").value;\n var filename = getObject(\"field-documentFilename\").value;\n\n // Now datetime\n var now = new Date();\n // Put into the following ISO format: yyyy-MM-dd'T'HH:mm:ss.SSSXX... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onAddCartChanged Add to Cart button changed on a set product | function onAddCartChanged() {
logger.info('onAddCartChanged called');
$.trigger('productDetailsTabSet:add_cart_changed');
} | [
"function bindAddToCartEvent() {\n var self = this;\n var addToCartElement = klevu.dom.find(\".kuModalProductCart\", \".productQuickView\");\n if (addToCartElement.length) {\n klevu.event.attach(addToCartElement[0], \"click\", function (event) {\n s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For desplaying message on console | function console_out(msg) {
process.stdout.clearLine();
process.stdout.cursorTo(0);
console.log(msg);
rl.prompt(true);
} | [
"function spitt(msg) {\n shell.echo(msg);\n}",
"function messWithConsole() {\n clearConsole();\n setInterval( addLog, 10 );\n }",
"function printMessage(message) {\n var times = 0;\n screen.style.vivibility = \"hidden\";\n screen.innerHTML = message;\n var blink = setInterval(funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use the user supplied wif key. | function restore_wif_key()
{
// TODO: only be able to do this dependent on state
// TODO: catch invalid strings here
set_funding_key(bitcore.PrivateKey.fromWIF(jQuery('#restore_key').value));
create_uri();
} | [
"function display_wif_key()\n{\n console.log(funding_key.toWIF());\n}",
"wif2privkey(wif){\n\n\t\tlet compressed = false;\n\t\tlet decode = this.base58decode(wif);\n\t\tlet key = decode.slice(0, decode.length-4);\n\t\tkey = key.slice(1, key.length);\n\t\tif(key.length>=33 && key[key.length-1]==0x01){\n\t\t\tkey... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: 'get_yt_title' Fetches Youtube video title | function get_yt_title(ytid, i) {
$.get('https://gdata.youtube.com/feeds/api/videos/' + ytid + '?v=2', function (xml) {
var s = $(xml).find('entry').find('title').text();
document.getElementById('vp-'+i).getElementsByClassName('info')[0].innerHTML = s.slice(0, s.length/2);
});
} | [
"function youtube_video_title(youtube) {\n return youtube.data.items[0].title /* YOUR CODE GOES HERE */\n}",
"function getVideoTitle() {\n return document.querySelector(\".ytp-title-link\").innerText;\n}",
"function getYoutubeTitle(obj) {\n return obj.items[0].snippet.title;\n}",
"function getTitle(videoId... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reenable scroll by canceling scroll listener | function enableScroll() {
$(window).off("scroll", cancelScroll);
$(window).off("wheel", checkScroll);
} | [
"cancelTouchScroll() {\n if (this.isDragging) {\n isWindowTouchMoveCancelled = true;\n }\n }",
"removeScrollHandling() {}",
"unlockScroll() {\n this.scrollLocked = false;\n }",
"resetScroll() {}",
"function _unblockScrolling() {\n\t Utils.removeEvent($(wind... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create An SQS Queue. Returns The New Queue URL | function CreateSqsQueue(name, deliveryDelaySec, maxSizeBytes, retentionPeriodSec, recWaitTimeSec, visTimeoutSec)
{
var output = HttpGet(SQS_WS_ROOT + "CreateQueue.php?name=" + encodeURIComponent(name)
+ "&deliveryDelaySec=" + encodeURIComponent(deliveryDelaySec)
+ "&maxSizeBytes="... | [
"function createQueue(cb) {\n sqs.createQueue({\n 'QueueName': 'TweetsQ'\n }, function (err, result) {\n if (err !== null) {\n console.log(util.inspect(err));\n return cb(err);\n }\n console.log(util.inspect(result));\n // get queue url\n config.QueueUrl = result.QueueUrl;\n\n cb();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute the upper bound on time before two shapes penetrate. Time is represented as a fraction between [0,tMax]. This uses a swept separating axis and may miss some intermediate, nontunneling collision. If you change the time interval, you should call this function again. Note: use Distance to compute the contact point... | function TimeOfImpact(output, input) {
var timer = Timer.now();
++stats.toiCalls;
output.state = TOIOutput.e_unknown;
output.t = input.tMax;
var proxyA = input.proxyA;
// DistanceProxy
var proxyB = input.proxyB;
// DistanceProxy
var sweepA = input.sweepA;
// Sweep
var sweepB ... | [
"function TimeOfImpact(output, input) {\n var timer = Timer.now();\n\n ++stats.toiCalls;\n\n output.state = TOIOutput.e_unknown;\n output.t = input.tMax;\n\n var proxyA = input.proxyA; // DistanceProxy\n var proxyB = input.proxyB; // DistanceProxy\n\n var sweepA = input.sweepA; // Sweep\n var sweepB = input... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onSubmitData function to validate login and navigate to dash board screen | onSubmitData() {
if (this.state.email == '' || this.state.password == '')
alert("Please fill out all fields!");
else if(this.state.email != '' && this.state.password != '' && this.validInput(this.state.email))
Actions.reset('dashBoard'); // Navigate to dashBoard screen
... | [
"function login() {\n //\n // Extract login credentials from login view\n //\n const loginData = document.getElementsByName(\"logindata\");\n //\n // Validate credentials if provided\n //\n if (loginData[0].value !== '' && loginData[1].value !== '') {\n //\n // Validate login credentials\n //\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUBLIC METHODS. I add the given date/time delta to the given date. A new date is returned. | function add( part, delta, input ) {
var result = new Date( input );
switch ( part ) {
case "year":
case "y":
result.setFullYear( result.getFullYear() + delta );
break;
case "month":
case "M":
result.setMonth( result.getMonth() + delta );
break;
case "day":
case "d":
... | [
"addDate(newDate) {\n\t\tthis.date = newDate;\n\t}",
"function dateAdd(date, years, months, days, hours, minutes, seconds) {\n validateArgs(arguments, \"dateAdd\", 7, 7, [null, Number, Number, Number, Number, Number, Number]);\n if (date === undefined) {\n return date;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a dir path to dir id mapping. It makes sure the dir path ends with a slash '/' | function addDirPathToIdMap(dirPath, dirId) {
//make sure the dir path ends with a slash
dirPath = addEndingPathSeparator(dirPath);
//add the dir path to dir id mapping
pathToIdMap[dirPath] = dirId;
} | [
"function removeDirPathToIdMap(dirPath) {\n\n //make sure the dir path ends with a slash\n dirPath = addEndingPathSeparator(dirPath);\n\n //delete the dir path to dir id mapping\n delete pathToIdMap[dirPath];\n}",
"function getIdFromDirPath(dirPath) {\n\n //make sure the dir path ends with a slash\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
After the questionPool is empty (after a full round), regenerate the pool with randomly ordered questions Choose the next currentQuestion and remove it from the questionPool If it is the first game of the session, simply select a question from the pool and display related data and remove from pool | function nextQuestion(currentQuestion){//split this into a reset function and new question function
if(questionPool.length < 1){
questionPool = getQuestionPool(answerPool, hintPool);
currentQuestion = questionPool[Math.floor(Math.random()*questionPool.length)];
}
//This is used only for gameStart at the fir... | [
"function randomiseQuestionOrder() {\n questionPool = questionsSet.length;\n let randomNumber = Math.floor(Math.random() * questionPool); // Gets a random number between 1 and the total number of questions remaining in the question pool\n currentQuestion = questionsSet[`${randomNumber}`]; // Finds a questi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes player/enemy ship from player/enemy space | function removeShip(ship){
let shipHTML = document.getElementById(ship.getID());
shipHTML.remove();
} | [
"function removeShip(ship) {\r\n\t\r\n\tfor (var i = 0; i < ship.length; i++)\r\n\t\t$(\"#\"+ship.placement[i]).css('background-color', 'gray');\r\n\t\r\n\tif (turn == 'p1') {\r\n\t\t\r\n\t\tfor (var i = 0; i < p1ShipArray.length; i++) {\r\n\t\t\t\r\n\t\t\tif (p1ShipArray[i].name == ship.name)\r\n\t\t\t\tp1ShipArra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exit a parse tree produced by Grammar19Parsera39. | exitA39(ctx) {
} | [
"exitParse(ctx) {\n\t}",
"function translator_terminate()\n{\n this.parser.terminate();\n}",
"exitBinaryExpressionAtom(ctx) {\n\t}",
"exitSyntaxBracketRa(ctx) {\n\t}",
"exitEraDeclaration(ctx) {\n\t}",
"function stepEndLexer() {\n while (lexI < lexText.length) stepLexer(false);\n}",
"exitDeclaration... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Breaks up the given `template` string into a tree of token objects. If `tags` is given here it must be an array with two string values: the opening and closing tags used in the template (e.g. [""]). Of course, the default is to use mustaches (i.e. Mustache.tags). | function parseTemplate(template, tags) {
template = template || '';
tags = tags || mustache.tags;
if (typeof tags === 'string') tags = tags.split(spaceRe);
if (tags.length !== 2) throw new Error('Invalid tags: ' + tags.join(', '));
var tagRes = escapeTags(tags);
var scanner = new Scanner(templ... | [
"function parse(template, tags) {\n tags = tags || exports.tags;\n\n var tagRes = escapeTags(tags);\n var scanner = new Scanner(template);\n\n var tokens = [], // Buffer to hold the tokens\n spaces = [], // Indices of whitespace tokens on the current line\n hasTag = false, // I... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function identifies the campaigns and keywords to be processes and deletes the keyword satisfying the criteria | function accountKeywordDeletion() {
// Account completion flag
var accountDone = 0;
// After first run this can throw an error as the label already exists, but we can ignore.
try {
AdWordsApp.createLabel( LABELS_NAME[0] );
} catch (e) {} // Nothing to do about this error
var currentAccountId = AdWo... | [
"deleteOldKeywords(){\n let currentTimeMillis = new Date().getTime();\n for(let word in this.keywords){\n if(currentTimeMillis - this.keywords[word].date > this.timeWindow){\n delete this.keywords[word];\n }\n }\n this.save();\n }",
"function rem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the table column title for the boots count. | function _bootColumnTitle() {
var tooltipNode;
tooltipNode = html.tooltip();
tooltipNode.setAttribute(
'title', 'Total/Successful/Failed/Other boot reports');
tooltipNode.appendChild(
document.createTextNode('Boot Results'));
... | [
"function create_table_title(){\n if (table_view_type == 'case_type'){\n return year + ' ' + locales[current_locale].court_types[court_type.id] + ' ' + locales[current_locale].table_data;\n }else if (table_view_type == 'year'){\n return locales[current_locale].court_types[court_type.id] + ': ' + locales[cur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate a prepositional phrase | function prepphrase(){
var presponse=[];
var array=pp[r(pp)]
if (array==pp1){
presponse.push(array[0][r(array[0])])
presponse.push(nbar())
}
else{presponse.push('')}
return presponse;
} | [
"function createSentence() { \n var sentence = noun[1] + ' ' + verb[1] + ' ' + preposition[1]; \n return sentence;\n}",
"function generatePhrase() {\n\n const pronouns = ['My', 'His', 'Her', 'Its', 'Our', 'Their'];\n\n const pi = Math.floor(Math.random() * pronouns.length);\n const ni = Math.floor(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes a String with number charachters in it and returns only the numbers and decimals as a Number type | function extractOnlyNumbersAndDecimalsFromString(str)
{
str = str.replace(/\s+/g, ""); //Remove blank spaces from string
var numString = "";
for(var i=0; i<str.length; i++)
{
var curChar = str[i];
//console.log(currencyString+" Looking at "+str[i]);
if(!isNaN(curChar) || curChar ... | [
"function extractOnlyNumbersFromString(str)\n{\n str = str.replace(/\\s+/g, \"\"); //Remove blank spaces from string\n var numString = \"\";\n for(var i=0; i<str.length; i++)\n {\n var curChar = Number(str[i]);\n //console.log(currencyString+\" Looking at \"+str[i]);\n if(!isNaN(cur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RenderSelection creates a Select component given an array arr | function RenderSelection(props) {
const dispArr = [<option >{""}</option>];
if (props.arr) {
props.arr.forEach(element => {
dispArr.push(<option >{element}</option>);
});
}
return (
dispArr
);
} | [
"caricaSelect() {\n return html `\n <select class=\"custom-select custom-select-lg mb-3\" id=\"selDoc\">\n <option value=0 selected>Choose...</option>\n ${this.docUt.map(doc => this.createRow(doc))}\n </select>`\n }",
"renderSelect(options) {\r\n co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper functions / Takes in a query word and a matching string and returns how well the string matches the query words as an integer score. | function scorePart(query, string) {
// split the string into words and filter the ones which contain the query
var matchingWords = string.split(' ').filter(function (word) {
return word.indexOf(query) !== -1;
});
// go through each matching word, with a base score relative to the
// number ... | [
"function similarity(query, testString) {\n\t\t// console.log(query);\n\t\t// console.log(testString);\n\n\t\t// ignore case sensitivity\t\t\n\t\tquery = query.toLowerCase();\n\t\ttestString = testString.toLowerCase();\t\n\t\tvar i = 0, j = 0, total = 0;\n\t\twhile(i < query.length && j < testString.length) {\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For unpinned tabs, moves the specified tab(s) right one position, rotating to the start if already at the last unpinned position (or last tab if no tabs are pinned). For pinned tabs, does the same thing, but with first/last limited to the group of pinned tabs. If multiselected/highlighted tab handling is enabled, and a... | function moveTabsRight(tabs, tabsToMove) {
var lastTab = tabsToMove[tabsToMove.length-1];
var indexLimit = getIndexLimitInDirection(tabs, lastTab, DIRECTION_RIGHT);
var newIndex = getNextUsableTabIndex(tabs, lastTab, DIRECTION_RIGHT, indexLimit);
if(tabsToMove[0].pinned) {
if(!disableTabWrap && ... | [
"function moveTabsLast(tabs, tabsToMove) {\n var newIndex = -1;\n\n // For Chrome, index -1 always works as last index in group for both pinned and un-pinned tabs.\n // Firefox needs special treatment\n if(IS_FIREFOX) {\n var newIndex = (tabs.length-1);\n if(tabsToMove[0].pinned) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function searches assets by their content variables (i.e. assetType, eventTypes, mediaTypes, coordinates etc) | async function assets(zone, type, id){
// id variable can be null
/** set the variables, query headers and query url will be specified here.
* Each request will be made in this function
* options for eventTypes, mediaTypes and assetTypes are specified here
*/
... | [
"async QueryAssetsByOwner(ctx, owner) {\n\t\tlet queryString = {};\n\t\tqueryString.selector = {};\n\t\tqueryString.selector.docType = 'asset';\n\t\tqueryString.selector.owner = owner;\n\t\treturn await this.GetQueryResultForQueryString(ctx, JSON.stringify(queryString)); //shim.success(queryResults);\n\t}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add new element to the queue | function enqueue(newElement){
queue.push(newElement);
} | [
"add(item) {\n this.queue.unshift(item);\n }",
"enqueue(element) {\n // Write the code here.\n this.items[this.count] = element;\n this.count++;\n }",
"add(value) {\n this.queue.unshift(value);\n this.size++;\n }",
"add( data ) {\n this._queue.push( data );\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find all spans with class date, and set value to localized date string e.g. enUS: 12/2/15 enUK: 2/12/15 | function updateDates() {
$('span.date').each(function (index, dateElem) {
var formatted = moment($(dateElem).data('date')).format('l');
formatted = formatted.replace(/\d\d(\d\d)/, "$1");
$(dateElem).text(formatted);
});
} | [
"function update_date() {\n for(let element of query_all('.date'))\n\telement.textContent = format_date(element.dataset.ts);\n}",
"function calculateDates() {\n var message_date = \"\";\n \n jQuery(\".supp_data\").each(function(){\n message_date = prettyDate(new Date($(this).children(\".supp_millidate\")... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function assigns image "datastate" attribute | function assignDataState() {
// Sets this variable equal to the data state of the item clicked
var state = $(this).attr("data-state");
// If the "data-state" attribute is set to "still"
if (state === "still") {
// Then change the source to the moving image URL
$(this).attr("src", $(this).attr("data-animate"... | [
"function _set_imgData(index, red = 0, green = 0, blue = 0, alpha = 255) {\r\n imgData.data[index] = red;\r\n imgData.data[index + 1] = green;\r\n imgData.data[index + 2] = blue;\r\n imgData.data[index + 3] = alpha;\r\n }",
"setData ( imgData, color, index ) { \n imgData.data[ index ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========================================================= SECTION [ wdPlantsByAnyName ] wdPlantsByAnyName has some common requirents for many use case; wdPlantsByAnyNameCommonAssertions collect these requirements so the test case can reuse it | function wdPlantsByAnyNameCommonAssertions(assert, searchTerm, queryResult, hasPlants) {
assert.equal(queryResult.name, searchTerm, 'the json response has a "name" key which value equals to the searched term');
const shouldExpectSomePlants = (hasPlants === undefined) ? true : hasPlants;
if (shouldExpectSomePlants) {... | [
"function resolvedPlantsByNameCommonAssertions(assert, searchTerm, queryResult, hasPlants) {\n\tassert.equal(queryResult.name, searchTerm, 'the json response has a \"name\" key which value equals to the searched term');\n\tconst shouldExpectSomePlants =\t(hasPlants === undefined) ?\ttrue : hasPlants;\n\tif (shouldE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a Lexical Environment | function createLexicalEnvironment({ inputEnvironment: { extra, preset }, policy, getCurrentNode }) {
let envInput;
switch (preset) {
case EnvironmentPresetKind.NONE:
envInput = mergeDescriptors(extra);
break;
case EnvironmentPresetKind.ECMA:
envInput = mergeDe... | [
"function createEnvironment() {\n\tvar environment = {\n\t};\n\n\treturn environment;\n}",
"function startLexicalEnvironment(){ts.Debug.assert(state>0/* Uninitialized */,\"Cannot modify the lexical environment during initialization.\");ts.Debug.assert(state<2/* Completed */,\"Cannot modify the lexical environment... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Developer: Matheus Johann Araujo Date: 25022020 GitHub: form html sync for async > | function FormAsync(){
let formAsync = {}
formAsync.callback = arguments[0] ? arguments[0] : console.log
formAsync.debug = arguments[1] ? arguments[1] : false
formAsync.getInputs = function($element){
let vetInput = false
if($element){
vetInput = []
let tipoInput = ["in... | [
"function FormAsync() {\n var formAsync = {};\n formAsync.callback = arguments[0] ? arguments[0] : console.log;\n formAsync.debug = arguments[1] ? arguments[1] : false;\n\n formAsync.getInputs = function ($element) {\n var vetInput = false;\n\n if ($element) {\n vetInput = [];\n var tipoInput = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PreConditions: AlertView is loaded, and the array of alerts is listed in reverse chronological order PostConditions: Returns single unread alert | displayUnreadAlerts(alert) {
let unreadAlert = (
<div className="unread">
<h2 className="unread">{alert.title}</h2>
<h6 className="unread">{alert.date.toDateString()} at {alert.time}</h6>
<p className="unread">{alert.description}</p>
<b... | [
"getAlertingInteractionstatsAlertsUnread() { \n\n\t\treturn this.apiClient.callApi(\n\t\t\t'/api/v2/alerting/interactionstats/alerts/unread', \n\t\t\t'GET', \n\t\t\t{ },\n\t\t\t{ },\n\t\t\t{ },\n\t\t\t{ },\n\t\t\tnull, \n\t\t\t['PureCloud OAuth'], \n\t\t\t['application/json'],\n\t\t\t['application/json']\n\t\t)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Aqui eu estou passando por todos os itens de "allProducts" e tambem passando o operador "rest" que vai fazer com que cada item seja armazenado em initialState no formato que ele eh, no caso um objeto literal e vai juntar todos os valores, entao se por exemplo eu adicione um produto no array do "allProducts" ele vai atu... | function Products(state = initialState, action){
return (state)
// Aqui eu apenas quero que ele retorne o state que basicamente sao os produtos e nada mais!
} | [
"productList(state) {\n return state.productList || []\n }",
"function getProductState(state) {\r\n return state.products;\r\n}",
"function gotProducts(products) {\n return {\n type: GET_ALL_PRODUCTS,\n products\n };\n}",
"fetch(state, payload) {\n state.products = payloa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Evento para adicionar um novo estilo de luta. | function ClickAdicionarEstiloLuta() {
var estilo_entrada = {
nome: 'uma_arma',
arma_primaria: 'desarmado',
arma_secundaria: 'desarmado',
};
gEntradas.estilos_luta.push(estilo_entrada);
AtualizaGeralSemLerEntradas();
} | [
"function adicionar(alimentoP) {\n alimentoP.id = alimentService.length + 1;\n// console.log(\"Adicionando Alimento: \" + alimentoP);\n alimentService.push(alimentoP);\n }",
"function insertPref(event){ \r\n\r\n const pref = event.currentTarget;\r\n\r\n /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
validating special characters choice | function specialValidation(){
var specialCharacters = "!@#$%^&*()+=";
if(specialCharactersChoice === 'yes'){
return specialCharacters;
}else{
return;
}
} | [
"function specialValidation() {\n var specialCharacters = \"!@#$%^&*()+=\";\n if (specialCharactersChoice == true) {\n return specialCharacters;\n } else {\n return;\n }\n}",
"function validateSpecialChars(input_val) {\n var re = /[\\/\\\\#,+!^()$~%.\":*?<>{}]/g;\n return re.test(input_val);\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
zeruje odpowiedzi wpisane przez uzytkownika | function wyzerujOdp() {
for (var i = 0; i < liczbapytan; i++) {
odpUzytkownika[i] = "";
czyOdpowiedziano[i] = false;
}
} | [
"function clean(obj) {\n delete obj._byz;\n delete obj._fht;\n delete obj._ttrs;\n }",
"wipe() {\n this._setElementValue('', false); // Do not send the 'AutoNumeric.events.formatted' event when wiping an AutoNumeric object\n this.remove();\n }",
"destruir(){\n\t\tthis.cuadro = null\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if viewScreenShareButton button exists , remove it | function removeScreenViewButton(){
if(getElementById("viewScreenShareButton")){
let elem = getElementById("viewScreenShareButton");
elem.parentElement.removeChild(elem);
}
return;
} | [
"function removeScreenViewButton(){\r\n if(document.getElementById(\"viewScreenShareButton\")){\r\n var elem = document.getElementById(\"viewScreenShareButton\");\r\n elem.parentElement.removeChild(elem);\r\n }\r\n return;\r\n}",
"function removeShareBtn() {\n\tif (cmn_tb_domain == 'freeons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
delete the Cell: including its Children if confirmed = true, show | function fDelCell(id,confirmed) {
if (confirmed){
confirmed = confirm("删除单元ID="+id+" 将同时删除其下挂节点!");
} else {
confirmed = true;
}
if (confirmed){
// 删图
fEraseCell(vMap, id, true);
// 删数
fDelDataFandC(vCurCCells, id);
fDelDataFandC(vCurFCells, id);
vDataChanged = true;
vDataSave = true;
}
myLock.l... | [
"function confirmDelete(row){\n setRoomId(row.roomId);\n setConfirmDeleteVisible(true);\n }",
"function deleteCell()\n{\n\tvar cell = document.getElementById($(currentObj).attr('data-pillCount'));\n\tvar\tparentCell = $(cell).parent().attr('id');\n\t\n\t$(cell).remove();\n}",
"function deleteFromView() {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Starts computing weights for tests. | async computeWeightsLoop() {
while ( true ) { // eslint-disable-line no-constant-condition
try {
this.computeRecentTestWeights();
}
catch( e ) {
this.setError( `weights error: ${e} ${e.stack}` );
}
await sleep( 30 * 1000 );
}
} | [
"static setup() {\n this.buildings.sort(this.compareWeights);\n for (let i = 0; i < this.buildings.length; i++) {\n this.weightTotal += this.buildings[i].weight;\n }\n }",
"computeRecentTestWeights() {\n this.snapshots.slice( 0, 2 ).forEach( snapshot => snapshot.tests.forEach... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all the child comments of the given root node, in preorder. | function traverseComments(root_id) {
childNodes = new Array();
// since pre-order, start with root at beginning
childNodes.push(data.nodes[root_id]);
// now recurse through children comments, from top to bottom.
// already sorted by vote count.
var cids = data.nodes[root_id].children_ids;
console.log("CID... | [
"function nestChildComments(comment_list) {\n\tfor (var i = 0; i < comment_list.length; i++) {\n\t\tvar comment = makeCommentObservable(comment_list[i]);\n\t\tif (comment.parentID != null) {\n\t\t\tvar parent = comment_list.find(function(el){return el.id === comment.parentID;});\n\t\t\tif (parent) {\n\t\t\t\tparent... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
to disable console & debug output in browser.. | function disable_logs() {
if (!window.console) window.console = {};
var methods = ["log", "debug", "warn", "info"];
for (var i = 0; i < methods.length; i++) {
console[methods[i]] = function () { };
}
} | [
"disable () {\n console.log = () => {}\n console.info = () => {}\n console.error = () => {}\n }",
"function disableConsole() {\n // console = console || {};\n console.log = function () { };\n console.table = function () { };\n console.warn = function () { };\n}",
"disableConsole() {\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Turns all cards for some time if the game have just started | function turnCards()
{
for (var counter = 0; counter < cards.length; counter++)
{
cards[counter].turn(true);
}
} | [
"function distributeNewCards()\n {\n if (Game.lastTimedEvent === 0)\n {\n Game.lastTimedEvent = Game.frameCounter;\n }\n\n if (Game.frameCounter === Game.lastTimedEvent + 60)\n {\n for (let i = 0; i < Game.userHand.cards.length; i++)\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
region Conversion: Preboard converts a PreboardExamItem item into TestInformation item | static createFromPreboardExamItem(exam = PreboardExamItem.structure){
//convert date string into timestamp
const timestampDate = moment(exam.dateposted, 'YYYY-MM-DD').unix();
return TestInformation.wrap({
examType : EXAM_TYPE.preboard,
title : exam.examname ,
description :... | [
"static convertToPreboardExamItem(info = TestInformation.structure){\n const extraData = (info.extraData || {});\n return PreboardExamItem.wrap({\n examname : info.title ,\n description: info.description ,\n //reassign preboard specific data\n timelimit: info.preboardTimeLimit,\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
======================= Page Display Functions ========================== / The function that actually does the sending of the variables through an Ajax call to Controller.php based on collected information stored in the 'page' parameter sent from other functions in Controller.js. | function displayPageInfo(page){
var postString = page+"=True";
$.ajax({
type: "POST",
url: "Controller.php",
data: postString,
success: function(response){
if(response.includes("placeValues()")){
$("#pageInfo").html(response.replace('placeValues()',''));
placeValues();
}else if(response.include... | [
"function loadDetailsPage() {\n /* pageId equals 0 when the Home Page or the List page \n * is active\n */\n if (pageId != 0) {\n $('#item').html(setDetailPagePoi(pois[pageId]));\n showFavouriteButtons(pageId);\n pageId = 0;\n }\n}",
"function fetchPage (page) {\n\n\n\t\tif (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
votePatients() Params: patientData An associative array of indices to a patient's k nearestNeighbors key = index, value = distance Returns the status of the given patient. | function votePatients(neighbors, testData) {
var votes = new Object();
// weight by distance, nearer neighbors get larger vote
var base = getClosestDelta(neighbors);
for(i in neighbors)
{
var patient = testData[i];
var status = patient[patient.length - 1];
if(votes[status] == null)
{
... | [
"function vote (data) {\n var responses = document.getElementsByClassName('response');\n for (var i = 0; i < responses.length; i++) {\n \n //wipes all responses as not selected\n if (responses[i].className == \"response selected\") {\n responses[i].className = \"response... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns language code for the base language in userAgent it simply takes the hostname which on Khanacademy is the language code | getBaseLanguage() {
var data = location.href.replace('https://','').split('.');
return data[0].replace('https://','');
} | [
"function ls_getLanguage() {\n var language = '';\n \n // Priority:\n // 1. Cookie\n // 2. Browser autodetection\n \n // grab according to cookie\n language = ls_getCookieLanguage();\n \n // grab according to browser if none defined\n if (!language) {\n language = ls_getBrowserLanguage();\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The AddControl adds a control to the map. This constructor takes the control DIV as an argument. | function AddControl(controlDiv, map) {
// Set CSS for the control border.
var controlUI = document.createElement('div');
controlUI.style.backgroundColor = '#fff';
controlUI.style.border = '2px solid #fff';
controlUI.style.borderRadius = '3px';
controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';
contr... | [
"AddControl(/**@type {GUIControl}*/ control) {\n\n\t\tcontrol.ID = this._controls.length;\n\t\tcontrol._parentGUI = this; // TODO: Fix missuse of private accessor\n\t\tthis._controls.push(control);\n\t}",
"addControl (control) {\n debug(' ... Found control: %s', control.key);\n this.controls.add(con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to get largest unsigned integer of a certain length Takes 1 argument (number of bits) | function getLargestIntOfSize(bits) {
var nums = 0;
for(let i = 0; i < bits; i++) nums += Math.pow(2, i);
return nums;
} | [
"function largestInteger (){\n var limit = 12000;\n var n= 0;\n while ((n*n) < limit){\n n++;\n }\n return n - 1;\n }",
"function largestNumber(n) {\n let large = (10 ** n) -1;\n return large\n }",
"function longestOneRunBinary(num){\n\tlet longest = 0, binaryArr = num.toString... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
takes a code, and a callback function for use with async waterfall calls Citi endpoint to exchange a code for an access token. | function fetchToken(code, callback) {
//https request
axios({
method: 'post',
url: TOKEN_URL,
headers:{
"Authorization": ENCODED_ID_SECRET,
"Content-Type": CONTENT_TYPE
},
data: querystring.stringify({
"grant_type": GRANT_TYPE,
"redirect_uri": REDIRECT_URI,
"code":code
})
}).then(function(... | [
"function exchangeToken(code, callback) {\n // make POST to /oauth/token with x-www-form-urlencoded client_id etc.\n request.post({\n url: oauth_config.host+'/oauth/token',\n form: {\n client_id: oauth_config.client_id,\n client_secret: oauth_config.client_secret,\n redirect_uri: oauth_config... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
;; camManageGroup(group, order, data) ;; ;; Tell ```libcampaign.js``` to manage a certain group. The group ;; would be permanently managed depending on the highlevel orders given. ;; For each order, data parameter is a JavaScript object that controls ;; different aspects of behavior. The order parameter is one of: ;; ;... | function camManageGroup(group, order, data)
{
var saneData = data;
if (!camDef(saneData))
{
saneData = {};
}
if (camDef(saneData.pos)) // sanitize pos now to make ticks faster
{
if (camIsString(saneData.pos)) // single label?
{
saneData.pos = [ saneData.pos ];
}
else if (!camDef(saneData.pos.length))... | [
"function camStopManagingGroup(group)\n{\n\tif (!camDef(__camGroupInfo[group]))\n\t{\n\t\tcamTrace(\"Not managing\", group, \"anyway\");\n\t\treturn;\n\t}\n\tcamTrace(\"Cease managing\", group);\n\tdelete __camGroupInfo[group];\n}",
"function manageContactgroupContacts(contactGroup) {\n showManageContactsPage(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Brings in whitelist popup | function viewWhitelist() {
var features = "chrome, dialog, centerscreen, scrollbars";
window.openDialog("chrome://thundersec/content/whitelist.xul", "Whitelist", features);
} | [
"function ShowWhiteList()\n{\n\tdocument.getElementById('black_list_textarea').style.display = 'none';\n\tdocument.getElementById('white_list_textarea').style.display = 'block';\n\tdocument.getElementById('black_list_tab_button').className = 'tab_button tab_button_inactive';\n\tdocument.getElementById('white_list_t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start searching. play indicates if the mode is play or not. If play is true, animation will happen | function startSearch(play) {
$("#status").html("");
bwtView.grid.hideRanks();
var next = query[queryPosition];
bwtView.query.setActive(queryPosition);
range = bwtIndex.start(next);
if (range === null) {
searchFailed();
}else {
queryPosition = queryPosition - 1;
if (pl... | [
"function playTrue() {\r\n play = true;\r\n }",
"function startPlay(){\n if(running) return;\n\n PLAYER_BALANCE -= 1;\n\n updateBalance(PLAYER_BALANCE);\n switchButton(true);\n highlightsOff();\n offBulbs();\n winnings = [];\n resetContainer();\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The rotation of the wrist servo in degrees | get wristRotationDegree() { return this._wristRotation * 180.0 / Math.PI; } | [
"set wristRotationDegree(value) { this._wristRotation = (value / 180.0 * Math.PI); }",
"get rotation() {}",
"getRotationDeg(){\n return this.currentRot* (180/Math.PI);\n }",
"get rotation() {\n // Get the radian angle\n let radianAngle = this.object3d.rotation.z;\n\n // Convert into degrees... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to geneate a new filename for the new photo: | function generateNewPhotoName(previousPhotoName) {
//Remove username from the filename:
var tempStr = previousPhotoName.replace(username,"");
console.log("tempStr: " + tempStr + typeof(tempStr));
//Extract the numeric substring at the end of the filename:
var tempStr2 = tempStr.re... | [
"function getNewName()\r{\r var ext, docName, newName, saveInFile, docName;\r docName = sourceDoc.name;\r ext = '.JPEG'; // new extension for JPEG file\r newName = \"\";\r \r for ( var i = 0 ; docName[i] != \".\" ; i++ )\r {\r newName += docName[i];\r }\r newName += ext; // ful... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change the background image based on the weather type, not sure if there's a way to see all the options available as there's no documentation | function checkWeatherType(type) {
if (type === "Clouds") {
$(".container").css(
"background-image",
"url(" +
"https://static.pexels.com/photos/129539/pexels-photo-129539.jpeg" +
")"
);
} else if (type === "Smoke") {
$(".container").css(
"background-i... | [
"function setBg(weatherObj){\n if(weatherObj.main.humidity>=90 || weatherObj.weather[0].main==\"Rain\" ){\n document.body.style.backgroundImage= \"url('images/rainy.jpg')\";\n }\n else if(weatherObj.main.temp<=10 || weatherObj.weather[0].main==\"Snow\"){\n document.body.style.backgroundImage= \"url('images... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if user is not authenticated for routes that should only be viewed if user is NOT logged in (Login page) | function checkNotAuth(req, res, next) {
// If authenticated, redirect to Home page
if (req.isAuthenticated()) {
return res.redirect('/');
}
// If not authenticated, proceed to requested route
next();
} | [
"function isNotLoggedIn(req, res, next) {\n // if user is authenticated in the session, carry on \n if (!req.isAuthenticated())\n return next();\n\n // if they aren't redirect them to the home page\n res.redirect('/');\n} // end isLoggedIn",
"function checkNotAuthenticated(req, res, next) {\n if (req.is... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
put refreshToken in the token payload | setRefreshToken(refreshToken) {
this.token.refresh_token = refreshToken;
} | [
"function refreshToken() {\n makeRequest({\n refresh_token: refresh,\n client_id: id,\n client_secret: secret,\n grant_type: 'refresh_token'\n });\n}",
"getRefreshTokenData(refreshToken) {\n let params = {};\n params.scope = this.scope;\n params.grant_type = 'refresh_token';\n params.ref... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TrieSetConstructor properties: .root = root of our Trie Tree .radixTable = a hash table containing letter:number pairs going from ASCII 97 to 123 (26). you can make any range of characters applicable by expanding the range. | function TrieSetConstructor () {
if (!(this instanceof TrieSetConstructor)) {
return new TrieSetConstructor(word);
}
this.root = new TrieNodeConstructor("");
this.trieSize = 0;
this.radixTable = {};
this.radixLength = 26;
for (var i = 0; i < this.radixLength; i+=1) {
var lett... | [
"constructor() {\n this.root = new _TrieNode();\n this.lastPrefixNode = this.root;\n this.lastPrefixKey = \"\";\n }",
"function Trie(){\n\t\n\tthis._root = new Node('');\n\n}",
"function TrieNodeConstructor (wordIn) {\n if (!(this instanceof TrieNodeConstructor)) {\n return new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets the value of a jquery object | function setVal(obj,val)
{
obj.val(val);
} | [
"function setPostPickerValue(objWrapper, value){\r\n\t\t\t\t\r\n\t\tvar objSelect = objWrapper.find(\".unite-setting-post-picker\");\r\n\t\t\t\t\r\n\t\tobjSelect.val(value);\r\n\t}",
"function updateValue(valor, destino) {\n $(\"#\" + destino).val(valor);\n}",
"function setFieldValue(el, val){\n \tif(el[0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update the display of the overlay/objectmap to current coordinates and color transfer function | updateobjectmapdisplay() {
let objcoord=this.getobjectmapcoordinates();
let frame=this.internal.slicecoord[3];
let objmapframe=frame;
if (objmapframe>=this.internal.objectmapnumframes)
objmapframe=this.internal.objectmapnumframes-1;
for (var pl=0;pl<... | [
"updateFromCamera() {\n this.updateLabelOffsets();\n this.updateBillboardOffsets();\n dispatcher.getInstance().dispatchEvent(MapEvent.GL_REPAINT);\n }",
"update() {\n\n\t\t// clear screen, scale to current zoom, and translate to current pan parameters.\n\t\tgGraphics.clear();\n\n\t\t// draw order should... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
apply a .led firmware file | updateFirmware (ledFile) {
} | [
"function copyToMicroBit(directory_entry) {\n // Create the hex file to flash onto the device.\n var firmware = $(\"#firmware\").text();\n var hexfile = EDITOR.getHexFile(firmware);\n var hex_filename = filename + '.hex';\n saveFile(directory_entry, hex_filename, hexfile);\n }",
"#load... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
; Params: correct: number, missed: number, noAnswer: number ; Response: number ; Description: Function to calculate the percentage score of the quiz. | function getScore(correct, missed, noAnswer){
let x = (correct / (correct + missed + noAnswer)) * 100;
return x;
} | [
"function scoreTest(correct, questions) {\n var percent;\n percent = (correct / questions) * 100;\n return percent;\n}",
"function getScore(correct, missed, noAnswer){\n let x = Math.round((correct / (correct + missed + noAnswer)) * 100);\n return x;\n }",
"function percentQuizResult(){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Product draft needs reassignment in these cases: 1. more than 1 product matches the draft's SKUs 2. or CTP product (staged or current) does not have exact SKU match with product draft 3. or product type is not the same 4. or 1 product is matched by SKU and number of variants, but slug is not the same in this case, we n... | _isReassignmentNeeded (productDraft, skuToProductMap) {
const productSet = new Set()
const productDraftSkus = this.productService.getProductDraftSkus(productDraft)
productDraftSkus.forEach((sku) => {
const product = skuToProductMap.get(sku)
if (product)
productSet.add(product)
})
... | [
"_selectCtpProductToUpdate (productDraft, products) {\n const matchBySkus = this._getProductMatchByVariantSkus(productDraft, products)\n if (matchBySkus)\n return matchBySkus\n const matchBySlug = this._getProductsMatchBySlug(productDraft, products)\n if (matchBySlug.length === 1)\n return mat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
restarts autoadvance timer for ten seconds | function refreshTimer() {
clearInterval(autoAdvanceTimer);
autoAdvanceTimer = setInterval(autoAdvance, 10000);
} | [
"restartTimer() {\n this.stopTimer();\n this.startTimer();\n }",
"function resetTimer() {\n values.timer = 20;\n }",
"function restartTimer() {\r\n idleTimer && idleTimer.restart();\r\n //console.log('idle timer started');\r\n }",
"restart() {\n this.timer = AquiferTimer.s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads the file from a serialized string | static deserialize(fileString)
{
// split head and data parts
let m = fileString.match(/[^\n]*\n/)
if (m === null)
throw new Error("File has bad format - head not found.")
let head = m[0]
let data = fileString.slice(head.length)
// check file version
... | [
"function loadOBJFromString(string) {\n\n //Pre-format\n var lines = string.split(\"\\n\");\n var positions = [];\n var vertices = [];\n\n for (var i=0; i<lines.length; i++) {\n var parts = lines[i].trimRight().split(' ');\n if (parts.length > 0) {\n switch(parts[0]) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
removes classes from HTML elements to hide welcome modal and display main page content | function hideWelcomeModal() {
$('body').removeClass("modal-open");
$('#welcome-modal').addClass("hide");
$('#modal-backdrop').addClass("hide");
} | [
"function hideCenterModal() {\n disable('infos');\n disable('infos-wrapper');\n\n hide('star-panel');\n hide('constellation-panel');\n hide('about-panel')\n}",
"hide() {\n modal.innerHTML = '';\n if (modal.classList.contains('active'))\n toggleModalView();\n }",
"function modalD... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to add Genesis block | addGenesisBlock(){
let genBlock = new BlockClass.Block("First block in the chain - Genesis block");
genBlock.time = new Date().getTime().toString().slice(0,-3);
genBlock.previousBlockHash = '';
genBlock.hash = SHA256(JSON.stringify(genBlock)).toString();
// Add Genesis block to the chain. The b... | [
"async createGenesisBlock() {\n console.log(\"create Genesis block\")\n const height = await leveldb.getBlockHeight();\n if(height==0){\n this.addBlock(new Block(\"First block in the chain - Genesis block\"));\n }\n }",
"createGenesisBlock() {\n let name = \"First block in the chain - Gen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets an array of objects and returns an array with objects containing only relevant information to create the sites. This information includes: site id, site latitude, site longitude and site name | function getCorrectData(sites){
var data = [];
for(var i in sites){
var id = Number(sites[i].siteID);
var lat = Number(sites[i].siteLat);
var lng = Number(sites[i].siteLong);
var name = sites[i].siteName;
data.push({siteID: id, siteLat: lat, siteLong: lng, siteName: name});
}
return d... | [
"function getSites () {\n let opts = { \n 'pageSize': 25,\n 'pageNumber': 1,\n 'sortBy': \"name\",\n 'sortOrder': \"ASC\",\n };\n telephonyProvidersEdgeApi.getTelephonyProvidersEdgesSites(opts)\n .then((data) => {\n let awsItem = data.entities.find(entitiesItem => entitiesItem.name === \"PureClou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates HTML for guild data table headers. | function generateTableHeader(guilds)
{
let guildNameHeadersHtml = '';
let descriptionHeadersHtml = '';
for (let i = 0; i < guilds.length; i++)
{
guildNameHeadersHtml += `
<th colspan="3" class="tableCellVerticalAlignMiddle" style="background-color: ${guilds[i].backgroundColor}; font-size: 20px; paddin... | [
"generateHeader() {\n // string of HTML for table header\n var headerHTML = '<tr>';\n // generate header item for each column\n for (var col of this.colNames) {\n if (col == \"id\") {\n headerHTML += `<th>${col.toUpperCase()}</th>`;\n } else {\n headerHTML += `<th>${toTitleCase(c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to create a palm with 4 fingers attacched to the leg input | function create_fingers(leg) {
var sizePalm= 0.02;
var heightPh = 0.04;
var widthPh = 0.015;
var depthPalm = 0.01;
var palmLeft = BABYLON.MeshBuilder.CreateBox("palm",{size:sizePalm,depth:depthPalm});
palmLeft.rotation.x += Math.PI/2;
palmLeft.rotation.y += Ma... | [
"function paddleright() {\n rect(paddles.x2, paddles.y2, 15, 100);\n}",
"function mLfingerPopper() {\n //Determines where and how you are pointing your index finger\n if (predictions.length > 0) {\n let hand = predictions[0];\n let index = hand.annotations.indexFinger;\n let tip = index[3];\n let b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End Given Code, don't edit above here... / Write your implementation of greet() let timeString="08:40"; | function greet(timeString){
let text;
let x= timeString.split(":");
if (x[0]<12 && x[1]>=0){
text="Good Morning";
}
else if (x[0]>12 && x[0]<17 && x[1]>=0){
text="Good Afternoon";
}
else if (x[0]>17 && x[1]>=0){
text="Good Evening";
}
return text;
} | [
"function greet(time){\n text = parseInt(time.split(\":\")[0])\n if (text < 12){\n return \"Good Morning\"\n }\n else if (17 > text && text >= 12){\n return \"Good Afternoon\"\n }\n else {\n return \"Good Evening\"\n }\n }",
"function greeting(inpTime) {\n // get current hour and minutes\n l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check and attempt autorepair of messages. Returns false if messages are too wrong to repair. Useful for developers : it would be too cumbersome to require all translation keys during dev it's hard to spot a missing key without help | function check_and_autorepair_bundle(i18n_messages, target_locale) {
var checks_ok = false; // so far
var target_locale = requested_locale_cursor.get();
checking: {
if (! _.isObject(i18n_messages)) {
console.error('i18n messages for "' + target_locale + '" are not an object !');
break checking;
}
... | [
"function verify_message_keys(aSynSet) {\n let iMsg = 0;\n for (let msgHdr of aSynSet.msgHdrs()) {\n let glodaMsg = aSynSet.glodaMessages[iMsg++];\n if (msgHdr.messageKey != glodaMsg.messageKey) {\n mark_failure([\n \"Message header\",\n msgHdr,\n \"should have message key \" +\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
global QUnit:false Tile:false / exported Tile_Test Unit test function for Tile. | function Tile_Test() {
'use strict';
QUnit.module('Tile');
QUnit.test('basic', function(assert) {
var bad = Tile._kBadTile;
var char1 = new Tile(Tile.TileType.CHARACTER, 1);
var char3 = new Tile(Tile.TileType.CHARACTER, 3);
var wind3 = new Tile(Tile.TileType.WIND, 3);
... | [
"function Tile (x, y, type) {\n this.coord = [x, y]\n this.elevation = type\n this.continent = 0\n this.visited = false\n}",
"__init9() {this.hasAnimatedTile = false;}",
"function setupTiles() {\n TileRewireAPI.__Rewire__('tileInfo', {\n NAME_1: { id: 1, a: '1', b: '2' },\n NAME_2: { id: '2',... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
insert a row into the tbl_messages table | function insert_message(topic, message_str, packet) {
var message_arr = extract_string(message_str); //split a string into an array
var clientID= message_arr[0];
var message = message_arr[1];
var sql = "INSERT INTO ?? (??,??,??) VALUES (?,?,?)";
var params = ['tbl_messages', 'clientID', 'topic', 'message', clientI... | [
"function insert_message(message) {\n\tvar msg=message.toString();\n\tvar sql1=`SELECT id from bundles WHERE id='${msg}'`;\n\tconnection.query(sql1,function(err, rows, fields){\t\n\t\tif(rows[0]!=undefined){\n\t\t\tvar sql3=`UPDATE kunbuns SET status='1' where id='${msg}'`;\n\t\t\tconnection.query(sql3,function(err... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
addOption(select_object,display_text,value,selected) Add an option to a list | function addOption(obj,text,value,selected) {
if (obj!=null && obj.options!=null) {
obj.options[obj.options.length] = new Option(text, value, false, selected);
}
} | [
"function EZselectOptionAdd(listObject, text, value, selected, options)\n{\n\tif (typeof listObject != 'object') return\n\tif (!options) options = '';\n\tif (EZcheckOptions(options,'fastselect'))\n\t{\n\t\tEZselectOption(listObject, text, value, selected);\n\t\treturn;\n\t}\n\n\tvar opt = listObject.options.length\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Guess the type of a data file from file extension, or return null if not sure | function guessInputFileType(file) {
var ext = getFileExtension(file || '').toLowerCase(),
type = null;
if (ext == 'dbf' || ext == 'shp' || ext == 'prj' || ext == 'shx' || ext == 'kml' || ext == 'cpg') {
type = ext;
} else if (/json$/.test(ext)) {
type = 'json';
} else if (ext == 'csv... | [
"function getFiletype (file) {\n var dotIndex = file.lastIndexOf('.');\n if (dotIndex == -1) {\n return \"No filetype specified\";\n } else {\n return file.substring(file.lastIndexOf('.'), file.length)\n }\n}",
"function getFileType(filename)\n{\n\treturn (/[.]/.exec(filename)) ? /[^.]+$... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Perform a check to see if the username is already taken If so, message NickServ to ghost back the name | function checkUsername(message) {
// If the username has been taken, and a new one (with a number on the end) has been assigned
// try to Ghost the other user
if (client.nick.match(new RegExp(settings.client.user + '[0-9]+'))) {
client.say('nickserv', 'ghost ' + settings.client.user + ' ' + settings.client.pa... | [
"function usernameAlreadyExists(username){\n return false;\n }",
"function nickNameStorageCheck(userName) {\n getUUID();\n getNickName();\n}",
"function setUserName() {\n if(!exists(USER_NAME)) {\n var name = genUserName();\n save(USER_NAME, name);\n username_lbl.text(nam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructor for the typing panel | function TypingPanel(div) {
this._div = div;
this._el = DOM.bind(this._div);
this.update();
} | [
"function init() {\r\n /* Make spanElement = .txt-type class, words = parseJSON format of the words array, wait time = number in wait attribute */\r\n const spanElement = document.querySelector('.txt-type');\r\n const words = JSON.parse(spanElement.getAttribute('data-words'));\r\n const wait = spanEleme... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Registers this addons static content to the server, but only if this addon has been loaded at startup | _registerStaticPath(app) {
if (this.instance.staticPath) {
this.hasStaticContent = true;
// Can only load static content during startup
// otherwise it will be overridden by error route
if (this.loadedDuringStartup) {
const folderPath = path.join(this.addonPath, this.instance.static... | [
"async function install() {\n console.log('Locomote: Starting service worker installation');\n // Refresh all content origins.\n await refreshAll();\n console.log('Locomote: Refreshed %d content origin(s)', Origins.length );\n // Clear out any previously cached statics.\n await caches.delete('stat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Slice and Splice You are given two arrays and an index. Use the array methods slice and splice to copy each element of the first array into the second array, in order. Begin inserting elements at index n of the second array. Return the resulting array. The input arrays should remain the same after the function runs. SO... | function frankenSplice(arr1, arr2, n) {
// It's alive. It's alive!
// my code
// copy the elements in arr2 and assign them to newArr so that we don't change arr2
let newArr = arr2.slice();
// starting from n index, delete 0 elements, and insert arr1(unpacked with the spread operator)
newArr.spli... | [
"function frankenSplice(arr1, arr2, n) {\n\n let newarr2 = arr2.slice();\n newarr2.splice(n, 0,...arr1);\n \n return newarr2;\n }",
"function frankenSplice(arr1, arr2, index) {\n const newArr = arr2.slice();\n newArr.splice(index, 0, ...arr1);\n return newArr;\n}",
"function insertAdOffers(array1,a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws dependencies on vertical scroll | onVerticalScroll() {
// ResizeMonitor triggers scroll during render, make sure render is done
if (this.isDrawn) {
// Do not invalidate on scroll, if height changes it will be invalidated anyway
this.scheduleDraw(false);
}
} | [
"onVerticalScroll() {\n // ResizeMonitor triggers scroll during render, make sure render is done\n if (this.isDrawn) {\n // Do not invalidate on scroll, if height changes it will be invalidated anyway\n this.scheduleDraw(false);\n }\n }",
"function linesOnScroll() {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
New fucntion added to validate timesheet hours Vani | function isHoursNew(field,name)
{
var str =field.value;
if(isNaN(str) || str.substring(0,1)=="-" || str.substring(0,1)=="+")
{
alert("\n"+name+" field accepts numbers and decimals only. Enter a valid time value.");
field.select();
field.focus();
return false;
}
/*if(str<0)
{
alert("You have entered Inva... | [
"function validateHour(){\n // Get ony gCalSource events, not hourBlocks\n var gCalEvents = calendar.getEvents().filter(event => event.id.length > 0);\n var attemptDate = moment($date + ' ' + $hour.val(), 'DD/MM/YYYY hh:mm').toDate();\n var hourBefore, hourAfter;\n \n // Search for coincidence\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert XML responses to the corresponding object | convertXmlToTagObject(response) {
var xml = parser.parseFromString(response, "text/xml");
var json = this.xmlToJsonService.xmlToJson(xml);
return Object(class_transformer__WEBPACK_IMPORTED_MODULE_3__["plainToClass"])(_models_model_interfaces__WEBPACK_IMPORTED_MODULE_4__["Tag"], json);
} | [
"function xml2object($xml) {\r\n var obj = {};\r\n if ($xml.find('response').size() > 0) {\r\n var _response = _recursiveXml2Object($xml.find('response'));\r\n obj.type = 'response';\r\n obj.response = _response;\r\n }\r\n else if ($xml.find('error').size() > 0) {\r\n var _co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Aggiunge una quota al Coupon | function AddCoupon(linkID, txtID, IDQuota) {
//Verifico che il coupon non sia in attesa
var objHid = document.getElementById(sHidAttesa);
if (objHid.value != 0) return;
var link = document.getElementById(linkID);
var txt = document.getElementById(txtID);
txt.value = IDQuota;
link.click();
... | [
"function AddAsync(IDQuota) {\n //Verifico che il coupon non sia in attesa\n var objHid = $('#' + sHidAttesa);\n if (objHid.val() != 0) return;\n\n var link = $('#' + sCPbtn);\n var txt = $('#' + sCPqt);\n\n txt.val(IDQuota);\n link.click();\n}",
"function QuotaUpdate(cost) {\n _quota -= c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Scans the enviroment for iBeacons | function findBeacons() {
var room = "";
/*[] values;
for(var i=0;i>10;i++) {*/
Beacon.rangeForBeacons("B9407F30-F5F8-466E-AFF9-25556B57FE6D")
.then(function(beacons_found) {
// $("#beacon-list").empty();
var maxRSSI = 100;
for(beaconIndex in beacons_found) {
var beacon = beacons_found[beaco... | [
"function createBeacons(){\n var mintBeaconRegion = createBeacon('mintEstimote', '31B32E3C-5E8B-68F8-0493-FF9DCAA7C4B7', 10002, 48896);\n var iceBeaconRegion = createBeacon('iceEstimote', '29644B63-3EBD-AE99-ED00-0608F6A708A4', 28374, 41843);\n var blueberryBeaconRegion = createBeac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
line 3756, (corelib), class Exception | function Exception() {} | [
"function GF_Exception(sMessage) {}",
"function Exception() {\n return;\n}",
"function Exception(what) {\n\tthis.mWhat = what; // information about this exception\n}",
"function beginExceptionBlock(){var startLabel=defineLabel();var endLabel=defineLabel();markLabel(startLabel);beginBlock({kind:0/* Exceptio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to parse start and end dates from date range string | function getDates( dateStr ){
var re = /\s*(?:to|$)\s*/;
var dates = dateStr.split(re);
var start = new Date( dates[0] );
if (dates.length >1 ) {
var end = new Date( dates[1] ); } else {var end= null; }
return{ startDate: start, endDate: end };
} | [
"function parseDateRange(str) {\n\t\tstr = \"\"+str;\n\n\t\tvar m = str.match(/^\\s*(\\d\\d)\\/(\\d\\d)\\/(\\d{4})\\s*-\\s*(\\d\\d)\\/(\\d\\d)\\/(\\d{4})\\s*$/)\n\n\t\treturn {\n\t\t\tstart: new Date(parseInt(m[3]), parseInt(m[2]) - 1, parseInt(m[1])),\n\t\t\tend: new Date(parseInt(m[6]), parseInt(m[5]) - 1, parse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the state of the timline, depending on the state of the simulation. | updateSimulationState() {
if (this.lastSimulationState !== currentSimulationState) {
//the state has changed.
switch (currentSimulationState) {
case simulationState.NO_SIMULATION:
break;
case simulationState.RUNNING:
... | [
"setState() {\n this.setterState.set ^= true;\n var str = this.setterState.set ? 'Set Lights' : 'Solve Lights'\n this.setterText.text(str)\n }",
"function stateChange(){\n //Start of simulation\n if(state === `start`){\n startScreen();\n }\n //End the simulation\n if(state === `end`){\n endSc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rescales the graph horizontally according to the applied scale | function horizontalRescale(increment) {
if (increment) {
if (graph.scale.horizontal.value < graph.scale.horizontal.limits[1]) {
graph.scale.horizontal.increment()
setNewYPositions()
applyScaleText()
}
} else {
if (graph.... | [
"function scaleGraph() {\n var aspect = width / height;\n var targetWidth = chart.parent().width();\n var targetHeight = chart.parent().height();\n console.log('width: ' + targetWidth);\n console.log('height: ' + targetHeight);\n chart.attr(\"width\", targetWidth + \"px\");... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove attachment during update notes process | function updateRemoveAttachemnt(req) {
return NotesModel.findOneAndUpdate({ _id: req.params.id },
{ $pull: { attachment_ref: req.body.removeAttachment } }).exec();
} | [
"function removeAttachment( name ) {\n $.each(attachment_list, function (i, filename) {\n if (filename === name) {\n attachment_list.splice(i, 1);\n }\n });\n }",
"function removeAttachment() {\n console.debug(\"removeAttachment called\");\n\n atgSubmitAction({\n formHandl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Digest typically expires after 30 mins. we need to get a new one / I purge digest after 20 min, just in case: | function purgeStaleDigest(digest) {
if (!digest) {
return null;
}
var digestissued = digest.split(',')[1];
var digestissuedDate = new Date(digestissued);
var timeDifference = (new Date() - digestissuedDate);
var diffMins = Math.round(((timeDifference % 86400000) % 3600000) / 60000); //difference i... | [
"static async getNewDigest() {\n // Fetch state from localStorage\n const state = store.get(\"state\")\n\n // Create new digest\n const digest = multisig.getDigest(\n state.userSeed,\n state.index,\n state.security\n )\n\n // Increment digests key index\n state.index++\n state... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the given trait | updateUserTrait(userId, traitName, traitValue) {
UserDataService.updateUserTrait(userId, traitName, traitValue).then((users)=> {
this.props.updateUsers(users);
}, this.handleServiceError);
} | [
"addTrait(trait){\n this.traits.push(trait);\n this[trait.NAME]=trait\n }",
"function addTrait(trait) {\n if (typeof this === 'undefined') {\n return null;\n }\n var t = makeObjectFromAbstract(trait);\n for (var k in t) {\n if (k !== 'prototype') ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle test between alltests and mytests | toggleT(x){
if(this.alltests.indexOf(x)!==-1){
this.mytests.push(x);//add to mytests
this.alltests.splice(this.alltests.indexOf(x),1);//pop from total alltests
}
else{
this.alltests.push(x);//add to all questypes
this.mytests.splice(this.mytests.indexOf(x),1);//pop from mytests
}... | [
"function applyTestSettingsChanges()\n{\n if (testSelector.testSelection === true && testSelector.testSwitched === false)\n {\n // This will be changed when it be defined what should do with test settings\n $(\"#testSwitched\").attr(\"test-value\", \"On\").html(\"On\");\n \n TogFor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets form options by reading them from config store. | _setFormOptions () {
this.formOptions = {
limit: this._get('limit'),
strict: this._get('strict')
}
} | [
"function initSettings() {\n var settings = storage.getSettings();\n var form = $('.js-settings-form');\n\n $.each(settings, function(key, value) {\n var option = form.find('[name=\"'+ key +'\"]');\n\n // set the option's value\n option.val(value);\n\n // unhide the as-defin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Modal Controllers / Controller for Timeline Modal. Argument projectId consists of the list of projects. | function TimelineModalCtrl($scope, $modalInstance, projectId, protitle, $modal){
$scope.title = protitle;
$scope.predicate = 'maxv';
$scope.timeline = {};
$scope.max_max = 0;
var foreachcall = projectId.forEach(function(obj){
var x = time(obj);
$scope.timeline[obj.title] = {'title':obj.title,'values':x.current... | [
"function viewProject(elmnt){\n var title = projects[elmnt.id].title;\n var desc = projects[elmnt.id].desc;\n var date = projects[elmnt.id].date;\n var products = projects[elmnt.id].products;\n displayModal(title, desc, date, products, elmnt.id);\n}",
"function editProjectModal() {\n $('#edi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |