query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Remove Option Text Item, based on optionNro (it's order in the view)
function removeOptionByUsingOptionNro(optionNro, callback) { this.moveOptionText((optionNro - 1), (_data.optionsText.length - 1)); _data.optionsText.splice((_data.optionsText.length - 1), 1); this.callback(callback, _data); }
[ "function removeOptionByUsingIndex(index, callback) {\r\n\r\n _data.optionsText.splice(index, 1);\r\n\r\n this.callback(callback, _data);\r\n }", "removeHighlightedOption() {\n const options = this.optionList.getChildren();\n if (this.options.allowDuplicates) {\n this.deselectOption...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AutoFill inputs when a CEP is fetched
function autoFill3(responseCEP, attr) { $('['+attr+']').each(function() { var self = $(this); var field = self.attr(attr); if(responseCEP[field]) { self.val(responseCEP[field]); } }); }
[ "function autofillCoffee() {\n nameInput = document.querySelector('#name-input');\n updateCoffees();\n}", "function autoFill(responseCEP, attr) {\n $(\"[\" + attr + \"]\").each(function () {\n var self = $(this);\n var field = self.attr(attr);\n\n if (responseCEP[fiel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mount all the required CASA middleware
function mountCasaMiddleware(app, config, i18nUtility) { const staticModulePaths = { govukFrontend: Util.resolveModulePath('govuk-frontend', module.paths), govukTemplateJinja: Util.resolveModulePath('govuk_template_jinja', module.paths), govukCasa: __dirname, }; mwHeaders(app, config.csp, config.head...
[ "mountMiddlewares() {\n this.express = Kernel_1.default.init(this.express);\n }", "mountMiddlewares () {\n\t\tthis.express = Kernel.init(this.express);\n\t}", "applyMiddlewares() {\n this.application.use(require('../middlewares').middlewares);\n }", "middlewares() {\r\n // Transfere...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Splits a file path into an array, then slices it based on a directory name and index modifier.
slicePath(filePath, dirName, modifier = 1) { const filePathArray = filePath.split(path.sep); const index = dirName ? filePathArray.lastIndexOf(dirName) : filePathArray.length; return filePathArray.slice(0, Math.min(index + modifier, filePathArray.length)); }
[ "function splitPath(path)\n{\n var parts = path.split(\"/\");\n var idx = -1;\n for (var i = parts.length - 2; i >= 0; --i)\n {\n var lcpath = parts[i].toLowerCase();\n if (lcpath.endsWith(\".zip\") ||\n lcpath.endsWith(\".tgz\"))\n {\n idx = i;\n br...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the number of orders that exist for the shop at baseUrl.
function getOrderCount (baseUrl, token) { const url = `${baseUrl}/admin/orders/count.json?&access_token=${token}`; return fetchJson(url) .then(data => data.count); }
[ "function getOrderItemsCount() {\n AppOrdersService\n .getItemOrderedCount()\n .then(count => {\n vm.ItemOrderedCounter = count;\n });\n }", "async function getNumberOfOrders() {\n let sql = \"SELECT COUNT(id) AS countId FROM order...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
JS Practice. Exercises found at MAP2 / WORD0 Given an array of strings, return a Map containing a key for every different string in the array, always with the value 0. For example the string "hello" makes the pair "hello":0. We'll do more complicated counting later, but for this problem the value is simply 0.
function word0(keyArray){ let exists = new Map(); for (let key of keyArray) { exists.set(key, 0); } return exists; }
[ "function createMapOfAllWords(words){\n let wordMap = new Map();\n\n for (let i = 0; i < words.length; i++){\n let nextWord = \"\";\n if (i != words.length - 1){\n nextWord = words[i + 1];;\n }\n let currentWord = words[i];\n \n if (wordMap.has(currentWord)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a custom function to return Roman gods with more than 1 million search results
function popular(roman) { return roman.romanSearchResults > 1000000; }
[ "function getBestResult(english,regoise) {\n if (english.length ===0 || regoise.length === 0){\n return getBestResultBean(0,english);\n }\n var englishList = english.trim().split(/\\s+/);\n var regoiseList = regoise.trim().split(/\\s+/);\n\n var resultList = [];\n for (var i = 0; i < regois...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method, that returns array with names of prefetch fields.
_getPrefetchFields() { if(Array.isArray(this.use_prefetch)) { return this.use_prefetch; } else if(this.use_prefetch) { return this.model.getPrefetchFields(); } }
[ "_getPrefetchFields() {\n if (Array.isArray(this.use_prefetch)) {\n return this.use_prefetch;\n } else if (this.use_prefetch) {\n return this.model.getPrefetchFields();\n }\n }", "function selectPrefetchFieldsFromSchema(fields)\n{\n let prefetch_collector = {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
format the message for random posts
function buildMessage (post) { let data = { 'response_type': 'in_channel', 'text': '<'+post.url+'|'+ post.title +'>', 'unfurl_links': true, 'unfurl_media': true, 'attachments': [ { 'pretext': post.selftext, 'text': 'Fresh from ' + post.subreddit_name_prefixed + '! <https://ww...
[ "generateMessage() {\n const type = this.getRandomType();\n const location = this.getRandomLocation();\n const dish = this.getRandomDish();\n\n return `Your random meal will be ${type}!\\nIt will come from ${location}.\\nYou will be eating ${dish}!`;\n }", "createMessage(){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Run empty query against redis to check availability
checkAvailability() { var self = this; this.attachTimeout(new Promise((resolve) => { this.cache.randomkey((error) => { if (_.isNull(error) === false) { throw error; } self._isReachable = true; resolve(true); ...
[ "checkRedis(uniqueKeyQuery) {\n // instantiate promise to enable awaiting query results\n // promise value will resolve to an array\n return new Promise(resolve => {\n this.redisClient.mget(...uniqueKeyQuery, (err, result) => {\n if (err) {\n console.log('error within checkRedis func: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
invoked on clicking close button of user info box
function closeProfile() { // making user info box invisible---- document.querySelector('.main').style.visibility = 'hidden'; }
[ "closeInfo(){\n this.infoWindow.close();\n }", "function closeUserInfoModal() {\n userAccountModalFirst.style.display = 'none';\n saraAccountModal.style.display = 'none';\n }", "function closeUserInfoSubMenu() {\n vm.showUserInfo = false;\n }", "function closeInfoWindo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The default format will use HEX if opaque and RGBA otherwise.
function format(color) { if (color.isOpaque()) { return Color.Format.CSS.formatHex(color); } return Color.Format.CSS.formatRGBA(color); }
[ "function ColorHashToString() { // @return String: \"#000000\" or \"rgba(0,0,0,0)\"\r\n return uu.ver.advanced ? this.rgba : this.hex;\r\n}", "provideColor(format, alpha) {\n const defaultText = this.format.defaultText\n const lightColor = (format && format.color && format.color.length) ? format.color : ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retrieve all Registered User Data From LocalStorage
getAllRegisteredUser(){ let i = window.localStorage.length; for(k in window.localStorage.valueOf()){ if(i){ i--; this.usersList.push(JSON.parse(window.localStorage.getItem(k))); } } }
[ "function getUsers() {\n var allUsers = localStorage.users;\n if (allUsers == null || allUsers == undefined || allUsers == \"[]\")\n return null;\n return JSON.parse(allUsers);\n}", "function getAllUsers() {\n var users;\n\n if(!$localStorage.users){\n $localStorage.users ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize default preferences specified in PREFS
function setDefaultPrefs() { console.debug("setDefaultPrefs CP1"); let branch = Services.prefs.getDefaultBranch(PREF_BRANCH); for (let key of Object.keys(PREFS)) { let val = PREFS[key]; console.debug("setDefaultPrefs CP2: key=" + key + " val=" + val); switch (typeof val) { case "boolean":...
[ "function initPreferences() {\n //$('#preferences [name=\"sexe\"]')[$('#preferences [name=\"sexe\"]').data('default')].checked = true;\n $('#preferences [name=\"ageMin\"]').val($('#preferences [name=\"ageMin\"]').data('default'));\n $('#preferences [name=\"ageMax\"]').val($('#preferences [name=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
What is the highest grade?
function maxGrade () { for (var i = 0; i <scores.length; i++) { if (maxNum < scores[i]) { maxNum = scores[i]; } else { maxNum ; } } return maxNum; }
[ "function highestGradeFunction (grades) {\n const highestGrade = Math.max (...grades);\n return console.log(highestGrade);\n\n}", "function highestGrade2( grades ) {\n let max = grades[0];\n\n for (let i = 0; i < grades.length; i++) {\n if ( grades[i] > max )max = grades[i];\n }\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function: Get node name with meaningful context
function getNodeNameInContext(node) { if (no(node.apiData.path)) { return node.apiData.name; } return node.apiData.path; }
[ "function _getNodeName(node, index) {\r\n\t\t\t\r\n\t\t\t// If caller supplied a function, then return the result.\r\n\t\t\tif (typeof(_nodeNameFn) == \"function\") return _nodeNameFn(node);\r\n\r\n\t\t\t// If node has a name already, then return it.\r\n\t\t\tif (node.name) return node.name;\r\n\r\n\t\t\t// Otherwi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save Horizontal data for the section type V or VC
function _saveHorizontal() { return $scope.Data; }
[ "function _saveVerticle() {\n var validColumns = [];\n var data = $scope.DataColumns;\n for (var col in $scope.DataColumns) {\n if (data[col][\"template\"] != \"label\")\n validColumns.push(data[col][\"key\"]);\n }\n var output = {};\n for (var ind...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send any alarms based on the response
function checkAlarms(job,response){ if(job.alarms && job.alarms.length>0){ job.alarms.forEach(function(alarm){ if(alarm.statusCode){ if(response.statusCode!=alarm.statusCode){ //if we need to send an alarm, exit out sendAlarm(job,response); return; } } if(alarm.jsonPath && alarm.json...
[ "function alarm() {\n\n /* set new status */\n status();\n\n /* send new msg */\n send();\n }", "function ack_all_alert(mid){\n\tvar cmd_data = { \"cmd\":\"ack_all_alert\", \"mid\":mid};\n\tcon.send(JSON.stringify(cmd_data)); \t\t\n\n\tshow_alarms(mid); \t// its ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
strrepeat(s, l) Repeat string s l times
function strrepeat(s, l) { var str = ''; for (var index = 0; index < l; index++) { str += s; } return str; }
[ "function repeatStr (n, s) {\n\n}", "function repeatStr(count, str){\n return str.repeat(count);\n}", "function oc_repeat_str (str, times) \r\n {\r\n var result = '';\r\n for (var i = 0; i < times - 1; i++)\r\n result += str;\r\n return result;\r\n }", "function repeat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes a config in the form of and returns a list of html elements input:name text:age textarea:message file:resume submit:Save
function parseForm(config) { return config.replace(/\r\n/, "\n") .replace(/\r/, "\n") .replace(/\n+/, "\n") .split("\n") .map(line => parseInput(line.trim())) }
[ "function fillHtmlInputs(config) {\r\n Object.keys(config).forEach(function (key, index) {\r\n setHtmlInputValue(key, config[key]);\r\n });\r\n}", "setConfig (cfg) {\n const finds = []\n this.allSettings.querySelectorAll('input').forEach(input => {\n const k = input.configOpt.key\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Envia ajax por array de parametros
function ajax_arrparams(url, data, callback) { $.ajax({ url: base_url + url, dataType: 'json', type: 'POST', data: data, success: function (data) { if (typeof data.msg.text !== 'string') { $.formErrors(data.msg.text)...
[ "function ajaxPostAdmin(funcao, array, action){\n jQuery(function(){\n jQuery.ajax({\n url: getUrlController()+\"/admin\"+action,\n dataType: \"json\",\n type: \"post\",\n data:array,\n beforeSend: function() {\n },\n success: fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loadPlaylist() This function loads the playlist. It is assigned to the 'div' containing the playlist name. This 'div' also has a dataid attribute which is used in this function.
function loadPlaylist(){ let playlistID = this.dataset.id; // this.dataset is an object containing all attributes with "data-" before spotupdtr.getMissingTracks(playlistID); // Fetching the missing tracks of the playlist }
[ "function loadPlaylistData(player, result) {\n player_playlist[player].remove();\n\n var playlistItems = [];\n for (var i = 0; i < result.length; i++) {\n playlistItems.push({\n title: (result[i].name.length > 50 ? (result[i].name.substring(0, 50) + \"...\") : result[i].name),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks if the value has changed and accordingly adds or removes the element name from the list
function addToChangesList(obj) { if ($(obj).is("input[@type='checkbox']")) { if (obj.checked) { if (oldValues.get(obj.name)) { removeFromChangedValuesList(obj); } else { addToChangedValuesList(obj); } ...
[ "function add_changed(ele)\n{\n\t/* insert some validation as a condition to continue */\n\tif (ele.value !== undefined)\n\t{\n\t\tChanged.push(new Changed_Obj(ele));\n\t}\n}", "function updateElement(){\r\n value = document.getElementById('element').value;\r\n var newElement = document.getElementById('newE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the role from a participant object Note: every champion gets assigned a role, even if they're all the same
function getRoleFromParticipantObj(participant) { var role = participant['timeline']['role']; var lane = participant['timeline']['lane']; if(lane == 'TOP') { if(role == 'DUO_SUPPORT' && checkSummonerIsSmite(participant)) { return 'Jungle'; } return 'Top'; } else if(lane == 'JUNGLE' && checkS...
[ "function getOpponentParticipantObj(match, role, teamId, row) {\n /*\n * Changes to take into account the roles we calculated by ourselves\n */\n var s = SpreadsheetApp.getActiveSpreadsheet();\n var sheet = s.getSheetByName('Data');\n var opponentChampion = sheet.getRange(row, getSheetTranslationIndex('Thei...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate a Mock httpServer Request and Response
function generateMockRequestAndResponse (statusCode, forwarded, ip, url) { let req = { connection: { remoteAddress: ip || '8.8.8.8' }, headers: { host: 'http://0.0.0.0', referer: 'http://google.com', 'user-agent': 'Mozilla/5.0 (Windows NT x.y; WOW64; rv:10.0) Gecko/20100101...
[ "function MockRequest( response ){\n Events.EventEmitter.call( this)\n this.uniqueId = MockRequest.id++\n if( !response ){\n this.model = \"ServerRequest\"\t \n this.url = \"\"\n this.headers = {}\n this.method = \"GET\"\n this.connection = {}\n }else{\n this.model = \"ServerResponse\"\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make a google map marker for each resort and using googles MarkerClusterer to put markers, that are close to one another, in clusters. The resorts are fetched from a file. Snowreport and forecast, respectively, are fetched from Weather Unlockeds API.
function putResortMarkersInMap(){ fetchResortInfo(resortsURL) .then( allResorts => { allResorts.forEach((resort) => { resortsInMap.push(new ResortInMap(resort)); }); return Promise.all(resortsInMap.map(resort => Promise.all([fetchSnowInfo(resort.getId()), ...
[ "function updateMarkers(){\n clearMarkers();\n\n var count = 1;\n\n for(var key in places){\n if(places[key].day.replace(/\\s/g, '') == trip_days[day].replace(/\\s/g, '')){\n data = {color: visits_color, icon: getIcon(places[key][\"poi_type\"])};\n createMarker(places[key], dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Naive Hash Chain Implementation
function naive_chain() { var chain = { state: null }; chain.initialize = function(num_iterations, seed) { chain.state = { position: 0, num_iterations: num_iterations, start: hash(seed) }; var initial = chain.state.start; for (var...
[ "function _HashChain() {\n // intentionally empty\n }", "function Hash() {}", "function hash() {\n var h = 0;\n for (var i = 0; i < arguments.length; i++) {\n var k = arguments[i];\n h += k;\n h += k << 10;\n h ^= k >> 6;\n }\n h += h << 3;\n h ^= h >> 11;\n h += h << 15;\n return h >...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
StockItemCategoryRow to display StockItemRow headers
function StockItemCategoryRow(props) { return ( <div className="row"> <div className="col h6">{props.value}</div> </div> ) }
[ "renderProductsHeader() {\n const labels = this.props.getProductTableLabels();\n return (\n <tr>\n <th style={{width:\"50%\"}}>{labels[\"name\"]}<div>{labels[\"name\"]}</div></th>\n <th>{labels[\"price\"]}/{labels[\"count\"]}/{labels[\"discount\"]}<div>{labels[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculateFonts calculates font size parameters PARAMETERS: nothing RETURNS: nothing
function calculateFonts() { //title font size calculations titleFont.fontSize = allDimensions.titleBarHeight * titleFont.fontSizeFactor //bottom font size calculations bottomFont.fontSize = allDimensions.bottomBarHeight / 3 * bottomFont.fontSizeFactor }
[ "function fontSizes(vars, maxSize) {\n\n var sizes = [];\n var svg = d3.select(\"body\").append(\"svg\");\n\n // Create some spans such that we can work out the length of the various words\n var tspans = svg.append(\"text\")\n .selectAll(\"tspan\")\n .data(vars.word...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fetch the reviewed places
function getReviewedPlaces(userId) { if(userId) { return $http.get("/api/project/reviewed/"+userId); } return $http.get("/api/project/reviewed/"+$rootScope.currentUser._id); }
[ "async function getReviews(place_id){\n\n console.log(\"----- getReviews\");\n\n // Generate and fill Place Details API url\n let gm_place_details_api = 'https://maps.googleapis.com/maps/api/place/details/json?fields=name,rating,reviews';\n\n gm_place_details_api = gm_place_details_api + '&key='+apiKey...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
taggable d'un xml tag node
function taggable_tag_xml(xml, is_editable = false) { var that = this; this.xml = null; this.$root = null; this.$root_children = null; this.is_editable = is_editable this.set_xml = function(xml) { that.xml = xml; that.xml.view = that; } this.remove_from_DOM = funct...
[ "get tags () {\n\t\t\treturn this.node('tag', this.tagroot);\n\t\t}", "get tag() {}", "function taggable_text_xml(xml, is_editable = false)\n{\n var that = this;\n\n this.xml = null;\n this.$root = null;\n this.sel_show = null;\n this.id = null;\n this.duplicate_tags = {};\n this.is_editabl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
query a guest participant of a study
async guestParticipant(parent, args, ctx, info) { if (!ctx.request.userId) { throw new Error("You must be logged in to do that!"); } const participant = await ctx.db.query.guest( { where: { id: args.participantId, }, }, info ); return participant; ...
[ "async participantStudyResults(parent, args, ctx, info) {\n if (!ctx.request.userId) {\n throw new Error(\"You must be logged in to do that!\");\n }\n\n const results = await ctx.db.query.results(\n {\n where: {\n OR: [\n {\n user: {\n id: ar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function is use to restore Deleted file attachment
function restoreFileAttachment(req, res) { attachmentFile.findOneAndUpdate({_id: req.body.attachmentId}, {temp_deleted: false}).exec(function(err, data) { if (err) { res.json({code: Constant.ERROR_CODE, message: err}); } else { res.json({code: Constant.SUCCESS_CODE, message: ...
[ "function MigrateAttachmentDownloadStore()\n{\n var attachmentStoreVersion = gPrefBranch.getIntPref(\"mail.attachment.store.version\");\n if (!attachmentStoreVersion)\n {\n var dirService = Components.classes[\"@mozilla.org/file/directory_service;1\"]\n .getService(Components.interfaces.ns...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test whether a kernel message is a `'comm_open'` message.
function isCommOpenMsg(msg) { return msg.header.msg_type === 'comm_open'; }
[ "function isCommOpenMessage(msg) {\n return msg.header.msg_type === \"comm_open\";\n}", "function validateCommMessage(msg) {\n for (var i = 0; i < COMM_FIELDS.length; i++) {\n if (!msg.content.hasOwnProperty(COMM_FIELDS[i])) {\n return false;\n }\n }\n if (msg.header.msg_type ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the face turn count of the specified node. If a move has changed at least one layer but not all layers: counts 1: if the innermost layer has been turned together with the outermost layer counts 2: otherwise
countFaceTurns(move) { let layerCount = move.getLayerCount(); let layerMask = move.getLayerMask(); let angle = Math.abs(move.getAngle()) % 4; let allLayers = (1 << layerCount) - 1; if (angle == 0 || layerMask == 0 || layerMask == allLayers) { return 0; } let innerTurned = (layerMask ...
[ "function getLayerTurnCount(node, coalesce=true) {\n let metrics = new MoveMetrics();\n metrics.setCoalesce(coalesce);\n metrics.accept(node);\n return metrics.getLayerTurnCount();\n}", "function getFaceTurnCount(node, coalesce=true) {\n let metrics = new MoveMetrics();\n metrics.setCoalesce(coalesce);\n m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOTE: Unused. Replaced with the draw mehtod in the description object Creates a highlighted section within the timeline to indicate a recorded description
function drawDescriptionSpace(timeStart, timeFinished, videoDuration,segmentsWidth, segmentsHeight){ var startPercentage = timeStart / videoDuration ; var endPercentage = timeFinished / videoDuration ; var descriptionWidth = (endPercentage - startPercentage) * segmentsWidth; var descriptionStartPoint ...
[ "function storyLine(){\n \n background.draw(); \n }", "function storyLine(){\n\t \n\t background.draw(); \n\t }", "draw(ctx) {\n this.drawDescriptionBox();\n }", "function storyLine(){\n background.draw(); \n }", "function showConceptTitle(ctx, d) {\n ctx.t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setup storyboard interface Called when the window is loaded or resized. This adjusts the height of the storyboard creation area to use the whole height of the window, less the header.
function setupStoryboardInterface() { $("#storyboard").height($(window).height() - 10 - $("header").outerHeight()); }
[ "function initWinResize() {\n $(window).resize(function() {\n initSidenavMinHeight(); // call initSidenavMinHeight function\n });\n }", "function resizeStoryFrame() {\n var h = $window.height();\n\n var h1 = $pageHead.height();\n\n var gap = 30;\n\n var h2 = h - h1 ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hide all the major pages
function hide_all_pages(){ pages_to_hide = document.getElementsByClassName('page'); for(i=0;i<pages_to_hide.length;i++) pages_to_hide[i].style.display = 'none'; }
[ "function hideAllPages() {\n\t\t\tUtil.all(\".opage\").forEach((page) => {page.hidden = true;});\n\t\t}", "function hideAllPages() {\n start.switchOff();\n board.switchOff();\n finish.switchOff();\n }", "function hideAllPages() {\n let pages = document.querySelectorAll(\".page\");\n fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculates the unpaid balance of the invoice
function remainingBalance(payments) { var amountPaid = 0; angular.forEach(payments, function(payment) { angular.forEach(payment.appliedPayments, function(applied) { amountPaid += applied.amount; }); }); return this.total...
[ "outstandingBalance() {\n const amountPaid = this.amountPaidOnInvoice();\n const invoiceTotal = this.amount;\n const tip = this.tip || 0;\n return (invoiceTotal + tip) - amountPaid;\n }", "function calculateTotal (invoice) { // ①\n return invoice.subtotal -\n invoice.discount +\n invoice.tax\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if all elements of the given array are defined, false otherwise.
function allAreDefined(arr){ return !arr.some(function (d) { return typeof d === 'undefined' || d === null; }); }
[ "function defined(arr){\n return !arr.some(isUndefined);\n}", "function allAreDefined(arr){\n return !arr.some(function (d) {\n return typeof d === 'undefined' || d === null;\n });\n }", "function allAreDefined(arr){\n return !arr.some(function (d) {\n return typeof d === \"undefined\" || d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HEIGHT FOR PHOTO7 SLIDER
function photo7Height() { $('.wpc-photo7 .swiper-wrapper, .wpc-photo7 .swiper-slide').height($(window).height() - 144); $('.wpc-photo7').height($(window).height() - 144).css({ "marginTop": "80px", "marginBottom": "64px" }); }
[ "setElementHeights () {\n var imgHeight = el_flickrImg.height;\n var screenSize = document.documentElement.clientHeight;\n\n this.maxheightWikiContentElement((screenSize - imgHeight) + 'px');\n }", "function sliderHeight() {\n var windowHeight = $(window).height();\n var windowWidth = $...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns tokens played for a set of board indices
function getTokens(board, line) { return [board[line[0]], board[line[1]], board[line[2]]]; }
[ "function findTokens(){\t\t\n\t\twindow.alert(\"Loading...\");\n\t\tvar tokens = 0;\n\t\tvar x = gameboard.left;\n\t\tvar width = (gameboard.width/18);\n\t\t\n\t\t//X\n\t\tfor(var j = x; j < (gameboard.right); j += 1){\n\t\t\t//Y\n\t\t\tfor(var k = 1; k < gameboard.height; k += 1){\n\t\t\t\tvar imgData = background...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper to peek up to `maxChunks` into a stream. The return type signals if the stream has ended or not. If not, caller needs to add a `data` listener to continue reading.
function peekStream(stream, maxChunks) { return new Promise(function (resolve, reject) { var streamListeners = new disposable_1.DisposableCollection(); // Data Listener var buffer = []; var dataListener = function (chunk) { // Add to buffer buffer.push(chunk);...
[ "function peekStream(stream, maxChunks) {\n return new Promise((resolve, reject) => {\n const streamListeners = new lifecycle_1.DisposableStore();\n // Data Listener\n const buffer = [];\n const dataListener = (chunk) => {\n // Add to buffer\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform analysis (obtain cell energy data from ISF file)
function Analyze() { // Assume failure var RC = false; var Txt = ""; Txt = "Loading ISF file:\n" + ISFAbsolutePath; WScript.StdOut.WriteLine( Txt ); // Load the item store file var Handle = IISF.LoadItemStore( ISFAbsolutePath ); if (Handle == 0xFFFFFFFF) { Txt = "Unable to load ISF:\...
[ "function extractEQInfo(earthQuakes){\n\n console.log(\"Extracting E.Q Info\");\n\n for(var i = 0; i < 100; i++){\n var long = earthQuakes.features[i].geometry.coordinates[0];\n var lat = earthQuakes.features[i].geometry.coordinates[1];\n\n var longDif = goalLong - long;\n var latD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `CustomHTTPHeaderProperty`
function CfnRuleGroup_CustomHTTPHeaderPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but rec...
[ "function CfnWebACL_CustomHTTPHeaderPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
randomly assign the speed attribute a new value
setSpeed() { return Math.floor(Math.random() * 250) + 120; }
[ "setRandomSpeed() {\n const rand = Math.random();\n\n this.speed = rand > .5\n ? 1 + (rand / 2) // divide by two just so they don't get too far ahead\n : 1;\n }", "function setSpeed(){\r\n speed = Math.random() * 4;\r\n}", "function randomSpeed(){\n return Math.floor(Math.random() * 400) + ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getFourWordPhraseCounts(args) Get 4word phrase keywords.
function getFourWordPhraseCounts(args) { var inputwords = args['inputwords']; var inputwordscount = args['inputwordscount']; var skipwords = args['skipwords']; var fourwordphrases = {}; for(i = 0; i - 3 < inputwordscount; i++) { var currentword = inputwords[i]; var nextword = inputwords[i + 1]; ...
[ "function getFiveWordPhraseCounts(args) {\n\t\tvar inputwords = args['inputwords'];\n\t\tvar inputwordscount = args['inputwordscount'];\n\t\tvar skipwords = args['skipwords'];\n\t\t\n\t\tvar fivewordphrases = {};\n\t\t\n\t\tfor(i = 0; i - 4 < inputwordscount; i++) {\n\t\t\tvar currentword = inputwords[i];\n\t\t\tva...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
trig operatorts evaluated immediately
function trigOp(){ if (!this.classList.contains("disabled")){ evaluate(); var inputScreen = document.querySelector('.screen'); var value = inputScreen.innerHTML; if(this.innerHTML.contains("sin")){ inputScreen.innerHTML = Math.sin(value); } else if(this.innerHTML.contains("cos")){ inputScreen.innerHT...
[ "function test_trig() {\n assertEquals(Math.sin(90 / 180 * Math.PI), 1, 'sin');\n assertEquals(Math.cos(180 / 180 * Math.PI), -1, 'cos');\n assertEquals(Math.tan(0 / 180 * Math.PI), 0, 'tan');\n assertEquals(Math.asin(-1) / Math.PI * 180, -90, 'asin');\n assertEquals(Math.acos(1) / Math.PI * 180, 0, 'acos');\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function Name: updateID() Function Description: Update the currently selected user ID for login. Parameters: event (event) event. Programmer: Shir Bar Lev.
updateID(event) { this.setState({ userID: event.target.value }); }
[ "function setID(newid) {\r\n id = newid;\r\n }", "function on_identify(id){\n users.user0.uuid=id;\n document.querySelector(\"#username\").innerHTML = id;\n}", "function setid(newid) {\n localStorage.setItem(\"userID\", newid);\n }", "function idUpdate(){\n dynamID.currID = dynamID....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detects vertical squash in loaded image. Fixes a bug which squash image vertically while drawing into canvas for some images. This is a bug in iOS6 (and IOS7) devices. This function from
function detectVerticalSquash (img) { var iw = img.naturalWidth, ih = img.naturalHeight var canvas = document.createElement ("canvas") canvas.width = 1 canvas.height = ih var ctx = canvas.getContext('2d') ctx.drawImage (img, 0, 0) var ...
[ "function detectVerticalSquash(img) {\r var iw = img.naturalWidth,\r ih = img.naturalHeight\r var canvas = document.createElement(\"canvas\")\r canvas.width = 1\r canvas.height = ih\r var ctx = canvas.getContext('2d')\r ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new BlobClient object identical to the source but with the specified snapshot timestamp. Provide "" will remove the snapshot and return a Client to the base blob.
withSnapshot(snapshot) { return new BlobClient(setURLParameter(this.url, URLConstants.Parameters.SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline); }
[ "withSnapshot(snapshot) {\n return new BlockBlobClient(setURLParameter(this.url, URLConstants.Parameters.SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline);\n }", "withSnapshot(snapshot) {\n return new AppendBlobClient(setURLParameter(this.url, URLConstants.Parameters.SNAPSHO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LLAMA LA FUNCION editaPedidoAPI PARA EFECTUAR LOS CAMBIOS RECIBE POR PARAMETRO EL ID Y LA FILA DEL HTML, DEL PEDIDO
function editarPedido(id, fila) { let celdas = fila.querySelectorAll("td"); //CARGA INPUTS CON DATOS DE LA FILA inputNombre.value = celdas[0].innerHTML.trim(); inputDireccion.value = celdas[1].innerHTML.trim(); inputSelect.value = celdas[2].innerHTML.trim(); inputCantidad.value = celdas[3]....
[ "function enviar_editar(id,usuario,nombreusuario, tarea, descr, caducidad){\n //Sistema ajax para crear elemento\n $.post(\"funciones.php\",\n {\n datos : {\n id:id,\n usuario: usuario,\n tarea: tarea,\n descr: descr,\n caducidad: caducidad\n },\n funcion: \"ed...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns custom items for network selector. Shows 'Proxy settings' only when connected to a network.
getNetworkCustomItems_() { const items = []; if (this.isNetworkConnected) { items.push({ customItemType: NetworkList.CustomItemType.OOBE, customItemName: 'proxySettingsListItemName', polymerIcon: 'oobe-network-20:add-proxy', showBeforeNetworksList: false, customData...
[ "function generateVirtualNetworksSelector(){\n // Get the list of options\n var options = G_virtualNetworks;\n\n // If the current virtual network is not in the list of virtual networks, choose the first available\n if (options.indexOf(G_virtualNetwork) < 0) {\n G_virtualNetwork = options[0];\n }\n\n // Em...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines if a given command has an `outlets` map. When we encounter a command with an outlets k/v map, we need to apply each outlet individually to the existing segment.
function isCommandWithOutlets(command) { return typeof command === 'object' && command != null && command.outlets; }
[ "function isCommandWithOutlets(command) {\n return typeof command === 'object' && command != null && command.outlets;\n }", "function isCommandWithOutlets(command) {\n return typeof command === 'object' && command != null && command.outlets;\n}", "function isCommandWithOutlets(command) {\n return ty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends a new track email to the emergency contact.
function sendTrackEmail() { const mailOptions = { from: `${APP_NAME} <noreply@firebase.com>`, to: `${email}`, }; mailOptions.subject = `${APP_NAME} Track Message!`; mailOptions.text = `Hey ${name}! You are $...
[ "function sendEmergencyEmail() {\n const mailOptions = {\n from: `${APP_NAME} <noreply@firebase.com>`,\n to: `${email}`,\n };\n\n mailOptions.subject = `${APP_NAME} Track Message!`;\n mailOptions.text = `Hey ${...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add newPost from Firebase to store
async addPost({ commit, state }, createdPost) { try { const res = await axios.post("https://nuxt-web-blog.firebaseio.com/posts.json?auth=" + state.token, createdPost) commit("ADD_POST", { ...createdPost, id: res.data.name }) } catch (e) { console.log(e.response) } }
[ "function writeNewPost(uid, title, imageUrl) {\n // A post entry.\n var postData = {\n user: uid,\n image: imageUrl,\n message: title,\n time: new Date()\n };\n\n var db = firebase.firestore();\n\n return db.collection(\"posts\").add(postData).then(function(ref) {\n console.log(\"Document id: \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End script function, logs and shows info about the errors and finish the script
function endScript() { logger.log('ERROR parsing command line: invalid argument!'); //Error message for the log logger.log('Terminating ...'); //Exit message ...
[ "end() {\n process.exit();\n }", "function End () {}", "function quit() {\n console.log(\"---End of results. Thank you.---\");\n process.exit(0);\n }", "async onEnd() {\n\t\tawait this.say('Exiting...');\n\t}", "function end() {\n console.log(\"Thank you for using Employee Trac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function add a new query chart into query tab [Outside functions] newQueryChartDOM(pID) : defined in panelsDOM7.js newSurveyArea(pID) : defined in panelsDOM7.js newQuestionArea(pID) : defined in panelsDOM7.js newQuestionSelector(pID): defined in panelsDOM7.js resizable() : defined in open source library jQuery UI ...
function addNewQueryChart() { // Record IDs, maximum panel ID is increased by 1 becomes the current panel ID maxPID += 1; currentPID = maxPID; // Create DOMs of new query chart panel and append it to query tab var nextQueryChart = panelsDOM.newQueryChartDOM(currentPID); ...
[ "function createQueryChart(sID, qID, qcID) {\n // If qID has no content, create empty chart\n if (qID == null) {\n createQueryEmpty(qcID); \n // Update chart header\n $(\"#query-chart\"+qcID+\" .query-header\").text(\"Selected questions: none\");\n }\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove selection submenu items for the given ID
function removeContextMenuItems( menuId ) { // Remove always-there menu browserMenusRemove( menuId + "-unaltered" ); // Now prefs menus if (submenuCount) { browserMenusRemove( menuId + "-separator" ); for (let n = 0; n < submenuCount; ++n) browserMenusRemove( menuId + ...
[ "removeMenu(id) {\n check(id, String);\n delete Context.menus[id];\n }", "function removeItem(id) {\n\t\tvar index = selectedItems.indexOf(id);\n\t\tif(index >= 0) {\n\t\t\tselectedItems.splice(index,1); \n\t\t}\n\t}", "function removeItem(id) {\n var multi_select = $('#paraia-multi-select-'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the requested path is mapped to a directory, make sure it has a ending slash. This will allow for subdirectories This does not reapply the possible query string, but it is not used in this feature
function requireDirSlash(req) { let newUrl = null; if (!req.path.endsWith("/")) { newUrl = req.baseUrl + req.path + "/"; } else if (req.path.length == 1 && !req.originalUrl.includes(config.cloudDirectoryUserView + "/")) { // The requested path is /cloud, which express confuses with /clou...
[ "function __addSlashIfNot(directory)\n{\n\tvar d = directory;\n\tif(d==null)\n\t\td=\"\";\n\t// add ending / if it is not there.\n\tif(d.length>=1)\n\t{\n\t\tlastChar = d[d.length-1];\n\t\tif(lastChar!='\\\\' && lastChar!='/')\n\t\t\td+='/';\n\t}\n\treturn d;\n}", "function ensureLeadingSlash(path) {\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The 5 following functions show the bars, detect if you hit one and what happens when you do hit one lose a life and get pushed back to try again so long as you haven't lost all your lives.
function barShow(){ let barX = bgLeft + 800; fill(127); noStroke(); rectMode(CORNER); for(let i = 0; i < 9; i++){ rect(barX, bar.y, bar.sizeX, bar.sizeY); barTouch(barX,bar.sizeY,bar.y); barX += 600; } if(bar.sizeY <= bottom && bar.sizeY > cieling){ shouldGrow(); } else if(bar.sizeY...
[ "barShow(){\n let x = this.bgLeft + 800;\n let y = this.y;\n for (let i = 0; i < metalBars.length; i++){\n let bar = metalBars[i];\n bar.display(x,y, bar.width, bar.height);\n bar.barTouch(stealer);\n x += 600;\n if(bar.height <= bottom && bar.height > cieling){\n bar.grow()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stream operators ================ These functions combine streams in some way, rather than transforming a single stream. For this reason they stand apart from the TupleQueue methods. Base for things that are writable themselves, but accept data from multiple streams. Since we won't be piped into, but rather will subscr...
function Combine(streams) { TupleQueue.call(this); this._streams = streams; this.writable = false; }
[ "_putIntoStream(){\n let processedData;\n\n while(!this.backPressure && (processedData = this.dataHandler.popProcessed(this.writtenCount)) !== undefined){\n if(processedData){ // can be null to imply the end of results\n processedData = processedData.getMajorityResult();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Instances of this interface are used to navigate a column in the Bitwig Studio browser.
function BrowserColumn() {}
[ "function BrowseViewColumn()\r\n\t{\r\n\t\tOTAddProperty( this, \"boolean\", \"isEnabled\", true );\r\n\t\tOTAddProperty( this, \"boolean\", \"sort\", false );\r\n\t\tOTAddProperty( this, \"boolean\", \"sortDirectionDesc\", false );\r\n\t\tOTAddProperty( this, \"string\", \"colName\", \"unDefinedValue\");\r\n\t\tOT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
do first select action, if no tab is setted the first tab will be selected.
function doFirstSelect(container){ var state = $.data(container, 'tabs') var tabs = state.tabs; for(var i=0; i<tabs.length; i++){ var opts = tabs[i].panel('options'); if (opts.selected && !opts.disabled){ selectTab(container, i); return; } } selectTab(container, state.options.select...
[ "selectFirst() {\n const tabs = this._allTabs();\n const idx = this._getAvailableIndex(0, 1);\n this._selectTab(tabs[idx % tabs.length]);\n }", "function doFirstSelect(container){\r\n\t\tvar state = $.data(container, 'tabs')\r\n\t\tvar tabs = state.tabs;\r\n\t\tfor(var i=0; i<tabs.length; ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Collects the import bindings for the debug tools.
collectDebugToolsSpecifiers(specifiers) { specifiers.forEach(specifier => { if (specifier.node.imported && SUPPORTED_MACROS.indexOf(specifier.node.imported.name) > -1) { this.localDebugBindings.push(specifier.get('local')); } }); }
[ "collectDebugToolsSpecifiers(specifiers) {\n this.importedDebugTools = true;\n this._collectImportBindings(specifiers, this.localDebugBindings);\n }", "recordChanges() {\n this.updatedImports.forEach((expressions, importDecl) => {\n const sourceFile = importDecl.getSourceFile();\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks if a value exists and returns it with append_text appended
function li_value(val, append_text) { if(!append_text) { append_text = ''; } if(val) { return val + append_text; } else { return ''; } }
[ "function appendORreplace(id, value) {\n if ($(id).html() === \"\") {\n $(id).append(value);\n } else {\n $(id).text(value);\n }\n}", "function appendFindsTypeValue(findsTypeValue) {\n var inputDiv = document.createElement(\"div\");\n inputDiv.className = \"findsTypeValueDiv\"\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a key which can be used in a hash to find the combination of the method and the uri.
function buildRequestKey(method, uri) { return method + " " + uri; }
[ "function signgen(method, key, ...args) {\n\t// create tuples of key-value pair\n let tuples = [];\n\n\tfor (let i=0; i<args.length; i+=2) {\n\t\ttuples.push({ key: args[i], value: args[i+1] });\t\n\t}\n\n\t// sort lexicographically inplace\n\tsortLex(tuples);\n\n\t// form stringA output\n\tlet stringA = '';\n\tfo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setDocumentFocus sets the document focus of the context manager. The focus includes all parameters needed to access a particular document. These are: storageId the MedCommonsID where the data is stored. guid the document's SHA1 identifier within the context of that storageId. cxphost the hostname for a particular gatew...
function setDocumentFocus (storageId,guid, cxpprotocol, cxphost, cxpport, cxppath, applianceRoot) { if(!applianceRoot) applianceRoot = ''; setContextURL(baseURL + "setDocumentFocus?storageId=" + storageId + "&guid=" + guid + "&cxpprotocol=" + cxpprotocol + "&cxphost=" + cxphost + "&cxpport=" + cxpport + ...
[ "function setDocumentFocus (storageId,guid, cxpprotocol, cxphost, cxpport, cxppath) {\n\n\tsetContextURL(baseURL + \"setDocumentFocus?storageId=\" + storageId +\n\t\t\"&guid=\" + guid +\n\t\t\"&cxpprotocol=\" + cxpprotocol +\n\t\t\"&cxphost=\" + cxphost +\n\t\t\"&cxpport=\" + cxpport +\n\t\t\"&cxppath=\" + cxppath\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get work orders of all provided ids
function getWorkOrders(idArray) { try { var filters = []; var columns = []; filters.push(new nlobjSearchFilter("internalid", null, "anyof", idArray)); filters.push(new nlobjSearchFilter("mainline", null, "is", "T")); var col = new nlobjSearchColumn('internalid'); ...
[ "function getOrderIds() {\r\n\treturn fetch(\r\n\t\t`${URL}/orders/?ws_key=${API_KEY}&filter[current_state]=[2]&${FORMAT}&rand=${Math.floor(\r\n\t\t\tMath.random() * 1000000\r\n\t\t)}`\r\n\t)\r\n\t\t.then((res) => {\r\n\t\t\treturn res.json();\r\n\t\t})\r\n\t\t.then((res) => res.orders);\r\n}", "function getAllTe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends LitAdvisor outbound message to CSC for any field changes listed in policyFieldChanged() function in a Policy associated with the Claim that has InSuit Feature.
static function sendPolicyChanges(messageContext : MessageContext, policy : Policy) { var isClaimNew = false; if (policy.Changed && policy.Claim.Changed) { isClaimNew = true; } for (exposure in policy.Claim.Exposures) { if (exposure.ex_InSuit && exposure.State != "draft" && anyFieldChanged(...
[ "static function sendClaimChanges(messageContext : MessageContext, claim : Claim) {\n var invokeMessage = false;\n\n for (exposure in claim.Exposures) {\n if (!exposure.New && exposure.ex_InSuit && exposure.State != \"draft\" && anyFieldChanged(exposure)) {\n invokeMessage = true;\n } else {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
allows subsystems to pin the sidebar open. The sidebar will only hide when all pins have been removed.
function pinSidebar(pin) { $('#topbar #close-sidebar').addClass('disabled'); $('#topbar #close-sidebar').removeClass('fa-rotate-90'); $('#sidebar').show(); zoom(true); mode.pinnedSidebar = mode.pinnedSidebar || [] if (mode.pinnedSidebar.indexOf(pin) == -1) { mode.pinnedSidebar.push(pin); } }
[ "function switchToMap() {\r\n if (sidebarCoversMap()) {\r\n sidebar.close();\r\n }\r\n}", "_showOrHideSidebar() {\n sidebar.classList.toggle('hidden');\n\n //display the show sidebar button\n btnHideSidebar.classList.toggle('hidden');\n\n //hide the button once it is pushed\n btnShowSi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Caches the logged in user's current IC status, and starts a subscription to receive IC status changes for the logged in user.
function startUserStatusSubscription() { var icwsUser, payload, userCurrentStatusElement; // Start listening for IC status changes for the logged in user. icwsUser = session.getSessionUser(); payload = { userIds:[icwsUser] }; session.sendRequest('PUT', '/messaging/subscriptions/status/user-statuses...
[ "function updateSubscribeUIStatus() {\n all_comic_data = settings.get('comic');\n if (all_comic_data == undefined) {\n all_comic_data = {};\n settings.set('comic', all_comic_data);\n }\n search_viewcontroller.updateSubscribeUI(all_comic_data);\n favorite_viewcontroller.updateSubscribeUI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets value from factor group.
function get_values_from_group_factor(form_group) { var value = get_value_from_group_dropdown(form_group); var factor_div = form_group.children('div:first'); var factor = factor_div.children('label').text().split(': ')[1]; if (factor == 'FACTOR_1') { factor = ''; } var values = { 'name': factor, ...
[ "function getGroupValue(groupName) {\r\n\r\n\treturn document.querySelector('input[name=\"' + groupName + '\"]:checked').value;\r\n}", "function getSelectedValue(groupName) {\n var radios = document.getElementsByName(groupName);\n for( i = 0; i < radios.length; i++ ) {\n if( radios[i].checked )...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function to clear the given elements field value, by setting the elements fields value to an empty string.
function clearInputField(element) { element.value=''; }
[ "function clearFields(elements) {\n for( var i = 0; i < elements.length; i++ ) {\n elements[i].value = '';\n }\n}", "function clearElementValue( formElement )\r\n{\r\n\tif ( formElement != null ){\r\n\t\tformElement.value=\"\";\r\n\t}\t\r\n}", "function clear_input_values ( elements ) {\n\t\telemen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Caching: We only bundle English by default in the SignIn Widget. Other languages are loaded on demand and cached in localStorage. These languages are tied to the version of the widget when it bumps, we reset the cache.
function getCachedLanguages() { var storage = JSON.parse(localStorage.getItem(STORAGE_KEY)); if (!storage || storage.version !== config.version) { storage = { version: config.version }; } return storage; }
[ "_loadLocale() {\n this._locale = settingsCache.get('lang');\n return this._locale;\n }", "function loadLanguage(){\n var storedLanguage = window.sessionStorage.getItem(\"language\")\n if (!(typeof storedLanguage === 'undefined' || storedLanguage === null)){\n language = storedLangua...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2 create a function that accepts an array of numbers and returns an array with all the duplicates removed. dedupe([1,2,1,2,1]) // [1,2] dedupe([0,0,0]) // []
function dedupe(array) { // initialize an array that holds all the non duplicate // iterate thru the arr const output = array.filter((el, idx) => idx === array.indexOf(el)); // check if the idx of the el is equal to the output of using the indexof method with that el // push the el into the output array // ...
[ "function dedupeSorted(nums) {\n var newArr = []\n newArr.push(nums[0])\n for (var i = 1; i < nums.length; i++){\n if (nums[i] !== nums[i-1]){\n newArr.push(nums[i])\n }\n }\n return newArr\n}", "function dedupeArr(arr) {\n var newArr = [];\n for (var i = 0; i < arr.lengt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mark inspectorinjected nodes. The `.source` annotation was added with For older versions, we check for the `picker` name.
markInspectorNodes () { const scene = this.sceneEl.object3D; const inspectorRootNodes = new Set(); let inspectorNode = scene.getObjectByName('picker'); if (inspectorNode) { while (inspectorNode.parent !== scene) inspectorNode = inspectorNode.parent; inspectorRootNodes.add(inspectorNode); ...
[ "function attachSourceIfNecessary ({ nodes }, selector) {\n for (const node of nodes) {\n if (node.type === 'pseudo' || node.type === 'attribute') {\n const splitSelector = selector.split('\\n')\n const { start, end } = node.source\n let sourceCode = ''\n for (let i = start.line - 1; i < end...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A flex container with vertical layout. All additional props are spread to the style of the underlying div.
function Vbox(props) { props = _objectSpread(_objectSpread({}, props), {}, { flexDirection: 'column' }); return /*#__PURE__*/_react["default"].createElement(Box, props); }
[ "function layout({dr='v', jc='b', ac='+', ai='~', fx=null, mg=null, pd=null}) {\n var style = {\n display: 'flex',\n flexFlow: dr.indexOf('v') != -1 ? 'column' : 'row' +\n dr.indexOf('-') != -1 ? '-reverse ' : ' ' +\n dr.indexOf('.') != -1 ? 'nowrap' : 'wrap',\n justifyContent: ja[jc],\n alig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assert Joi validation error
function assertValidationError (err, message) { expect(err.isJoi).to.equal(true) expect(err.name).to.equal('ValidationError') expect(err.details.map(x => x.message)).to.include(message) expect(errorLogs).to.include(err.stack) }
[ "getJoi() {\n const newJoi = Joi.extend((joi) => ({\n base: joi.string(),\n name: 'cloakAmount',\n language: {\n validCloak: this.t(`is less than 0.00000001`),\n validCloakM: this.t(`is less than 0.00001`),\n validCloakU: this.t(`is less than 0.01`),\n },\n /* eslint...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
can we assume search tree is balanced? > yes input > search tree 5 / \ 2 20 / \ / \ 1 4 15 21 output > 3 given a search tree count the number of rows if a node has child counter + 1 until node has no child return count if ( right ) increment counter check again if ( left ) increment counter check again return counter;
function findHeight(node, counter = 0) { // console.log(currentNode); // console.log(bst); if (!node) { return counter; } //if has both if (node.right) { findHeight(node.right, counter++); } if (node.left) { findHeight(node.left, counter++); } return counter + 1; }
[ "function treeQuantity(root, target){\r\n if (!root) return 0;\r\n let count = 0;\r\n let stack = [root];\r\n\r\n while(stack.length) {\r\n let currentNode = stack.pop();\r\n if(currentNode.val === target) {\r\n count++\r\n };\r\n if(currentNode.left) stack.push(cu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
///get the membership product details
function regGetMembershipProductDetailsAction(productId) { return { type: ApiConstants.API_REG_GET_MEMBERSHIP_PRODUCT_LOAD, productId, }; }
[ "function fetchDetailsForProduct() {\n if (kony.net.isNetworkAvailable(constants.NETWORK_TYPE_ANY)) {\n kony.application.showLoadingScreen(\"loadskin\", \"Fetching product details...\", constants.LOADING_SCREEN_POSITION_FULL_SCREEN, false, true, {enableMenuKey: true, enableBackKey: true, progressIndicatorColor:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate per schema backups
async function main(){ if ( process.argv.length < 3 ){ throw new Error("Usage : postgis-backup <targetDir> [<schemaName>]"); } let targetDir = process.argv[2]; let schemaNameFilter = process.length < 4 ? null : process.argv[3]; /* handle targetDir */ targetDir = path.resolve(targetDir)...
[ "async backup() {\n\t\tconst filename = '../data/db_backup.json';\n\t\tconst block = await this.findAllFromCollection('block');\n\t\tconst forum = await this.findAllFromCollection('forum');\n\t\tconst courses = await this.findAllFromCollection('courses');\n\t\tconst quiz = await this.findAllFromCollection('quiz');\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shifts an item at `index` towards beginning of the array.
function shiftLeft(array, index) { var length = array.length; for (var i = index; i < length; ++i) { array[i - index] = array[i]; } array.length = length - index; }
[ "function shiftLeft(array, index) {\n var length = array.length;\n\n for (var i = index; i < length; ++i) {\n array[i - index] = array[i];\n }\n\n array.length = length - index;\n }", "function shiftLeft(array, index) {\n var length = array.length;\n\n for (var i = index; i < lengt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch All Product Group
GetProductgroups(){ var that = this; var reqQuery = {}; reqQuery['userdetails'] = getUserDetails(); const request = new Request(`${process.env.API_HOST}/ManageProducts.svc/GetProductGroups/json`, { method: 'POST', headers: new Headers({ 'Content-Type': 'application/json' ...
[ "function fetchAllProduct(){\n \n client.product.fetchAll().then((products) => {\n // Do something with the products\n console.log(products.it);\n }); \n}", "function notesFetchAllCalcGroups() {\n itemDB.open(databaseName, version, datastoreName, \"\", properties, true, function (resu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new RecentDataProduct.
constructor() { RecentDataProduct.initialize(this); }
[ "constructor() { \n \n RecentsProduct.initialize(this);\n }", "function Recent()\n{\n this.key = -1;\n this.idext = 0;\n}", "function CreateProductObject( database ){\n\t\n\tToken0 = database.indexOf(\"|\", 0);\n Token1 = database.indexOf(\"|\", Token0+1);\n Token2 = database.indexO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show/Hide subnav menu on mainnav item hover
function showHideSubNav(i) { $(mainNavArr[i]).hover(function() { $(subNavArr[i]).addClass('active'); }); $(subNavArr[i]).hover(function() { $(subNavBlock).css('display', 'block'); $(subNavArr[i]).addClass('active'); clearTimeout(timer); }, function() { $(subNavBlock).hide(); $(subNavArr)...
[ "showSubmenu() {\n $(this).addClass(\"hover\").find(\".subMenu\").show();\n }", "function hoverOnNav() {\n if ($(window).width() >= 768 && cssua.ua.desktop && !cssua.ua.tablet_pc) {\n //hover nav event\n $('.nav-icon, .left-menu').hover(function () {\n activeNav = $...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluate the world light entity position and orientation from the model ones
function evalLightWorldTransform(modelPos, modelRot) { return {p: Vec3.sum(modelPos, Vec3.multiplyQbyV(modelRot, MODEL_LIGHT_POSITION)), q: Quat.multiply(modelRot, MODEL_LIGHT_ROTATION)}; }
[ "report_camera_world() {\n var cam_wp = new THREE.Vector3(), cam_up = new THREE.Vector3(), world_q = new THREE.Quaternion(), cam_fwd = new THREE.Vector3(), cam_right = new THREE.Vector3();\n // cam_wp\n lens.updateMatrixWorld(); // Object3D matrixAutoUpdate d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Take in the JSON, parse to a string and then Return a string of name,url (for easier comparisons in the set)
function jsonToSetString(message) { var json = JSON.parse(message.payloadString); var name = json.name; var url = json.URL; return name + "," + url; }
[ "function parseRestaurantName(googleObject){\n return googleObject[0][\"name\"];\n}", "function json2url(json) {\n\tvar arr = [];\n\tfor (var i in json) {\n\t\tarr.push(i + '=' + json[i]);\n\t}\n\tvar str = arr.join('&');\n\treturn str;\n}", "function jsonUrl(url) {\n var segs = url.split('?'),\n n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
attach the team to an existing company
async attachToCompany () { // get the company this.company = await this.data.companies.getById(this.attributes.companyId); if (!this.company || this.company.get('deactivated')) { throw this.errorHandler.error('notFound', { info: 'company' }); } // can only attach to a company that was created by the same...
[ "async createCompany () {\n\t\tconst company = this.attributes.company || {};\n\t\tcompany.name = company.name || this.determineCompanyName();\t// company name is determined from the user's email\n\t\tthis.company = this.transforms.createdCompany = await new CompanyCreator({\n\t\t\trequest: this.request,\n\t\t\ttea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the game (with provided gameID) from the list of games returns a copy of the deleted game, or null if game was not deleted
removeGame(gameID) { let game = this.gameByID(gameID); if (!game) { return null; } let gameClone = {}; Object.assign(gameClone, game); this.games.delete(gameID); return gameClone; }
[ "function removeGame(id) {\n listGames.splice(id, 1);\n console.log(\"Destroying game number \"+ id);\n}", "function deleteGame(game) {\n client.collection(\"games\", function(error, games) {\n if (error) throw error;\n games.remove({id: game.id}, function(error) {\n if (error) throw error;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds typeof to Object.prototype
function register() { if (Object.prototype.typeOf !== boundTypeOf) { otypeof = Object.prototype.typeOf; Object.prototype.typeOf = boundTypeOf; } }
[ "function setType(obj,type){obj.__proto__ = type.prototype;return obj;}", "function isPrototypical(obj) {\n if ((typeof obj) !== 'object') { return false; }\n if (obj === null) { return false; }\n var constr = obj.constructor;\n if ((typeof constr) !== 'function') { return false; }\n return constr....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a global external handler. Used internally by plugins.
function GlobalExternalHandler() { //a map of context ids to specific handlers var specificHandlers = {}; //whether or not this handler has replaced the default functions var installed = false; return { /** * Sets the global handler up. this should override the global browser * A...
[ "function registerHandler(name, instance) {\n externals[name] = instance;\n }", "handler(name) {\n return externals[name].getSpecificHandler(self);\n }", "function createHook(ext) {\n return function(module, filename) {\n if (module.parent == wrapper) {\n // If the main module is ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Game function start game with board full of images of cards
function gameStart() { for (let i = 0; i < deck.length; i++) { let cardFront = document.createElement('img'); cardFront.setAttribute('class', 'box'); cardFront.setAttribute('data-number', i); cardFront.setAttribute('src', deck[i].image); gameBoard.appendChild(cardFront); } }
[ "function startGame(){\n\n // create the grid array\n gridCardsArray = createGrid();\n\n // start cards with objects IDs and Icon values\n initCards();\n\n}", "function startBoard() {\n resetBoard();\n getNewCards();\n shuffleBoard();\n loadBoardElemets();\n updateCounters();\n start...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method to create a thought. Callback function for the route POST /api/thoughts
createThought({body},res){ // Mongoose .create() method to create data based on the body from the Thought.js model, only needing objects that have required properties (username, thoughtText) Thought.create(body) .then(({_id}) => { return User.findOneAndUpdate( {_id: b...
[ "createThought({ body }, res) {\n\t\tThought.create(body)\n\t\t\t.then((dbThoughtData) => {\n\t\t\t\tUser.findOneAndUpdate(\n\t\t\t\t\t{ username: dbThoughtData.username },\n\t\t\t\t\t{ $push: { thoughts: dbThoughtData._id } },\n\t\t\t\t\t{ new: true, runValidators: true }\n\t\t\t\t).then((data) => {\n\t\t\t\t\tif ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use Xmlmc to log the call
function _swdoc_lcf_complete_log_call (strType) { //-- set callclass document.opencall.callclass = this._callclass; //-- will handle fullclient onSendSessionData event this._send_session_data(); var xmlmcMethod = "logNewCall"; var xmlmc = new XmlMethodCall(); //-- set action as incoming if(_SWF...
[ "function logCallInfo(values){\n return modelsupport.logCallInfo(values);\n}", "function _XMLDoc_logStream()\n{\n if(!this.logFn) return;\n for(var i=0; i< this.stream.length; i++) this.logFn(this.stream[i].toString());\n}", "function LogAccess() {}", "function EBX_Logger() {\n\n}", "function JSNLog() { ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get header of field
function getHeader(field){ var head='<thead>'; for(var i=1;i<field.length;i++){ head+='<td class="query-header">'+field[i].column+'</td>'; } return head+'</thead>'; }
[ "get headerField() {\n\t\treturn this.__headerField;\n\t}", "function getHeader(){\n var documentProperties = PropertiesService.getDocumentProperties();\n var header = documentProperties.getProperty(HEADER_DATA);\n if (header == null)\n header = HEADER;\n return header;\n}", "visitHeader_field(ctx) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_ESAbstract.CreateMethodProperty 7.3.5. CreateMethodProperty ( O, P, V )
function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars // 1. Assert: Type(O) is Object. // 2. Assert: IsPropertyKey(P) is true. // 3. Let newDesc be the PropertyDescriptor{[[Value]]: V, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true}. var newDesc = { value: V, wr...
[ "function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars\n\t// 1. Assert: Type(O) is Object.\n\t// 2. Assert: IsPropertyKey(P) is true.\n\t// 3. Let newDesc be the PropertyDescriptor{[[Value]]: V, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true}.\n\tvar newDesc = {\n\t\tvalu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get input and output node names from SavedModel metagraphs info. The input.output node names will be used when executing a SavedModel signature.
function getInputAndOutputNodeNameFromMetaGraphInfo(savedModelInfo, tags, signature) { for (var i = 0; i < savedModelInfo.length; i++) { var metaGraphInfo = savedModelInfo[i]; if (stringArraysHaveSameElements(tags, metaGraphInfo.tags)) { if (metaGraphInfo.signatureDefs[signature] == null...
[ "showInputs () {\n const requiredInputs = this.dag.requiredInputNodes() // returns an array of DagNode references\n console.log('REQUIRED INPUTS:')\n requiredInputs.forEach(node => { console.log(node.key()) })\n }", "function getInputsVerilogString(){\n inputsVerilogString = 'input ';\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this func dynamically rotates and checks each rotation for instance of prime
function rotate (prime) { // split prime into an array prime = prime.toString().split(''); // rotate prime as many times as it's length dictates for (let i = 0; i < prime.length - 1; i++) { // rotate one place to the right prime.unshift( prime.pop() ); // if current rotati...
[ "function allRotationsPrime(n) {\n var num = String(n); // start by converting our test-number to a string\n\n // The way we check every rotation is by moving the last digit to the beginning each time.\n for (var i = 1; i < num.length; i++) {\n num = num.slice(-1) + num.slice(0, num.length - 1);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This time no story, no theory. The examples below show you how to write function accum: Examples: accum("abcd") > "ABbCccDddd" accum("RqaEzty") > "RQqAaaEeeeZzzzzTtttttYyyyyyy" accum("cwAt") > "CWwAaaTttt" The parameter of accum is a string which includes only letters from a..z and A..Z.
function accum(s) { // a place to store the result let result = ""; //iterate over sting for (let i = 0; i < s.length; i++) { // append the current letter i+1 times to the string for (let j = 0; j < i + 1; j++) { if (j == 0) { // ap the first append ...
[ "function accum(str) {\n // Note about time complexity: Other languages have data structures to deal with the expense of repeated string concatenation (i.e. StringBuilder in Java). My understanding is that Javascript has some efficiency built into its + operator. If this is NOT the case, then the code below ha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }