query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
API calls to enable player account
@action enablePlayer(reason, comment) { const _selectedPlayerDetails = JSON.parse(JSON.stringify(this.selectedPlayerDetails)); const {identity} = _selectedPlayerDetails; const id = this.selectedPlayerID; const obj = { firstName: identity['firstName'], lastName: identity['last...
[ "enableAccounts() {\n\t\tthis._accounts = true;\n\t\tthis.sendStateUpdate();\n\t}", "function enableWallet() {\n const provider = _environment.web3Providers.wallet;\n\n if (!provider) {\n return;\n } // For providers supporting .enable() (EIP 1102 draft).\n\n\n if (typeof provider.enable === 'function') {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to plot sense or aroma data and appropriate color
function plotRadars(sense) { d3.selectAll(".radarStroke") .attr("d", function(d) { return radarLine(extractAvgs(d, sense)); }) // .style("stroke", cfg.radarColor[showOrHide][sense]) .style("stroke", function(d) { return vizStatus[d.hop] ? d3.select(this).style...
[ "setAxesColor(color)\n{\n this.axesColor = color;\n}", "color(data) {\n\t\treturn d3\n\t\t\t.scaleLinear()\n\t\t\t.domain([0, Math.round(data.length / 2), data.length])\n\t\t\t.range(['#BBE4A0', '#52A8AF', '#00305C'])\n\t}", "function colorVisualizations(kind, data) {\n if (kind === \"hue\") {\n col...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wait for the dancing dots to stop.
function waitForStillness() { var element = dancingDotsElement(); // Currently, the dots sometimes stop & start again. We're introducing a // fudge factor here - the dots have to be stopped for a few consecutive // checks before we'll consider them really stopped. let matches = 0; const desiredMatches = 2;...
[ "async endWait() {\n await this.obnizBle.peripheralBindings.stopAdvertisingWait();\n }", "function wait() {\n Utilities.sleep(500);\n}", "function wait() {\n $('.not-sec').fadeOut(900);\n }", "function waitForDJ() {\n\t\"use strict\";\n\t\n\tif (dPressed && jPressed) {\n\t\tclearInterval(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End Static Properties Utilities parses slot values out of request into an `action` for easier access and saves slot values to session attributes
getAction (request, session, slots) { const action = {}; slots.forEach(function (slotKey) { const slot = request.intent.slots[slotKey]; if (slot && slot.value && slot.value !== '?') { action[slotKey] = slot.value; } else { action[slotKey] = session.attributes[slotKey]; } ...
[ "_parseIntentRequest () {\n this.intent = {\n name: this.raw.request.intent.name,\n slots: {}\n }\n\n for (let slot in this.raw.request.intent.slots) {\n this.intent.slots[slot] = this.raw.request.intent.slots[slot].value\n }\n }", "actionRequestQueryString() {\n return {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the video max spatial layer to be sent.
async setMaxSpatialLayer(spatialLayer) { if (this._closed) throw new InvalidStateError('closed'); else if (this._kind !== 'video') throw new UnsupportedError('not a video Producer'); else if (typeof spatialLayer !== 'number') throw new TypeError('invalid spati...
[ "constrainVideoBitrate (maxVideoBitrateKbps) {\n this.constrainVideoBitrateKbps = maxVideoBitrateKbps;\n }", "SetMaxBweBitrate(maxBr, force) {\n\t\t\tV.log('BWE SetMaxBweBitrate:' + maxBr, 'Debug');\n\t\t\tthis._maxBweBitrate = maxBr;\n\t\t\tif (force) {\n\t\t\t\tvar senders = this._peerConnection.getSenders(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compare Position MIT Licensed, John Resig
function _comparePosition(a,b){return a.compareDocumentPosition?a.compareDocumentPosition(b):a.contains?(a!=b&&a.contains(b)&&16)+(a!=b&&b.contains(a)&&8)+(0<=a.sourceIndex&&0<=b.sourceIndex?(a.sourceIndex<b.sourceIndex&&4)+(a.sourceIndex>b.sourceIndex&&2):1)+0:0}
[ "isPositionsEqual(first, second) {\n return first.x === second.x && first.y === second.y;\n }", "function equalPositions(pos1, pos2) {\n return pos1.x === pos2.x && pos1.y === pos2.y; \n}", "function compare(position1, position2) {\n return position1[0] - position2[0] || position1[1] - position2[1];\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a guests by id
function getById(req, res) { res.status(200).send(guestService.getById(req.params.guestId)); }
[ "function getGuest(id) {\n return db('guests').where({ id }).first();\n}", "async function getAllGuestsForAPotluck(id) {\n return db('potluck_guests as pg')\n .join('users as u', 'pg.guest_id', 'u.id')\n .select('u.username')\n .where({ 'pg.potluck_id': id });\n}", "function getById(guestId) {\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
console.log(XNOR2(0,0)) console.log(XNOR2(1,0)) console.log(XNOR2(0,1)) console.log(XNOR2(1,1)) console.log(AND(AND(1,1), AND(1,1))) //outputs true console.log(OR(AND(0,1), AND(1,1))) //outputs true console.log(XOR(AND(0,0), OR(1,0))) //outputs true
function ANDfromNOR(a,b) { return NOR(NOR(a,a), NOR(b,b)) }
[ "function xor(arg1, arg2) {\n // If only arg1 is true - or - only arg2 is true...\n if ( (arg1 && !arg2) || (arg2 && !arg1) ) {\n return true;\n }\n return false;\n}", "function NAND(x, y) {\n return (!x || !y);\n}", "function xor(a,b) {\n if (a === true && b === true) {\n return false;\n } else if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detect cyclical dependencies in the bundle. All modules in a dependency cycle are moved to the top of the bundle and wrapped in functions so they're not evaluated immediately. When other modules need a module that's in a dependency cycle, instead of using the module's exportName, it'll call the `_$cycle` runtime functi...
function detectCycles (rows) { var cyclicalModules = new Set() var checked = new Set() rows.forEach(function (module) { var visited = [] check(module) function check (row) { var i = visited.indexOf(row) if (i !== -1) { checked.add(row) for (; i < visited.length; i++) { ...
[ "detectCycles() {\n\t\t\tconst flatOrder = Array.from(this.orderedNodes);\n\n\t\t\tfor (let i = 0; i < flatOrder.length; i++) {\n\t\t\t\tconst node = flatOrder[i];\n\n\t\t\t\tfor (const imp of node.analyze.value.importFirstUsage) {\n\t\t\t\t\tconst subnode = node.getNodeFromRelativeDependency(imp.source);\n\t\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Do a full vacuum to optimise the database which can be needed if files are often deleted/modified
vacuum () { this.db.exec('VACUUM') }
[ "function vacuum () {\n if (!args.no_vacuum) {\n log.info('Running VACUUM on line_items...')\n return redshift.vacuum(process.env.LINE_ITEMS_TABLE_NAME || 'line_items')\n } else {\n log.info('--no-vacuum specified, skiping vacuum.')\n return\n }\n}", "function testVacuumDisabled() {\n assertError(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The player clicked the log button. Shows the log modal.
function showLogModal () { $logContainer.empty(); transcriptHistory.forEach(function (pt) { if (pt instanceof RollbackPoint) { pt.logEntries.forEach(function (e) { logText = fixupDialogue(e[1]); logText = logText.replace(/<script>.+<\/script>/g, ''); ...
[ "function showLoggerPopUp() {\n let model = document.getElementById(\"loggerModalWrapper\");\n const errorMessage = document.querySelector(\".ui.error.message\");\n errorMessage.style.display = \"none\";\n clickCounter();\n if (clickCount === 5) {\n if (timeDifference() <= 3) {\n CrComLib...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getting tasks to UI
function getTasks(){ http .get('http://localhost:3000/Tasks') .then(tasks => { //showing tasks in ui ui.showTasks(tasks); //showing total task in ui ui.showTotalTasks(tasks); //getting complited task ui.getCompletedTaskCount(tas...
[ "function tasks_getAndDisplay() {\n communicator.getTasks().then((items) => {\n displayTasks(items)\n }, () => {\n tbTasks.innerHTML = 'Error while listing tasks'\n })\n}", "static displayData(){\n const tasks = Store.getData();\n\n //Inte ui\n const ui = new UI;\n\n tasks.forEa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When writing a bunch of records we can use the bulk() method of the ES API:
async _writev(chunks, next) { const body = chunks .map(chunk => chunk.chunk) .reduce((arr, obj) => { if (this.config.usePartialUpdate) { arr.push({ update: { _id: this.idFn(obj) } }) arr.push({ doc: obj, doc_as_upsert : true }) } else { arr.push({ index: { _id: this.idFn(...
[ "_bulkSave() {\n let { _saveQueue: saveQueue } = this;\n\n let promises = array();\n for (let i in saveQueue) {\n promises.push(this.add(i, saveQueue[i]));\n saveQueue[i] = array();\n }\n\n return Promise.all(promises, 'indexedDb/_bulkSave');\n }", "async function iterate () {\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: Create a function that returns the license section of README If there is no license, return an empty string
function renderLicenseSection(license) { if (!license) return ''; else if (license === 'MIT License') { return 'This project is covered under the MIT License. For more information, please click the link below.'; } else if (license === 'GNU GPLv3') { return 'This project is covered under the GNU GPLv3 Lice...
[ "function licenseSection(license) {\n if (license !== 'No License') {\n return `## License\n \n This project is licensed under [${license}]` + licenseLink(license)\n }\n return ''\n}", "function renderLicenseSection(license) {\n return `\n## License \nThis project is licensed under the ${license} ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the DrawingManager and set up drawing event handlers.
function setUpDrawingTools(){ // Initialize drawing manager. drawingManager = new google.maps.drawing.DrawingManager({ drawingMode: google.maps.drawing.OverlayType.CIRCLE, drawingControl: true, drawingControlOptions: { position: google.maps.ControlPosition.TOP_LEFT, drawingMode...
[ "initActions() {\n this.canvas.addEventListener('mousedown', (event) => { this.startDrawing(event); });\n this.canvas.addEventListener('mouseup', (event) => { this.endDrawing(event); });\n this.canvas.addEventListener('mousemove', (event) => { this.onMove(event); });\n }", "function addDra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a path is exactly equal to another.
equals(path, another) { return path.length === another.length && path.every((n, i) => n === another[i]); }
[ "equals(path, another) {\n return path.length === another.length && path.every((n12, i15) => n12 === another[i15]);\n }", "function pathsAreEqual() {\n if (winPath.length !== userPath.length) {\n return false;\n }\n for (var i = 0; i < winPath.length; i++) {\n if (winPath[i] !== userPath[i]) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when the user specifies an intent for this skill.
function onIntent(intentRequest, session, callback) { console.log("onIntent requestId=" + intentRequest.requestId + ", sessionId=" + session.sessionId); var intent = intentRequest.intent, intentName = intentRequest.intent.name; if ("AMAZON.StartOverIntent" === intentName) { // ...
[ "function onIntent(intentRequest, session, callback) {\n \n console.log(\"onIntent requestId=\" + intentRequest.requestId\n + \", sessionId=\" + session.sessionId);\n\n var intent = intentRequest.intent,\n intentName = intentRequest.intent.name;\n\n // Dispatch to your skill's inte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates the colour blocks based on the colours that is most prominent within the single painting.
function colourBlocks(painting) { let div = document.querySelector("#coloursBlock") div.textContent = ""; for (let p of painting.JsonAnnotations.dominantColors) { let span = document.createElement("span"); let colour = p.web; span.style.backgroundColor =...
[ "function generateColorBlocks() {\n $('.palette').html('');\n\n $('.palette').append('<h4 class=\"text-muted\">Dominant Color</h4>');\n\n var c = rgbToCssString(bgColor);\n\n $('.palette').append('<div class = \"color-blocks\"><div class=\"color-block\" style=\"background-color: ' + c + ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the musician's photo url if it exists, otherwise returns a parrot.
function getMusicianPhoto(musician) { if (imageExists(musician.photo)) return musician.photo; else return 'http://cultofthepartyparrot.com/parrots/hd/donutparrot.gif'; }
[ "function getMediaURLFromArtist(artist) {\n if (artist === undefined) {\n return null;\n }\n return artist.photo;\n}", "get image() {\n\t\tvar images = this.song.album.images;\n\t\treturn images[0].url;\n\t}", "function getPhoto() {\n if (properties.avatarUrl.link) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Commit saving the form through AJAX
function commitAjaxSave(callback) { var form = $('#application-form'); var postdata = form.serialize(); var endpoint = ajax_save_endpoint; $.post(endpoint, postdata, null, 'json') .done(function(data, textStatus, jqXHR) { if (textStatus != 'parsererror') { // Request seems to have gone fine i...
[ "function save(){\n // init - update style of file list we want to delete (update form)\n BowsManager.tools.updateStyleDeleteAttachment();\n\n // init action done when submit form\n $(\"#bill-form\").submit(function( event ) {\n event.preventDefault();\n $(\"#save-b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
closes new risk form
function CloseRisk() { document.getElementById("AddRisk").style.display = "none"; document.getElementById("newRisk").value = ""; }
[ "function CloseERisk() {\n\tdocument.getElementById(\"EditRisk\").style.display = \"none\";\n\tdocument.getElementById(\"EditRiskName\").value = \"\";\n}", "function closeVatDetail() {\r\n $validateVat.resetForm();\r\n $('#VATBreakdown').dialog('close');\r\n setFocusAndBlur('#VatAmount');\r\n}", "function cl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rotate 4byte word w left by one byte.
static rotWord(w) { const tmp = w[0]; for (let i = 0; i < 3; i++) w[i] = w[i + 1]; w[3] = tmp; return w; }
[ "static rotWord(w) {\n const tmp = w[0];\n for (let i = 0; i < 3; i++) w[i] = w[i + 1];\n w[3] = tmp;\n return w;\n }", "static rotWord(w) {\n const tmp = w[0]\n for (let i = 0; i < 3; i++) w[i] = w[i + 1]\n w[3] = tmp\n return w\n }", "function bitR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse a namespace or tag. Returned: values are the resources which are the exact matches resolved are the lowest level tag members parsed is the literal tag. If parsed exists, but not resolved/values, then it was a nontag if not successful, if data undefined then parsing failed. if data is a value, then a tag parsed bu...
function parseNamespaceOrTag(reader, info, taghandling) { const helper = new __1.ReturnHelper(info); const start = reader.cursor; if (reader.peek() === consts_1.TAG_START) { reader.skip(); if (typeof taghandling === "string") { const tags = __1.getResourcesofType(info.data, taghandling); co...
[ "datatype_or_langtag() {\n\t\t// destruct chunk, length, and index\n\t\tlet {s, n, i} = this;\n\n\t\t// ref character\n\t\tlet x = s[i];\n\n\t\twhile(i < n) { // eslint-disable-line no-unmodified-loop-condition\n\t\t\t// datatype\n\t\t\tif('^' === x) {\n\t\t\t\t// enough to speculate datatype\n\t\t\t\tif((i+2) < n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Syncs the db model from a specific path First it sees if the path belongs to any record
function _syncData(path) { if (!path) return; var keys = Object.keys(syncObjects); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var record = syncObjects[key]; if (path.match(record.regex)) { _syncPath(key); return;...
[ "function _syncPath(path) {\n var record = syncObjects[path];\n if (!record) {\n return;\n }\n if (record.timeoutId) {\n clearTimeout(record.timeoutId);\n }\n record.timeoutId = setTimeout(function () {\n var iter = _model.getData();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
["10", "%", "0"] Uses splitBySymbol and after spltting expression, check if they contain decimal or nonoperator symbols
function checkDecimalMisc(op) { for (element of splitBySymbol(op)) { if (!element.match(/[-+*/%]/) && element % 1 != 0) { return true; } } return false; }
[ "isFirstDigitAnOperator(text){\n\t\tconst regex = /^[+-\\/*.]/;\n\t\treturn regex.test(text);\n\t}", "function checkDecimalNotAllowed() {\n let equation = inputDisplay.textContent.split(\" \");\n let firstNum = equation[0];\n let mathOp = equation[1];\n let secondNum = equation[2];\n\n if (mathOp =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all drugs name from drugname.json file and push it into Drugs state
getDrugsNameFromFile(){ const DataFile = require('./drugname.json'); //file size 4MB nearly and content nealy 50 thousand drug names let DragName = [] let UnqDrugName = [] let xName; DataFile.map((index)=>{ DragName.push(index.brand_name.toLowerCase()); }); //push all drug n...
[ "function getDrugs(data){\n\n // Variables that are identified alphabetically as part of the drugs.json file (drugs are ordered in alphabetical order)\n // Data JSON file made with various lists from Dariusk Corpora at https://github.com/dariusk/corpora\n var dataDrugsa = data.drugsa, i;\n var dataDrugsb = data...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FOR SUBMIT NEW LISTING enable
function enable(value){ console.log("inside enable"); if (value){ $( '#listingForm' ).on( 'submit', function(event){ event.preventDefault(); console.log("you've clicked submit"); clickSumbitNewListing(); clearForm(); }); } else{ $( '#listingForm' ).off( ...
[ "function enable() {\n //setup Listners in here\n}", "function list_change() {\n var selection = getCheckBoxSelection();\n if (selection === 'Cannot tell based on the abstract' || selection === 'Invalid Prompt') {\n document.getElementById(\"submit-but\").disabled = false;\n } else if (getFinalText().leng...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
const x2 = 2; const y1 = 2; const y2 = 2; const x1 = 0; const x2 = 4; const y1 = 2; const y2 = 6; let length_AB = Math.sqrt ((x1 x2)(x1 x2) + (y1 y2)(y1 y2)); console.log(length_AB)
function calculate_the_length(x1,y1,x2,y2){ let length_AB = Math.sqrt ((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)); console.log(length_AB) }
[ "function pitagoroTeorema(x, y ) {\n\nlet krastine = Math.sqrt(x*x + y*y);\nconsole.log( krastine );\n}", "function triangleArea() {\n let side1 = 5\n let side2 = 6\n let side3 = 7\n const s = (side1 + side2 + side3)/2\n const area = Math.sqrt(s*((s - side1) * (s - side2)* (s - side3)))\n console.log(area)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set Local storage with player data
function setLocalStorage(){ var playerSetter = JSON.stringify(allPlayers); localStorage.setItem('players', playerSetter); }
[ "function storeLocal() {\n var playersJSON = JSON.stringify(parsedlclStrgObjArr);\n localStorage.setItem('players', playersJSON);\n}", "function storePlayer() {\n localStorage.setItem(\"player names\", JSON.stringify(playerName));\n localStorage.setItem(\"player scores\", JSON.stringify(hiscoreList));\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to check that the name entered is the persons full name
function checkFullName(name){ var fullName = name.split(" "), fullNameLength = fullName.length, isName = false, i; // If there are two or more names entered such as first and last if ( fullNameLength >= 2) { // Loop over names for (i = 0; i < fullNameLength; i++) { // Each part ...
[ "function checkFullName() {\n\t\tlet validFullName;\n\n\t\tif (middleName.value != \"\") {\n\t\t\tvalidFullName = firstName.value + \" \" + middleName.value + \" \" + lastName.value;\n\t\t} else {\n\t\t\tvalidFullName = firstName.value + \" \" + lastName.value;\n\t\t}\n\n\t\tif (fullName.value != validFullName) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the lock on the multivector argument and returns the same argument. This is a convenience function for the dunder (double underscore) methods. All dunder methods should return locked values.
function lock(m) { m.lock(); return m; }
[ "function locking(x) {\n return {verb: \"locking\", dobj: x};\n}", "lock(locking){\n // return locked state if none provided\n if(locking === undefined) {\n return this.locked;\n } else if(this.locked === true && locking === true) {\n // already locked asking again for same lock state\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inserts knot un in the knot vector rtimes Algorithm A5.1 from "The NURBS Book"
insertKnot(un, r) { let p = this.degree; let dim = this.dimension; let k = this.findSpan(un); let isRational = this.isRational(); // If un already exists in the knot vector then s is it's multiplicity let s = 0; for (let i = 0; i < this.knots.shape[0]; i++)...
[ "insertKnotU(un, r) {\r\n let p = this.u_degree;\r\n // Knot will be inserted between [k, k+1)\r\n let k = helper_1.findSpan(p, this.u_knots.data, un);\r\n // If un already exists in the knot vector, s is its multiplicity\r\n let s = common_1.count(this.u_knots, un, 0);\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads track dates and colors from the URL. Tracks can be shown for specific dates and colors: map.html?20150918&20150920,a000f0 Or for a date range: map.html?20150918..20150920 Or just show me everything: map.html?all
function loadTracksFromURL () { var params = window.location.search.replace("?","").split("&"); tracks = {}; for (var i = 0; i < params.length; i++) { var track = params[i].split(","), color = track[1], range; if (!track[0] || track[0] == "all") { range = ["2015-03-...
[ "function dailyPlacementsLoaded() {\n\tvar conjunction;\n\tif (null == window.location.search || '' == window.location.search) {\n\t\tconjunction = '?';\n\t} else {\n\t\tconjunction = window.location.search + '&';\n\t}\n\t$('#daily_placements_plot').attr('src',\n\t\t\t'chart.html' + window.location.search);\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw current grid and placed to convas
function drawCurrentGrid() { for (var i = 0; i < 20; i++) { for (var j = 0; j < 10; j++) { if (grid[i][j] > 0) { var num = grid[i][j]; var color = colors[num - 1]; var y = 1 + j * 32; var x = 612 - (1 + i * 32); ...
[ "draw() {\n //Clear\n while (this.container.firstChild) {\n this.container.removeChild(this.container.firstChild);\n }\n //Draw\n this.grid.forEach(c => this.container.appendChild(c));\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a Hex with the current value, e.g. Hex("FF").
toHex() { const value = this.value.toString(16).toUpperCase(); return new Hex(`#${value}`); }
[ "toHex() {\n const value = this.value.toString(16).toUpperCase();\n return new Hex(`#${value}`);\n }", "function Hex(value){\n \n this.valueOf = function(){\n return value;\n };\n \n this.toString = function(){\n return \"0x\" + value.toString(16).toUpperCase();\n };\n \n this.toJSO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get meetups than user logged can subscription
async function loadMeetups() { try { setLoading(true); const response = await api.get('subscriptions'); // Load all meetups than user logged not is owner const data = response.data.map(meet => { return { ...meet, passed: isBefore(parseISO(meet.date), new Date()), }; }); setMeetu...
[ "async function getSubscribbedMeetups() {\n try {\n setLoader(true);\n const response = await api.get('subscriptions');\n\n const meetupData = response.data.map(meetup => {\n return {\n ...meetup,\n formattedDate: format(parseISO(meetup.date), \"MMMM, do 'at' p\"),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when the user changes the annotation type's value type.
function valueTypeChange() { if (vm.annotType.valueType === 'Select') { // add an option if none exist if (!vm.annotType.options || (vm.annotType.options.length < 1)) { optionAdd(); } } else { vm.annotType.options = undefined; vm.annotType.maxValueCount = 0;...
[ "function valueTypeChange() {\n vm.annotationType.valueTypeChanged();\n }", "type(value) {\n this.newType = value\n }", "function handleAnnotationTypeChange() {\n gAnnotationType = parseInt($('#annotation_type_id').val());\n globals.currentAnnotationsOfSelectedType = gCurrentAnnotati...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get video by quiz id
function GetVideoByQuizId(id) { return $resource(_URLS.BASE_API + 'get_video_by_quiz_id/' + id + _URLS.TOKEN_API + $localStorage.token).get().$promise; }
[ "function getVideo(id) {\n\t\t \t//https://www.googleapis.com/youtube/v3/videos?id=7lCDEYXw3mM&key=YOUR_API_KEY&part=snippet,contentDetails,statistics,status\n\t\t }", "function getVideo(id)\r\n{\r\n\tfor(var i in videos)\r\n\t\tif(videos[i].id == id)\r\n\t\t\treturn videos[i];\r\n\treturn null;\r\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GIT_UPDATE ////////////////////////////////////////// triggered by: user clicked on update button arguemnts: mid of cam what it does: just forward it to the server why: to tritter the git update on the client side ///////////////////////////////////////// GIT_UPDATE
function git_update(mid){ var cmd_data = { "cmd":"git_update", "mid":mid}; console.log(cmd_data); con.send(JSON.stringify(cmd_data)); }
[ "function commitGithub(GH, UI) {\n var d = new Date();\n var ds = d.toLocaleDateString();\n var ts = d.toLocaleTimeString();\n var data = GH.parse(UI);\n data['editcontent'] = UI.geteditor();\n data['commitmsg'] = \"Updated from Brython Server: \" + ds + \" \" + ts;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to uncover clicked card effect
function uncoverCard() { // to store id of clicked card let clickedCard = this.id; document.getElementById(clickedCard).classList.add("card-rotate"); }
[ "function removeCardTransparency() {\n let currentPageCards = sg.cardContainer.getCurrentPageCards();\n for (let card of currentPageCards) {\n let cardDomEl = document.getElementById(\"gallery_card_\" + card.getLabelId());\n if (cardDomEl.classList.contains(unselectedCardClassNam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setting the third slider arrays
thirdLoop(){ var listFour = this.state.newState, z; for (z = 8; z < 12; z++) { this.state.sliderThree[z] = listFour[z]; } }
[ "function actionSliders(arr) {\n \"use strict\";\n\n //planet distance\n arr[0].noUiSlider.on('slide', function( values, handle) {\n var newvalue = values[handle];\n document.getElementById('orbdis').value = newvalue;\n });\n //planets size\n arr[1].noUiSlider.on('slide', function( ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sorts the list, based on a given string value, either "Alpha" for alfabetically, or ticket for sorting by ticketcount
function sorted(list, value){ if (value == "Alpha"){ //Sorts alphabetically. [i][1] == product name list.sort(function(a,b){ if (a[1] < b[1]) { return -1; } if (a[1] > b[1]) { return 1; } }); } if (v...
[ "static sortList(list){\n list.sort(function(a,b){\n let nameA = a.batteryName.toUpperCase();\n let nameB = b.batteryName.toUpperCase();\n let middleA = a.batteryName.search(\"-\");\n let middleB = b.batteryName.search(\"-\");\n\n nameA = nameA.substring...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
delete folders on premature exits
function onexit() { rimraf.sync(folder); }
[ "purge() {\n let dirReader = this.fs.root.createReader();\n dirReader.readEntries(entries => {\n for (let i = 0, entry; entry = entries[i]; ++i) {\n if (entry.isDirectory) {\n entry.removeRecursively(() => {\n }, ChromeStore.errorHandler);\n } else {\n entry.remov...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the mesh mode (eg. 'edit', 'pose')
function setMeshMode(mode_change_value) { ss.setInObject('editor_scratch', 'current_view_mode', mode_change_value); model_compositor.setViewMode(mode_change_value); mesh_editor.setMode(mode_change_value); update_mesh_editor = true; }
[ "setMesh() {\n\n this.addSphere();\n \n }", "_setPrimitiveMode(meshPrimitive, primitiveMode) {\n switch (primitiveMode) {\n case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFillMode: {\n // glTF defaults to using Triangle Mode\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
populate Optionally populates the leaf nodes of a fragment with content.
function populate(node) { var childNodes = [].slice.call(node.childNodes); childNodes.forEach(function(childNode) { if (childNode.childNodes.length) { populate(childNode); } else { var part = childNode.__selectorPart__, ...
[ "populate() {\n if (!this.node_) {\n this.finish_();\n return;\n }\n\n const root = AutomationUtil.getTopLevelRoot(this.node_);\n if (!root) {\n this.finish_();\n return;\n }\n\n this.walker_ = new AutomationTreeWalker(root, constants.Dir.FORWARD, {\n visit(node) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resetPixel Takes the provided pixel element and sets its color back to default
function resetPixel(pixel) { pixel.style.backgroundColor = DEFAULT_COLOR; }
[ "function resetPixel(pixel) {\n // Change the pixel color to grey\n pixel.style.backgroundColor = 'grey';\n}", "function resetPixel(pixel) {\n pixel.style.backgroundColor = 'black';\n}", "function resetPixel(pixel) {\n pixel.style.backgroundColor = \"black\";\n}", "function clearPixel(pixel){\r\n var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var p1 = [0.05659940, 0.08041887, 398.00000000, 0.48199413] var p2 = [ 0.07103750 , 0.08601112 ,404.00000000 , 0.40937711 ] var p3 = [1.330870e01, 4.840363e02, 8.470000e+02, 6.100783e03 ] var params = [p1, p2, p3] //estimate, stderr, n, pvalue makeForestPlot(params, "body");
function makeForestPlot(params, plotId) { //estimate, stderr, n, pvalue //positions and dimensions var width = 500; var height = 500; var names = ["GDSC", "gCSI", "CCLE"] names.unshift(" ") // formatting the given data for easier parsing var estimates = [] var n = [] ...
[ "function forest_log (forest) {\n forest.forEach(function (tree) {\n console.log(tree.V.get());\n });\n}", "function forestVisual(val) {\n noStroke(); //tree has no stroke\n\n let c1 = color(color1);\n let c4 = color(color4);\n let theme = themes[ques2].name;\n if (personalityType == \"Introverted\") {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
callback(status,city) : status==true if everything went well and city then contains the city
function getCity(lat, lon, callback){ $.ajax({ url: 'http://maps.googleapis.com/maps/api/geocode/json?latlng='+lat+','+lon, type: "GET" }).done(function(ret) { var indice = ret.results.length - 4, status = (ret.status == "OK" && ret.results), city; try{ ...
[ "function cityCheck(city) {\n status = false;\n for (var i = 0; i < vm.searchHistory.length; i++) {\n\n if (vm.searchHistory[i].id == vm.weatherResponse.id) {\n status = true;\n\n };\n\n }\n return status;\n\n\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deny a transaction with certain order_id | transaction_id which gets challenge status from Fraud Detection System
deny(transactionId) { this.apiUrl = this.parent.apiConfig.getCoreApiBaseUrl() + '/' + transactionId + '/deny'; return this.parent.httpClient.request({ requestUrl: this.apiUrl, httpMethod: 'post', serverKey: this.parent.apiConfig.get().serverKey, requestPay...
[ "static async apiDenyRequest(req, res, next) {\n try {\n let requestId = req.body.id;\n let userId = req.body.user_id;\n \n const denyStatus = await MovieRequestsDAO.denyRequest(requestId, userId);\n \n if (denyStatus.modifiedCount == 1) {\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Uniform cost search to expand movement positions
function computeMovementPositions(store, unit) { const { units } = store.getState() const { movement } = gameConfiguration.unitsConfiguration[unit.type] const getSuccessors = getSuccessorsFactory(store, unit) const positions = [] const openSet = new Heap() const closedSet = new Set() openSet.insert(0, ...
[ "function aStarSearch(store, unit, startPosition, goalPosition) {\n const { worldMap, units } = store.getState()\n const { movementType } = gameConfiguration.unitsConfiguration[unit.type]\n const startPositionHash = hash(startPosition)\n const goalPositionHash = hash(goalPosition)\n\n const open = new Heap()\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stubbed out location for `MatProgressBar`.
function MatProgressBarLocation() {}
[ "function MatProgressBarLocation() { }", "function mxShapeMockupProgressBar(bounds, fill, stroke, strokewidth)\n{\n\tmxShape.call(this);\n\tthis.bounds = bounds;\n\tthis.fill = fill;\n\tthis.stroke = stroke;\n\tthis.strokewidth = (strokewidth != null) ? strokewidth : 1;\n\tthis.barPos = 20;\n}", "function mxSha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test the isGoogleIp4Address() method.
function testIsGoogleIp4Address() { assertTrue(ndebug.DNSResponsePacketAnalyzer.isGoogleIp4Address( '74.125.224.110')); assertFalse(ndebug.DNSResponsePacketAnalyzer.isGoogleIp4Address( '99.23.29.13')); assertFalse(ndebug.DNSResponsePacketAnalyzer.isGoogleIp4Address( '209.230.12.23')); }
[ "function isIPv4(ipAddr) {\n return (new v4.Address(ipAddr)).isValid();\n}", "function isIPv4Address(a) {\n let result = true\n a.split(\".\").length === 4 ? result = true : result = false\n a.split(\".\").map(function (e) {\n if (Number(e) < 0 || Number(e) > 255 || e.length === 0 || e.length >...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implements the PouchDB API for dealing with CouchDB instances over HTTP
function HttpPouch(opts, callback) { // The functions that will be publicly available for HttpPouch var api = this; var host = getHost(opts.name, opts); var dbUrl = genDBUrl(host, ''); opts = clone(opts); var ourFetch = function (url, options) { options = options || {}; ...
[ "function HttpPouch(opts, callback) {\n\n // Parse the URI given by opts.name into an easy-to-use object\n var host = getHost(opts.name, opts);\n\n // Generate the database URL based on the host\n var db_url = genDBUrl(host, '');\n\n // The functions that will be publically available for HttpPouch\n var api =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On Parent Tab Change
function onTabChange(i) { setCurrentTab(i) }
[ "function tabChanged(e){\n // var node = e.selectedValueTab;\n // gTrans.showDialogCorp = true;\n // if (node.id == 'tab1') {\n //\n // }\n // if (node.id == 'tab2'){\n // gTrans.dialog.activeDataOnTab('tab2');\n // gTra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to add employee in creating multiple timesheets.
function addEmployee() { form = document.sheet; if( window.location.href.indexOf('/BSOS/Include/edittimemulti.php')>0 ) { form.action = "/BSOS/Include/edittimemulti.php"; if(form.timefile.value != "") { var fileConfirm = (confirm("If you add row(s), you need to upload the file again. Do you want to ...
[ "function addEmployee() {\n var name = Browser.inputBox('Enter the name of the employee.');\n if(name == 'cancel') return;\n \n var ss = SpreadsheetApp.getActive();\n var s = ss.getActiveSheet();\n var set = ss.getSheetByName('Settings');\n \n // If the user is on the setting sheet just add to the end of ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays a file picker to select an SRT file. This must be done since browser actions will close the moment a file picker is opened, which makes it impossible to have any interaction at all. When an SRT file is chosen, we will process it and start displaying subtitles according to the current timestamp of the video.
function displaySrtFilePicker() { // Since this method is called at the start, when the addon is refreshed, and on history // state update, clear anything that may already exist from a previous run. if(intervalId !== null) clearInterval(intervalId); removeElementById('netflix-srt-subs-picker-box'); removeElementBy...
[ "function promptSRT() {\n //storing the last used SRT file for easy debugging\n const lastSRTKey = 'sr-last-srt';\n //remove everything for the previous subrenderer\n console.log(`\\n\\nNEW VIDEO\\n\\n`);\n if (sr) {\n sr.destroy();\n }\n let ta = document...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
throw a processor type error
function preprocessorTypeError(type) { panic$1(`No preprocessor of type "${type}" was found, please make sure to use one of these: 'javascript', 'css' or 'template'`); }
[ "function preprocessorTypeError(type){panic$1(`No preprocessor of type \"${type}\" was found, please make sure to use one of these: 'javascript', 'css' or 'template'`);}// throw an error if the preprocessor was not registered", "function preprocessorTypeError(type) {\n panic$2(`No preprocessor of type \"${type...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createJWT Creates a json web token (jwt) based on the userId, clientId, and timestamp provided.
createJWT({userId, clientId, timestamp}) { if (!userId || !clientId || !timestamp) { console.err(new Error("Invalid claim payload for JWT")); return null; } return jwt.sign({userId, clientId, timestamp}, configService.SECRET, { expiresIn: configService.JWT_EXP...
[ "function generateToken(userId) {\n // Include some data and an expiration timestamp in the JWT\n return jwt.sign(\n {\n exp: Math.floor(Date.now() / 1000) + 60 * 60 * 24, // This key expires in 1 hour\n data: { userId },\n },\n process.env.JWT_SECRET\n );\n}", "function createToken(user){\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Emits the `select` event.
_emitSelectEvent(option) { const event = new NovoOptionSelectedEvent(this, option); this.optionSelected.emit(event); }
[ "[notifySelection]() {\n this.dispatchEvent(new CustomEvent('select'));\n }", "_emitSelectEvent(option) {\n const event = new MatAutocompleteSelectedEvent(this, option);\n this.optionSelected.emit(event);\n }", "get __selectEvent() {\n return \"select-item\";\n }", "select() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
saving cloze card to log.txt
function clozeSave(flash) { fs.appendFile('log.txt', 'Cloze: ' + flashcard.cloze + 'Question: ' + flashcard.question + '\n' + 'UTF-8', function(error) { if (error) throw error; }); }
[ "function saveCloze(flashcard){\n\tfs.appendFile(\"output.txt\", `Cloze: ${flashcard.cloze} Question: ${flashcard.question} \\n`, \"UTF-8\", function(error){\n\t\tif (error) throw error;\n\t});\n}", "function basicSave(flash) {\n fs.appendFile('log.txt', 'Front: ' + flashcard.front + 'Back: ' + flashcard.back ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Guess the persistence manager for the given key
guessPersistenceManager(key) { for (let i = 0, l = this.keyPersistenceManagerMap.length; i < l; i++) { let keyPersistenceManager = this.keyPersistenceManagerMap[i]; if (key === keyPersistenceManager.key) { return keyPersistenceManager.persistenceManager; } } throw Er...
[ "getManager(key) {\n return this.managers.get(key);\n }", "get keyManager() {\n return this.getStringAttribute('key_manager');\n }", "createPubKeyManager(key, callback){\n var km = null;\n this.kbpgp.KeyManager.import_from_armored_pgp({armored: key}, (err, self) => {\n if(err){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
6. Capitalization Given a phrase, capitalize every word. Example input: capitalizeWords('i love javaScript!') Example output: 'I Love JavaScript!
function capitalizeWords(input) { let wordInput = input.split(' '); for (let i = 0; i < wordInput.length; i++) { var lettersUp = ((wordInput[i])[0]).toUpperCase(); wordInput[i] = wordInput[i].replace((wordInput[i])[0], lettersUp); } return console.log(wordInput.join(" ")); }
[ "function capitalizeAllWords(string) {\n \n}", "function capitalizeEachWord(phrase) {\r\nreturn phrase.split(\" \").map((word) => word.toUpperCase()[0] + word.slice(1)).join(\" \");\r\n}", "function capitalizeWords(lovercaseText){\n var wordArray=lovercaseText.split(' ');\n for(i=0; i<wordArray.length;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
objectExists(obj) Returns true if obj is not null and is not undefined
function objectExists(obj) { if (obj == null || typeof(obj) == "undefined") return false; return true; }
[ "function isPresent(obj) {\n return obj !== undefined && obj !== null;\n}", "function isPresent(obj) {\n return obj !== undefined && obj !== null;\n }", "function objectDefinedNotNull(obj) {\r\n return typeof obj !== \"undefined\" && obj !== null;\r\n}", "function isset(obj) {\n\t\tif(typeof o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
5. Create a function to remove a skill to all members in a list of mentors
function removeSkill(mentors,newSkill){ mentors.forEach(mentor => mentor.skills.remove(newSkill)) }
[ "function removeSkill(mentors,newSkill){\r\n return mentors.forEach(skill => skill.skills.splice(skill.skills.indexOf(newSkill),1));\r\n //your code here\r\n}", "function removeOldSkills() {\n elgg.action('b_extended_profile/edit_profile', {\n data: {\n 'guid': elgg.get_logged_in_user_guid(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Locates the element within the given LView and returns the matching index
function findViaNativeElement(lView,target){var tNode=lView[TVIEW].firstChild;while(tNode){var _native3=getNativeByTNode(tNode,lView);if(_native3===target){return tNode.index;}tNode=traverseNextElement(tNode);}return-1;}
[ "function findViaNativeElement(lView, target) {\n var tNode = lView[TVIEW].firstChild;\n while (tNode) {\n var native = getNativeByTNode(tNode, lView);\n if (native === target) {\n return tNode.index;\n }\n tNode = traverseNextElement(tNode);\n }\n return -1;\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Grants access to a site design for one or more principals.
grantSiteDesignRights(id, principalNames, grantedRights = 1) { return __awaiter(this, void 0, void 0, function* () { return yield this.clone(SiteDesigns, `GrantSiteDesignRights`) .execute({ "grantedRights": grantedRights.toString(), "id": id, ...
[ "grantSiteDesignRights(id, principalNames, grantedRights = 1) {\n return this.clone(SiteDesignsCloneFactory, \"GrantSiteDesignRights\")\n .execute({\n \"grantedRights\": grantedRights.toString(),\n \"id\": id,\n \"principalNames\": principalNames,\n });\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
jshint sub:true \file navtiming.js Plugin to collect metrics from the W3C Navigation Timing API. For more information about Navigation Timing, see:
function navtimingrun() { // First make sure BOOMR is actually defined. It's possible that your plugin is loaded before boomerang, in which case // you'll need this. BOOMR = BOOMR || {}; BOOMR.plugins = BOOMR.plugins || {}; /** * A private object to encapsulate all your implementation detail...
[ "function trackNavigationTiming() {\nif (!timingCounter) {\ntimingCounter = 0;\n}\nif (timing && ++timingCounter < 10 && timing.loadEventEnd === '0') {\nsetTimeout(BR.Tracking.trackNavigationTiming, 1000);\n} else {\n$.get(TRACKING_URL + getTimingParameters(timing) + '&r=' + encodeURIComponent(document.referrer) + ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Do the ASYNC call to the NASA API
function search_call() { var url_string = window.location.href var params = url_string.split("?")[1]; var query = "https://images-api.nasa.gov/search?" + params; var result = httpGetAsync(query, parse); }
[ "async function getNasaApod() {\n let response = await fetch(`https://api.nasa.gov/planetary/apod?api_key=${API_NASA_KEY}`);\n let data = await response.json();\n console.log(data);\n useNasaApod(data);\n}", "async function getNasaPictures(){\n loader.classList.remove('hidden');\n try {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the scroll size of the element as a [ width, height ] tuple
getScrollSize(_id) { const _elem = this._elements[_id]; let [w, h] = [0, 0]; if (_elem) { [w, h] = [_elem.scrollWidth, _elem.scrollHeight]; } else { console.warn('ELEM.getScrollSize(', _id, '): Element not found'); } return [w, h]; }
[ "function htmlScrollSize() {\n var rect = document.documentElement.getBoundingClientRect();\n return [rect.width, rect.height];\n}", "getHeight() {\r\n let scrollableEl = this.getScrollableElement();\r\n return scrollableEl.height\r\n }", "getHeight() {\n let scrollableEl = this.getScrollableEle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
VerticalLayout just sets the alignment to LayoutAlignment.VERTICAL_ALIGNMENT
function VerticalLayout() { LayoutAlignment.call(this); /** * The alignment of the layout * * @type String * @default LayoutAlignment.VERTICAL_ALIGNMENT */ this.alignment = LayoutAlignment.VERTICAL_ALIGNMENT; }
[ "function setVerticalAlignment(widget,value){Private$1.verticalAlignmentProperty.set(widget,value);}", "set verticalAlignment(value) {\n if (value === this.verticalAlignmentIn) {\n return;\n }\n this.verticalAlignmentIn = value;\n this.notifyPropertyChanged('verticalAlignmen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
utility to just get a random door
function pickADoor() { return Math.floor(Math.random() * 3 + 1) // get a random integer: 1, 2, or 3 }
[ "function getRandomDoor (a,b) {\n\treturn a + Math.floor(Math.random() * (b - a + 1));\n}", "pickRandomDinosaur() {\n return dinosaurs[Math.floor(Math.random() * dinosaurs.length)];\n }", "function randomDoctor() {\n\t\treturn doctors[Math.floor(Math.random() * doctors.length)];\n\t}", "function ran...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
writeNumber write a two byte number to the buffer
function writeNumber(buffer, pos, number) { buffer.writeUInt8(number >> 8, pos, true) buffer.writeUInt8(number & 0x00FF, pos + 1, true) return 2 }
[ "function writeNumber(buffer, pos, number) {\n buffer.writeUInt8(number >> 8, pos)\n buffer.writeUInt8(number & 0x00FF, pos + 1)\n\n return 2\n}", "function writeNumber(buffer, pos, number) {\n\t buffer.writeUInt8(number >> 8, pos)\n\t buffer.writeUInt8(number & 0x00FF, pos + 1)\n\n\t return 2\n\t}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the current away message received when the user was seen as away.
get awayMessage () { return this._awayMessage }
[ "set awayMessage (value) {\n this._awayMessage = value\n /**\n * @event IrcUser#awayMessage\n */\n this.emit('awayMessage')\n }", "get isAway () {\n return this._isAway\n }", "function getIdleMessages() {\n return dict.entries[dict.entries.length - 1].answer.slice(0);\n}", "function maw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the timeBar slider as the video plays
function timeUpdater() { var totalValue = (100 / video.duration) * video.currentTime; // Calculate the slider value timeBar.value = totalValue; // Update the slider value }
[ "function timeUpdaterVideo() {\n var totalValue = (100 / video.duration) * video.currentTime; // Calculate the slider value\n videoTimeBar.value = totalValue; // Update the slider value\n }", "function setTimebar() {\n video.currentTime = (+timebar.value * video.duration) / 100;\n}", "function changeV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name:remoteNotCallbacks Author:Kony Purpose:It sets the callback function for registration,push notification events.
function remoteNotCallbacks() { kony.print("\n\n\n<--------in remoteNotCallbacks--------->\n\n\n"); var callbacksTable = { onsuccessfulregistration: regSuccessiPhoneCallback, onfailureregistration: regFailureiPhoneCallback, onlinenotification: onlinePushNotificationiPhoneCallback, ...
[ "function localNotCallBacks()\n{\n\ttry{\n kony.localnotifications.setCallbacks({\n \"offlinenotification\": offlinenotification,\n \"onlinenotification\": onlinenotification\n });\n \n\t}catch(err){\n\t\tkony.print(\"Error Code \" + err.errorCode + \" Message \" + err.message);\n\t}\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set state correctly when game ends
endGame(){ this.state = END; }
[ "gameFinished() {\n this.timeRemaining = null;\n this.endTime = null;\n this.currentRound = null;\n this.colourPlaying = null;\n this.currentState = WinksGameState.FINISHED;\n }", "endGame() {\n\n this.state.gameEnded = 1;\n this.clearCanvas();\n this.dis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the Bytecode tab with an annotated view of the bytecode generated by the WebBS code generator.
updateByteCodeTab (module) { let markup = ""; let prevPath = []; let position = 0; for (let part of module.parts) { let path = part.path.split("|"); let field = path.pop(); // Count how many initial segments path and oldPath have in common. for (var i = 0, len = Math.min(path.len...
[ "function update_code_properties() {\n return (ast) => {\n let header_count = 1;\n let header_id = \"\";\n\n visit(ast, \"element\", (node) => {\n if (HEADER_ELEMENTS[node.tagName] && node.properties.id) {\n header_count = 1;\n header_id = \"-\" + nod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merges sourceTree into propertyTree, so that we can reuse propertyTree This works semantically the same way as mergeTree() although each node in the `propertyTree` is a property proxy object wrapping the real data. When a subtree changes, the root of the subtree will emit change events.
function treeMerge( propertyTree, sourceTree, opts ) { opts = opts || { }; var sorter = opts.sorter || defaultSorter; var identifyer = opts.identifyer || defaultIdentifyer; var changed = opts.changed || defaultChanged; var childRefs = opts.childRefs || defaultChildRefs; var merge = opts.merge...
[ "function merge(target,source){var _a;target.additionalNodes=target.additionalNodes||[];target.additionalNodes.push(source.node);if(source.additionalNodes){(_a=target.additionalNodes).push.apply(_a,source.additionalNodes);}target.children=ts.concatenate(target.children,source.children);if(target.children){mergeChil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds or removes zeptoseconds.
addZeptoseconds(value, createNew) { return this.addFractionsOfSecond(value, createNew, '_zeptosecond', '_attosecond', 'addAttoseconds'); }
[ "addYoctoseconds(value, createNew) {\n return this.addFractionsOfSecond(value, createNew, '_yoctosecond', '_zeptosecond', 'addZeptoseconds');\n }", "function increaseFavoriteTimeZonesClocks(secsIncrease) {\n favoriteTimeZonesToRender.forEach(function (zone) {\n zone.zoneTimeDate = zone.zoneTimeDate....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Modify the marker offset if it's not already handled
modify_mark(marker) { if (!marker.offset_handled) { marker.start_pos += this.offset; marker.end_pos += this.offset; } return marker; }
[ "static get markerOffset() {\n return 3;\n }", "function marker() {\n mark = 1;\n\t\tunmark = 0;\n }", "function markerAdjust(){\n\n var mapbounds = mapnav.map.getBounds();\n var ne = mapbounds.getNorthEast();\n var sw = mapbounds.getSouthWest();\n var markedloc = current_posit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The scanner functions senses what key is pressed and translates the coordinates of the block so that the block translates from the center of the block
function headScanner() { if (keyIsPressed && (key === "w")) { translate(x, y); rotate(dx * mouseX , 3); } else { translate(x, y); } }
[ "moveBlock () {\n let right = this.input.keyboard.addKey('RIGHT')\n let left = this.input.keyboard.addKey('LEFT')\n let down = this.input.keyboard.addKey('DOWN')\n\n // Right key\n if (this.input.keyboard.checkDown(right, 100)) {\n if (this.checkMove(this.right)) {\n this.block.children.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load reviews from indexed DB.
static loadReviewsFromIndexedDB(restaurantId) { return dbPromise.then(function (db) { const tx = db.transaction('reviews'); const reviewsStore = tx.objectStore('reviews'); const restaurantIidIndex = reviewsStore.index('by-restaurant-id'); return restaurantIidIndex.getAll(Number(restaurantId)); }).then(f...
[ "function loadReviews() {\n API.getReview(id)\n .then(res => \n setReviews(res.data)\n )\n .catch(err => console.log(err));\n }", "async function load(req, res, next) {\n req.review = await Review.get(req.params.reviewId);\n return next();\n}", "async function loadReviews () {\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test if an element is used the correct amount of times. For instance, a `` element can only contain a single `` child. If multiple `` exists this test will fail both nodes.
static validateOccurrences(node, rules, numSiblings) { if (!rules) { return true; } const category = rules.find((cur) => { /** @todo handle complex rules and not just plain arrays (but as of now * there is no use-case for it) */ // istanbul ignore...
[ "function nodeIsSufficient($node) {\n return $node.text().trim().length >= 100;\n}", "function nodeIsSufficient($node) {\n return $node.text().trim().length >= 100;\n}", "function isElementValid($element) {\n return $element instanceof $ && $element.length;\n }", "function isRepeatTest(groupEl) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
WI_2015: 1.7204 + 171G + 3R 70NIR 45SWIR1 71SWIR2
function WI_2015(image) { var wi_2015 = image.expression( "1.7204 + 171*G + 3*R - 70*NIR - 45*SWIR1 - 71*SWIR2", { "G": image.select("B3"), "R": image.select("B4"), "NIR": image.select("B5"), "SWIR1": image.select("B6"), "SWIR2": image.select("B7") } ); return image.addBa...
[ "function WI_2015l7(image) {\n var wi_2015 = image.expression(\n \"1.7204 + 171*G + 3*R - 70*NIR - 45*SWIR1 - 71*SWIR2\",\n {\n \"G\": image.select(\"B2\"),\n \"R\": image.select(\"B3\"),\n \"NIR\": image.select(\"B4\"),\n \"SWIR1\": image.select(\"B5\"),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to display the response of the booking ticket
function _displayBookingResponse(response) { try { if (response && response.success) { const revenue = { subTotal: response.cost.subTotal, serviceTax: response.cost.serviceTax, swachhBharatCess: response.cost.swachhBharatCes...
[ "function showResponse(response) {\n var responseString = JSON.stringify(response, '', 2);\n// document.getElementById('response').innerHTML += responseString;\n console.log(\"API JSON RESPONSE from user ytSearchRequest: \" + responseString);\n}", "function formatResponse(event) {\n\n const booking = {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create an array of attributes for a given industry // to be used in point to layer //
function processData(data) { // attributes is an array of an individual industry by year e.g. ['con2008', 'con2009', ....] var attributes = []; // would list all properties associated with the first attribute var properties = data.features[0].properties; //push each attribute name into attributes array ...
[ "function populateCatagories(){\n //base on an attributes so that we dont need to put them to other arraies?\n}", "function findAttributes(category) {\n let allAttributes = {};\n for(let i = 0; i < categoryVendors[category].length; i++) {\n let companyName = categoryVendors[category][i];\n if(c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
runCmd. useCmdOutput = true => the command output direct to std
function runCmd(cmd, useCmdOutput){ if (!useCmdOutput) grunt.log.writeln(cmd['grey']); var shell = require('shelljs'), result = shell.exec(cmd, {silent:!useCmdOutput}); if (result.code === 0){ if (!useCmdOutput) grunt.log.writeln(result.output['white']); } else { if (!useCmdOutput){ g...
[ "function runCmd(cmd, useCmdOutput){\n if (!useCmdOutput)\n grunt.log.writeln(cmd['grey']);\n\n var shell = require('shelljs'),\n result = shell.exec(cmd, {silent:!useCmdOutput});\n\n if (result.code === 0){\n if (!useCmdOutput)\n grunt.log.writel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recursively flattens an object. A new object containing all the elements is returned. If level is specified, it will only flatten up to that level.
function flatten(obj, level) { if (obj == null) { return {}; } level = level == null ? -1 : level; return flattenTo(obj, {}, '', level); }
[ "function flatten(obj, level) {\n if (obj == null) {\n return {};\n }\n\n level = level == null ? -1 : level;\n return flattenTo(obj, {}, '', level);\n }", "function flatten(obj,depth){var result=[],typ=typeof obj==='undefined'?'undefined':_typeof2(obj),prop;if(depth&&typ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call GET /get API to select a flashcard to display
function getFlashcard() { const frontValue = getFrontValue(); const keepCardCheckbox = document.getElementById('keepCard'); // build query string with parameters const queryString = `http://localhost:8089/get?front=${frontValue}&removeCard=${!keepCardCheckbox.checked}`; // send the request const xhr = new...
[ "card() {\n return this.mu.http.get('/card')\n .then(res => this._getRes(res, this._setCard))\n .catch(() => this._setCard(null));\n }", "function getFlashcardData(id, type) {\n var queryUrl;\n switch (type) {\n case \"flashcard\":\n queryUrl = \"/api/flashcards/\" + id;\n break;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate the mobile wallet QR
generateWalletQR() { let QR = this._Wallet.generateQR(this.commonQR); if(QR) { $('#mobileWalletQR').html(""); $('#mobileWalletQR').append(QR); // Hide the password input for export to mobile qr this.showMobileQRPass = false; } this.reset();...
[ "generateAccountInfoQR() {\n // Account info model for QR\n let QR = nem.model.objects.create(\"accountInfoQR\")(this._Wallet.network === nem.model.network.data.testnet.id ? 1 : 2, 1, this._Wallet.currentAccount.address, this._Wallet.currentAccount.label);\n let code = kjua({\n size:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns number of digits from LHS or RHS of dot LHS is implied is not given as argument
function placesFromDot(n, side) { let nStr = n.toString(); let dot = nStr.indexOf('.'); if (dot === -1) return nStr.length; if (side === 'LHS' || !side) { return nStr.slice(0, dot).length; } else return nStr.slice(dot + 1).length; }
[ "function findDecimalPlaces(x) {\n\tlet num = x.toString().split(\".\")\n\t//if number passed was .0 javascript dropped the .0 so add 1 decimal place\n\tif (num[1] === undefined) {\n\t\treturn 1;\n\t}\n\treturn num[1].length;\n}", "function DPs(n) {\n const s = n.toString();\n const point = s.indexOf(\".\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert date to timeStamp
function toTimeStamp(date) { try { var x=""; if(date!=""){ x= new Date(date).getTime()/1000; } // console.log('try'+x +' '+date); return x; } catch (e) { // console.log(e); var x= new Date().getTime()/1000; // console.log('catch '+...
[ "function convertTimeStamp(date) {\n return new Date(date).getTime();\n }", "function toTimeStamp(date) {\r\n\t\ttry {\r\n\t\t\tvar x= new Date(date).getTime()/1000;\r\n\t\t\treturn x;\r\n\t\t} catch (e) {\r\n\t\t\tconsole.log(e);\r\n\t\t\tvar x= new Date().getTime()/1000;\r\n\t\t\treturn x; \r\n\t\t} \r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a name from the category slug. The "+" are replaced by spaces and other characters are decoded.
function getCategoryName(slug) { const decodedSlug = slug; return decodedSlug .split('+') .map(decodeURIComponent) .join(' '); }
[ "function getCategoryName(slug) {\n return slug\n .split('+')\n .map(decodeURIComponent)\n .join(' ');\n}", "function getCategorySlug(name) {\n return name.split(' ').map(encodeURIComponent).join('+');\n } // Returns a name from the category slug.", "function getCategoryName(slug) {\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get class names for a cell theme. Padding is set on the inner wrapper to prevent the inner wrapper (with overflow hidden) from clipping borders, box shadows, etc.
function getCellTheme(style) { if (!style) { return {} } if (style.padding != null) { const { padding, ...cellStyle } = style return { className: css(cellStyle), innerClassName: css({ padding }) } } return { className: css(style) } }
[ "getCellClasses() {\n let classes =\n \"array-cell text-center border border-dark\\\n text-white font-weight-bold flex-grow-1\";\n return classes;\n }", "function getGetCellClass() {\n return function (row) {\n return \"span\" + (12 / row.cells.length).toString();\n };\n}", "get st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets stock price, name, etc. from YQL API Puts results into a table
function getDataFromYQL(thisStock) { var today = new Date(); var monthNumber = today.getMonth(); var currentMonth = monthNames[monthNumber]; var currentYear = today.getFullYear(); var key = currentMonth + "."+ currentYear; /* Makes sure current date's signals are updated, if not then use 1/1/2016's si...
[ "function makeYqlRequest(ticker) {\n\t\n\tvar queryString = \"select * from yahoo.finance.quotes where symbol in ('\" + ticker + \"')\";\n \n //make the YQL request\n Ext.YQL.request({\n \n\t\t\tquery: queryString,\n\n //and give it a callback when the response comes back\n callback: function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for instance user selects to run scores for an entire directory
function runAll() { //here loop over info.directory and send each file to runScores for (let i = 0; i < info.directory_files.length; i++) { if (i < (info.directory_files.length -1)) { runScores(info.directory_files[i], "many"); } else { runScores(info.directory_files[i], "one"); } } }
[ "function runScores(file, num) {\n //create empty object fileScore \n //should have initial properties of \"fileName\", \"lowest\", \"highest\", and \"average\"\n let fileScore = {\n file_directory: info.directory,\n file_name: file,\n lowest: null,\n highest: null,\n average: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LoginPageHelp.js Purpose: Display the Login Page table on /help
function LoginPageHelp() { return ( <table className="table table-striped table-dark" style={{'margin-top': '25px'}} > <thead class="thead-dark"> <tr> <th>Login Page</th> </tr> </thead> ...
[ "function LoginPage(){}", "function loadHelpfulSitesPage(){\r\n console.log(\"->helpful sites\");\r\n }", "function login_help_show() {\n $login_help\n .show()\n .siblings()\n .hide();\n }", "openHelpPage() {}", "function loadLoginPage(){\n\tnavigat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes a single contributed story with the supplied id
deleteContributedStory({id}) { return this._getCollection() .then(collection => collection.deleteOne({ _id: MongoDb.ObjectId(id) })); }
[ "function removeStory(story_id) {\n dbPromise.then(function (db) {\n var tx = db.transaction(STORY_OBJECT_STORE, 'readwrite');\n var storyOS = tx.objectStore(STORY_OBJECT_STORE);\n storyOS.delete(story_id);\n return tx.complete;\n });\n}", "removeStoryWithId(id){\n this.storie...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes the general regex based on the other existing regex variables.
function updateGeneralRegex() { general_regex = new RegExp( lookaround_regexs.comment.source + '|' + lookaround_regexs.code.source + '|' + lookaround_regexs.print.source + '|' + lookaround_regexs.print_plain.source, 'gm'); }
[ "function initRegex() {\n if (typeof general_regex !== 'undefined') {\n return;\n }\n\n regexs = {};\n regex_raw = '~';\n regex_not_raw = `(?<!${regex_raw})`;\n\n // Update lookarounds regex\n lookaround_regexs = {\n 'block': new RegExp(`${regex_not_raw}(?=\\\\{\\\\[)( ?){1,}block...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the 'value', 'verifiedValue' and 'fee' as a Number to this coin (i.e. verifiedValue = faceValue verificationFee).
function _setVerifiedValue(coinObj, args) { let value = Number.parseFloat(coinObj.v); coinObj.value = round(value, 8); let fees = _getVerificationFee(coinObj,args); coinObj.fee = fees.totalFee; coinObj.verifiedValue = round(value - fees.totalFee, 8); coinObj.variableFee = fees.variableFee; coinObj.var...
[ "_setVerifiedValue(coinObj, args) {\r\n //if (this.config.debug) console.log(\"WalletBF._setVerifiedValue\",coinObj);\r\n\r\n let value = Number.parseFloat(coinObj.v);\r\n coinObj.value = this._round(value, 8);\r\n \r\n let fees = this._getVerificationFee(coinObj,args);\r\n coinObj.fee = fees.tota...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }