query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Creates a spreadsheet for a new compition | function newComp() {
// Create the objects that we will use to operate on the spreadsheet
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var ui = SpreadsheetApp.getUi();
// Geet the name of the compition the user wants to add, and put it into the spreadsheet
var compName = ui.prompt('Create a ne... | [
"function createSheet () {\n ss.insertSheet(name, index, options);\n\n // Apply pending Spreadsheet changes\n SpreadsheetApp.flush();\n }",
"function create_sheet() {\n var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();\n var sheet = spreadsheet.insertSheet('Project Plan');\n /* Create all of t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enable remote main since it has been explicitly disabled by electron. | function enableRemoteMainForRenderer({ existingWindow, windowConfig }) {
let windowObj = existingWindow;
if (!windowObj) {
windowObj = new remote.BrowserWindow(windowConfig);
const remoteMain = remote.require('@electron/remote/main');
remoteMain.enable(windowObj.webContents);
}
return windowObj;... | [
"init() {\n if(config.disableRemoteControl || this.initialized\n || !APP.conference.isDesktopSharingEnabled) {\n return;\n }\n logger.log(\"Initializing remote control.\");\n this.initialized = true;\n APP.API.init({\n forceEnable: true,\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculates dot(A^T, x) as dot(x^T, A)^T without transposing A | function dotT(A, x){
return x.transpose().dot(A).transpose()
} | [
"function v3_dot(a, b) {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}",
"function dotMultiply(a, c){\n var temp = [];\n for (var i = a._data.length - 1; i >= 0; i--) {\n var t = []\n for (var j = a._data[0].length - 1; j >= 0; j--) {\n t.push([c*a._data[i][j]]);\n };\n temp.pus... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Position element el2 right to element el | function placeRightTo(el, el2) {
pos=getPos(el);
el2.style.position="absolute";
el2.style.left=(pos.x+el.offsetWidth)+"px";
el2.style.top=pos.y+"px";
} | [
"function placeRightTo(el, el2) {\n\tpos=getPos(el);\n\tel2.style.position=\"absolute\";\n\tel2.style.left=(pos.x-el2.offsetWidth)+\"px\";\n\tel2.style.top=pos.y+\"px\";\n}",
"function placeBelow(el, el2) {\n\tpos=getPos(el);\n\tel2.style.position=\"absolute\";\n\tel2.style.left=pos.x+\"px\";\n\tel2.style.top=(po... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Crea las salas por defecto y las aniade a la tabla | function inicializarSalas() {
//Creamos salas por defecto -- No vamos a dar opcion de crear mas
sala1 = new Sala(1, 25, vectorActividades); // Las 3 actividades por defecto se pueden hacer en las dos salas
sala2 = new Sala(2, 20, vectorActividades);
vectorSalas.push(sala1);
vectorSalas.push(sala2);
//Aniadimos... | [
"function asignarTablero(diccionarioSalas, nombreSala){\n diccionarioSalas[nombreSala]=inicializaTablero(); //inicializo un tablero en la sala de entrada\n}",
"function crearSalas(){\n\t\n\t//Creo el modelo\n\tfor (var i=0; i <=NRO_SALAS; i++){\n\t\tcrearSala(i);\n\t}\n\t\n\t//Reseteo el contador de quirofanos c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
store email CSV in database | function storeEmailCSV(dataInfo) {
return new Promise((resolve, reject) => {
let success = true;
let data = dataInfo.uploadedData;
let user = dataInfo.user;
let batchId = dataInfo.batchId;
//Attempt to store email CSV
data.forEach((contact) => {
pool.connect(function (errorConnecting, db... | [
"function storeEmailCSV(dataInfo) {\n return new Promise((resolve, reject) => {\n let success = true;\n let data = dataInfo.uploadedData;\n let user = dataInfo.user;\n let batchId = dataInfo.batchId;\n console.log('attempting to store Email CSV');\n data.forEach((contact) => {\n pool.connect... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to handle reservationsAllocation form validation | function reservationsAllocationValidate(allocationForm){
var validationVerified=true;
var errorMessage="";
if (allocationForm.reservationid.selectedIndex==0)
{
errorMessage+="Bạn chưa chọn mã đặt chỗ!\n";
validationVerified=false;
}
if(allocationForm.staffid.selectedIndex==0)
{
errorMessage+="Bạn chưa chọn mã nhân vi... | [
"function reservationsAllocationValidate(allocationForm){\n\nvar validationVerified=true;\nvar errorMessage=\"\";\n\nif (allocationForm.reservationid.selectedIndex==0)\n{\nerrorMessage+=\"Reservation ID not selected!\\n\";\nvalidationVerified=false;\n}\nif(allocationForm.staffid.selectedIndex==0)\n{\nerrorMessage+=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
makes a call to get the HTML from the AP Top 25 NCAAF Poll front page uses the request package to achieve this | function requestAPTop25HTML(callback) {
var request = require("request");
request({ uri: "https://collegefootball.ap.org/poll" },
function(error, response, body) {
if (!error) {
var parsedData = parseTop25Data(body);
// if no error return false error and the data
... | [
"function requestKaAns(err,res,html){\n // console.log(err);\n // console.log(res.statusCode);\n //console.log(html);//html code of URL will be printed by this\n if(err){\n console.log(\"some error\",err);\n }else{ \n //data->scrap\n //console.log(html);\n console.log(\"R... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle error codes from Tango | function handleTangoErrorCode(tangoRes) {
var responseCode = false;
var code = tangoRes.httpCode;
var errorPath = _lodash2.default.get(tangoRes, ['errors', 0, 'path']);
try {
if (typeof code !== 'number') {
code = parseInt(code);
}
} catch (e) {
return [500, 'Service is down. If this persist... | [
"function handleTangoErrorCode(tangoRes) {\n let responseCode = false;\n let code = tangoRes.httpCode;\n const errorPath = _.get(tangoRes, ['errors', 0, 'path']);\n try {\n if (typeof code !== 'number') {\n code = parseInt(code);\n }\n } catch (e) {\n return [500, 'Service is down. If th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Media queries that change the size of the dice | function mediaQueries(x) {
if (x.matches) { // If media query matches (mobile)
canvas.width = 100;
canvas.height = 100;
draw(context,0, 0, canvas.width - 20, diceNumber, diceColor, dotColor)
} else {
canvas.width = 150;
canvas.height = 150;
... | [
"static responsiveness() {\n if (Game.mql.matches) { // min-width 768px\n Game.width = 720;\n } else {\n Game.width = window.innerWidth - 40;\n }\n // update width\n Game.canvas.width = Game.width;\n //! reset array\n Game.goldSectorsArr = [5];\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
statement : compound_statement | assignment_statement | procedure_call | conditional_statement | while_statement | repeat_statement | empty | statement() {
const startToken = this.currentToken;
try {
switch (this.currentToken.type) {
case Lexer.TokenTypes.BEGIN:
return this.compound_statement();
case Lexer.TokenTypes.IF:
return this.conditional_statement();
case Lexer.TokenTypes.WHILE:
retu... | [
"statement() {\n let node\n if (this.token.type === UniqueTokens.BEGIN.type) {\n node = this.compoundStatement()\n } else if (this.token.type === UniqueTokens.ID.type) {\n if (this.lexer.readchar() === '(') {\n node = this.proccallStatement()\n } else {\n node = this.assignment... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifica se o CNPJ informado estah OK. | function verifyCnpj(){
log.info('Start servicetask8 verifyCnpj() ');
var cnpj = hAPI.getCardValue("nrCnpj").replaceAll("\\D", "");//Retira o . / -
log.info('Start servicetask8 replace');
var c1 = DatasetFactory.createConstraint("cnpj", cnpj, cnpj, ConstraintType.MUST);
var constraints = new Array(c1);
log.info('s... | [
"function valida_cnpj ( valor ) {\n\n // Garante que o valor é uma string\n valor = valor.toString();\n \n // Remove caracteres inválidos do valor\n valor = valor.replace(/[^0-9]/g, '');\n\n \n // O valor original\n var cnpj_original = valor;\n\n // Cap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set cursor to end of content | function setCursorToEnd() {
let p = document.getElementById("content");
let s = window.getSelection();
let r = document.createRange();
r.setStart(p.lastChild, 1);
r.setEnd(p.lastChild, 1);
s.removeAllRanges();
s.addRange(r);
} | [
"moveCursorToEnd() {\n const doc = this.getEditor().getDoc(),\n lastLine = doc.lastLine();\n\n doc.setCursor(lastLine, doc.getLine(lastLine).length);\n }",
"function cursorEndSetter() {\n //get the last Element :\n var lastElement = $(type).last();\n var p;\n //check if the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set to empty the value of new menu item inputs and remove error feedback messages if any | function emptyNewMenuItem() {
$('#new-menu-item-text,#new-menu-item-link').val('');
$('#new-menu-item-text,#new-menu-item-link').closest('div').removeClass('has-error');
} | [
"_clearForm() {\n // Clears input fields\n itemNameInput.value =\n itemDueDateInput.value =\n itemTimeDueInput.value =\n itemDescriptionInput.value =\n \"\";\n // Makes sure default pri always \"no priority\"\n itemPriorityInput.value = \"no_pri\";\n }",
"function empty_inputs()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find an existing user matching the email passed in under oneuserperorg, the existing user is only found if it is teamless | async getExistingUser () {
const { email } = this.request.body.user;
if (!email) {
throw this.errorHandler.error('parameterRequired', { info: 'user.email' });
}
const users = await this.data.users.getByQuery(
{
searchableEmail: decodeURIComponent(email).toLowerCase()
},
{
hint: UserIndexes.b... | [
"async tryFindInvitedUser () {\n\t\tconst company = await this.data.companies.getById(this.request.params.id.toLowerCase());\n\t\tconst users = await this.data.users.getByQuery(\n\t\t\t{\n\t\t\t\tsearchableEmail: this.user.email.toLowerCase()\n\t\t\t},\n\t\t\t{\n\t\t\t\thint: UserIndexes.bySearchableEmail\n\t\t\t}\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handler function called on click of route links pushes the click into the router history thus changing the route props.history comes from the reactrouter withRouter() higher order component. | routeHandler(event) {
event.preventDefault();
this.props.history.push(event.target.pathname);
} | [
"static updateHistory(href){let urlState=RouterElement.getUrlState(),url=urlState;if(2===url.length){url=href}else{url=document.baseURI+url}// Need to use a full URL in case the containing page has a base URI.\nlet fullNewUrl=new URL(url,window.location.protocol+\"//\"+window.location.host).href,oldRoute=RouterElem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
api access points send a tweet with a status param | tweet(status) {
return this.post({
path: '/statuses/update',
params: {
status,
}
});
} | [
"function sendTweet(txt) {\n var tweet = {status: txt }\n T.post('statuses/update', tweet, tweetSent);\n\n function tweetSent(err, data, response) {\n if (err) {\n console.log(\"Didn't work :(\");\n } else {\n console.log(\"All seems good!\");\n }\n }\n\n}",
"function tweetIt(txt){\n T.pos... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We have two implementations to check for the skip ad buttons: one is based on MutationObserver, that is only triggered when the videoplayer is updated in the page; second is a simple poll that constantly checks for the existence of the skip ad buttons. We first try to set up the mutation observer. It can sometimes fail... | function initTimeout() {
clearTimeout(timeoutId);
if (initObserver()) {
// We can stop the polling as the observer is set up.
return;
}
/**
* Starts the poll to see if any of the ad buttons are present in the page now.
* The interval of 2 seconds is arbitrary. I believe... | [
"function adSkipper() {\n 'use strict';\n // Need the video element to get current time\n // Ads appear within div.video-ads\n var video = document.getElementsByTagName('video')[0],\n ads = document.getElementsByClassName('video-ads')[0];\n\n // Function that attempts to immediately close banner ads if de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the 3D sensor calibration state (Yocto3DV2 only). This function returns an integer representing the calibration state of the 3 inertial sensors of the BNO055 chip, found in the Yocto3DV2. Hundredths show the calibration state of the accelerometer, tenths show the calibration state of the magnetometer while unit... | get_calibrationState() {
this.liveFunc.get_calibrationState();
return _yocto_api.YAPI_SUCCESS;
} | [
"get_3DCalibrationStage() {\n this.liveFunc.get_3DCalibrationStage();\n return _yocto_api.YAPI_SUCCESS;\n }",
"get_3DCalibrationProgress() {\n this.liveFunc.get_3DCalibrationProgress();\n return _yocto_api.YAPI_SUCCESS;\n }",
"get_3DCalibrationStageProgress() {\n this.li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
image handlers, builders... get input value for image search | function getImageInput() {
//define img value
var img_val = "";
//define input field
var $img_tags = $(".contextual-choice input");
if ($img_tags.val() !== "") {
img_val = $img_tags.val();
return img_val;
} else {
return img_val;
}
} | [
"function doGeneralImageSearch() {\n\n}",
"function checkImage(input) {\n\n}",
"function imgSearchMaker() {\n\tlet form = document.createElement(\"form\"); //New form\n\tform.classList.add(\"search-img\"); //Add class .search-img\n\tlet input = document.createElement(\"input\"); //New input\n\tinput.classList.a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends a random wave of enemies | async function CreateEnemyWave()
{
//Generate a random number
let intRandomWave = Math.floor(Math.random() * 6);
//Generates a wave depending on the result
if(document.hasFocus())
{
switch(intRandomWave)
{
case 0: //Three basic enemies in a vertical line
... | [
"function addRandomWave(ySlowest) {\n var waveEnnemies = [];\n \n // Models\n var slow = new Ennemy(2);\n var normal = new Ennemy(3);\n var fast = new Ennemy(1);\n // TODO other types when level higher\n \n var slowestEnnemy;\n \n var spaceForPlayer = {width: parseInt(player.width +... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
extracts the details from an entry html | function extractEntryDetails (html) {
// extract details
let details = {}
let rows = $('.gi tr', html)
for (let i = 0; i < rows.length; i++) {
let left = $('.spaltelinks', rows[i]).text().trim()
let right = $('.spalterechts', rows[i]).text().trim()
if (right[0] === '[' && right.slice(-1) === ']') {
... | [
"function extractData(html){\n let searchtool=cheerio.load(html);\n\n let part = searchtool('a[data-hover=\"View All Results\"]');\n let SourceLink=part.attr(\"href\");\n let FullLink=`https://www.espncricinfo.com${SourceLink}`;\n console.log(FullLink);\n\n //Now requesting on FullLink to obtain s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds listener on point to create tooltip when hovered | function addTooltipToPoint(svg, point, contents, attributes) {
function createTooltipAtCursor() {
var x = d3.mouse(svg.node())[0];
var y = d3.mouse(svg.node())[1];
var tt = createTooltip(svg, x, y, style('tooltipWidth'), contents, attributes);
}
point.on('mouseover', createTooltipAt... | [
"addTooltipEvent() {\n this.tooltips.forEach((tooltip) => {\n tooltip.addEventListener(\"mouseover\", this.onMouseOver);\n });\n }",
"addTooltipsEvent() {\n this.tooltips.forEach((item) => {\n item.addEventListener('mouseover', this.onMouseOver);\n });\n }",
"function on_tooltip_custom_p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
draw the rhino chasing me | function drawRhino() {
rinhoImg = env.loadedAssets['rhinoDef'];
var x = (gameWidth - rinhoImg.width) / 2;
ctxManager.drawImg(rinhoImg, x, rhinoY, rinhoImg.width, rinhoImg.height);
rhinoY = rhinoY + 2;
} | [
"drawRhino() {\n const skierYPosition = this.skier.y;\n if (skierYPosition > Constants.RHINO_START_POSITION) {\n this.rhino.draw(this.canvas, this.assetManager); // Draw Rhino asset on Canvas\n }\n }",
"function drawRhinoAteMe() {\n\n rhinoChecker++;\n rinhoImg = env.loadedAssets['rhinoAteMe'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a button to a dialog that closes the dialog when pressed. | function addCloseButtonToDialog(dialog, text = 'Close', append = true) {
return __awaiter(this, void 0, void 0, function* () {
const button = new Button_1.default();
if (append) {
yield dialog.appendButton(button);
}
else {
yield dialog.prependButton(button);
... | [
"function closeButton() {\n myPopup.showPopup(\"<h2>I have a close button</h2><p>Click the button to close me</p>\",{\n closeButton: true,\n closeCaption: \"Click me!\"\n });\n}",
"function closeDialog() {\n Avgrund.hide();\n}",
"function close_ok_dialog() {\r\n\t \tdialog.hide();\r\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given yelp data, return a string with the appropriate marker icon | function getMarkerImage(datum){
// determine the appropriate marker
if(datum.metacategory == "bars"){
return "/images/map-icons/bar.png"
}
else if(datum.metacategory == "parks"){
return "/images/map-icons/park.png"
}
else{
return "/images/map-icons/food.png"
}
} | [
"function iconSelect (marker) {\n if (marker.product_type_food !== '{}') {\n return packagedPin\n }\n else if (marker.product_type_fresh !== '{}') {\n return freshPin\n }\n else if (marker.product_type_bev !== '{}'){\n return drinkPin\n }\n else\n return 'no category to disp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setup handler for "Show versions only" checkbox | function toggleVersionsOnly() {
if (showVersionsEl.get('checked')) {
modalEl.addClass('boolean-on');
} else {
modalEl.removeClass('boolean-on');
}
} | [
"function versionCheckboxHandler() {\n var isChecked = document.getElementById('versionCheck').checked;\n \n displayNewVersionMessage(false); // Hide the message\n \n // If we've checked it, do the check\n if(isChecked) \n checkForNewVersions();\n \n // Save the preference\n if(window.widget) {\n wid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a unique id for each tab content element | _getTabContentId(i) {
return `mat-tab-content-${this._groupId}-${i}`;
} | [
"mainDivId()\n {\n // avoid conflicts between tab stylesets when several pagecontrols exist (even recursive)\n return this.attributes[\"id\"] ?? \"pagecontrol-\" + this.controlInstanceNumber;\n }",
"getArticleLinkId() {\n if (this.tabId == null)\n return \"\";\n else\n return '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
; Params: correct: number ; Response: string ; Description: Function to return the users rank based on the number of questions correct. | function getRanking(correct){
if(correct < 6){
return "Beginner";
} else if(correct >= 6 && correct < 8){
return "Novice";
} else{
return "Expert";
}
} | [
"function countOfCorrectAnswers(answer, correctAnswer) {\n\tconsole.log(numberofQuestionsCorrect);\n\tif (answer === correctAnswer) {\n\t\tnumberofQuestionsCorrect = numberofQuestionsCorrect + 1;\n\t}\n\trenderQuestionHeader(numberofQuestionsCorrect);\n}",
"function correctResponse() {\n score += 1;\n quest... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wait until the element specified by selectors is visible. Unlike the normal waitForVisible() ( this will traverse the shadow DOM. | function waitForVisible(selectors) {
browser.waitUntil(
() => {
const selected = pierceShadows(selectors);
return selected.value && selected.value.length > 0;
},
2500,
`selectors ${selectors} never selected anything`,
500
);
} | [
"function isVisible(selector) {\n Reporter_1.Reporter.debug(`Wait for an element to be visible ${selector}`);\n tryBlock(() => browser.waitForVisible(selector, DEFAULT_TIME_OUT), `Element not visible ${selector}`);\n }",
"async visible(selector) {\n debug(`Checking visibility of element ${... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
builds the view model needed by the index screen | function IndexBuilder(dependencies) {
// builds the view model
this.build = function(callback) {
var repository = dependencies.repository;
repository.getUsers(callback);
}
} | [
"render (model) {\n return this._indexTemplate (model);\n }",
"function initIndex(){\n\t\tlet state = new State({\n items: null,\n itemsSim: null,\n isIndex: true,\n filters: {\n categories: null,\n\t\t\tkeywords: null,\n\t\t\tlat: null,\n\t\t\tlng: null,\n\t\t\tumkreis:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Added close function to close the congratulations popup in close and play again button | function close () {
cMessage.style.cssText = '';
heading.style.cssText = '';
scorePanel.style.cssText = '';
deck.style.cssText = '';
copyright.style.cssText = '';
restartButton.classList.remove('disable');
copyright.classList.remove('disable');
} | [
"function closePopup() {\n\tdocument.getElementById(\"play-again\").addEventListener(\"click\", function() {\n\t\tpopup.classList.remove(\"show\");\n\t\tstartGame();\n\t});\n}",
"function playWallCloseModal() {\n playWallRemoveIframe();\n playWallRemoveCoverDiv();\n}",
"close() {\n\n\t\t\tthis.displayConfirm ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads pages to snapshot from a js, json, or yaml file. | async loadPagesFile(pathname) {
let ext = _path.default.extname(pathname);
if (ext === '.js') {
let pages = require(_path.default.resolve(pathname));
return typeof pages === 'function' ? await pages() : pages;
} else if (ext === '.json') {
return JSON.parse(_fs.default.readFileSync(pathn... | [
"loadPages() {\n this._pages = utility.getJSONFromFile(this._absoluteFile);\n }",
"function loadPages() {\n let pageDivs = $('.page');\n pageDivs.each(function(i) {\n if ($(pageDivs[i]).hasClass('inline')) {\n return;\n }\n let htmlName = './' + $(pageDivs[i]).attr('id') + '.html';\n var xh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return SHA1 of data buffer. | function sha1(data) {
var hash = crypto.createHash('sha1');
hash.update(data);
return hash.digest('hex');
} | [
"function sha1(buffer) {\n\tvar hash = crypto.createHash(\"sha1\")\n\thash.end(buffer)\n\treturn hash.read()\n}",
"function sha1(data) {\n const hash = crypto.createHash('sha1');\n hash.update(data);\n return hash.digest('hex');\n }",
"function sha1(data) {\n var hash = crypto.createHas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List Midi ouput Devices | function listMidiOutputs(){
print("Output Devices:");
for(var i = 0; i < midiOutDeviceList.length; i++) {
print("(" + (i+1) + ") " + midiOutDeviceList[i]); // Get rid of MS wavetable synth
};
} | [
"function listMidiOutputs(){\n\tprint(\"Output Devices:\");\n\tfor(var i = 0; i < midiOutDeviceList.length; i++) {\n \tprint(\"(\" + (i+1) + \") \" + midiOutDeviceList[i]); // Get rid of MS wavetable synth\n\t};\n}",
"function listMidiOutputs(){\n print(\"Output Devices:\");\n for(var i = 0; i < ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for finding the highest zindex | function findHighestZIndex(elem) {
var elems = document.getElementsByTagName(elem);
var highest = 0;
for (var i = 0; i < elems.length; i++) {
var zindex = document.defaultView.getComputedStyle(elems[i], null).getPropertyValue("z-index");
if ((zindex > highest) && (zindex != 'auto')) {
... | [
"function getHighestZIndex() \n{\t\n\tvar highest = 0;\n\t\n\t// nabeel - typecast to int, with base 10\n\t//\tw/o base string \"012\" returns 10\n\t$(\"div, p, param, object\").each(function() {\n\t if($(this).css(\"z-index\") != \"auto\" && parseInt($(this).css(\"z-index\"), 10) > highest)\n\t\t\thighest = par... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a modified version of the transactions by filtering out any negative payments (e.g. money moving from the multisig to the vendor, refunds). | get paymentsIn() {
return new Transactions(
this.get('paymentAddressTransactions')
.filter(payment => (payment.get('bigValue').gt(0)))
);
} | [
"function stripDeposits(transactions) {\n const stripped = [];\n for (let i = 0; i < transactions.length; i++) {\n if (transactions[i].amount < 0) {\n transactions[i].amount = \"£\" + toDec(transactions[i].amount * -1);\n stripped.push(transactions[i]);\n }\n }\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find_possible_set inputs a the end of a possible set which is assume is correct, the sums generated by of that end, the multiplications generated by of that end, the differences between each element of the set, and the length to which expand the set. It creates a set of that length with that end if is possible. | function find_possible_set(set_end, end_sums, end_multiplications, end_differences, final_length) {
// create the structures to store the new possibility, sums, multiplications, and differences
const searched_length = final_length - set_end.length;
const searched_set = Array(searched_length);
let tota... | [
"function find_best_set(set_length, only_first = true) {\n\n // create the structures to contain the set and the products\n const searched_set = Array(set_length);\n let searched_sums = [];\n let searched_multiplications = [];\n let searched_differences = [];\n\n // for every element to be filled ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds to scene directly with no optimizations, but colored | addToSceneColored (scene, precision, offset=0)
{
var group = new THREE.Object3D();
this.addToSceneColoredRecursion (group, this.octree, precision, offset);
scene.add(group);
} | [
"function add_elements_to_scene() {\n\n add_nucleus_proton_to_scene();\n add_electron_ground_state_to_scene();\n add_electron_excited_state_to_scene();\n\n}",
"function setScene(id) {\n $._drawBackground(id);\n}",
"addedToScene() { }",
"addScene(sceneName, scene, backgroundColor = 0x282828) {\n s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Looks at CTR < 0.5% Looks at CPC < $2.00 If the campaign meets that criteria, the bidding strategy should be max clicks If not it should be VCPM Also look at the account and campaign labels apply a iHeart_MaxClicks if the campaign requires it. If not remove that label. | function main() {
// Init Variables
var maxCpm = parseFloat(1.25);
var maxCpc = parseFloat(2.00);
var ctrCheck = parseFloat(.005);
var maxClicksLabel = 'iHeart_MaxClicks';
var currentAccount = AdWordsApp.currentAccount();
var accountName = currentAccount.getName();
Logger.log("Account - " + accountNa... | [
"function main() {\n var currentAccount = AdWordsApp.currentAccount();\n var currentAccountName = currentAccount.getName();\n var cpmCheck = 1.25;\n var bidDownOnce = currentCpm - .50;\n var bidDownTwice = currentCpm - 1.00;\n var cpmAboveAverage = 3.00;\n var maxCpm = 5.00;\n \n var camp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new state based on this one, but with an adjusted set of active plugins. State fields that exist in both sets of plugins are kept unchanged. Those that no longer exist are dropped, and those that are new are initialized using their [`init`]( method, passing in the new configuration object.. | reconfigure(config) {
let $config = new Configuration(this.schema, config.plugins);
let fields = $config.fields, instance = new EditorState($config);
for (let i = 0; i < fields.length; i++) {
let name = fields[i].name;
instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(conf... | [
"applyPluginConfig(plugInto) {\n let me = this,\n config = me.pluginConfig || me.constructor.pluginConfig,\n assign = config && config.assign,\n chain = config && (config.chain || config.after),\n before = config && config.before,\n override = config && config.override;\n\n me.plugged... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
expandAllAbs Recursively opens all child nodes | function expandAllAbs(d){
if('children' in d || '_children' in d){
if(d.children){
} else {
d.children = d._children;
d._children = null;
}
for(var i = 0;i<d.children.length;i++){
expandAllAbs(d.children[i]);
}
}
} | [
"function expandAll() {\n expand(root);\n //root.children.forEach(expand);\n update(root);\n }",
"function expandChildren(depth) {\t\n\tvar node = this;\n\n\tif (depth)\n\t\tdepth--;\n\n\tnode.expanded = true;\n\tif (node.childCount > 0) {\n\t\tnode.button.src = node.MSrc;\n\t\tif (!node.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sends a message to the background script letting it know user preferences have changed. | function popupSendBgPrefUpdate() {
var message = {
src: "en_popup",
title: "UPDATED_PREFERENCE"
};
chrome.runtime.sendMessage(message, function (response) {
console.log(response.title);
});
} | [
"sendPrefChange() {\n if (!this.pref) {\n return;\n }\n this.set(\n 'pref.value',\n Settings.PrefUtil.stringToPrefValue(this.selected, this.pref));\n }",
"function sendUpdatedSettings () {\n browser.tabs.query({currentWindow: true, active: true}, function (tabs){\n var activeTab... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function is used to show the delete div for a picklist | function showDeleteDiv() {
showActionDiv('delete');
} | [
"function showDeleteAllButton() {\r\n $(\"#deleteSelected\").show();\r\n}",
"function deletePicklist(picklist_index) {\n // deletes picklist from object\n delete picklists[picklist_index];\n // deletes the div, modals, and <br>\n $(\".from-picklist-\" + picklist_index).remove();\n // closes the modal\n $(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to insert a single document into the database | function insertDocument(dbHandle, doc, callback) {
dbHandle.collection('publications').insertOne(doc, function(err, result) {
assert.equal(err, null);
insertedCount++;
console.log("Publications inserted: " + insertedCount);
callback();
});
} | [
"function insert_doc(doc) {\n\tif (cloudant) {\n\t\tlogger.info(\"insert_doc() doc.id_str:\", doc.id_str);\n\t db.insert(doc, function (error, http_body, http_headers) {\n\t if(error) return logger.error(error);\n\t });\n // logger.debug(\"insert_doc() http_body:\", http_body);\n\t\t}\n}",
"insertOn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GENERAL FUNCTIONS function to mask clouds based on cloud probability layer | function maskClouds(img) {
var clouds = ee.Image(img.get('cloud_mask')).select('probability');
var isNotCloud = clouds.lt(MAX_CLOUD_PROBABILITY);
return img.updateMask(isNotCloud);
} | [
"function bustClouds(img){\n img = sentinelCloudScore(img);\n img = img.updateMask(img.select(['cloudScore']).gt(cloudThresh).focal_min(contractPixels).focal_max(dilatePixels).not());\n return img;\n}",
"function maskCloud(image) {\n var QA60 = image.select(['QA60']);\n var B1 = image.select(['B1']).gt(1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Moves the car towards its target position and heading Assumes this.heading is correct | moveToTarget() {
// Adjust heading using steering wheel
if (this.targetHeading) {
let rotationNeeded = this.targetHeading - this.heading;
if (rotationNeeded > PI) rotationNeeded -= TWO_PI;
if (rotationNeeded < -PI) rotationNeeded += TWO_PI;
co... | [
"move() {\n\t\tthis.carSpeed *= FRICTION_RATE_MULTIPLIER;\n\t\tif (Math.abs(this.carSpeed) > 0.05) {\n\t\t\tif (this.carTurnLeft) {\n\t\t\t\tthis.carAngle -= TURN_RATE;\n\t\t\t}\n\t\t\tif (this.carTurnRight) {\n\t\t\t\tthis.carAngle += TURN_RATE;\n\t\t\t}\n\t\t}\n\t\tif (this.carGas) {\n\t\t\tthis.carSpeed += ACCEL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
changing pages within an application | function changePage(appID, getPage) {
changeDivContent("appLoad.cc?cid=" + classID + "&id=" + appID + "&appType=" + appType + "&page=" + cleanData(getPage));
} | [
"function changePage(site)\r\n{\r\n\tself.location = site;\r\n}",
"function changeContent(page) {\n}",
"function mofChangePage(pageid) {\n //$.mobile.changePage(\"some.html\");\t\t\t\t\n $.mobile.changePage(pageid);\n }",
"function mofChangePage(pageid, options) {\n console.log('mofCha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detects if program is running on port and prompts user to choose another if port is already being used | async function choosePort(host, defaultPort) {
// @ts-expect-error: bad lib typedef?
return detect_port_1.default(defaultPort, host).then((port) => new Promise((resolve) => {
if (port === defaultPort) {
return resolve(port);
}
const message = process.platform !== 'win32' && d... | [
"async function choosePort(host, defaultPort) {\n try {\n const port = await (0, detect_port_1.default)({ port: defaultPort, hostname: host });\n if (port === defaultPort) {\n return port;\n }\n const isRoot = process.getuid?.() === 0;\n const isInteractive = process... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RECORD step codevar for each select steps | function report_select_steps_(obj, codevar){
// ONLY SELECT STEP
if( obj.closest('.fp_fieldline').hasClass('ss_in')){
if(ss_shortcode_vars.indexOf(codevar)==-1){
ss_shortcode_vars.push(codevar);
}
}
} | [
"function report_select_steps_(obj, codevar){\r\n\t\t\t// ONLY SELECT STEP\r\n\t\t\tif( obj.closest('.fieldline').hasClass('ss_in')){\r\n\t\t\t\tif(ss_shortcode_vars.indexOf(codevar)==-1){\r\n\t\t\t\t\tss_shortcode_vars.push(codevar);\r\n\t\t\t\t}\r\n\t\t\t}\t\t\r\n\t\t}",
"function mySelectEvent() {\n\n var s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In Thumbtack, users are able to rate Pros based on their exprerience working with them. Each rating is an integer ranging from 1 to 5, and all ratings are averaged to produce a single number rating for any given Pro. Those Pros who have a rating lower than a specific threshold are manually reviewed by Thumbtack staff t... | function ratingThreshold(threshold, ratings) {
const averageRatings = [];
for (let i = 0; i < ratings.length; i++) {
const ratingTotal = ratings[i].reduce((acc, rating) => acc + rating, 0);
const ratingAvg = ratingTotal / ratings[i].length;
averageRatings.push(ratingAvg);
}
const res = [];
for (let i = 0... | [
"function ratingThreshold(threshold, ratings){\n const manualReviewIndices = [];\n\n ratings.forEach( (element, index) => {\n let total = element.reduce( (prev, current) => prev + current );\n const average = total / element.length;\n if(average < threshold){\n manualReviewIndi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SZP2[] Set Zone Pointer 2 0x15 | function SZP2(state) {
var n = state.stack.pop();
if (DEBUG) console.log(state.step, 'SZP2[]', n);
state.zp2 = n;
switch (n) {
case 0:
if (!state.tZone) initTZone(state);
state.z2 = state.tZone;
break;
case 1 :
state.z2 = state.gZone;
... | [
"function SZP2(state) {\n\t var n = state.stack.pop();\n\n\t if (exports.DEBUG) { console.log(state.step, 'SZP2[]', n); }\n\n\t state.zp2 = n;\n\n\t switch (n) {\n\t case 0:\n\t if (!state.tZone) { initTZone(state); }\n\t state.z2 = state.tZone;\n\t break;\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Devolve a diagonal Direita da matriz num array unidimensional | function DiagonalDireita(tabuleiro) {
var x = new Array(MAX);
var ct = MAX -1;
for(var i = 0; i < MAX; i++) {
x[i]= tabuleiro[i][ct];
ct--;
}
return x;
}// fim da função DiagonalDireita********************************************************* | [
"function DiagonalEsquerda(tabuleiro){\n var x = new Array(MAX);\n for(var i = 0; i < MAX; i++) {\n x[i]= tabuleiro[i][i];\n }\n return x;\n}// fim da diagonalesquerda***************************************************************",
"function diagonals(matrix){ \n let firstDignal = 0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Is this request cachable? | function isCachable(req) {
// Only GET requests are cachable
return req.method === 'GET'; // &&
// Only npm package search is cachable in this app
//-1 < req.url.indexOf(searchUrl);
} | [
"_pendingRequests () {\n if (this._requestMap.size > 0) {\n return true\n }\n }",
"isCaching() {\n return this.response.data.hasOwnProperty('cache') &&\n this.response.data.cache === true;\n }",
"get busy() {\r\n // @ts-ignore\r\n return this.requests.items.length ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load multiple entity collections at the same time. before any selectors$ observables emit. | loadCollections(collections, tag) {
this.dispatch(new LoadCollections(collections, tag));
} | [
"async fetchMany () {\n\t\tconst documents = await this.databaseCollection.getByIds(\n\t\t\tthis.notFound,\n\t\t\tthis.options\n\t\t);\n\t\tthis.fetchedDocuments = documents;\n\t}",
"loadAllItems() {\n this.itemDao.findAll().forEach(i => this.loadItem(i.getId()));\n }",
"function loadSelectables ( )\n\t{\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update pax info whan user changed | function updatePaxInfo(pax) {
filterBody = pax;
_paxInfoChanged();
} | [
"function adjust_user(u){\n\t//todo: check for whether things need changes, change them, and mark changed as true\n\t//todo: put changes into db...?\n}",
"function refreshUserData() {\n userData.onUserChanged(fbInterface.currentUserID, fbInterface.oldUserID, true)\n}",
"updateUser(h, p){\n\t\tlet oldInfo = t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
the constructor will register the transaction processor with the validator we provide it with the name of the transaction family, the version and the address namespace it can manipulate | constructor () {
super(Address.XO_FAMILY, [Address.XO_VERSION], [Address.XO_NAMESPACE])
} | [
"constructor() { \n \n MozuAppDevContractsApplicationTransaction.initialize(this);\n }",
"constructor(target, abi, runner, _deployTx) {\n assertArgument(typeof (target) === \"string\" || isAddressable(target), \"invalid value for Contract target\", \"target\", target);\n if (runner ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Functions This will be a function that will go through the classNames of a DOM Element and see if there is a class of ship type. If so, it will return the name of that ship type, otherwise it will return an empty string. | function findShipType(element) {
let shipType;
element.classList.forEach( classItem => {
if (classItem.includes('type')) {
shipType = classItem;
} else {
return;
};
})
return shipType;
} | [
"hasShip(gridcellID, isUserBoard = this.props.isUserBoard) {\n // if this is the computer board then it can't add a hasShip class as this will give it away to the user so the function should just return\n if (isUserBoard === false) {\n return \"\";\n }\n\n // all the grid positions of all the ships... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process the allContentSearch form 1. Perform form validation, checking for empty fields. Give the user a relevent message if required. 2.Process/Assign the appropriate form elements and submit the form. | function processallContentSearch(hiddenForm, queryForm)
{
var formToSubmit = hiddenForm;
var formToProcess = queryForm;
// Do some basic form validation
if(formToProcess.terms.value != "")
{
formToSubmit.WISsearch1.value = formToProcess.terms.value;
formToSubmit.submit();
}
else
{
alert("You must ente... | [
"function PerformSearch() {\n\n if ($(\"#Criteria_BuildingID\").val() == \"\" || $(\"#Criteria_FloorID\").val() == \"\" || $(\"#Criteria_Date\").val() == \"\") {\n return; // One of the essential values is empty - we can't do anything, so return.\n }\n $(\"#CriteriaForm\").submit();\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Xpath for Race List Tab | get raceListTab() {return browser.element("~Race List");} | [
"get meetingRaceList_RaceNo() {return browser.element(\"//android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup[1]\");}",
"get VideoHub_RaceReplayTab() { return browser.element('//XCUIElementTypeOther[@name=\"Race Replays\"]');}",
"get raceOverviewTab() {return browser.e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset all the counters, called when a new channel is opened | function reset_counters() {
num_connection_retries = 0;
time_spent = 0;
time_purchased = 0;
} | [
"function resetChannelPositions() {\n Object.keys(internals.channels).forEach((channel) => {\n internals.channels[channel] = -1;\n });\n}",
"reset () {\n Object.values(this.channels).forEach((channel) => {\n if (channel.destroy) {\n channel.destroy()\n }\n })\n this.channels... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check for duplicate and conflicting rules. | function verifyRuleDuplicatesAndConflicts(rule, ruleRow) {
console.log("New rule name: " + rule.RuleName);
console.log("verifyRuleDuplicatesAndConflicts() rule--> " + JSON.stringify(rule));
var countDownRulesInfo = {};
for (var i = 0; i < ruleRow.length; i++) {
var tmpRule = ... | [
"checkRules() {\n this.rules_to_apply.forEach((rule) => {\n if (!(rule instanceof Array)) {\n throw new Error(`Invalid rule (must be 3-element array): ${rule}`);\n }\n if (rule.length !== 3) {\n throw new Error(`Invalid rule (must be 3-element array): ${rule}`);\n }\n });\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Height() : grabs the height of the user's device and adds on the height to the container; Objective : this is used to place the footer on the bottom of the screen | function getHeight(){
var usersHeight = screen.height;
var uHeight = usersHeight - 300;
document.getElementById('container').style.minHeight=uHeight+10+"px";
} | [
"_getFooterHeight() {\n const layoutFooter = this.getLayoutFooter()\n\n if (!layoutFooter) return 0\n\n return layoutFooter.getBoundingClientRect().height\n }",
"function getFooterHeight(){\n\treturn $('footer').height();\n}",
"function getHeight() {\n return body.outerHeight();\n }",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: POST To Remove Airline By Id | function _removeAirlineById(req, res, next) {
var airlineId = req.params.id;
if(!COMMON_ROUTE.isValidId(airlineId)){
json.status = '0';
json.result = { 'message': 'Invalid Airline Id!' };
res.send(json);
} else {
AIRLINES_COLLECTION.findOne({ _id: new ObjectID(airlineId)}, function (airlineerror, getAirlin... | [
"async delete (request, response) {\n const { id } = request.params;\n const airline_id = request.headers.authorization;\n\n const flight = await connection('flights').where('id', id).select('airline_id').first();\n\n if(flight.airline_id !== airline_id){\n return response.sta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Print failed authentication to the terminal | function authFailed() {
signale.error('Failed to authenticate to the wdc with given credentials');
} | [
"function errorByAuthentication() {\n next('Invalid username or password');\n }",
"function _authError() {\n next('Invalid User ID/Password');\n }",
"function failToAuth() {\n next({\n status: 401,\n statusMessage: 'Unauthorized',\n message: 'Invalid User ID/Password',\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sends url to background script | function sendURL(x){
console.log(x);
//var url = urlSplit(x[i].href);
chrome.runtime.sendMessage({'url': x}, function(response) {
console.log(response);
});
} | [
"OnStartRunningUrl(aUrl) {\n }",
"function Crawler__send(url) {\n var self = this;\n //\n // Send the URL\n //\n this._ipc.send('url', url, function(retval) {\n self._lastfile = url;\n });\n\n}",
"function callBackgroundScript(targetFunction, args) {\n var message = {functionName: t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if text is an email address | function isEmailAddress( text ) {
var email = EMAIL_ADDRESS_PATTERN;
return email.test( text );
} | [
"function isEmailAddress(text) {\n var email = EMAIL_ADDRESS_PATTERN;\n return email.test(text);\n }",
"function IsEmailAddress(str) {\n var posAt = str.indexOf('@');\n if (posAt < 0)\n return false;\n\n var posLastDot = str.lastIndexOf('.');\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
on click function will redirect to view all withdraw history | onClickViewAll() {
this.props.history.push("/app/history/withdraw");
} | [
"onClickViewAll() {\n this.props.history.push('/app/history/deposit');\n }",
"function goToHistory() {\n\t\t\t\tdiState.go('portal.audit.list', { id: vm.purchaseOrder.documentId });\n\t\t\t}",
"function showAll() {\n window.location.href = '/diseases/'\n}",
"function viewBackFromOther() {\n\tlogI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[MSOFFCRYPTO] 2.3.4.5 EncryptionInfo Stream (Standard Encryption) | function parse_EncInfoStd(blob, vers) {
var flags = blob.read_shift(4);
if((flags & 0x3F) != 0x24) throw new Error("EncryptionInfo mismatch");
var sz = blob.read_shift(4);
var tgt = blob.l + sz;
var hdr = parse_EncryptionHeader(blob, sz);
var verifier = parse_EncryptionVerifier(blob, blob.length - blob.l);
retur... | [
"function parse_EncInfoStd(blob){var flags=blob.read_shift(4);if((flags&0x3F)!=0x24)throw new Error(\"EncryptionInfo mismatch\");var sz=blob.read_shift(4);//var tgt = blob.l + sz;\nvar hdr=parse_EncryptionHeader(blob,sz);var verifier=parse_EncryptionVerifier(blob,blob.length-blob.l);return{t:\"Std\",h:hdr,v:verifie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create array of adapted batman data into the Listing Component | renderBatmanListings() {
const { batmanListings } = this.props;
const listingsArr = [];
each(batmanListings, (listing) => {
listingsArr.push(<Listing {...listing} />);
})
return listingsArr;
} | [
"renderSupermanListings() {\n const { supermanListings } = this.props;\n const listingsArr = [];\n each(supermanListings, (listing) => {\n listingsArr.push(<Listing {...listing} />); \n });\n return listingsArr;\n }",
"getBBdata() {\n let gtBal = this.balconyDa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gridMaker() creates a graphing box given width, height, and depth. The textures are also scaled to these dimensions. There are many ways this function could be improved or done differently e.g. buffer geometry, merge geometry, better reuse of material/geometry. | function gridMaker (width, height, depth) {
const grid = new THREE.Object3D();
// AKA bottom grid
const xGrid = planeMaker(width, depth);
xGrid.rotation.x = 90 * (Math.PI / 180);
grid.add(xGrid);
// AKA far grid
const yPlane = planeMaker(width, height);
yPlane.position.y = (0.5) * height;
... | [
"function createGrid(width, height) {\n\n}",
"function createGrid() {\n var size = getGridSize();\n var radius = (blockSpacing * size) / 2;\n var nodes = [];\n\n for (var x = -radius; x < radius; x += blockSpacing) {\n\n for (var y = -radius; y < radius; y += blockSpacing) {\n\n for ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns 0 if the state was changed, 1 if it wasn't, and 1 on error. | setCassetteState(newState) {
const oldCassetteState = this.cassetteState;
// See if we're changing anything.
if (oldCassetteState === newState) {
return 1;
}
// Once in error, everything will fail until we close.
if (oldCassetteState === CassetteState.FAIL && ... | [
"function get_error_state(){\n\treturn states.length + 1;\n}",
"stateChanged(state) { }",
"_changedState() {\n if (this._diffState()) {\n this.onChange(this, this.state)\n }\n }",
"state(name, state) {\n let changed = this[name] !== state;\n if (changed) {\n this[name] = state;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copy keys files to volume | async copyFilesToServiceDirectory () {
try {
// Create keys directory
await fs.ensureDir('/service/keys');
// Copy polkadot node key file
console.log(`Copying ${config.polkadotNodeKeyFile} from /config/ to /service/keys/...`);
await fs.copy(`/config/${config.polkadotNodeKeyFile}`, `/s... | [
"function copy_keys_over(custom_path) {\n\t\t\ttry {\n\t\t\t\tconst default_path2 = path.join(os.homedir(), '.hfc-key-store/');\n\t\t\t\tconst private_key = 'cd96d5260ad4757551ed4a5a991e62130f8008a0bf996e4e4b84cd097a747fec-priv';\t//todo make this generic\n\t\t\t\tconst public_key = 'cd96d5260ad4757551ed4a5a991e621... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
level saver checks for level value in localstorage | function getLevel() {
var level = localStorage.getItem('level');
if(!level) {
level = 1;
localStorage.setItem('level', level);
} else {
level = parseInt(level, 10);
}
return level;
} | [
"function storeLevel(level) {\n localStorage.setItem('level', level);\n}",
"function saveLevel(lv){\n level = lv\n}",
"function getLevel() {\n return localStorage.getItem('level')\n}",
"function getLocalLevel(){\n\treturn parseInt(localStorage.level);\n}",
"function setLevel(levelNo){\n\t//alert(\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: createUserAuthObj Create User Authentication parameter object to store in Redis | function createUserAuthObj (userName, password)
{
var userObj = {};
userObj['username'] = userName;
userObj['password'] = password;
return JSON.stringify(userObj);
} | [
"function createUserObject(data) {\n return new SkycapUser(data);\n}",
"function createToken(obj, username, amministratore) {\n let token = jwt.sign({\n '_id': obj._id,\n 'username': obj.username,\n 'amministratore': obj.amministratore,\n 'iat': obj.iat || Math.floor(Date.now() / 1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Forwards org creation to dao class | function create(req, res, next) {
const orgData = {
name: req.body.name,
description: req.body.description,
email: req.body.email,
street: req.body.street,
city: req.body.city,
state: req.body.state,
postalCode: req.body.postalCode,
};
orgDao.create(orgData)
.then((newOrg, created)... | [
"createOrg(orgName, orgType) {\n var orgData = {};\n orgData[\"orgName\"] = orgName;\n orgData[\"orgType\"] = orgType;\n logger.info (\"creating org\", orgData);\n return this.modelService.create(orgData);\n }",
"function createOrg(logger, reqContext, accessToken) {\n const userContext = reqCon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes all row elements from the subgrids body and empties cache | clearRows() {
this.emptyCache();
const all = this.element.querySelectorAll('.b-grid-row'),
range = document.createRange();
if (all.length) {
range.setStartBefore(all[0]);
range.setEndAfter(all[all.length - 1]);
range.deleteContents();
}
} | [
"reset() {\n const rows = document.getElementsByClassName('row')\n for (let row of rows) {\n while (row.firstChild) {\n row.removeChild(row.firstChild)\n }\n } \n while (gridContainer.firstChild) {\n gridContainer.removeChild(gridContainer.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create multiple new items using model.bulkCreate() | bulkCreate(req, res) {
Item.bulkCreate(req.body)
.then((item) => {
res.status(200).json(item);
})
.catch((error) => {
res.status(500).json(error);
});
} | [
"function crudpostmulti(arr) {\n var opts = {};\n // Note: node/express also parses Q-string on POST\n var q = req.query;\n if (q && q._fields) {console.log(\"Q:\", q); opts.fields = q._fields.split(/,\\s*/); }\n console.log(\"opts:\", opts);\n smodel.bulkCreate(arr, opts)\n .then(function (ent... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
after dtick is already known, find tickround = precision to display in tick labels for numeric ticks, integer digits after . to round to for date ticks, the last date part to show (y,m,d,H,M,S) or an integer digits past seconds | function autoTickRound(ax) {
var dtick = ax.dtick;
ax._tickexponent = 0;
if (!isNumeric(dtick) && typeof dtick !== 'string') {
dtick = 1;
}
if (ax.type === 'category' || ax.type === 'multicategory') {
ax._tickround = null;
}
if (ax.type === 'date') {
// If tick0 is unusual, give tickround a bi... | [
"function autoTickRound(ax) {\n\t var dtick = ax.dtick;\n\t\n\t ax._tickexponent = 0;\n\t if(!isNumeric(dtick) && typeof dtick !== 'string') {\n\t dtick = 1;\n\t }\n\t\n\t if(ax.type === 'category') {\n\t ax._tickround = null;\n\t }\n\t if(ax.type === 'date') {\n\t // If ti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stringifies a GeoJSON object into WKT | function stringify (gj) {
if (gj.type === 'Feature') {
gj = gj.geometry;
}
function pairWKT (c) {
return c.join(' ');
}
function ringWKT (r) {
return r.map(pairWKT).join(', ');
}
function ringsWKT (r) {
return r.map(ringWKT).map(wrapParens).join(', ');
}
function multi... | [
"function stringify(gj) {\n if (gj.type === 'Feature') {\n gj = gj.geometry;\n }\n\n function pairWKT(c) {\n if (c.length === 2) {\n return c[0] + ' ' + c[1];\n } else if (c.length === 3) {\n return c[0] + ' ' + c[1] + ' ' + c[2];\n }\n }\n\n function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Longest Sequence / Write a function that returns the length of the longest sequence of 1s in an array of 1s and 0s. | function longestSequence(arr) {
// YOUR CODE HERE
let maximum = 0;
let count = 0;
for (let i = 0; i < arr.length; i++) {
if (arr[i] === 0) count = 0;
else {
count++;
maximum = Math.max(maximum, count);
}
}
if (maximum === 0) return "There is no one sequenced";
else return maximum;
... | [
"function longestSequence(arr) {\n\n}",
"function longestSequence(array) {\n let count = 0;\n let max = 0;\n for (let index = 0; index < array.length; index++) {\n if (array[i] === 0) count === 0;\n else {\n count++;\n max = Math.max;\n }\n }\n if (max === 0) return \"there is no sequence\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a Catberry Catcomponent file. More details can be found here Creates new instance of the "commitsdetails" component. | function CommitsDetails() {
} | [
"newCommit() {\n\t\tconst method = `newCommit[${this.name}]`;\n\t\tlogger.debug(`${method} - start`);\n\n\t\treturn new Commit(this.chaincodeId, this.channel, this);\n\t}",
"function CommitFiles(props) {\n return (\n <Row>\n <Col span={24}>\n <div className=\"commit-component\">\n <h3> Ch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculates the sum of the squares of prime numbers between a and b, inclusive | function primes_square_sum(a, b) {
return filtered_accumulate_iter(
(x, y) => (x + y),
0,
x => square(x),
a,
x => x + 1,
b,
is_prime);
} | [
"function sumOfSquares(a, b) {\n var sum = add(square(a), square(b));\n return sum;\n}",
"function squares(a, b) {\n let squareCounter = 0;\n let startIndex = 0;\n for (let i = a; i <= b; i++) {\n if (Number.isInteger(Math.sqrt(i))) {\n startIndex = Math.sqrt(i);\n squa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the underlying webview instance for this preview. | get webview() {
return this._panel.webview;
} | [
"function getWebviewWebContents() {\n return webContents.getAllWebContents()\n // TODO replace `localhost` with whatever the remote web app's URL is\n .filter(wc => wc.getURL().search(new RegExp(endpoint, \"gi\")) > -1)\n .pop();\n}",
"get backgroundView() {\n if (!this._backgroundView) {\n this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
we keep this function for testing purposes. We can use the keyboard to simulate the classes. | function keyTyped() {
if (key === '0') {
activeClass = 0;
} else if (key === '1') {
activeClass = 1;
} else if (key === '7') {
activeClass = 7;
}
} | [
"function ClickClasses() {\n\tif (app.viewerVersion >= 15 && (!event.target.value || event.modifier || event.shift)) {\n\t\tevent.target.remVal = event.target.value;\n\t\ttDoc.getField(\"Player Name\").setFocus();\n\t\tSelectClass();\n\t};\n}",
"isInputPhisychal() {\n //If the event if from the keyboard th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to draw contours on the aladin viz | function aladin_setContours(
aladin,
contour_list,
){
overlaylist = [];
for (i = 0; i < contour_list.length; i++) {
var contour = A.graphicOverlay({id: i, color:contour_list[i].color, lineWidth: 2, name:contour_list[i].name});
aladin.addOverlay(contour);
var overlay_contours = c... | [
"function drawContour() {\n\t\t\t\t\t\n\t\t\t\t\t// Set fill color\n\t\t\t\t\t$.contourContext.fillStyle = updateColor();\n\n\t\t\t\t\t$.contourContext.beginPath();\n\n\t\t\t\t\t// Get contour\n\t\t\t\t\tthisContour = $.contourData.contourArray[0][$.contourData.currentContour][\"py/numpy.ndarray\"][\"values\"];\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if a list has more than one article Returns boolean | function isArticlesCorrect(anArray) {
var counter = 0;
for(i = 0; i < anArray.length; i++) {
if(dictionary.articles.includes(anArray[i])){
console.log("Article matched: " + dictionary.articles[i]);
counter++;
}
}
console.log("Articles found: " + counter);
return counter > 1
} | [
"function containsArticle(article, articlesArr) {\n for (let a of articlesArr) {\n if (a.url === article.url) {\n console.log(a);\n return true;\n }\n }\n return false;\n }",
"isMany() {\n return !this.isSingle();\n }",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format Time in seconds | formatTime(seconds) {
// Minutes
let minutes = Math.floor(seconds / 60);
// Seconds
let partInSeconds = seconds % 60;
// Adds left zeros to seconds
this.partInSeconds = partInSeconds.toString().padStart(2, "0");
// Returns formated time
return `${minutes}:${partInSeconds}`;
} | [
"get formattedSeconds() {\n var seconds = Math.ceil(this.seconds / 1000) + \"s\";\n return seconds;\n }",
"function formatTime() {\n seconds++;\n const mins = Math.floor(seconds / 60).toString().padStart(2, '0');\n const secs = (seconds % 60).toString().padStart(2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Makes the matching socket instances leave the specified rooms | socketsLeave(room) {
this.adapter.delSockets({
rooms: this.rooms,
except: this.exceptRooms,
}, Array.isArray(room) ? room : [room]);
} | [
"socketsLeave(room) {\n this.adapter.delSockets({\n rooms: this.rooms,\n except: this.exceptRooms,\n }, Array.isArray(room) ? room : [room]);\n }",
"delSockets(opts, rooms) {\n this.apply(opts, (socket) => {\n rooms.forEach((room) => socket.leave(room));\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this removes an entry from the hash and then checks to see if any 'rejiggery' is necessary | function removeFromHash(sid) {
// simultaneously checks for this sentence in the hash and assigns the
// concept if present
if (concept = conceptHash.get(sid)) {
// alert('found this sentence in the hash');
conceptHash.unset(sid);
// alert('values are '+conceptHash.values());
// if there is now nothing with... | [
"function removeEntry() {\n\t// Get the \"hostname\"/\"certificate\"-combination whose entry should be removed from the cache ...\n\tvar hash = document.getElementById(\"crossbear-ce-hash\").value;\n\tvar host = document.getElementById(\"crossbear-ce-host\").value;\n\t\n\t// ... remove it from the cache ...\n\twind... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a color, update the data to have a "show" element that is true if the BART station is on that Line and false if not. This uses map rather than filter so that the elements aren't actually removed, just not displayed. This is so the tooltip information and mouse clicks don't need to be readded. | function filterByColor(color) {
const stationsFiltered = STATIONS.map(function (sta) {
let newSta = JSON.parse(JSON.stringify(sta));
let newEtd = [];
let showing = null;
for (let destination of newSta.etd) {
// push the destination if it's on the correct line. Using push because
// there ... | [
"function filterByColorAndDirection(color, dirName) {\n const stationsFiltered = STATIONS.map(function (val) {\n let newVal = JSON.parse(JSON.stringify(val));\n for (let elem of newVal.etd) {\n if (elem.estimate[0].color === color && elem.abbreviation === dirName) {\n newVal.show = true;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a line a short Url to the results.csv file and if all url were received download the file. | function addUrlCsvFile(msg) {
if(msg.valid) {
retval += msg.url + ";" + msg.shortUrl + ";" + "0\n";
} else {
retval += msg.url + ";web no alcanzable;\n";
}
numUrlsCsvReceive++;
if(numUrlsCsvSends <= numUrlsCsvReceive && numUrlsCsvSends !== 0){
download('results.csv', retval);... | [
"function getShortURLFromCSV() {\n num_processed_lines++;\n stompClient.send(\"/app/link\", {}, JSON.stringify({url: lines[num_processed_lines - 1],\n idToken: getCookie(\"token\"), documentCsv: true}));\n if (num_processed_lines < lines.length && lines[num_processed_lines] !== \"\") {\n getS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Insert user to a team | function insertUser(data) {
return db("team_members").insert(data);
} | [
"function insertUser(data) {\n return db(\"team_members\").insert(data);\n}",
"async addUserToTeamAsNeeded () {\n\t\tif (!this.teamId && (!this.signupToken || !this.signupToken.teamId)) { return; }\n\t\tthis.teamId = this.teamId || this.signupToken.teamId;\n\t\tthis.team = await this.data.teams.getById(this.team... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Select a token in the token list | function select_token (token) {
token.addClass(settings.classes.selectedToken);
selected_token = token.get(0);
// Hide input box
input_box.val("");
// Hide dropdown if it is visible (eg if we clicked to select token)
hide_dropdown();
} | [
"function getTokenSelection(token){\n console.assert(tokenService.isToken(token), \"Not token, but this:\", token);\n const selection = g.select(\".topping-circle[data-token-id=\" + token.id + \"]\");\n return selection;\n}",
"function selectToken($token) {\n if (!settings.disabled) {\n desel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run preparation handlers for a single bot loaded in the Manager. | static prepareBot(botId) {
return __awaiter(this, void 0, void 0, function* () {
// Await preparation handler for a single bot.
const bot = yield BotManager.getBot(botId);
yield bot.prepare();
});
} | [
"static prepareAllBots() {\n return __awaiter(this, void 0, void 0, function* () {\n // Await preparation handlers for all bots.\n yield Promise.all(Object.keys(BotManager.bots)\n .map((botId) => __awaiter(this, void 0, void 0, function* () {\n // Await pre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sign In template Saga Watcher | function SignInTemplateSaga() {
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function SignInTemplateSaga$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
case "end":
return _context.stop();
}
}
}, _marked, this);... | [
"[types.START_SIGN_IN](state) {\n state.signingIn = true;\n }",
"signIn() {}",
"@action(constants.SIGN_IN)\n handleSignIn() {\n new ChromeIdentityAdapter().signIn().done(\n () => {\n this.authenticated = true;\n this.emit('change', this.getState());\n this.flux.ac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves the $endpoint hhh youtube links and streamable soundcloud tracks. endpoint: one of ('hot','new','top') returns []Item | hhh(endpoint) {
const isSupported = raw => {
const sc = raw.data.domain === 'soundcloud.com' && raw.data.url.indexOf('/sets/') === -1;
const yt = reYtUrl.test(raw.data.url);
return sc || yt;
};
const toItem = raw => {
const props = {
src: 'hhh',
createdAt: moment.unix... | [
"_getEndpoints() {\n var endpointUrl = 'https://graph.api.smartthings.com/api/smartapps/endpoints/' + this._authTokens['access'].client_id + '?access_token=' + this._authTokens['access'].token;\n\n return this._makeRequest(\"\", endpointUrl, 'GET').then((responses) => {\n var endpoints = re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
An object providing rest api for books. Made it not via prototypes, rather via direct construction, to make the routing code of server.js more clear. Anyway such endpoints are going to be sealed (final) so no extension is thought of at the moment. | function BookRestApi() {
var bookProvider = BookProvider;
var searchProvider = Search;
var self = this;
/**
* Retuns all the books from the storage. Should be used with care. Apply paging later?
* @param req express request
* @param res express response
*/
this.findAllBooks = fu... | [
"function BookRestApi() {\n var bookProvider = BookProvider;\n var searchProvider = Search;\n var self = this;\n\n /**\n * Retuns all the books from the storage. Should be used with care. Apply paging later?\n * @param req express request\n * @param res express response\n */\n this.fi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Writes a new database version to the db. | _writeDBVersion(version) {
const tx = this._db.beginTxn();
tx.putNumber(this._mainDb, '_dbVersion', version);
tx.commit();
} | [
"function updateDatabase(oldDbVersion)\n{\n\t// WRITEME\n\tTi.App.Properties.setInt(\"dbVersion\", dbVersion);\n\treturn;\n}",
"function dbVersionUpgrade(evt) {\n\n // If the database was previously loaded, close it. \n // Closing the database keeps it from becoming blocked for later delete operatio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Concatenates two arrays of library names and preserves the dependency order that ld needs. | function concatLibs(libs, deplibs) {
var r = [];
var s = {};
function addLibs(lst) {
for (var i = lst.length; --i >= 0;) {
var lib = lst[i];
if (!s[lib]) {
s[lib] = true;
r.unshift(lib);
}
}
}
addLibs(deplibs);
... | [
"function librariesReduce( libraries ) {\n\t\treturn libraries.reduce( function( pv, cv, i ) {\n\t\t\treturn \"\" + pv + ( ( pv !== \"\" ) ? \",\" : \"\" ) + cv;\n\t\t}, \"\" );\n\t}",
"function __updateLibs(deplibs) {\n var result = [],\n manifest = project.getManifest();\n\n function _D... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |