query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
utility function to compose multiple composers at once.
function composeAll() { for (var _len = arguments.length, composers = Array(_len), _key = 0; _key < _len; _key++) { composers[_key] = arguments[_key]; } return function (BaseComponent) { if ((0, _.getDisableMode)()) { return _common_components.DummyComponent; } if (BaseComponent === null |...
[ "function composeAll() {\n for (var _len = arguments.length, composers = Array(_len), _key = 0; _key < _len; _key++) {\n composers[_key] = arguments[_key];\n }\n\n return function (BaseComponent) {\n if (BaseComponent === null || BaseComponent === undefined) {\n throw new Error('Curry function of comp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finite State Machine used to change Scenes
function changeScene() { // Launch various scenes switch (scene) { case config.Scene.MENU: // show the MENU scene stage.removeAllChildren(); menu = new scenes.Menu(); currentScene = menu; console.log("Starting MENU Scene"); break; ...
[ "function changeScene() {\n // Launch various scenes\n switch (scene) {\n case config.Scene.MENU:\n // show the MENU scene\n stage.removeAllChildren();\n menu = new scenes.Menu();\n currentScene = menu;\n console.log(\"Starting MENU Scene\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the output data display based on the current value of gaOutputData.
function updateOutputDataDisplay() { console.log('updateOutputDataDisplay'); var s = ''; for (var i = 0; i < gaOutputData.length; i++) { var obj = gaOutputData[i]; s += (obj.value + '=' + obj.count + ', '); } $('#output-data').text(s); }
[ "function updateOutputData() {\n outputData = unformatNum(getOutput());\n // Lines to remove initial emoji etc\n if(isNaN(outputData)) {\n setOutput(this.id);\n setCalculation(\"\");\n }\n //Clear rather than append if last button was =\n else if (sumDone == true) {\n outputData = this.id;\n set...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert grayscale jsfeat image to p5 rgba image usage: dst = jsfeatToP5(src, dst)
function jsfeatToP5(src, dst) { if (!dst || dst.width != src.cols || dst.height != src.rows) { dst = createImage(src.cols, src.rows); } var n = src.data.length; dst.loadPixels(); var srcData = src.data; var dstData = dst.pixels; for (var i = 0, j = 0; i < n; i++) { var cur = ...
[ "function jsfeatToP5(src, dst) {\n if(!dst || dst.width != src.cols || dst.height != src.rows) {\n dst = createImage(src.cols, src.rows);\n }\n var n = src.data.length;\n dst.loadPixels();\n var srcData = src.data;\n var dstData = dst.pixels;\n for(var i = 0, j = 0; i < n; i++) {\n var cur = srcData[i]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`_encodeIriOrBlank` represents an IRI or blank node
_encodeIriOrBlank(entity) { // A blank node or list is represented as-is if (entity.termType !== 'NamedNode') { // If it is a list head, pretty-print it if (this._lists && entity.value in this._lists) entity = this.list(this._lists[entity.value]); return 'id' in entity ? entity.id : '_:' + ent...
[ "_encodeIriOrBlank(entity) {\n // A blank node or list is represented as-is\n if (entity.termType !== 'NamedNode') {\n // If it is a list head, pretty-print it\n if (this._lists && (entity.value in this._lists))\n entity = this.list(this._lists[entity.value]);\n return 'id' in entity ? e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate Transfer transaction creation with provided message
validate() { var _a; if (((_a = this.message) === null || _a === void 0 ? void 0 : _a.type) === message_1.MessageType.PersistentHarvestingDelegationMessage) { if (this.mosaics.length > 0) { throw new Error('PersistentDelegationRequestTransaction should be created without Mosa...
[ "function verifyCreateTransfer(tx, value, creator) {\n for (let l of tx.logs) {\n if (l.event === 'TransferSingle') {\n assert(l.args._operator === creator);\n // This signifies minting.\n assert(l.args._from === zeroAddress);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert a cell into an array of cells based on 'r' cell reference, if a cell already exists with the same 'r' cell reference, overwrite it (only if 'allowOverwrite' = true)
function insertOrOverwriteCell(cells, newCell, allowOverwrite, allowMerge, overwriteSharedStrings, sharedStrings) { var parseCol = CellRefUtil.parseCellRefColumn; var cellIdx = parseCol(newCell.r); // if an existing cell has the same index, overwrite it (if allowed), return var findIdx =...
[ "function insertOrOverwriteRow(rows, newRow, allowOverwrite) {\n if (allowOverwrite === void 0) { allowOverwrite = false; }\n var rowNum = newRow.r;\n // if an existing row has the same row number, overwrite it (if allowed), return\n var rowIdx = getRowIndex(rows, rowNum);\n if (r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Print the names of the first 10 courses the user has access to. If no courses are found an appropriate message is printed.
function listCourses() { console.log('It is hitting listCourses') var request = gapi.client.classroom.courses.list({ pageSize: 10 }); request.execute(function(resp) { var courses = resp.courses; appendPre('Courses:'); if (courses.length > 0) { ...
[ "function GetCourseName(num, cjo) {\r\n\tvar courses_jo = cjo.courses;\r\n\tfor(var i in courses_jo) {\r\n\t\tif(num == courses_jo[i].course_number &&\r\n\t\t\tcourses_jo[i].subject == \"CMP SCI\")\r\n\t\t\treturn courses_jo[i].course_name;\r\n\t}\r\n\treturn \"No CMP SCI Course with that course number\";\r\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the URL for the carousel page.
function getCarouselUrl(page) { carouselStr = new String(CAROUSEL_URL); carouselStr = carouselStr.replace('/x/', '/'+page+'/'); carouselStr = carouselStr.replace('y.ajax', Math.floor(Math.random()*10) + '.ajax'); return carouselStr; }
[ "function getCurrentSlideLink() {\r\n return window.location.href;\r\n}", "static async getURL() {\n url = await driver.getDriver().execute(`return document.URL`)\n logger.info('Current page URL: [ ' + url + ' ]')\n return url\n }", "get url() {\n\t\tif (this.path != '')\n\t\t\tretu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
since there is an error, make allFormsValid false create a paragraph element with a class of error, and errorIndication text make the text colour red insert the paragraph after the invalid form
function addErrorIndication(errorIndication, elem) { allFormsValid = false; var errorPara = document.createElement("p"); var node = document.createTextNode(errorIndication); errorPara.appendChild(node); errorPara.className = 'error'; errorPara.style.color = 'red'; elem.parentNode.insertBefore(errorPara, e...
[ "function validateErrors(err) {\n if (err) {\n var d = document.getElementById(\"dialog2\");\n var validation = document.createElement(\"div\");\n validation.id = \"validation\";\n validation.style = \"color:red;\";\n validation.innerText = err;\n d.appendChild(validatio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform any work necessary to start application load manifest from url display splash screen create external application manager download any assets for external applications create MainSystem create our first application using application manager
startApp() { const manifest = this.manifest; logger.debug('main->startApp'); const splashScreenImage = this.getManifestEntry('splashScreenImage'); if (splashScreenImage) { const manifestTimeout = this.getManifestEntry('splashScreenTimeout'); MainWindowProcessManager.showSplashScreen(splashScreenImage, man...
[ "function manifestStartup() {\n // Fixed Controllers\n startupClipboard(); // manifest_clipboard.js\n startControlBar(); // manifest_controlBar.js\n\n\n // Manifest Sheets\n list_manifestsheets();\n\n\n // Run Jumper and Manifest Routines\n //routinesJumpers();\n routinesManifestSheet();\n\n\n // Disable S...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates HTML markup for link to restart a ProcessingStep.
createRestartProcessingStepLink(id, dataTable) { 'use strict'; const imageLink = $.otp.createAssetLink('redo.png'); return `<a id="restartProcessingStepLink" onclick="$.otp.workflows.restartProcessingStep(${id}, '${dataTable}');" href="#" title="Restart"> ...
[ "function gameRestartFragment()\n{\n\ttextSize(100);\n\ttext(\"GAMEOVER\", width/2, height/2);\n\ttextAlign(CENTER, CENTER);\n\n\t//resetBtn = createButton('RESET');\n \t//resetBtn.position(width/2 - 70, height/2 + 100);\n \t//resetBtn.mousePressed(mousePressed);\n}", "function replaceStep(){\n d3.select('#ste...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
submit storyboard Called when you click the green check mark button. We gather all the information needed for the server to create a new storyboard, and send it in a nice JSON object to the server.
function submitStoryboard() { /* // If the user hasn't logged in yet, we kindly request they login if (!login.loggedIn) { $("#loginbox").data('function', 'submitStoryboard'); $("#loginbox").dialog('open'); // break out. We'll be back because of the loginbox's calling mechanism return; } */ // if the descr...
[ "function createNewStoryFromSubmit() {\n console.debug(\"createNewStoryFromSubmit\");\n hidePageComponents();\n $submitForm.show();\n\n // getNewStoryData();\n\n $submitForm.trigger(\"reset\")\n\n // $submitForm.on(\"submit\", await storyList.addStory(currentUser.username, {title, author, url}));\n\n\n\n\n\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: createButton creates an individual button Parameters: URL path to image position: x x position y y position frameSize: width frame width height frame height animBounds: out mouse off button start start frame end end frame over mouse on button start start frame end end frame down clicking the button start star...
function createButton(UID, assetQueue, cm, position, frameSize, animBounds, fn) { // TODO: Replace this animation stuff with animation class var buttonImg = assetQueue.getResult(UID); var buttonSheet = new createjs.SpriteSheet({ images: [buttonImg], frames: {width: frameSize.width, height:...
[ "makeButton() {\n //Align Sprite\n rectMode(CENTER);\n //Create Button Sprite At Position\n this.sprite = createSprite(\n width / 2,\n (height - this.size) / this.max * (this.y + 1),\n this.size * 3,\n this.size * 1.5);\n //Bind Sprite o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return metadata for a specific asset assocated with token
async function getIonAssetMetadata(accessToken, assetId) { Object(_utils_assert__WEBPACK_IMPORTED_MODULE_0__["default"])(accessToken, assetId); const url = `${CESIUM_ION_URL}/${assetId}/endpoint`; const headers = {Authorization: `Bearer ${accessToken}`}; const response = await fetch(url, {headers}); if (!resp...
[ "async getMetaData(token){\n\t\tlet toRet;\n\t\tawait window.ConnectClass.getCardMeta(token).then((metaData) => {\n\t\t\ttoRet = {\"price\": window.web3.utils.fromWei(metaData.price), \"cardId\" : window.web3.utils.toUtf8(metaData.cardId)};\n\t\t});\n\t\treturn toRet;\n\t}", "async fetchMetadata (_collectionId, _...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the process event handlers, which could allow a worker to hold open the process
unbindProcessSignals() { process.removeListener('SIGINT', this._signalHandlers.SIGINT); process.removeListener('SIGTERM', this._signalHandlers.SIGTERM); }
[ "_deregisterProcessSignalHandlers() {\n HANDLED_PROCESS_SIGNAL_EVENTS.forEach(signal => {\n process.listeners(signal).map(handler => process.off(signal, handler));\n });\n }", "unsubscribeFromProcessSignals() {\n if (!this.shutdownCleanupRef) {\n return;\n }\n this.acti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Section Caption Props Section Text Props
get sectionText() { return this._sectionText.elements; }
[ "function SectionTitle(props) {\n const classes = props.classes;\n\n return (\n <Typography\n variant=\"subheading\"\n align=\"center\"\n className={classes.title}\n >\n {props.title.toUpperCase()}\n </Typography>\n );\n}", "renderCaptions() {\r\n return ((this.captionTitle ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Obtiene los cupones por industria
function getCuponesPorIndustria(idIndustria){ }
[ "function irComputadores() {\n // Eliminar la clase Activa de los enlaces y atajos\n eliminarClaseActivaEnlances(enlaces, 'activo');\n eliminarClaseActivaEnlances(atajosIcons, 'activo-i');\n // Añadimos la clase activa de la seccion de Coputadores en los enlaces y atajos\n añadirClaseActivoEnlaces(en...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create guards for a variable declaration statement.
function createVariableGuards(node) { var genericTypes = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1]; var guards = []; node.declarations.forEach(function (declaration) { if (declaration.id.typeAnnotation) { guards.push(createVariableGuard(declaration.id, extractAnn...
[ "function createVariableGuards (node : Object, genericTypes: Array = []) : Array<Object> {\n let guards = []\n node.declarations.forEach(declaration => {\n if (declaration.id.typeAnnotation) {\n guards.push(createVariableGuard(declaration.id, extractAnnotationTypes(declaration.id.typeAnnotation), ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create client according to type.
createClient() { switch (this.config.type) { case 'azureBlob': return new __1.AzureBlobClient(this.config); default: throw new Error(`NotImplemented`); } }
[ "createClient(type, json) {\n return Client.create(this.companyId, this.id, type, json)\n }", "static build(type, config, bot) {\n return __awaiter(this, void 0, void 0, function* () {\n // Initialize the object.\n let client;\n // Depending on the requested type, we bu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize defaults for the generator. Adds middleware for renaming dest files and parsing frontmatter, and an engine for rendering ERBstyle templates (like lodash/underscore templates: ``) This is wrapped in a function so we can export it on the `.init` property in case you need to call it directly in your generator. ...
function init(app, config, options) { app.use(utils.conflicts()); // merge `config` object onto options if (!config.isApp) { app.option(config); } var defaults = { engine: '*', dest: app.cwd, collection: 'templates' }; var opts = utils.extend(defaults, app.options); app.use(utils.defaults); // en...
[ "function setupDefaultOptions(options) {\r\n\tif(!options)\r\n\t\toptions = {};\r\n\tif(!options.extensions)\r\n\t\toptions.extensions = [\"\", \".js\"];\r\n\tif(!options.loaders)\r\n\t\toptions.loaders = [];\r\n\tif(!options.postfixes)\r\n\t\toptions.postfixes = [\"\"];\r\n\tif(!options.loaderExtensions)\r\n\t\top...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns true if filename ends with '.zip'
function isZip(filename) { // last 4 characters in filename let ss = filename.slice(filename.length-4, filename.length); return ss === '.zip'; }
[ "function isZipFile(file) {\n\treturn file.name.endsWith(\".zip\") || file.type === 'application/zip';\n}", "function checkIfZip(name) {\n var ok=false;\n try {\n var regexp=/^.*\\.([^\\.]*)$/m;\n var x=name.match(regexp);\n var ext=x[1].toLowerCase();\n ok = ext==\"zip\";\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method changes the Threshold button (% > abs > % ...)
function changeBtnThresholType() { $('#btn-threshold-type').off().on('click', function() { if($(this).val() === 'percentage') { $(this).val("absolute"); $(this).text("abs") } else { $(this).val("percentage"); $(this).text("%") } }); }
[ "function setThresholdBar() {\n var slider = document.getElementById(\"myRange\");\n var output = document.getElementById(\"demo\");\n output.innerHTML = slider.value;\n drawThresholdLine();\n\n slider.oninput = function() {\n output.innerHTML = this.value;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find NPCs by ID
function npcById (id) { for (var i = 0; i < npcs.length; i++) { if (npcs[i].id === id) { return npcs[i]; } } return undefined; }
[ "function findplayerbyid (id) {\n\tfor (var i = 0; i < enemies.length; i++) {\n\t\tif (enemies[i].player.name == id) {\n\t\t\treturn enemies[i]; \n\t\t}\n\t}\n}", "function npcInRoom (id) {\n var roomNPCs = [];\n for (var i = 0; i < npcs.length; i++) {\n if (npcs[i].roomid === id) {\n roomNPCs.push(npcs...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert func to PackedFunc
toPackedFunc(func) { if (this.isPackedFunc(func)) return func; return this.createPackedFuncFromCFunc(this.wrapJSFuncAsPackedCFunc(func)); }
[ "toPackedFunc(func) {\n\t if (this.isPackedFunc(func))\n\t return func;\n\t return this.createPackedFuncFromCFunc(this.wrapJSFuncAsPackedCFunc(func));\n\t }", "isPackedFunc(func) {\n\t // eslint-disable-next-line no-prototype-builtins\n\t return typeof func == \"function\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Connect the voice connection.
connect() { if (this.status !== Constants.VoiceStatus.RECONNECTING) { if (this.sockets.ws) throw new Error('There is already an existing WebSocket connection.'); if (this.sockets.udp) throw new Error('There is already an existing UDP connection.'); } if (this.sockets.ws) this.sockets.ws.shutdow...
[ "connect() {\n this.emit('debug', `Connect triggered`);\n if (this.status !== VoiceStatus.RECONNECTING) {\n if (this.sockets.ws) throw new Error('WS_CONNECTION_EXISTS');\n if (this.sockets.udp) throw new Error('UDP_CONNECTION_EXISTS');\n }\n\n if (this.sockets.ws) this.sockets.ws.shutdown();\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
initialization that runs on popup startup defers session validation to async while popup loads to give general case user quicker startup
function popupInit() { popupLoadPrefs(function () { loadData(function (data) { if (data === "No Data") { console.log("No data to display."); } else { buildPopup(data); } popupHookListeners(); popupValidateSession(data); }); }); return; }
[ "function popupInit() {\n\tpopupLoadPrefs(function () {\n\t\tloadData(function (data) {\n\n\t\t\tif (data === \"No Data\") {\n\t\t\t\tconsole.log(\"No data to display.\");\n\n\t\t\t} else {\n\t\t\t\tbuildPopup(data);\n\t\t\t}\n\t\t\thookListeners();\n\t\t\tvalidateSession(data);\n\t\t});\n\t});\n\t\n\treturn;\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that get building list by company and user
function getBuildingListByUserAndCompany(uid, data) { return new Promise((resolve, reject) => { adminWebModel.getBuildingListByUserAndCompany(data).then((result) => { if (result) { let token = jwt.sign({ uid: uid }, key.JWT_SECRET_KEY, { expiresIn: timer.TOKEN_EXPIRATION ...
[ "function getBuildingListByCompany(req, res) {\n let userId = req.decoded.uid\n let data = req.body\n adminService.getBuildingListByCompany(userId, data).then((result) => {\n res.json(result)\n }).catch((err) => {\n res.json(err)\n })\n}", "function getBuildingListByCompany(uid, data) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove the last data line
popDataLine() { this.linesData.pop(); }
[ "popDataLine() {\n this.linesData.pop();\n }", "function deleteLastLine() {\n $('.line:last').remove();\n }", "function removeLastPolyLine() {\n currentPolyLines.pop();\n}", "function reset() {\n var line = false;\n while (line = lines.pop()) {\n l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the PKCS1 RSA encryption of "text" as an evenlength hex string
function RSAEncrypt(text) { var m = pkcs1pad2(text, (this.n.bitLength() + 7) >> 3); if (m == null) return null; var c = this._doPublic(m); if (c == null) return null; var h = c.toString(16); if ((h.length & 1) == 0) return h; else return "0" + h; }
[ "function RSAEncrypt(text) {\n var m=pkcs1pad2(text,(this.n.bitLength()+7)>>3);\n if(m==null) return null;\n var c=this.doPublic(m);\n if(c==null) return null;\n var h=c.toString(16);\n if((h.length&1)==0) return h;else return \"0\"+h;\n }", "encrypt(text) {\n\t\tvar m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO get Assets for trust in orderBook
getTrustedAssets() { let image = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQIAAAECCAYAAAAVT9lQAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAACKFJREFUeNrs3T1yG8kZBuBe2YEz0pkzwJkzMHRG+ATUDaAbcG8A3YBHAJ3ZEbjZOiJ0AlAnIPYEoDJn9HRxYEEUqSWJv+n+nqeqi9JulQqYnnnZ/U1PT0oAAAAAAAAAAAAAAAAAAAAAAI/85BBUo9e0ftNOmnbc/r...
[ "get Assets() {}", "function getAssets() { return _assets; }", "getOwnAssets() {\n const ownImages = {}\n for (const version of this._options.versions) {\n ownImages[version] = this._assets.hasOwnProperty(version)\n }\n return ownImages\n }", "async getAssets() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ObjectTypeExtension : extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition extend type Name ImplementsInterfaces? Directives[Const] extend type Name ImplementsInterfaces
function parseObjectTypeExtension(lexer) { var start = lexer.token; expectKeyword(lexer, 'extend'); expectKeyword(lexer, 'type'); var name = parseName(lexer); var interfaces = parseImplementsInterfaces(lexer); var directives = parseDirectives(lexer, true); var fields = parseFieldsDefinition(lexer); if ...
[ "parseObjectTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('type');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields = this.parseFie...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[Clear all data structures used internally for labels]
clearAllLabelData() { // clear lines for (let i = this._.lineGroup.children.length - 1; i >= 0; --i) { const line = this._.lineGroup.children[i]; this._.lineGroup.remove(line); } // clear sprites for (let i = this._.spriteGroup.children.length - 1; i >= 0; --i) { const sprite = thi...
[ "function clear() {\r\n\tif (labelArray.length) {\r\n\t\tlabelArray.splice(0, labelArray.length);\r\n\t\tlabelMem.splice(0, labelMem.length);\t\t\r\n\t}\r\n}", "function clearAllLabels() {\r\n knn.clearAllLabels();\r\n updateCounts();\r\n}", "function clearAllLabels() {\n // knn.clearAllLabels();\n // updat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
trim space and comma uu.split.comma split commas
function uusplitcomma(source) { // @param String: ",,, ,,A,,,B,C,, " // @return Array: ["A", "B", "C"] return source.replace(uusplit._MANY_COMMAS, ","). replace(uusplit._TRIM_SPACE_AND_COMMAS, "").split(","); }
[ "function commaSplit(val) {\n return val.split(/,\\s*/);\n}", "function mySplit(textToSplit) {\n while (textToSplit.indexOf(\", \") !== -1)\n textToSplit = textToSplit.replace(\", \", \",\");\n while (textToSplit.indexOf(\" \") !== -1)\n textToSplit = textToSplit.rep...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a decompressed stream, given an encoding.
function decompressed(req, encoding) { switch (encoding) { case 'identity': return req; case 'deflate': return req.pipe(_zlib2.default.createInflate()); case 'gzip': return req.pipe(_zlib2.default.createGunzip()); } throw (0, _httpErrors2.default)(415, 'Unsupported content-encoding "...
[ "function decompressed(req, encoding) {\n switch (encoding) {\n case 'identity':\n return Either_1.right(req);\n case 'deflate':\n return Either_1.right(req.pipe(zlib_1.default.createInflate()));\n case 'gzip':\n return Either_1.right(req.pipe(zlib_1.default....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Let's do a harder exercise. In this code, your function receives a parameter data. You must modify the code below based on the following rules: Your function must always return a promise If data is not a number, return a promise rejected instantly and give the data "error" (in a string) If data is an odd number, return...
function job(data) { return new Promise((resolve, reject) => { if (isNaN(data)) { reject("error"); } if (data % 2 === 0) { setTimeout(() => { reject("even"); }, 2000); } else { setTimeout(() => { resolve("odd"); }, 1000); } }); }
[ "function evenOddTest (num) {\n\treturn new Promise(\n\t\t(resolve, reject) => {\n\t\t\t\n\t\t\tif( num % 2 == 0 )\n\t\t\t\treturn resolve(num * num);\n\t\t\telse\n\t\t\t\treturn reject('Odd number input');\n\t\t}\n\t);\n}", "function testNumber (number){\r\n \r\n return new Promise ((resolve,reject) =>{\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to extract magnetic declination
function getMagDec() { if (document.solarCalc.trueMag[1].checked) { magDec=document.solarCalc.mDec.value; if (document.solarCalc.decEastWest[1].checked) { sign=-1; } else { sign=1; } magDec=magDec*sign; } else { magDec=0*1; } return magDec; }
[ "static getMagvar(lat, lon) {\n return GeoMath.magneticModel.declination(0, lat, lon, 2020);\n }", "magnetometer() {\n this.setup();\n\n //\n // taken from https://github.com/pimoroni/enviro-phat/pull/31/commits/78b1058e230c88cc5969afa210bb5b97f7aa3f82\n // as there is no real ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an FS SDK client for the given environment.
function getFSClient(environment){ var config = { client_id: 'a02j00000098ve6AAA', redirect_uri: document.location.origin + '/', environment: environment }, token = Cookies.get(environment + '-token'); if(token){ config.access_token = token; } return new FamilySearch(config); }
[ "async forEnvironment(environment, mode) {\n const env = await this.resolveEnvironment(environment);\n const creds = await this.obtainCredentials(env.account, mode);\n return new sdk_1.SDK(creds, env.region, this.sdkOptions);\n }", "createClient( config = defaultConfig ) {\n const optio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recursively convert the BN tree to HTML BN = BookmarkNode to "print" to HTML Returns: a String
function BN_toHTML (BN) { let html; let type = BN.type; if (type == "folder") { html = "<DL><DT>"+BN.title+"</DT>"; let children = BN.children; if (children != undefined) { let len = children.length; for (let i=0 ; i<len ;i++) { html += "<DD>"+BN_toHTML(children[i])+"</DD>"; } } html +...
[ "function BN_toPlain (BN, indent = \"\") {\r\n let plain;\r\n let type = BN.type;\r\n if (type == \"folder\") {\r\n\tplain = indent+BN.title;\r\n\tlet children = BN.children;\r\n\tif (children != undefined) {\r\n\t let len = children.length;\r\n\t for (let i=0 ; i<len ;i++) {\r\n\t\tplain += \"\\n\"+BN_toPlain...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function will grab a random animal and a random breakfast item and make a meal. it will then tweet out that meal
function breakFast(){ var test = animals(); var breakfast = bf[Math.floor(Math.random()*bf.length)]; var bfjuice = animals(); var temp = m.drinkTemp[Math.floor(Math.random()*m.drinkTemp.length)]; params = { status: 'today for breakfast @realdonaldtrump is having ' + test + '-dick ' + breakfast + ' with a ...
[ "function breakFast(){ \n var test = animals();\n var breakfast = bf[Math.floor(Math.random()*bf.length)];\n const params = {\n status: 'today for breakfast @realdonaldtrump is having ' + test + '-dick ' + breakfast \n }\n whChef.post('statuses/update', params);\n}", "function makeMeal() {\n const numIte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show the agent typing
function agentTyping(data) { logger.debug("agentTyping", data); if (data.agentTyping) { $(jqe(lpChatID_lpChatAgentType)).css("visibility","visible"); } else { $(jqe(lpChatID_lpChatAgentType)).css("visibility", "hidden"); } }
[ "function showTypingStatus() {\r\n\r\n\t//dnp test\r\n\t//const user_data = $('#user_data')[0];\r\n\t// const un = getUserData('loggedusername');\r\n\t// const ui = getUserData('loggeduserid');\r\n\t// const tu = getUserData('touserid');\r\n\t// const tn = getUserData('tousername');\r\n\t// setUserData({\r\n\t// \t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provides a synchronizer for an executer lambda that executes a known number of asynchronous tasks. The executor function is in charge of filling in the provided array with nonnull values, and once the array is completely nonnull, the callback function is called. executor Takes in an array that is numAsyncTasks long and...
function synchronize(numAsyncTasks, executor, callback) { const nnAT = numAsyncTasks; const synchronizationArray = new Array(nnAT).map(e => null); for (let i = 0; i < nnAT; i++) synchronizationArray[i] = null; // Pass the reference to the synchronization array to the executor executor(synchronizationArray); /...
[ "function executor(tasks){\n \n if(tasks.length ==0){\n console.log(\"empty task list, can't run executor\");\n return;\n }\n let task = tasks.shift();\n let callback = function(err, data){\n if(err!==null){\n console.log(\"some error, stopping now\", err);\n return; \n }\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assign student data at current indexId to global currentStudent variable
function makeStudent() { currentStudent = studentsObject.sigmanauts[indexId]; }
[ "function setIndividualStudent(student) {\n\t\t\t\t\t\t\tvar data = filterDataByStudent(jsonData, student);\n\t\t\t\t\t\t\t$scope.individualStudent = ((data[0] !== null) && (data[0] !== undefined)) ? data[0]\n\t\t\t\t\t\t\t\t\t: null;\n\t\t\t\t\t\t}", "function setStudentId(student) {\n /* current code...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that adds notifications about issue events to the DOM
function notifications (data) { let status = '' switch (data.action) { case data.action = 'opened': status = 'New Issue' break case data.action = 'edited': status = 'Issue edited' break case data.action = 'created': status = 'New Comment' break case data.actio...
[ "function addNotificationElements() {\n\tconst SPAN = document.createElement(\"span\");\n\tSPAN.className = \"dhqol-notif-ready\";\n\tSPAN.style = \"display:inline-block\";\n\tSPAN.appendChild(document.createElement(\"img\"));\n\tSPAN.children[0].className = \"image-icon-50\";\n\tSPAN.appendChild(document.createEle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used above, for joining possibly empty strings with pluses
function fancyJoin(a,b) { if (a == "") { return b; } else if (b == "") { return a; } else { return a+"+"+b; } }
[ "function joinNotEmpty(items, sep) {\n var str =\"\";\n for (var i= 0; i < items.length; ++i) {\n var item = items[i];\n if (item != null && item != \"\") {\n if (str.length != 0) str+=sep;\n str+=item;\n }\n }\n return str;\n}", "function fancyJoin ( a, b )\n{\n if (a == \"\") { return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
nav always stay center animation
function navAnimtion() { var scrollWidth = $(".fairies-nav").width(); var ulWidth = $(".fairies-nav ul").width(); var liLeft = $(".fairies-nav li.active").position().left; var liWidth = $(".fairies-nav li.active").outerWidth(true); $(".fairies-nav ul").removeAttr('class'); if (liLeft + liWidth <...
[ "function animateNav(){\n\tvar tl = new TimelineMax()\n\t.staggerTo('.project-nav li', .5, {ease:Back.easeIn.config(2.7), y:-25, opacity:0}, .1)\n\t.set('.top-slant', {y:-250})\n\t.set('.bottom-slant', {y:1024});\n\treturn tl;\n}", "function pageTransition(){\n // Problem: css animationen nicht stapelbar (Plug...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pseudo code for what I could not finish function for getting the score on click for the submit button
function getScore(score) { $(".submit").on("click", function(){ //see what was selected $( "input[type=radio]:checked" ).val(); //if something was selected, add one to answered questions if (":checked",...
[ "function submitScore(){\n saveScore();\n hideResult();\n showScoreBoard();\n}", "function userSubmit() {\n\n if ($(\"#userTriviaGuess\").val() === \"\") {\n $(\"#userTriviaGuess\").val(0);\n }\n\n let tomatoScoreUnfiletered = scoreArray[counter];\n let tomatoScoreFiltere...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Represents a grid of fillin bubbles. json_init: JSON // initialization values that come from a JSON file update_init: JSON // initialization values that come from updating the field
function BubbleField(json_init, update_init) { GridField.call(this, json_init, update_init); /* Set all bubble attributes. */ this.field_type = 'bubble'; this.grid_class = 'bubble_div'; this.data_uri = "bubbles"; this.cf_advanced = {flip_training_data : false}; this.cf_map = {empty : false}; if (json_init)...
[ "function GridField(json_init, update_init, field_group) {\n\tthis.$grid_div = $('<div/>');\n\tthis.$grid_div.data(\"obj\", this);\n\t\n\tif (json_init) {\n\t\tthis.order = json_init.order;\n\t\tthis.num_rows = json_init.num_rows;\n\t\tthis.num_cols = json_init.num_cols;\n\t\tthis.margin_top = json_init.margin_top;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
B. For debugging: Output array contents to alert box
function showArray(array) { var text = ""; for (j = 0; j < array.length; j++) { text += "\n" + array[j]; } return alert(text); }
[ "function showArray(output) {\n var text = \"\";\n for (j = 0; j < output.length; j++) {\n text += \"\\n\" + output[j];\n }\n return alert(text);\n}", "function debugArray(array) {\r\n\tvar txt = '';\r\n\tfor(i=0 ; i<array.length ; i++) {\r\n\t\tfor(j=0 ; j<array[i].length ; j++) {\r\n\t\t\tif(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populate the Title and Message for the changeConfModal / Requires: / type: code representing the type of change to be confirmed / elem: clicked element originating the popChangeConfModal() call eslintdisablenextline nounusedvars
function popChangeConfModal(type, elem) { // Set modal title let title = 'Confirmation Required'; // Set modal message based on type let message; switch (type) { case 'sa': // Single answer message = 'If you disable multiple choice, all existing multiple ' + 'choice options for ...
[ "function ModConfirmOpen(mode) {\n console.log(\" ----- ModConfirmOpen ----\")\n console.log(\"mode\", mode)\n //modes are \"copy_scores\" and \"undo_submitted\" (not in use)\n // only used to copy scores to grade page\n\n mod_dict = {mode: mode, is_test: true, show_modal: fals...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Highlight leave game button
function highlightLeaveButton() { $('.game button[name="leave_game"]').effect('highlight', {}, 1000); window.setTimeout(highlightLeaveButton, 3000); }
[ "function onLeaveGameBtClick(event)\n{\n\t// Join the lobby\n\tjoinLobbyRoom();\n\n\t// Remove Game Popup\n\tremoveGamePopUp();\n}", "function onLeaveGameBtClick(event)\n{\n\t// Join the lobby\n\tjoinLobbyRoom();\n}", "function addLeaveButton() {\n\n // use template for team button\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A statistic can contain a label to help provide context for the presented value.
function StatisticLabel(props) { var children = props.children, className = props.className, label = props.label; var classes = __WEBPACK_IMPORTED_MODULE_2_classnames___default()('label', className); var rest = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__lib__["b" /* getUnhandledProps */])(Sta...
[ "function formatDataLabel(attr, val) {\n switch (attr) {\n case \"population\":\n return (val / 1000).toLocaleString(\"en-US\") + \"K\";\n case \"illiteracy\":\n default:\n return val + \"%\";\n }\n}", "function StatisticLabel(props) {\n var children = props.children,\n className = prop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes an array of names and groups them into arrays of length size
function group(names, size){ const output = []; while(names.length > 0){ const group = names.splice(0, size); output.push(group); } return output; }
[ "function breakIntoChunks(names) {\n var newArray = [];\n\n for (var i = 0; i < names.length; i += 4) {\n newArray.push(names.slice(i, i + 4))\n }\n return newArray\n}", "function group(names,n){\n var extra = names.length % n;\n var minSize = (names.length - extra)/n;\n\n //console.lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Try to add a :+1: to the PR. May be on code diff, so trigger the comment tab first, then post the comment.
function plusOne() { // Could be on one of the non-comment tabs, so get on to the first tab first $('.js-pull-request-tab')[0].click(); // Populate the comment $('textarea').val(':+1:'); // Submit the form $('.js-new-comment-form').submit(); }
[ "_onAddCommentClicked() {\n const comment = this.model.createGeneralComment(\n undefined,\n RB.UserSession.instance.get('commentsOpenAnIssue'));\n\n this._generalCommentsCollection.add(comment);\n this._bodyBottomView.$el.show();\n this._commentViews[this._commentVi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the first ARIA label defined by the collective.
function getCollectiveAriaLabel(collective) { var labels = collective.elements.map(function (element) { return element.getAttribute('aria-label'); }); // Would prefer to use Array.prototype.find here, but IE 11 doesn't have it. var nonNullLabels = labels.filter(function (label) { return label != null; ...
[ "function getCollectiveAriaLabel(collective) {\n let labels = collective.elements.map(element => element.getAttribute('aria-label'));\n // Would prefer to use Array.prototype.find here, but IE 11 doesn't have it.\n let nonNullLabels = labels.filter(label => label != null);\n return nonNullLabels[0];\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes in a percent and sets it to a presetIndex
function getPresetIndex(percent) { return Math.round(percent/100 * (scope.presetValues.length - 1)); }
[ "function percentFromPresetIndex(index) {\n return index / (scope.presetValues.length - 1) * 100;\n }", "function usePresetPercent(percent) {\n return Math.round(percent / 100 * (scope.presetValues.length-1)) / (s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
to be called when content.size and display.size change. the following need to be done: we decide if we need sliders based on new content.size and current frame.size update sliders' sizes. sliders are supposed to fit into the frame. update max sliders' max values. max values represent on content.size update sliders' thu...
function onChange() { // decide if we need sliders based on new content size. default is they are hidden // we update both h and v sliders even when only content.width is changed as it's possible that both sliders // will hide/show based on the change in content.width alone hslider.hide = true; vslider.hide...
[ "function setSize() {\n $('.video__slider').css({\n 'height': (getSize() * 0.58) - 10\n });\n\n $('.video__slider__list').css({\n 'width': getSize() * slider.length,\n 'background' : 'black'\n });\n\n $('.video__slider__item').css({\n 'w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for setting text in InstructionLabel and then adjusting scroll to make sure text is visible
function setInstructions(instructions) { $("#Instructions").html(instructions); $("#Instructions").adjustScroll(); }
[ "updateLabelText() { }", "function MessagesBtnClick() {\n frmScrollSPA.lblScroll1.text = \"Solutions for your customers, employees, vendors and partners.Configurable, Extensible with Universal Integration.Stunning User Experience.Support for All Technologies and Devices.\";\n}", "function newsFeedBtnClick()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List names of installed Loggers as string
static list() { var i, ix, len, lgr, msg, ref; msg = ""; ref = this._loggers; for (ix = i = 0, len = ref.length; i < len; ix = ++i) { lgr = ref[ix]; if (ix > 0) { msg += ", "; } msg += lgr.modName; } return msg; }
[ "function list () {\n\tprettyLog('log', 'INSTALLED COMPONENTS: ' + installed_components.sort().join(', '));\n}", "function defaultLoggers() {\n return [\n {\n name: /.*/,\n level: 'error',\n target: defaultImplementation(),\n }\n ];\n}", "function getPluginSt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete a game from the game array
static deleteGame(id) { delete activeGames[id]; }
[ "function removeGame(id) {\n listGames.splice(id, 1);\n console.log(\"Destroying game number \"+ id);\n}", "handleOnClick_btRemoveGame(e) {\n let { selectedGame, games } = store.getState();\n\n for (let i = 0; i < games.length; i++)\n if (games[i] === selectedGame) {\n games.splice(i, 1);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates new frame aligned to bottom of other
bottomOf(other) { return new Frame(this.origin.x, other.origin.y + other.size.height, this.size.width, this.size.height); }
[ "bottomOf(other) {\n return new Frame(this.origin.x, other.origin.y + other.size.height, this.size.width, this.size.height);\n }", "topOf(other) {\n return new Frame(this.origin.x, other.origin.y - this.size.height, this.size.width, this.size.height);\n }", "topOf(other) {\n return new Frame(this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove all subs objects from the subscriptions map (after a disconnect for example)
function clearSubs() { var subsDiv = document.getElementById("subscriptions"); for (var topic in subscriptions) { if (subscriptions.hasOwnProperty(topic)) { // remove row... subsDiv.removeChild(subscriptions[topic].div); // remove from data structure delete subscriptions[topic]; subCount--; } } }
[ "removeAllSubscriptions() {\n for (const key in this.subscriptions) {\n if (this.subscriptions[key]) {\n this.subscriptions[key].unsubscribe();\n delete this.subscriptions[key];\n }\n }\n }", "clearPersistedSubsList() {\n for (let [k, v] ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cut edges along crossings/tjunctions
function cutEdges(floatPoints, edges, crossings, junctions, useColor) { //Convert crossings into tjunctions by constructing rational points var ratPoints = [] for(var i=0; i<crossings.length; ++i) { var crossing = crossings[i] var e = crossing[0] var f = crossing[1] var ee = edges[e] ...
[ "deleteCutEdges() {\n this._computeNextCWEdges();\n this._findLabeledEdgeRings();\n\n // Cut-edges (bridges) are edges where both edges have the same label\n this.edges.forEach(edge => {\n if (edge.label === edge.symetric.label) {\n this.removeEdge(edge.symetric);\n this.removeEdge(ed...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
delete all of the listings created by this user
async deleteMany(req, res) { const { userId } = req.query; const deletedListings = await Listing.remove({ publisher_id: { $in: [userId] }, }); res.send(deletedListings); }
[ "function deleteAllAnimeFromUserList() {\n db.transaction((tx) => {\n tx.executeSql(\"delete from userlist\", [], () => {\n console.log(\"useDB: Deleted all anime from userlist in database!\");\n });\n });\n dispatch(clearUserData());\n }", "function deleteFromListing() {\n var $...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
xTable, Copyright 2007 Michael Foster (CrossBrowser.com) Part of X, a CrossBrowser Javascript Library, Distributed under the terms of the GNU LGPL
function xTable(sTableId, sRoot, sCC, sFR, sFRI, sRCell, sFC, sFCI, sCCell, sTC, sCellT) { var i, ot, cc=null, fcw, frh, root, fr, fri, fc, fci, tc; var e, t, tr, a, alen, tmr=null; ot = xGetElementById(sTableId); // original table if (!ot || !document.createElement || !document.appendChild || !ot.delete...
[ "function renderTable(extElement) {\n\n var createClickHandler =\n function (rowIndex) {\n return function () {\n extElement.Data.SelectRow(rowIndex);\n };\n };\n\n // Data.SelectValuesInColumn(columnIdx, values, toggle, isFinal)\n var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check the merge request can be submitted
checkAvailability() { if(!this.sourceBranch || !this.toBranch) { this.title = ''; this.available = false; return; } $.getJSON(app.getUri('h-gitter-repo-merge-request-availability', { repoId : this.repoId, ...
[ "async function checkMergeable() {\n\tif (github.pr.mergeable_state === 'dirty') {\n\t\tlabelsToAdd.add(Label.MERGE_CONFLICTS);\n\t} else {\n\t\t// assume it has no conflicts\n\t\tlabelsToRemove.add(Label.MERGE_CONFLICTS);\n\t}\n}", "async _checkMergePreconditions() {\n this._log(\"checking merge precondit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Is this Interval entirely covered by the union of the ranges? The ranges parameter must be sorted by range.start
isCoveredBy(ranges: Interval[]): boolean { var remaining = this.clone(); for (var i = 0; i < ranges.length; i++) { var r = ranges[i]; if (i && r.start < ranges[i - 1].start) { throw 'isCoveredBy must be called with sorted ranges'; } if (r.start > remaining.start) { return...
[ "function checkOverlappingRange(range)\r\n{\r\n range.isTested = true; // mark this interval\r\n \r\n var sortedIntervals = []; // sorted by start point\r\n\r\n disjointIntervals.forEach(function(interval,id) {\r\n sortedIntervals.push(interval);\r\n });\r\n\r\n sortedIntervals.push(range);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Optionally confine search to map extent
function setSearchExtent (){ if (dom.byId('chkExtent').checked === 1) { geocoder.activeGeocoder.searchExtent = map.extent; } else { geocoder.activeGeocoder.searchExtent = null; } }
[ "function centersearchfeature(xmax, xmin, ymax, ymin)\n{ \nmap.zoomToExtent(new OpenLayers.Bounds(xmin, ymin, xmax, ymax).transform(map.displayProjection, map.projection));\n}", "function setSearchExtent (){\n if (dom.byId('chkExtent').checked === 1) {\n geocoder.activeGeocoder.searchExtent = ap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calcular CHI teniendo como entrada la tabla_de_contingencia (frecuencias observadas) y usandola para genarar la tabla de frencuencias espedas
function calcular_chi2_calculado(tabla_de_contingencia) { let frecuencias_esperadas = generar_frecuencias_esperadas(tabla_de_contingencia); let sumatoria = 0; for (let i = 0; i < tabla_de_contingencia.length; i++) { // sumatoria para chi calculado usando la formula de sumatoria for (let j = 0; j < t...
[ "function calcular_chi2_calculado(tabla_de_datos) {\n let tabla_de_contingencia = generar_tabla_de_contingencia(tabla_de_datos);\n let frecuencias_esperadas = generar_frecuencias_esperadas(tabla_de_datos);\n let sumatoria = 0;\n for (let i = 0; i < tabla_de_contingencia.length; i++) { // sumatoria para ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update the appearance of the reset button depending on whether the graph has been filtered
function updateReset() { d3.select("div.reset") .style("opacity", function() { if (filtered) { return 1; } else { return 0.4; } }) .style("width", function() { if (filtered...
[ "function reset(){\n setInitialCondition(compute,renderer);\n}", "function filterReset() {\n for(const btn of filterBtns) {\n btn.classList.add('active');\n }\n conditionsToShow = allConditions.slice(); // reset conditionToShow\n const filter = ['match', ['get', 'condition'], conditionsToShow, true, fal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
restoreRange restore lately range
restoreRange() { if (this.lastRange) { this.lastRange.select(); this.focus(); } }
[ "function restoreRange(editor) {\n if (editor.range) {\n if (ie)\n editor.range[0].select();\n else if (iege11)\n getSelection(editor).addRange(editor.range[0]);\n }\n }", "function restoreRange(serialized) {\n var range = document.createRange();\n range.setStart(serialized.st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the set of currently tracked path refs of the editor.
pathRefs(editor) { var refs = PATH_REFS.get(editor); if (!refs) { refs = new Set(); PATH_REFS.set(editor, refs); } return refs; }
[ "pathRefs(editor) {\n var refs = PATH_REFS.get(editor);\n if (!refs) {\n refs = /* @__PURE__ */ new Set();\n PATH_REFS.set(editor, refs);\n }\n return refs;\n }", "references() {\n const { path, refs } = this.referenceWalk(this);\n if (path !== undefined) {\n refs.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: PredictionLink Description: The PredictionLink class is used to estimate the rating that will be given to another song (or category) based on an attribute of another song (or category)
function PredictionLink(passedVal1, passedVal2){ //alert("constructing predictionLink\r\n"); /* public function */ this.initializeDecreasing = initializeDecreasing; this.initializeIncreasing = initializeIncreasing; this.update = update; this.guess = guess; //private variables var inputData = passedVal1...
[ "function PredPrediction(pred, alt) {\n this.alt = alt;\n this.pred = pred;\n return this;\n}", "function PredPrediction(pred, alt) {\n\tthis.alt = alt;\n\tthis.pred = pred;\n\treturn this;\n}", "function PredPrediction(pred, alt) {\r\n this.alt = alt;\r\n this.pred = pred;\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
picture API phonegap, see more at
function getPicture() { navigator.camera.getPicture(getPictureSuccess, getPictureError, { resQual: 50, destinationType: Camera.DestinationType.FILE_URI, correctOrientation: true }) }
[ "function pictureRetrieve(device){\r\n\tvar myJSONP = new Request.JSONP({\r\n \turl: 'http://www.ifixit.com/api/0.1/device/' + device.device,\r\n \tcallbackKey: 'jsonp',\r\n \tonComplete: function(data){\r\n \t // the request was completed.\r\n \t //Check if image exists, if not placeholder\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recursively expand segment groups for all the child outlets
expandChildren(ngModule, routes, segmentGroup) { // Expand outlets one at a time, starting with the primary outlet. We need to do it this way // because an absolute redirect from the primary outlet takes precedence. const childOutlets = []; for (const child of Object.keys(segmentGroup.ch...
[ "expandChildren(injector, routes, segmentGroup) {\n // Expand outlets one at a time, starting with the primary outlet. We need to do it this way\n // because an absolute redirect from the primary outlet takes precedence.\n const childOutlets = [];\n for (const child of Object.keys(segmentGroup.children)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
endregion region Relations Initializes model relations. Called from store when adding a record.
initRelations() { const me = this, relations = me.constructor.relations; if (!relations) return; // TODO: feels strange to have to look at the store for relation config but didn't figure out anything better. // TODO: because other option would be to store it on each model instance, not better......
[ "initRelations() {\n const me = this,\n relations = me.constructor.relations;\n if (!relations) return; // TODO: feels strange to have to look at the store for relation config but didn't figure out anything better.\n // TODO: because other option would be to store it on each model instance, not be...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Agrega orden por columna y tipo de orden
function agregarOrden(columna, tipo) { return ' ORDER BY p.' + columna + ' ' + tipo; }
[ "function ConverteValorColunas(data, type, row)\n {\n //console.log(data);\n //console.log('type: ' + type);\n //console.log(typeof data);\n\n if (typeof data !== 'string') {\n if (typeof data === 'boolean')\n return (data) ? 'Ativo' : 'Inativo';\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if this collection is accessed over a network connection. readonly attribute boolean isRemote;
get isRemote() { //exchWebService.commonAbFunctions.logInfo("exchangeAbFolderDirectory: isRemote\n"); return true; }
[ "_isRemoteCollection() {\n // XXX see #MeteorServerNull\n return this._connection && this._connection !== Meteor.server;\n }", "_isRemoteCollection() {\n // XXX see #MeteorServerNull\n return this._connection && this._connection !== Mete...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to properly format output of a object property or array key takes key, value, and level of nesting
function genPropOutput( key, val, level ){ // set level to 0 if not found level = level || 0; // indent 4 spaces per level of nesting for( var i = 0; i < level; i++ ){ cOutput += ' '; } // check value type, only accept strings, numbers, objects and arrays switch( typeof val ){ // if its ...
[ "function printObjectProperties(val, config, indentation, depth, refs, printer) {\n var result = '';\n var keys = getKeysOfEnumerableProperties(val);\n\n if (keys.length) {\n result += config.spacingOuter;\n var indentationNext = indentation + config.indent;\n\n for (var i = 0; i < keys.leng...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start the timer for a length determined by the difficulty. Easy > 60 second turn. Medium > 30 second turn. Hard > 15 second turn.
function timerStart () { var sec; if (difficulty === 1) { sec = 60; document.getElementById('time').innerHTML = '∞'; } else if (difficulty === 2) { sec = 30; } else { sec = 15; } if (sec <= 30) { timer = setInterval(function () { document.getElementById('time').innerHTML = sec.toSt...
[ "function startChallengeTimer() {\n // Set the global 'challengeRunning' variable state to on\n showPrompt();\n if (timerState === TIMER_STATES.PAUSED) {\n disableStartButton();\n }\n\n timerState = TIMER_STATES.ACTIVE;\n unSelectAllTimerButtons();\n\n // Get the selected time, turn it into a date object\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
EXAMPLE 2 Make a promisebased function for reading properties from window
function readPropertyFromWindow (propertyName) { return new Promise(function (resolve) { workerProof( function (propName, callback) { callback(window[propName]); }, { args: propertyName, multipleCallbacks: false, callback: resolve } ); }) }
[ "read (thing, name) {\n var getValue = function (resolve, reject) {\n \tconst uri = thing.uri + \"/properties/\" + name;\n \t\n \tconst opts = {\n\t\t\t\tmethod: \"GET\",\n\t\t\t\theaders: {\n\t\t\t\t\t'Accept': 'application/json'\n\t\t\t\t}\n\t\t\t};\n\t\t\t\n \tfetch(uri, opts)....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get transaction explorer base url for nonethereum blockchain
static getBlockChainExplorerUrl(coin, hash) { if (OtherCoins[coin] && OtherCoins[coin].explorer) { if (hash) { return OtherCoins[coin].explorer.replace('[[txHash]]', hash); } return OtherCoins[coin].explorer; } return ''; }
[ "function transactionUrl (networkName, txHash) {\n const insightUrl = config.get('insightUrl')\n return `${insightUrl}/tx/${txHash}`\n}", "function getTreeUrl() {\n return url_1.URLExt.join(getBaseUrl(), getOption('treeUrl'));\n }", "getExplorerUrls() {\n let networks = this.getNetworks();\n l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
because of the way the network is created, nodes are created first, and links second, so the lines were on top of the nodes, this just reorders the DOM to put the svg:g on top
function keepNodesOnTop() { $(".nodeStrokeClass").each(function( index ) { var gnode = this.parentNode; gnode.parentNode.appendChild(gnode); }); }
[ "function draw_tree(nodes){\n var graph = svg.append('g').attr('id', 'graph');\n var link = graph.selectAll('.g')\n .data(nodes.descendants().slice(1).reverse())\n .enter().append('g')\n var paths = link.append(\"path\")\n .attr(\"class\", \"link\")\n ....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
input: route and swap indices output: swapped route
function twoOptSwap(route, i, k) { var diff = ((k)-i)/2; //console.log("i: ", i, "\tk: ", k, "\tlenRoute: ", route.length, "\tdiff: ",diff); //make sure i & k values are valid if (diff>(route.length)/2) { console.log("difference between k and i is larger than array size."); return } diff = Math.flo...
[ "function twoOptSwap(route, i, k)\n{\n\tvar diff = ((k)-i)/2;\n\t//console.log(\"i: \", i, \"\\tk: \", k, \"\\tlenRoute: \", route.length, \"\\tdiff: \",diff);\n\t//make sure i & k values are valid\n\tif (diff>(route.length)/2)\n\t{\n\t\tconsole.log(\"difference between k and i is larger than array size.\");\n\t\tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Intercepts tags from markup and handles the way they resolve in react Internal links will update history (so they don't refresh the page) External links open new tabs
function handleClick(e) { if (e.target.nodeName === "A") { e.preventDefault(); console.log("markdown link click") if (e.target.href) { const url = new URL(e.target.href); //if it is an internal link, push to history so page doesnt refresh if (url.hostname.indexOf(".hotter.com") > -1 || u...
[ "function modifyAnchorTags(caller) {\n var tagParts, currentStateLink, isSamePage, pathHashCount;\n if (caller === \"modalPopupCtrl.pageContent\" || ctrl.currentLink === undefined) {\n currentStateLink = [];\n }\n else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LOADING MORE POSTS ON THE FEED/HOME PAGE
function grabFeedPosts() { $.ajax(`/poem/fetchmore/4?page=${$page}`, { type:'GET', error:function(data) { console.log(data.responseText); }, success:function(data) { $poemscontainer.append(data); if($spanmore.text().trim() == $('.poem').length) { $loaderbody.remove(); } els...
[ "function moreFeed()\n\t{\n\t\tpostsToView += 10;\t\n\t\tonRequestBlogs();\n\t}", "function handleLoadMore(){\n if(hasMore && blogs.length ==20){\n setPageNumber(pageNumber+1)\n }\n }", "loadMore(e) {\n e.preventDefault();\n this.loadMoreNum += 10;\n if (this.loadMoreNum <= this.sta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
moveToFront(PixelLayer) Moves a PixelLayer to the front of the canvas
function moveToFront(p){ p.moveToFront(); var uuid = p.uuid(); for(var i = 0; i < _pixelLayers.length; i++){ if(_pixelLayers[i].uuid() === uuid){ _pixelLayers.splice(i,1); _pixelLayers.unshift(p); break; ...
[ "goToFront() {\n // This should only ever be used for sprites // used by compiler\n if (this.renderer) {\n // Let the renderer re-order the sprite based on its knowledge\n // of what layers are present\n this.renderer.setDrawableOrder(this.drawableID, Infinity, StageLayering.SPRITE_LAYER);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
filters mouse events so an event is fired only if the mouse moved. filters out mouse events that occur when mouse is stationary but the elements under the pointer are scrolled.
function installFilteredMouseMove(element) { element.bind("mousemove", function (e) { var lastpos = lastMousePosition; if (lastpos === undefined || lastpos.x !== e.pageX || lastpos.y !== e.pageY) { $(e.target).trigger("mousemove-filtered", e); } }); }
[ "function installFilteredMouseMove(element){element.on(\"mousemove\",function(e){var lastpos=lastMousePosition;(lastpos===undefined||lastpos.x!==e.pageX||lastpos.y!==e.pageY)&&$(e.target).trigger(\"mousemove-filtered\",e)})}", "function installFilteredMouseMove(element){element.on(\"mousemove\",function(e){var la...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the configuration panel from the local storage. The last configuration stored
function get_config_panel(config_name){ if(config_name=="") config_name=getUrlVars()["config_name"]; //console.log(localStorage.gpio_config); if (localStorage.getItem("gpio_config:"+config_name) === null){ create_first_configuration(); config_name="default"; } var rows = localStorage.getItem("gpio_config...
[ "function getConfig() {\n return JSON.parse(localStorage.getItem('bpmConfig'));\n}", "static load() { return JSON.parse(window.localStorage.getItem('settings')) || {}; }", "function getLocalConfig(strKey){\n\treturn window.localStorage.getItem(strKey);\n}", "_read() {\n try {\n if (!localSt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get building by ID
getOne(buildingId, callback) { const query = "SELECT * FROM IntelliDoorDB.dbo.Buildings WHERE buildingId = @buildingId;"; const idParam = { name: 'buildingId', type: TYPES.NVarChar, value: buildingId }; sqlDB.sqlGet(query, idParam, function(error, res...
[ "find(id) {\n return this.buildings.find((i) => i.id === id || i.email === id);\n }", "function getBuildingByName(name) {\n\tfor (i = 0; i < buildings.length; i++) {\n\t\tif (buildings[i].name == name) {\n\t\t\treturn buildings[i];\n\t\t}\n\t}\n\n\t// No building exists with given name\n\treturn null;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PRIVATE Allocates the destination coordenates of the connection at the middle point of the destination port.
function allocateDestination() { this.destinationX = this.destinationPort.x + 3 + this.destinationPort.ne.x; this.destinationY = this.destinationPort.y + 3 + this.destinationPort.ne.y; if (this.originX != null && this.originY != null) { this.allocate(); } }
[ "function allocateOrigin() {\n\t\tthis.originX = this.originPort.x + 3 + this.originPort.ne.x;\n\t\tthis.originY = this.originPort.y + 3 + this.originPort.ne.y;\n\t\tif (this.destinationX != null && this.destinationY != null) {\n\t\t\tthis.allocate();\n\t\t}\n\t}", "function allocateConnection() {\n\t\tif (docume...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the closest element to 'e' that has class "classname"
function closest( e, classname ) { if( classie.has( e, classname ) ) { return e; } return e.parentNode && closest( e.parentNode, classname ); }
[ "function closest( e, classname ) {\n if( classie.has( e, classname ) ) {\n return e;\n }\n return e.parentNode && closest( e.parentNode, classname );\n }", "function closest( e, classname ) {\n\t\tif( classie.has( e, classname ) ) {\n\t\t\treturn e;\n\t\t}\n\t\treturn e.parentNode && closest( e.pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Map through all todos, and replace the text of the todo with the specified id
editTodo(id, updatedText) { this.todos = this.todos.map(todo => todo.id === id ? { id: todo.id, text: updatedText, complete: todo.complete } : todo ); this._changeList(this._currentTab); }
[ "editTodo(id, updatedText) {\n this.todos = this.todos.map(todo =>\n todo.id === id ? { id: todo.id, text: updatedText, complete: todo.complete } : todo\n )\n }", "editTodo(id, updatedText) {\n this.todos = this.todos.map(todo =>\n todo.id === id\n ? { id: todo.id, text:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isEmail(field) Returns true if value contains a correct email address
function isEmail(fld) { if(!fld.value.length || fld.disabled) return true; // blank fields are the domain of requireValue var emailfmt = /(^['_A-Za-z0-9-]+(\.['_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.(([A-Za-z]{2,3})|(aero|coop|info|museum|name))$)|^$/; if(!emailfmt.tes...
[ "function isEmail(field){\r\n\tre = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/; // regular expression that checks for valid email adress notation\r\n\tif(re.test(field.value)) {\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}", "function isEmail(value) {\n if (notEmpty(value)) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end of function processParcel() / validNumberAboveZero() Purpose: verify if the number is valid, is a number, and is greater then zero Parameters: number in input Returns: true if number is valid, false if invalid
function validNumberAboveZero(inputNumber){ inputNumber = inputNumber.replace(/\s+/,""); inputNumber = inputNumber.replace(/\,+/,"."); if(isNaN(parseFloat(+inputNumber))){ return false; } if(parseFloat(+inputNumber)<=0){ return false; } ret...
[ "function isValidParcelNumber(numberStr) {\n\n // If provided numberStr is not representing an integer return false ..\n if (!Number.isInteger(+numberStr)) return false;\n\n // Returns true if numberStr is representing value greater or equal to 0. Otherwise return false.\n return numberStr >= 0;\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find states with only one action, a reduction
function findDefaults(states) { var defaults = {}; states.forEach(function (state, k) { var i = 0; for (var act in state) { if ({}.hasOwnProperty.call(state, act)) i++; } if (i === 1 && state[act][0] === 2) { // only one action in state and it's a reduction defa...
[ "function reduceSingle(reducer, state, action) {\r\n return reducer(state, action);\r\n }", "stateFor(action) {\n let stores = Object.keys(this.stores)\n .filter(key => Store.taskFor(this.stores[key], action))\n\n return stores.reduce((memo, key) => {\n memo[key] = this.get(key)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
options.socket: The Asyngular client socket to use to sync the model state. options.type: The resource type. options.id: The resource id. options.fields: An array of fields names required by this model.
function AGModel(options) { AsyncStreamEmitter.call(this); this.socket = options.socket; this.type = options.type; this.id = options.id; this.fields = options.fields; this.defaultFieldValues = options.defaultFieldValues; this.agFields = {}; this.value = { ...this.defaultFieldValues, id: this.id...
[ "function SCModel(options) {\n Emitter.call(this);\n\n this.socket = options.socket;\n this.type = options.type;\n this.id = options.id;\n this.fields = options.fields;\n this.scFields = {};\n this.value = {\n id: this.id\n };\n\n this._triggerModelError = (err) => {\n // Throw error in different sta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to check if country code match our checklist
function countryMatch(checkList, trackedCountry) { return checkList.indexOf(trackedCountry) > -1; }
[ "function country_check(country){\n\tfor (var i = 0; i < ufo_data.length; i++){\n\t\tif (ufo_data[i].country === country){\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "function checkSameCountry(team1, team2){\n\tvar id1 = teamID[team1];\n\tvar id2 = teamID[team2];\n\n\tif(id1.indexOf(\"NZ\")!=-1 && id2....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
THE MAIN FUNCTION CALL call the sparql endpoint and do the query
function do_sparql_query(resource_iri){ //console.log(resource_iri); //var header_container = document.getElementById("browser_header"); if (resource_iri != "") { //resource = "https://w3id.org/oc"+"/corpus/"+resource_iri; //initialize and get the browser_config_json browser_conf_json = browse...
[ "function sparql_query(endpoint, queryProcessor){\n\tvar querypart = \"query=\" + escape(queryProcessor.query);\n\t// Get our HTTP request object.\n\tvar xmlhttp = getHTTPObject();\n\t//Include POST OR GET\n\txmlhttp.open('POST', endpoint, true); \n\txmlhttp.setRequestHeader('Content-type', 'application/x-www-form-...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns index of first different element in two sorted arrays
function firstDiff(A, B) { for (var i = 0; i < Math.min(A.length, B.length); i++) { if (A[i] !== B[i]) { return i; } } return -1; }
[ "function getIndexOfFirstDifference(a, b, equal) {\n for (var i = 0; i < a.length && i < b.length; i++) {\n if (!equal(a[i], b[i])) {\n return i;\n }\n }\n return undefined;\n}", "function getIndexOfFirstDifference(a, b, equal) {\n for (let i = 0; i < a.length && i < b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }