query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
resizing the transcript_display div with the remaining screensize | function do_onResize() {
var elem = $('#transcript_display');
if (!elem) {
return;
}
if ($.browser.msie) {
//y = document.body.clientHeight - 95;
var x = $('body').offsetWidth - 380;
elem.width(x);
//elem.style.height = '700px';
}
else if ($.browser.opera) {
// Opera is special: it ... | [
"function resizeTranscript() {\n var wdh = $(window).height();\n var progress = $('#progress').height();\n var params = $('#parameters-area').height();\n var mdh = $('#media-display').height();\n if ($('#metadata-bench').is(':visible') || $('#participant-bench').is(':visible') || ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the ChangeSetDelete for primary keys of the given entity type | delete(entityName, keys) {
const ids = Array.isArray(keys)
? keys
: keys
? [keys]
: [];
return { entityName, op: ChangeSetOperation.Delete, entities: ids };
} | [
"enterAlterByDropPrimaryKey(ctx) {\n\t}",
"async deleteRelatedEntityFromMetadata(deletedEntity) {\n await this.deleteFromMetadata(deletedEntity.sharedId, deletedEntity.template, [\n propertyTypes.select,\n propertyTypes.multiselect,\n propertyTypes.relationship,\n ]);\n }",
"visitAlterByDr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the dynamic champion json every Thursday | function updateChampions() {
const rule = new schedule.RecurrenceRule();
rule.hour = 6
const job = schedule.scheduleJob(rule, async () => {
console.log('> the update job started.')
const data_path = path.resolve(path.join(__dirname, '../static-data/'))
const res = await fetch(`https... | [
"function updateChampion(champ) {\n currChampionName = champ.replace(\"+ \", \"\"); // set champ name\n // Get average\n var avgDataRow = avg_data.filter(function(d) { return d.champ == currChampionName; })[0];\n currAvg = +(avgDataRow.winrate).toFixed(2);\n updateSlider();\n // update champ subse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructor for Pong, i.e. a new game of Pong | function Pong(config) {
this.config = config = merge( defaults, config );
this.canvas = document.createElement('canvas');
this.height = config.height;
this.width = config.width;
this.paddleSpeed = config.paddleSpeed;
this.ballSpeed = config... | [
"function Player() {\n this.paddle = new Paddle(10, canvasVariables.getHeight()/2, paddleVariables.getPaddleWidth(), paddleVariables.getPaddleHeight());\n}",
"function Player() {\n this.paddle = new Paddle(175, 580, 50, 10);\n}",
"function Player() {\n this.paddle = new Paddle(\n (board_width / 2) - (pad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Navigate back to customer view | function back() {
$location.path('/customer');
} | [
"goBackToHairdresserAccount(){\n\t\tvar self=this;\n\t\tself.$location.path('/hairdresser/account');\n\t}",
"function back() {\n $state.go(\"database.details\");\n }",
"function goBackToResults() {\n $location.path('/result-page')\n }",
"function goBack() {\n console.log(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
etherScan Price in USD currency | async getEtherPrice() {
try {
let provider = new ethers.providers.EtherscanProvider();
let price = await provider.getEtherPrice();
return {
price
};
} catch (error) {
if (error.result) {
const { result } = JSON.parse(error.result);
return {
price: ... | [
"function convertToETHPrice(priceUSD){\n let ETHPrice = cmcArrayDict['eth'.toUpperCase()]['quote']['USD']['price'];\n return priceUSD / ETHPrice;\n}",
"async function price() {\n const obj = await wallet.lcd.market.swapRate(new Terra.Coin('uluna', '1000000'), 'uusd');\n return parseFloat(obj.toData().amou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace the text in the navigation element Pass in the active league name | function replaceNavText(league) {
$('.league-name-active a').text(league);
// hide current league name in dropdown, show all the others
$('.drop-down li').each(function(){
$(this).show();
});
$('#nav-'+league).parent().hide();
} | [
"function changeNavPills(navPills, txtToChangeTo) {\n\t//changes to navigation between steps when selecting an enrolment type\n\tvar navPills = $(navPills);\n\tvar txt;\n\tvar index;\n\t$(navPills).children().each(function() {\n\t\ttxt = $(this).find('a').text();\n\t\tindex = txt.indexOf('- ');\n\t\tif (index == -1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The 'back to ...' botton was clicked, hide the confirm form and show the maincontent | function confirm() {
showElement(mainContent);
hideElement(formConfirm);
} | [
"function confirmBack(){\n let youSure = confirm('If you go back to the menu your art will be lost...');\n //if the user is sure, reload the page (bringing you back to the menu)\n if(youSure == true){\n location.reload();\n }\n}",
"function goBack(){\r\n document.getElementById(\"askLogout\").style.displa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
rearrangement of contents on display alternating Table Cell Color | function alternatingTableCellColor() {
$('.containerX.display-item:odd').css('background-color','rgb(100, 200, 255, 0.25)');
$('.containerX.display-item:even').css('background-color','rgb(150, 250, 200, 0.25)');
$('.container.categoryX:odd').css('background-color','rgb(100, 200, 255, 0.25)');
$('.container.cate... | [
"function addAlternatingRowColors()\n{\n var tables = getElementsByClass('rage-bw', document.getElementById('content'));\n \n if(tables.length == 0)\n return;\n \n for(var k = 0; k < tables.length; k++) {\n var table = tables[k];\n var rows = table.getElementsByTagName('tr');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The standard SHA1 needs the input string to fit into a block This function align the input string to meet the requirement | function AlignSHA1(str){
var nblk = ((str.length + 8) >> 6) + 1, blks = new Array(nblk * 16);
for (var i = 0; i < nblk * 16; i++)
blks[i] = 0;
for (i = 0; i < str.length; i++)
blks[i >> 2] |= str.charCodeAt(i) << (24 - (i & 3) * 8);
bl... | [
"function alignSHA1 (str) {\n var nblk = ((str.length + 8) >> 6) + 1\n var blks = new Array(nblk * 16)\n for (var i = 0; i < nblk * 16; i++) {\n blks[i] = 0\n }\n for (i = 0; i < str.length; i++) {\n blks[i >> 2] |= str.charCodeAt(i) << (24 - (i & 3) * 8)\n }\n blks[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
writeSequences returns an array of arrays that describes all possible ways a buffer of the given length could be split up and passed to sequential write calls. e.G. writeSequences(3) will return: [ [ [ 0, 3 ] ], [ [ 0, 2 ], [ 2, 3 ] ], [ [ 0, 1 ], [ 1, 3 ] ], [ [ 0, 1 ], [ 1, 2 ], [ 2, 3 ] ] ] | function writeSequences(length, start, sequence) {
if (start === undefined) {
start = 0;
sequence = [];
} else if (start === length) {
return [sequence];
}
let sequences = [];
for (let end = length; end > start; end--) {
const subSequence = sequence.concat([[start, end]]);
const subSequenc... | [
"writeSequence(len) {\n precondition.ensureNotNull('this.ctxPtr', this.ctxPtr);\n precondition.ensureNumber('len', len);\n\n let proxyResult;\n proxyResult = Module._vscf_asn1wr_write_sequence(this.ctxPtr, len);\n return proxyResult;\n }",
"getSequence... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bitwise AND a & bReturns a 1 in each bit position for which the corresponding bits of both operands are 1's. Bitwise OR a | bReturns a 1 in each bit position for which the corresponding bits of either or both operands are 1's. Bitwise XOR a ^ bReturns a 1 in each bit position for which the corresponding bits of either ... | function nQueens(Q, u = 0, ee = 0, n = 0, s = 0, H = 0, R = 0) {
let start = new Date();
s = 0;
Q = u ? Q : (1 << Q) - 1;
H = ~(u | ee | n) & Q;
while (H) H ^= R = -H & H, s += nQueens(Q, (u | R) << 1, ee | R, (n | R) >> 1);
let end = new Date();
let runTime = end - start;
if (true) {
console.log(`I... | [
"function matrixAndOrXorNotTest() {\n var vals = [\n Number.NEGATIVE_INFINITY,\n -1e100,\n -0x123456789ab,\n -0xffffffff, -0x80000000, -0x7fffffff,\n -0x12345678 - 0.75, -0x12345678 - 0.50, -0x12345678 - 0.25, -0x12345678,\n -1, -0, +0, +1,\n 0x12345678, 0x1234567... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reference to the Module Nav container element, if present | get containerEl() {
return this.element.parents('.module-nav-container')[0];
} | [
"get moduleButtonContainerEl() {\n return this.element[0].querySelector('.module-nav-section.module-btn');\n }",
"function getNavigationContainer(element) {\n var container;\n\n container = $(getContainer(element)).find('.gallery-pages');\n if (container.length < 1) {\n console... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save dup data to sheet | function saveDupData(data) {
var doc = new GoogleSpreadsheet('1KCi-0r8aHAkj5vd3P99yG0cLEhI_U6_SYXQ71ZUH-O8');
var sheet;
async.series([
function setAuth(step) {
// see notes below for authentication instructions!
var creds = require('../2i studio-fd2ce7d288b9.json');
doc.useServiceAccountAuth(creds, step)... | [
"function saveDupData(data) {\n\tvar doc = new GoogleSpreadsheet('1KCi-0r8aHAkj5vd3P99yG0cLEhI_U6_SYXQ71ZUH-O8');\n\tvar sheet;\n\tasync.series([\n\t\tfunction setAuth(step) {\n\t\t\t// see notes below for authentication instructions!\n\t\t\tvar creds = require('../2i studio-fd2ce7d288b9.json');\n\t\t\tdoc.useServi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tool functions Helper to reset environment for asynchronous Fancytree tests. | function _setupAsync(){
QUnit.reset();
if( $("#tree").is(":ui-fancytree") ){
$("#tree").fancytree("destroy");
}
stop();
} | [
"static async resetTestingModule() {\n await TestMind.terminate();\n\n TestModuleImports = [];\n TestModuleProviders = [];\n TestApplicationModule = undefined;\n testAppInstance = undefined;\n TestMind.resetEnvVariables();\n }",
"static reset() {\r\n EnvironmentConfiguration._rushTempFol... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter for status This will return the displayText string from CodeableConcept Value | get status() {
if (!this._cancerDiseaseStatus.dataValue
|| !this._cancerDiseaseStatus.dataValue.value
|| !this._cancerDiseaseStatus.dataValue.value.coding
|| !this._cancerDiseaseStatus.dataValue.value.coding[0]
|| !this._cancerDiseaseStatus.dataValue.value.coding[... | [
"get observationCodeDisplayText() {\n return this._questionAnswer.findingTopicCode.value.coding[0].displayText.value;\n }",
"get observationCodeDisplayText() {\n return this._questionAnswer.observationCode.coding[0].displayText.value;\n }",
"getStatusString() {\n if (this.shouldSkip()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find start day of that year and calculate how many time to plus and divide with 7 to get start day of that year | function calculateStartYearDay(year) {
let { year: baseYear, day } = baseDate;
// find round to calculate start date
let yearRound = year - baseYear;
// set startday with basevalue
let times = days.indexOf(day);
for (i = 0; i < yearRound; i++) {
console.log("yearRound :", yearRound);
times = times... | [
"function calculateStartDay( year, month ){\n return 6;\n}",
"function doomsday() {\n let shortYear = year.toString().substr(-2);\n shortYear = parseInt(shortYear);\n if (shortYear % 2 != 0) {\n shortYear += 11;\n }\n shortYear /= 2;\n if (shortYear % 2 != 0) {\n shortYear += 11;\n }\n shortYear = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts where clause object to where.string and where.params to use in query | function whereStringParams(where) {
let whereObj = where || {},
result = {string: '', params: []},
fields = []
// Two cases of where object:
// 1) simple where object with keys for field names and values for field values
// 2) .clause with a query string (e.g. "name like ? OR surname l... | [
"function createWhereClause ( whereObj ) {\n let whereStatement = \"\";\n\n // Calculate where statement\n for ( let key in whereObj ){\n \n let val = convertSqlValue (whereObj[key]);\n \n if (whereStatement.length === 0) {\n whereStatement = `... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Callback invoked on focus enter. | onFocusEnter() { } | [
"function callOnEnter(event, callback) {\n if(event.key === 'Enter') {\n callback();\n }\n }",
"function onEnter(cb) {\n\tvar innerPage = $('.inner-page');\n\tinnerPage.keypress(function(e) {\n\t\tif (e.keyCode == 13) {\n\t\t\te.preventDefault();\n\t\t\tcb();\n\t\t}\n\t});\n}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Escapes text to prevent scripting attacks. | function escape(text) {
return String(text).replace(ESCAPE_REGEX, function (match) {
return ESCAPE_LOOKUP[match];
});
} | [
"function escape(text){return String(text).replace(ESCAPE_REGEX,function(match){return ESCAPE_LOOKUP[match];});}",
"function escape(text) {\n return text.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}",
"function text_escape (s_text) {\n\tif (typeof(s_text) != 'string')\n\t\ts_text = String(s_text);\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates the nth ThueMorse number. | function thueMorse(n) {
var count = 0;
while (n != 0) {
n = n & (n - 1);
count++;
}
return count % 2;
} | [
"function horses(n) {\n if (Number.isInteger(n)) return n<3 ? n : n*(n-1)*(n-2);\n}",
"function hoopCount(n) {\r\n\r\n if (n > 9) {\r\n return \"Great, now move on to tricks\";\r\n }\r\n else {\r\n return \"Keep at it until you get it\";\r\n }\r\n}",
"function bai3(n) {\n var tong ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
WINDOW MANAGEMENT Initialize start of game. Stores current user name | function UserIsReady() {
//get user input
var welcomeUserNameTextbox = window.document.getElementById('welcomeUserName');
var name = welcomeUserNameTextbox.value; //no whitespaces
//init user data obj
currentLevel = CONSTANTS.DEFAULT_START_LEVEL;
currentUserScore = new GameObjects.Score(name, cu... | [
"function startNewGame () {\n\t\tvar username = $('#input_username').val().trim();\n\t\tif (username.length <= 0) {\n\t\t\tshowError('input_username');\n\t\t}\n\t\telse {\n\t\t\thideError('input_username');\n\t\t\tglobal.username = username;\t\t\t\n\n\t\t\tsendToServer(\"NEW_GAME\", global.username);\n\t\t}\n\t}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deactivate sidebyside mode and allow PDF.js pages to render at whatever width the current fullpage viewport allows. | deactivateSideBySide() {
this.sideBySideActive = false;
this.closeSidebarOnDocumentClick = true;
this.pdfContainer.style.width = 'auto';
this.pdfContainer.classList.remove('hypothesis-side-by-side');
} | [
"deactivateCondensedSidebar() {\n this.body.removeAttr('data-leftbar-compact-mode');\n }",
"function multiLayoutOff() {\n ipc.send('asynchronous-message', 'attach-output');\n $('*[data-event=\"sidebar-presentation\"]').removeClass('active');\n}",
"function toggleSideNav() {\n const currentAnchor = full... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
+++++++++++++++++ MODAL SELECT MULTIPLE CLUSTERS ++++++++++++++++++++++++++++++++++++++++++ ========= MSM_Open ==================================== PR20220126 PR20230126 | function MSM_Open (el_input) {
console.log(" === MSM_Open =====") ;
b_clear_dict(mod_MSM_dict)
const has_permit = (permit_dict.permit_crud && permit_dict.requsr_same_school);
const tblRow = t_get_tablerow_selected(el_input);
const data_dict = user_dicts[tblRow.id];
conso... | [
"function _multipomOpenPOMs()\r\n{\r\n\tvar htmlAreaObj = _getWorkAreaDefaultObj();\r\n\t//alert(\"htmlAreaObj \" + htmlAreaObj);\r\n var objAjax = htmlAreaObj.getHTMLAjax();\r\n var objHTMLData = htmlAreaObj.getHTMLDataObj();\r\n \r\n if(!objAjax)objAjax = new htmlAjax();\r\n var url = \"open\";\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `AlarmEventActionsProperty` | function CfnAlarmModel_AlarmEventActionsPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but r... | [
"function CfnAlarmModel_AlarmActionPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculates the current load factor | loadFactor() {
return this.elements / this.capacity;
} | [
"getLoadRatio() {\n\n return (this.total == 0 ? 1 : this.loaded/this.total);\n }",
"getLoadFactor() {\n return this.size / this.buckets.length;\n }",
"function getOSLoadavg(){\r return os.loadavg()\r}",
"function getLoad(callback) {\n\tvar result = {};\n\tvar loads = os.loadavg().map(function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check paragraph is inside table | moveToNextParagraphInTableCheck() {
if ((this.selection.start.paragraph.isInsideTable || this.paragraph.isInsideTable)
&& (this.selection.start.paragraph.associatedCell !== this.paragraph.associatedCell
|| this.selection.isCellSelected(this.selection.start.paragraph.associatedCell, t... | [
"function isTableContent(node) {\n return TableRow_1.isTableRow(node);\n}",
"isInTable(editor) {\n const curPos = editor.getCursor();\n return this.linePartOfTableRE.test(editor.getDoc().getLine(curPos.line));\n }",
"function isTableElement(node) {\r\n var TABLELIKE_VALUES = [\r\n 'table', 'in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Erase ao Trades in this Trade collection. | erase () {
this._trades = []
} | [
"function clearInterplayerTrades() {\n\t// Clear currently displayed trade\n\t$(\".interplayer-trade-input\").val(\"\");\n\t$(\".to-give-list-item\").addClass(\"hidden\");\n\t$(\".to-get-list-item\").addClass(\"hidden\");\n\t$(\".trade-number\").text(\"\");\n\n\tcurrentTrade = {brick: 0, wood: 0, ore: 0, wheat: 0, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a user field to the colleciton | addUser(title, selectionMode, properties) {
const props = {
FieldTypeKind: 20,
SelectionMode: selectionMode,
};
return this.add(title, "SP.FieldUser", extend(props, properties));
} | [
"function add(){\n\t\t\tsendCommand(\"list\",\"user\",{\"course\":courseId},function (data) {\n\t\t\t\tw2ui['add'+w2uiName].fields[0].options.items=[{id:-1,text:\"New\"}].concat(data);\n\t\t\t\tw2ui['add'+w2uiName].User={id:-1,text:\"New\"};\n\t\t\t\tsetValues('add'+w2uiName,{\"name\":undefined,\"email\":undefined,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called on show caller number choice button is clicked | changeShowCallerNumberChoice() {
this.dialplanCtrl.popoverStatus.rightPage = 'callerNumber';
this.dialplanCtrl.popoverStatus.move = true;
} | [
"function buttonClicked(button) {\n var selection = button.value;\n\n if (selection == \"countryView\") {\n showCountry(200);\n\n } else if (selection == \"projectView\") {\n showProjects(200)\n }\n\n}",
"function showIncoming(caller){\n $(\"#outgoingCall\").hide();\n $(\"#incomingCall\").sh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a function called getLength that takes any word as an argument. The function should return the number of characters in the string. | function getLength(word) {
return word.length;
} | [
"function getLengthOfWord(word) {\n // code here\n}",
"function getLengthOfWord(word) {\n // your code here\n}",
"function getlength(word) {\r\n return word.length;\r\n\r\n}",
"function getlength(word) {\n return word.length;\n}",
"function getLength(\"string\") {\n return string.length;\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the current line number (takes the offset into account). | getRealCurrentLineNb() {
return this.currentLineNb + this.offset;
} | [
"function lineIndex() {\n\treturn (index - charsBeforeThisLine);\n}",
"getRealCurrentLineNb() {\n return this.currentLineNb + this.offset;\n }",
"function findLineNumber(){\n let err = new Error();\n let stack = err.stack.split(/\\n/);\n\n\t\t//Chrome:\n let m = stack[3].match(/<a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
New deaths daily MovAvg | function newDeathsMXavg(newcasos) {
//console.log(deathMX)
let newcasosNum = []
for (let i = 0; i < newcasos.length; i++) {
newcasosNum.push(parseInt(newcasos[i]))
if (i == newcasos.length - 1) {
//console.log(newcasosNum)
}
}
l... | [
"function newDeathsPLavg(newcasos) {\n //console.log(deathMX)\n let newcasosNum = []\n for (let i = 0; i < newcasos.length; i++) {\n newcasosNum.push(parseInt(newcasos[i]))\n if (i == newcasos.length - 1) {\n //console.log(newcasosNum)\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the background elements to reflect the current slide. | function updateBackground() {
// Update the classes of all backgrounds to match the
// states of their slides (past/present/future)
toArray(dom.background.childNodes).forEach(function (backgroundh, h) {
// Reverse past/future classes when in RTL mode
var horizontalPast... | [
"function updateBackground (number) {\n var meta = {duration: 200, queue: false};\n var slides = $('#slides article');\n var background = $(slides[number]).data('background');\n if (background)\n $('body').animate({backgroundColor: background}, meta);\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
place a word inside the given grid using the Grid class API to store each word letter at the corresponding row and column | function placeWord(positionIdx, direction, word, grid) {
let column = positionIdx % grid.columns;
let row = Math.floor(positionIdx / grid.rows);
let [rIdx, cIdx] = [row, column];
grid.setAt(row, column, word[0]);
for (let letterIdx = 1; letterIdx < word.length; letterIdx++) {
rIdx += direction[0];
cId... | [
"updateGrid() {\n for(let i=0; i<this.words.length; i++) {\n let w = this.words[i];\n this.grid[w.x][w.y].label = w.label;\n if(this.grid[w.x][w.y].label_drawing < 0) {\n this.grid[w.x][w.y].label_drawing = 1;\n }\n for(let h=0; h<w.word.length; h++) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Factory to mock an instance of Messer | function MockMesser() {
const messer = new Messer();
messer.messen = getMessen();
return messer;
} | [
"function MockMesser() {\n const COMMANDS = require(\"../src/commands\");\n const EVENT_HANDLERS = require(\"../src/event-handlers\");\n\n const messer = new Messer();\n messer.messen = getMessen();\n messer.setPrompt = _ => {\n return _;\n };\n\n COMMANDS.forEach(command => {\n messer.registerCommand(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that can be used to add gps pins to the map, optional parameter style | function addPinFeature(thing,style="default") {
var defaultGeoJSONProjection = 'EPSG:4326';
var mapProjection = olMap.getView().getProjection();
var geom = (new ol.format.GeoJSON()).readGeometry(thing["Locations"][0]["location"], {
dataProjection: defaultGeoJSONProjection,
... | [
"function addPin(position)\n{\n var googlePos = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);\n var mapOptions = {\n zoom: 4,\n center: googlePos,\n mapTypeId: google.maps.MapTypeId.ROADMAP\n }\n var marker = new google.maps.Marker({\n position: googlePos,\n map:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
==================== Function: GetObjectWidth Purpose: Returns the width of any passed in block level object Input: ID of item Output: Returns the width of any passed in block level object Assumptions: History: RW 200805 Created ==================== | function GetObjectWidth(objectRef) {
var intHeight = -1;
if (document.getElementById) {
if (document.getElementById(objectRef)) {
intHeight = eval(document.getElementById(objectRef).offsetWidth);
}
} else if (document.all) {
if (document.all[objectRef]) {
int... | [
"function getObjectWidth(obj) {\n\treturn obj.offsetWidth;\n}",
"function dynGetObjectWidth(obj) {\n\tvar elem = dynGetRawObject(obj);\n\tvar result = 0;\n\tif (elem.offsetWidth) {\n\t\tresult = elem.offsetWidth;\n\t} else if (elem.clip && elem.clip.width) {\n\t\tresult = elem.clip.width;\n\t} else if (elem.style... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make a default configuration. | static makeDefault() {
return new Config(ModelType.MODEL3, BasicLevel.LEVEL2, CGChip.LOWER_CASE, RamSize.RAM_48_KB, Phosphor.WHITE, Background.AUTHENTIC, ScanLines.OFF);
} | [
"static defaultConfig() {\n return new Config(default_1.default);\n }",
"function createDefaultConfig() {\n // Copy over the example file to the actual file, then read it again\n fs.writeFileSync(FILENAME, fs.readFileSync(EXAMPLE_FILENAME));\n exports.readFile();\n}",
"static defaultConfig() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
w h (w + h gcd(w,h)) | function solution(w,h){
return w*h -(w+h -gcd(w,h));
} | [
"function solution(w, h) {\n const gcd = () => {\n let _gcd = 1;\n\n for (let i = 2; i <= Math.min(w, h); ++i) {\n if (w % i === 0 && h % i === 0) {\n _gcd = i;\n }\n }\n\n return _gcd;\n }\n\n const gcdValue = gcd();\n\n return w * h - ( ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
move w.tetra by dx, dy, but only if you can | function worldMove(dx, dy, w) {
var tmpTetra = data_1.Data.tetraCopy(w.tetra);
tetras_1.Tetras.tetraMove(dx, dy, tmpTetra);
tryNewTetra(w, tmpTetra);
} | [
"move(deltax, deltay){\n this.x += deltax;\n this.y += deltay;\n }",
"function tetraMove(dx, dy, t) {\n t = { center: { x: t.center.x + dx,\n y: t.center.y + dy },\n blocks: t.blocks };\n bset_1.BSet.blocksMove(dx, dy, t.blocks);\n }",
"move() {\n this.x ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
render the table row by passing each item and its summarized info like how many count and total cost. | function renderTableRow(itemName,totalcost,index) {
var tr_node = document.createElement("tr");
var th_node = document.createElement("th");
th_node.setAttribute('scope',"row");
th_node.innerText =index;
var td_item = document.createElement("td");
td_item.innerText =itemName;
... | [
"_renderRow(row,i) {\n var ans = [];\n ans.push(this._makeTD(i))\n ans.push(this._makeTD(row['Equipment Name']))\n ans.push(this._makeTD(\"$\" + row['Hourly Rate']))\n ans.push(this._makeTD(row['Total Usage'] + \" hrs.\"))\n\n let total_cost = \"$\" + row['Hourly Rate'] * r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define a function for scoring how well a string matches | function getScore(str1,str2,v1,v2,v3){
var r = 0;
str1 = str1.toUpperCase();
str2 = str2.toUpperCase();
if(str1.indexOf(str2)==0) r += (v1||3);
if(str1.indexOf(str2)>0) r += (v2||1);
if(str1==str2) r += (v3||4);
return r;
} | [
"function scorePart(query, string) {\n // split the string into words and filter the ones which contain the query\n var matchingWords = string.split(' ').filter(function (word) {\n return word.indexOf(query) !== -1;\n });\n\n // go through each matching word, with a base score relative to the\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
same as above just for the current card's score | showCurrentCardScore() {
return this.showCurrentCard().score
} | [
"getScoreCard(){\n this.playerScore.minValue = this.getTotalNormalCardValues(\"player\") + this.getMinACardsValue(\"player\");\n this.playerScore.maxValue = this.getTotalNormalCardValues(\"player\") + this.getMaxACardsValue(\"player\");\n this.delearScore.minValue = this.getTotalNormalCardVal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
insert new burger into database | function insertOne(newBurger) {
//insert new burger into table and input devoured boolean value
var queryString = "INSERT INTO burgers (burger_name) VALUES (?)"
connection.query(queryString, newVal , function(err, res){
if (err) throw err;
console.log(result);
... | [
"function insertBurger(event) {\n\t\tconsole.log(\"adding new burger to db\");\n\t\tevent.preventDefault();\n\t\tvar newBurger = {\n\t\t\tburger_name: $newBurgerInput.val().trim(),\n\t\t\tdevoured: false\n\t\t};\n\n\t\t$.post(\"/api/burgers\", newBurger).done(() => location.reload());\n\t}",
"function insertBurge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a mesh to the tower, updates the currentTowerHeight to compensate but DOES NOT add it to the list of destructible tower pieces. This will make an indestructible tower piece. | function addBaseMeshToTower(newMesh, height){
newMesh.position.x=TOWER_X;
newMesh.position.y=currentTowerHeight;
newMesh.position.z=TOWER_Z;
mainScene.add(newMesh);
currentTowerHeight = currentTowerHeight + height;
updateTopMesh();
} | [
"function addMeshToTower(newMesh, height){\n\tif(typeof newMesh == 'undefined'){\n\t\tconsole.log(\"Adding undefined mesh!!\");\n\t\treturn;\n\t}\n\tnewMesh.position.x=TOWER_X;\n\tnewMesh.position.y=currentTowerHeight; // Pivot in centre of object\n\tnewMesh.position.z=TOWER_Z;\n\t\n\taddToList(new Tower(height,new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make a request to GitHub API for given amount of commits from a given user's named repo | async function getNCommits(username, repo, amount) {
try {
const res = await axios.get(
`https://api.github.com/repos/${username}/${repo}/commits?per_page=${amount}`,
{
headers: {
Authorization: `token ${process.env.PAT}`,
},
}
);
console.log(
"FROM COMMIT... | [
"async function getNCommitsByAuthor(repo, token, data) {\n // commits data is comprised of a list of pages of commits\n // each of which has an author 'login'\n\n console.log('getting n commits by author');\n let url = 'https://api.github.com/repos/' + repo + '/commits';\n let promises = await queryE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if this bitfield equals another. | equals(bit) {
// @ts-ignore
return this.bitfield === this.constructor.resolve(bit);
} | [
"equals(other) {\n if (!Long.isLong(other))\n other = Long.fromValue(other);\n if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)\n return false;\n return this.high === other.high && this.low === other.low;\n }",
"assertSameNumb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
utility function to exercise the CPU a little | function burn_some_CPU(){
var x = 0.0001
for(i = 0;i < 100000;i++)
x += Math.sqrt(x)
return(x)
} | [
"function AdvanceProgramCounter(cpu) {\n} //step 3 & 4",
"function singleStep() {\n _CPU.cycle();\n}",
"function CPU(memory,output,flagRegister,register,PC,SP)\n{\n let i=0;\n while(i<10000000)\n {\n let instructionRegister=memory[PC];\n i++;\n let registerIndex;\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We need the outer function because the back button will pass the event argument as the first argument of the onNavigateBack handler. The first argument of our onNavigateBack should be the navigation stack, so this allows us to use the default value by omitting that argument. | handleNavigateBack() {
const { onNavigateBack, defaultNavigateBack } = this.props;
onNavigateBack ? onNavigateBack() : defaultNavigateBack();
} | [
"catchIonicGoBack(event) {\n // We only care for the event coming from Ionic's back button\n const backButton = event.target && event.target.closest('ion-back-button')\n if (!backButton) return\n\n let defaultHref\n\n // Explicitly override router direction\n // This will always trigge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used as a state reference for update values between style/class binding instructions. | function StylingState() {} | [
"function StylingState(){}",
"styleUpdate() {\n\t\tvar self = this;\n\t\tconsole.log(this.myRefs[\"style\"].current.state.currstyle);\n\t\tvar currstyle = self.myRefs[\"style\"].current.state.currstyle;\n\t\tvar currdamage = self.myRefs[\"style\"].current.state.currdamage;\n\t\tthis.setState({\n\t\t\tstylecurrent... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add or remove the viewer's player marker | function togglePlayerMarker() {
viewerPM.toggle();
} | [
"function updatePlayer() {\n if(!map || !mapData)\n return;\n\n playerPos = getPosition(playerData.map, playerData.pos[0], playerData.pos[2], true)\n\n if(!playerMarker) {\n playerMarker = L.marker(unproject(playerPos), { icon: new playerIcon(), title: playerData.pName });\n playerMark... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copyright(c) 2013 3NSoft Inc. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, you can obtain one at This module provide an object pool for typed arrays used in the library. When we turn off reusing, by always making new arrays... | function NumericArrPool(numOfElemsInObj, constructorFunc) {
"use strict";
this.constructor = constructorFunc;
this.numOfElemsInObj = numOfElemsInObj;
this.pool = new Array(16);
this.poolIndex = -1;
Object.seal(this);
} | [
"function ObjectPool(ClassVar, size, initialParams) {\n this.pool = [];\n this.freeIndexes = [];\n this.ClassVar = ClassVar;\n\n const params = initialParams || [];\n for (let i = 0; i < size; i++) {\n this.freeIndexes.push(i);\n this.pool.push(new ClassVar(...params));\n }\n}",
"function BufferPool(l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getkeys of an object | getKeys(obj){
var keys = [];
for(var key in obj) keys.push(key);
return keys;
} | [
"function getKeys(obj) {\n return Object.keys(obj)\n}",
"function keys(obj){\n return Object.keys(obj)\n}",
"function getKeys(obj) {\r\n var keys = [];\r\n for(var k in obj)\r\n keys.push(k);\r\n return keys;\r\n }",
"function getKeys(object) {\n return Object.keys(object)\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
input: sorted array of vec2 points Makes rays originating from sector centre to angle point without any duplicate rays. If two points are in the same line of sight e.g. when the sector is at (0, 0) and two angle points (1, 0), (2.5, 0), one of them can be removed; in JS there is no builtin routine to remove duplicates,... | function makeRays(sector, anglePoints) {
// first ray needs no check for duplicity; calculate and add to array
var ray = vec2.create();
vec2.sub(ray, anglePoints[0], sector.centre);
var rays = [ray];
// i for anglePoints, j for rays to avoid doing anglePoints.length - 1
for (var i = 1, j = 0, n ... | [
"dedupeCoordArray(array){\n for(var a = 0; a < array.length; a++){\n for(var b = 0; b < array.length; b++){\n if(a != b && array[a].x == array[b].x && array[a].y == array[b].y){\n array.splice(b, 1);\n }\n }\n }\n }",
"pruneRays(rays) {\n let lastX;\n let lastY;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a list of project types exported the modules defined in `moduleDirs`. This list will always also include the builtin projen project types. Modules without a .jsii manifest are skipped. | function discover(...moduleDirs) {
var _a, _b, _c, _d;
const jsii = {};
const discoverJsii = (dir) => {
const jsiiFile = path.join(dir, '.jsii');
if (!fs.existsSync(jsiiFile)) {
return;
} // no jsii manifest
const manifest = fs.readJsonSync(jsiiFile);
for ... | [
"async function getCustomModuleTypings() {\n const customModuleTypings = new Map();\n const moduleNames = await fs.readdir(TYPED_MODULES_PATH);\n for (const moduleName of moduleNames) {\n customModuleTypings.set(moduleName, `${TYPED_MODULES_PATH}/${moduleName}`);\n }\n return customModuleTypings;\n}",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Control What foot is showing | function chooseFoot(foot) {
visitUI.setCurrentFoot(foot);
} | [
"function toogleFootprints(pressed){\n\tvar footprint = myMap.getLayersByName('Bottom fishing areas')[0];\n\tfootprint.setVisibility(!pressed);\n}",
"function showCarbonFootprint() {\n if (foodFrequency !== undefined && foodProduct !== undefined) {\n if (foodFrequency[0].value === 1) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
USEUNIT InitializationEnviornment USEUNIT PlaceReservationOrder | function s()
{
try{
Log.AppendFolder("s");
InitializationEnviornment.initiliaze();
AppLoginLogout.login();
Log.AppendFolder("PlaceReservationOrder.placeMixROrder");
var groupNm=defaultGroupName;
var keyWordNm ="Reservations";
var packageNm ="Minimum Payme... | [
"function Placeorder(size, crust, topping) {\n this.size = size;\n this.crust = crust;\n this.topping = topping;\n this.price = 0;\n // this.deliveryFee = 200;\n}",
"function init_create_order()\n{\n\t//Fetch product data and pricing data from server \n\tfetch_product_data();\n\t//Fetch the suppliers list fr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Lazy Loading time value at the storage. :param: no param. :return: no value, value saved at global variable lazyLoadingTime. | function getStorageLazyLoading(){
console.log('Init getStorageLazyLoading()')
var gettingItem = browser.storage.local.get('idLazyLoadingTime');
// Object result: empty object if the searched value is not stored.
gettingItem.then((result) => {
// Undefined -> Lazy Loading time value option has neve... | [
"get timeSinceLoad() {\n return this._timeSinceLoad;\n }",
"get nowTime(){return this._cacheAccessor.nowTime;}",
"static get timeSinceLevelLoad() {}",
"getTimeStamp(){\n const timestamp = JSON.parse(localStorage.getItem(\"timestamp\"))\n if (timestamp) {\n return parse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates a specific Deployment. Parameters: deploymentId : String ID of the Deployment to be updated attributes : Object Key/Value attributes of the Deployment that will be updated. The valid keys are: 'description' (String, optional) an optional freeform description of the Deployment 'flagged' (Boolean, optional) a tog... | update(deploymentId, attributes) {
const body = {
data : {
type : Deployments._TYPE,
id : deploymentId,
attributes : attributes
}
};
return super.update(deploymentId, attributes, body);
} | [
"function updateDeploy_(deploymentId, versionNumber) {\n const response = UrlFetchApp.fetch(\n `https://script.googleapis.com/v1/projects/${ScriptApp.getScriptId()}/deployments/${deploymentId}`,\n {\n method: 'PUT',\n payload: JSON.stringify({\n deploymentConfig: {\n versionNumber\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display a toast notification when a user gets an achievment | function displayAchievementToastNotification(achievement) {
// Store the WinJS notifications object
var notifications = Windows.UI.Notifications;
// Create the toast notification template
var template = notifications.ToastTemplateType.toastText02;
var toastXml = notificati... | [
"function displayConfirmation() {\n Toast.show({\n style: { backgroundColor: \"green\", justifyContent: \"center\" },\n position: \"top\",\n text: \"Meal(s) successfully recorded.\",\n textStyle: {\n textAlign: 'center',\n },\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
constructs a map of edges>triangles | function make_edge_map(triangles) {
var edge_map = {};
for (var t=0; t<triangles.length; t++) {
// loop through the points of this triangle to find the edges
for (var p=0; p<pointnames.length; p++) {
// the two points involved in this edge
var a = triangles[t][pointnames[p]];
var b = triangles[t][pointna... | [
"function generateEdges(triangles,mapVertex){\n\n\tvar edges = [];\n\n\tfor(var i = 0; i < triangles.length ; i++){\n\t\tvar triangle = triangles[i];\n\t\tvar v0Poly2Tri = triangle.getPoint(0);\n\t\tvar v1Poly2Tri = triangle.getPoint(1);\n\t\tvar v2Poly2Tri = triangle.getPoint(2);\n\n\t\tvar v0 = mapVertex.get(v0Po... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
user clicked on row, get the selected group and bind | function rowClicked(groupId) {
var group = meta.filter(groupData, "GroupId", groupId, true);
var json = { "Group" : group };
meta.bind(json);
/* update the screen to show save/delete buttons, focus on the textbox */
show(btnSave);
show(btnDelete);
txtDescription.focus();
} | [
"groupSelected(evt) {\n var group_name = $(evt.target).val();\n \n this.edited_group = this.voxel_groups.findIndex(function(g){\n return g.name == group_name;\n });\n }",
"function allowGroupClickableRows () {\n $('.group-row').click(function() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
item type API functions prepareContext for Class templates | function prepareContext (key, context) {
log.debug('[DataClass] ' + path.basename(__filename) + ' - prepareContext');
// prepare class name
var className = "";
if ( context.global.moduleID )
className += context.global.moduleID + '_';
if ( context.global.classPrefix )
className += context.global.classPrefix ... | [
"enterCreateType(ctx) {\n\t}",
"function augment(context, original, decycled) {\n\t\tvar classname = original.constructor.name;\n\t\t// look in context if classname not available\n\t\tif (!classname || classname === \"\") { \n\t\t\tObject.keys(context).some(function(name) {\n\t\t\t\tif (context[name] === original... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Moves the camera down using the current scroll speed. | moveDown() {
this.point.y += this.scrollSpeed;
} | [
"function updateCamera() {\n camera.position.y = CAMERA_Y - window.scrollY * SCROLL_SPEED / 50.0\n}",
"moveDown(speed) {\n\t\tthis.setData('currentSpeedY', speed);\n\t}",
"function moveDown() {\n\tconsole.log(\"Scroll down\");\n\trobot.scrollMouse(0, -20);\n}",
"moveUp() {\n this.point.y -= this.scrollS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the gaps and all relations (father, left son, right son) for every key of array arr. The gap is important for their xcords. A father's gap is always twice as high as his children's gaps. | function setRelations() {
arr[0].gap = Math.round(width / 2);
for (var i = 0; i < arr.length; i++) {
if ((i * 2 + 1) < arr.length)
arr[i].leftson = arr[i * 2 + 1];
if ((i * 2 + 2) < arr.length)
arr[i].rightson = arr[i * 2 + 2];
if (i > 0)
arr[i].father... | [
"function setRelations(){\n arr[0].gap = Math.round(width/2);\n for(var i = 0; i < arr.length; i++){\n if((i*2+1) < arr.length)\n arr[i].leftson = arr[i*2+1];\n if((i*2+2) < arr.length)\n arr[i].rightson = arr[i*2+2];\n if(i > 0)\n arr[i].father = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
value for this field and attribute pair | function _value(field, attribute)
{
return field.values[attribute];
} | [
"fieldValue(attrib) {\n const div = this.fieldElement(attrib);\n if (div.is('.read-only')) {\n const wrapper = div.find('.ro-val');\n if (typeof wrapper.data('val') !== 'undefined') { return wrapper.data('val'); } return wrapper.text();\n }\n // Rails checkbox fields have a hidden field follow... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a span to a line. | function addMarkedSpan(line, span) {
line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
span.marker.attachLine(line);
} | [
"function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]\n span.marker.attachLine(line)\n }",
"function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given a position and a set of moves, return a new position with the moves executed | function calculatePositionFromMoves (position, moves) {
var newPosition = deepCopy(position)
for (var i in moves) {
if (!moves.hasOwnProperty(i)) continue
// skip the move if the position doesn't have a piece on the source square
if (!newPosition.hasOwnProperty(i)) continue
var piece ... | [
"function calculatePositionFromMoves (position, moves) {\n let newPosition = deepCopy(position);\n\n for (let i in moves) {\n if (!moves.hasOwnProperty(i)) continue;\n\n // skip the move if the position doesn't have a piece on the source square\n if (!newPosition.hasOw... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a Catberry Catcomponent file. More details can be found here Creates new instance of the "catalog" component. | function Catalog() {
} | [
"function Catalog() {\n this.type = 'Catalog';\n\n this.compMap = new Map;\n}",
"function createNewCatalog() {\n en.catalog.create(locationName, \n function(data) {\n locationID = data.response.id;\n },\n function(data) {\n error(\"Couldn't create catalog \" + locationName);\n }\n );\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper function to clear the QAD column of prior results | function clearQADCol()
{
$('.QAD').each( function(index, object) {
$(this).html("   ");
$(this).css("background-color", "transparent");
});
} | [
"function clearQueryMarks() {\n\t\t\n\t\tconsole.debug(\"clearing query marks\");\n\t\t_queries = {};\n\t\t_widthSort = [];\n\t\tsetCurrentQueryMark(null);\n\t}",
"_unset(){\r\n this.currentOperator = '';\r\n this.currentValue = '';\r\n if ( this.columns.length > 1 ){\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw or update the Reservation canvas | function drawReservationCanvas() {
var ctx = contextReservation;
//background
ctx.fillStyle = "#4BA9F0";
ctx.fillRect(0, 0, canvasReservation.width, canvasReservation.height);
//draw screen
ctx.fillStyle = "#FFFFFF";
ctx.fillRect(canvasReservation.width / 5, 10, canvasReservation.width * 3 / 5, 30);
ctx.font =... | [
"function clickOnReservationCanvas(e) {\n\tvar ctx = contextReservation;\n\t\n\t//get seat number\n\tvar seat = getSeatFromClick(e);\n\tif(seat.row < 0 || seat.column < 0 || seat.row >= rows || seat.column >= cols){\n\t\treturn;\n\t}\n\n\t//draw red seat over the green one\n\tvar posx = seatOffsetX + seat.column * ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
displays parents, spouse, and children of selected person | function displayFamily(person, people) {
let parentsString = getParents(person, people);
let spouseString = getSpouse(person, people);
let childString = "Children: "
let children;
let foundChildren = [];
children = people.filter(function (childrens) {
for (let i = 0; i < childrens.parents.length; i+... | [
"function displayPerson(person) { // create and append nodes with person info\n var goeshere = document.getElementById(person.parentId);\n\n // Create a new element (a <UL/>, as it turns out) for the person.\n var personHtml = document.createElement(\"ul\");\n personHtml.setAttribute(\"id\",formNodeId(p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When locked, Cropper is frozen and inputs are disabled | function toggleLocked() {
locked.checked ? cropper.disable() : cropper.enable()
width.disabled = locked.checked
height.disabled = locked.checked
change.disabled = locked.checked
if (locked.checked) {
toggleShowUpload(false)
}
} | [
"disable () {\n return this.cropper.disable()\n }",
"enable() {\n if (this.ready) {\n this.disabled = false;\n this.$cropper.removeClass(CLASS_DISABLED);\n }\n }",
"disable() {\n return this.cropper.disable();\n }",
"enable () {\n return this.cropper.enable()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3] Internal utils Converts the table name into a pure alphanum string not starting with a digit | function buildTableRangeName_(tableName) {
return tableName.replace(/^[0-9]/, '').replace(/[^a-zA-Z0-9]/g, "") + ManagementService_.managementSheetName()
} | [
"function table(context) {\n return context.params.table.replace(/[^a-zA-Z\\._\\-]/g, '');\n}",
"tableName(prefix) {\n\t // Derive table name from, since that is unique for each track.\n\t // Track ID can be UUID but '-' is not valid for sql table name.\n\t const idSuffix = this.trackId.spli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enqueues a sync request to secondary on specified syncQueue and returns job info | async enqueueSync ({
userWallet,
primaryEndpoint,
secondaryEndpoint,
syncType,
immediate = false
}) {
const queue = (syncType === SyncType.Manual) ? this.manualSyncQueue : this.recurringSyncQueue
// If duplicate sync already exists, do not add and instead return existing sync job info
... | [
"async enqueueSync ({\n userWallet,\n primaryEndpoint,\n secondaryEndpoint,\n syncType\n }) {\n const queue = (syncType === SyncType.Manual) ? this.manualSyncQueue : this.recurringSyncQueue\n\n // If duplicate sync already exists, do not add and instead return existing sync job info\n const du... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get coords for where the worm needs to transmit between Infections needs to store node id's of new infections | function getWormCoords()
{
xyCoords = [];
for(var i = 0; i < infections.length; i++)
{
xyCoords.push({id: i, targetX: infections[i].x
, targetY: infections[i].y
, sourceX: infections[i].infectedByx
, sourceY: infections[i].infectedByy});
}
} | [
"getAffectedLocations() {\n let c1 = this.source.clone();\n c1.reset();\n c1.transform(this.axis, this.layerMask, this.angle);\n return c1.getUnsolvedParts();\n }",
"function realCoordinates(nodeIndex) {\n return { x: x[nodeIndex] + 20 - rect.left, y: y[nodeIndex] + 20 - rect.top };\n}",
"getCoord... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Core function that takes a Holder scene description and builds a scene graph | function buildSceneGraph(scene) {
var fontSize = App.defaults.size;
if (parseFloat(scene.theme.size)) {
fontSize = scene.theme.size;
} else if (parseFloat(scene.flags.size)) {
fontSize = scene.flags.size;
}
scene.font = {
family: scene.theme.font ? scene.theme.font :... | [
"function buildSceneGraph(scene) {\n var fontSize = App.defaults.size;\n if (parseFloat(scene.theme.size)) {\n fontSize = scene.theme.size;\n } else if (parseFloat(scene.flags.size)) {\n fontSize = scene.flags.size;\n }\n\n scene.font = {\n family:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copies and adjusts `entryTemplate` to suit the request in `options`. | function makeEntry(entryTemplate, options) {
const entry = {...entryTemplate};
for (const prop
of ['name', 'mimeType', 'modificationTime', 'isDirectory', 'size']) {
if (!options[prop]) {
delete entry[prop];
}
}
return entry;
} | [
"_copyHtmlTemplate(type) {\n switch(type) {\n case 'bare':\n this._copyHtmlTemplate_bare();\n break;\n case 'clean':\n this._copyHtmlTemplate_clean();\n break;\n case 'full':\n this._copyHtmlTemplate_full();\n break;\n default:\n console.log('Clean S... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns if a value is null | __is_null(value) {
return value === null;
} | [
"function is_null(value)\n {\n return value === null || value === undefined;\n }",
"isNull (value) {\n return value === null;\n }",
"static isValueNull(val) {\n return !val && typeof(val)!=\"undefined\" && val!=0;\n }",
"isNull (value) {\n return value === null;\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a message (with attachments) and list the the user's 20 most urgent tasks without details | function sendTaskList(bot, message, fromButton) {
bot.botkit.log('getting tasks for user', message.user);
// add a reaction so the user knows we're working on it
if (!fromButton) {
bot.addReaction(message, 'thinking_face')
}
getTasks(bot, message, message.user, false, (err, response, tasks) => {
if (... | [
"function sendTasks(bot, message, fromButton) {\n bot.botkit.log('getting tasks for user', message.user);\n // add a reaction so the user knows we're working on it\n if (!fromButton) {\n bot.addReaction(message, 'thinking_face')\n }\n\n getTasks(bot, message, message.user, false, (err, response, tasks) => {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return a stream of the music data. | stream(){
var fileName = __dirname + '/songs' + this.dataFile;
var stats = fs.statSync(fileName);
var stream = fs.createReadStream(fileName);
return {
stream : stream,
stats : stats
};
} | [
"playStream(stream) {\n self.decoder = new lame.Decoder();\n self.speaker = new Speaker(audioOptions);\n return stream.pipe(self.decoder).once('format', function() {\n self.decoder.pipe(self.speaker);\n self.startTime = Date.now();\n self.emit('play start', self.currentSong);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method two binary search square root of each X must happen within [1, x/2 + 1] the tricky point is that we will return right if there is no square root found the reason is the square root is between [n1, n] and we know that when while is broken, right must be n1 | function squareRoot(x){
let left = 1
let right = Math.floor(x/2) + 1
let mid
while(left <= right){
mid = Math.floor((left+right) / 2)
if(mid * mid > x){
right = mid-1
} else if (mid * mid < x){
left = mid+1
} else {
... | [
"function binarySearchSquareRoot(number)\n{\n\tvar left=0\n\tvar right=number\n\n\twhile(left<=right)\n\t{\n\t\tvar mid = Math.floor(left+((right-left)/2))\n\n\t\tif (mid*mid>number)\n\t\t{\n\t\t\tright = mid-1\n\t\t}\n\t\telse if(mid*mid < number)\n\t\t{\n\t\t\tleft = mid+1\n\t\t}\n\t\telse if (mid*mid == number)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
tunnel2_address computed: true, optional: false, required: false | get tunnel2Address() {
return this.getStringAttribute('tunnel2_address');
} | [
"get tunnel1Address() {\n return this.getStringAttribute('tunnel1_address');\n }",
"get tunnel2CgwInsideAddress() {\n return this.getStringAttribute('tunnel2_cgw_inside_address');\n }",
"getAddressLine2(){\n return this._addressLine2;\n }",
"function handleChangeOfAddress2(e) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load a PGN with variants, NAGs, header and annotations. cmchess uses cmpgn fot the header and history. See | loadPgn(pgn) {
this.pgn = new Pgn(pgn)
} | [
"function parse (pgn) {\n const tags = parseTags(pgn)\n const moveData = tokenizeLines(pgn)\n const turns = parseRecursively(moveData)\n let pieces\n if (tags.FEN && tags.SetUp === '1') {\n pieces = toPieces(tags.FEN)\n } else {\n pieces = JSON.parse(defaultPieces)\n }\n const star... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
activate the solve route button | function activateSolve() {
// Execute the route task with atleat 2 stops
if (routeParams.stops.features.length >= 2) {
routeTask.solve(routeParams).then(showRoute);
}
} | [
"function solved() {\n id(\"solved\").classList.toggle(\"hidden\");\n id(\"reset_button\").disabled = false;\n id(\"clear_button\").disabled = false;\n qs(\"#loading\").classList.toggle(\"hidden\");\n id(\"solve_button\").textContent = \"Solved!\";\n }",
"function clickRoutesButton() {\n\t\td3.sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A for loop getting different queries length base on input "phrase length" value | function phrase(queries, len) {
let phrases = [];
for (let i = 1; i <= len; i++) {
phrases.push(queryToNWords(queries, i));
}
return phrases.flat();
} | [
"function longphrase(arr) {\n var longest = 0;\n var answer = \"\";\n for (var phrase = 0; phrase < arr.length; phrase++) {\n if (arr[phrase].length > longest) {\n var longest = arr[phrase].length;\n var answer = arr[phrase];\n }\n }\n console.log(answer);\n}",
"function setSearchQueryLength(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to seed test users into db with encrypted passwords | function seedTestUsers(db, users) {
//map over each user, spread out the rest of the user object but replace password w/ bcrypt version
const preppedUsers = users.map((user) => ({
...user,
password: bcrypt.hashSync(user.password, 1),
}));
//insert prepped users into db, will then need to manually set s... | [
"function seedUsers(db, users) {\n const hashedUsers = users.map((user) => ({\n ...user,\n password: bcrypt.hashSync(user.password, 1),\n }));\n return db.into(\"itav_users\").insert(hashedUsers);\n}",
"function seedUsers(db, users) {\n const preppedUsers = users.map(user => ({\n ...user,\n passwo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find and list certificates and download their data. | function listAndDownloadCertificates(api, query) {
return api_1.GET(api, '/certificates', { query })
} | [
"function loadCertificates() {\n\n // Call the listCertificates() method to list the user's certificates. For more information see\n // http://webpki.lacunasoftware.com/Help/classes/LacunaWebPKI.html#method_listCertificates\n pki.listCertificates({\n\n // specify that expired certifi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a path of coordinate arrays, traverses it and asserts that the values increase incrementally. | function assertPath(pathHelper, path) {
path.reverse().forEach((coordinate, index) => {
let [x, y] = coordinate
expect(pathHelper.pathLengths.at(x, y)).toBe(index)
})
} | [
"function evalOpenPaths() {\n\t\tconst x = $scope.maze.compass[0];\n\t\tconst y = $scope.maze.compass[1];\n\t\tconst potentialPathsCoords = [\n\t\t\t[x, y+1],\n\t\t\t[x, y-1],\n\t\t\t[x+1, y],\n\t\t\t[x-1, y],\n\t\t];\n\t\tlet count = 0;\n\t\tpotentialPathsCoords.forEach((coords) => {\n\t\t\tif (coords[0] >= 0 && c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
console.log(button.myAction, 'myAction'); node.dataset.action => close dataset.foo | function onClick() {
// const behavior = this.getAttribute('my-action');
// const behavior = this.dataset
// console.dir(this.dataset.action, 'action');
const behavior = this.dataset.action;
actions[behavior] && actions[behavior]();
// console.log(this.getAttribute('m... | [
"updateAction() {\n this.close({$value: this.action});\n }",
"_handleAction(actionNode) {\n switch(actionNode.event) {\n // \"start\" event\n case \"start\":\n this.displayObj.resetElements(actionNode.data);\n break;\n // \"comparator... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
protect route to ensure logged in user is accessing | function protectRoute(req, res, next) {
let isLoggedIn = req.session.user ? true : false;
if (isLoggedIn) {
next();
}
else {
res.redirect('/');
}
} | [
"function allowUsers(req, res, next) {\n if (res.locals.auth && res.locals.auth.userId) return next('route');\n next();\n }",
"function restrict(req, res, next) {\n if (req.session.user) {\n next();\n } else {\n req.session.error = \"Access denied!\";\n res.redirect(\"/\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
From the soup menu, selecting cup of tomato soup | selectSoupTomato() {
I.waitForElement(foodObjects.chooseCup);
I.tap(foodObjects.chooseCup);
I.waitForElementLeaveDom(settings.config.helpers.Appium.platform, commonObjects.progressBar);
I.waitForElement(foodObjects.tomatoSoup);
I.tap(foodObjects.tomatoSoup);
I.waitForElementLeaveDom(settings.con... | [
"selectSoupBroc() {\n I.waitForElement(foodObjects.chooseBowl);\n I.tap(foodObjects.chooseBowl);\n I.waitForElementLeaveDom(settings.config.helpers.Appium.platform, commonObjects.progressBar);\n I.waitForElement(foodObjects.BroccoliSoup);\n I.tap(foodObjects.BroccoliSoup);\n I.waitForElementLeaveD... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the merge of any number of JSON objects pass JSON objects as comma separated parameters var newJSON = mergeJSON(a,b,c...n) note: overwrites preexisting entries from earlier passed objects | function mergeJSON () {
var ret = {};
for (var a=0,len=arguments.length;a<len;a++) for (var v in arguments[a]) ret[v] = arguments[a][v];
return ret;
} | [
"function mergeJSON(obj1, obj2, overwriteAt) {\n\n var attrname,\n obj2copy = JSON.parse(JSON.stringify(obj2));\n\n for (attrname in obj1) {\n if (obj2copy.hasOwnProperty(attrname)) {\n\n if (attrname === overwriteAt) {\n obj2copy[attrname] = obj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getScriptInfo() get it from the exception data | function getScriptInfo() {
var ex, fn, dbLevel;
var fInfo = null;
dbLevel = $.level; // save
$.level = 0; // debug off
try {
undefined_variable1 = undefined_variable2;
} catch(ex) {
fInfo = ex.fileName;
}
$.level = dbLevel; // restore
fn = fInfo.substring(fI... | [
"_getScriptData() {\n return this._script;\n }",
"function scriptInfo() {\r\n return `[${scriptData.name} ${scriptData.version}]`;\r\n}",
"function scriptInfo() {\r\n\treturn `[${scriptData.name} ${scriptData.version}]`;\r\n}",
"getScriptId() {\n return this.scriptId;\n }",
"function getTen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if a string is a coordinate | function checkCoordinates(str) {
if( !str ) { return false; }
str = str.split(',');
var isCoordinate = true;
if( str.length !== 2 || !isFloat(str[0].trim()) || !isFloat(str[1].trim()) ) {
isCoordinate = false;
}
return isCoordinate;
} | [
"isCoordinateCharacter(string) {\n if(!isNaN(string)) return true;\n if(string == ' ' || string == '.' || string == ',' || string == '-' || string == '+') return true;\n return false;\n }",
"function isCoordinateString(value) {\n var result = value.match(/^-?\\d+(.\\d+)?(\\s+|\\s*,\\s*)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save changes to multiple entities across one or more entity collections. Server endpoint must understand the essential SaveEntities protocol, in particular the ChangeSet interface (except for Update). This implementation extracts the entity changes from a ChangeSet Update[] and sends those. It then reconstructs Update[... | saveEntities(changeSet, url) {
changeSet = this.filterChangeSet(changeSet);
// Assume server doesn't understand @ngrx/entity Update<T> structure;
// Extract the entity changes from the Update<T>[] and restore on the return from server
changeSet = this.flattenUpdates(changeSet);
l... | [
"async _saveChangesToTickets() {\n if (this.items) {\n await Promise.all(\n this.items.map(it => it.ticket.save({ transaction: this.transaction }))\n )\n }\n }",
"_updateAllEntities() {\n for (let i = this._entities.length - 1; i >= 0; i--) {\n this._entities[i].update();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GetMarkdownFiles returns an array of only files ending in .md or .markdown NOTE: When a file name is the same, eg. happy.md and happy.markdown, only one file is outputted as it will be overwritten. This needs to be checked. (TODO:) | function GetMarkdownFiles(files) {
return files.filter(function (filePath) {
if (path.extname(filePath).match(/^(.md|.markdown)$/)) {
return true;
}
})
} | [
"function GetMarkdownFiles(files) {\n\treturn files.filter(function(filePath) {\n\t\tif(path.extname(filePath).match(/^(.md|.markdown)$/)) {\n\t\t\treturn true;\n\t\t}\n\t});\n}",
"function parseMarkdownFiles() {\n const contentsDirectory = path.join(__dirname, '../contents');\n fs.readdir(contentsDirectory... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a mapping that maps only through a part of this one. | slice(from2 = 0, to = this.maps.length) {
return new Mapping(this.maps, this.mirror, from2, to);
} | [
"function MapBuilder() {}",
"static createMap (data) {\n let ptr = 0;\n for (let k of Object.keys(data)) {\n const item = data[k];\n\n // normalize parameters\n if (item.type === 'fixed') {\n if (!item.hasOwnProperty('range')) {\n item.range = [0, 1];\n }\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
findUser() 3.3 updateuser return old user info | function updateUser() {
UserModel.findOneAndUpdate({ _id: '5ccc58951909cd45478a74cd' }, { username: 'hahaXing' }, function(err, olduser) {
console.log('findOneAndUpdate', err, olduser)
})
} | [
"function updateUser(userFound,reqBody) {\n var userIndex = userDbStub.lastIndexOf(userFound);\n \n if (reqBody) {\n \n for (var params in reqBody) {\n // we avoid to insert non existing property and avoid the modification of the id and password that it's forbbiden\n if( p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |