query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Check for voteId in session or create a new session if one doesn't exist
function checkSession(req, res, voteId) { var session = req.session; if (!session) { res.contentType('json'); res.send({'msg': 'Something went terribly wrong. Try refreshing the page.'}); return false; } // Check if there's already an object for cast votes and create it ...
[ "touch (sessionId, session, callback) {\n\t\t\tlet now = new Date ();\n\t\t\tlet update = {\n\t\t\t\tupdatedAt: now\n\t\t\t};\n\n\t\t\tif (session && session.cookie && session.cookie.expires) {\n\t\t\t\tupdate.expiresAt = new Date (session.cookie.expires);\n\t\t\t} else {\n\t\t\t\tupdate.expiresAt = new Date (now.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return list of adjacent positions to p. if diagonal is true, diagonal adjacencies are also included
function adjacent(p, diagonal) { var list = []; var r=p[0]; var c=p[1]; list.push([r, (c+1)%block[0].length]); // right list.push([r, (c-1+block[0].length)%block[0].length]); // left list.push([(r+1)%block.length, c]); // down list.push([(r-1+block.length)%block.length, c]); // up if (diagonal) { list.push...
[ "getAdjacent(tile) {\n\t\t\n\t\tconst index = tile.getIndex();\n\t\t\n\t\tconst col = index % this.width;\n\t\tconst row = Math.floor(index / this.width);\n\n\t\tconst first_row = Math.max(0, row - 1);\n\t\tconst last_row = Math.min(this.height - 1, row + 1);\n\n\t\tconst first_col = Math.max(0, col - 1);\n\t\tcons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new help tooltip
function createHelpTooltip() { if (helpTooltipElement) { helpTooltipElement.parentNode.removeChild(helpTooltipElement); } helpTooltipElement = document.createElement('div'); helpTooltipElement.className = 'tooltip hidden'; helpTooltip = new ol.Overlay({ element: helpTooltipElement, ...
[ "function createTooltip(title, tiptext, parent) {\n let box = create(\"td\");\n let tooltip = create(\"a\");\n append(box, tooltip);\n tooltip.classList.add(\"tooltip\");\n appendText(tooltip, title);\n\n let tooltipText = create(\"span\");\n tooltipText.classList.add(\"tooltiptext\");\n\n appendText(toolti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests for `thisArg` argument.
function assertThisArg(thisArg, thisValue) { // In sloppy mode, `this` could be global object or a wrapper of `thisArg`. assertDeepEq(arr.filter(function(v) { assertDeepEq(this, thisValue); return v; }, thisArg), arr); // In strict mode, `this` strictly equals `t...
[ "function assertThisArg(thisArg, thisValue) {\n // In sloppy mode, `this` could be global object or a wrapper of `thisArg`.\n assertDeepEq(arr.map(function(v) {\n assertDeepEq(this, thisValue);\n return v;\n }, thisArg), arr);\n\n // In strict mode, `this` strictly ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Appends the given element ot the given parent.
function appendTo(el, parent){ parent.appendChild(el); }
[ "function addChild(parent, child, childElement) {\n (parent.nodes || parent).push(child);\n (parent.el || rootTreeElement).appendChild(childElement);\n child.parentElement = (parent.el || rootTreeElement);\n }", "function addChild(parent, child) {\n parent.appendChild(child);\n}", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses G/M/K suffixed string, returns number in MB
function parseMB(str) { var n = toNumber(str.slice(0, -1)); var u = str.slice(-1); switch (u.toUpperCase()) { case 'G': n = n * 1024; case 'M': n = n * 1024; case 'K': n = n * 1024; n = n / (1024 * 1024); n = Number(n.toPrecision(2)); break; ...
[ "function marketCapToNum(mcString) {\r\n if (!mcString) {\n return;\n }\r\n const suffix = mcString.charAt(mcString.length-1);\r\n let mcNum;\r\n switch(suffix) {\r\n // billions\r\n case \"B\":\r\n mcNum = Number(mcString.replace(\"B\", \"\")) * 1000000000;\r\n break;\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the spaces of the text and adds the delimiter the plus sign
function spaces(str) { var pos = str.indexOf(" "); var delStr = ""; if(pos >= 0) { for(var i = 0; str.length > i; ++i) { delStr += str[i].replace(/\s/, '+'); } return delStr; } else return str; }
[ "function makeSemicolonSeparated(text) {\n return text.replace(/[\\n]/g, ';');\n}", "function plusOut(str, word)\n{\n let result = \"\";\n let temp = \"\";\n let j = 0;\n for(let i = 0; i < str.length; i++){\n if(str.charAt(i) != word.charAt(j)){\n result = result + \"+\";\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pulls straight json if the firebase is open
function firebase_json_pull(url) { url = url || "https://shippy-ac235.firebaseio.com/DataTablesTest/Test3.json" l = $.ajax({ url: url, method: "GET", async: false, headers: { "Accept": "application/json; odata=verbose" } }) results = l.responseJSON ...
[ "function getDataFromFirebase(size){\n\t\tfirebase.storage().ref('test_files/' + size + '.json').getDownloadURL().then(function(url){\n\t\t\tconsole.log(url);\n\t\t\t$http.get(url).then(function(data){\n\t\t\t\tconsole.log(data);\n\t\t\t\t$scope.data = JSON.stringify(data.data, null, 4);\n\t\t\t});\n\t\t}).catch(fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve all the booked flights based on user
function getAllBookedFlights(userID){ return $q(function(resolve, reject){ $http({ method: 'GET', url: 'scripts/db/db.php', params: { q:'getAllBookedFlights', userID: userID } }) .then(function(data){ // Success resolve(data.data); }, func...
[ "_getFlightOffers() {\r\n const date = new Date()\r\n const year = date.getFullYear()\r\n const nextMonth = date.getMonth() + 2\r\n const rangeStart = `${year}${pad(nextMonth, 2)}01` // start with 1st of next month's current date\r\n const rangeEnd = `${year}${pad(nextMonth, 2)}10` // end with the 10...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
will add the calendarExtender to all inputs in the page
function addcalendarExtenderToDateInputs () { //get and loop all the input[type=date]s in the page that dont have "haveCal" class yet var dateInputs = document.querySelectorAll('input[type=date]:not(.haveCal)'); [].forEach.call(dateInputs, function (dateInput) { //call calendarExtender function on the input ...
[ "registerEvents() {\n\t\t\tthis.container = this.getContainer();\n\t\t\tthis.registerListEvents();\n\t\t\tthis.registerForm();\n\t\t}", "function initCal() {\n const cal = document.querySelector('#calendar');\n const datepicker = new Datepicker(cal, {\n autohide: true\n });\n \n cal.addEventListener('chan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================================================= / Q10 ============================================================================= Using closures create makeSafe Function that accepts an initial integer value to specify the storage size limit makeSafe should contain addItem function that ...
function makeSafe(intial){ var size=0; var limit=intial; var storage=""; function addItem(item,itemSize){ if(itemSize==="big") itemSize=3 else if(itemSize==="medium") itemSize=2; else if(itemSize==="small") itemSize=1; if(size+itemSize>limit) return "Can't fit"; ...
[ "function get_item_size() {\n var sz = 220;\n return sz;\n}", "function getItemBuyLimit(value) {\n switch (value){\n //BLINE - Bandos Line\n case \"bh\": return \"1/4\";\n case \"bcp\": return \"1/4\";\n case \"tass\": return \"1/4\";\n case \"bg\": return \"1/4\";\n case \"bb\": return \"1/4\";\n case ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Get InGame Odds Line Movement / / The GameID of an NHL game. GameIDs can be found in the Games API. Valid entries are 13096 or 13110
getInGameOddsLineMovementPromise(gameid){ var parameters = {}; parameters['gameid']=gameid; return this.GetPromise('/v3/nhl/odds/{format}/LiveGameOddsLineMovement/{gameid}', parameters); }
[ "getPeriodGameOddsLineMovementPromise(gameid){\n var parameters = {};\n parameters['gameid']=gameid;\n return this.GetPromise('/v3/nhl/odds/{format}/AlternateMarketGameOddsLineMovement/{gameid}', parameters);\n }", "async function getGameID(game_time,home_team_id, away_team_id){\n let res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch new generation and send it to canvasScript
async getNextGeneration() { const {i, nextGen} = await this.fetchNextGeneration(); canvasScript.displayNewGeneration(i, nextGen); }
[ "function updateGenerationCounter() {\n \t\t$('#generation span').html(++generation);\n \t}", "function create_generation(err, client, done, req, res) {\n if(err) {\n return console.error('error fetching client from pool', err);\n }\n var reqArr = [req.query.expID, req.query.parents, req.que...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inserts a new image into the image slider
addNewImageToSlider(idx) { let addedImagedata = this.images[idx]; let slide = '<div class="swiper-slide"><img src="' + addedImagedata + '" alt="Image"/></div>'; this.mySwiper.appendSlide(slide); }
[ "function insert () {\n var link = escape($('#redactor-redimage-link').val());\n var title = escape($('#redactor-redimage-title').val());\n\n this.insert.html('<img src=\"' + link + '\" alt=\"' + title + '\">');\n this.modal.close();\n }", "function add_image() {\n\tvar image_choice...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Import data from csv file
function import_data_from_csv() { fetch("input.csv") .then(v => v.text()) .then(data => init_table_from_data(data)) }
[ "function readCSV(data) {\n var dataLines = data.split('\\r\\n');\n\n for(var i = 1; i < dataLines.length; ++i) {\n if(dataLines[i] === '') continue;\n entries.push(new RawEntry(dataLines[i].split(',')));\n }\n}", "function loadCSVfile() {\n return axios.get(EXTERNAL_CSV_FILE)\n .then((res) => ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when the url has been set in storage. We'll just log success here.
function onSuccess() { print("Url set successfully"); }
[ "set_url (url) {\n this.url = url\n Cookies.set('url', this.url, { expires: this.EXPIRE_DAYS })\n }", "set imageURL(aValue) {\n this._logger.debug(\"imageURL[set]\");\n this._imageURL = aValue;\n }", "function StorageDelegate() {\n}", "function handle_storage(e){\n console.dir(e);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates all focus rings to reflect new location, color, style, or other changes. Enables observers to monitor what's focused.
updateFocusRings_() { if (SwitchAccess.mode === Mode.POINT_SCAN && !MenuManager.isMenuOpen()) { return; } const focusRings = Object.values(this.rings_); chrome.accessibilityPrivate.setFocusRings( focusRings, chrome.accessibilityPrivate.AssistiveTechnologyType.SWITCH_ACCESS); }
[ "_handleFocusChange() {\n this.__focused = this.contains(document.activeElement);\n }", "function updateFocusPoint(){\n\t\t\t/*-----------------------------------------*/\n\t\t\t// See note in setImage() function regarding these attribute assignments.\n\t\t\t//TLDR - You don't need them for this to work.\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update identity screen id.
UPDATE_IDENTITY_SCREEN_ID (_state, _screenId) { _state.identityScreenId = _screenId }
[ "UPDATE_STAGE_SCREEN_ID (_state, _screenId) {\n _state.stageScreenId = _screenId\n }", "function updateScreenName() {\n if (typeof settings.screenName === 'string' && settings.screenName.length) {\n ChatSocket.emit('screenname update', settings.screenName);\n }\n }", "function upda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
configForOvertime :: object > object
function configForOvertime(history) { const transformations = { remainingPossessions: add(secInGameOrOvertime('overtime', teamsSpeed)), overtime: T }; return evolve(transformations, history); }
[ "function setTimers(timeout)\n{\n // warning 5 mn before the end.\n setTimeout('showAlmostExpiredLock()',(timeout-5)*60000);\n setTimeout('showExpiredLock()',timeout*60000); \n}", "function OverwatchChecker (date) {\n this.date = null\n if(date !== undefined) {\n this.date = date\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a section by its anchor / index
function getSectionByAnchor(sectionAnchor){ var section = $(SECTION_SEL + '[data-anchor="'+sectionAnchor+'"]', container)[0]; if(!section){ var sectionIndex = typeof sectionAnchor !== 'undefined' ? sectionAnchor -1 : 0; section = $(SECTION_SEL)[sectionIndex]; ...
[ "function getSectionByAnchor(sectionAnchor){var section=$(SECTION_SEL+'[data-anchor=\"'+sectionAnchor+'\"]',container)[0];if(!section){var sectionIndex=typeof sectionAnchor!=='undefined'?sectionAnchor-1:0;section=$(SECTION_SEL)[sectionIndex];}return section;}", "function getSection( sectionPos ) {\r\n\t\treturn s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers an icon config by name in the specified namespace.
_addSvgIconConfig(namespace, iconName, config) { this._svgIconConfigs.set(iconKey(namespace, iconName), config); return this; }
[ "static register(namespace, name, value) {\n this.getNamespace(namespace)[name] = () => value\n }", "register(namespace, callback) {\n this.bindings[namespace] = callback;\n }", "institutionIcon(id) {\n return 'static/institutions/' + id + '.png'\n }", "_renderIcon () {\n let p = this._...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The function createShareButton creates a share button that will be added to all the memes
function createShareButton(memeId) { //Create an img element for the picture for the button var shareButton = document.createElement("img"); //Add the share button image to the img element shareButton.src = "link.png"; //Give a class name to the all the share buttons to style all the share buttons...
[ "function addSocialIcons(to) {\n const url = document.head.querySelector(\"[property='og:url'][content]\").content;\n const title = document.head.querySelector(\"[property='og:title'][content]\").content;\n let flURL = 'https://faithlife.com/share?content=' + encodeURIComponent(title) + '&url=' + encodeURI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fires okAction closure action if one exists and closes the dialog
okAction() { if (this.attrs.okAction) { get(this, 'okAction')(); } this.send('closeDialog'); }
[ "@action closeDialog() {\r\n\t\tif (this.dialog) this.dialog.opened = false;\r\n\t}", "_closeCreateProjectDialogClicked() {\n this.shadowRoot.getElementById(\"dialog-create-project\").close();\n\n // clear input field for project name in the dialog\n this.shadowRoot.getElementById(\"input-project-name\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Packet sequence for LeftAlt [unicode] combinaton
function LeftAlt(unicode) { var packet = asHIDPacket(4, 0) + asHIDPacket(4, 98) + asHIDPacket(4, 0); unicode.toString().split("").forEach(digit => { packet += asHIDPacket(4, [98, 89, 90, 91, 92, 93, 94, 95, 96, 97][parseInt(digit)]) + asHIDPacket(4, 0); }); packet += asHIDPacket(0, 0); return packet; }
[ "function ak2uy ( akstr )\n{\n var tstr = \"\" ;\n for ( i = 0 ; i < akstr.length ; i++ ) {\n code = akstr.charCodeAt(i) ;\n if ( code < BPAD || code >= BPAD + akmap.length ) {\n tstr = tstr + akstr.charAt(i) ; \n continue ;\n }\n\n code = code - BPAD ; \n\n if ( code < ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
quitInteraction Sets the alphas to 0 so that the interaction is quit.
quitInteraction() { this.r3a1_map.alpha = 0.0; this.r3a1_notebook.alpha = 0.0; this.hideActivities(); this.r3a1_activityLocked.alpha = 0.0; this.character.alpha = 1; this.r3a1_characterMoveable = true; //this.r3a1_activityOneOpened = false; //this.r3a1_activityTwoOpened = false; //th...
[ "function DDLightbarMenu_ClearAdditionalQuitKeys()\n{\n\tthis.additionalQuitKeys = \"\";\n}", "quit()\n\t{\n\t\t// stop game from listening for player input\n\t\tthis.input.shutdown();\n\n\t\t// blank screen\n\t\tthis.clearCanvas(\"#888\");\n\t}", "function setExit() {\n\tada$(shell.header.exitLink).onclick = f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function reduces inventory in Mysql database
function reduceItems(item, quantity) { connection.query("UPDATE products SET quantity = quantity -"+quantity+" WHERE id = "+item, function(err,res) { if (err) throw err; }) }
[ "function updateInventory(){\n console.log(\"updating inventory...\");\n debugLog += \"updating inventory... \"+ '\\n';\n for(var i = 0; i < soldItems.length; i++){\n var indexOfMatchingBarcodes = [];\n var matchFound = false;\n var sellingItem = soldItems[i];\n var sellingBarcode = sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints out the list of ranges in the range collection
print() { console.log(this.ranges.map(range => `[${range.toString()})`).join(' ')) }
[ "function printAnyRange(rangeStart, rangeStop) {\n let range;\n\n if (rangeStop > rangeStart) {\n range = printRange(rangeStart, rangeStop);\n } else {\n range = printRangeReversed(rangeStart, rangeStop);\n }\n return range;\n}", "function createRangeDescription() {\n if((!dual |...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
attempt to resume inprogress guides that may have stalled
function resumeGuide (guide) { if (guide.isInProgress() && !guide.isShown()) { for (let step of guide.steps) { if (!step.seenState || !step.seenState === 'advanced') { step.show(); } } } }
[ "resume() {\n this.paused_ = false;\n this.resetAutoAdvance_();\n }", "static resume() {\n TaskTimer._resolve_pause_lock();\n TaskTimer.paused = false;\n for (timer of TaskTimer.timers) timer.resume();\n }", "abort() {\n\n if (this.state !== 'WAITING') {\n if (this.pendingSegment_) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an input Array, loop backwards over the Array and print its values using console.log().
function printArrayValuesInReverse(array) { // YOUR CODE BELOW HERE // for (var i = array.length - 1; i > -1; i--) { //iterates through array backwards console.log(array[i]); //prints each value } // YOUR CODE ABOVE HERE // }
[ "function iterateArray(arr){\n for (var i = 0; i < arr.length; i++){\n console.log(arr[i]);\n }\n}", "function showArrayInformation(theArray) {\n for (let i = 0; i < theArray.length; i++) {\n console.log(theArray[i]);\n }\n}", "function logArray(array) {\n\t\tfor (let i = 0; i < array....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event handler function for when a date is clicked Will populate the field of a input with id 'fdate' with the value of the date button Will also load the time picker
function getVal(e) { //lert(document.getElementById(e.id).value); day = document.getElementById(e.id).value; var date = year +"/"+ (currPage + 1) + "/" + day ; document.getElementById("fdate").value = date; loadTimePicker(getTimesNotAvailableFor(date)); }
[ "function showDatePicker(field){\n \n // Get date picker\n \n let datePicker = $(field).siblings('.date-picker');\n \n // If date picker doesn't exist, create it\n \n if(datePicker.length == 0){\n \n // Create date picker\n \n datePicker = $('<table></table>');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show all toys created
function showToys(toyArray) { toyArray.map(function(toy) { newToy(toy) }) }
[ "function fetchAllToys() {\n fetch(`http://localhost:3000/toys`, {method: 'GET'})\n .then(responseObject => responseObject.json())\n .then(data => toyCollectionDiv.innerHTML = renderAllToys(data))\n}", "async function getAllToys() {\n let response = await fetch(toyBoxUrl);\n let data = await response.jso...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the logical AND between Series and other. Supports element wise operations and broadcasting.
and(other) { if (other === undefined) { throw new Error("Param Error: other cannot be undefined"); } const newValues = []; if (other instanceof Series) { if (this.dtypes[0] !== other.dtypes[0]) { throw new Error("Param Error must be of same dtype"); } if (this.shape[0]...
[ "function and(xs) {\n return xs.reduce((x,acc) => x && acc, true);\n}", "function and(a, b) {\n\treturn a && b;\n}", "or(other) {\n\n if (other === undefined) {\n throw new Error(\"Param Error: other cannot be undefined\");\n }\n const newValues = [];\n\n if (other instanceof Series) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the blobs coming from the capture logs activity to the current bug's attachments and render the attachment list.
function addActivityAttachments(blobs, names, picked) { blobs.forEach(function(blob, i) { if (picked.indexOf(names[i]) === -1) { return; } return pushAttachment(blob, names[i]); }); bugChanged(); }
[ "function inputChanged(e) {\n var files = e.target.files;\n var attachments = [];\n for (var i = 0; i < files.length; i++) {\n pushAttachment(files.item(i));\n }\n bugChanged();\n}", "function attachmentCallBack( filename, mimeType, attachment ) {\n\t\t\t\t\tvar ifrm = $('#message-iframe-'+ message.id)[0]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TW: Enable "packaged runtime" mode. This is a oneway operation.
convertToPackagedRuntime() { if (this.storage) { throw new Error('convertToPackagedRuntime must be called before attachStorage'); } this.isPackaged = true; }
[ "function toggleFreeze() {\n if (frozen) {\n frozen = false;\n } else {\n frozen = lastRenderMillis;\n }\n }", "SetCompatibleWithAnyPlatform() {}", "SetCompatibleWithPlatform() {}", "hatchRuntime() {\n logger.trace('hatching the runtime object')\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Global instant events are fat and easy to see. This function adds a big black global instant event.
function addGlobalInstantEvent(model, name, timestamp) { console.log("Adding instant event for ", timestamp); var e = new tr.model.InstantEvent("tti-experiment", name, tr.b.ColorScheme.getColorIdForReservedName("black"), timestamp); model.instantEvents.push(e); }
[ "_registerEvent () {}", "function addEvent(event) {\n allEvents.push(event);\n}", "function PushEvent() { }", "function globalTracker(event) {\n let tId = event.target.id;\n console.log('eventId=' + tId);\n let setting = dict.get(tId);\n if(setting != undefined) {\n let type = setting.type...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change the display to list or detailed view, and save the current view option to the cookie.
function changeDisplay(d) { if(d == "list") $("#projects-table").removeClass("detailed-view"); else $("#projects-table").addClass("detailed-view"); display = d; saveParamsToCookie(); }
[ "function setView(view) {\n\tSession.set(\"view\", view);\n}", "function switchToView(view) {\n // Hide all views before displaying the one its switching to\n welcome ? welcome.$el.hide() : false;\n setupAssistance ? setupAssistance.$el.hide() : false;\n customUrl ? customUrl.$el.hide() : fals...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This helper function provides the options for making get requests through reddit's oauth pathway params: req = the request Always needs an Access Token url = the url of the reddit api Ex: 'api/v1/me'
function getHelper(req, url) { var options = { method: 'get', url: 'https://oauth.reddit.com/' + url, headers: { 'User-Agent': 'YeetLight', Authorization: `bearer ${req.body.accessToken}` } } return options }
[ "function getTimelineRequestOptions(user, access_token) {\n\n var options = {\n hostname: 'api.twitter.com',\n path: '/1.1/statuses/user_timeline.json?screen_name=' + user +\n '&exclude_replies=true',\n headers: {\n Authorization: 'Bearer ' + access_token\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The countries are displayed after 1 second
function displayCountries() { setTimeout(function() { let html = ''; countries.forEach(function(country) { html += `<li>${country}</li>`; }); document.body.innerHTML = html; }, 1000 ); }
[ "function showContries(){\n setTimeout(function(){\n let html = '';\n countries.forEach(function(country){\n html += `<li>${country}</li>`;\n });\n document.getElementById('carrito').innerHTML = html;\n }, 1000);\n}", "function countryTimer() {\r\n countryElement.styl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The method will query the games DB for the team's upcoming games (If there are some).
async function getTeamUpcomingGames(team_id){ let games = [] const now = app_utils.formatDateTime(new Date()) const upcoming_games = await DButils.execQuery(`SELECT * From Games WHERE (AwayTeamID = ${team_id} OR HomeTeamID = ${team_id}) AND GameDateTime > '${now}' ORDER BY GameDateTime`); upcoming_games.map(...
[ "async function getAllPastGames(){\n const now = app_utils.formatDateTime(new Date())\n const past_games = await DButils.execQuery(`SELECT Games.gameid, Games.GameDateTime, Games.HomeTeam, Games.HomeTeamID,\n Games.AwayTeam, Games.AwayTeamID, Games.Stadium, Games.Referee, Games.Result\n FROM Games WHERE GameDat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The OAuth2 implicit grant flow (RFC 6749, section 4.2). In the implicit auth flow the client creates a new to get a new access token. Let's say the client has sent a request to UCWA and got a 401 in response: GET /contacts Host: webdir.tip.lync.com HTTP 401 WWWAuthenticate: Bearer authorization_uri=" The client needs a...
function Implicit(_a) { var xframe = _a.xframe, client_id = _a.client_id, oauth_uri = _a.oauth_uri, _b = _a.state, state = _b === void 0 ? random() : _b, context = _a.context, _c = _a.use_cwt, use_cwt = _c === void 0 ? true : _c, redirect_uri = _a.redirect_uri, _d = _a.document, document = _d === void 0...
[ "function getAuthorizationCode() {\n const UUID = uuidv4();\n const REDIRECT_URL = 'https://'+chrome.runtime.id+'.chromiumapp.org';\n const OAUTH_URL = 'https://app.intercom.io/a/oauth/connect?client_id='+CLIENT_ID+'&state='+UUID+'&redirect_uri='+REDIRECT_URL;\n console.log('opening OAuth window');\n chrome.id...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setting up random Notification
function randomNotification() { var randomItem = Math.floor(Math.random()*games.length); var notifTitle = games[randomItem].name; var notifBody = 'Created by '+games[randomItem].author+'.'; var notifImg = 'data/img/'+games[randomItem].slug+'.jpg'; var options = { body: notifBody, icon: notifImg } var notif =...
[ "function randomNotification() {\n\t/* var randomItem = Math.floor(Math.random()*games.length);\n\tvar notifTitle = games[randomItem].name;\n\tvar notifBody = 'Created by '+games[randomItem].author+'.';\n\tvar notifImg = 'data/img/'+games[randomItem].slug+'.jpg'; */\n\t\n\tvar notifTitle ='Ejemplo de noticifacion I...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
chkIntegerMaxValue ????????????????????? str????????????????????? val??????????????? ???????????? ??????????????????????????????????????????????????????????????????true ???????????????????????? ??????false ??????????????????????????????????????????????????????
function chkIntegerMaxValue(str,val) { if(typeof(val) != "string") val = val + ""; if(chkIsInteger(str) == true) { if(parseInt(str,10)<=parseInt(val,10)) return true; else return false; } else return false; }
[ "function bigint() {\n Swal.fire('Es un tipo de dato numerico que puede representar enteros cuyos digitos solo estan limitados por la memoria del sistema en el que se aloja el dato')\n}", "function chkIntegerMinValue(str,val)\r\n{\r\n\tif(typeof(val) != \"string\")\r\n\t\tval = val + \"\";\r\n\tif(chkIsInteger...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the range of ycoordinates that can be specified by a candidate position
function getYCoordinatesRange() { return (MAX_Y_COORDINATE - MIN_Y_COORDINATE); } // getYCoordinatesRange
[ "_validateYRange() {\n return this.currentYRange[1] >= this.currentYRange[0];\n }", "function getXCoordinatesRange() {\n return (MAX_X_COORDINATE - MIN_X_COORDINATE);\n } // getXCoordinatesRange", "function obstacleLocY() {\n var number = Math.floor(Math.random() * 5) + 1;\n if (number === 1) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return whether this Transaction is being sampled
isSampled() { return this._transaction.isSampled() }
[ "Exists() {\n return this.transaction != null;\n }", "function getIsSimulating() {\n \t return isSimulating;\n } // getIsSimulating", "isTakeoff() {\n return this.flightPhase === FLIGHT_PHASE.TAKEOFF;\n }", "isLocalOnHold() {\n if (this.state !== CallState.Connected) return false;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API for updating a postit
static async apiUpdatePostit(req, res, next) { try { const postitId = req.body._id; const title = req.body.title; const content = req.body.content; const deadline = req.body.deadline; const date = new Date(); const postitEditRes = await PostitsDAO.editPostit( postitId, ...
[ "async updateResearchPaper(id,researchPaper){\n const bearer = 'Bearer ' + localStorage.getItem('userToken');\n return await fetch(RESEARCH_PAPER_API_BASE_URI+\"/\"+id,{\n method:'PUT',\n headers:{\n 'content-Type':\"application/json\",\n 'Authorizat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attaches a text label to the specified root. Handles escape sequences.
function addTextLabel(root, node) { var domNode = root.append("text"); var lines = processEscapeSequences(node.label).split("\n"); for (var i = 0; i < lines.length; i++) { domNode.append("tspan").attr("xml:space", "preserve").attr("dy", "1em").attr("x", "1").text(lines[i]); } util.applyStyle(domNode, no...
[ "function setText(text) {\n svg.selectAll(\".label\").text(text);\n }", "function addOrUpdateTextLabel() {\n showModalDialog(\n Data.Edit.Node ? 'Update or delete text label' : 'Add a text label',\n true, Data.Edit.Node ? Data.Edit.Node.textContent : '',\n 'OK', function textModalOK() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the latest block of the chain
getLatestBlock() { return this.chain[this.chain.length - 1]; }
[ "async latestTxBlock() {\n return await this.baseJsonRpcRequest('GetLatestTxBlock');\n }", "function getNextBlock () {\n\n // ensure something to pull from\n fillBag();\n\n // take block from next pieces queue\n let nextBlock = nextPieces.pop();\n\n // ensure STILL something to pull from\n f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update current patient into racentview to show on dashbaord
function updateRecentViews(patientId) { var query = { patientid: patientId }; Patients.updateRecentViews().save(query, function () { }); }
[ "function updatePlantStatus(){\n\n}", "function updateRactives() {\n ractiveTitle.update();\n ractiveCategories.update();\n ractiveRisks.update();\n\tractiveGrades.update();\n\tractiveImpacts.update();\n ractiveRiskAssessment.update();\n ractiveSummary.update();\n ractiveResults.update();\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ajax call save available contact
function saveAvailableContact(){ var fd = $('#available-phone-data').serialize(); $.ajax({ url: siteUrl+"/saveUserPhoneAvailable", type: "POST", data: fd, beforeSend: function(){ $(".loading-process").show(); }, complete: function(){ $(".loading...
[ "function xxsetearContacto(data) {\n\t$('#contacto').val(data.intidcontacto);\n\t$('#telefono').val(data.strtelefono1);\n\t$('#correo').val(data.stremail);\n\t$('#area').val(data.strcampo1);\n}", "function fill_edit_contact_form(contact) {\n // console.log(contact);\n // set the values to modal form\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The element is shown
show() { this.element.style.visibility = ''; }
[ "function showAtag() {\n $item.find('a').filter(function (idx) {\n return !$(this).data('rolling');\n }).css('visibility', 'visible');\n }", "static showStuffs(stuff){\r\n\t\tstuff.style.display = \"block\";\r\n\t}", "function display() {\n\tif (queueclear) {\n\t\t$(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ajax get call the controller for the top performing pages
function top_performing_page_init() { //console.log('top performing page loaded'); var xmlhttp = new XMLHttpRequest(); var url = $('#ad-get-top-performing-pages-input').val(); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4 && xmlhtt...
[ "function changePageAction(page)\r\n{ \r\n //ajax show list request\r\n $('pageIndex').value = page;\r\n var url = UrlConfig.BaseUrl + '/ajax/search/keywordrank';\r\n new Ajax.Request(url, {\r\n parameters : {\r\n pageIndex : $F('pageIndex'),\r\n pageSize : CONST_DEFAULT_P...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method will create a new burger and insert it into the database. We pass it a callback to hold the results
create(cols, value, callBack) { orm.insertOne("burgers", cols, value, res => { callBack(res); }); }
[ "function insertBurger(event) {\n event.preventDefault();\n // if (!newItemInput.val().trim()) { return; }\n var burger = {\n burger_name: newItemInput\n .val()\n .trim(),\n devoured: false\n };\n\n // Posting the new burger, calling getBurgers when done\n $.post(\"/api/b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Slider image scale [change] handler
function _changeImageScale ( values, handle ) { changeScale.call( this, values, handle ); }
[ "function scale_changed() {\n\n var s = document.getElementById(\"scale_input\");\n //alert(\"slider value \" + s.value);\n\n var range = s.value / 100; // .25 - 2\n\n g_config.scale_factor = range;\n\n if (g_enableInstrumentation) {\n alert(\"scale_factor \" + g_config.scale_factor);\n }\n\n up...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find an element by id, by classname, by tagname or return null
function getEl(id) { return document.getElementById(id) || document.getElementsByClassName(id)[0] || document.getElementsByTagName(id)[0] || null; }
[ "function dom_elt_child_of_class(elt, a_class){\n for(let kid of elt.children){\n if (kid.classList.contains(a_class)) { return kid }\n }\n return null\n}", "function getFirstMatchingElementByClass(matchClass, elementTag) {\r\n var elems = document.getElementsByTagName(elementTag), i;\r\n for (i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pick the first defined of two or three arguments. dfl comes from default.
function dfl(a,b,c){switch(arguments.length){case 2:return a!=null?a:b;case 3:return a!=null?a:b!=null?b:c;default:throw new Error('Implement me');}}
[ "function gather_w_def(def = \"no args passed\", ...rest){ \n console.log(\"first value passed: \", def );\n console.log(\"remaining values: \", rest);\n}", "function firstDefined(){\n var undefined, i = -1;\n while (++i < arguments.length) {\n if (arguments[i] !== undefined) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates and returns labeled grid axes
function createAxes(rows, cols) { var axes = document.createElementNS(svgNs, 'g'); axes.setAttribute('id', 'vis-axes') //y-axis - rows for (var i = 0; i < rows; i++) { //calc placement var xLoc = 0; //constant var yLoc = i * rectSize; var label = document.createEleme...
[ "function createXAxis() {\n $(element + \" .xAxis\").css({\n \"grid-area\": \"3/3/4/4\",\n display: \"grid\",\n \"grid-template-columns\": \"repeat(\" + lenData + \",1fr)\",\n \"grid-template-rows\": \"1fr\",\n \"grid-column-gap\": defaultOptions.barSpacing,\n \"paddin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return an array of match in matchList
function getMatchList(matchList) { return matchList .map((element) => { const playerList = getPlayerList(element); return new Match(playerList, element.timestamp); }); }
[ "function newMatchesArray(array, match){\n let newArr = [];\n //loops through match array\n for(i = 0; i < match.length; i++){\n //pushes array item at the index into the array\n newArr.push(array[match[i]]);\n }\n return newArr;\n}", "function arrayMatch(array1, array2){ \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If there isn't an organizer property on the event, find who the organizer is and set it. If the property is set and false, there is no organizer.
function findEventOrganizer(event) { if (!event) { return; } var attendees = Utilities.getActiveAttendees(event), num = attendees && attendees.length, organizer = event.organizer; !num && (organizer = event.organizerIndex = event.organizer = false); ...
[ "get organizer()\n\t{\n\t\t//dump(\"get organizer: title:\"+this.title+\", value:\"+this._calEvent.organizer);\n\t\treturn this._calEvent.organizer;\n\t}", "function getOrganizer(attendees) {\n var count = attendees && attendees.length;\n\n if (count) {\n for (var i = 0; i < count; ++i) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reserved group id for ungrouped items This is the constructor of the LineGraph. It requires a Timeline body and options.
function LineGraph(body, options) { this.id = util.randomUUID(); this.body = body; this.defaultOptions = { yAxisOrientation: 'left', defaultGroup: 'default', sort: true, sampling: true, stack: false, graphHeight: '400px', shaded: { enabled: false, o...
[ "initGroup(){\n if(!this._shapeGroup){\n this.#createGroup();\n }\n }", "constructor(\n /// The node types in this group, by id.\n types) {\n this.types = types;\n for (let i = 0; i < types.length; i++)\n if (types[i].id != i)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a userId, returns a promise containing all users that have send or received a message from the authenticated user If userId does not exist in db or no 'friends' have been found, returns a promise containing null
getFriends(userId) { return this._getObjects( ( 'SELECT DISTINCT u.id, u.email, u.imgUrl FROM user u ' + 'JOIN message m1 ON u.id = m1.recipientId ' + 'JOIN message m2 ON u.id = m2.senderId ' + 'WHERE m1.senderId = :id AND m2.recipientId = :id' ), { id: userId } ); }
[ "async function getOtherUsersFavorites(userId){\n const query = \"SELECT DISTINCT b.bname AS 'Band' FROM Bands b JOIN Favorites f ON f.band_id = b.bid JOIN `User` u ON u.uid = f.uid WHERE u.uid IN (SELECT u.uid FROM `User` u2 JOIN Favorites f2 ON f2.uid = u2.uid JOIN Bands b2 ON b2.bid = f2.band_id WHERE u2....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds "_ptr" on to the end of type identifiers that might need it; note that this operats on identifiers, not definitions
function restorePtr(identifier) { return identifier.replace(/(?<=_(storage|memory|calldata))$/, "_ptr"); }
[ "function incrementPointer() {\n\tcode_string_pointer++;\n}", "static address(v) { return new Typed(_gaurd, \"address\", v); }", "function spliceLocation(definition, location) {\n debug(\"definition %O\", definition);\n return Object.assign(Object.assign({}, definition), { typeDescriptions: Object...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given cube coordinates, give center of cell in SVGspace
center(cell) { const {x, z} = cell instanceof Map ? cell.toJS() : cell; return { x: (x * HEX_WIDTH * 3/4), y: (z * HEX_HEIGHT) + (x * HEX_HEIGHT / 2) }; }
[ "function cellCenter(cell) {\n return { x: (cell.col + 0.5) * Tile.shapeSize, y: (cell.ln + 0.5) * Tile.shapeSize };\n}", "function cell_center(x, y){\n var cell_offset = cells[x][y].cell.getBoundingClientRect();\n var grid_offset = grid.getBoundingClientRect();\n\n var cx = cell_offset.left - grid_of...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setCalendarPref Helper to set an independant Calendar Preference, since I cannot use the calendar manager because of early initialization Problems.
function setCalendarPref(aCalendar, aPrefName, aPrefType, aPrefValue) { cal.setPref("calendar.google.calPrefs." + aCalendar.googleCalendarName + "." + aPrefName, aPrefValue, aPrefType); return aPrefValue; }
[ "function setCalendarAppts() {\n\n var data = getCalendarData();\n var columnHeaders = getColumnHeaders();\n\n // column headers \n var isCompleteColumnId = columnHeaders.indexOf(CONFIG_COLUMNS_DONE);\n var taskColumnId = columnHeaders.indexOf(CONFIG_COLUMNS_TASK);\n var dateColumnId = columnHeaders.indexOf(C...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method that logs in, fetches the public and private type indexes, and finally fetches the profile info
@action async login() { await this.auth.ensureLogin(this.selectedProvider); await this.storeCommunicator.fetchTypeIndexes(this.auth.webId); await this.profile.fetchProfileInfo(); }
[ "function mpLogIn() {\n mixpanel.identify(mixpanel.cookie.props.distinct_id)\n mixpanel.people.set({\"last page\":window.location.href});\n mixpanel.people.set_once({\"account created\":Date.now()});\n}", "async login() {\n try {\n const { accountName, permission, publicKey } = await th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the child compiler name e.g. 'htmlwebpackplugin for "index.html"'
function getCompilerName (context, filename) { var absolutePath = path.resolve(context, filename); var relativePath = path.relative(context, absolutePath); return 'html-webpack-plugin for "' + (absolutePath.length < relativePath.length ? absolutePath : relativePath) + '"'; }
[ "function componentize(name) {\n let dasherized = dasherize(name);\n return hasDash(dasherized) ? dasherized : `${dasherized}-app`;\n}", "function generateWebpackConfigForCanister(name, info) {\n if (typeof info.frontend !== 'object') {\n return;\n }\n const outputRoot = path.join(__dirname, output, name)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove all products from the session shopping cart
removeProducts() { var self = this; self.req.session.shoppingCart = []; return self.res.status(204).send(); }
[ "function deleteAllProducts() {\n API.deleteAll()\n .then(res => {\n loadProducts();\n })\n\n }", "function removeAllTheSameProducts(element) {\n element.closest('li.cart-item').remove();\n }", "function removeProduct(event) {\n const $target = $(event...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert hiddenTags entries to lower case if case sensitivity is off
function normalizeHiddenTags() { // new array for normalized tags globalprefs.hiddenTagsNormalized = []; // iterate through the tags to hide var len = globalprefs.hiddenTags.length; for (var i = 0; i < len; i++) { var newkey = globalprefs.hiddenTags[i]; // if matching not case sensitive, convert to lower ...
[ "function normalizeRenameTags() {\n\t// new dictionary for normalized tags\n\tglobalprefs.renameTagsNormalized = {};\n\t\n\t// iterate through the tags to rename\n\tfor (var key in globalprefs.renameTags) {\n\t\tvar newkey = key;\n\t\t\n\t\t// if matching not case sensitive, convert to lower case\n\t\tif (globalpre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This shows the search parameters used in a query
function showSearchParameters() { $('.searchParameters').html(` <h2 class="searchTerm">Search Term: ${searchResults.params.q}</h2> <p class="advSearch">Search Refined By</p> <ul> <li class="bull"><strong>Calories - </strong>${calValue}</li> <li class="bull"><strong>Max Number of Ing...
[ "function getSearchParams() {\n return { searchScript: optScript, searchTones: optTones };\n }", "function displayParams() {\n \"use strict\";\n const paramString = getQueryParamString();\n const span = document.getElementById(\"queryParamSpan\");\n\n span.textContent = paramString;\n}", "buildS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name of vaccine manufacturer.
get manufacturer () { return this._manufacturer; }
[ "function firstVoiceName() {\n if (result.V) {\n return result.V.split(/\\s+/)[0];\n } else {\n return '';\n }\n }", "set deviceName(value) {}", "parseName() {\n return ionMarkDown_1.Imd.MarkDownToHTML(this.details.artist) + \" - \" + ionMarkDown_1.Imd.MarkDownToHTML(this.details.titl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function generates the necessary private message string in order to be identified as a private message on the notifications page.
function generatePrivateMessage(userUID, message){ return userUID + "@#$:" + message; }
[ "function privateMessage(\n/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/\n /**\n * Message Information Object. */\n msginfo\n)\n/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/\n{\n var cont = msginfo.body;\n var nick = msginfo.nick;\n\n console....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called by page load event. Opens DB reference and displays contents of Messages table
function doPageLoad() { try { //Assign 2MB of space for the database console.log('doPageLoad'); var dbSize = 2 * 1024 * 1024; db = window.openDatabase("RecentDb1", "1.0", "Recent file database", dbSize, createTableOnNewDatabase); console.log(db); // // What ...
[ "function readMessages(callback){\n myDB.executeSql(\"SELECT id,phone,message,time,isSent FROM messages order by id desc\", [], function(resultSet) {\n console.log('Length: ' + resultSet.rows.length);\n var i=0;\n for (i = 0; i < resultSet.rows.length; i++) {\n var message = new Obje...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Performs 'processLine' for each line and aggregates its return boolean. When at the end of the file, if no problem was found then run 'noProblem'.
function mapLines(input, processLine, noProblem) { var remaining = ''; var problem = false; input.on('data', function(data) { remaining += data; var index = remaining.indexOf('\n'); while (index > -1) { var line = remaining.substring(0, index); remai...
[ "function ruleOne(lineNumber){\n var currentLine = document.getElementById('line'+lineNumber).value.trim();\n if (currentLine != \"(UQx)(x=x)\"){\n return false;\n }\n var citation = document.getElementById('cite'+lineNumber).value.trim();\n if (citation != \"\"){\n return false;\n }\n var premises = d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers the additional helper functions for Handlebars
function registerHelpers() { /*Creates a helper which checks if two given values are equal*/ Handlebars.registerHelper('equal', function (lvalue, rvalue, options) { if (arguments.length < 3) { throw new Error("Handlebars Helper equal needs 2 parameters"); } if (lvalue != rv...
[ "function gulpHandlebarsRegisterHelpers() {\n return through.obj(function(file, enc, callback) {\n if (file.isNull()) {\n this.push(null);\n callback();\n return;\n }\n \n if (file.isStream()) {\n this.emit(\"error\", new gulpUtil.PluginErro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the index of specified column index by the name of the column Parameter(s): String colname, name of the column Return: int index, index of the column
function getColIndexByName(colName, sheet) { var numColumns = sheet.getLastColumn(); // Get header row var row = sheet.getRange(1, 1, 1, numColumns).getValues(); // Index through the header row for (i in row[0]) { var name = row[0][i]; // Transverse down the row to each column if (name == colName)...
[ "columnIndex(name) {\n if (_.isNumber(name) && this.headers[name]) {\n return name;\n }\n const index = this._headers.indexOf(name);\n if (index === -1) {\n throw Error(`Table.columnIndex: no column named ${name}`);\n }\n return index;\n }", "getC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserlob_retention_clause.
visitLob_retention_clause(ctx) { return this.visitChildren(ctx); }
[ "visitTablespace_retention_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitModify_lob_storage_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitLob_storage_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitModify_lob_parameters(ctx) {\n\t return this.visitChildren(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Comprueba si existen las direcciones guardadas en el LocalStorage para luego guardarlas.
function SaveDir(NuevaDireccion){ var Direcciones = localStorage.getItem("Dir"); var Direc = new Array(); var flag; if( Direcciones != null && Direcciones != "" && Direcciones != false && Direcciones != undefined){ Direc = JSON.parse(localStorage['Dir']); console.log("Tamaño dire...
[ "function guardarCursoLocalStorage(curso){\n\t\tlet cursos;\n\t\t//toma el valor de un arreglo con datos de ls o vacio\n\t\tcursos = obtenerCursosLocalStorage();\n\t\t//el curso seleccionado se agrega el arreglo\t\n\t\tcursos.push(curso);\n\n\t\tlocalStorage.setItem('cursos', JSON.stringify(cursos));\n\n\t}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Description: Sets the app ID for the API search from the user input If the user enters a number, see the app ID to the input straight away Also, set the validSearch flag to true Otherwise, the user searched a game title. Find the game title in the appMap. If it finds one, set the corresponding appID Also set the validS...
function DetermineAppID(u_inp) { if (NameOrID(u_inp)) { if (appIDMap.has(parseInt(u_inp, 10))) { appID = u_inp; validSearch = true } else { validSearch = false } } else if (UpCase_NameMap.has(u_inp.toUpperCase())) { validSearch = true; ...
[ "function initializeApp() {\n // Load client ID & search app.\n loadConfiguration().then(function() {\n // Set API version to v1.\n gapi.config.update('cloudsearch.config/apiVersion', 'v1');\n\n // [START cloud_search_widget_register_adapter]\n var resultsContainerAdapter = new ResultsContainerAdapter...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: Many of the functions of NetworkStreamer and FileStreamer are similar or the same. Consolidate?
function NetworkStreamer(config) { config = config || {}; if (!config.chunkSize) config.chunkSize = Papa.RemoteChunkSize; var start = 0, fileSize = 0; var aggregate = ""; var partialLine = ""; var xhr, url, nextChunk, finishedWithEntireFile; var handle = new ParserHandle(copy(config)); handle.strea...
[ "EnumerateStreams() {\n\n }", "function stream_receiver(payload) {\n payload.m.forEach( ( msg, num ) => { \n streamary.push(msg);\n if (streamary.length > streamlim ) streamary.shift();\n } );\n }", "function sendFile() {\n // const peer = peerRef.current;\n // co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Turn Species name into PTT/ taper chart species code
function SpeciesToCode(species) { var speciesCode; switch(species){ case "DOUGLAS FIR": speciesCode = "DF"; break; case "PONDEROSA PINE": speciesCode = "WP"; break; case "WESTERN RED CEDAR": speciesCode = "WC"; break; case "JACK PINE": speciesCode = "JP...
[ "function CodeToSpecies(species) {\n var speciesCode;\n \n switch(species){\n case \"DF\":\n speciesCode = \"DOUGLAS FIR\";\n break;\n case \"WP\":\n speciesCode = \"PONDEROSA PINE\";\n break;\n case \"WC\":\n speciesCode = \"WESTERN RED CEDAR\";\n break; \n case \"JP\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates a browser window with or without node integration
function createWindow(nodeint) { return new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: nodeint } }); }
[ "function createNewCarWindow() {\n if (newCarWin) {\n return;\n }\n\n newCarWin = new BrowserWindow({width: 450, height: 400, webPreferences :{nodeIntegration : true}});\n newCarWin.loadFile(path.join('src', 'addCar.html'));\n\n // Listen when the window will be closed for destroy it\n newC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function count Total Bill of instant Order
function countTotalBill() { instantObj.orderDetailsObj.orderValue = instantObj.noOfTshirtMWI*13 + instantObj.noOfShirtMWI*13 + instantObj.noOfJeansMWI*16 + instantObj.noOfTrouserMWI*13 + instantObj.noOfLungiDhotiMWI*16 + instantObj.noOfSuitsBlazerMWI*31 + instantObj.noOfKurtaMWI*19 + instantObj.noOfTshirt...
[ "totalBill() {\n let billclass = this;\n _.map(this.diners, function(index) {\n let indvTotal = index.total + index.tax + index.tip;\n billclass.tBill.push(indvTotal);\n });\n billclass.tBill = _.sum(billclass.tBill);\n }", "function obtenTotalInvitados(){\r\n\t\tvar tablaLength = obtenTabl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function adds .inputvalidityvisible to each input element if value is empty
function showInputValidity(elements){ elements.forEach( element => { element.classList.add("input--validity-visible"); }); }
[ "function validarSeleccion(input,output){\n if (input.value == \"\" ){\n output.text(\" * Escoja una opcion\");// mensaje de error\n output.css(\"visibility\", \"visible\");\n return false;\n }\n else{\n output.css(\"visibility\", \"hidden\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets the light position
setLightPos(lightPos) { this.setUniform("uLightPos" + this.id, lightPos); this.lightPos = lightPos; }
[ "function setupLight(){\r\n\r\n\t//an ambient light for \"basic\" illumination\r\n\tambientLight = new THREE.AmbientLight( 0x444444 );\r\n\tscene.add( ambientLight );\r\n\r\n\t//a directional light for some nicer additional illumination\r\n\tdirectionalLight = new THREE.DirectionalLight( 0xffeedd );\r\n\tdirectiona...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a test clip container from a tick, a length, and an array of subclips
function createTestContainer(tick, length, subclips) { return { "_id": "[container]", "asset_id": "[container]", "project_id": "test", "trim": {"left": 0, "right": 0}, "tick": tick, "length": length, "track": 0, "subclips": subclips }; }
[ "createSliceSize() {\n if (this.frames % 420 === 0) {\n let Sy = 0\n let SminGap = 0\n let SmaxGap = this.canvasSize.w - 30\n let SGap = Math.floor(Math.random() * (SmaxGap - SminGap + 1) + SminGap)\n this.sliceSize.push(new Slicebar(this.ctx, SGap, Sy, 35, 94, '....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all data from JSON Server and update the states 'list' and 'filter', so UserForm just handle these states without access the server again.
getUsers(){ axios.get(_URL).then(resp => this.setState({list: resp.data, filter: resp.data})); }
[ "function gettingJasonMembersObj(event) {\n const savedMembers = JSON.parse(event.target.responseText);\n appData.members = savedMembers.members\n jsonsState.push('true');\n addLabelColors();\n //checking only two since i have only 2 AJAX calls\n checkIfCanLoadPage();\n // firstLoad();\n\n //\n // firstLoa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Props: allUnits (boolean): if true, it will receive the header for all units unitNumber (string): biggest and first text in the header, it'll receive the unit number unitName (string): name of this unit numOfUnits (number): number of units initialDate (date): initial date for the query finalDate (date of false): final ...
render() { let { allUnits, unitNumber, unitName, numOfUnits, initialDate, finalDate, typeOfUnit, handleNewSearch, oneMonth, children } = this.props; if (initialDate && initialDate.length === 7) initialDate = dateWithFourDigits(initialDate); ...
[ "function getUserUnit() {\n let userUnit = document.getElementById('units');\n unit = userUnit.value;\n}", "function game_find_unit_by_number(id)\n{\n return units[id];\n}", "function DisplayUnit(i) {\n if(typeof i === \"object\"){\n i = u.GetNumber(event.target.id);\n }\n if (u.ID(`selec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a button name and a calculator data object, return an updated calculator data object. Calculator data object contains: total:s the running total next:String the next number to be operated on with the total operation:String +, , etc.
function calculate(obj, buttonName) { if (buttonName === 'AC') { return { total: 0, next: '', operation: '' }; } if (isNumber(buttonName)) { if (buttonName === '0' && obj.next === '0') { return {}; } // If there is an operation, update next if (obj.operation) { ...
[ "function onEqualClick() {\n if (changeLastNum) {\n calculations.pop()\n }\n calculations.push(parseFloat(display));\n let ans = calculateCalculations();\n let result = typeof ans;\n display = String(ans);\n if (result == \"number\") {\n let calc = calculations.toString();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles mouse position and draws ball to display this information visually
function MouseControlBall(x, y, w, h) { this.x = x; this.y = y; this.width = w; this.height = h; this.display = function() { if(mouseX > mouseControlWin.x && mouseX < mouseControlWin.x + mouseControlWin.width && mouseY > mouseControlWin.y && mouseY < mouseControlWin.y + mouseControlWin.height) { th...
[ "drawBall() {\n fill('#FFFFFF');\n circle(this.x, this.y, 2 * this.radius);\n }", "function displayBall() {\n rect(ball.x, ball.y, ball.size, ball.size);\n}", "function draw() {\n background(bg);\n \n drawBall();\n drawLPaddle();\n drawRPaddle();\n ballCollision();\n rPaddleCollisio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for deleteV3ProjectsIdHooksHookId
deleteV3ProjectsIdHooksHookId(incomingOptions, cb) { const Gitlab = require('./dist'); let defaultClient = Gitlab.ApiClient.instance; // Configure API key authorization: private_token_header let private_token_header = defaultClient.authentications['private_token_header']; private_token_header.apiKey = 'YOUR...
[ "deleteV3HooksId(incomingOptions, cb) {\n const Gitlab = require('./dist');\nlet defaultClient = Gitlab.ApiClient.instance;\n// Configure API key authorization: private_token_header\nlet private_token_header = defaultClient.authentications['private_token_header'];\nprivate_token_header.apiKey = 'YOUR API...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ensure that the git working directory is clean.
function ensureGitClean(done) { git.status(function(err, out) { if (err) { throw err; } if (!/working directory clean/.exec(out)) { throw new Error('Git working directory not clean, will not bump version'); } }); done(); }
[ "function cleanBuild() {\n if (!cleaned) {\n cleaned = true;\n clearTimeout(cleanTimeout);\n if (app.config.get('auto-cleanup') !== false) {\n console.log('Removing: ' + dir);\n exec('rm -rf ' + dir, function (rerr) {\n //\n // Ignore errors removing...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funcion utilizada para eliminar consolidaciones seleccionadas
function eliminarConsolidacionesSeleccionadas() { var lstCheckBox = $('.chkSeleccion'); var lstSeleccionados = new Array(); var strItemSeleccionados = ","; for (var i = 0; i < lstCheckBox.length; i++) { if ($(lstCheckBox[i]).prop('checked') == true) { lstSeleccionados.push(lstCheckBo...
[ "function accionEliminar()\t{\n\t\tvar arr = new Array();\n\t\tarr = listado1.codSeleccionados();\n\t\teliminarFilas(arr,\"DTOEliminarMatricesDescuento\", mipgndo, 'resultadoOperacionMsgPersonalizado(datos)');\n\t}", "function removerItem(index) {\n const finded = selecionados.indexOf(index);\n if (finded !== -...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Queries specified MongoDB collection for one documet and logs results logs confirmation for database connection logs queried collection name logs single document if successful
async getSingleDoc(mongoUri, dbName, coll) { const client = await MongoClient.connect(mongoUri, { useNewUrlParser: true}); const doc = await client.db(dbName).collection(coll).find().toArray().then(docs => docs[0]); logger.collectionSingle(doc, dbName, coll); client.close(); }
[ "function findCollectionByX(collection, criteria, callback) {\n connectToDb(function onConnect(err, db) {\n if (err) {\n callback(err);\n } else {\n db.collection(collection).find(criteria).toArray(function onResult(err2, data) {\n db.close();\n callback(err2, data);\n });\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
transforms the object according to the user input ( translation, rotation, scale )
transform ( translationVector, theta, axis, scalingVector ) { modelViewMatrix = mat4.create(); mat4.lookAt( modelViewMatrix, eye, at, up ); var ctm = mat4.create(); var q = quat.create(); if ( axis === "X" ) { mat4.fromRotationTranslationScale( ctm,...
[ "function transformation(objects, matrix, scaleRadius=false) {\r\n objects.forEach(item => {\r\n switch(item.type) {\r\n case \"line\":\r\n transform(item, \"p1x\", \"p1y\", matrix);\r\n transform(item, \"p2x\", \"p2y\", matrix);\r\n break;\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Class iglooPast sets up iglooHist
function iglooPast () { //Temporary- overwritten on a new diff load this.pageTitle = ''; this.hist = null; //Receives info for new diff var me = this; igloo.hookEvent('history', 'new-diff', function (data) { me.pageTitle = data.pageTitle; me.hist = new iglooHist(data.pageTitle); }); this.buildInterface = ...
[ "function History(){}", "function initalhistory(){\n\tgetHistory();\n\tclearInterval(inithis);\n}", "function iglooArchive () {\n\tthis.archives = [];\n\tthis.archivePosition = 0;\n\tthis.canAddtoArchives = true;\n\n\tthis.buildInterface = function () {\n\t\tvar backButton = document.createElement('div'),\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iterates through reviews and counts based on the year/month that they were posted
getReviewCountByMonth() { const reviewCountByMonth = {}; reviewStore.reviews.forEach((review) => { const [year, month] = getTimeInfo(review.reviewTime); // Check if reviews includes a year key if (!Object.keys(reviewCountByMonth).includes(year)){ rev...
[ "getReviewCountByYear() {\n const reviewCountByYear = {};\n\n reviewStore.reviews.forEach((review) => {\n const [year] = getTimeInfo(review.reviewTime);\n\n // Check if reviews includes a year key\n if (!Object.keys(reviewCountByYear).includes(year)){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by Java9ParserlabeledStatementNoShortIf.
enterLabeledStatementNoShortIf(ctx) { }
[ "exitLabeledStatementNoShortIf(ctx) {\n\t}", "enterStatementNoShortIf(ctx) {\n\t}", "enterIfThenElseStatementNoShortIf(ctx) {\n\t}", "exitStatementNoShortIf(ctx) {\n\t}", "enterBasicForStatementNoShortIf(ctx) {\n\t}", "exitIfThenElseStatementNoShortIf(ctx) {\n\t}", "enterWhileStatementNoShortIf(ctx) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Marks a cloze word in view mode. Returns NOT_ATTEMPTED, CORRECT, or WRONG
function checkAndMarkClozeWord(ele) { var result = checkClozeWord(ele); if (result != '') { markClozeWord(ele, CORRECT); ele.value = result; return CORRECT; } else if (!ele.value) { markClozeWord(ele, NOT_ATTEMPTED); return NOT_ATTEMPTED; } else { markCloz...
[ "function canPlace() {\r\n var pos = getLocation(parameters.openLocations[parameters.choice]);\r\n for (length = 0; length < parameters.word.length; length++) {\r\n if (alphabetSoup[pos.row][pos.col] !== 0 && alphabetSoup[pos.row][pos.col] !== parameters.word[length]) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to implement a commonPreLoad depending on the dataStore state INITIAL > Go to login page, which will query server info and find out if login is required REQUIRE_LOGIN > Go to login page and prompt user to log in LOGGED_IN > Go to requested page
function commonPreLoad (to, from, next) { if ((globalStore.getters.datastoreState === 'LOGGED_IN') || (globalStore.getters.datastoreState === 'LOGGED_IN_SERVERDATA_LOADED')) { next() return } next({ path: '/login', query: { redirect: to.fullPath } }) }
[ "function loadLoginData () {\n let savedUsername = config.get('username')\n let savedPassword = config.get('password')\n let savedRememberUsername = config.get('rememberUsername')\n let savedRememberPassword = config.get('rememberPassword')\n\n document.querySelector('#login-remember-name').checked = savedReme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Editing Card requires front and back key, as well as the updateCard utility API call
function editCard({ signal }) { const newCard = { ...objToModify, front: formData.front, back: formData.back, }; updateCard(newCard, signal).then(() => updateDecks(signal)); }
[ "function editCard(card_id) {\n // console.log(\"id received\" + card_id);\n loadValues(card_id);\n}", "function handle_cm_edit_payment_card(req, startTime, apiName, cardExpandBoxId, index) {\n this.req = req; this.startTime = startTime; this.apiName = apiName; this.cardExpandBoxId = cardExpandBoxI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CREATE : BOTTOM ICONS
function Create_Bottom_Icons () { var bottom_bar = document.getElementById("bottom_bar") var buttom_btns = document.createElement("div") buttom_btns.className = "" buttom_btns.setAttribute("id", "llama_btm_bar") buttom_btns.setAttribute("title", "llama_btm_bar") buttom_btns.innerHTML = ` <label class="butto...
[ "function createPanel( pw, ph, director ){\n\t\tdashBG = new CAAT.Foundation.ActorContainer().\n\t\t\t\t\tsetPreferredSize( pw, ph ).\n\t\t\t\t\tsetBounds( 0, 0, pw, ph ).\n\t\t\t\t\tsetClip(false);\n\n \n\t\t//create bottom panel\n\t\tfor(var i=0;i<dashBoardEle.length;i++){\n\t\t\tvar oActor = game.__addImage...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }