query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
SERVICE to delete a Flight
async deleteFlight(req, res) { const { flightId } = req.params; try { await Flight.findByIdAndDelete(flightId); return res.status(204); } catch (error) { return res .status(400) .json({ message: "Flight with that id does not exist" }); } }
[ "function deleteOneFlight(req, res, next) {\n var query = `\n DELETE FROM itineraryflight\n WHERE itinerary_id = :i_id\n AND route_id = :r_id\n `;\n let i_id = req.params.i_id;\n let r_id = req.params.r_id;\n const binds = [i_id, r_id];\n\n oracledb.getConnection({\n user : credentials.user,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
alt :: Alt f => (f a, f a) > f a . . Function wrapper for [`fantasyland/alt`][]. . . `fantasyland/alt` implementations are provided for the following . builtin types: Array and Object. . . ```javascript . > alt([1, 2, 3], [4, 5, 6]) . [1, 2, 3, 4, 5, 6] . . > alt(Nothing, Nothing) . Nothing . . > alt(Nothing, Just(1)) ...
function alt(x, y) { return Alt.methods.alt(x)(y); }
[ "function alt(x, y) {\n return Alt.methods.alt (x) (y);\n }", "function alt(m, x) {\n if(!(isAlt(m) && isSameType(m, x))) {\n throw new TypeError('alt: Both arguments must be Alts of the same type')\n }\n\n return x.alt(m)\n}", "alt (alternative) {\n if (Either.isEither(alternative)) {\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set this to true if the record is saying that the procedure was NOT performed.
get notPerformed() { return this.__notPerformed; }
[ "get doNotPerform() {\n\t\treturn this.__doNotPerform;\n\t}", "rsvpFalse() {\n this.rsvp(false);\n }", "get not() {\n this.negation = true;\n return this;\n }", "get IsPed() {\n return !!IsModelAPed(this.hash);\n }", "get disableButton() {\n return !this.noRecords;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Opens Upgrade to Pro link in AIOSEOP menu as new tab.
function upgrade_link_aioseop_menu_new_tab() { $('#toplevel_page_all-in-one-seo-pack-aioseop_class ul li').last().find('a').attr('target','_blank'); }
[ "function openStorePageTab() {\n var createProperties = {\n url: targetProduct.url\n }\n chrome.tabs.create(createProperties, function(tab) {});\n}", "openWebAssessor() {\n window.open(\n 'https://www.webassessor.com/salesforce',\n '_blank' // <- This is what makes it open in a new window.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
12 Return the count of passengers by gender.
function getPassengersByGender(data, gender) { const sexOfPassengerCount = data.filter(passenger => passenger.fields.sex === gender) console.log(`${gender.toUpperCase()} COUNT: ${sexOfPassengerCount.length}`) return sexOfPassengerCount.length }
[ "function getPassengersByGender(data, gender) {\n\tconst pGender = data.filter( p => p.fields.sex == (gender))\n\treturn pGender.length\n}", "function getPassengersByGender(data, gender) {\n\treturn data\n .filter(p => p.fields.sex === gender)\n .length\n}", "function getPassengersByGender(data, gender) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays user records to the table.
function displayUsers(users = []) { var userCount = users.length; for (var i = 0; i < userCount; i++) { var user = users[i]; var userRow = createUserRow(user); if (user !== null) { tableBody.append(userRow); } } }
[ "function displayInfo() {\r\n $( \"#tableData\" ).html('');\r\n users.forEach(function(user){\r\n $( \"#tableData\" ).append( `\r\n <tr id=\"user${user.id}\" class=\"user\" data-id=\"${user.id}\">\r\n <td>${user.id}</td>\r\n <td>${user.first_name}</td>\r\n <td>${user.surname}</td>\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Interviewer: Phillip for tenwei problem: remove letter if it proceeds a hash tag return string without hash tag "ab" => "a" "ab" => "" "aab" => "b" "ababb" => "ab" high level solution: create an array iterate through the string if i = array.pop else array.push return array.join("")
function removeHashTag(array) { const arr = [] for (let i = 0; i < array.length; i++) { if (array[i] === "#") { arr.pop } else { arr.push(array[i]) } } return arr.join("") }
[ "function stripHashtags(arr) {\n for(var i = 0; i < arr.length; i++) {\n if(arr[i].charAt(0) == \"#\") {\n arr[i] = arr[i].substr(1);\n }\n }\n return arr;\n}", "function cleanUp(string) {\n let alphebets = \"abcdefghijklmnopqrstuvwxyz\";\n let result = \"\";\n \n\n for (inde...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Map WRAM into address space
map_wram(bank_start, bank_end, addr_start, addr_end) { let offset = 0; for (let c = bank_start; c <= bank_end; c++) { for (let i = addr_start; i <= addr_end; i += 0x1000) { let b = (c << 4) | (i >>> 12); this.readmap[b].kind = this.writemap[b].kind = MAP_TI.RAM; this.readmap[b].offset = this.writemap...
[ "setup_mem_map_lorom() {\n\t\tthis.clear_map();\n\t\tthis.map_system();\n\n\t\tthis.map_lorom(0x00, 0x3F, 0x8000, 0xFFFF);\n\t\tthis.map_lorom(0x40, 0x7F, 0x8000, 0xFFFF);\n\t\tthis.map_lorom(0x80, 0xBF, 0x8000, 0xFFFF);\n\t\tthis.map_lorom(0xC0, 0xFF, 0x8000, 0xFFFF);\n\n\t\tthis.map_lorom_sram();\n\t\tthis.map_lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checkDbPageContent check content of the page, search list of DBs. Check for certain DB if required Call:res = checkDbPageContent(content,db); Where:res result: true or false. content page content db db we are looking for
function checkDbPageContent(content,db) { var re = new RegExp(FINDDB_REGEXP_START + (db == 'ANY' ? '[^<]+' : db) + FINDDB_REGEXP_END); //var res = content.match(re); //if (res) { // console.log("MATCH!!\n" + JSON.stringify(res,undefined," ")); //} //else { // console.log("Check DB failed"); //} return re.test(c...
[ "function checkForDB(db, database, next){\n\t\tdb.admin().listDatabases(function(err, dbs){\n\t\t\tif(err){\n\t\t\t\tconsole.log(err);\n\t\t\t\tnext(err);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tvar found = false;\n\t\t\t\tfor(var i=0;i<dbs.databases.length;i++){\n\t\t\t\t\tif(dbs.databases[i].name == settings.db && !dbs.d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generateCourseData: takes in parameters, generates node for course that can be used in makegraph.js
function generateCourseNode(courseCode, courseName, courseDesc, courseLevel, courseSeasons, coursePrereq) { const courseDescription = courseCode + " (" + courseName + ")\n" + "--------------------------------" + "\n" + stringParse(courseDesc); const courseTitle = (courseCode === "HS") ? courseCo...
[ "function buildData() {\n buildCourseData();\n}", "addCourse(courseData) {\n let courseObject = new CourseObject(\n courseData,\n {\n x: this.x,\n y: this.courses.length*this.courseHeight + this.headerHeight,\n width: width,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API test for 'AddEtherIpId', Add EtherIP ID setting
function Test_AddEtherIpId() { return __awaiter(this, void 0, void 0, function () { var in_etherip_id, out_etherip_id; return __generator(this, function (_a) { switch (_a.label) { case 0: console.log("Begin: Test_AddEtherIpId"); in_...
[ "function newEthAddress(){\n\trequest.post('https://api.blockcypher.com/v1/beth/test/addrs', { json: true }, (err, res, body) => {\n\t\tif (err) { return console.log(err); }\n\t\ttry{\n\t\t\tconsole.log(\"\\n\\n-----\\n\\nSuccess! Ethereum address created. Please be sure to save your private key in a safe location....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
replace common battle Statistics
function replaceBattleStatistics(obj) { obj.innerHTML=obj.innerHTML.replace(/(Recent)/g,"正在输出的"); obj.innerHTML=obj.innerHTML.replace(/(defenders:)/,"防守者:"); obj.innerHTML=obj.innerHTML.replace(/(attackers:)/,"进攻者:"); obj.innerHTML=obj.innerHTML.replace(/(Current round statistics)/,"本回合战斗统计信息"); obj.innerHTML...
[ "function replaceBattleStatistics(obj) {\r\n\tobj.innerHTML=obj.innerHTML.replace(/(Recent)/g,\"Derniers\");\r\n\tobj.innerHTML=obj.innerHTML.replace(/(defenders:)/,\"défenseurs:\");\r\n\tobj.innerHTML=obj.innerHTML.replace(/(attackers:)/,\"attaquants:\");\r\n\tobj.innerHTML=obj.innerHTML.replace(/(Current round st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
send feedback to control page
function feedback(message, guid){ // var pid = getPidForUser(guid); var session = getSessionForUser(guid); var originalguid = getFirstGuid(guid); // send to session pages - control page can display io.to(session).emit('feedback', {"message": message, "user": originalguid}); }
[ "sendFeedback() {\r\n shell.openExternal(ApplicationConstants.FEEDBACK_URL);\r\n }", "function sendFeedback() {\n\t// Make sure there's feedback text first\n\tif (!$.trim($(\"#feedbackTextArea\").val())) {\n\t\t$(\"#feedbackEmptyAlert\").removeClass(\"hidden\").hide().slideDown(\"fast\");\n\t\treturn;\n\t}\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parsing the json message. The type of message is identified by 'flag' node value flag can be self, new, message, exit
function parseMessage(message) { var jObj = $.parseJSON(message); // if the flag is 'self' message contains the session id if (jObj.flag == 'self') { sessionId = jObj.sessionId; } else if (jObj.flag == 'new') { // if the flag is 'new', a client joined grid var new_name = 'You'; // number of ...
[ "function parseMessage(message) {\n\tvar jObj = $.parseJSON(message);\n\n\t// if the flag is 'self' message contains the session id\n\tif (jObj.flag == 'self') {\n\n\t\tsessionId = jObj.sessionId;\n\t\tvar chatObj = $.parseJSON(jObj.chat);\n\t\tfor (var i = 0; i < chatObj.messages.length; i++) {\n\t\t\tvar from_nam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets the signal level and frequency to their default values.
function reset() { signalLevel = 1; signalFrequency = 1000; }
[ "function reset() {\n vm.level = 1;\n vm.frequency = 1000;\n }", "function reset_signal() {\n if (sigselected !== '' && mag[sigselected] !== 1) {\n\tmag[sigselected] = 1.1;\n\tshow_plot();\n }\n}", "function resetFrequencies() {\n angular.forEach(chart.frequencies, function(frequency...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return all asset names in the AssetBundle.
GetAllAssetNames() {}
[ "get assetNames() {}", "get assetBundleName() {}", "function getAssetNames (patterns = []) {\n let matched = []\n patterns.forEach(pattern => {\n matched = glob.readdirSync(pattern)\n })\n return matched.map(file => path.basename(file))\n}", "function getAllAssets(){\n //get all assets\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
'project link' command implementation. Creates a new project in the current directory by linking it to the specified Device Group. If the specified Device Group does not exist, a user is informed and the operation is stopped. Parameters: options : Options impt options of 'project link' command Returns: Nothing
link(options) { this._checkExistingProject(options, this._link.bind(this)). then(() => this._info()). then(info => { UserInteractor.printInfo(UserInteractor.MESSAGES.PROJECT_LINKED); UserInteractor.printResultWithStatus(info); }). c...
[ "_link(options) {\n return this._initDeviceGroup(options).\n then(() => this._linkToDeviceGroup()).\n then(() => this._processSourceFiles(options)).\n then(() => {\n this._projectConfig.endpoint = this._helper.authConfig.endpoint;\n if(options &&...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hardhat env set up
function hardhatSetupEnv(mocha) { const mockwd = path.join(process.cwd(), temp); previousCWD = process.cwd(); process.chdir(mockwd); mocha.env = require("hardhat"); mocha.env.config.logger = testLogger mocha.logger = testLogger }
[ "setupEnvironment() {}", "function setupEnvironments() {\n console.log();\n setupEnvironment(repositories = Object.keys(repos), function() {\n console.log(\"setting AWS credentials.\");\n setupAWS(repositories = Object.keys(repos), function() {\n console.log(\"\\nInstallation complete.\");\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
grab a valid array choice
function getArray(array) { // takes in an array of booleans length 4 // returns a value between 0-3 based on the user's initial input choices var value = -1; var temp = -1; while (value === -1) { temp = getRandomInt(4); // if array was selected by user if (array[temp] === true) {...
[ "function answerCheck(selection, currArray) {\n\n }", "function getMcSelectNonArrayValueError() {\n return Error('Value must be an array in multiple-selection mode.');\n}", "function getMatSelectNonArrayValueError() {\n return Error('Value must be an array in multiple-selection mode.');\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this method is run whenever the mouse moves anywhere over the video player on the first move, the controls will appear and it will set a timer to hide the controls in 3 seconds if the mouse hasn't moved afterwards. if it is still moving before the timer ends, the timer is reset
showControls() { const { started, paused, mouseMoving } = this.state; clearTimeout(this.awayTimer); if (mouseMoving) { clearTimeout(this.timeout); this.timeout = setTimeout(() => { this._hideControls(); if (started && paused) { this.awayTimer = setTimeout(() => { ...
[ "function fadeControls() {\n\t\t\t\t// initial loop to hide controls if no movement\n\t\t\t\ttimer = setTimeout(function() { \n\t\t\t\t\t$vcontrols_container.fadeOut('slow');\n\t\t\t\t\t$vplayer.css('cursor', 'none');\n\t\t\t\t}, 3000);\n\t\t\t\tif ($video.attr('fs') == \"true\") {\n\t\t\t\t\t$overlay.mousemove(mou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the background view.
get backgroundView() { if (!this._backgroundView) { this._backgroundView = BrowserHelper.getBackgroundPage(); } return this._backgroundView; }
[ "getBackgroundStage () {\n return this._background;\n }", "function getBackground(){\n\t\treturn background;\n\t}", "get background() {\n return this._data.background;\n }", "get backgroundRenderer () {\n return this._backgroundRenderer = (this._backgroundRenderer || BackgroundRendererM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls a function on the latest client. Use this with caution, it's meant as in "internal" helper so we don't need to expose every possible function in the shim. It is not guaranteed that the client actually implements the function.
function _callOnClient(method) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } callOnHub.apply(void 0, Object(tslib_es6["e" /* __spread */])(['_invokeClient', method], args)); }
[ "function _callOnClient(method) {\n\t var args = [];\n\t for (var _i = 1; _i < arguments.length; _i++) {\n\t args[_i - 1] = arguments[_i];\n\t }\n\t callOnHub.apply(void 0, tslib_es6.__spread(['invokeClient', method], args));\n\t}", "function _callOnClient(method) {\n var args = [];\n for...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
routes to "/", "/new", "/:postId" either renders PostList, NewPostForm, or PostDetail
render() { return ( <div className="Routes"> <Switch> <Route exact path="/" render={() => <PostList />} /> <Route exact path="/new" re...
[ "function new_post_page(path, title, posts, url){\n router.get('/'+path, function(req, res, next) {\n res.render('dynamic', {\n\t\t\tTitle: title,\n\t\t\tPosts: posts,\n\t\t\tURL: url\n\t\t});\n });\n}", "static jumpToPost(id) {\n Router.jumpTo(`${Constant.route.post}/${id}`);\n }", "createPost()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
REGRESSION Takes market data and calculates yintercept, slope and takes an arg of x in this.Regression to calculate the y of any x in relation to the target market slope.
function Regression(arr) { var N = arr.length, XY = [], XX = [], EX = 0, EY = 0, EXY = 0, EXX = 0; for (var i = 0; i < N; i++) { var y = arr[i].price; var x = arr[i].miles; XY.push(x * y); XX.push(x * x);...
[ "function linearRegression(y,x){\n\n var lr = {};\n var n = y.length;\n var sum_x = 0;\n var sum_y = 0;\n var sum_xy = 0;\n var sum_xx = 0;\n var sum_yy = 0;\n\n for (var i = 0; i < y.length; i++) {\n\n sum_x += x[i];\n sum_y += y[i];\n sum_xy += (x[i]*y[i]);\n su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Search a BookmarkNode and its children for inclusion of a given BN Returns Boolean, true if searched BN is included
function BN_includes (BN, sBN) { let found = Object.is(BN, sBN); if (!found && (BN.type == "folder")) { let children = BN.children; let len; if ((children != undefined) && ((len = children.length) > 0)) { for (let i=0 ; i<len ; i++) { if (BN_includes(children[i], sBN)) { found = true; break...
[ "function contains(a, b){\n if(a === b){\n return true;\n }\n if(a.children) {\n var n, i=0;\n while(n = a.children[i++]){\n if( contains(n, b) ) {\n return true;\n }\n }\n }\n return false;\n}", "function contains(a, b) {\n // Return true if node a contains node b.\n while...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
emptys history state of the page (window path)
function emptyState(){ history.pushState(" "," ","/"); }
[ "function clear() {\n history.length = 0;\n }", "function clearHistory() {\n\tlinkedIn.clearHistory();\n\trender();\n}", "function clearHistory () {\n localStorage.removeItem('palettes');\n // remove the palettes from the page\n historyMarkupDelete();\n loadHistory();\n }", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a rectangular room with door at input.row/input.col and room in direction input.dir
rectRoom(input) { const ROW = input.row; const COL = input.col; const DIR = input.dir; }
[ "function generateRoom() {\n // If currentRoom is undefined, generate the first room\n if(currentRoom == undefined) {\n addRows(2);\n var r = new room(startRoomTypes[rndi(0,startRoomTypes.length)], 0, 0);\n roomLayout[0][0] = r;\n return r;\n }\n // Otherwise, find exit of current room and spawn a r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an MatCalendarCell for the given month.
_createCellForMonth(month, monthName) { const date = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1); const ariaLabel = this._dateAdapter.format(date, this._dateFormats.display.monthYearA11yLabel); const cellClasses = this.dateClass ? this.dateClass(date, 'year...
[ "createCalendarTable(year, month) {\n // prepare data for calendar\n this._prepareDataForCalendar(year, month);\n\n // render calendar\n this._renderCalendar();\n }", "function MonthView(year, month, calendar) {\n this.element = document.createElement('div');\n this.element.className = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ArrayRemoveRange Given an array and the start and end indices, remove values in that index range. e.g., given ([10, 20, 30, 40, 50, 60, 70], 2,4), return [10, 20, 60, 70]. Work inplace Assume the arguments passed are an array and two integers
function removeRange(arr, start, end){ // Make sure the start index is lower than the end index [start, end] = (start > end) ? [end, start] : [start, end] // Make sure the index range provided is valid if ((start < 0) || (end > arr.length - 1)){ return null } else { for(let j = start; j <= end; j++){...
[ "function removeRange(arr, start, end){\n\n}", "function remove_range(arr, idx0, idx1)\n{\n\t// this step was necessary during the loop that uses pop. using pop messed up the \n\t// array counter variable\n\tvar leng = arr.length;\n\t// idx1-idx0-1 is the number of elements to keep\n\t// shift those elements to t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Separate subject, catalog number, and title from course string
function parseCourse(courseStr) { // Get title let title = null; let index = courseStr.indexOf('-'); if (index !== -1) { title = courseStr.slice(index + 1).trim(); courseStr = courseStr.slice(0, index).trim(); } // Remove unnecessary whitespace courseStr = courseStr.replace(/\s/g, ''); // Sear...
[ "function getCourseHeader(course) {\n return course.split(' ')[0].toUpperCase()\n}", "function getCourseName(course) {\n return course.replace(course.split(' ')[0], '').trim()\n}", "function cleanCourse(oldCourse) {\n\t//don't use string.substr() here, because the string is much longer as expected (xml nodeVa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function para criar o lembrete
function criarLembrete(){ var conteudoTextArea = document.getElementById("texto").value; if(!textoValido(conteudoTextArea)){ mostrarError(); } limparError(); // criar as variaveis para tempo var referencia = new Date(); var id = referencia.getTime(); var data = referencia.toLocaleDateString(); var texto ...
[ "function Literature(title, filename, txt) {\n this.title = title;\n this.fn = filename;\n this.txt = txt;\n}", "function ajouterLacune() {\n\n\t// Déterminer l'éditeur\n\ted = $('#item_solution').tinymce();\n\t\n\t// Obtenir le contenu sélectionné\n\tlacuneTexte = ed.selection.getCon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Floating Bar End Floating Bar Start
function upload_floatingbar(floatingbar,top_button,bottom_button, h) { if($(floatingbar)) { $(document).scroll(function() { if($(top_button).position()) { if(parseFloat($(top_button).position().top) < parseFloat($(window).scrollTop())) { $(floatingbar).css({height: 0}).animat...
[ "floatDrawer() {\n this.__isFloating = true;\n }", "function updateFloatingBar(floatingBar){\n var floatingBarTop = $(floatingBar).offset().top;\n var floatingBarHeight = $(floatingBar).outerHeight();\n monthBarsStat = updateMonthBarsStat();\n monthBarsTop = monthBarsStat[0];\n monthBarsContent...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update numReplies for the parent post's codemark, if any
async updateParentCodemark () { if (!this.parentPost.get('codemarkId')) { return; } const codemark = await this.request.data.codemarks.getById(this.parentPost.get('codemarkId')); if (!codemark) { return; } const now = Date.now(); const op = { $set: { numReplies: (codemark.get('numReplies') || 0)...
[ "async updateGrandParentPost () {\n\t\tif (!this.grandParentPost) { return; }\n\t\tconst op = { \n\t\t\t$set: {\n\t\t\t\tnumReplies: (this.grandParentPost.get('numReplies') || 0) + 1,\n\t\t\t\tmodifiedAt: Date.now()\n\t\t\t} \n\t\t};\n\t\tthis.transforms.grandParentPostUpdate = await new ModelSaver({\n\t\t\trequest...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
accepts a timing function, returns the transformed variant
function makeEaseOut(timing) { return function (timeFraction) { return 1 - timing(1 - timeFraction); } }
[ "function wrapWithTiming(fn) {\n return function() {\n const startAt = +new Date();\n fn(arguments); // call or apply or bind or just 'fn'\n console.log(+new Date() - startAt);\n }\n}", "function timeFunction(fn) {\n const startTime = Date.now();\n const result = fn();\n const elapsed = Date.now() -...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Post json string to Elasticsearch
function postToES(json_str, endpoint, region, context) { var req = new AWS.HttpRequest(endpoint); req.method = 'POST'; req.path = '/_bulk'; req.region = region; req.headers['presigned-expires'] = false; req.headers['Host'] = endpoint.host; req.body = json_str; var signer = new AWS.Sign...
[ "function postToES(json_str, endpoint, region, context) {\n var req = new AWS.HttpRequest(endpoint);\n var creds = new AWS.EnvironmentCredentials('AWS');\n\n req.method = 'POST';\n req.path = '/_bulk';\n req.region = region;\n req.headers['presigned-expires'] = false;\n req.headers['Host'] = en...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End output loading Start > Load approver filter data
function loadApproverFilterData(){ if($('#reportingId').val() != "" && $('#strategicPillarId').val() != "" && $('#themeId').val() != "" && $('#outcomeId').val() != "" && $('#outputId').val() != "") { $('#approverDiv').hide(); $('#filter-btn').hide(); $('#reset').show(); $('#filter-btn-show').show(); var pro...
[ "function finishRenderFilters() {\n $window.UnicalApiBehaviors.filterToggle();\n }", "function _loadGSAdata() {\n // This is going to load the GSA data\n $.getJSON('/api/opportunities/?format=json')\n .done(function (d) {\n d[\"agency\"] = \"gsa\";\n _loadFilterOptions(d);\n\n $(\"#loa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
turns a name into a URI depending on type, e.g. name: UNDP, type: Organisation > if the input is already a URL (starting with " simply returns it
function makeURI(name, type){ if (name.indexOf("http://") != 0){ var fragment = name.replace(/\s+/g, '_'); // replace whitespaces name = "http://hxl.carsten.io/"+type.toLowerCase()+"/" + fragment.toLowerCase(); } return name; }
[ "function typeToUrl(type) {\r\n if (type == \"movie\") {\r\n return urlMovies;\r\n } else if (type == \"tv\") {\r\n return urlTV;\r\n }\r\n }", "function getFullName(type) {\n\t if (type) {\n\t type = type.toLowerCase();\n\t switch (type) {\n\t case 'q':\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function `addToObject` that takes an object, a key, and an array as arguments and adds the array to the object as the value of the given key. The changes should be made directly to the argument and should change the object without any reassignment
function addToObject(obj, key, arr) { // -------------------- Your Code Here -------------------- obj[key] = arr; // --------------------- End Code Area -------------------- }
[ "function addArrayProperty(obj, key, arr) {\n\t// object at the key reassign value to arr\n\tobj[key] = arr;\n\t// return arr\n\treturn obj;\n}", "function addValue(obj, key, value) {\n if (obj.hasOwnProperty(key)) {\n obj[key].push(value);\n } else {\n obj[key] = [value];\n }\n}", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::IoTEvents::AlarmModel.AcknowledgeFlow` resource
function cfnAlarmModelAcknowledgeFlowPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnAlarmModel_AcknowledgeFlowPropertyValidator(properties).assertSuccess(); return { Enabled: cdk.booleanToCloudFormation(properties.enabled), }; }
[ "renderAlarmRule() {\n return `ALARM(${this.alarmArn})`;\n }", "renderAlarmRule() {\n return `ALARM(\"${this.alarmArn}\")`;\n }", "function CfnAlarmModel_AcknowledgeFlowPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for getting url after applying sorting
function finalurl() { var url = new URL(window.location.href); var search_params = url.searchParams; search_params.set('sorting', document.getElementById("sort-list").value); url.search = search_params.toString(); var new_url = url.toString(); return new_url }
[ "function SortByColor()\r\n{\r\n var URL = ''; \r\n URL = document.location.href;\r\n var ArrKeys = URL.toQueryParams();\r\n var sSort = ArrKeys[\"sort\"];\r\n switch(sSort)\r\n {\r\n case \"IntColor\"://Interior Color\r\n sSort =\"Color\";\r\n break;\r\n case ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update list after sync deleted catalog rule price
updateListAfterSyncDeletedCatalogRulePrice(ids = []) { if (ids && ids.length) { let items = ProductListService.prepareItemsToUpdateListAfterSyncDeletedCatalogRulePrice( ids, this.state.items ); if (items !== false) { this.addItems(items); ...
[ "updateListAfterSyncCatalogRulePrice(catalogrule_prices = []) {\n if (catalogrule_prices && catalogrule_prices.length) {\n let items = ProductListService.prepareItemsToUpdateListAfterSyncCatalogRulePrice(\n catalogrule_prices, this.state.items\n );\n if (items ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Should further reducers need to be utilized, we can combine them here in the Root Reducer. Asis, we only have 'accounts'.
function rootReducer() { return combineReducers({ accounts: accountReducer, }) }
[ "combine() {\n this.shared.combined = {}\n for (var id in this.shared.rules) {\n for (var r in this.shared.rules[id]) {\n this.shared.combined[r] =\n this.shared.rules[id][r]\n }\n }\n }", "function getRootReducer(appName) {\n var ap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show the loading spinner before the content loaded
function showLoadingView() { $loader.css("display", "block"); }
[ "function showLoadingSpinner(){\n loader.hidden = false;\n quoteContainer.hidden = true;\n}", "showLoadingScreen() {\n this.setUIStep(AssistantUIState.LOADING);\n this.$.loading.onShow();\n }", "function displayLoadingState() {\n LEXUS.loadingAnimation.start();\n\n hideDrillDo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hexKeyPressed() This function is called when the user presses any key when the hexpad is open. It only reacts when the user presses a hex digit (09, A F, a f). It works for both lowercase and upper case.
function hexKeyPressed(event) { var code = event.keyCode || event.which; // grab the key code if (code == 13) { // 13 is enter var input = document.getElementById("numpadInput" + thisID); callback(input.value); // call the callback function with the input box value $( "#numpadDialog" + t...
[ "function keyPressed() {}", "function keyPress(code, char) { }", "function keyPress(event) {\n\tdocument.getElementById(\"displayLetter\").innerHTML += String.fromCharCode(event.charCode);\n// console.log(event) allows for the key that you are pressing to be viewed in the console\n// as well as the h1 element w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MakeGeomCritPnts: make the three.js geometry for the critical points
function MakeGeomCritPnts () { ComputeCriticalPointPositions (); /* Either use spheres or points. const grpCritPnts = new THREE.Group (); for (var i = 0; i < 3; i++) { const geometry = new THREE.SphereGeometry (1, 7, 7); const material = new THREE.MeshBasicMaterial ({ color: _Cri...
[ "function MakeGeomCritPnts ()\n{\n ComputeCriticalPointPositions ();\n\n const vertices = [];\n for (var i = 0; i < 9; i++)\n vertices.push ( _CriticalPntPositions[ Math.floor(i/3) ][ i % 3 ] );\n\n var geometry = new THREE.BufferGeometry ();\n geometry.setAttribute ('position', new THREE.Floa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether or not we have a querystring.
function hasQueryString() { return location.href.indexOf("?") !== -1; }
[ "function hasQueryString() {\n\n\t\tvar url = this.parseURI();\n\n\t\tif ( url.search !== null ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "function hasQueryString() {\n return location.href.indexOf(\"?\") !== -1;\n}", "function hasQuery(url) {\n return (url.indexOf(\"?\") === -...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create 7 clientproperties commands foreach publisher in order to change the titles' fontsize this affects on lineheight, maxsize, height and branding lineheight
function change_titles_size(new_font_size, new_line_height) { for (var i = 0; i < jsonData.length ; i++) { console.log("------ "+i+" ------"); var needChange = false; var newCustom = ""; var oldCustom = ""; var mode = jsonData[i]; console.log(mode['mode_name']); ...
[ "function setMemesFontSize(){ //not in use font size taken from modal\r\n var meme = getGMeme();\r\n meme.lines.forEach((line ,index,array) => { \r\n line.fontSize = gFontSize;\r\n });\r\n}", "function createBodyProperties ( objOptions ) {\r\n\t\t\tvar bodyProperties = '<a:bodyPr';\r\n\r\n\t\t\ti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes ANOTHER FUNCTION as an arg will call the arg function, passing it "world"
function doWorld(aFunction) { aFunction("world"); }
[ "function doWorld(aFunction) {\n aFunction(\"world\");\n}", "function makeWorldMain(transition){\n\t// Since its name is being dynamically generated, always ensure your function actually exists\n\tif (typeof(window[function_prepWorld]) === \"function\") {\n\t\tconsole.log(window[function_prepWorld]);\n\t\twindo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
In order to stay true to the latest spec, RGB values must be clamped between 0 and 255. If we don't do this, weird things happen.
static clampRGB (val) { if (val < 0) { return 0 } if (val > 255) { return 255 } return val }
[ "static clampRGB(val) {\n if (val < 0) { return 0; }\n if (val > 255) { return 255; }\n return val;\n }", "function constrain_rgb(r, g, b)\n{\n var w;\n\n /* Amount of white needed is w = - min(0, *r, *g, *b) */\n\n w = (0 < r) ? 0 : r;\n w = (w < g) ? w : g;\n w = (w < b) ? w : b;\n w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process compensation tiles for any bonus tiles received during the initial deal. Not that this may also include _new_ bonus tiles, which need to be moved out and compensated for again, handled in 'checkDealBonus'.
processDealBonusTiles(tiles) { this.tiles = this.tiles.concat(tiles); this.checkDealBonus(); }
[ "checkDealBonus() {\n var bonus = this.tiles.map(v => parseInt(v)).filter(t => t >= Constants.PLAYTILES);\n if (bonus.length > 0) {\n this.bonus = this.bonus.concat(bonus);\n this.tiles = this.tiles.map(v => parseInt(v)).filter(t => t < Constants.PLAYTILES);\n this.log('requesting compensation ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
lowtech reformatting of perfect HTML
function reformatHtml (html) { if(!html) return html; // break up HTML into tags and text var hh = [], h = html; while (h) { var i = h.indexOf('<'); if (i === -1) { hh.push(h); break; } else if (i > 0) { hh.push(h.substring(0, i)); ...
[ "function format_html_output() {\r\n var text = String(this);\r\n text = text.tidy_xhtml();\r\n\r\n if (Prototype.Browser.WebKit) {\r\n text = text.replace(/(<div>)+/g, \"\\n\");\r\n text = text.replace(/(<\\/div>)+/g, \"\");\r\n\r\n text = text.replace(/<p>\\s*<\\/p>/g, \"\");\r\n\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================================================= Other functions SIGINT handler
function HandleSigInt() { console.log(''); // (for linefeed after CTRL-C) Log('Exiting on SIGINT'); Cleanup(); // exit after giving time to log last message setTimeout(function() { process.exit(); }, 10); }
[ "function sigint() {\n\tcleanup( onCleanup( SIGINT ) );\n}", "_hookSIG(){\n\t\tprocess.on('SIGINT',this.exit.bind(this));\n\t}", "function sigterm() {\n\tcleanup( onCleanup( SIGTERM ) );\n}", "function sigHandle() {\n if (child) {\n child.kill('SIGINT');\n }\n}", "function onHandleSignal(signal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saves a block as successfully run. This method requires that the block was added to the blockchain.
async _saveBlockAsSuccessfullyRun(block, runBlockResult) { const receipts = output_1.getRpcReceiptOutputsFromLocalBlockExecution(block, runBlockResult, output_1.shouldShowTransactionTypeForHardfork(this._vm._common)); this._blockchain.addTransactionReceipts(receipts); const td = await this.getBl...
[ "saveBlock(block)\n\t{\n\t}", "async function save_block(block) {\n newblock = await block.save();\n console.log(\"Block \" + newblock.height + \" saved.\");\n return newblock;\n}", "function saveDoneBlock() {\n\n let blockAlreadyInserted = false;\n for (let i = 0; i < playerLevelEnvironm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
lastNodeOf This function gets passed a URL and returns the last node of same.
function lastNodeOf(e) { var expr = "" + e; var to = expr.indexOf("?"); if( to !== -1) { var path = expr.substring(0,to); var pieces = path.split("/"); return pieces[pieces.length -1]; } else { var pos = expr.lastIndexOf("/"); if( (pos != -1) && (pos+1 != expr.length) ) { return expr.substr(pos+1)...
[ "getLastNode(){\n\t\tlet pointer = this.head;\n\t\tfor(; pointer.next; pointer = pointer.next){\n\t\t\tcontinue;\n\t\t}\n\t\treturn pointer;\n\t}", "findLastNode() {\n return this.findNodes().reverse()[0];\n }", "getLast () {\n\t\tlet lastNode = this.head;\n\t\t\n\t\tif (lastNode) {\n\t\t\twhile (lastNode.n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks if the settings for the cipher are invalid (ex. NaN). However, if there are no settings given (ie blank settings), then it will NOT be considered invalid. Parameters: settings the settings to check for validity
hasInvalidSettings(settings){}
[ "function checkSettings(){\n\tlog(\"commencing settings check\");\n\tvar errors = new Array();\n\tif (settings.cols % 1 != 0 || settings.cols < 1){\n\t\terrors.push(\"cols settings incorrect. cols: \"+ settings.cols +\" (settings.cols % 1 != 0 || settings.cols < 1\");\n\t}\n\tif (settings.rows % 1 != 0 || settings....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replaces instruction text and handles button opacity to indicate whether user is at first/last step
function replaceStep(){ d3.select('#step_instructions').text(recipe.instructions[currStepId].text); //Determine button opacity if (currStepId == recipe.instructions.length-1){ d3.select('#next') .style('opacity', '.2'); } else if (currStepId == 0){ d3.select('#back') .style('opacity', '.2');...
[ "function displayInstructions() {\n instructions.html('Click once for eraser. Click again for pen.');\n}", "function changeStepText(){\n\t$('.step-counter').text('Step: ' + (stepNumber + 1));\t//Show current step number above drawing area\n\t\n\tif (stepNumber == 0){\n\t\t$('.btn-prev').css('visibility', 'hidden...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
determin if all properties has empty values in an object
static isObjectPropertyAllHasEmptyValue(object) { if (lodash.isObject(object)) { for (var key in object) { if ( object[key] !== "" && !this.isEmptyArray(object[key]) && !this.isEmpty(object[key]) ) { return false; } } } return true...
[ "function isAllKeysAreEmpty(obj) {\n\n\tif (isEmpty(obj)) {\n\t\tconsole.log('Obbject is empty');\n\t\treturn true;\n\t}\n\n\tfor(var key in obj) {\n\t\tif ((obj[key] != null) && (obj[key].trim().length>0)) {\n\t\t\t// Does it have some value, then return true\n\t\t\treturn false;\n\t\t}\n\t}\t\t\t\n\t// If we are ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change header and squares to the color picked (Display)
function correctColorDisplay(){ header.style.backgroundColor = colorPicked; for(var x=0; x<squares.length; x++){ squares[x].style.backgroundColor = colorPicked; squares[x].style.opacity = "1"; } }
[ "function ColorSelection() {\n\n selectedColor = color(`rgba(${c.map((dat) => dat)})`);\n hueVarr = Math.round(hue(selectedColor));\n\n //h % 180\n fill(color(`rgba(${c.map((dat) => dat)})`));\n push();\n fill(100,0,100);\n textSize(12);\n text(\"Primary Secondary\", width/4 * 3, height/20, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an array of all worker of a country in relation the the whole data set. The array don't check the worker type.
createWorkerSeries() { const arr = this.state.whitelistEvents const result = Object.values( arr.reduce((c, { country }) => { c[country] = c[country] || { label: country, value: 0, colorIndex: COUNTRIES[country].color } c[country].value++ return...
[ "function createAvailabilityByWorker(nworkers, availabilityByDay) {\n var result = [];\n var ndays = availabilityByDay.length;\n for (let iworker = 0; iworker < nworkers; iworker++) {\n result.push([]); //make new array for that worker\n for (let iday = 0; iday < ndays; iday++) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getY :: Cell > Integer
function getY(cell) { return cell[1]; }
[ "function getCellno(x, y) {\n\treturn x*50 + y\n}", "getY(index) {\n return this.xy[index * 2 + 1];\n }", "function _getY() {\r\n\t\t\tvar sortedTiles = self.tiles.sort(function (a, b) {\r\n\t\t\t\tif (a.y != b.y)\r\n\t\t\t\t\treturn a.y - b.y;\r\n\t\t\t\treturn a.x - b.x;\r\n\t\t\t});\r\n\t\t\treturn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets all row data in the inventory sheet, stores cell data as Object (eg. items[U603]['description'] = "Uni Foam Air Filter") returns string (JSON.stringify(Object))
function getInvData() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheetByName('Master Inventory'); var lastColumn = sheet.getLastColumn(); var range = sheet.getRange(firstBarcodeRow,firstBarcodeColumn,masterLastRow,lastColumn); var invData = range.getValues(); var headers = getHe...
[ "function soldItems() {\n const table = document.getElementById('sale');\n const rows = table.rows;\n const data = [];\n for (let r = 2; r < rows.length; r++) {\n const row = rows[r];\n const product = {\n prod_name: row.cells[0].innerHTML,\n quantity: parseInt(row.cells[1].innerHTML),\n };\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a ImplementationGuideDependency resource
static get __resourceType() { return 'ImplementationGuideDependency'; }
[ "fixDependsOn(dependency, igs) {\n // Clone it so we don't mutate the original\n const dependsOn = lodash_1.cloneDeep(dependency);\n if (dependsOn.version == null) {\n // No need for the detailed log message since we already logged one in the package loader.\n utils_1.logg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
onPageInit (run only once)
function onPageInit(e){ }
[ "function onPageInit(e){\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t}", "function initPage() {\n checkAndSetTheme();\n initSelectedPage();\n}", "function pageBeforeInit(pageData) {\n // todo\n\n } // end pageInit", "function init() {\r\n // page load init function\r\n}", "function init () {\n if (!isHomeP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Easy 1838 239 Add to List Share An image is represented by a 2D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate (sr, sc) representing the starting pixel (row and column) of the flood fill, and a pixel value newColor, "flood fill" the image. To perform a "f...
function s( image = [ [1, 1, 1], [1, 1, 0], [1, 0, 1], ], sr = 1, sc = 1, newColor = 2 ) { const originalColor = image[sr][sc]; helper(sr, sc, 1); return image; function helper(r, c) { console.log({ r, c }); if ( r < 0 || r > image.length - 1 || c < 0 || c ...
[ "function flood_fill(image_data, canvas_width, canvas_height, x, y, color) {\n\n var components = 4; //rgba\n\n // unpack values\n var fillColorR = color[0];\n var fillColorG = color[1];\n var fillColorB = color[2];\n\n // get start point\n var pixel_pos = (y*canvas_width + x) * components;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets or Sets the first line indent for selected paragraphs.
get firstLineIndent() { return this.firstLineIndentIn; }
[ "set firstLineIndent(value) {\n if (value === this.firstLineIndentIn) {\n return;\n }\n this.firstLineIndentIn = value;\n this.notifyPropertyChanged('firstLineIndent');\n }", "getLineStartLeft(widget) {\n let left = widget.paragraph.x;\n let paragraphFormat ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for opacity based on magnitude
function markerOpacity(magnitude) { if (magnitude > 6) { return 1 } else if (magnitude > 5) { return .90 } else if (magnitude > 4) { return .80 } else if (magnitude > 3) { return .70 } else if (magnitude > 2) { return .60 } else if (magnitude > 1) { return .50 } else { return ....
[ "function markerOpacity(magnitude) {\n if (magnitude > 6) {\n return .99\n } else if (magnitude > 5) {\n return .80\n } else if (magnitude > 4) {\n return .70\n } else if (magnitude > 3) {\n return .60\n } else if (magnitude > 2) {\n return .50\n } else if (magnitude > 1) {\n return .40\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all conversations for a specific user
getUsersConversations(db, user_id) { return db .from('conversation AS con') .select( 'con.id', 'con.user_1', 'con.user_2', 'con.date_created', 'con.is_active', 'con.user_1_turn', 'con.user_2_turn', ) .where({ 'con.user_1': user_...
[ "function getUserConvos(user) {\n\n\tvar userObj = getUser(user);\n\tvar convos_ids = userObj.convos;\n\n\tvar convos = [];\n\n\t// for all conversation objects\n\tfor (var i = 0; i < data.convos.length; i++) {\n\n\t\t// if the conversation is in the users list of convos,\n\t\t// add to convos array\n\t\tif (convos...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a promise to retrieve the page content from MW API mobileview
function pageContentForMainPagePromise(logger, domain, title) { return mwapi.getAllSections(logger, domain, title) .then(function (response) { var page = response.body.mobileview; var sections = page.sections; var section; // transform all sections for (var idx = 0; idx ...
[ "function pageContentForMainPagePromise(req) {\n return mwapi.getAllSections(app, req)\n .then((response) => {\n const page = response.body.mobileview;\n const sections = page.sections;\n let section;\n\n // transform all sections\n for (let idx = 0; idx < sections.length; i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tennis Set In tennis, the winner of a set is based on how many games each player wins. The first player to win 6 games is declared the winner unless their opponent had already won 5 games, in which case the set continues until one of the players has won 7 games. Given two integers score1 and score2, your task is to det...
function tennisSet(score1, score2) { if (score1 < 5 && score2 < 5) { return false } if ((score1 - score2 <= 3 || score2 - score1 <= 3) &&(score1 - score2 > 0 || score2 - score1 > 0)&& (score1 >= 5 && score2 >= 5)) { console.log("RETRY here") return true } if(score1 >=...
[ "function tennisSet(score1, score2) {\n if(score1 == 7 && score2 < 7){\n if( score2 == 2){\n return false;\n } else {\n return true;\n }\n }\n if(score1 == score2 ){\n return false;\n } \n if(score1 >= 6 ){\n if(score2 < 5){\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replaces defined variables in the given value
function replaceVariables( value ) { return value.replace( options.variableRegex, function( match, key ) { if ( options.variables[ key ] === undefined ) { grunt.log.warn( "No variable definition found for: " + key ); return ""; } ...
[ "function __replaceValues(){\n\t\tvar result = expression;\n\t\tvar key;\n\t\tvar regex;\n\t\t//substitute variable values\n\t\tfor(key in variableValues){\n\t\t\tregex = new RegExp(\"\\\\b\"+key+\"\\\\b\", \"g\");\n\t\t\tresult = result.replace(regex, variableValues[key]);\n\t\t}\n\t\t//substitute constant values\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the selected state on all of the options and emits an event if anything changed.
_setAllOptionsSelected(isSelected, skipDisabled, isUserInput) { // Keep track of whether anything changed, because we only want to // emit the changed event when something actually changed. const changedOptions = []; this.options.forEach(option => { if ((!skipDisabled || !opt...
[ "_watchForSelectionChange() {\n this.selectedOptions.changed.pipe(takeUntil(this._destroyed)).subscribe(event => {\n // Sync external changes to the model back to the options.\n for (let item of event.added) {\n item.selected = true;\n }\n for (let i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is used to update the scheme details of an existing scheme in the database
async function postSchUpdt(mfscheme) { debugger; try { let schemes // var _id = new mongoose.Types.ObjectId(); schemes = await mfschemesModel.update({ "scode": mfscheme.scode }, { $set: { "sname": mfscheme.sname } }); return schemes; } catch (err)...
[ "function updateScheme(updatedScheme) {\n for (var i = 0; i < schemes.length; i++) {\n var oldScheme = schemes[i];\n if (oldScheme.data.id == updatedScheme.data.id) {\n schemes[i] = updatedScheme;\n }\n }\n}", "function updateScheme(req,res) {\n // console.log(req.body);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
do x=xyRi mod n for bigInts x,y,n, where Ri = 2(knbpe) mod n, and kn is the number of elements in the n array, not counting leading zeros. x array must have at least as many elemnts as the n array It's OK if x and y are the same variable. must have: x,y < n n is odd np = (n^(1)) mod radix
function mont_(x,y,n,np) { var i,j,c,ui,t,t2,ks; var kn=n.length; var ky=y.length; if (sa.length!=kn) sa=new Array(kn); copyInt_(sa,0); for (;kn>0 && n[kn-1]==0;kn--); //ignore leading zeros of n for (;ky>0 && y[ky-1]==0;ky--); //ignore leading zeros of y ks=sa.length-1; /...
[ "function arrayOperation(x, y, n) {\n const r = [];\n for (let i = x; i <= y; i++) {\n if (i % n === 0) r.push(i);\n }\n return r;\n}", "function mont_(x,y,n,np) {\n var i,j,c,ui,t,ks;\n var kn=n.length;\n var ky=y.length;\n\n if (sa.length!=kn)\n sa=new Array(kn);\n \n copyInt_(sa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=================================================================== from functions/maths/ComplexParts.java =================================================================== Needed early: Builtin Needed late: Complex Pair
function ComplexParts() { }
[ "function EBX_ComplexList() {}", "function EBX_ComplexList() {\n}", "function Complex() {\n this._chains = [];\n this._components = [];\n this._helices = [];\n this._sheets = [];\n this.structures = [];\n\n this._residueTypes = Object.create(ResidueType.StandardTypes);\n this._atoms = []; // TODO: pre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if user matches the given ruleset
function checkRules(options) { /* istanbul ignore else */ if (options.rules) { const time = new Date(options.time); const recurr = options.recurr_end ? new Date(options.recurr_end) : new Date(); const count = Object.keys(options.rules).length; let matches = 0; for (const ...
[ "static async testUser(user, rule, ctx = null) {\n return this.testUserAny(user, rule, ctx);\n }", "function matchSchemaAgainstRuleSet(ruleSet, schema) {\n var rejectCount = 0;\n var acceptCount = 0;\n var acceptRules = ruleSet['accept'];\n if (Array.isArray(acceptRules)) {\n if (rule...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AuthCtrl manages the authentification feature and manages templates/login.html.erb Uses angulardevise module
function AuthCtrl($state,Auth){ /* jshint validthis: true */ var authCtrl = this; authCtrl.login = login; authCtrl.register = register; /** * Called when logging in */ function login() { Auth.login(authCtrl.user).then(functi...
[ "function LoginController ($rootScope, $state, authorizationService, $log){\r\n\r\n var self = this;\r\n self.formData = {};\r\n self.isLoginFormActive = true;\r\n self.authorization = authorizationService;\r\n\r\n self.doLogin = doLogin;\r\n self.resetPassword = resetPassword;\r\n\r\n function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to split text input into an array and return length of array. Checks for empty array items and does not include in the total item count.
function splitString(stringToSplit, separator) { var arrayOfStrings = stringToSplit.split(separator); var arrayLength = 0; for(var i=0;i<arrayOfStrings.length;i++) if(arrayOfStrings[i].length > 0){ arrayLength = arrayLength+1; console.log(arrayLength) } return arrayLength; }
[ "function countItems(input) {\n var count = 0;\n var inputSplit = input.split(',');\n for(var i = 0; i < inputSplit.length; i++) {\n if(inputSplit[i].trim() !== '') {\n count++;\n }\n }\n return count;\n }", "function splitString(string) {\n var arrayOfStrings...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
escape a single character ch: single character string return value: printable string representing ch
function escapedChar(ch) { // get the unicode character code number var code = ch.charCodeAt(0) if (code < minPrinted || code > maxPrinted || code == quoteCode) { // the character needs escaping // single-character escapes var escape = characterEscapeSequences[ch] if (escape) ch = escape else { // co...
[ "function escape(ch) {\n var charCode = ch.charCodeAt(0);\n var escapeChar;\n var length;\n\n if (charCode <= 0xFF) {\n escapeChar = 'x';\n length = 2;\n } else {\n escapeChar = 'u';\n length = 4;\n }\n\n return '\\\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The Extraction Object: Input : isAsync : if this extraction should use Promises reject : The function to run when an error occurs str : The string that this extraction is parsing bracket : The Brackets object that this Extraction is based on
function Extraction( isAsync, reject, str, brackets ){ //initialize some values from the input this.isAsync = isAsync; this.reject = reject; this.remainingString = str; this.WordBoundaryManager = brackets.wordBoundaryManager; //initialize other arguments this.Location = buildLocation();...
[ "parseAsync(text,extra){\r\n\t\treturn new Promise(function(ok,err){\r\n\t\t\t/**\r\n\t\t\t * Pseudo-labels\r\n\t\t\t**/\r\n\t\t\tconst $DOC_TEXT=1,\r\n\t\t\t\t$TAG=2,$TAG_COLON=3,$TAG_KEY=4,\r\n\t\t\t\t$VALUE_TEXT=5,$VALUE_TAG=6,$VALUE_ERR=7,\r\n\t\t\t\t$SEC_START=8,$SEC_BODY=9;\r\n\t\t\t\r\n\t\t\tfunction innerPa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse the neterror information that's sent to us as part of the documentURI and return an error object. The error object will contain the following attributes: e Type of error (eg. 'netOffline'). u URL that generated the error. m Manifest URI of the application that generated the error. c Character set for default geck...
function getErrorFromURI() { var error = {}, uri = document.documentURI; // Quick check to ensure it's the URI format we're expecting. if (!uri.startsWith('about:neterror?')) { // A blank error will generate the default error message (no network). return error; } // Small hack ...
[ "function getErrorFromURI() {\n var error = {};\n var uri = document.documentURI;\n\n // Quick check to ensure it's the URI format we're expecting.\n if (!uri.startsWith('about:neterror?')) {\n // A blank error will generate the default error message (no network).\n return error;\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Note: the hook is passed as the `this` argument to allow proxying the arguments without requiring a full array allocation to do so. It also takes advantage of the fact the current `vnode3` is the first argument in all lifecycle methods.
function callHook(vnode3) { var original = vnode3.state try { return this.apply(original, arguments) } finally { checkState(vnode3, original) } }
[ "function callHook(vnode) {\n \t\tvar original = vnode.state;\n \t\ttry {\n \t\t\treturn this.apply(original, arguments)\n \t\t} finally {\n \t\t\tcheckState(vnode, original);\n \t\t}\n \t}", "function callHook(vnode) {\n\t\tvar original = vnode.state;\n\t\ttry {\n\t\t\treturn this.apply(original, argument...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provides more expired events information formatted as and elements
getMoreExpired(){ this._numCurrent = 1; let output = _formatEventsIntoHTML(this._schedule[1].slice(this._numExpired - 1, this._numExpired + 9)); this._numExpired += 10; return output; }
[ "get expired() {\n return this.invokedAt + 1000 * 60 * 15 < Date.now();\n }", "getFullSchedule(){\n let schedule = this._accountManager.viewSignedUpEvents(this._username);\n this._numCurrent = 1;\n this._numExpired = 1;\n\n let current = Object.keys(schedule[0]);\n let...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checkHostName checks for a valid host name This routine checks for valid host name and return true, if value is a valid host name else returns false RETURNS: TRUE or FALSE
function checkHostName (fieldId, errorFlag, customMsg, emptyFlag) { var errDisplayField = document.getElementById (fieldId + "Err"); if (errDisplayField) errDisplayField.innerHTML = ""; var fieldHighliter = document.getElementById(fieldId + "Msg") if (fieldHighliter) fieldHighliter.innerHTML = ""; var fiel...
[ "function isLegalHostName(aHostName) {\n /*\n RFC 952:\n A \"name\" (Net, Host, Gateway, or Domain name) is a text string up\n to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus\n sign (-), and period (.). Note that periods are only allowed when\n they serve to delimit components of \"d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to change the colour of input fields. Parameters: ele the element id of the field to change eleType the type of field that is being changed, i.e INPUT is normal but has a different style to TEXTAREA colour the colour that that the field will turn into
function changeColour(ele,eleType,colour){ if(eleType ==="INPUT"){ ele.style.borderBottomColor = colour; } else if(eleType === "TEXTAREA"){ ele.style.borderColor = colour; } }
[ "function makeRed(inputDiv) {\n //input field set to red\n inputDiv.style.backgroundColor = \"#c80815\";\n}", "function changeInputColor(color) {\n myInput.style.backgroundColor = color;\n}", "function changeColor(field, color) {\n field.style.background = color;\n}", "function makeInputGreen(el) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ExportSpecifier : ModuleExportName ModuleExportName `as` ModuleExportName
parseExportSpecifier() { const node = this.startNode(); node.localName = this.parseModuleExportName(); if (this.eat('as')) { node.exportName = this.parseModuleExportName(); } else { node.exportName = node.localName; } this.scope.declare(node.exportName, 'export'); return this.fin...
[ "parseExportSpecifier_() {\n // ExportSpecifier ::= IdentifierName\n // | IdentifierName \"as\" IdentifierName\n\n let start = this.getTreeStartLocation_();\n let lhs = this.eatIdName_();\n let rhs = null;\n if (this.peekPredefinedString_(AS)) {\n this.eatId_();\n rhs = this.eatIdNam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert deprecated functionality to new functions
_mapDeprecatedFunctionality(){ //all previously deprecated functionality removed in the 5.0 release }
[ "function DeprecatedWarning() {\n}", "deprecated(debug, message, meta) {\n \t if (this.deprecations.has(message)) return;\n \t this.deprecations.add(message);\n \t this.log(debug, 'warn', `Warning: ${message}`, meta);\n \t }", "get deprecated() {\n return false;\n }", "function depreca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Zoom to the specified new root.
function zoom(root, p) { if (document.documentElement.__transition__) return; //console.log(root, p); // Rescale outside angles to match the new layout. var enterArc, exitArc, outsideAngle = d3.scale.linear().domain([0, 2 * Math.PI]); function insideArc...
[ "async zoomInto(newroot) {\n await this.changeView(newroot);\n let newrow = this.youngestVisibleAncestor(this.cursor.path);\n if (newrow === null) { // not visible, need to reset cursor\n newrow = newroot;\n }\n await this.cursor.setPath(newrow);\n }", "function zoom() {\n fullTree.attr(\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
initialize the emotion window
function initEmotionWindow() { $("emotionArea").hide(); $("emotionArea").hidden = false; $("emotionBtn").observe("click", function (event) { if (isEmotionWindowOpened == false) { // set the location of the emotion window var total = $("emotionBtn").offsetTop - parseInt($("emo...
[ "function initialise()\n{\n\tinitCanvas();\n\t\n\tthis.popup = new PopupBox(0,0);\n\tthis.popupVisible = false;\n}", "_buildWindow()\n\t{\n\t\tthis.window = new MotionTrackerWindow();\n\t\tthis.currentCanvasPosition = MotionTracker.CONFIG.canvasZIndex;\n\t\tthis.currentUseHighDPI = MotionTracker.CONFIG.useHighDPI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to publish payload to IoT topic
function publishToIoTTopic(topic, payload) { // Publish to specified IoT topic using device object that you created device.publish(topic, payload); }
[ "function publishMessage(topic, payload, eventCallback){\r\n\r\n\tvar params = {\r\n\t\ttopic: topic, /* required */\r\n\t\t//payload: new Buffer('...') || payload,\r\n\t\tpayload: payload,\r\n\t\tqos: 1\r\n\t};\r\n\t\tiotdata.publish(params, function(err, data) {\r\n\t\tif (err) console.log(err, err.stack); // an ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get URL for the top suggestion
function getTopSuggestionUrl(data, text) { var suggestions = getSuggestions(data, text); if (suggestions.length) { var topSuggestion = suggestions.reverse().pop(); return topSuggestion.url; } else if (String(text).match(/^https?:\/\//)) { return text; } return false; }
[ "get suggestionURL() { return namespace(this).suggestionURL; }", "function findLargestUrl(callback) {\n Url.find().sort({ shortUrl:-1 }).limit(1)\n .exec(function(err, data) {\n if (err) return callback(err, null); \n return callback(null, data[0].shortUrl);\n });\n }", "get randomSearchUR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Modifica el ancho del tooltips sobre 22 caracteres
function tooltip(){ try{ var tooltips = document.getElementsByClassName("inew-tooltiptext"); for (var i = tooltips.length - 1; i >= 0; --i) { var tooltipCount = tooltips[i].innerHTML.length; if (tooltipCount > 22){ tooltips[i].className = "inew-tooltiptext inew-tooltipLarge"; } } ...
[ "function tt_FormatTip()\n{\n\tvar fn = \"[tooltip.js tt_FormatTip] \";\n\tvar css, w, h, pad = tt_aV[PADDING], padT, wBrd = tt_aV[BORDERWIDTH],\n\tiOffY, iOffSh, iAdd = (pad + wBrd) << 1;\n\n\t//--------- Title DIV ----------\n\tif(tt_aV[TITLE].length)\n\t{\n\t\tpadT = tt_aV[TITLEPADDING];\n\t\tcss = tt_aElt[1].st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Add the plarform's gear
function addGear(){ gear = game.add.sprite(400, 500, 'gear'); gear.anchor.set(0.5); gear.scale.set(1.3); gear.animations.add('right', [0, 1, 2, 3, 4, 5, 6], 6); gear.animations.add('left', [6, 5, 4, 3, 2, 1, 0], 6); }
[ "function addToolboxGear(newGear){\n\t\tvar previousGear = toolFigures[toolFigures.length - 1];\n\t\tif(previousGear != null)\n\t\t\tnewGear.setXPos(previousGear.getXPos() + previousGear.getInnerRadius() + previousGear.getOuterRadius() + 35);\n\t\telse\n\t\t\tnewGear.setXPos(50);\n\t\tnewGear.setYPos(35);\n\t\ttool...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method that calculates the points for the upper table (Ones to Sixes). Does it by checking each element in the dice_values array and multiplies them by the index i.e If there are 5x threes it will multiply the element (5) by the index number (3) and return 15.
upperTablePoints(){ let pointsArray = [0, 0, 0, 0, 0, 0, 0]; //[0, 2, 1, 0, 0, 2, 0] -> 2*1 + 1*2 + 2*5 = 14 // pointsArray = [0, 2, 2, 0, 0, 10, 0] this.dice_values.forEach((element,index)=>{ pointsArray[index] = element * index; }) ...
[ "function numRollsToTarget (d, f, t) {\n let dp = [...Array(d + 1)].map(() => Array(t + 1).fill(0));\n dp[0][0] = 1;//each index corresponds to the number of ways you can get to that position\n for (let i=1; i <= d; i++)//number of dice\n for (let j=1; j <= t; j++)//amount\n for (let k=1;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the position from the spherical coordinates
function calcPos() { // Current coordinates var coords = sphoords.getCoordinates(); var coords_deg = sphoords.getCoordinatesInDegrees(); // Corresponding position on the sphere return { x: radius * Math.cos(coords.latitude) * Math.sin(coords.longitude), y: radius * Math.cos(coords.latitude) * Math.co...
[ "function sphericalCoords (ev) {\n var point = TAGGER.graphics.eventCoords(ev);\n return TAGGER.orientation.sCoords(point);\n }", "function sphericalX(r, theta, phi) {\n return r * sin(theta) * cos(phi);\n}", "static get spherical() {\n return geometry;\n }", "function spherical(cartesi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a link to the tree view version of this view
function linkToTreeView() { var answer = null; if ($scope.contextId) { var node = null; var tab = null; if ($scope.endpointPath) { tab = "browseEndpoint"; node = workspace.findMBea...
[ "function TreeView() {\n this.anchor = '';\n this.collapsible = true;\n this.initiallyCollapsed = true;\n this.icons = {};\n this.icons.dirOpen = 'fa fa-folder-open';\n this.icons.dirClosed = 'fa fa-folder';\n this.icons.file = 'fa fa-file';\n this.icons.active = true;\n this.ommit = [];\n}", "function S...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter Range Alan is good at breaking secret codes. One method is to eliminate values that lie outside of a specific known range. Given arr and values min and max, retain only the array values between min and max. Work inplace: return the array you are given, with values in original order. No builtin array functions. [...
function filterRange(arr, minVal, maxVal){ /* loop through the Array IF value not between min and max: move all values after current idx to the left one and short the length of array ELSE move on the next idx */ for(var i = 0; i < arr.length; i++){ if(arr[i] < minVal || arr[i] > maxVal){ // m...
[ "function filterRange(arr, min, max){\n // store array length - needed later on for decrementing array length\n var arrLength = arr.length;\n // move values between arr[min] and arr[max] to beginning of array\n for(var i = min+1, j = 0; i < max; i++, j++){\n arr[j] = arr[i];\n }\n // remove...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns true if any open order or false
async function haveOpenOrders() { await traderBot.api('OpenOrders') .then((res) => result = !helpers.isEmptyObject(res.open)) .catch((rej) => console.log('Грешка!')); return result; }
[ "function hasOrder() {\n return this.orders.length > 0;\n }", "function allOrdersAreComplete(){\r\n\tfor(var i=0; i<orderQueueOrders.length; i++ ){\r\n\t\tif(!orderQueueOrders[i].allOrderItemsComplete){\r\n\t\t\treturn false;\r\n\t\t}\r\n\t} \r\n\treturn true;\r\n}", "static isOrderDelivered(o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sample demonstrates how to Creates or updates a workspace active directory admin
async function createOrUpdateWorkspaceActiveDirectoryAdmin() { const subscriptionId = process.env["SYNAPSE_SUBSCRIPTION_ID"] || "00000000-1111-2222-3333-444444444444"; const resourceGroupName = process.env["SYNAPSE_RESOURCE_GROUP"] || "resourceGroup1"; const workspaceName = "workspace1"; const aadAdminInfo ...
[ "function addNewAdmin() {\n console.log(\"Add New Admin\");\n}", "async createAdmin(ctx, args) {\n\n args = JSON.parse(args);\n //create a new admin\n let newAdmin = await new Admin(args.firstName, args.lastName, args.email);\n \n // update the world state\n await ctx.stub.putState(newAdmin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate that option value is valid nonempty string
function validateOptionString(options, key) { if (!R.is(String, options[key])) { throw ('Must be a string.'); } if (R.isEmpty(options[key].trim())) { throw ('Value must not be empty.'); } }
[ "requireOptionString(opt /*:OptionDeclaration*/) {\n if (opt.value == undefined || opt.value == \"\") {\n const key = this.findDeclarationKey(opt)\n color.logErr(`required --${key}`)\n process.exit(1)\n }\n }", "function nonEmptyStringValidator(value) {\n\treturn ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
close loading when async callback, after callback the max timeout is 100ms
function closeLoading() { setTimeout(function () { layer.closeAll('loading'); }, 100); }
[ "closeLoading() {\n if (this.progressBar) {\n clearInterval(this.progressTimer);\n this.progressTimer = null;\n this.progressBar.destroy();\n this.progressBar = null;\n }\n }", "function setTimeoutLoader(){\n $time...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }