query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Helper method to determine if a character is a Latinscript letter or not. For our purposes, combining marks should also return true since we assume they have been added to a preceding Latin character.
function isLatinLetter(letter) { // Combining marks are a subset of non-spacing-mark. if (!pL_regexp.test(letter) && !pMn_regexp.test(letter)) { return false; } return latinLetterRegexp.test(letter); }
[ "function isLetter(c) {\n return c.charCodeAt(0) >= 65 && c.charCodeAt(0) <= 90 ; \n}", "function latinWordStartCheck(contextParams) {\n\t var char = contextParams.current;\n\t var prevChar = contextParams.get(-1);\n\t return (\n\t // ? latin first char\n\t (prevChar === null && isLatin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates a single block (1 byte) using DES. The update will either encrypt or decrypt the block.
function _updateBlock(keys, input, output, decrypt) { // set up loops for single or triple DES var iterations = keys.length === 32 ? 3 : 9; var looping; if(iterations === 3) { looping = decrypt ? [30, -2, -2] : [0, 32, 2]; } else { looping = (decrypt ? [94, 62, -2, 32, 64, 2, 30, -2, -2] : ...
[ "update(req, res) {\n\n let id = req.param(\"id\");\n\n Block.findById(id, (error, block) => {\n if (error) return res.serverError(error);\n if (!block) return res.notFound(req.lang(\"block.errors.block_not_found\"));\n\n if (!req.can(\"block.update\", block)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Depois que a lista foi ordenada habilita que os processos sejam "draggable"
function orderedReadyList() { $('.draggable').draggable({ containment: '#draggable-area', revert: true, start: function() { startTime = $.now(); // Muda a cor do processador para receber o processo $('#processor ul').anim...
[ "function dragdropElementos(){\n $('img').draggable({\n\t\tcontainment: '.panel-tablero',\n grid: [115, 95],\n droppable: 'img',\n\t\trevert: true,\n\t\trevertDuration: 100,\n\t\topacity: 0.8,\n\t\tzIndex: 1,\n\t});\n\t$('img').droppable({\n\t\tdrop: intercambiar\n\t});\n}", "async function trigger_drop() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is used for submit installation information to back end
function submitInstallationInfo() { var validateStatus = validateInstallations(); console.log("validateStatus ::::::::: " + validateStatus); if (validateStatus) { var formData = $('#installationsAndPayments').serializeInstallationObject(); //console.log("formData ::::::::: "+JSON.st...
[ "callInstallDetails() {\n const requestConfig = {};\n this.manageShoppingCartService.installationDetails(requestConfig, this.handleInstallationDetailsResponse, this.handleInstallationDetailsError, this.installDetails.code);\n this.$refs.spinner.showSpinner();\n }", "function saveInstallments(){\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert the 2d board array into a 1d array with unique ids
transformBoardToArray (board) { const boardArray = [] for (let i = 0; i < board.length; i++) { for (let j = 0; j < board[i].length; j++) { boardArray.push({ id: (i * 8) + j, // id will be equal to the original index position piece: board[i][j] }) } } retur...
[ "function change_from_2D_to_1D(array)\n{\n\tvar new_array = [];\n\tfor (var i = 0; i < array.length; i++)\n\t{\n\t\tfor (var j = 0; j < array[i].length; j++)\n\t\t{\n\t\t\tnew_array.push(array[i][j]);\n\t\t}\n\t}\n\treturn new_array;\n}", "function create2dArray(ids_array, ansType_array) {\n var twoD_array = [...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_add_print_subtree_to_ast Constructs a subtree in the abstract syntax tree rooted with the Keyword While, adding: BooleanExpr Block Remember, if you built your concrete syntax tree correctly... For WhileStatement ::== while BooleanExpr Block Node(While).children[0] > Keyword While [while] Node(While).children[1] > Node...
_add_while_subtree_to_ast(while_node) { this.verbose[this.verbose.length - 1].push(new NightingaleCompiler.OutputConsoleMessage(SEMANTIC_ANALYSIS, INFO, `Adding ${while_node.name} subtree to abstract syntax tree.`) // OutputConsoleMessage ); // this.verbose[this.verbose.length - 1].push ...
[ "_add_print_subtree_to_ast(print_node) {\n this.verbose[this.verbose.length - 1].push(new NightingaleCompiler.OutputConsoleMessage(SEMANTIC_ANALYSIS, INFO, `Adding ${print_node.name} subtree to abstract syntax tree.`) // OutputConsoleMessage\n ); // this.verbose[this.verbose.length - 1].push\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
search directories upward to avoid hardwired paths based on the build tree (same as src/harness/findUpDir.ts)
function findUpFile(name) { let dir = __dirname; while (true) { const fullPath = join(dir, name); if (existsSync(fullPath)) return fullPath; const up = resolve(dir, ".."); if (up === dir) return name; // it'll fail anyway dir = up; } }
[ "function traverseUp( filePath, Paths, Ancestors ){\n\tvar index, start, end,\n\t\tsplit = filePath.split('^');\n\t\n\t//Throw an error if there is more than one ^ in the given filePath\n\tif( split.length > 2 ){\n\t\tthrow new Error('Invalid File Path : ' + filePath)\n\t}\n\t\n\t//Get the start directory and the e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Query buoys from the server
function queryBuoys() { server.getBuoys().then(function(res) { vm.buoys = res.data.buoys; formatBuoys(); }, function(res) { gui.alertBadResponse(res); }); }
[ "function queryBuoyInstances() {\n server.getBuoyInstances().then(function(res) {\n vm.buoyInstances = res.data.buoyInstances;\n formatBuoys();\n }, function(res) {\n gui.alertBadResponse(res);\n });\n }", "function getBuses(admi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
api url format: /strip?date="+date_value
function getStripByDate(req,res){ var date = req.query.date; database .getStripByDate(date) .then(function (strip) { if (strip === null) return res.send("0"); else return res.json(strip); }, function (err) { return res....
[ "formatUrl(date) {\n return this.url.replace(/\\{\\{([^}]+)\\}\\}/, (_, fmt) => strftime(date, fmt))\n }", "function datePrecedente(date) {\n var dt = date.split('/');\n var myDate = new Date(dt[2] + '-' + dt[1] + '-' + dt[0]);\n myDate.setDate(myDate.getDate() + -1);\n newDate = formatDateSlash(m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this is the App component it has component level states it manages the child components to render dynamically based data
function App(data, parent) { // create the root div component this.component = document.createElement('div'); // simple tracking of component lifecycle status this.rendered = false; // set initial value of component level state this.state = { checked: [], data: data }; // define component method to up...
[ "function App() {\n return (\n <Provider store={store}>\n <div className=\"App\">\n <header className=\"App-header\">\n {/* <MonitorChart/> */}\n {/* <Form1/> */}\n {/* <ModalTest/> */}\n {/* <Demo3 initData={\"3\"}/> */}\n {/* <JqDemo1/> */}\n {/* <Demo1/> */...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For each gene in this gene set, mutates to a random gene with mutation_rate chance
mutate() { this._genes.forEach((gene, idx) => { if (probability(this._mutationRate)) { if (idx) { this._genes[idx] = randomInArray(alphabet); } else { this._genes[0] = Math.random() * 10; } } ...
[ "changeRandomWeight(){\n\t\tvar i = Math.floor(Math.random() * this.genes.length)\n\n\t\t//we can only use an available gene\n\t\tif (this.genes[i] != null){\n\t\t\tthis.genes[i].weigth = (Math.random() * 2) - 1 //betwenn -1 and 1\n\t\t} else {\n\t\t\tthis.changeRandomWeight()\n\t\t}\n\t}", "function mutate(chrom...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the welcome message mode to live, beta or disabled.
setWelcomeMessageMode(welcomeMessageMode) { Instabug.setWelcomeMessageMode(welcomeMessageMode); }
[ "showWelcomeMessage(welcomeMessageMode) {\n Instabug.showWelcomeMessageWithMode(welcomeMessageMode);\n }", "function setNewPresence() {\n // Select a random activity\n const settings = names[Math.floor(Math.random()*names.length)];\n\n // Set the status\n client.user.setPresence(settings);\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is equally likely to generate a male or female
function generateGender() { var rand = Math.random(); var gender; if (rand < .5) { gender = 'F'; } else { gender = 'M'; } return gender; }
[ "function SheHe(Obj) {\n if (Obj.gender == \"male\" || Obj.gender == \"Male\") {\n return \"He\";\n }\n else {\n if (Obj.gender == \"female\" || Obj.gender == \"Female\") {\n return \"She\";\n }\n }\n}", "function validateGender(input){\n if(input.toLowerCase() == \"male\" || input.toLowerCase(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
searches for domain data with query and updates state with the new data
async searchForDomain (){ var data = await mapDomainData(this.state.query); if(data === null){ this.setState({error: true}) } else{ this.setState({ domainData: data, error: false }); } }
[ "searchQuery (value) {\n let result = this.tableData\n if (value) result = this.fuseSearch.search(this.searchQuery)\n else result = []\n this.searchedData = result\n }", "static upsert(query, data) {\n const item = __.findOne(query);\n if (!item)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For some dumb reason, we need both ontriggerenter2d and ontriggerstay2d to spawn the zombies. I dont know if doing it this way breaks something else.
function MagicTrigger (zombieSpawner : Collider2D) { if(zombieSpawner.gameObject.name=="ZombieRespawn"){ current_lane_spawning=lane; if(cm.CanSpawn(ZombiePickerMaster.mouse_x, ZombiePickerMaster.mouse_y, lane)){ ZombiePicker.can_spawn=true; }else{ ZombiePicker.can_spawn=false; } } //if (zo...
[ "createInteractionZones() {\n this.r3a1_graphics = this.add.graphics({fillStyle: {color: 0xFFFFFF, alpha: 0.0}});\n //this.graphicsTest = this.add.graphics({fillStyle: {color: 0x4F4F4F, alpha: 1.0}});\n //TOP ZONES\n //xpos ypos x y\n this.r3a1_increaseAs...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns courses with the given course number. If only one exact match is found, a list containing only that course is returned. Otherwise, all courses with course numbers starting with the given string all returned. Returns an empty list if no matches are found at all. Input must be an exact, alluppercase, nonpadded co...
function findCoursesByCourseNumber(courseNumber) { var exactMatches = []; var closeMatches = []; for (var i = 0; i < departments.length; i++) { var department = departments[i].code; var courses = coursesByDepartments[department]; for (var j = 0; j < courses.length; j++) { if (courses[j].cnum ===...
[ "static async findCourse(string){\n const result=await pool.query('SELECT *,LOWER(coursename),INSTR(LOWER(coursename),?) FROM course WHERE INSTR(LOWER(coursename),?)>0 ORDER BY INSTR(LOWER(coursename),?);',[string,string,string]);\n return result;\n }", "function numberInList(number, numbers) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check is line to clear
function isLineToClear(y, board){ /** * Working on board, make copy first */ if(virtualBoard.length < 1){ return false; } const rowInBoard = virtualBoard.filter((piece)=>{ const pieceTranslateY = parseInt(piece.style.transform.slice(11,14).trim()); return y === pieceTra...
[ "function lineClear() {\n\tlet countClearLines = 0;\n\tlet line = 0;\n\tlet lineCount = grid[0].length - 2;\n\tfor (let i = 0; i < grid.length; i++) {\n\t\tfor (let j = 0; j < grid.length; j++) {\n\t\t\tif (grid[j][lineCount] === true) line++;\n\t\t}\n\t\tif (line === grid.length) {\n\t\t\tcountClearLines++;\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fonctions about DOM elements showed on pages ////////////////////////////////////////////// Create a node with the location, tag and a list of attributs
function createNode(location, tag, ListOfAttributs = {}) { let node = document.querySelector(location); let createdTag = document.createElement(tag); // Get the list of attributs and creates tag(s) in fonction of it for(const [key, value] of Object.entries(ListOfAttributs)){ createdTag[key] = value; }...
[ "function createElement(loc, tag, id='', el_class='', text='') {\n var element = document.createElement(tag);\n if (id != '') {\n element.setAttribute('id', id);\n }\n if (el_class != '') {\n element.setAttribute('class', el_class);\n }\n if (text != '') {\n element.innerText ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
La funcion de modificar_datos() actualiza los datos en firebase, la primera variable que recibe es de tipo usuario, y las otras son de tipo string como nombre, anio, mes, dia y gener, que son las variables que se actualizaran
modificar_datos(user, nombre, apellido, anio, mes, dia, gener) { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function* () { try { const datos = { nombre: nombre, apellido: apellido, a...
[ "modificar_compartimento(user, marca, medicamento, Npastilla, Ntratamiento, temp_max, hum_max, hora) {\n try {\n const compar1 = {\n marca: marca,\n medicamento: medicamento,\n Npastilla: Npastilla,\n Ntratamiento: Ntratamiento,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Depending on the town selected in the drop down list return contacts filtered by town If no town is found show an alert informing the user
getContactByTown(town){ if(town === "ALL") { ContactService.getContact().then((res) => { this.setState({ contacts: res.data}); }); } else { ContactService.getContactByTown(town).then((res) => { this.setState({ contacts: res.data})...
[ "function searchChangeOfficeDetails() {\r\n\tvar strPinCode = $(\"#txtChangeOfficeBookingSearchPinCode\").val().trim();\r\n\tvar strAreaName = $(\"#txtChangeOfficeBookingSearchAreaName\").val().trim();\r\n\tvar strCityName = $(\"#txtChangeOfficeBookingSearchCityName\").val().trim();\r\n\t\r\n\t// Validating if user...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the watchlisted movies of users by user id return an array of watchlisted movies
function getWatchlistedMoviesOfUsers(userId) { let watchlistedMovies = [] movies.map(movie => { if (movie.watchlist.includes(userId)) { watchlistedMovies.push(movie.title) } }) return watchlistedMovies }
[ "function getWatchlistedMoviesOfUsersFriends(userId) {\n\n let watchlistedMovies = []\n\n getUserFriends(userId).map(friendId => {\n watchlistedMovies = [...watchlistedMovies, ...getWatchlistedMoviesOfUsers(friendId)]\n })\n\n return watchlistedMovies\n}", "static async apiGetUserReviewMovies(r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes the global issues array Should be called on every page that needs the issues array.
function initIssues() { //ids start at 5 so fill in 0-4 to make retrieval bawed on array index trivial issues = [0, 0, 0, 0, 0, {id:5, name:"Alumni"}, {id:6, name:"Animals"}, {id:7, name:"Children"}, {id:8, name:"Disabilities"}, {id:9, name:"Disasters"}, {id:10, name:"Education"}, {id:11...
[ "function getIssues() {\n TestService.getTestCaseWorkItemsByType(test.id, 'BUG').\n then(function(rs) {\n if (rs.success) {\n vm.issues = rs.data;\n if (test.workItems.length && vm.attachedIssue) {\n angular.copy(vm.attach...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggle between showing and hiding the sidebar, and add overlay effect
function open_sidebar() { if (mySidebar.style.display === 'block') { mySidebar.style.display = 'none'; overlayBg.style.display = "none"; } else { mySidebar.style.display = 'block'; overlayBg.style.display = "block"; } }
[ "function showSidebarBrowser()\n{\n $(\".sidebar-browser\").show();\n hideBrowserTemplatesInUse();\n}", "function showstartupElementSidebar() {\n\n if (!(typeof startupSlideExitHandle === \"undefined\")) {\n clearTimeout(startupSlideExitHandle);\n }\n\n if (!(typeof startupSlideEnterHandle === \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
perform math for isometric projection this function take the postion on the screen and tells which grid tile under that screen postion
function convertScreenToGrid(x, y) { const a = (((x - gridX - offsetY) / zoom) / (tileWidth / 2)) / 2 const b = (((y - gridY - offsetX) / zoom) / (tileHeight / 2)) / 2 return { x: Math.floor(b - a), y: Math.floor(a + b) } }
[ "function drawGridContent(){\n for( var i =0; i<=cw/100; i++){\n for(var j=0; j<=ch/100; j++){\n var cI = i.toString()+'-'+j.toString();\n if( cI in gridContent){\n\tif(gridContent[cI]>=0){\n\t if( pickThis == cI){\n\t /* Mouse motion: puzzle piece follows mouse coordiantes: */\n\t drawPiece(mx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to check and highlight incorrect squares
function checkIncorrectSquares() { if(this.checked) { for (var x = 0; x < colorArray.length; x++) { for (var y = 0; y < colorArray.length; y++) { var cell = document.getElementById("cell"+x+"-"+y); if ((cell.style.backgroundColor !== colorArray...
[ "function addColours() {\n for (let i=0; i<squares.length; i++) {\n if (squares[i].innerHTML == 0) {\n squares[i].style.backgroundColor = '#afa192'; \n } \n else if (squares[i].innerHTML == 2) {\n squares[i].style.backgroundColor = '#eee4da'; \n }\n else ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method use to remove error of expiry from credit, debit & emi.
function removeError(self) { var str = document.getElementById(self.parentNode.id).style.border; if (self.value !== '' && str.search("255") > -1) { var id = self.id; var date = new Date(); var month = date.getMonth(); var year = date.getFullYear(); var selector = id.split...
[ "function cleanErrorMessages() {\n\t$(\"#capitalError\").text(\"\");\n\t$(\"#monthsError\").text(\"\");\n\t$(\"#rateError\").text(\"\");\n\t$(\"#interestPaymentsError\").text(\"\");\n\t$(\"#expenditureError\").text(\"\");\n\t$(\"#expenditurePeriodicityError\").text(\"\");\n\t// for periods\n\tfor (id = 1; id <= per...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mergeDefaults (options: Object) => Object
function mergeDefaults(options) { options = options || {}; // create a new object, merging `options` over the top of defaults return Object.assign({}, { cwd: process.cwd(), dryRun: false, filePaths: null, fs, prune: false, s3: null, skip: true }, options); }
[ "static GetOptions(options, defaultOptions) {\n let _options = {};\n if (!options) {\n options = {};\n }\n if (!defaultOptions) {\n defaultOptions = LowPolyPathBuilder.GetDefaultOptions(options ? options.version : undefined);\n }\n for (let param in de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a pushToken function for a given type
function pushToken(type) { return function (v) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var startColumn = opts.startColumn || column - String(v).length; delete opts.startColumn; var endColumn = opts.endColumn || startColumn + String(v).length - 1; ...
[ "function createFieldToken(field, id, type){\n \n // Get field value and token container\n \n let value = $(field).val();\n let container = $(field).siblings('.token-container');\n let tokenNo = $(container).find('.token').length + 1;\n \n // If token container doesn't exist, create it\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds instructor names from Cal Schedule Website
function getInstructors() { var elements = document.getElementsByClassName("ls-instructors fspmedium"); for (let item of elements) { // Finds course title for respective professors var courseTitle = item.parentNode.querySelector('.ls-course-title').innerHTML; var simpleCourseTitle = c...
[ "function lookUpInstructor(firstName, lastName, element, courseKey) {\n const rmpAPI = \"https://cors-anywhere.herokuapp.com/https://solr-aws-elb-production.ratemyprofessors.com//solr/rmp/select/?solrformat=true&rows=20&wt=json&json.wrf=noCB&callback=noCB&q=\"+ firstName + \"+\" + lastName +\"&qf=teacherfirstnam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event handler called when the category breadcrumb delete button is clicked Erases current category, which results in showing all available categories in the category dropdown
handleBreadcrumbDelete() { let emptyCategory = this.state.category; emptyCategory.itemCategory.name = null; emptyCategory.breadcrumb = []; this.setState({ category: emptyCategory }); this.getDropdownCategories(); }
[ "function deleteCategory(e, category) {\n e.preventDefault();\n\n // find the index of the object we're removing from the array\n const indexToRemove = budgetData.expenses.findIndex(\n (element) => element.categoryName === category\n );\n\n // delete the category from the atom\n let expensesA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add by Brad,just for USB content
function playUsbContent() { debugPrint("test_length" + HiFileBrowser.contentsCurrentData.length); if (HiFileBrowser.contentsCurrentData.length > 0) { debugPrint(JSON.stringify(HiFileBrowser.contentsCurrentData[HiFileBrowser.curFile]) + "_____(currentData user choose)"); switch (HiFileBrowser.co...
[ "function setDeviceInformation(devPath,model,src,manufac,ostyp,prdfmly,ipadd,prot,hostnme,devtype){\n//\tvar devtype = getDeviceType(model);\n\tif(manufac){\n\t\tvar manu = manufac;\n\t}else{\n\t\tvar manu = getManufacturer(model);\n\t}\n\tvar myPortDev = [];\n\tif(globalInfoType == \"JSON\"){\n\t\tsetDevicesInform...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Choropleth chart to show the number of suicides for each country
function show_country_map(ndx, countriesJson) { //Data dimension for country let country_dim = ndx.dimension(dc.pluck('country')); //Data group for no of suicides per 100k people for each country let total_suicide_by_country = country_dim.group().reduceSum(dc.pluck('suicides_100k')); dc.geoCh...
[ "function show_countries_with_highest_suicide(ndx) {\n //Data dimension for country\n let country_dim = ndx.dimension(dc.pluck('country'));\n //Data group for no of suicides per 100k people for each country\n let total_suicide_by_country = country_dim.group().reduceSum(dc.pluck('suicides_100k'));\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Closes all bindings bound to this target.
closeBindings() { this.receiver_.closeBindings(); }
[ "close() {\n\t\t// Close all live sockets\n\t\tthis.sockets.forEach(socket => {\n\t\t\tif (!socket.destroyed) socket.end();\n\t\t});\n\n\t\tthis.sockets.clear();\n\t}", "closeAll() {\n this.openDialogs.forEach(ref => ref.close());\n }", "function closeAllConnections() {\n var i;\n for (i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays account info for email message. Valid fields are: achdistnbr;achdistorder;ebankid;ebnkacctnbr;accounttype,xlt; netpercent;depositamt;description;checkdesc;begdate;enddate;defaultflag; accounttype;dedcycle;employee.achdistnbr;employee.autodeposit; payableto;bankrollno
function WriteAccount(acct) { if (typeof(acct) == "undefined" || acct == null || !acct) return "" var Info = "" if (Employee.work_country == "UK") { Info += getSeaPhrase("DD_35","DD")+": "+acct.description+"\n" } else { Info += getSeaPhrase("DD_36","DD")+": "+acct.description+"\n" } if (Employee.work_...
[ "function displayInfo(name, account, business) {\n console.log(`Account Holder Name: ${name}`);\n console.log(`Account Holder Number: ${account}`);\n console.log(`Business Name: ${business}`);\n}", "function UpdateAccount(queue,index,evt,fc,warning,action)\n{\n\tthisQueue = queue\n\n\tvar ddObj \t= new A...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recognizes and collects stanzas used for ordinary TCP streams and Websockets. API: write(data) & end(data) Events: streamStart, stanza, end, error
function StreamParser (options) { EventEmitter.call(this) var self = this var ElementInterface = (options && options.Element) || Element var ParserInterface = (options && options.Parser) || LtxParser this.maxStanzaSize = options && options.maxStanzaSize this.parser = new ParserInterface() /* Count traff...
[ "register(stream) {\n const streamState = new StreamInfo(stream);\n stream.on('end', this._streamEnd(streamState));\n stream.on('data', this._streamData(streamState));\n this._streams.push(streamState);\n this._ensureActiveTask();\n }", "function setupStreams() {\n // setup ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checkOverrides will return the user that is currently oncall after checking overrides.
function checkOverrides(user, overrides) { for (let i in overrides) { let override = overrides[i] if (override.origOnCall === user) { let now = Date.now() // Check that Date.now() is between the start and end of the matched override. if ((now > new Date(override.start).getTime()) && (now < new Date(overr...
[ "function checkLogedInUser() {\n\n}", "function getCurrentOnCallUsername() {\n\tlet user = \"\"\n\t// Get the rotation that has an onCall user.\n\tfor (let i in this.raw.schedule) {\n\t\tlet sched = this.raw.schedule[i]\n\t\tif (sched.onCall) {\n\t\t\tuser = sched.onCall\n\t\t}\n\t}\n\n\t// Return Error if no use...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate initials from a name.
function generateInitials(name){ var initials=""; splitName=name.split(" "); if(splitName.length<3){ //Add the two first letters of every name. for(var i=0;i<splitName.length;i++){ initials+=splitName[i].substring(0,2); } } else{ //Add first letter of the first name. initials+=splitName[0].substr...
[ "_getInitial(name) {\n return name[0].toUpperCase();\n }", "function createUserNames(accs) {\n accs.forEach(function (acc) {\n acc.username = acc.owner\n .toLocaleLowerCase()\n .split(\" \")\n .map((word) => word[0])\n .join(\"\");\n });\n}", "function alphabetizer(names) {\n var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function loops through the elements on the form and pushes them into the empty array. the variable values is then set to equal that array
function loopEls(elements){ //An empty array to push the values into var valuesNew = []; // loops through the form elements and gets their values for (var i = 0; i < elements.length; i++) { valuesNew.push(elements[i].value); }; values ...
[ "function getInputEleVals(eles) {\n var valArr = [];\n for(var i = 0; i< eles.length; i++) {\n valArr.push(eles[i].value);\n }\n return valArr;\n}", "function meteElementosEnArray() {\n for (let i = 1; i <= numElementos; i++) {\n cantidad = document.getElementById(\"cantidadEl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================== Function that resets the points of the game ===============================================
function quizgame_reset_points(){ //Set the points at the beginning of the game to zero quizgame_tigerpoints = 0; quizgame_tupoints = 0; }
[ "resetGame() {\n\t\tthis.ballX = this.width / 2 - this.BALL_RADIUS / 2;\n\t\tthis.ballY = this.height / 2 - this.BALL_RADIUS / 2;\n\n\t\tthis.paddle1Y = this.height / 2 - this.PADDLE_HEIGHT / 2;\n\t\tthis.paddle2Y = this.height / 2 - this.PADDLE_HEIGHT / 2;\n\t}", "function resetGame() {\n ships._ships = [];\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open a new tab to download the CSV file
function downloadCSVFile() { window.open('/ReportController/downloadCSVFile', '_blank'); }
[ "createDownloadLinkForCsvFile () {\n // put metrics as download link value\n Csv.filename = 'busrideMetrics_' + Utils.getCurrentDateAndTime(new Date()) + '.csv'\n csvDownloadLink.setAttribute(\n 'href',\n 'data:text/plain;charset=utf-8,' + encodeURIComponent(Csv.contents))\n csvDownloadLink.se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate parameters p output parameters array v input parameter values d default values f extra process function
function $GP(v, d, f) { var i = 0, p = []; while (i < v.length) { p[i] = v[i] ? (f[i] ? f[i](v[i]) : v[i]) : d[i]; i += 1; } while (i < d.length) { p[i] = d[i]; i += 1; } return p; }
[ "function createPasswordArray(par1, par2, par3, par4){\n if ((par1 === true) && (par2 === true) && (par3 === true) && (par4 === true)){\n passwordVals = lowercaseChar.concat(uppercaseChar).concat(specialChar).concat(numericChar);\n passwordVals = randomizePlacement(passwordVals);\n } else if ((par1 === tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
share a random media from the selection provided
function handleMediaShare(entry) { // need to click the entry before entry_method.media is defined entry.enterLinkClick(entry.entry_method); markEntryLoading(entry); // and then wait var temp_interval = setInterval(function() { if(entry.entry_method.media) { var choices = entry.entry_method.med...
[ "function chooseSong() {\n song = _.sample(sampleArray);\n\n // while the id is in the recentlyPlayedSongs array, pick another\n while(recentlyPlayedSongs.some(function (e) { return e.id == song.id; })) {\n song = _.sample(sampleArray);\n }\n\n // adjust recentlyPlayedSongs\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an error view.
errorView() { var table = this.table; var reg = this.getReg(); return this.singleLine(table, reg.errorFetchingData); }
[ "function errorPage(req, res, err) {\n\tres.type(\"text/html\");\n\tres.charset = \"utf-8\";\n\tres.write(header(req));\n\tres.write(`\n\t<div class=\"infobox\">\n\t\t<h2><i class=\"fas fa-exclamation-triangle\"> </i> Failed to load</h2>\n\t\t${err}\n\t</div>`);\n\treturn res.end(footer());\n}", "function renderE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load data from blockexplorer.com.
function loadBlockExplorerData(node,publicKey) { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { var status = xhr.status; if (status == 200) { var myBalance = xhr.response; loadBlockExplorerReceived(node,publicKey,myBalance); } else { node.innerH...
[ "async loadBlockchainData() {\n let web3\n \n this.setState({loading: true})\n if(typeof window.ethereum !== 'undefined') {\n web3 = new Web3(window.ethereum)\n await this.setState({web3})\n await this.loadAccountData()\n } else {\n let infuraURL = `https://ropsten.infura.io/v3/${...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get engines for given value
_getEngines(value) { if (!value) { return null; } return value.split(',').map(function (item) { return new engineMap[item](); }); }
[ "async function getTargetEngines(asset) {\n let targets = {};\n let compileTarget = BROWSER_CONTEXT.has(asset.env.context) ? 'browsers' : asset.env.context;\n let pkg = await asset.getPackage();\n let engines = pkg && pkg.engines;\n\n if (compileTarget === 'node') {\n let nodeVersion = engines === null || e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ removeThis() is called when the user presses Enter in the Remove Course box or presses the Remove Course button / It santizes the user input by adding a white space if needed and converts the characters to uppercase / It uses regex to determine if the user input was entered in the correct format / The function will s...
function removeThis() { var spaced = addSpace(document.getElementById("removeMe").value); var Sanitize2 = spaced; var upperCase = Sanitize2.toUpperCase(); var re = /^[A-Z]{4}\s{1}[A-Z0-9]+/; if (re.test(upperCase) == 0) { alert("Not a Valid Input. Please follow this format: COEN 10"); document.getElem...
[ "function removeSubjectClass(){\n $(\".questionContainer\").removeClass(\"AH LA MA SC SS\");\n}", "function removeClass(obj, cls) {\n //defining variable classNameArray for array, which created by method split\n var classNameArray = obj.className.split(\" \");\n //loop for searching cls in classNumberAr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds a state with a specified hue and brightness
function buildHueState(hue, bri, trans) { return JSON.stringify({ on: true, bri: bri, hue: hue, sat: 254, transitiontime: trans/100 }) }
[ "function RGBtoHSB(red, green, blue)\n{\n //Normalize input\n let r = red/255;\n let g = green/255;\n let b = blue/255;\n \n //Obtain maximum and minimum input values\n let maximum = max(r,g,b);\n let minimum = min(r,g,b);\n \n //Declare h, s, and b variables\n var hue;\n var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if given public keys are equal.
function publicKeyEqual(keyA, keyB) { return normalizePublicKey(keyA) === normalizePublicKey(keyB); }
[ "function testKeys(){\n\t\tvar server_K = $.trim($('#server_K').text()); //DEBUG-ONLY!!\n\t\tvar client_K = $.trim($('#client_K').text());\n\t\tif(server_K != \"\" && client_K != \"\"){\n\t\t\tif(server_K == client_K){\n\t\t\t\t$('#result_test').html(\"Keys are identical. Key exchange was successful.\");\n\t\t\t}\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On the first template pass, the reserved slots should be set `NO_CHANGE`. If not, they might not have been actually reserved.
function assertReservedSlotInitialized(slotOffset, numSlots) { if (firstTemplatePass) { var startIndex = tView.bindingStartIndex - slotOffset; for (var i = 0; i < numSlots; i++) { assertEqual(viewData[startIndex + i], NO_CHANGE, 'The reserved slots should be set to `NO_CHANGE` on first t...
[ "addSlotKeys() {\n\t\t\tthis.$slots.default.forEach((item, index) => {\n\t\t\t\titem.key = item.key!=null?item.key:index;\n\t\t\t});\n\t\t}", "removeAllSlots() {\n var size = this.closet_slots_faces_ids.length;\n for (let i = 0; i < size; i++) {\n this.removeSlot();\n }\n }", "emptySlots(){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Kick the target user from the group. Make sure that both users are part of the group and that 'user' has a more powerful role than 'targetUser' before kicking them. The logic should be the same as leaveGroup(), just with an additional check to make sure the user has permission.
async function kick(user, group, targetUser) { await permissionCheck(user, group, targetUser, 'kick'); await removeFromGroup(targetUser, group); }
[ "function KickUser(ws, currentLobbyId, newLobbyId, customMessage) {\n // TODO: distinguish between being kicked and disconnecting, the current disconnect gives a kicked from lobby message\n if (currentLobbyId === nullLobbyId) {\n return;\n }\n\n // remove user from server list //\n var index = lobbies[curre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convertit un nombre en base 10 en un nombre en base 36 int > string
function ze_Base_10_36(n) { if(n == 0) { return 0; } var nombre = new Array(), res = new String; while(n != 0) { if(n >= 36) { nombre.push(n%36); n = parseInt(n/36); } else { nombre.push(n); n = 0; } } for(var i=nombre.length-1; i>-1; i--) { res += String(caracteres[nombre[i]]); } retu...
[ "function siiB(e) {\r\n\treturn Math.round(parseInt(e)).toString(36);\r\n}", "function baseConverter(decNumber, base) {\r\n\tvar nStack = new Stack(),\r\n\t\tn,\r\n\t\tbaseString = '';\r\n\t\tdigits = '0123456789ABCDEF';\r\n\r\n\twhile (decNumber > 0 ) {\r\n\t\tn = Math.floor(decNumber % base);\r\n\t\tnStack.push...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Faker creating 10 posts each category, each user
function seedingPosts(authors, postCategories) { const Post = mongoose.model('Post', postSchema); const posts = []; for (let i = 0; i < 100; ++i) { const nCategories = faker.random.number(2) + 1; const categories = faker.helpers.shuffle(postCategories).slice(0, nCategories); posts....
[ "function seedingCategories() {\n const PostCategory = mongoose.model('PostCategory', postCategorySchema);\n\n const fakeCats = [];\n for (let i = 0; i < 10; ++i) {\n const name = faker.lorem.words();\n fakeCats.push({\n name,\n slug: faker.helpers.slugify(name),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the URI of the currently running sync task. Null if no task is running.
async function getRunningSyncTask() { const result = await query(` PREFIX ext: <http://mu.semte.ch/vocabularies/ext/> PREFIX dct: <http://purl.org/dc/terms/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX adms: <http://www.w3.org/ns/adms#> SELECT ?s WHERE { ?s a ext:SyncTask ; ...
[ "get task () {\n return this._mem.work === undefined ? null : this._mem.work.task;\n }", "get activeTextEditorUri() {\n if (typeof vscode.window.activeTextEditor !== 'undefined' &&\n typeof vscode.window.activeTextEditor.document !== 'undefined') {\n return vscode.window.act...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function formats the data as required for saved connections page and renders the page
async function renderSavedConnectionsPage(req,res){ var allUsersMap = await userDB.getAllUsers(); var currentUser = allUsersMap.get(req.session.theUser); var dataForTable = await createDataForTable(req.session.userConnectionsList ); res.render('savedConnections',{username:currentUser.firstName, dataForTable: da...
[ "function renderWatch2Page(data) {\n\n var page2 = $('.watch2'),\n container2 = $('.watch2Stuff')\n\n if(data.length) {\n data.forEach(function (item) {\n if(item._id == \"57af142ffb2fa22659e55c18\") {\n container2.find('h2').text(item.name);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get name of an image of the given category
function getImageName(category, callBack) { if (getImageName.imageName) { callBack(getImageName.imageName); } else { suite.execute('vm image list --json', function (result) { var imageList = JSON.parse(result.text); imageList.some(function (image) { if (image.category.toLowerCase() === ca...
[ "getClassNameForCategory(category) {\n\t\tlet className = \"\";\n\n\t\tswitch (category) {\n\t\tcase \"a\": {\n\t\t\tclassName = \"light_brown\";\n\t\t\tbreak;\n\t\t}\n\t\tcase \"b\": {\n\t\t\tclassName = \"light_purple\";\n\t\t\tbreak;\n\t\t}\n\t\tcase \"c\": {\n\t\t\tclassName = \"pink\";\n\t\t\tbreak;\n\t\t}\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a 2D array representation of a numbered triangle into a weighted adjacency matrix.
function makeAdjMatTriangle(tri2DArray) { var rows = tri2DArray.length; var columns = tri2DArray[rows - 1].length; var numNodes = getNumNodes(tri2DArray); var adjmat = new Array(numNodes); var r, c; for (r = 0; r < numNodes; r++){ adjmat[r] = new Array(numNodes); for (c = 0; c <...
[ "function makeWeightArray(tri2DArr){\n var vertexWeights = new Array(getNumNodes(tri2DArr));;\n var count = 0;\n for(var i = 0; i < tri2DArr.length; i++){\n for (var j = 0; j < tri2DArr[i].length; j++){\n vertexWeights[count] = tri2DArr[i][j];\n count++;\n }\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a span with inline SVG for the element.
function buildSvgSpan_() { var viewBoxWidth = 400000; // default var label = group.value.label.substr(1); if (__WEBPACK_IMPORTED_MODULE_4__utils__["a" /* default */].contains(["widehat", "widetilde", "utilde"], label)) { // There are four SVG images available for each function. ...
[ "createSVGElement(w,h){const svgElement=document.createElementNS(svgNs$1,'svg');svgElement.setAttribute('height',w.toString());svgElement.setAttribute('width',h.toString());return svgElement;}", "function createSpan(){\n return document.createElement('span');\n}", "_renderIcon () {\n let p = this._props...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populate the stop table with a nominal ascent profile
function nominalAscent() { var ascentInfo = {firstStop: 0, TTS: 0, ascentTime: 0}; var firstStop = 0; var maxDepth = parseFloat(document.getElementById("MaxDepth").value); var table = document.getElementById("addRowsHere"); if (document.getElementById("nominal").checked) { firstStop = roundUp((maxDepth ...
[ "function startStopWatch() {\n if (!running) {\n startTime = new Date().getTime();\n tableSize++;\n newRow = historyTable.insertRow(tableSize);\n \n newStart = newRow.insertCell(0);\n startLatitude = newRow.insertCell(1);\n startLongitude = newRow.insertCell(2);\n newStop = newRow.insertCel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
collect all DOM elements with 'scope' and 'bind' attrs for processing watchers bindEls jquery collection of DOM elements scope scope item scopeStorage item
function watchToElements(bindsEls, scope, item){ // bind watchers var self = this; bindsEls.each(function(index, el){ var $el = $(el); var exp = el.getAttribute('jr-watch'); // split all defined methods var methods = exp.split(';'); ...
[ "function setScopeOnElements(elements, scope) {\n for (let i = 0; i < elements.length; i++) {\n elements[i].setAttribute('scope', scope);\n }\n}", "function checkBindings () {\n addLog('checkBindings() was Triggered');\n // if dataBoundNodes has elements in it, loop through each one and\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
formats telemetry data for graphing
formatData() { let formattedData = [[ { type: 'date', label: 'Time' }, 'CPU Usage', 'Memory Usage', ]]; let unformattedData = this.state.telemetry unformattedData.map(data => { return formattedData.push([ new Date(parseInt(d...
[ "function formatData(data) {\n return data.map((el) => {\n return {\n x: new Date(el[0]).toLocaleString().substr(11,9),\n y: el[1].toFixed(2),\n };\n });\n }", "async sendToTelemetry() {\n let reporter;\n try {\n reporter = await telemetry_1.default.create({...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the original method used for retrieving the next meetup. It used a error first callback
function getNextMeetup(cb) { var sreq = https.request(httpsOptions, function (response) { response.setEncoding('utf8'); response.on('data', function (chunk) { nextMeeting += chunk; }); response.on('end', function () { var err = false; if (nextMeeti...
[ "async function getNextMeetupV4() {\n return nextmeeting[0];\n}", "async function getNextMeetupV3() {\n const meetingCache = cache.get('nextMeeting');\n if (meetingCache) {\n return meetingCache[0];\n } else {\n const response = await fetch('https://api.meetup.com/2/events?&sign=true&gro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return current unread count
function getUnreadCount() { return unreadCount; }
[ "function getCurrentCount(){\n return parseInt(counterTag.innerText)\n }", "updateNotification(messageObject, unseenChatCount) {\n for(let chatId in messageObject) {\n if(messageObject.hasOwnProperty(chatId)) {\n messageObject[chatId].unseenMsgCount !== 0 && unseenChatC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function used by scripts to define minimum version requirements
function requires(version) { var s = version.split("."); assert(s.length >= 1); var reqmajor = parseInt(s[0]); var reqminor = (s.length >= 2) ? parseInt(s[1]) : 0; var reqbuild = (s.length >= 3) ? parseInt(s[2]) : 0; var id = GPSystem.getSystemID(); var s = id.toString(OID).split("."); var major = parseInt...
[ "function checkMinVersion() {\n const majorVersion = Number(process.version.replace(/v/, '').split('.')[0]);\n if (majorVersion < NODE_MIN_VERSION) {\n $$.util.log('Please run Subscribe with Google with node.js version ' +\n `${NODE_MIN_VERSION} or newer.`);\n $$.util.log('Your version is', process.v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fill the note data with rests to start. Rest are positioned based on the center line of the instrument clef.
generateInitialNoteData() { for (let i = 0; i<this.numberOfNotes; i++) { this.noteData.push({ clef: this.instrumentClef, keys: [RESTNOTE[this.instrumentClef]], duration: `${this.noteLength}r`}); } }
[ "noteAt(note, glyph, withLineTo = true) {\n if (!note) throw \"NeumeBuilder.noteAt: note must be a valid note\";\n\n if (!glyph) throw \"NeumeBuilder.noteAt: glyph must be a valid glyph code\";\n\n note.setGlyph(this.ctxt, glyph);\n var noteAlignsRight = note.glyphVisualizer.align === \"right\";\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setColor sets the color of a note to the color of the button pressed.
function setColor() { console.log('color button pressed'); let note = this.parentNode.parentNode; let newColor = this.style.backgroundColor; note.style.backgroundColor = newColor; note.children[0].style.backgroundColor = newColor; note.children[1].style.backgroundColor = newColor; }
[ "function setDrawingColor(event) {\n sketchController.color = this.value;\n}", "function changeColor(color) {\n gMeme.currText.color = color\n}", "setTextColor(color) { this.textColor = color }", "function changeColor(event) {\n event.target.style.backgroundColor = paintBrush;\n\n}", "updateColor (co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whether this pass uses adaptive luminosity.
get adaptive() { return this.toneMappingMaterial.defines.ADAPTED_LUMINANCE !== undefined; }
[ "getInvertLightness() {\n return this._invertLightness;\n }", "function isLightMode(designSystem) {\n return !isDarkMode(designSystem);\n}", "get isWeighted() {\n return this._config.isWeighted;\n }", "function getLightness(rgb){\n var r = rgb[0], g = rgb[1], b = rgb[2];\n return (r*299...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds the button on soundcloud
function soundcloudButton() { $('.soundTitle__title').each(function(i, obj) { if ($(obj).parent().find(".spotifyButton").length == 0) { var text = $(obj).find("span:first-child").text(); spotifyButton(text).insertAfter(obj); } }); soundcloudAdded = false; }
[ "function initVidYardPlayBtn(){\n\tjQuery('.vidyard-lightbox-centering .play-button').append('<span>Watch Now</span>')\n}", "function playButtonSound() { \nsound.src = 'music/click.mp3'\nsound.play() }", "function createAudioButton() {\n // creating the 'play' button\n var playButton1 = document.createElement...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
writes notes to db
function noteWriter(notes) { fs.writeFile( path.join(__dirname, "/db/db.json"), JSON.stringify(notes), (err) => (err ? console.err(err) : console.log("note saved to db")) ); }
[ "async saveNotesToFile() {\n return await fs.writeFile(\n path.join(__dirname, \"../db/db.json\"),\n JSON.stringify(this.notes)\n );\n }", "function send_notes_to_db() {\n let new_note = document.querySelector('textarea'); // reference to the textarea in the modal form\n db.collection(\"sc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper method for stripping the Google's and MIT's Apache Licenses.
function stripApacheLicense() { // Strip out Google's and MIT's Apache licences. // Closure Compiler preserves dozens of Apache licences in the Blockly code. // Remove these if they belong to Google or MIT. // MIT's permission to do this is logged in Blockly issue #2412. return gulp.replace(new RegExp(license...
[ "function output_license_html ()\n {\n\t\tvar output = get_comment_code() + '<a rel=\"license\" href=\"' + license_array['url'] + '\"><img alt=\"Creative Commons License\" border=\"0\" src=\"' + license_array['img'] + '\" class=\"cc-button\"/></a><div class=\"cc-info\">' + license_array['text'] + '</div>';\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the radius from the filter information
function getRadiusFromFilter(data) { let enabled = false; for (let key in data) { if (key == "radiusEnable") enabled = true; if (key == "slider-radius" && enabled) return parseInt(data[key]) * 1609.34; } return 1000 * 1609.34; }
[ "getRadius(year) {\n const type = 'singlePayments';\n const range = this.getRange([25, 150]);\n const value = this._getDataValueForYear(type, year);\n\n if (!value) {\n return 0;\n }\n\n return range(value);\n }", "function getRadiusMeters() {\n return RADIUS_METERS;\n}", "function ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check of a value is a `NodeOperation` object.
isNodeOperation(value) { return Operation.isOperation(value) && value.type.endsWith('_node'); }
[ "isNodeOperation(value) {\n return Operation.isOperation(value) && value.type.endsWith('_node');\n }", "isOperation(value) {\n if (!isPlainObject(value)) {\n return false;\n }\n\n switch (value.type) {\n case 'insert_node':\n return Path.isPath(value.path) && Node$1.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler for play event triggered from buttons/actions external to app. playEvent is triggered as a result of audio.play() call. To prevent a infinite loop of play and playEventhandler here, we check if the 'playing' is false.
function playEventHandler() { if ($rootScope.playing === false) { play(); } }
[ "onplay(song) { }", "function privatePlayClickHandle(){\n\t\t/*\n\t\t\tGets the attribute for song index so we can check if\n\t\t\tthere is a need to change the song. In some scenarios\n\t\t\tthere might be multiple play classes on the page. In that\n\t\t\tcase it is possible the user could click a different pla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls the full_image function and setting 'images' as the value for 'n'
function current_image(n) { full_image(images = n); }
[ "function change_image(n) {\n full_image(images += n);\n}", "function full_image (n) {\n var full_size = document.getElementsByClassName('fullSizeImage')\n if(images <= 0) {\n images = 1\n return\n }\n if(images > image_gallery.length) {\n images = image_gallery.length\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setup() Sets up a canvas Creates objects for the dinos (Dinos) and the pokemons (food)
function setup() { createCanvas(700, 500); dinoStegosaurus = new Dino(200, 200, 5, 40, 87, 83, 65, 68, 16, dinoStegosaurusImage); dinoTriceratops = new Dino(100, 100, 5, 40, UP_ARROW, DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW, 32, dinoTriceratopsImage); foodLeaves = new Food(100, 100, 10, 25, foodLeavesImage); food...
[ "function setup() {\n createCanvas(windowWidth + canvasEdge, windowHeight + canvasEdge, WEBGL);\n smooth();\n\n initializeStates();\n initializePlanets();\n initializeStars();\n initializeUI();\n initializeSound();\n\n}", "function setup() {\n\tcreateCanvas(800, 700);\n\tengine = Engine.create();\n\tworld ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rotates piece by its current rotation pattern
rotate() { //each piece has a different center of rotation uhoh, see image for reference //https://vignette.wikia.nocookie.net/tetrisconcept/images/3/3d/SRS-pieces.png/revision/latest?cb=20060626173148 for (let c in this.coords) { this.coords[c][0] += this.rotationIncrements[this...
[ "function rotate(){\r\n unDraw();\r\n currentRotation++;\r\n if(currentRotation === current.length){ // so it doesn't go higher that array\r\n currentRotation = 0;\r\n }\r\n current = piecesArray[random][currentRotation];\r\n draw();\r\n }", "function animateRotation(face, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
No known log message upon configuration change The 'analyzeTrap' function entry point = Will be called when receiving a trap for a device of this type.
function analyzeTrap(trap) { return trap["1.3.6.1.6.3.1.1.4.1.0"] == "1.3.6.1.4.1.12356.101.6.0.1003" || trap["1.3.6.1.6.3.1.1.4.1.0"] == "1.3.6.1.2.1.47.2.0.1"; }
[ "function handleAnalyzeAccessibility() {\n var distance = $('#accessibilityDistance').val();\n var position = $('.guiComponent.waypoint.start .address').attr('data-position');\n if (!position) {\n var position = $('.guiComponent.waypoint.end .address').attr('data-position');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the state of input 6 for all nodes of the input chain, as a hexadecimal string. The node nearest to the controller is the lowest bit of the result.
function YInputChain_get_bitChain6() { var res; // string; if (this._cacheExpiration <= YAPI.GetTickCount()) { if (this.load(YAPI.defaultCacheValidity) != YAPI_SUCCESS) { return Y_BITCHAIN6_INVALID; } } res = this._bitChain6;...
[ "function bit_to_ascii(array) {\n var num = 0;\n var n;\n for (n = 0; n < 8; n++) {\n if (array[n] == '1') {\n num += Math.pow(2, 7 - n);\n console.log(num);\n }\n }\n return String.fromCharCode(num);\n}", "function getHex6(cssColor) {\n\t\tlet output;\n\t\t\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Genera la lista de carros
function generateCarList() { for(let i = 0; i < 30; i++) { carList[i] = new Car() } console.log(carList) return carList }
[ "async getList() {\n const data = await this.getData();\n return data.map(tour => {\n return {\n title: tour.title,\n shortname: tour.shortname,\n summary: tour.summary,\n card: tour.card\n };\n });\n }", "function createCardsList() {\n const cardList = [];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the bars to be the ones from current area code
function updateBars(code) { // get all the rows in graphic_data concerning current AREACD. var data = graphic_data.filter(function(d) {return d.AREACD == code}) // "transpose" this data into the right format for stacking transposedData = [] varnames.forEach( function(d) { var tmp_obj = {} tmp_ob...
[ "function drawUpdateBar(){\n\t\t\td3.select(\"#bar-cover #bar-chart\").selectAll(\"svg\").remove();\n\t\t\tdrawBar();\n\t\t}", "drawBarsRemoveOld(){\n }", "function updateConditionsTrackChart2(){\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar temp = getDpsActive();\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar myData = \t[{\r\n\t\t\t\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setColorSaturation: Set the color saturation of the magnified view.
setColorSaturation(saturation) { this._colorSaturation = saturation; if (this._magShaderEffects) this._magShaderEffects.setColorSaturation(this._colorSaturation); }
[ "getColorSaturation() {\n return this._colorSaturation;\n }", "function updateSaturationField(fieldName, value){\n\t\n\tsaturationFieldId = \"#saturation-field_\" + fieldName\n\t\n\tjQuery(saturationFieldId).attr({\"value\" : value});\n\t\n\t// then update color\n\t/*\n\t * Actually quoted because satur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if policy_name_is_predefined in predef_qos, except edit_index in apply_qos
function policy_name_is_predefined() { var cf = document.forms[0]; var i; if(cf.category.selectedIndex == CATEGORY_APP || cf.category.selectedIndex == CATEGORY_GAME) { if (cf.apps.options.selectedIndex != cf.apps.options.length-1 && cf.name.value == cf.apps.options[cf.apps.selectedIndex...
[ "function is_predef_app(name) {\n var rule = get_predefined_rules(name);\n\n if(rule.length) {\n rule = rule.split(\"\\x02\");\n if(rule[_category] == CATEGORY_APP) {\n return true;\n }\n }\n return false;\n}", "isAssignedToManage(document) {\r\n if (typeof document ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Maps the base DraftVisibilityType enum to string array so it can more easily be used in validation or descriptions.
get draftVisibilityTypeMap() { const result = []; for (let draftType in DraftVisibilityType_1.DraftVisibilityType) { if (typeof DraftVisibilityType_1.DraftVisibilityType[draftType] === 'number') { result.push(draftType); } } return result; }
[ "_cleanEnums(columnType) {\n if (!columnType) {\n return\n }\n // clean enum(\n var str = columnType.replace('enum(', '')\n // clean )\n str = str.replace(')', '')\n // clean all '\n str = str.replace(new RegExp('\\'', 'gm'), '')\n return str.split(',')\n }", "getTypes(pokemon) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This will throw an error if the protocol wasn't included in the host string
vaidateProtocol(host){ let protocols = ['https://', 'http://']; if (protocols.map(protocol => host.includes(protocol)).includes(true)) return host throw new Error('Host String must include http:// or https://') }
[ "function isValidSchemeUrl(url) {\n // If the scheme is 'javascript:' or 'vbscript:', these link\n // types can be dangerous. Don't link them.\n if (invalidSchemeRe.test(url)) {\n return false;\n }\n var schemeMatch = url.match(schemeUrlRe);\n if (!schemeMatch) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use : multiEnableById(new Array('id1', 'id2'));
function multiDisableById(ids) { for (var i = 0; i < ids.length; i++) { var obj = getObj(ids[i]); if (obj != null) obj.disabled = true; } }
[ "function multiEnableById(ids) {\r\n for (var i = 0; i < ids.length; i++) {\r\n var obj = getObj(ids[i]);\r\n if (obj != null) obj.disabled = false;\r\n }\r\n}", "function myCheckOnlyById(ids){\r\n\t//var ids = [\"payType\",\"payName\",\"payMoney:money\",\"payWay\",\"inBank\",\"bankWay\"];\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create average hourly availability bike number chart
function createHourlyChart(title,chart_data,output_chart){ try{ var data = new google.visualization.DataTable(); data.addColumn('string', 'Hour of Day'); data.addColumn('number','available bikes'); chart_data.forEach(hourlydata=>{ data.addRow([hourlydata.hour.toString(),hourlydata.available_...
[ "function getClosingTimeAverage(rawRetails) {\n\tlet output;\n\tlet newFormData = changeFormatData(rawRetails);\n\tlet cleanedData = cleanData(newFormData);\n\n\tlet totalHours = 0;\n\tfor (let i = 0; i < cleanedData.length; i++) {\n\t\ttotalHours += cleanedData[i][3];\n\t}\n\n\toutput = totalHours / cleanedData.le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wait for a model to meet a particular condition. NOTE: You must provide a condition that, upon evaluating to "true", will stop the watch loop
waitFor(model, condition = (response) => true) { const self = this; let currentLoop = null; return new Promise((resolve, reject) => { if (!model) { return reject("No model provided"); } if (!model._modelType) { return reject("No modelType provided"); } ...
[ "setFinished() {\n this.condition = 'finished';\n }", "construct(building, condition) {\n while (condition) {\n setInterval(() => {\n for (i = 0; i < this.interactSpeed; i++) {\n building.progress = Math.min(building.health, building.progress + 5);\n if (building.progres...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funcion Desplegar Menu La Carta
function desplegarMenu() { var boton = $(".formaBoton"); var cuadroMenu = $(".platosCarta"); boton.click(function() { boton.each(function(index, obj) { if($(obj).hasClass("active") == true) { $(obj).removeClass("active"); } }); $(this).addClass("active"); /* cuadroMenu | 0-2 Ceviches ...
[ "function seleccionarMenu(){\r\n\t//elementos del menú principal (sin submenús)\r\n\telementosDelMenu = $(\"ul.sf-menu > li\");\r\n\t//url en la que está el navegador\r\n\turlActual = window.location.href;\r\n\r\n\t//recorremos los elementos principales del menú\r\n\tfor(var i = 0; i<elementosDelMenu.length; i++){\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets extended payload length (7+64).
getPayloadLength64 () { if (!this.hasBufferedBytes(8)) return; const buf = this.readBuffer(8); const num = buf.readUInt32BE(0, true); // // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned // if payload length is greater than this number. // if (num > Math.pow(2...
[ "function getSize(payload) {\n // Message header length is 24 bytes.\n const len = payload.length + 24;\n if (len >= 1024) {\n return (len / 1024).toFixed(2) + \"KiB\";\n } else {\n return len + \"B\";\n }\n}", "function getLength(data) {\n\treturn Object.keys(data).length;\n}", "size() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CLASS /FORMATTER SysFmtFilterObject return object containing keyvalue pairs with keys which matches some words passed as parameters.
function SysFmtFilterObject() {}
[ "function getParametersFromFilters () {\n var parameters = {};\n parameters.disp = 'T';\n\n for (var i = 0; i < filterIds.length; i++) {\n var value = getFilterValue(filterIds[i].id);\n if (value) {\n var obj = getFilterObject(filterIds[i].paramname, value);\n parameters[obj.name] =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the core function which handles differences between collections. `record` is the record which we saw at this position last time. If null then it is a new item. `item` is the current item in the collection `index` is the position of the item in the collection
_mismatch(record, item, itemTrackBy, index) { // The previous record after which we will append the current one. let previousRecord; if (record === null) { previousRecord = this._itTail; } else { previousRecord = record._prev; // Remove the rec...
[ "add(collection, obj) {\n this.db\n .get(collection)\n .unshift(obj)\n .last()\n .value();\n }", "function saveOriginalBuddiesOrder() {\n var length = buddiesColl.length;\n\n if (length && !buddiesColl.at(length - 1).get('originalIndex')) {\n buddiesColl.forEach(function (budd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make a new CategoryIndexedRecipients instance
function CategoryIndexedRecipients(recipients) { if (recipients === void 0) { recipients = []; } /** * The selected recipients for the form */ this._recipients = []; this._recipients = recipients.slice(); }
[ "createRecipients() {\n const recipientsCount = textUtils.getRandomNumber(1, maxConcurrency);\n const recipientsList = [];\n for (let i = 0; i < recipientsCount; i++) {\n const { name, phone, email } = coreUtils.generateRecipient();\n recipientsList.push({ fullName: name, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper for code_generator.objjMethodDeclaration objj (for methods): methodType: string "+" or "" action: objj_ActionType node returnType: objj_ObjectiveJType node selectors: Array Identifier nodes, one for each element in params params: Array Objects with these keys/values: type: objj_ObjectiveJType node id: Identifier...
compileMethod(node, scope, methodScope, params, types, compileNode) { const objj = node.objj, selector = this.makeSelector(scope, compileNode, params, types, objj.selectors); this.checkSetter(node, scope, selector); if (!scope.optionalProtocolMethods) { ...
[ "buildCode_Methods(methods){\n\n\t\t//code to return\n\t\tvar ret = '';\n\n\t\tif(methods.length>0){\n\n\t\t\t//loop over methods\n\t\t\tfor(var i=0; i<methods.length; i++){\n\n\t\t\t\t//get the method\n\t\t\t\tvar method = methods[i];\n\n\t\t\t\tret += \t\"\\tdef \" + ((method.isStatic)?'self.':'') + method.mName ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call this right after everything of this GRPC call has been finished at GRPC client.
afterGrpcCallFinish() { this.tracer.scoped(() => { this.tracer.setId(this.traceId); this.tracer.recordAnnotation(new Annotation.ClientRecv()); }); }
[ "function endCallback() {\n logger.log('[whois][' + session.getID() + '] whois server connection ended');\n session.clientEnd();\n }", "finish() {\n if (!this.disabled) {\n this._sendBatch();\n this.clearEvents();\n }\n }", "function dispatchin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Close a prompt or more prompts using a `promptname`. You can set a prompts name by setting `Prompt.name` to a string.
static close(name) { let ps = document.querySelectorAll(`div[promptname="${name}"]`); for (let i = 0; i < ps.length; i++) { const p = ps[i]; if (p.hasOwnProperty("prompt")) { p.prompt.close(); } } }
[ "@action closeDialog() {\r\n\t\tif (this.dialog) this.dialog.opened = false;\r\n\t}", "function exit(){\n inquirer\n .prompt([\n {\n type: 'list',\n message: 'Would you like to add an Engineer or an Intern to the team?',\n name: 'teamChoice',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add event listener for read more button. Once the button is clicked, the client side will query relevant post for a specific event. If the service is online, it will AJAX query info from sever side. Otherwise, it will query info from local side (IDB).
function readMoreBtnEventListener(id) { $("#" + id).click(function () { $("#blog-post").empty(); queryAjaxPosts("/events/query/" + id) }) }
[ "function moreClick() {\n\t\t$.when(moreStories()).done(function(story_data) {\n\t\t\tif (story_data.hasOwnProperty('stories')) {\n\t\t\t\tif (!story_data.before_timestamp) {\n\t\t\t\t\t$(\".more\").hide();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\turlForMoreStories = story_data.before_timestamp;\n\t\t\t\t\t$(\"#morelo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CODING CHALLENGE 655 You are given two numbers a and b. Create a function that returns the next number greater than a and b and divisible by b.
function divisibleByB(a, b) { return a - a % b + b; }
[ "function coprime(a, b)\n{\n if (__gcd(a, b) === 1)\n console.log(\"1\");\n else\n console.log(\"0\"); \n}", "function getPower(a,b,p) { \n\tif (b == 1)\n\t return a%p;\n\telse {\n\t x = getPower(a,Math.floor(b/2),p);\n\t if (b%2 == 0) \n\t return (x*x)%p;\n\t else return (((x*x)%p)*a)%p;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a new picture in the database
function createPicture(req, res, next) { db.none('insert into pics(name, description, img)' + 'values(${name}, ${description}, ${img}', req.body) .then(function () { res.status(200) .json({ status: 'success', message: 'inserted one picture' }); }) .catch(function ...
[ "insertUserPhoto(photo,callback){\n this.pool.getConnection((err, con) => {\n if(err){callback(err);return}\n else{\n con.query(\"INSERT INTO USER_PHOTOS(USER_ID, IMAGEN) VALUES (?,?)\", [photo.user, photo.photo], (err, fila) =>{\n if(err){callback(err);return}\n el...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the outside nodes
function setNodePosition(){ var num = 0; var change = 0; //check if node is outside or not, when the status of node changes, the transition happens nodes.each(function(d){ if (d.noLayer){ d.outside.isOutside = true; d3.select(this) .transition() .duration(500) .attr("opacity", 0.8) ...
[ "function keepNodesOnTop() {\n $(\".nodeStrokeClass\").each(function( index ) {\n var gnode = this.parentNode;\n gnode.parentNode.appendChild(gnode);\n });\n }", "function resetNodes() {\n var artist_nodes = $(\".node[data-selected=1]\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
dynamically remove list items with empty values
function removeEmpty () { $(".val").each(function(){ if (!$(this).text().trim().length) { $(this).parent($('li')).remove(); } }); }
[ "_findAndRemoveEmptyList() {\n this.wwe.get$Body().find('ul,ol').each((index, node) => {\n if (!(FIND_LI_ELEMENT.test(node.innerHTML))) {\n $(node).remove();\n }\n });\n }", "function cleanTypesList() {\n const typeElements = document.querySelectorAll(\"#ty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to get the client state from the db and then set it in redis for the persistent key
function fetchClientStateDB(clientID, clientStateKey, callback) { try { var clientStatePersist = null; _dbmethods.queryClientState(clientID, function(err, clientStateRows) { if(!err) { logger.debug("Not error retrieving data for persistent client state for clientID: " + clientID); if(...
[ "function setClientStateRedis(clientID, clientStateKey, clientStatePersist, callback) {\n\n try {\n\n _redisclient.set(clientStateKey, clientStatePersist, function(err, persistReply) {\n if(!err) {\n if(persistReply == \"OK\") {\n _redisclient.expire(clientStateKey, _maxpersiststatustime, f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }