query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Update an existing reach profile object.
static update(id, reachProfile){ let kparams = {}; kparams.id = id; kparams.reachProfile = reachProfile; return new kaltura.RequestBuilder('reach_reachprofile', 'update', kparams); }
[ "static update(id, accessControlProfile){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\tkparams.accessControlProfile = accessControlProfile;\n\t\treturn new kaltura.RequestBuilder('accesscontrolprofile', 'update', kparams);\n\t}", "function updateDriver() {\n profileFactory.updateProfile(vm.profile).then...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resets content and sets event listener on randomnumberwrapper element, updates active player and instruction in clickToPlay element in DOM
setupNewTurn(){ this.variableValue = null; // reset variableValue property updateVariableInDOM(this.variableValue); // sets #random-number-wrapper element content in DOM to ? updateActivePlayer.bind(this)(); // update activePlayer property and display active player's name in #current-player-name...
[ "function playAgain(){\n document.querySelector('button').setAttribute('id', 'button-hide'); //remove play again button\n resetSelectionState();\n resetGameBoardState();\n addElementListener(document.getElementsByTagName('div')); //reapply board event listeners\n addElementListener(document.getElemen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reset selected options to default;
resetOptions(){ // reset all extras; const $selects = $('.sm-box').find('select'); $($selects).each((i, el) => { const name = $(el).attr('id'); $(`#${name}`).prop('selectedIndex', 0); this.resetSheetValues(name); }); }
[ "function clearSelectedStates() {\n _scope.ugCustomSelect.selectedCells = [];\n }", "function cleanSelection() {\n $scope.presets = undefined;\n $scope.selectedCategory = undefined;\n $scope.selectedPreset = undefined;\n }", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
click on the pdf button to generate pdf of dashboard
function generatePDF() { viz.showExportPDFDialog() }
[ "function pdfDownload(){ \n\tvar url = \"https://\"+CURRENT_IP+\"/cgi-bin/NFast_3-0/CGI/RESERVATIONMANAGER/FastConsoleCgi.py?action=configdlpdf&query={'QUERY':[{'username':'\"+globalUserName+\"'}]}\";\n \n\t\twindow.location.href = url + query ;\n}", "function export_pdf()\n\t{\n\t\tdata = get_dat_sort();\n\t\tva...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
shows all neural network lines
function show_line(){ var lines=Array.from(document.getElementsByClassName("line")); lines.forEach(each=>{ each.classList.remove("line_hide"); if(Math.random()<0.5){ each.classList.add("line_animate"); } }); document.getElementsByClassName("output_neuron_layer")[0].ch...
[ "function draw_nn(arch){\n let n = arch.length;\n let rad = 25;\n \n // Draw neurons\n let hor_dist = width / (n+1)\n for (let i = 0; i < n; i++){\n draw_layer(arch[i], (i+1) * hor_dist, 2*rad); \n }\n \n // Draw weights\n for (let i = 0; i < n-1; i++){\n draw_connections(i, i+1, arch[i], arch[i+1],...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse the API version.
parseVersion() { var version = this.map_['info']['version']; var parsed = ''; if (goog.isString(version)) { parsed = parseInt(version, 10); if (isNaN(parsed)) parsed = version; else parsed = parsed.toString(); this.version = parsed; } }
[ "function getVersion() {\n var contents = grunt.file.read(\"formulate.meta/Constants.cs\");\n var versionRegex = new RegExp(\"Version = \\\"([0-9.]+)\\\";\", \"gim\");\n return versionRegex.exec(contents)[1];\n }", "function version(){\n var xmlReq = new XMLHttpRequest(); \n xmlReq.open(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
locate which line a node is on
function locate_line(elt) { var found var initlen = elt.textContent.length var textlen = 0 var count = 10000 var wentup = false while (count > 0 && elt) { count = count - 1 // console.log("at", elt) if (elt.nodeType == 3) { textlen += textContentLength(elt) } else if (found = atLineSt...
[ "function lineNo(line) {\n if (line.parent == null) { return null }\n var cur = line.parent, no = indexOf(cur.lines, line);\n for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n for (var i = 0;; ++i) {\n if (chunk.children[i] == cur) { break }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper to get one icon from the list of extension icons.
function getIcon(icons) { var retval = ""; if (icons && icons.length) { retval = icons[0].url; } return retval; }
[ "get icon_type() {\n return this.args.icon_type;\n }", "getDefaultImage() {\n return this.icon_.get(this.getBaseSize());\n }", "get icon_path() {\n return this.args.icon_path;\n }", "icon(type, path) {\n if (type && path) {\n this._icon.type = type;\n this._icon.path = pat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a list of all adjacent locations to the indicated location
function getAdjacentLocations({homeLocation, locations}) { return directions .map((direction) => { const location = getAdjacentLocation({homeLocation, locations, direction}); return {direction, location} }) .filter(result => !!result.location) }
[ "function getAdjacentCells(cell){\n\tvar cellCopy;\n\tif(cell.location.row+1 < mazeSize ){ // down\n\t\tcellCopy = new Cell(maze[cell.location.row+1][cell.location.col].location.row, maze[cell.location.row+1][cell.location.col].location.col,maze[cell.location.row+1][cell.location.col].id);\n\t\tcell.adjacentCells.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns random color between iMin and iMax.
function getRandomColor(iMin, iMax) { // Creating a random number between iMin and iMax, converting to hex var hexR = (getRandomNumber(iMin, iMax)).toString(16); var hexG = (getRandomNumber(iMin, iMax)).toString(16); var hexB = (getRandomNumber(iMin, iMax)).toString(16); // Making sure single chara...
[ "function rndColor() {\n var iRed = Math.floor((Math.random() * 255) + 1);\n var iGreen = Math.floor((Math.random() * 255) + 1);\n var iBlue = Math.floor((Math.random() * 255) + 1);\n\n $(\"#red\").slider(\"value\", iRed);\n $(\"#green\").slider(\"value\", iGre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CODING CHALLENGE 217 Additional spaces have been added to a sentence. Return the correct sentence by removing them. All words should be separated by one space, and there should be no spaces at the beginning or end of the sentence.
function correctSpacing(sentence) { return sentence.replace(/\s+/g,' ').trim(); }
[ "function reducer(sentence) {\nlet splittedArray = sentence.split(' ');\nlet newWord = splittedArray.reduce(function(initialValue, currentValue){\n\tif(splittedArray(currentValue).length === 3) {\n\t\tinitialValue += ' ';\n\t\treturn initialValue;\n\t}\n\telse {\n\t\tinitialValue += splittedArray(currentValue).char...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(Try to) post a new message to 'sub' via the web API
async function postNew(sub) { $('#newmessage-button').attr('disabled', true); var to = $('#newmessage-to').val(); var subject = $('#newmessage-subject').val(); var body = $('#newmessage-body').val(); const data = await v4_post('./api/forum.ssjs', { call: 'post', sub, to, subject, body }); if (data.succ...
[ "function addNew(sub) {\n\tif ($('#newmessage').length > 0) return;\n\t$('#forum-list-container').append(\n\t\t'<li id=\"newmessage\" class=\"list-group-item\">' +\n\t\t'<input id=\"newmessage-to\" class=\"form-control\" type=\"text\" placeholder=\"To\"><br>' +\n\t\t'<input id=\"newmessage-subject\" class=\"form-co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get Time Array of Day for week
function timeOneDayOfWeek() { const hoursPerDay = 24; let time = []; let formattedTime; for (i = 0; i < hoursPerDay + 1; i++) { //fill in all of the hours formattedTime = (moment().subtract(i, "hours")).format("hA");...
[ "getLocationTimesByDay(day, hours) {\n // NOTE: Location availability is stored in the Firestore database as:\n // availability: {\n // Friday: [\n // { open: '10:00 AM', close: '3:00 PM' },\n // { open: '10:00 AM', close: '3:00 PM' },\n // ],\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save the message to the db and send all sockets but the sender.
function _sendAndSaveMessage(message, socket) { var messageData = { text: message.text, from: message.from, to: message.to, createdAt: new Date(message.createdAt), }; db.collection('messages').insert(messageData, (err, message) => { io.sockets.in(message.to).emit('new_msg', [message]); ...
[ "function send() {\n // Create a new message object\n var message = {\n text: vm.body\n };\n\n var Message = MessageService.message();\n var item = new Message({\n body: vm.body,\n channelId: vm.channel\n });\n\n item.$save(function (response) {\n // Em...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the [min, max] tile corners of the seen tiles.
function findCorners(seenTiles) { const max_int = Number.MAX_SAFE_INTEGER; const min_int = -Number.MAX_SAFE_INTEGER; var min = [max_int, max_int]; var max = [min_int, min_int]; seenTiles.forEach(function ([row, col]) { min = [ Math.min(min[0], row), Math.min(min[1], col) ]; max = [ Math.max(max[0]...
[ "function findCorner() {\n\t\tvar availTiles = emptyTiles(board);\n\t\t\n\t\tvar corner = availTiles.filter(tile => tile == 0 || tile == 2 || tile == 6 || tile == 8);\n\n\t\treturn corner;\n\t}", "function findCorners() {\n var corners = [];\n for (var y = 0; y < map.length; ++y) {\n for ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the drag data can be dropped onto the drop data, false otherwise.
function canDropItem(dragData, dropData) { if (!dragData || !dropData || dragData === dropData || (dragData && !dragData.isTabItem)) { return false; } return true; }
[ "function isInCoords( coords ) {\n\t\t\t\t// get current drop position\n\t\t\t\tvar dropX = getX();\n\t\t\t\tvar dropY = getY();\n\t\t\t\t\n\t\t\t\t//console.log(\"isInCoords: x = \" + getX() + \", y = \" + getY() + \", coords = \" + coords.top + \", \" + coords.right + \", \" + coords.bottom + \", \" + coords.left...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When a player quits, notify everyone else in the room.
function onPlayerQuit() { const player = this.player; this.broadcast.to(player.roomCode).emit('player quit', player); }
[ "onPlayed () {\n UIManager.setStatusCast(UIManager.status.READY);\n UIManager.showSplashScreen();\n\n this.isCompleted = true;\n if (this.endedCallback !== null) {\n this.endedCallback();\n }\n\n this.notifySenders.apply(this, arguments);\n\n logger.info(LOG_PREFIX, 'Played');\n }", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that is used to view a singular person and inserts it into the singular user detail template
function userView(targetid, user){ apply_template(targetid, "user-detail-template", user); }
[ "function showRegistrationDetails() {\n\tselectOne(sessionStorage.getItem('userID'), function(record) {\n\t\t\n\t\tif(!record) {\n\t\t\tconsole.log('Not found');\n\t\t}\n\t\telse {\n\t\t\t$('#txtFirstName').val(record.firstname);\n\t\t\t$('#txtLastName').val(record.lastname);\n\t\t\t$('#txtAddressline1').val(record...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove all translations for `$localize`.
function clearTranslations() { $localize.TRANSLATIONS = {}; }
[ "function loadTranslations(translations) {\n // Ensure the translate function exists\n if (!$localize.translate) {\n $localize.translate = translate;\n }\n if (!$localize.TRANSLATIONS) {\n $localize.TRANSLATIONS = {};\n }\n Object.keys(translations).forEach(key => {\n $localiz...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function:deleteSiteEditorConfigEntry (pageName) Purpose:removes pageName from the site editor config file, collapsing any fields appropriately
function deleteSiteEditorConfigEntry (pageName) { if (!pageName) return false; if (pageName == gBASE_PAGE) return false; var seObj = generateSEObjects (''); if (seObj.pageObjArray[pageName]) { var buttonOrd = parseInt (seObj.pageObjArray[pageName][gBUTTON_ORDER]); doAction('DATA_DELETECONFIGROW', 'Objec...
[ "function removePage (slug) {\n\tvar pagefile = PAGE_DIR+slug+'.md';\n\trm(pagefile);\n}", "function clean_jekyll() {\n return del([\"./_site\"]);\n}", "function entryDeleteHandler(evt, repo){\n const form = document.getElementById('entry-edit-form');\n const entryIndex = form.getAttribute('data-entryInd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Focus Google Maps onto selected device
focusDevice(id) { if (id in this.entities && typeof this.entities[id].maps !== "undefined") { this.googleMaps.setCenter(this.entities[id].maps.marker.getPosition()); } }
[ "function handleClickOnMap() {\n $(\"#map_container\").click(function() {\n startMapMode();\n });\n }", "static cmdCameraFocus(device, stopfarnear = 0x00, speed = -1) {\n let data = stopfarnear;\n if (speed > -1 && stopfarnear != 0x00)\n data = (data << 8) + (speed & 0b111);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
init WebRTC by nim
function initWebRTC() { SDK.NIM.use(WebRTC); console.log(nim); const Netcall = WebRTC; netcall = Netcall.getInstance({ nim: nim, container: document.getElementById('containerLocal'), remoteContainer: document.getElementById('containerRemote'), // chromeId: '', ...
[ "function initMediaStream() {\n\n // Acquire 'getUserMedia' object\n try {\n navigator.getUserMedia = navigator.getUserMedia ||\n navigator.webkitGetUserMedia ||\n navigator.mozGetUserMedia ||\n navigator.msGetUserMed...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset this handle options to their defaults. This will put the handle in a clean state, as if it was just created. Official libcurl documentation: [`curl_easy_reset()`](
reset() { this.removeAllListeners(); this.handle.reset(); // add callbacks back as reset will remove them this.handle.setOpt(Curl.option.WRITEFUNCTION, this.defaultWriteFunction.bind(this)); this.handle.setOpt(Curl.option.HEADERFUNCTION, this.defaultHeaderFunction.bind(this)); ...
[ "reset(){\r\n // Close connection\r\n this.close()\r\n // Reset params\r\n this.sdp = null\r\n this.remoteSdp = null\r\n this.remoteStreams = null\r\n }", "close() {\n curlInstanceMap.delete(this.handle);\n this.removeAllListeners();\n if (this.han...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
type() parses `str` as an object and returns its type: commit, tree or blob.
type(str) { return { commit: 'commit', tree: 'tree', blob: 'tree' }[str.split(' ')[0]] || 'blob'; }
[ "treeHash(str) {\n if (Objects.type(str) === 'commit') {\n return str.split(/\\s/)[1];\n }\n }", "function checkType(str) {\n var obj = {\n datatype: typeof str,\n length: str.length,\n }\n return obj;\n}", "function $type(obj){\n\tif (!obj) return false;\n\tvar type = false;\n\tif (obj ins...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this section populates the dbroles to display in the list================================================
function populateDBRoleList(){ //dblist.set("items", null); dblist.set("items", _model.dbrs); if (_model.SelDBRoleID) { var idx = mstrmojo.array.find(_model.dbrs, 'did', _model.SelDBRoleID); dblist.set("selectedIndex", idx); } }
[ "function populate_roles_fields () {\n // Populate the fields from the roles table\n for (var i in roles) {\n var current_role = new Array();\n $('.roles-row').each(function(index) {\n user = $(this).attr('user_id');\n if ($('#checkbox-'+roles[i]+'-'+user).is(':checked')) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
formats the series identifier. If the number is undefined, the blank string is returned
function formatSeriesIdentifier(msg) { if (msg && msg.seriesIdentifier && msg.seriesIdentifier.number) { var id = msg.seriesIdentifier.fullId; if (msg.type == 'TEMPORARY_NOTICE') { id += '(T)'; } else if (msg.type == 'PRELIMINARY_NOTICE') { id += '(P)'; } ...
[ "function service2id(n)\n {\n return \"dummy_\"+n.replace(\" \",\"_\");\n }", "function getNotifiedSpanID(itemNumber) {\n\treturn 'notifiedSpan-' + itemNumber;\n}", "getID() {\r\n return this.id.toString().padStart(3, '0');\r\n }", "function measure_id () {\n if ( ! _current.measure ) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: extUtils.getOffsetsAfterAccountingForSomeSpecialSelectionCases DESCRIPTION: like the title says ARGUMENTS: RETURNS:
function extUtils_getOffsetsAfterAccountingForSomeSpecialSelectionCases(allText, offsets) { var newOffs = oldOffs = offsets; // strip leading and trailing white space newOffs = extUtils.getOffsetsAfterStrippingWhiteSpace(allText,newOffs[0],newOffs[1]); //remove trailing &nbsp; tag if there // this can happen if...
[ "function extUtils_getOffsetsAfterListCheck(docStr,offset1,offset2)\n{\n var newOffset1 = offset1;\n var newOffset2 = offset2;\n var openListItems = new Array(\"<ol>\",\"<OL>\",\"<ul>\",\"<UL>\");\n var i, nItems = openListItems.length, closeListItem1, closeListItem2, currItem;\n var selStr = docStr.substring(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We have the technology we can rebuild. Function to reassemble the message from the MIME Tree into a String.
mimeToString(mimePart, includeHeaders) { EnigmailLog.DEBUG( "persistentCrypto.jsm: mimeToString: part: '" + mimePart.partNum + "'\n" ); let msg = ""; let rawHdr = mimePart.headers._rawHeaders; if (includeHeaders && rawHdr.size > 0) { for (let hdr of rawHdr.keys()) { let formatt...
[ "function flattenBeamMessage(message) {\n\tvar result = '';\n\tif (message.length !== undefined) {\n\t\tif(message.length > 1 ) {\n\t\t\tresult = message.reduce(function (previous, current) {\n\t\t\t\tif (!previous) {\n\t\t\t\t\tprevious = '';\n\t\t\t\t}\n\t\t\t\tif (typeof previous === 'object') {\n\t\t\t\t\tprevi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the payload is valid and has the same structure as stated in the requestBody Structure If the payload is not valid the request will not go through and will fire off and error to al inputs that hold the data and also a notification will be sent to the server for future use cases
function isValidPayload(payloadRules, data){ // hold the validation errors var valBeforeErrors; //go through all the specified rules and if there is any that is not required the // a request Rejection Event will be fired and change in the data structure will be required for(var field in payloadRul...
[ "function isRequestValid(req){\n return !(req.body === undefined\n || Object.keys(req.body).length < 4\n || !supportedTypes.includes(req.body.type)\n || !activityFields.every(field => req.body.hasOwnProperty(field)));\n}", "function validateFormulaBody(req, res, next){\n const bodyConte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a label for the current MIDI track.
labelCurrentTrack() { let labl = 'empty'; if (this.trks[tpos].usedInstruments.length === 1) { if (this.trks[tpos].hasPercussion) { labl = 'Percussion'; } else { labl = getInstrumentLabel(this.trks[tpos].usedInstruments[0]); } } else if (this.trks[tpos].usedInstruments.length > 1) { labl = 'Mix...
[ "function crearLabel(id) {\n let label = document.createElement(\"LABEL\");\n label.setAttribute(\"for\", id);\n label.innerHTML = id;\n return label;\n\n}", "function TLabel(){}", "getLabel() { return this.labelP.innerText; }", "function generateLabel(myCongestionProject) {\r\n var total_fundi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepend a child to an element.
function prependChild(elem, child) { removeElement(child); child.parent = elem; child.prev = null; if (elem.children.unshift(child) !== 1) { var sibling = elem.children[1]; sibling.prev = child; child.next = sibling; } else { child.next = null; } }
[ "_insertAsFirstChild(element, referenceElement) {\n referenceElement.parentElement.insertBefore(element, referenceElement);\n // bump up element above nodes which are not element nodes (if any)\n while (element.previousSibling) {\n element.parentElement.insertBefore(element, element.previousSibling);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compose the data into training set. Making tuples of data and label.
function getTrainingSet(dtm, label){ var i; var tuple; var result = []; for(i = 0; i < dtm.length; i++){ tuple = [dtm[i], label[i]]; result.push(tuple); } eventEmitter.emit('trainingSet', result); }
[ "function prepareData(){\n testData = toDataFormat(Array.from(testData));\n trainData = toDataFormat(Array.from(tData));\n}", "function prepareData(category, data) {\n category.training = [];\n category.testing = [];\n for(let n = 0; n < 1000; n++) {\n let offset = n * len;\n if(n < training_amount...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if `node` is a text node.
function text(node) { return node && node.type === 'text' }
[ "function containsOnlyText(node, checkChildren) {\n\t\t\tif (typeof node !== 'object') {\n\t\t\t\tthrow \"containsOnlyText: Expected argument node of type object, \" + typeof node + \" given.\";\n\t\t\t}\n\n\t\t\tcheckChildren = checkChildren || false;\n\n\t\t\tvar result = false,\n\t\t\t\tnodeTmp = null;\n\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shows the parking leave form. Hides the parking entry form. Clears messages.
function showLeaveForm (){ $scope.booleanLeaveForm = true; $scope.booleanEnterForm = false; $scope.message = ''; }
[ "function exitSubscribeForm() {\n $('.subscribe-overlay').hide();\n $('.subscribe-form').css('top', '28%');\n $('.subscribe-form').hide();\n }", "function showLosses() {\n $(\"#losses\").text(losses);\n }", "function clearAndHideForm() {\n clearForm();\n hideForm();\n}", "function hide...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create element with all selected schools buttons
createSelectedSchools(){ let selectedSchools = [] for(let i = 0; i < this.state.school.length; i++){ selectedSchools.push(<p className="RemoveSchool">{this.state.school[i]}<button type="button" className="ButtonRemove" value={"schoolselect" + this.state.school[i]} onClick={(e) => this.rem...
[ "function dl_buttons() {\r\n\t// button for each story\r\n\tfor (var set of set_list.sets) {\r\n\t\tvar set_i = set_list.sets.indexOf(set);\r\n\t\tvar set_ele = gcl(\"set\")[set_i];\r\n\t\tfor (var story of set) {\r\n\t\t\tvar story_i = set.indexOf(story);\r\n\t\t\t// story text button\r\n\t\t\tvar button = documen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Throws an error when a search term is missing.
function _noSearchTermError() { throw new Error('A search term is required, for example "javascript"'); }
[ "function displayError() {\r\n alert(\"Search term cannot be empty\");\r\n }", "function subtest_shows_error_on_empty_suggest_from_name(w) {\n wait_for_provider_list_loaded(w);\n wait_for_search_ready(w);\n\n type_in_search_name(w, \"Maggie Robbins\");\n\n // Do the search.\n w.click(w.eid(\"search...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draws a sphere from the sphere buffer
function drawSphere() { gl.bindBuffer(gl.ARRAY_BUFFER, sphereVertexPositionBuffer); gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, sphereVertexPositionBuffer.itemSize, gl.FLOAT, false, 0, 0); // Bind normal buffer gl.bindBuffer(gl.ARRAY_BUFFER, sphereVertexNormalBuffe...
[ "function makeSphere(ctx, radius, lats, longs)\n{\n var geometryData = [ ];\n var normalData = [ ];\n var texCoordData = [ ];\n var indexData = [ ];\n\n for (var latNumber = 0; latNumber <= lats; ++latNumber) {\n for (var longNumber = 0; longNumber <= longs; ++longNumber) {\n var th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcion auxiliar para cargar foto de perfil
function cargarFotoPerfil() { let fotoPostulante = document.getElementById("fotoPostulante"); if (postulante.foto) fotoPostulante.src = "../fotos_perfil/" + postulante.foto; else fotoPostulante.src = "../fotos_perfil/no_image.png"; }
[ "function pasarFoto() {\r\n if(posicionActual >= IMAGENES.length - 1) {\r\n posicionActual = 0;\r\n } else {\r\n posicionActual++;\r\n }\r\n renderizarImagen();\r\n }", "function actualizarFoto() {\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to make the facial features of No face Makes a bezier surface of the mask and we will use it as a basis for other facial features
function makeNoFaceMask(facialFeatureColor){ var noFaceMaskGeom = new THREE.BezierSurfaceGeometry( noFaceMaskPoints.reverse(), 8, 8 ); var noFaceMaskMat = new THREE.MeshPhongMaterial( { color: facialFeatureColor, ambient: facialFeatureColor, ...
[ "function face() {\n noFill();\n stroke('white'); strokeWeight(10);\n var face = triangle(300, 100, 100, 500, 500, 500);\n var cheekl = ellipse(150, 400, 50, 10);\n var cheek2 = ellipse(450, 400, 50, 10);\n}", "function drawFeaturePoints(canvas, img, face) {\n // Obtain a 2D context object to draw on the ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the pandoc tool is available
function __pandocAvailable(cb) { var test = spawn('pandoc', ['--help']); test.on('error', function() { console.error('Pandoc not found'); cb('Pandoc not found'); }); test.on('exit', function() { cb(null); }); test.stdin.end(); }
[ "function IsToolbarInstalled(strCTID) {\n var oToolbar = new TPI.Toolbar(strCTID);\n var oRes = oToolbar.IsVisible();\n return oRes.returnValue;\n }", "hasDocstring(line){\n if (typeof line == 'undefined'){ return false;}\n return line.indexOf('*/')>=0\n}", "function checkTools() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an existing ReplicationGroup resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
static get(name, id, state, opts) { return new ReplicationGroup(name, state, Object.assign(Object.assign({}, opts), { id: id })); }
[ "static get(name, id, state, opts) {\n return new ReplicationInstance(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }", "getGroup (id) {\n assert.equal(typeof id, 'number', 'id must be number')\n return this._apiRequest(`/group/${id}`)\n }", "static get(name, id, state, op...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the path against the registered history manager
setPath(path) { this._history.set(path); }
[ "function setWorkerPath(newPath) {\n workerPath = newPath;\n}", "_setHistory(currentRoute) {\n for (let i = 0; i < this.history.length; i++) {\n let previousRoute = this.history[i];\n if (currentRoute.controller === previousRoute.controller &&\n currentRoute.method ===...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Emit code for encoding `val` as a table and assign to a fresh variable (based on the arg name). I use a scratch buffer to compose the encoded table, otherwise I'd have to do a size calculation pass first. I can get away with this only because 1. the encoding procedures are not reentrant; and, 2. I copy the result into ...
function assignTable(a) { var varname = tableVar(a); println( "len = encodeTable(SCRATCH, val, scratchOffset);"); println('var %s = SCRATCH.slice(scratchOffset, scratchOffset + len);', varname); println('scratchOffset += len;'); }
[ "function makeNameTable(names) {\n const t = new table.Table('name', [\n {name: 'format', type: 'USHORT', value: 0},\n {name: 'count', type: 'USHORT', value: names.length},\n {name: 'stringOffset', type: 'USHORT', value: 6 + names.length * 12}\n ]);\n const stringPool = [];\n\n for ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the address of the Breakout Rooms XMPP component.
getComponentAddress() { return this.room.xmpp.breakoutRoomsComponentAddress; }
[ "getMainRoomJid() {\n return this._mainRoomJid;\n }", "get address() {\n if (this.#state !== kSocketDestroyed) {\n try {\n return this.#udpSocket.address();\n } catch (err) {\n if (err.code === 'EBADF') {\n // If there is an EBADF error, the socket is not bound.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the date pane.
_updateDatePane() { var DateChooser = qx.ui.control.DateChooser; var today = new Date(); var todayYear = today.getFullYear(); var todayMonth = today.getMonth(); var todayDayOfMonth = today.getDate(); var selDate = this.getValue(); var selYear = selDate == null ? -1 : selDate....
[ "function updateModalDate() {\n\tvar date = document.getElementById('date');\n\tdate.value = todaysDate(activeDate);\n}", "function update_date() {\n for(let span of query_all('.date')) {\n\tspan.textContent = format_date(span.dataset.ts);\n }\n for(let mark of query_all('.edited_mark')) {\n\tmark.title ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
display_from_JSON() [Description]function to display the conf [inputs] frame : [jQuery]YES
function display_from_JSON() { // get html element concerned $conf_to_display = $('#conf_to_display'); //clear the current content of the select $conf_to_display.html(''); jsonStr = JSON.stringify(flowplayer_conf), // THE OBJECT STRINGIFIED regeStr = '', // A EMPTY STRING TO EVENTUALLY HOLD THE FORMATTED STR...
[ "function showJson() {\n var strJsonExes = JSON.stringify(jsonExes);\n document.querySelector('pre').innerHTML = strJsonExes;\n btn = document.getElementById('show-json')\n showOrHideElement(btn);\n}", "function JSONViewer (value) {\n this.value = value;\n}", "function mostrarObjetos(json){\n var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dynamically load plugin scripts Dynamically load Fullcalendar Plugin Script homepage: require moment.js
function LoadCalendarScript(callback){ function LoadFullCalendarScript(){ if(!$.fn.fullCalendar){ $.getScript('/hiapt/resources/fullcalendar/fullcalendar.js', callback); } else { if (callback && typeof(callback) === "function") { callback(); } } } if (!$.fn.moment){ $.getScript('/hiapt/resourc...
[ "function DrawFullCalendar(){\nLoadCalendarScript(DrawCalendar);\n}", "function loadMomentLocaleBundle() {\n var path,\n deferred = $q.defer();\n\n if (!_appLocaleRootPath || _selectedLocale === 'en') {\n moment.locale('en');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
integers_from constructs an infinite stream of integers starting at a given number n Lazy? Yes: The result stream forces the construction of each next element
function integers_from(n) { return pair(n, () => integers_from(n + 1)); }
[ "function build_stream(n, fun) {\n function build(i) {\n return i >= n\n ? null\n : pair(fun(i),\n () => build(i + 1));\n }\n return build(0);\n}", "function findMultiples(int,limit){\n //your code here\n let array = []\n for(i=1; i <= Math.floor(limit/int);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Trigger the logs to be downloaded to the agent's machine in JSON form.
getLogDownload() { this.awsConnect.getLog().download(); }
[ "function loadLog(){\n $(\".page\").css(\"display\", \"none\");\n $(\"#logs\").css(\"display\", \"block\");\n\n $(\"#logs\").html('<i class=\"fa fa-spinner fa-pulse fa-3x fa-fw center\"></i>');\n\n // Initially load the log with the most recent entries first\n sendMessage(\"agent/log/true\", \"\", \"post\",\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assembles the message from a single commit payload
function get_msg(commit) { var msg = commit.author.name + " <" + commit.author.email + ">\n"; msg += commit.url + "\n\n" + commit.message + "\n\n"; commit.added.forEach(function (val) { msg += "A\t" + val + "\n"; }); commit.removed.forEach(function (val) { msg += "D\t" + val + "\n"; }); commit.m...
[ "function formatCommitInfo( line ) {\n // Result is in format e.g. d748d93 1465819027 committer@email.com A commit message\n // First field is the truncated hash; second field is a unix timestamp (seconds\n // since epoch); third field is the committer email; subject is everything after.\n let fields = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new instance of ProxyClient with the provided `options`. The available options are: `rootUrl`: The URL to base all requests on. Must include the protocol (http/https). Defaults to ' `logger`: An optional "bunyanstyle" Logger instance to send logs to. More specifically, this object is expected to have a printf...
function ProxyClient(options) { if (!(this instanceof ProxyClient)) { return new ProxyClient(options); } options = options || {}; this.rootUrl = this.rootUrl || options.rootUrl || 'http://localhost'; this.logger = this.logger || options.logger || sawmill.createMill(this.constructor.name); this.timeout...
[ "constructor(options) {\n // Proxy options\n this.options = Object.assign({\n serverAddress: '127.0.0.1',\n serverPort: 16567,\n // proxyAddress: 'THIS CAN NOT HAVE SENSIBLE DEFAULT',\n socketTimeout: 10000,\n banTimeout: 10 * 60000\n }, op...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a ImageData object with adjusted brightness in relation to the sourceImageData object
function brightnessFilter ( sourceImageData){ //build imageData var returnImageData = ctx.createImageData(canvas.width, canvas.height); var imageDataArray = returnImageData.data; for(var i=0; i < sourceImageData.data.length; i+=4){ imageDataArray[i] = setNewColor(sourceImageData.data[i] + brightnessValue); ...
[ "function contrastFilter ( sourceImageData){\n //calculate contrast factor\n var contrastFactor = (259 * (contrastValue + 255))/(255 * (259 - contrastValue));\n\n //update pixel value\n for(var i=0; i< sourceImageData.data.length; i+=4){\n for(var x=0; x<3; x++){\n sourceImageData.data[i+x] = setNewColo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DEMO Version of a betweenness centrality computed via Johnson's or FloydWarshall algorithm
function betweennessCentrality(graph, directed, sparse) { let paths; var sparse = sparse || false; if (sparse) { paths = $JO.Johnsons(graph)[1]; } else { paths = $FW.changeNextToDirectParents($FW.FloydWarshallAPSP(graph)[1]); } let nodes = graph.getNodes(); //ge...
[ "function solve(w, h, data_array) {\n\tvar k = 0;\n\tvar city_xs = [];\n\tvar city_ys = [];\n\tvar city_is = [];\n\tfor (var y = 0; y < h; ++y) {\n\t\tfor (var x = 0; x <= w; ++x) {\n\t\t\tconst i = x + y * (w+1);\n\t\t\tif (data_array[i] == 1) {\n\t\t\t\t++k;\n\t\t\t\tcity_xs.push(x);\n\t\t\t\tcity_ys.push(y);\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stores url and lastlog w/ line number to compare w/ new log data If the new logdata has same number of lines & same last line, then there is no update If the new log data has more lines, then we'll only process the newer ones.
function processLogData(data, url) { data = data.trim(); if(data == "") { data = "-- no data --"; } data = data.split('\n'); var obj = $scope.urlAndLogsHash[url]; if (!obj) { $scope.urlAndLogsHash[url] = {previousLength: data.length, lastLineTxt: ...
[ "function _log_change()\n\t\t{\n\t\t\tvar clone = data.valueCloned;\n\t\t\tvar timestamp = EZ.format.time('@ ms');\n\t\t\t//\ttimestamp = EZ.format.dateTime(data.timestamp,'@ ms');\n\n\t\t\tlogInfo.iconTitle = 'full compare via winmerge with last displayed value';\n\t\t\tlogInfo.summaryClass = 'summary';\n\t\t\tvar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checkTotal checks the total of player's hands. Ensures they're less than 10.
checkTotal(hand){ if(hand.total >= 10){ hand.total -= 10; } }
[ "function busted(hand) {\n if (getTotal(hand) > MAX_VALUE) {\n return true;\n } else {\n return false;\n }\n}", "function updateTotal(playerTotal, playerHand) {\n playerTotal = getTotal(playerHand);\n return playerTotal;\n}", "function bestTotal(hand) {\n aces = 0;\n total = 0;\n hand.forEach(func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Internal compiletimeonly representation of a `CdkDropList`. Used to avoid circular import issues between the `CdkDropList` and the `CdkDrag`.
function CdkDropListInternal() { }
[ "function dragItem(event){\n draggedItem = whereInLists(event.target);\n draggedItem.list = document.getElementById(draggedItem.list);\n\tevent.dataTransfer.setData('text/html', event.target);\n\tevent.dataTransfer.dropEffect = 'move';\n}", "function DragDropConfig() { }", "function ELEMENT_LIST$static_(){Lin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
put dataset, new or merge on id
function dataset_put(ds) { const newds = (ds.id) ? topStack().datasets.map(d => d.id === ds.id ? { ...d, ...ds } : d) : [ ...topStack().datasets, { id: topStack().datasets.length + 1, notes: [], ...ds, } ]; // validate here pushNext({ ...topStack(), datasets: ne...
[ "set(id, data) {\n let oldData = this.raw();\n oldData[id] = data;\n this._write(oldData);\n }", "function table_put(dsid, tb) {\n const fixid = a => a ? a.map((row, x) => ({ ...row, id: x+1, })) : [];\n\n const newtb = (tb.id) \n ? topStack().tables.map(t => t.id === tb.id ? { ...t, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
smoothScrollTo helper to smooth scroll to element on page
smoothScrollTo( scrollToElement ) { if( scrollToElement.length < 1 ) { return; } const new_position = scrollToElement.offset(); $('html, body').stop().animate({ scrollTop: new_position.top }, 500); }
[ "function moveToPageElemnt(element) {\n $('body, html').animate({ scrollTop: $(element).offset().top }, 600);\n}", "function initSmoothScroll () {\n var scroll = new SmoothScroll();\n\n var smoothScrollWithoutHash = function (selector, settings) {\n \tvar clickHandler = function (event) {\n \t\tvar toggle = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true or false if the provided story should be skipped by matching against include and exclude filter options. If any global filters are provided, they will override story filters.
function shouldSkipStory(name, options, config) { let matches = regexp => { /* istanbul ignore else: sanity check */ if (typeof regexp === 'string') { let [, parsed, flags] = /^\/(.+)\/(\w+)?$/.exec(regexp) || []; regexp = new RegExp(parsed ?? regexp, flags); } return regexp?.test?.(name)...
[ "exclude(resource, context){\n return this.excludeFn ? this.excludeFn(resource, context) : false;\n }", "shouldBeIgnored() {\n if (!this.json_.tag_)\n return false;\n\n var tag = this.json_.tag_;\n if (!tag.startsWith(\"autogenerated:\"))\n return false;\n\n if (tag == \"autogenerated:ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: delete_search_query Desc: Open IndexedDB, find search query based on query and call delete on it
function delete_search_query(query, $q) { var q = $q.defer(); var request = twitter_search_queries_db.transaction(["twitter_search_queries"], "readwrite") .objectStore("twitter_search_queries") .delete(query); request.onsuccess = function(event) { // It's gone! q.resolve(...
[ "function delete_tweets_by_search_id($q, query, search_id) {\n\tvar q \t \t\t\t= $q.defer();\n\tvar index \t\t\t= tweets_db.transaction([\"tweets\"], \"readwrite\").objectStore(\"tweets\").index(\"query, search_id, status_id\");\n\tvar boundedKeyRange = IDBKeyRange.bound([query, search_id, 0], [query, search_id, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the distance reached after a 1 unit step in the direction of theta.
function calculateDistance(d, theta) { return Math.sqrt(1 + Math.pow(d, 2) - 2 * d * Math.cos(theta)); }
[ "function findAngle(object, unit, directions) {\n// var dy = (object.y) - (unit.y);\n// var dx = (object.x) - (unit.x);\n var direction;\n if (object.x > unit.x) {\n if (object.y > unit.y) {\n direction = 3;\n } else if (object.y < unit.y) {\n direction = 1;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
expand from itemname to itemname and the list of revisions
function getRevisionReducer(org) { return (promise, itemname) => promise .then( accumulator => org.proxies.get({ name: itemname }) .then( ({revision}) => { if (opt.options.latestrevisionnumber) { revision = [revision.pop()]; ...
[ "function doExpand() {\n _result = expand(_specs);\n}", "visitEdition_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function createItem(revision) {\n\n var block = $('<div></div>').attr('class', 'commit-item2');\n var actions = $('<div></div>');\n\n var title = $('<div></div>')\n .te...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse the file name to grab order and job number. Find the job path on the server with that info.
function getJobPathFromName(job) { var jobData = loadJobData(job); var fileName = jobData.fileName; var unGroupName = jobData.unGroupName; if (unGroupName){ fileName = unGroupName; } var parsedJobName = fileName.split("-"); var order = parsedJobName[0]; var jobNumber = parsedJobName[1]; var flow...
[ "morawareJobID() {\n let reg = /(?<=mw-job-id: )\\d*/\n let jobID = this.msg.match(reg)[0]\n return jobID\n }", "function parsePath(str) {\n var cutpos = str && str.length? str.lastIndexOf('/'):0;\n // console.log('parsePath.cutpos', cutpos)\n //-- verify this switch! (Orion)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the leaves for a text node given decorations.
decorations(node, decorations) { var leaves = [_objectSpread$4({}, node)]; for (var dec of decorations) { var rest = _objectWithoutProperties(dec, ["anchor", "focus"]); var [start, end] = Range.edges(dec); var next = []; var o = 0; for (var leaf of leaves) { var { ...
[ "decorations(node, decorations) {\n var leaves = [_objectSpread$5({}, node)];\n\n for (var dec of decorations) {\n var rest = _objectWithoutProperties(dec, [\"anchor\", \"focus\"]);\n\n var [start, end] = Range.edges(dec);\n var next = [];\n var o = 0;\n\n for (var leaf ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A feed can contain an extra content.
function FeedExtra(props) { var children = props.children, className = props.className, content = props.content, images = props.images, text = props.text; var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(images, 'images'), (0, _lib.useKeyOnly)(content || text, 'text'), ...
[ "function FeedExtra(props) {\n const { children,\n className,\n content,\n images,\n text,\n } = props\n\n const classes = cx(\n useKeyOnly(images, 'images'),\n useKeyOnly(content || text, 'text'),\n 'extra',\n className,\n )\n const rest = getUnhandledProps(FeedExtra, props)\n const E...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
private method optgroupTemplate returns the li's for optgrooup html template
function optgroupTemplate(label, o){ var $tpl="<li class='"+o.prefix+"group'>"; $tpl+=label; $tpl+="</li>"; return $tpl; }
[ "createSelectGroup() {\n let items = [];\n this.state.groups_list.forEach((T) => {\n items.push(<option key={T.group_id} value={T.group_id}>{T.title}</option>);\n })\n return items;\n }", "function GenerateOptionsandList() {\n var optn = '';\n var li = '';\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that returns the license section of README If there is no license, return an empty string
function renderLicenseSection(license) { var licenseLink = renderLicenseLink(license); if (license === 'MIT' || 'Apache' || 'GPLv2') { return ('Licensed under the ' + licenseLink) } else if (license === 'none') { return ('') } }
[ "function output_license_html ()\n {\n\t\tvar output = get_comment_code() + '<a rel=\"license\" href=\"' + license_array['url'] + '\"><img alt=\"Creative Commons License\" border=\"0\" src=\"' + license_array['img'] + '\" class=\"cc-button\"/></a><div class=\"cc-info\">' + license_array['text'] + '</div>';\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Click listener for submission delete button on user's own submission
function deleteClickListener() { $('.container').on('click', '.delete-submission', event => { event.stopImmediatePropagation(); const submission = $(event.currentTarget) .parents('.submission-thumb') .prop('id'); if ( confirm( 'Are you sure that you would like to permanently remove this sub...
[ "function entryDeleteHandler(evt, repo){\n const form = document.getElementById('entry-edit-form');\n const entryIndex = form.getAttribute('data-entryIndex');\n repo.deleteEntry(entryIndex);\n alertSave();\n document.getElementById('entry-edit-div').style.display = 'none';\n}", "delete(event) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
define get value of timeOut
getTimeout(){cov_50nz68pmo.f[2]++;cov_50nz68pmo.s[6]++;return this.timeout;}
[ "function getTimeout(timeout) {\n if (!isFinite(timeout) || !util.isPositiveNumber(timeout)) {\n timeout = 0;\n }\n \n return timeout;\n }", "ms () { return this.now() - this.startMS }", "async getIcmpOutTimeExcds()\n {\n return Promise.resolve()\n .then(() => ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if bucket has reached limit, sort wishList
checkBucket(){ if(this.bucketTotal >= this.bucketLimit){ console.log("Yay! The bucket limit has been reached.") let sortedWishList = this.rankWishes() this.fillBucket(sortedWishList) } else { console.log("Bucket is not full yet – more donations are needed....
[ "rankWishes(){\n let sortedWishList = this.wishList\n sortedWishList.sort(function(a, b){return b.votes - a.votes})\n return sortedWishList \n }", "function sortAndLimit(input){\n const result = input.sort((countA, countB) => countA.count < countB.count ? 1: -1).slice(0,5);\n return resu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2. You can also filter using Reduce. We want to find the sum of all user's followers from the UK. Write a reducer function sumAllFollowersFromTheUK which does this and uncomment the console.log to test it.
function sumAllFollowersFromTheUK(accumulator, currentValue) { // Write your code here }
[ "function mapFilterAndReduce(arr){\n return arr.map(val => val.firstName).filter(val => val.length < 5).reduce((acc,next) => \n\t{acc[next] = next.length;\n\treturn acc;}, {})\n}", "function directorsAgeSum() {\n return _.sumBy(getUsersByDirector(true), 'age');\n}", "function getSummedAge(people) {\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disambiguating between a `for` and a `for`/`in` or `for`/`of` loop is nontrivial. Basically, we have to parse the init `var` statement or expression, disallowing the `in` operator (see the second parameter to `parseExpression`), and then check whether the next token is `in` or `of`. When there is no init part (semicolo...
function parseForStatement(node) { next(); labels.push(loopLabel); expect(_parenL); if (tokType === _semi) return parseFor(node, null); if (tokType === _var || tokType === _let) { var init = startNode(), varKind = tokType.keyword, isLet = tokType === _let; next(); parseVar(init, tr...
[ "ForStatement() {\n this._eat(\"for\");\n this._eat(\"(\");\n\n const init = this._lookahead.type !== \";\" ? this.ForStatementInit() : null;\n this._eat(\";\");\n const test = this._lookahead.type !== \";\" ? this.Expression() : null;\n this._eat(\";\");\n\n const update = this._lookahead.type...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runtime helper for rendering static trees.
function renderStatic(index,isInFor){var cached=this._staticTrees||(this._staticTrees=[]);var tree=cached[index];// if has already-rendered static tree and not inside v-for, // we can reuse the same tree. if(tree&&!isInFor){return tree;}// otherwise, render a fresh tree. tree=cached[index]=this.$options.staticRenderFns...
[ "function _hydrateAndRenderExternalTemplates() {\n const header = new Header(\n './../../../templates/includes/header.jsr'\n );\n const footer = new Footer(\n './../../../templates/includes/footer.jsr'\n );\n const breadcrumb = new BreadCrumb(\n ['Hub', 'Mathématiques', 'PGCD'], ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CODING CHALLENGE 265 Write a function that returns the first n vowels of a string. Return "invalid" if the n exceeds the number of vowels in a string. Vowels are: a, e, i, o, u
function firstNVowels(s, n) { const x = s.match(/[aeiou]/gi).join('').slice(0, n); return n > x.length ? 'invalid' : x; }
[ "function solve(s) {\n\tlet result = \"\";\n\tlet regex = /[aeiou]/;\n\tlet consonants = s\n\t\t.split(\"\")\n\t\t.filter(char => {\n\t\t\treturn !regex.test(char);\n\t\t})\n\t\t.sort((a, b) => {\n\t\t\treturn a.charCodeAt(0) - b.charCodeAt(0);\n\t\t});\n\tlet vowels = s\n\t\t.split(\"\")\n\t\t.filter(char => {\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Functions to support On first mouseover of plate, set up variables needed for selecting
function pwPlateSelector_plateOnMouseOut(plate){ //empty function }
[ "function pwPlateSelector_initPlate(plate){\r\n $(plate).currentSelection={ startY:-1, endY:-1, startX:-1, endX:-1 }\r\n plate.isDragging=false;\r\n var rowNum=0;\r\n var colNum=0;\r\n var rows=plate.select(\"tr.wells\");\r\n rows.each(function(row){\r\n \tvar wells=row.select(\"td.well\");\r\n \twells.each...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a list of columns which hold multiple IDs, breaks them into an array
cellToArray(dt, columns, splitExpr) { if (splitExpr === undefined) splitExpr = /\b\s+/; let j; dt.forEach((p) => { p = p.data; columns.forEach((column) => { let list = p[column]; if (list === null) return; if (typeof list === 'number') { p[colu...
[ "function convert_row_ids(rows)\r\n{\r\n\r\n\t// change grid ids to data ids\r\n\tvar row_ids = [];\r\n\tfor (var i = 0; i < rows.length; i++) {\r\n\t\tvar item = data_view.getItem(rows[i]);\r\n\t\trow_ids.push(item[item.length-2]);\r\n\t}\r\n\r\n\treturn row_ids;\r\n\r\n}", "static serializeColumns(list) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserwrite_clause.
visitWrite_clause(ctx) { return this.visitChildren(ctx); }
[ "visitData_manipulation_language_statements(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function parse_StatementList(){\n\t\n\n\t\n\n\tvar tempDesc = tokenstreamCOPY[parseCounter][0]; //check desc of token\n\tvar tempType = tokenstreamCOPY[parseCounter][1]; //check type of token\n\n\tif (tempDesc == ' pri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Property is to get whether the browser has touch support.
static get isTouch() { if (isUndefined(window.browserDetails.isTouch)) { return (window.browserDetails.isTouch = ('ontouchstart' in window.navigator) || (window && window.navigator && (window.navigator.maxTouchPoints...
[ "get isTouch()\n {\n return \"ontouchstart\" in window;\n }", "function useTouch() {\n return isNativeApp() || $.browser.mobile || navigator.userAgent.match(/iPad/i) != null;\n}", "function deviceHasTouchScreen() {\n let hasTouchScreen = false;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds the .tagsbtn__selected class to a given tag to indicate it as being selected
function indicateSelectedTag(tag) { clearSelectedTags(); tag.classList.add("tags-btn__selected"); }
[ "function markSelected(btn) {\n if (lastRowSelected != null)\n lastRowSelected.classList.remove(\"selected\");// remove the last row selected(last row = DOM element)\n let row = (btn.parentNode).parentNode; // button is in TD which is in Row\n row.className = 'selected'; // mark as selected\n las...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsermodify_col_substitutable.
visitModify_col_substitutable(ctx) { return this.visitChildren(ctx); }
[ "visitSubstitutable_column_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitModify_mv_column_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitModify_column_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitAdd_modify_drop_column_clauses(ctx) {\n\t return this.visi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints a hint about valid filter restrictions
function printFilterRestrictionHint () { console.log(' The "restriction" field is used to determine the type of filter. Possible values for restriction are:') console.log(' "after" - Filters by date') console.log(' filter.path must lead to a date string') console.log(' filter.value must be a numbe...
[ "generateFilterText() {\r\n let filterText = '';\r\n let { CONTROLS } = this.props.strings;\r\n let { display, activityStatus, species, breed, speciesType, maturity, gender, category,\r\n enclosure, livestockOrigin, financierOwned, dropBirthYear, ltStatus, euStatus } = this.filter;\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draws a black and white grid based on the state of the GOL object
function drawGrid() { for(var i = 0; i < nRows; i++) { for(var j = 0; j < nCols; j++) { if(gol.getCell(i, j) == 1) gridCtx.fillStyle = "white"; else gridCtx.fillStyle = "black"; gridCtx.fillRect(j * cellWidth + 1, i * cellHeight + 1, cellWidth - 2, cellHeight - 2); } } //console.log(gol...
[ "paintFrame() {\n for (let rowIterator = 0; rowIterator < this.gridState.length; rowIterator++) {\n for (let columnIterator = 0; columnIterator < this.columns; columnIterator++) {\n const cellState = Math.pow(2, columnIterator) & this.gridState[rowIterator]\n this.paintBrick(rowIterator, this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
locate the pacman randomaly on empty cell on the canvas. if shape.i/j is not undefined, remove the pacman from shape.i/j and locate him in a new cell.
function randomLocatePacman(){ if (shape.i != undefined && shape.j != undefined){ board[shape.i][shape.j] = 0; } let pacmanCell = findRandomEmptyCell(board); board[pacmanCell[0]][pacmanCell[1]] = 2; shape.i = pacmanCell[0]; shape.j = pacmanCell[1]; }
[ "genPosition(max_x, max_y, seg) {\r\n //make sure if there's still space for the fruit on the map.\r\n if (seg.length < (max_x + 1)*(max_y+1)) {\r\n //if there is still space choosing the random position on x and y from 0 to max width 'x' and max height 'y'\r\n let pos = {x: Math...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the string version of a networkId. Should be static.
mapNetworkString(networkId) { switch (networkId) { case 1: return "Mainnet"; case 2: return "Morden"; case 3: return "Ropsten"; case 4: return "Rinkeby"; case 42: return "Kovan"; default: return "Unknown Network (ID " + networkId + ")"; } }
[ "async getChainId(network){}", "function getNetworkName(chainId) {\n if (chainId === CHAIN_ID_MAINNET_ETHEREUM) {\n return \"Mainnet - Ethereum\"\n } else if (chainId === CHAIN_ID_TESTNET_GOERLI) {\n return \"Testnet - Goerli\"\n } else if (chainId === CHAIN_ID_MAINNET_POLYGON) {\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Listener for show gridlines checkbox clicks. Toggles whether or not to draw the display unit grid lines.
function onCheckboxGridLinesClicked(e) { DisplayCanvas.drawGridLines = ViewController.checkboxGridLines.checked; }
[ "function toggleGridLines() {\n drawLines = !drawLines;\n draw();\n }", "showGrid(){\n this.Grid = true;\n this.Line = false\n \n }", "function groupLineToggle() {\n groupLines *= -1;\n\tdrawBoard();\n}", "function on_check_xz_grid() {\n\n var show_xz_grid = docu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fonction constructeur de l'objet Gendarme
function Gendarme(id) { this.index = id; this.cible = 0; // --------- association du corps avec son image html via le noeud enfant "id" du div page this.corps = document.getElementById("page").children[id]; this.corps.style.zIndex = id; // --------- association des éléments du corps ...
[ "constructor (dia = 1, mes = 1,ano = 1970){\n this.dia = dia\n this.mes = mes\n this.ano = ano\n }", "constructor(title,days,time,duration,relative_time,relative_to,till,relative_to_till)\r\n {\r\n this.m_start = '' //moment object for start time\r\n this.title = title;\r\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Periods of the day (e.g. `[AM, PM]` for enUS).
function getLocaleDayPeriods(locale, formStyle, width) { var data = findLocaleData(locale); var amPmData = [data[1 /* DayPeriodsFormat */], data[2 /* DayPeriodsStandalone */]]; var amPm = getLastDefinedValue(amPmData, formStyle); return getLastDefinedValue(amPm, width); }
[ "function updatePeriods(){\n var periods;\n\n /* 726: Set the period to hourly for ww3 dataset and hide the monthly option as it is not available for surface map. */\n if (ocean.datasetid == 'ww3'){\n if (ocean.plottype == 'histogram'){\n periods = {\"monthly\": ocean.variables[ocean.vari...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Public function `boolean`. Returns true if `data` is a boolean value, false otherwise.
function boolean (data) { return data === false || data === true; }
[ "static toBoolean(value) {\n if (typeof value === \"boolean\")\n return value;\n if (typeof value === \"string\")\n return value === \"true\" || value === \"1\";\n if (typeof value === \"number\")\n return value > 0;\n return false;\n }", "castToBool...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserxmlroot_param_version_part.
visitXmlroot_param_version_part(ctx) { return this.visitChildren(ctx); }
[ "visitXmlserialize_param_version_part(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitXmlroot_param_standalone_part(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitXmlserialize_param_ident_part(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitParameter_spec(ctx) {\n\t return this.vi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a mapping to the top event in the given branch. If this maps away all the changes and effects in that item, drop it and propagate the mapping to the next item.
function addMappingToBranch(branch, mapping) { if (!branch.length) return branch let length = branch.length, selections = dist_none while (length) { let event = mapEvent(branch[length - 1], mapping, selections) if ((event.changes && !event.changes.empty) || event.effects.length...
[ "function addMappingToBranch(branch, mapping) {\n if (!branch.length)\n return branch;\n let length = branch.length, selections = none$5;\n while (length) {\n let event = mapEvent(branch[length - 1], mapping, selections);\n if (event.changes && !event.changes.empty || event...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update polygonal layer opacity
function updateOverlayLayersOpacity(value) { geojsonCCAA.setStyle({ fillOpacity: value / 100 }); geojsonProvincias.setStyle({ fillOpacity: value / 100 }); geojsonZonas.setStyle({ fillOpacity: value / 100 }); }
[ "function updateBaseLayersOpacity(value) {\r\n\tif (map.hasLayer(OpenStreetMap_Mapnik)) {\r\n\t\tOpenStreetMap_Mapnik.setOpacity(value / 100);\r\n\t};\r\n\tif (map.hasLayer(Stamen_Watercolor)) {\r\n\t\tStamen_Watercolor.setOpacity(value / 100);\r\n\t};\r\n\tif (map.hasLayer(OpenTopoMap)) {\r\n\t\tOpenTopoMap.setOpa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to load all TopAchivars records
function loadRecords() { var promiseGet = manageAgencyRepository.getAllagency() promiseGet.then(function (pl) { $scope.AllAgency = pl.data }, function (errorPl) { $log.error('failure loading Topachivars', errorPl); });...
[ "function getAthletes() {\n // get athletes owned by logged in user\n console.log(\"In getAthletes, OwnerId:\", OwnerId);\n $.get(\"/api/athletes/team/\"+OwnerId, function(data) {\n initializeRows(data);\n });\n // get unowned athletes\n $.get(\"/api/athletes/team/1\", function(data) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: LMSInitialize() Parameter: None Return: true indicating that the LMSInitialize("") was successful, false otherwise. Description: This function indicates to the LMS API Adapter that the SCO is going to communicate with the LMS. It is a requirement of the SCO that it call this function before calling any other ...
function LMSInitialize() { var strResult = strCMIFalse if (objAPI != null){ strResult = objAPI.LMSInitialize(strEmptyString) if(strResult == strCMITrue){ return true; } else{ handleSCORMError(); return false; } } else{ handleSCORMError(); return false; } }
[ "function doLMSInitialize()\n{ \n var api = getAPIHandle();\n if (api == null)\n {\n messageAlert(\"Unable to locate the LMS's API Implementation.\\nLMSInitialize was not successful.\");\n return \"false\";\n }\n\n var result = api.LMSInitialize(\"\");\n\n if (result.toString() != \"true\")\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility methods Defines a property using a getter and setter in order to trigger a change handler without using `$watch` to observe changes.
function defineProperty (key, handler, value) { Object.defineProperty(ctrl, key, { get: function () { return value; }, set: function (newValue) { var oldValue = value; value = newValue; handler && handler(newValue, oldValue); } }); }
[ "set value(_) {\n throw \"Cannot set computed property\";\n }", "function propertyChangeHandler(scope, element, key, newVal, oldVal) {\n var dataSet = scope.dataset || scope.scopedataset,\n isBoundToServiceVariable;\n /*Checking if widget is bound to service variable...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
e.g. "foreign key (faith) references religion(id)"
function column2foreignKeyTableClause(column) { if (!('foreignKey' in column)) { throw Error(`column passed to column2foreignKeyTableClause must ` + `have a foreignKey property`); } const keyColumn = quoteName(column.name); const foreignTable = quoteName(column.foreignKey.table); ...
[ "async getForeignKeys() {\n\n }", "visitForeign_key_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "createAssociations(typeScript) {\r\n let strBelongs = \"\";\r\n let strBelongsToMany = \"\";\r\n const rels = this.relations;\r\n rels.forEach(rel => {\r\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handle photo sharing request
function photoShareRequest(userId,room){ var photoRequested ={}; photoRequested.request="sent"; photoRequested.status=true; photoRequested.questionAsked=true; photoRequested.user=userId; photoRequested.room=room; Socket.emit("photoRequest",photoRequested); }
[ "function shareMedia( _type, _blob, _blob2 )\n{\n\tvar title = $('#input-title').val()\n\tvar description = $('#input-description').val()\n\tvar author = $('#input-author').val()\n\tvar website = $('#input-website').val()\n\tvar timestamp = new Date().getTime()\n\tvar extension = ''\n\tvar xhr = new XMLHttpRequest(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method function to clear HTML to display new chart
function clearHtml() { $("#searchChart").remove(); }
[ "function clearChart() {\r\n\td3.select('#chartDiv').selectAll('svg').remove();\r\n}", "clear() {\n // Wipe out the DOM content.\n for (let [, containerElem] of this._containerHtmlElems) {\n $(containerElem).empty();\n }\n // Clear the data structures.\n this._containerHtmlElems.cl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOTE: After this GET, should have an array on DOM NOTE: Delete Business
function deleteBusiness(businessid) { console.log('deleteBusiness = ', deleteBusiness); $http({ method: 'DELETE', url: '/business/delete' + businessid // NOTE: changing path resulted with this error: DELETE http://localhost:5500/mainPage/deleteMustMatc26 404 (Not Found) }).then(function(response...
[ "function deleteLead(leadId) {\n $.ajax({\n url: '/lead/' + leadId + '/delete-json',\n contentType: 'application/json; charset=utf-8',\n dataType: 'json',\n data: JSON.stringify({leadId}),\n type: 'POST',\n success: ((res) => {\n // Replace follow button with ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate a percent encoded query string from the supplied options.
function genQueryString (options) { if ( !options.queryParams ) { return ""; } log(options.verbose,"Now generating query string value ..."); var queryStringParams = []; Object.keys(options.queryParams).forEach(function (key) { queryStringParams.push(createEncodedParam(key,options...
[ "function _buildUrlHelper(options) {\n let limit = options && options.limit ? options.limit : DEFAULT_LIMIT;\n let offset =\n options && options.page > 0\n ? (options.page - 1) * PAGE_SIZE\n : DEFAULT_OFFSET;\n\n let uri = URI(window.path);\n uri.addSearch({ limit, offset });\n if (options && opti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
tnhis function draws a basic asteroid the context, radius, shape (an array of random numbers), options
function draw_asteroid(ctx, radius, shape, options) { options = options || {}; ctx.strokeStyle = options.stroke || "white"; ctx.fillStyle = options.fill || "black"; ctx.lineWidth = options.lineWidth || 1; if (options.noise === undefined) { options.noise = 0.4; } ctx.save(); ctx.b...
[ "function newAsteroid(x, y, r) {\n var asteroid = {\n x: x,\n y: y, \n velx: Math.random() > 0 ? Math.random() * ASTR_SPEED / FPS * (Math.random() < 0.5 ? 1 : -1) : 0.5 * ASTR_SPEED / FPS * (Math.random() < 0.5 ? 1 : -1), //asteroid velocity\n vely: Math.random() > 0 ? Math.random() *...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }