query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Dynamically generate(Reverse Order) Todo Tasks List using todoList.
function generateTasksList() { var finalData = ""; if (tasksList.length === 0) { finalData += "<span class='item_list_empty'>No Data Found</span>"; } else { tasksList.slice(0).reverse().map((val, index) => { finalData += "<div class='item_container'>"; finalData += (...
[ "function refreshTodoList() {\n // Clean task list.\n var list = document.getElementById(\"myToDoList\");\n var entries = list.getElementsByTagName(\"LI\");\n while (entries.length > 0) {\n list.removeChild(entries[0]);\n }\n //Create task list.\n getAllTasks();\n}", "function createListTasks(tasks) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add info for main nav
function OsNavAdditionInfo() { $('.os-menu a[href="#"]').on('click', function (event) { event.preventDefault(); }); $('.os-menu li').has('ul').addClass('li-node').parent().addClass('ul-node'); //$('.os-menu .mega-menu:not(.menu-fullwidth)').parent().css('position', 'rela...
[ "function NavData() {\n }", "updateNavDetail(info) {\n var navSection = this._nodeContent.querySelector('.navigation');\n\n if (!navSection) {\n return false;\n }\n var content = '';\n if (info.prevId) {\n //content = '<a class=\"pull-left\" data-id=\"' ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Leave book success page
function leaveBookSuccess() { localStorage.removeItem("bookedRoom"); }
[ "function leaveBooking() {\n if (localStorage.getItem(\"bookingRoom\")) {\n localStorage.removeItem(\"bookingRoom\");\n }\n // return \"Leaving booking page !\";\n}", "function onClickSubmitBtn() {\n //validate form\n let validation = isDataValid(inputs);\n if (validation.isValid) {\n hideEr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CLEAR LOGIC Clear items Button show/hide
function clearBtnToggle(){ if(groceryItem.innerHTML == ''){ clearBtn.style.display = 'none' }else{ clearBtn.style.display = 'block' } }
[ "function HideAllClearButtons() {\n //\n // Clear filter choices for each property group where \n // 'Clear' button is shown\n //\n ClearCtrlSelectionMap(); // clear control selections\n for (var sPropId in gMapPropIdToBtnClearStatus) {\n if (gMapPropIdToBtnClearStatus[sPropId] === true) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
View fullscreen video in landscape mobile view.
function video_in_landscape_mode() { if ((!isPortrait()) && (WURFL.form_factor == "Smartphone" && screen.width < 768)) { $.confirm({ text: "Want to view in Fullscreen ?", confirm: function() { if (BigScreen.enabled) { var iframe = document.getElementById('vide...
[ "function openFullscreen() {\n if ($video.requestvideo) {\n $video.requestFullscreen();\n } else if ($video.webkitRequestFullscreen) { /* Safari */\n $video.webkitRequestFullscreen();\n } else if ($video.msRequestFullscreen) { /* IE11 */\n $video.msRequestFullscreen();\n }\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
==== templates ==== Reinforcements template
function twcheese_Reinforcements() { this.troops = new Array(0,0,0,0,0,0,0,0,0,0,0,0); this.village = new Array(0,0,0); }
[ "function GFS_P_Reinforce() {\n\tGFS_Playing.call(this);\n\tthis.id = GFS_P_Reinforce.id;\n\tthis.name = 'reinforcement phase';\n\tthis.eventHandler = function(gameMessage) {\n\t\tif(gameMessage instanceof GE_P_Reinforced) {\n\t\t\t// remove traded cards if any\n\t\t\tfor(var i=0; i<gameMessage.trade.length; i++) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Have you heard about the myth that if you fold a paper enough times, you can reach the moon with it? Sure you do, but exactly how many? Maybe it's time to write a program to figure it out. You know that a piece of paper has a thickness of 0.0001m. Given distance in units of meters, calculate how many times you have to ...
function foldTo(distance) { let paperSize = 0.0001 let paperFold = 0; while(paperSize < distance && distance != 0){ paperSize *= 2 paperFold ++; } if (distance <0) { return null; } return paperFold; }
[ "function foldTo(distance){\n if(distance < 0) return null;\n let thickness = 0.0001, count = 0;\n while(thickness < distance){\n count++;\n thickness *= 2;\n }\n return count;\n}", "function foldDistance(distance) {\n let paper = 0.0001\n let tracker = 0;\n while (paper < distance...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends the client's player info to the server
sendPlayerInfo(){ var player = { dataType: dataTypes.PLAYER, playerID: this.player.playerID, posX: this.player.position.x, posY: this.player.position.y, rotation: this.player.rot, hp: this.player.actualHp, weapon: this.player.weapon, dead: this.player.dead, }; player = JSON.strin...
[ "function sendPlayerInfo() {\n\n var res = {};\n res['remotePlayers'] = [];\n for (var key in CONNECTS) {\n if ('pcoords' in CONNECTS[key]) {\n CONNECTS[key]['pcoords']['score'] = CONNECTS[key]['score']; // add score to pcoords record (gets erased on pcoords updates)\n res['rem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate Sheeps and Rams
function calculateGuessResult(guess) { var result = { sheep: 0, ram: 0 }; for (var i = 0; i < 4; i++) { var currentGuessNumber = guess[i], indexInSecretNumber = secretNumber.indexOf(currentGuessNumber); if (indexInSecretNumber > -...
[ "function silvermanRule(len, ssd, iqr) {\n var a = Math.min(ssd, iqr / 1.349);\n return 1.059 * a * Math.pow(len, -0.2);\n }", "function silvermanRule(len, ssd, iqr) {\n var a = Math.min(ssd, iqr / 1.349);\n return 1.059 * a * Math.pow(len, -0.2);\n}", "function Ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches anomaly regions for metrics
function fetchRegions() { return (dispatch, getState) => { const store = getState(); const { primaryMetricId, relatedMetricIds, filters, currentStart, currentEnd } = store.primaryMetric; const metricIds = [primaryMetricId, ...relatedMetricIds].join(','); // todo: id...
[ "refreshAnomalyTable() {\n const { anomalyIds, exploreDimensions } = this.currentModel;\n if (anomalyIds && anomalyIds.length) {\n get(this, 'loadAnomalyData').perform(anomalyIds, exploreDimensions);\n }\n }", "favorite_region_stats() {}", "static async _injectRegions(event) {\n try ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selects records based on arguements, return the result as args in the callback func
function selectRecords(tblname, cols, callback) { var output = ""; var sqlQuery = `SELECT ${cols} FROM ${tblname}`; db.transaction((trans) => { trans.executeSql(sqlQuery, [], (trans, res) => { callback(res); }); }) }
[ "function onGetAllSuccess_GetResponseFromDatabaseWhereClause(records){\n isSuccess = true;\n ReturnRecords = (records);\n}", "getRecords(options, callback) {\n this.getMultiple(recordsTable)(options, callback);\n }", "function select(arr, callback) {\n var result = [];\n\n for (var i = 0; i < arr.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates date in state to 7 days from current date in state
getNextWeek(){ let date = this.state.date; const nextWeek = new Date(date.getTime() + (7 * 24 * 60 * 60 * 1000)); this.setState({date: nextWeek}) }
[ "incrementDate(){\n\n dateSetter += 7\n \n this.setState({\n weeks:[<i class=\"material-icons \">keyboard_arrow_left</i>,setLastWeek('DD-MM'), setWeek('DD-MM'), setNextWeek('DD-MM'),<i className=\"material-icons \">keyboard_arrow_right</i>]\n \n })\n }", "decrementDate(){\n\n dateSet...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Message reciver for the message sent from other clients. this method performs actions according to the received msgType
function onMessageRecieved(who, msgType, content) { switch(msgType) { case "telepointer_info": updateTelepointer(content); break; case "inform_my_details_to_all_other_clients": addNewClientToAllOccupantsDetails(content); updateOnlineStatusOfClients(al...
[ "function onMessageRecieved(who, msgType, content) {\n\n switch(msgType) {\n case \"telepointer_info\":\n updateTelepointer(content);\n break;\n case \"inform_my_details_to_all_other_clients\":\n addNewClientToAllOccupantsDetails(content);\n updateOnlineS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove connection from the model.
delete() { const source = internal(this).source; const model = internal(source).model; internal(model).connections.remove(this); }
[ "function removeConnection(){\n\n // just active, when mode is \"del\"\n if( $els.container.data('mode') != 'del' ) {\n return;\n }\n\n // remove connection\n $(this).remove();\n }", "handleRemoveConnection() {\n\n let connection = this.getInstance().getActiveConnection();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a ConsentPolicy resource
static get __resourceType() { return 'ConsentPolicy'; }
[ "get policy() {\n return this.getStringAttribute('policy');\n }", "generateDefaultPolicy_() {\n // Generate default policy\n const instanceKeys = Object.keys(this.consentConfig_);\n const defaultWaitForItems = {};\n for (let i = 0; i < instanceKeys.length; i++) {\n // TODO: Need to supp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a path to the project, finds all specs returns list of specs with respect to the project root
static findSpecs (projectRoot, specPattern) { debug('finding specs for project %s', projectRoot) la(check.unemptyString(projectRoot), 'missing project path', projectRoot) la(check.maybe.unemptyString(specPattern), 'invalid spec pattern', specPattern) // if we have a spec pattern if (specPattern) { ...
[ "function getSpecFiles() {\n\n var fs = require('fs');\n var all_files = [];\n var files = [];\n\n all_files = fs.readdirSync('./specs');\n all_files.forEach(function (file) {\n if (file.indexOf('.spec.js') > 0)\n files.push(file);\n })\n\n return files;\n}", "async function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns all the tags with given text
function tags(text) { return $board.$(".tag").filter(function () { return $(this).text().toLowerCase() == text.toLowerCase(); }); }
[ "function tags(text) {\n return $board.find(TAG).filter(function () {\n return $(this).text().toLowerCase() == text.toLowerCase();\n });\n}", "function findAllTextNodesWithText(el, text) {\n var n;\n const results = [];\n const walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an onSuggestSelect callback passing label (place name) and location (place coordinates) from the suggest parameter. Pass label and location to the setLocation callback on the component via the onSuggest prop Clear input after selecting suggest
onSuggestSelect({ label, location }) { this.props.onSuggest(label, location); this._geoSuggest.clear(); }
[ "function autoCompleteListener(textBox, suggest, flag) {\n if (query != textBox.value) {\n if (textBox.value.length) {\n var atPosition;\n if (pickLocation) {\n atPosition = pickLocation;\n } else {\n atPosition = myPosition;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns how many times date occurs in the objects of myArray
function searchDate(keyDate, myArray){ var count = 0; for (var i=0; i < myArray.length; i++) { if (myArray[i].date.getFullYear() == keyDate.getFullYear() && myArray[i].date.getMonth() == keyDate.getMonth() && myArray[i].date.getDate() == k...
[ "function count(array) {\n\treturn d3.keys(array).length;\n}", "function getNumOnDay(entries, day) {\n var entriesAtDate = 0;\n entries.map((entry) => {\n if(entry.date === day.dateString)\n entriesAtDate++;\n })\n return entriesAtDate;\n }", "function countPerDay(data) {\n let numbe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SetDatePickers Initiate the Flatpickr date pickers.
function setDatePickers(filter_id, datePickers) { if (!datePickers) { return false; } // Loop all datepickers [].concat(_toConsumableArray(datePickers)).forEach(function (datePicker, e) { var mode = datePicker.dataset.displayMode ? datePicker.dataset.displayMode : 'single'; var display_format = datePicker.d...
[ "function initDatePickers() {\n\tvar pickerSettings = {\n\t\tdateFormat: \"dd.mm.yy\",\n\t\tmaxDate: \"+0d\"\n\t};\n\n\t$( \"#datepickerFrom\" ).datepicker(pickerSettings);\n\t$( \"#datepickerTo\" ).datepicker(pickerSettings);\n}", "function setupPickers() {\n // Setup pickers\n var dateObject = new Date();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert given GraphQL PriceRange object into data structure as defined by the sling model.
_convertPriceToRange(range) { let price = {}; price.productType = range.__typename; price.currency = range.minimum_price.final_price.currency; price.regularPrice = range.minimum_price.regular_price.value; price.finalPrice = range.minimum_price.final_price.value; price.dis...
[ "function fromRange(range) {\n const sliderValue = {};\n if (_.has(range, 'gte')) {\n sliderValue.min = _.get(range, 'gte');\n }\n if (_.has(range, 'gt')) {\n sliderValue.min = _.get(range, 'gt');\n }\n if (_.has(range, 'lte')) {\n sliderValue.max = _.get(range, 'lte');\n }\n if (_.has(range, 'lt')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Animation du bouton rotatif
function animBtnRot(e) { console.clear(); e.preventDefault(); /************dimensions du bouton ***************/ var btnHeight = parseInt(getComputedStyle(divBtn).height); var btnWidth = parseInt(getComputedStyle(divBtn).width); /************coordonnées du bouton ***************/ var xBtn = ...
[ "setupRotateAnimation() {\n let animation = new BABYLON.Animation('rotate', 'rotation.y', 60, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\n const keys = [\n {\n frame: 0,\n value: 0\n },\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
====================== Function align selected object to top ========================
function alignTop (){ var selectedGr = canvas.getActiveGroup(); if (!selectedGr) return; var pointC = new fabric.Point(0,0); var deltaY = 0; var firstObjH = 0; var coordY1 = 0; var coordY2 = 0; i=0; selectedGr.forEachObject(function(obj) { i++; obj.setOriginX('left'); obj.setOrigi...
[ "function vAlignTop(key,otherObjects)\n{\n\tvar kp = key.top;\n\n\tfor(var x=0;x<otherObjects.length;x++)\n\t{\n\t\totherObjects[x].top = kp;\n\t}\n}", "function alignTop(objects) {\nvar boundingEdge;\n//calculate top edge position of first object\n\t\n\tif(objects[0].hasOwnProperty(\"origin\")){\n\t\t\n\t\tif ( ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Map through all recipes, and replace the method of recipe with the specified id
editMethod(id, updatedMethod) { this.recipes = this.recipes.map((recipe) => recipe.id === id ? { id: recipe.id, method: updatedMethod } : recipe ); // commits changes to local storage this._commit(this.recipes); }
[ "function updateRecipe(myId,plus){\n allData.forEach(item => {\n if(item.id == myId){\n changeIngredient(item.ingredients,plus);\n }\n });\n}", "function setRecipeID(id) {\r\n setID(id);\r\n }", "function handleRecipeChange(id, recipe) {\n //duplicate the old recipe array s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add a admin object to the blockchain state identifited by the adminId
async RegisterAdmin(stub, adminId) { let admin = { id: adminId, type: 'admin', }; await stub.putState(adminId, Buffer.from(JSON.stringify(admin))); //add adminId to 'admin' key let data = await stub.getState('admin'); if (data) { let ...
[ "function addAdminUser() {\n try{\n db.getData(`${rootKeys.USER}/${id}`)\n } catch(error) {\n const username = 'pervez'\n const password = 'pervez'\n const id = 'pervez'\n db.push(`${rootKeys.USER}/${id}`, {\n id,\n username,\n password,\n role:['superAdminUser']\n })\n }\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
WysiHat.Persistencesave() > undefined Saves editors contents back out to the textarea.
function save() { this.textarea.value = this.content(); }
[ "function save() {\r\n this.textarea.value = this.content();\r\n }", "function save() {\n $editors.find('.text').each(function () {\n $(this).closest('.fields').find('textarea').val(this.innerHTML);\n });\n }", "function save() {\n editors.forEach(function (editor, index) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if we can place DEP in TARGET to satisfy EDGE Need to verify: no child by that name there already target does not have a peer dep on name no higherlevel pkg by that name and incompatible spec is depended on by anything lower in the tree. node's peer deps and metapeer deps are siblings in a virtual root at this po...
[_canPlaceDep] (dep, target, edge, peerEntryEdge = null) { // peer deps of root deps are effectively root deps const isRootDep = target.isRoot && ( // a direct dependency from the root node edge.from === target || // a member of the peer set of a direct root dependency peerEntryEdge && p...
[ "[_canPlacePeers] (dep, target, edge, ret, peerEntryEdge) {\n if (!dep.parent || peerEntryEdge)\n return ret\n\n for (const peer of dep.parent.children.values()) {\n if (peer !== dep) {\n const peerEdge = dep.edgesOut.get(peer.name) ||\n [...peer.edgesIn].find(e => e.peer)\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function adds a deviceId to the rentedDevice list model.
async function addRentedDevice(config, deviceId) { //debugger; try { const options = { method: "GET", uri: `${config.server}:${config.port}/api/rentedDevices/add/${deviceId}`, json: true, // Automatically stringifies the body to JSON }; const data = await rp(options); if (!data....
[ "function addRentedDevice(deviceId) {\n //debugger;\n\n const options = {\n method: \"GET\",\n uri: `http://p2pvps.net/api/rentedDevices/add/${deviceId}`,\n json: true, // Automatically stringifies the body to JSON\n };\n\n return rp(options)\n .then(function(data) {\n //debugger;\n\n if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API test for 'DisconnectConnection', Disconnect a connection
function Test_DisconnectConnection(connection_id) { return __awaiter(this, void 0, void 0, function () { var in_rpc_disconnect_connection, out_rpc_disconnect_connection; return __generator(this, function (_a) { switch (_a.label) { case 0: console.log("...
[ "function disconnectConnection() {\n View.confirm(getMessage(\"disconnectConnection\"), function (button) {\n if (button == 'yes') {\n tcConnectController.disconnect();\n }\n });\n}", "disconnect () {\n if (this.isConnected()) {\n this.logEvent(`Closing IoT connection of cli...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns web/ path, the place where all the static files are compiled
getWebPath() { return path.join(this.getRootPath(), 'web'); }
[ "copyStaticFiles() {\n\t\tif (!this.weaver.root\n\t\t\t|| !fs.existsSync(this.weaver.root)\n\t\t\t|| !fs.statSync(this.weaver.root).isDirectory()) {\n\t\t\tthrow new Error('this.weaver.root does not point to a valid directory');\n\t\t}\n\n\t\t// this will be the output directory\n\t\tlet _siteStaticPath =\n\t\t\tpa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a value but record error
function recError(value, errorString = "there was an error!") { error = true; Logger.log(value + ": " + errorString); return value; }
[ "getError() {\n\t\treturn !this.isOk ? this.value : null;\n\t}", "function readRecordValue(record) {\n if (record.status === 1) {\n return record.value;\n } else {\n throw record.value;\n }\n}", "get value() {\n throw new TypeError('`value` can’t be accessed in an abstract instance of ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a google calendar link
function googleCalendarLink(startDate, endDate, useTime, text, details, location) { var url = 'http://www.google.com/calendar/' + (prefs['GoogleApps'] && prefs['GoogleAppsDomain']!='' ? 'hosted/'+prefs['GoogleAppsDomain']+'/' : '') + 'event'+ '?action=TEMPLATE'+ '&text=' + escape(text).replace(/"/g, '&quot;...
[ "function getGoogleCalLink(eventNum, i) {\n\tout_url = \"https://www.google.com/calendar/render?action=TEMPLATE\";\n\tout_url += \"&text=\" + event_data[eventNum].title.replace(/ /g, \"+\");\n\n\tstart_dt = event_data[eventNum].instances[i].start_datetime;\n\tstart_date = start_dt.split(\" \")[0];\n\tstart_time = s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display the OpenPGP Key Details window
async openKeyDetails(win, keyId, refresh) { if (!win) { win = this.getBestParentWin(); } keyId = keyId.replace(/^0x/, ""); if (refresh) { EnigmailKeyRing.clearCache(); } const resultObj = { refresh: false, }; win.openDialog( "chrome://openpgp/content/ui/keyDeta...
[ "function openKeyManager() {\n window.browsingContext.topChromeWindow.openDialog(\n \"chrome://openpgp/content/ui/enigmailKeyManager.xhtml\",\n \"enigmail:KeyManager\",\n \"dialog,centerscreen,resizable\",\n {\n cancelCallback: reloadOpenPgpUI,\n okCallback: reloadOpenPgpUI,\n }\n );\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove cards from the zone and playing end animation
removeCards(cards = this.cards.children) { cards = [].concat(cards); //in case one card is past let i = 0; const cfg = this.cfg.removeAnimation; const onCardRemove = (card) => { this._killCard(card); if (++i === cards.length) this.dispatchEvent(DealZone.events.CARDS_REMOVED); }; _.e...
[ "function removeCards() {\n cardsView.removeEventListener('transitionend', removeCards);\n screenElement.classList.remove('cards-view');\n cardsList.innerHTML = '';\n prevCardStyle = currentCardStyle = nextCardStyle = currentCard =\n prevCard = nextCard = deltaX = null;\n }", "clearCar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add icon to a group header that indicates the data for the group has changed
function showChangeIconOnHeader(headerFieldId) { var headerSpan = jq("#" + headerFieldId + "_header"); var headerIcon = jq("#" + headerFieldId + "_changeIcon"); if (headerSpan.length > 0 && headerIcon.length == 0) { headerSpan.append("<img id='" + headerFieldId + "_changeIcon' alt='change' src='" +...
[ "function displayMilestoneIcon ($group) {\n $group.find('.cmb-repeatable-grouping').each(function () {\n var $this = $(this);\n var milestone = $this.find('[id$=\"milestone\"]').val();\n\n if (milestone) {\n $this.find('.on-title.dashicons').remove();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear City seach history
function clearHistory(event){ event.preventDefault(); eCity=[]; localStorage.removeItem("cityname"); document.location.reload(); }
[ "function clearSavedCities() {\n searchedCities.empty()\n}", "function clearAllHistory(){\n\tremoveChildren(historyRecords);\n\tsearchHistory = [];\n}", "function clearAllSearchTermHistory () {\n \n window.localStorage.removeItem(\"searchHistory\");\n \n alert(\"Search History Cleared\");\n \n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Popup box for earthquak information
function popupBox(earthquake) { var properties = earthquake.feature.properties; let date = new Date(properties.time); return `<strong>Magnitude: ${properties.mag}</strong><br><a href="${properties.url}">${properties.place}</a><br>${date.toUTCString()}`; }
[ "function quakePopUp(feature, layer) {\n layer.bindPopup(\"<h3>\" + feature.properties.place +\n \"</h3><hr><p>\" + new Date(feature.properties.time) + \"</p>\");\n }", "function showPopup1(e) {\n // Show the popup at the coordinates with some data\n popup\n .setLngLat(e.lngLat)\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draws the chart data points and line connection for each entry that fits in the range
function drawChart() { ctx.beginPath(); ctx.strokeStyle = "blue"; var firstElement = true; ctx.font = "10px sans-serif"; //plot each entry if it is in the range for (let entry of entries) { //check if entry is in the range of xmin and xmax, otherwise ignore it if (entry.date > xM...
[ "function drawData(dataPoints) {\n //get min and max and take its root to acquire normalised scaling\n min = Math.min.apply(Math,dataPoints.map(function(d){return d.pop_density;}));\n max = Math.max.apply(Math,dataPoints.map(function(d){return d.pop_density;}));\n root_min = Math.sqrt(min);\n root_ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
grabs JSON of class description and slots given the link to the detail page CURRENTLY DOES NOT WORK ON MULTIPLE PAGES remember, this function must complete its task before returning something attempting to call it without await or .then will result in no return value
async function getDescSlots(link) { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto(link, { waitUntil: "networkidle2", }); const json = await page.evaluate(() => { let obj = {}; obj.description = document.querySelector( "div#section p.section_d...
[ "async function parseDetailPage(asin) {\n\n const detailsDOM = await getItemPage(asin);\n\n const title = parseTitle(detailsDOM);\n\n const price = parsePrice(detailsDOM);\n\n const image = parseImage(detailsDOM);\n\n return {\n image,\n img: image,\n title,\n name: title,\n price,\n variants...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sanitizes the given link by removing curies.
sanitize() { assert(typeof this.link === 'string', 'You must provide at least one string as link!'); return this.link.replace(this.REGEX_MATCHER_CURIE_PARAMS, ''); }
[ "function _doClean(link) {\r\n /* Click-tracking is bind on mousedown event. */\r\n var track = link.getAttribute('onmousedown');\r\n\r\n /* Redirection URL's regular expression */\r\n var rredirect = /\\/url\\?(?:url|q)=([^&]*)/i;\r\n\r\n /* Real image URL's regular expression */...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The timeout event is called based on the transition time set by the caller. This will continually call itself once the background image is set on the element.
function timeoutEvent(element, settings) { debug(settings.debug, "Calling timer for element [" + element + "]"); var nextImage = getNextImage(settings); slideBackgroundImage(element, settings, nextImage); }
[ "handleGetBackgroundImage() {\n setTimeout(() => {\n let path = getImagePath();\n if (path === '') return;\n makeBackgroundImage(path);\n this.props.dispatch(setBackgroundImage(path));\n }, 200);\n }", "transitionImg() {\n if (!this.placeholderImg) return true;\n this.fadeOutPlace...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
code TODO: publicarCtrl | controller_by_user controller by user
function controller_by_user(){ try { } catch(e){ console.log("%cerror: %cPage: `publicar` and field: `Custom Controller`","color:blue;font-size:18px","color:red;font-size:18px"); console.dir(e); } }
[ "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page index => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page storie_singles => custom con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates buttons at top of screen to select climo site
function makeBtns() { for (let btn of btnList) { const newBtn = document.createElement("button"); newBtn.addEventListener("click", () => selectClimoSite(btn)); newBtn.innerText = btn.site; if (btn.site === "KTUS") { newBtn.classList.add("active"); } btns.append(newBtn); } }
[ "function setupButtonsAndActions() {\r\n changeFeatureName('a', 'Proprietário', '<b>TORNAR-SE PROPRIETÁRIO</b>');\r\n changeFeatureName('a', 'Fechar', '<b>FINALIZAR</b>');\r\n createButonMover('GIRS', 14, 'highlight-out')\r\n createButonMover('BANCADA', 10)\r\n createButonMover('CIRO', 29)\r\n createButonMove...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether a fileSummary or file path is audio/video that we can play, based on the file extension
function isPlayable (file) { return isVideo(file) || isAudio(file) }
[ "accepts (extension) {\n if (!extension) return true\n return [\n '.mp4', '.m4v', '.mov', '.mpg', '.mpeg', '.mkv', '.webm', '.ogg', '.flv', '.ts'\n ].some(x => extension.toLowerCase().endsWith(x))\n }", "function isPlayable (file) {\n var extname = path.extname(file.name)\n return ['.mp4', '.m4v'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fetches for the top anime that are currently airing
function getTopAnime() { console.log('getting top anime'); fetch(generalApi + 'top/anime/'+1+'/bypopularity') .then(res => res.json()) .then(data => { console.log(data.top); createCards(data.top, true, trendingAnimeEl); }); }
[ "async function topAnime() {\n const response = await fetch(\n `https://api.jikan.moe/v3/top/anime/1/bypopularity`\n );\n const topanime_data = await response.json();\n topanime_data.top.forEach((anime) => createtopAnime(anime));\n}", "function findAnime() {\n ctrl.animeitems = Animeitems.query();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compute number of blocks in innerCanvas
function innerCanvasWidth(width) { var innerCanvasWidth = width; var numBlocks = innerCanvasWidth * blockWidth(); return numBlocks + 'px' }
[ "function innerCanvasArea() {\n var total = parseInt(innerCanvas.style.width) * 2;\n return total;\n }", "function getNumBlocks(){\n\t\tvar i = 0;\n\t\tfor(var x = 0; x < gridSize; x++){\n\t\t\tfor(var y = 0; y < gridSize; y++){\n\t\t\t\tif(grid[x][y]) i++;\n\t\t\t}\n\t\t}\n\t\treturn i;\n\t}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move to the to step and open the date picker.
_openToDate() { this._moveToToStep(); this._open(); }
[ "_openFromDate() {\n this._moveToFromStep();\n this._open();\n }", "openDatePicker() {\n this._openDatePicker();\n }", "_moveToToStep() {\n let [,month] = get(this, '_dates') || Ember.A();\n if (month) {\n var startOfMonth = new Date(month.getFullYear(), month.getMonth(), 1);\n se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
flexgrid class must exist!
function addFlexGridDiv(dParent) { return addDivU({ dParent: dParent, className: 'flex-grid' }); }
[ "initGrid() {\n this.grid = new Masonry('.pin-wrapper', {\n itemSelector: '.pin',\n columnWidth: 250\n });\n }", "createGrids () {\n }", "function resizeGrid() {\n var items = util.getArray(container.querySelectorAll(\"[data-grid-active]\"));\n\n row...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
lambdaHandler is the handler function that is invoked by AWS Lambda to process an incoming event for performing data validation tests. lambdaHandler accepts the following input parameters as part of the event: 1) bucket bucket name 2) key key name lambdaHandler retrieves the object from Bolt and S3 (if BucketClean is O...
function lambdaHandler(event, context, callback) { return __awaiter(this, void 0, void 0, function* () { yield (() => __awaiter(this, void 0, void 0, function* () { const opsClient = new BoltS3OpsClient_1.BoltS3OpsClient(); const boltGetObjectResponse = yield opsClient.processEvent(O...
[ "function handler (event, context, callback){\n console.log('Lambda params:', JSON.stringify(event))\n \n // This handler will both catch APIGateway and CLI invokations\n // the passed in httpMethod will make the distinction between the two of them\n if (event.httpMethod) {\n // It's an APIGateway event\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make full combination of the effects to check proper management of render targets and validity of random effects composition without electron density
function testPostProcessEffects(fxs) { describe('use the Miew to display a data set with different combination of post-process effects', () => { const number = 2 ** effects.length; for (let i = 0; i < number; i++) { const combination = buildParams(i); // add general protein to load combinati...
[ "createEffects() {\n config.effects.forEach(effect => {\n this.makeEffect(effect.name, effect.params);\n })\n }", "applyEffect()\n {\n\n // verify VALID targets & condition fulfilled\n\n\n }", "initMaterials(){\n \n this.skinTexture = new CGFtexture(this.scene, 'images/skin.png');...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disables automatic transformation of tags with "text/babel" type.
function disableScriptTags() { window.removeEventListener('DOMContentLoaded', transformScriptTags); }
[ "transform () {\n if (this.node.type === 'tag') {\n return this.transformTag()\n } else if (this.node.type === 'text') {\n return this.transformText()\n } else if (this.node.type === 'script') {\n return this.transformScript()\n } else {\n return React.isValidElement(this.node) ? thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find all tweets with a certain hashtag using fakenewsdetector
function twitterhashtagfakenews(hashtag, callback){ console.log('Listening to:' + hashtag); Twitter.stream('statuses/filter', {track: hashtag}, function(stream) { stream.on('data', function(tweet) { console.log('Verifica notícia de @' + tweet.user.screen_name + '\t tweet: ' + tweet.text); console.log('------...
[ "function concernedTweets(tweets=[],lookedHashtag=[]){\n\t\tconcerned_tweets= tweets.filter(tweet => tweet[\"hashtags\"].match(lookedHashtag))\n\t\treturn concerned_tweets\t\t\t\n\t}", "function getTweetsfromHashtag(hashtag, callback) {\n client.get('search/tweets.json',\n { q: hashtag, count: 200, include_en...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save all our caddy
function saveCaddy(caddyProductsNumber, caddyProducts, caddyPrice, caddyUser, caddyComId) { createCookie('caddyProductsNumber', caddyProductsNumber, 1); createCookie('caddyProducts', JSON.stringify(caddyProducts), 1); createCookie('caddyPrice', total, 1); createCookie('caddyUser', caddyUser, 1); cre...
[ "function saveAll() {\r\n if (allNotes.length == 0) {\r\n deleteAllCookies();\r\n return;\r\n }\r\n var allNotesTemp = allNotes.slice();\r\n for (var i = 0; i < allNotesTemp.length; i++) {\r\n allNotesTemp[i] = encodeURIComponent(allNotesTemp[i]);\r\n }\r\n var saveString = btoa(allNotesTemp.toString...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Definition for the List controller. quizMetrics and dataService are two services that are created in js/factory/quiz.js and js/factory/dataService.js respectively.
function ListController(quizMetrics, DataService){ var vm = this; /* * The interface for the controller. The below code shows all the * variables that are available from inside the view. References to * named functions are used instead of inline anon functions. This ...
[ "function ListController(quizMetrics){\n\t\tvar vm = this;\n\t\t\n\t\tvm.quizMetrics = quizMetrics;\n\t\tvm. activateQuiz = activateQuiz;\n\t}", "function ListController($scope, QuizMetrics, DataService) {\n\t\t$scope.data = DataService.fruitsData;\n\t\t$scope.activeFruit = {};\n\t\t$scope.changeActiveFruit = cha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the MIDI note number for a give string and fret.
function getNote(string, fret, options) { var baseNoteName = options.tuning[string]; var components = baseNoteName.match(/([A-Gb#]+)([0-9]+)/); var baseOctave = parseInt(components[2]); // C4 = 48 var baseIndex = 48 + (baseOctave - 4) * 12 + NOTES.indexOf(components[1]); return baseIndex + fret;...
[ "function noteToMidiNumber(note) {\n const [, basenote, octave] = NOTE_REGEX.exec(note);\n const offset = BASENOTES.indexOf(basenote);\n return MIDI_NUMBER_C0 + offset + NOTES_IN_OCTAVE * parseInt(octave, 10);\n}", "function note2index(note){\n let returnInt = 0;\n if (note.length === 2){\n let no...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the existing macro or null if it doesn't exists
static getMacro(name) { return this.macros[name]; }
[ "_findMacro(line) {\n line = parseConstants(line, this.constants);\n const inputTokens = tokenize(line);\n for (let i = 0; i < this.macros.length; i++) {\n const macro = this.macros[i];\n const args = parseMacroInputTokens(macro, inputTokens);\n if (args)\n return Object.assign({}, ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get table top border.
getTableTopBorder(borders) { if (!isNullOrUndefined(borders.top)) { return borders.top; } else { let border = new WBorder(borders); border.lineStyle = 'Single'; border.lineWidth = 0.66; return border; } }
[ "get topCanvasBorder() {\n var _a, _b;\n return (_b = (_a = this.canvasBorder.borderTop) !== null && _a !== void 0 ? _a : this.canvasBorder.border) !== null && _b !== void 0 ? _b : 0;\n }", "get topViewportBorder() {\n var _a, _b;\n return (_b = (_a = this.viewportBorder.borderTop) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepends an item to the beginning of the list. ...data One or more data to prepend. Arguments will be prepended in argument order, with the last argument being inserted immediately before the list's current first item. Returns the new node containing the last prepended data (first argument).
unshift(...data) { let node; for (let i=data.length-1; i>=0; --i) { node = this.insert(data[i], this[this._start]); } return node; }
[ "prepend(data) {\n return this.insertAfter(data, this._head);\n }", "function prepend(list, item) {\n list.unshift(item);\n}", "prepend(value){\n // create new node\n const newNode = {\n value: value,\n next: null,\n prev: null\n };\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the stocks that the user has in their watchlist based on their username
function getUserStocksByUsername(username) { let query = { name: "get-user-stocks-by-username", text: "select symbol from user_stocks where username = $1", values: [username] } return new Promise((resolve, reject) => { postgres.query(query, (error, results) => { ...
[ "async getWatchlist(username) {\n let watchlist;\n watchlist = await Watchlist.query() \n .select('model', 'size', 'priceMin', 'priceMax')\n .where('username', username)\n return watchlist; \n }", "getUserStocks() {\n return __awaiter(this, void...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resize video and preview canvas to maintain aspect ratio
function resize(width, height) { var widthFactor = 640 / width, heightFactor = 360 / height, factor = Math.min(widthFactor, heightFactor); d3.select("canvas") .attr("width", factor * width) .attr("height", factor * height); d3.select("#canvas") .style("width", (factor * width) + "px"); ...
[ "function sizeCanvas() {\n setTimeout(function() {\n contextSource.width = video.videoWidth;\n contextSource.height = video.videoHeight;\n contextBlended.width = video.videoWidth;\n contextBlended.height = video.videoHeight;\n img.height = video.videoHeight;\n img.width = video.vide...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CREATE Message controls with Accept Button
__createMessageControlsElement(adId) { let message_controls = document.createElement("div"); message_controls.classList.add("message__controls"); message_controls.style.display = "flex"; message_controls.style.justifyContent = "flex-end"; let accept_button = this.__createAcceptBu...
[ "__createAcceptButton(messageId) {\n let accept_button = document.createElement(\"button\");\n accept_button.classList.add(\"btn__accept\");\n accept_button.textContent = \"I will accept\"\n accept_button.addEventListener(\"click\", async function () {\n await this.messageAcce...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================== HELPERS ============================== clears login error status
function clearLoginError() { setLoginError(false) }
[ "function resetLogin()\n{\n\tloggedIn = false;\n\thasSeed = false;\n}", "function clearLoginError() {\n $(\"login-error\").innerHTML = \"\";\n }", "function onLoginFail(status, res) {\n // TODO(rdleon): show failure message\n form.querySelector('input[name=\"password\"]').value = '';\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function to render the main topics the relate to react and each topic has nested topics
function TopicList(props) { return ( <Container> <Accordion> <AccordionSummary> <Typography> <Span><strong>Topic Name:</strong>{props.name} </Span> <Span><strong>Stargazer count:</strong>{props.count} </Span> </Typog...
[ "function renderTopics() {\n const topicContainer = document.querySelector(\".topic-container\");\n const topics = createTopics(topicData);\n\n while (topicContainer.firstChild) {\n topicContainer.removeChild(topicContainer.firstChild);\n }\n\n topicContainer.appendChild(topics);\n}", "function TopicSubhe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load new round and sets the handlers
function loadRound(){ enableButtons(); updateScore(); unbindHandlers(); shuffle(); setGame(0); setGame(1); setGame(2); bindSelectors(); }
[ "nextRound() {\n this.loadNewGenotypes();\n this.handleChangeBlockView(false);\n }", "function startNewRound() {\n userObject.round = currentRound;\n userObject.currentSelection = \"\";\n databaseModify.update();\n userScreen.choose();\n }", "newRound() {\n // Recreate game obje...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
In an iframe, test to fetch a keepalive URL that involves in redirect to another URL.
function keepaliveRedirectTest( desc, {origin1 = '', origin2 = '', withPreflight = false} = {}) { desc = `[keepalive] ${desc}`; promise_test(async (test) => { const tokenToStash = token(); const iframe = document.createElement('iframe'); iframe.src = getKeepAliveAndRedirectIframeUrl( tokenTo...
[ "function keepaliveRedirectInUnloadTest(desc, {\n origin1 = '',\n origin2 = '',\n url2 = '',\n withPreflight = false,\n shouldPass = true\n} = {}) {\n desc = `[keepalive][new window][unload] ${desc}`;\n\n promise_test(async (test) => {\n const targetUrl =\n `${HTTP_NOTSAMESITE_ORIGIN}/fetch/api/res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prune buffer on our own in background to avoid browsers pruning buffer silently
function pruneBuffer() { if (!buffer) return; if (type === 'fragmentedText') return; var start = buffer.buffered.length ? buffer.buffered.start(0) : 0; var bufferToPrune = playbackController.getTime() - start - mediaPlayerModel.getBufferToKeep(); if (bufferToPrune > 0) { ...
[ "function pruneBuffer() {\n if (!buffer) return;if (type === _constantsConstants2['default'].FRAGMENTED_TEXT) return;var start = buffer.buffered.length ? buffer.buffered.start(0) : 0;var bufferToPrune = playbackController.getTime() - start - mediaPlayerModel.getBufferToKeep();if (bufferToPrune > 0) {\n log(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given some regular income and some long term capital gains, return the long term capital gains tax. Based on 2021 rates.
function LTCGTAX(regularIncome, longTermCapitalGains, filingStatus) { if (filingStatus !== 'MFJ') { throw new Error('filingStatus currently only supports MFJ'); } var taxedAt = { 0: 0, 15: 0, 20: 0 }; taxedAt[0] = Math.min(Math.max(0, 80800 - regularIncome), longTermCapitalGains); longTermCa...
[ "function income2tax(income) {\n return 12*income/3;\n}", "function getInterest(rate, capital, term) {\n\tvar interest = capital*(rate/365)*term;\n\treturn interest;\n}", "function incomeTax(annual_salary) {\n if (annual_salary <= 18200) {\n return 0;\n } else if (annual_salary >= 18201 && annual_sa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
category: utilities/themes Sets the document text direction as it's required for themeable component bidirectional styles.
function setTextDirection() { if (hasRan) return; hasRan = true; if (canUseDOM$2) { var dir = document.documentElement.getAttribute('dir'); if (!dir) { document.documentElement.setAttribute('dir', 'ltr'); } } }
[ "function enforceTextDirectionOnPage() {\n $(\"#red-ui-workspace\").find('span.red-ui-text-bidi-aware').each(function() {\n $(this).attr(\"dir\", resolveBaseTextDir($(this).html()));\n });\n $(\"#red-ui-sidebar\").find('span.red-ui-text-bidi-aware').each(function() {\n $(t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
called when saving edits to the title
async function onSaveTitle(val) { try { let editContentRes = await fetch('/content/edit', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: contentBaseI...
[ "function handleEditTitle() {}", "function saveTitle() {\n var sid = txtTitleEdit.attr('sid');\n var title = $(btnSoundTitles[sid]);\n //TODO Make sure you cannot save if input is empty by disabling button\n if(txtTitleEdit.val() === \"\")\n {\n txtTitleEdit.val(title.attr('default'));\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RTG[] Round To Double Grid 0x3D
function RTDG(state) { if (DEBUG) console.log(state.step, 'RTDG[]'); state.round = roundToDoubleGrid; }
[ "function roundToDoubleGrid(v){return Math.sign(v)*Math.round(Math.abs(v*2))/2;}", "function RTDG(state) {\n\t if (exports.DEBUG) { console.log(state.step, 'RTDG[]'); }\n\n\t state.round = roundToDoubleGrid;\n\t}", "function roundToDoubleGrid(v) {\n return Math.sign(v) * Math.round(Math.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the mask for IRQ (regular) interrupts.
setIrqMask(irqMask) { this.irqMask = irqMask; }
[ "maskableInterrupt() {\n if (this.regs.iff1 !== 0) {\n this.interrupt(true);\n }\n }", "setMask(mask) { this.maskBits |= mask; }", "setTimerInterrupt(state) {\n if (this.config.modelType === Config_1.ModelType.MODEL1) {\n if (state) {\n this.irqLatch ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by LUFileParserqnaDefinition.
exitQnaDefinition(ctx) { }
[ "exitQnaSection(ctx) {\n\t}", "exitEraDeclaration(ctx) {\n\t}", "exitSyntaxBracketRa(ctx) {\n\t}", "exitQnaAnswerBody(ctx) {\n\t}", "exitParse(ctx) {\n\t}", "exitQnaQuestion(ctx) {\n\t}", "exitBuild_clause(ctx) {\n\t}", "exitDeclaration(ctx) {\n\t}", "visitQnaDefinition(ctx) {\n\t return this.visit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rose Chart (also called: Coxcomb Chart; Circumplex Chart; Nightingale Chart)
function chartRoseChart () { /* Default Properties */ var svg = void 0; var chart = void 0; var classed = "roseChart"; var width = 400; var height = 300; var margin = { top: 20, right: 20, bottom: 20, left: 20 }; var transition = { ease: d3.easeBounce, du...
[ "function redCovenants() {\n var covenantsChart = createGraphics.newChart()\n .setChartType(Charts.ChartType.PIE)\n .setOption('title', 'Covenants')\n .setOption('colors', ['#f4cccc', '#ea9999', '#e06666', '#990000'])\n .addRange(redData.getRange(\"O22:R23\"))\n .setOption('backgroundColor', '#00000...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function selectattackdefense will select if possible the attacker or defender country
function selectattackdefense(ctrname){ var i, n; escaattackdefense: if(Territori[ctrname].jugador==Jugador['jugador'+Turn.turn]){ n=document.MyTurn.Attacker.options.length; for (i=0; i<n; i++){ if (MyTurn.Attacker.options[i].value==ctrname){ MyTurn.Attacker.selectedIndex=i; Turn.attackdefense=1; d...
[ "selectAttack() {\n let randomAttack = Math.floor(Math.random() * this.enemies[hercules.currentEnemy].attacks.length);\n this.enemies[hercules.currentEnemy].currentAttack = this.enemies[hercules.currentEnemy].attacks[randomAttack];\n alert(`${this.enemies[hercules.currentEnemy].name} chose to ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to close the modal, clear the src and remove keyboard listeners
function onCloseClick() { modalEL.classList.remove("is-open"); imagePlacer(""); window.removeEventListener("keydown", onEsc); window.removeEventListener("keydown", horizontalSlider); }
[ "function hangeleCloseButton() {\n refs.openModalWindow.classList.remove(\"is-open\");\n refs.img.alt = \"\";\n refs.img.src = \"\";\n window.removeEventListener(\"keyup\", handleEscape);\n window.removeEventListener(\"keyup\", handleScrolling);\n\n }", "removeModal () {\n if (this.el && this.el.pare...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `S3PathProperty`
function CfnDataSource_S3PathPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' ...
[ "function CfnFaq_S3PathPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to start quiz
function startQuiz () {}
[ "function startQuiz(){ \n firstQuestion();}", "function initiateQuiz() {\r\n initializeQuiz();\r\n startQuiz();\r\n}", "function startQuiz() {\n fetchTriviaDbQuestions();\n addOptionEventListeners();\n }", "function startQuiz() {\n // clear the start-view page when start-butto...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pushes a string to the specified person's notif section
function pushNotif(person, notif){ //push the new notification into the queue person.notifsHistory.push(notif); //trim the notifications if(person.notifsHistory.length > 5){ person.notifsHistory.shift(); } }
[ "function appendName(identity, container) {\n const name = document.createElement(\"p\");\n name.id = `participantName-${identity}`;\n name.className = \"instructions\";\n name.textContent = identity;\n container.appendChild(name);\n}", "function pushToSection(sectnum,lines)\n{\n\tif(lines === 2){ //are ther...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build content placeholder title.
async cphTitleBuild() { //Logic. //---------------------- try { this.cphTitle = SyncSystemNS.FunctionsGeneric.contentMaskRead(gSystemConfig.configSystemClientName, "config-application") + " - " + SyncSystemNS.FunctionsGeneric.appLabelsGet(gSystem...
[ "async cphTitleBuild()\n {\n //Logic.\n //----------------------\n try\n {\n this.cphTitle = SyncSystemNS.FunctionsGeneric.contentMaskRead(gSystemConfig.configSystemClientName, \"config-application\") + \n \" - \" + \n SyncSystemNS.FunctionsGeneric.app...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function harnesses the builtin detector for any mouse click and simply saves the location of the mouse when it was clicked mouseClicked() is a predefined p5.js function we just fill in what happens when it is invoked by the system.
function mouseClicked() { MouseClickedAtX = mouseX; MouseClickedAtY = mouseY; }
[ "function mouseClicked() {\n MouseClickedAtX = mouseX;\n MouseClickedAtY = mouseY;\n}", "function mouseClicked() {}", "function mouseClicked() {\n sketches[currentSketch].mouseClicked();\n}", "function mouseClicked() {\n click = true;\n}", "function mouseClicked()\n{\n clicked = true;\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
start nginx rtmp server
start () { this.logger.info('Starting NGINX...', 'start.nginx'); this.process = spawn('sh', [ '-c', this.config.nginx.exec ]); this.bindNginxProcessEvents(this.process); // todo: code a watcher instead of fix 1s delay for state detection this.getS...
[ "function restartServerInitd(){\n createPathAsRoot( nginxConfPath, function(){\n // cp nginx conf to /etc/\n var confFile = path.join( nginxConfPath, nginxConfFileName );\n var args = [ 'cp', outputConfFile, confFile ]\n var command = 'sudo'\n execAndPrint(command, args, null, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
scrapeData(subreddits): returns the titles and links to Reddit posts in the specified subreddits
async function scrapeData(subreddits) { // build reddit url let url = "https://old.reddit.com/r/"; for (let i = 0; i < subreddits.length; i++) { url += "+" + subreddits[i]; } url += '/top/?sort=top&t=day'; let scrapedData = {'data': []}; const response = await request({ uri: url, resolveWithFullResponse:...
[ "function getSubreddits() {\n return requestPromise('https://reddit.com/subreddits.json');\n}", "function getSubreddits() {\n // Load reddit.com/subreddits.json and call back with an array of subreddits\n return requestPromise(\"https://www.reddit.com/subreddits.json\")\n .then(function(result) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start new task given the data collected from the user
function startTask() { const task = { id: nextTaskId(), name: taskNameElement.value.trim(), length: sliderElement.value * 60, // Length in seconds date: new Date(), type: !currentTask ? taskTypes.work : currentTask.type == taskTypes.rest ? taskTypes.work : taskTypes.rest, ...
[ "start() {\n this.executeNextTask();\n }", "startProcessing() {\n\t\tthis.start = Date.now();\n\t\tthis.data = JSON.parse(this.taskWrapper.payload);\n\t\tthis._updateStatus('start processing');\n\t}", "onSparkTaskStart(data) {\n this.addData(data.launchTime, this.numActiveTasks);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if an ID is valid
function isValidID(id){ if(typeof id != 'string'){ console.log("db: ID must be a string"); return false; } if(id == ""){ console.log("db: ID cannot be blank"); return false; } if(/[^a-zA-Z0-9_-]/.test(id)){ console.log("db: ID can only contain letters, numbers...
[ "function IsValidID(id) {\n if (!id) { return false; }\n return (ID_REGEX).test(id);\n}", "function validateId(id) {\n\treturn shortId.isValid(id)\n}", "idFieldIsValid(value){\n\t\tconst LONGUEUR_MIN_ID = 4;\n\t\t/*change hexaId required length by changing this part: '^([A-Fa-f0-9]{1}){minValue,maxvalue}$...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse input for this run to get an array of domain names or domain objects
static parseInputForDomains({input=null}) { let domains=input.domain; let inputDirectory=null; // normalize the input directory if(input.directory&&input.directory.length>0) { inputDirectory=input.directory; } input.inputDirectory=inputDirectory; // There were no input options and no config file input // Show the hel...
[ "function parseDomains(input, separator, options) {\n options.domains = options.domains || [];\n options.skipDomains = options.skipDomains || [];\n var domains = input.split(separator);\n options.domains = options.domains.concat(domains.filter(function (domain) {\n return domain[0] !== '~';\n })...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createQuestionArea creates html for question section
function createQuestionArea(){ questionArea = '<div class="panel-default text-center" id="questionArea"><h2 id="title"></h2><div class="row text-center"><div class="col-xs-offset-1 col-xs-10"><h3 id="questiontext">' + questions[questionCount] + '</h3></div></div></div>'; $('.questionDiv').html(questionArea); ...
[ "generate_html(q_idx) {\n let q_info = this.info;\n let text = q_info[0];\n let required = q_info[2];\n let follow = q_info[3];\n let known_response = this.parent.responses[q_idx];\n\n let ret = document.createElement('div');\n\n // Insert node for the question\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function get the xml3di file using ajax
function Xml3di(filename) { $.ajax({ type: "GET", url: filename, cache: false, async: false, dataType: "xml", success: function(xml3di) { player.XML3DI = $(xml3di).find("islay3d")[0]; player.data = new Hash(xml3di.getElementsByTagName("data"), "name"); ...
[ "function getXML() {\n let secret = JSON.parse(Cookies.get(\"LOKIDIED\"));\n let token = secret.token;\n let userId = secret.uid;\n let modelId = Cookies.get(\"MID\");\n let url = \"/goal_model/xml/\" + userId + \"/\" + modelId;\n\n $.ajax(url, {\n // the API of upload pictures\n typ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the list of callables explicitly defined in files in this scope. This excludes ancestor callables
getOwnCallables() { let result = []; this.logDebug('getOwnCallables() files: ', () => this.getOwnFiles().map(x => x.pkgPath)); //get callables from own files this.enumerateOwnFiles((file) => { for (let callable of file.callables) { result.push({ ...
[ "getOwnCallables() {\n let result = [];\n this.logDebug('getOwnCallables() files: ', () => this.getFiles().map(x => x.pkgPath));\n //get callables from own files\n this.enumerateFiles((file) => {\n for (let callable of file.callables) {\n result.push({\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Now stitch the fragments back together into rings.
function stitchFragments(fragments) { var i, n = fragments.length; // To connect the fragments start-to-end, create a simple index by end. var fragmentByStart = {}, fragmentByEnd = {}, fragment, start, startFragment, end, endFragment; // For each fragment… for (i = ...
[ "function stitchFragments(fragments) {\n var i, n = fragments.length;\n // To connect the fragments start-to-end, create a simple index by end.\n var fragmentByStart = {}, fragmentByEnd = {}, fragment, start, startFragment, end, endFragment;\n // For each fragment…\n for (i = 0; i < n; ++i) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Component for loader during admin submit process.
function SubmitLoader(props) { const {title} = props; return <LightBox className="submit-loader flex-col-centered"> <h2 className="loader-title">{title}</h2> <span className="loader-message">Don't refresh or leave page...</span> <i className="icon-spinner flex-col-centered"/> </Ligh...
[ "function showAdminLoadingDiv() { tf.showAdminLoading(); }", "handleChildComponentActionStarted(event) {\r\n //render loader\r\n this.setActionInProgress(event.detail.message);\r\n }", "_onFormSubmit() {\n // show loading indicator in submit button\n const loader = new ButtonLoadi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves the path inserted by the user. This is taken based on the last quote or last white space character.
getUserPath(currentLine, currentPosition) { var lastQuote = -1; var lastWhiteSpace = -1; for (var i = 0; i < currentPosition; i++) { var c = currentLine[i]; // skip next character if escaped if (c == "\\") { i++; continu...
[ "quotePath(path) {\r\n return /\\s/g.test(path) ? `\"${path}\"` : path;\r\n }", "quotePath(path) {\n return /\\s/g.test(path) ? `\"${path}\"` : path;\n }", "function GetPath()\r\n {\r\n var name = WScript.ScriptFullName;\r\n return name.substr(0, name.lastIndexOf(\"\\\\\")+1);\r\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called by the event handler to deal with events on the standard value control(s). In general we want to clear the primary value(s), which includes clearing other values and ADE element values. In addition, if 'See Note' was clicked we want to enable the note.
function handleStdControlEvent(thisObj) { var m = thisObj.getMeta(); var v = thisObj.getStandardValue(); if (v) { _changed = true; // Hide the ADE and clear all of the ADE values since a standard value is not considered // an ATV value. The clearAdeValues() method will deal with the ...
[ "function handlePrimaryControlEvent(thisObj, source) {\n var primaryValue, primaryValues;\n var m = thisObj.getMeta();\n \n // The data element is multivalued. In this situation there is not much to do since there\n // is no ADE to show/hide (since a multivalued data element with an ADE is handled v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CORE Maps // / Function that maps file states to textual values
function mapFState(fstate) { var stClass = 'i_filestate_'+fstate.split(' ').join(''); if (fstate.indexOf('/') >= 0) stClass = 'i_filestate_'+fstate.split('/')[0]; // special cases if (fstate == 'corrupted version/invalid crc') stClass = 'i_filestate_corrupted'; if (fstate == 'self edited') stClass = 'i_filestat...
[ "function statusMapper([filename, headStatus, workDirStatus, stageStatus,]) {\r\n const status = [headStatus, workDirStatus, stageStatus].join(\",\");\r\n const description = {\r\n \"1,1,1\": \"unmodified\",\r\n \"0,2,2\": \"added, staged\",\r\n \"1,2,2\": \"modified, staged\",\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
initializeMap: called for each object in the allLocs array (in app.js). location = the name of the place. isPark = boolean. loc = the whole object in the allLocs array (built from the Location constructor). The loc is useful because we can add to the marker and infoWindow properties. Then those can be accessed in the v...
function initializeMap(location, isPark, loc) { // create a map object with Google's constructor. var mapOptions = {}; // empty now, may be useful later. map = new google.maps.Map(document.querySelector('#map'), mapOptions); // create an infoWindow object with Google's constructor. infoWindow ...
[ "function initMap() {\n mapObj.initMap(45.753, 4.850);\n getStationLocations(refresh);\n}", "function initMap() {\n\t// Constructor creates a new map - only center and zoom are required.\n\tmap = new google.maps.Map(document.getElementById('map'), {\n\t\tcenter: {\n\t\t\tlat: 40.7413549,\n\t\t\tlng: -73.998...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hunger Functions Create and Draw the Hunger Bar
function drawHungerBar () { // Hunger bar Background rect(0, 550, cnv.width, 50, "black", "fill"); // Hunger bar Border rect(8, 558, 784, 34, "white", "fill"); // Hunger bar Border Background rect(10, 561, 195, 28, "maroon", "fill"); // 1/4 rect(195, 561, 195, 28, "darkred", "fill"); ...
[ "hpBar() {\n return generateHeartsBar(this.currenthp);\n }", "makeHealthBar()\n {\n this.healthBarGUI = this.add.image(10, 10, \"health_bar\").setOrigin(0).setScale(2).setDepth(100);\n this.healthBar = this.add.graphics({\n fillStyle: {\n color: \"0xff0000\"\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a content data of an active tab
getActiveTabContent (state, getters) { let selectedActivityContents = getters.getSelectedActivity.contents for (let i = 0; i < selectedActivityContents.length; i++) { const content = selectedActivityContents[i] if (content.subnav_id === state.activeTabId) { return content } } c...
[ "function getContent()\n {\t\n \tvar editor = ace.edit(idTrack[tabs.tabs(\"option\",\"active\") + 1]);\n \treturn editor.getValue();\n }", "function getContextClickedContent()/*:Content*/ {\n return getTabContent$static(this.getContextClickedTab());\n }", "GetActiveTabData() {\n return ne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setWireFromConnectorToGate() This function is called to set a connection from a connector to a gate. We are passed the gate that we will be connecting the connector (selectedComp) to. We are also passed the start line and end line. We will make a wire (line) from the end point of the start line to the start point of th...
function setWireFromConnectorToGate(gate, start, end, plugoutNum, pluginNum) { start = start.getPoints()[1]; // get the end point of the start line end = end.getPoints()[0]; // get the start point of the end line // if the plugoutNum of the connector is 2, use getWirePoins(); else use getWir...
[ "function setWireFromGateToConnector(connect, start, end, pluginNum) {\n\t\tstart = start.getPoints()[1];\t\t\t// get the end point of the start line\n\t\tend = end.getPoints()[0];\t\t\t\t// get the start point of the end line\n\t\t\n\t\tif (pluginNum == 1) points = getWirePoints3(start, end);\n\t\telse points = ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add's display none propery to svg with definitions
function transformSvg (svg, cb) { svg.attr({ style: 'display:none' }) cb(null) }
[ "_hideShapes() {\n this.getElement(\"ellipse\").setAttribute(\"hidden\", true);\n this.getElement(\"polygon\").setAttribute(\"hidden\", true);\n this.getElement(\"rect\").setAttribute(\"hidden\", true);\n this.getElement(\"markers\").setAttribute(\"d\", \"\");\n }", "function transformSvg(svg, cb) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Click Event CLOSE STORE
async closeStore() { this.gold_container.style.color = "black"; this.gold_container.style.zIndex = "initial"; this.store_container.remove(); await this.updateMessages(); }
[ "_onCloseButtonTap() {\n this.fireDataEvent(\"close\", this);\n }", "function handleClose() {\n setCart(false);\n }", "closeWaveEventMenu() {\n utils.hideElement(this.actionMenuContainer_);\n this.clickedWaveEvent_ = null;\n }", "close() {\n this._qs(\"#close-popup\").addEventListener(\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
converts this group to a dictionary for use in a template i.e. the states that are to be rendered.
toDict() { return { 'group_name': ADDRESSGROUP_NAME, 'addresses' : this.group } }
[ "getContextGroupStates() {\n return InteropBroker.toObject(this.contextGroupsById);\n }", "convert(states) {\n let converted = {};\n for (let [state, command] of Object.entries(this._states)) {\n if (states.hasOwnProperty(command)) {\n converted[state] = states[command];\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }