query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Saved Channels This grabs the list of saved channels and adds each of them to the page.
function savedChannels() { var savedStreams = localStorage.getItem("streamer"); if (savedStreams !== undefined && savedStreams !== null && savedStreams !== "") { $.each(savedStreams.split(','), function() { singleChannelSubscribe(this); }); } }
[ "function fetchFaveChannels() {\n var list = document.getElementById('channels').getElementsByTagName('ul')[0];\n list.innerHTML = '';\n for (var i = 0; i < channelsList.length; i++) {\n var channel = '&id=' + channelsList[i];\n var url = 'https://www.googleapis.com/youtube/v3/channels?part=s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stage a product by uploading APIs and deploying product
function processStaging(options, result) { result.body = {}; result.body['product'] = result.product; result.body['apis'] = []; for (var prop in result.apis) { // if api is not wsdl type push to result if (result.apis[prop]['x-ibm-configuration'] === undefined || result.apis[prop]['x-ibm-configura...
[ "handleDeploySample() {\n this.setState({ deploying: true });\n const promisedSampleAPI = this.createSampleAPI();\n promisedSampleAPI.then((sampleAPI) => {\n sampleAPI\n .publish()\n .then(() => {\n const message = 'Pet-Store API Publi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the index of the lowest elevation point that is adjacent to the specified index and not in the list of closed indexes. If there are no lower elevations then it will lower the elevation of one of the adjacent indexes.
function getLowestElevationIndex (index, closed, clamp) { let i let lowest = self.map[index].elevation let newindex = index const next = [index - self.size, index + self.size, index - 1, index + 1] // top, bottom, left, right for (i = 0; i < 4; ++i) { if (lowest > self.map[next[i]].elevation ...
[ "function getIndexOfMinDistance(waypoints){\n\tindex = 0;\n\tminDistance = 0;\n\tfor(var i = 0; i < waypoints.length; i++){\n\t\tif(i == 0 || waypoints[i].distance < minDistance){\n\t\t\tminDistance = waypoints[i].distance;\n\t\t\tindex = i;\n\t\t}\n\t}\n\treturn index;\n}", "function getNearestIndex(index, side)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
should be a defined function should return "tru" if "true" and 1 are passed in as arguments should return "" (empty string) if "texas" and 7 are passed in as arguments should return false if "san antonio" and "texas" are passed in as arguments should return "code" if "codeup" and 2 are passed in as arguments should ret...
function reverseSign(num) { if(!isNaN(parseFloat(num))){ return Math.sign(num) * -1; } else return false; }
[ "function reverseSign(num) {\n if(parseInt(num)) {\n return -num;\n }else {\n return false;\n }\n}", "function reverse(bool) {\n if (bool === true) {\n return false;\n } //must be three equals - has to be exact\n if (bool === false) {\n return true;\n } else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete Homework by adID
function deleteHomework(homeworkID) { var url = apiURL + '/homework/' + homeworkID; $.ajax({ url: url, type: 'delete', success: function(data, status) { if (data['message'] == 'Homework deleted successfully.') { $.snackbar({ content: 'Aufgabe erfolgreich gel&ouml;...
[ "async deleteHomeAd({state}, id) {\n try {\n await fb.homesCollection.doc(id).delete();\n alert('Successfully deleted Ad');\n } catch(error) {\n console.log(error);\n }\n }", "function deleteWork(idWork) {\n if (idWork) {\n workDB.remove({ _id: idWork }, function (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a promise for a schemaController.
loadSchema( options: LoadSchemaOptions = { clearCache: false } ): Promise<SchemaController.SchemaController> { if (this.schemaPromise != null) { return this.schemaPromise; } this.schemaPromise = SchemaController.load(this.adapter, options); this.schemaPromise.then( () => delete this.sc...
[ "dGetSchema() {\n // @_GET_\n return new Promise((resolve, reject) => {\n if (this._schema) {\n resolve(this._schema)\n } else {\n reject(new Error('schema missing'))\n }\n })\n }", "loadSchema(\n options: LoadSchemaOptions = { clearCache: false }\n ): Promise<SchemaCont...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate stars in random places
function generatestars() { const geom = new THREE.SphereGeometry(0.2, 24, 24); let rnd = Math.floor(Math.random()*4); let color; if (rnd === 0 || 1) { color = 0xfff4f3; } else if (rnd === 2) { color = 0xc7d8ff; } else { color = 0xffd9b2...
[ "function starGenerator() {\n for(let i=0; i<STAR_AMOUNT; i++){\n randX = round(random(0, width));\n randY = round(random(-height, height));\n randColor = random(starColors);\n randAlph = round(random(1, 254));\n append(starList, [randX, randY, randColor, randAlph, true]);\n }\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the navItem for the specified entity and parentItem
function getNavItemFromEntity(entity, parentItem) { var navItem; if (parentItem) { // find the nav item by parent item navItem = _.find(parentItem.children, function (childItem) { return childItem.item.id === entity.id(); ...
[ "get parentItem() {\n const parentItem = getParentItem(this.rootItem, this.dataPath, true) || null\n return parentItem !== this.item ? parentItem : null\n }", "get parentItem() {\n const item = (\n getParentItem(this.rootItem, this.dataPath, this.nested) ||\n null\n )\n return item !== t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set last move grid color
colorLatestMove(oldGrid, newGrid) { this.clearMoves(); this.baseboard[oldGrid.x][oldGrid.y] = Const.COLOR_LAST_MOVE; this.baseboard[newGrid.x][newGrid.y] = Const.COLOR_LAST_MOVE; this.updateGame(); }
[ "setMovesColor(color, newGrid) {\n\t\tfor (let i = 0; i < this.moves.length; i++) {\n\t\t\tthis.baseboard[this.moves[i].x][this.moves[i].y] = color;\n\t\t}\n\t\tthis.baseboard[newGrid.x][newGrid.y] = color;\n\n\t\tthis.updateGame();\n\t}", "function setGridColor1(data, row, column){\n data.color_history.push(\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds and removes .haserror class to both the form element and the form element's parent depending on the validity of the element and the submitted state of the form
function updateValidationClass(element) { var $element = angular.element(element); var validator_group = 'validator-group' in element.attributes && element.attributes['validator-group'].value; var $validator_group = $element.closest('.' + validator_group); ...
[ "function _addErrorClasses(element) {\r\n// $(element).addClass('form-error').siblings().addClass('form-error');\r\n return false;\r\n }", "function _addErrorClasses(element) {\n\t\t\t\t$(element).addClass('form-error').siblings().addClass('form-error');\n\t\t\t}", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns Font tag with default font as Calibri
function fn_fontstart() { return "<font face = " + chr(34) +"Calibri" + chr(34) + ">" + Chr(10); }
[ "get font() {}", "get fontTTFName() {}", "get fontStyle() {}", "get FontDefault() {\n const font = this.native.FontDefault;\n return (font === null) ? null : new ImFont(font);\n }", "static get MISSING_FONT_DEFAULT() {\n return 'Helvetica, Arial, sans-...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for time penalty
function penaltyTime () { secondsLeft += penaltyWrongAnswer; }
[ "function timePenalty() {\n timeRem =- 5;\n}", "function penalty() {\n\tif (timerValue >= 6) {\n\t\ttimerValue += wrongPenalty;\n\t} else {\n\t\ttimerValue = 0;\n\t}\n}", "function subtractTime() {\n // Subtracts\n time = time - penaltyTime;\n }", "function penalty() {\n timerLe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset any content that needs to be reset. (Mainly the scroller)
function resetContent() { scrollLine.scroffset = 0; scrollOffScreen.clear(); scrollScreen.clear(); currentScrollBackPos = 10; }
[ "resetScroll() {}", "function reset()\n {\n hide_pagination();\n opts.scrollContainer.scroll(scroll_handler_a);\n }", "function resetContent() { setContent(''); }", "reset() {\n this.offset = 0;\n this.heights = [];\n this.scrollTop = 0;\n this.numberOfI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
computes vertical step needed returns maximum width for x labels
function computeVStep() { var xLabelWidth = 0; if (typeof obj.xData !== "undefined") { var xfont = obj.xData.font; if (adjustableTextFontSize) { xfont.size=getAdjustableLabelFontSize(); } var b = " "; c.font = xfont.weight + b + xfont.size + "px" + b + xfont.family; } if (showLabels) { ...
[ "findAxisStepSize(yMin, yMax) {\n let stepSize = 1;\n // Positions to draw the label at.\n if (yMax - yMin < 20) {\n stepSize = 1;\n } else if (yMax - yMin < 50) {\n // If there are too many things, draw every 5 instead.\n stepSize = 5;\n } else if (yMax - yMin < 100) {\n // If th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a list of competitions, it will fetch the participant count of each, and inserts a "participantCount" field in every competition object.
async function attachParticipantCount(competitions) { /** * Will return a participant count for every competition, with the format: * [ {competitionId: 35, count: "4"}, {competitionId: 41, count: "31"} ] */ const participantCount = await Participation.findAll({ where: { competitionId: competitions.map(...
[ "function updateCounts(){\n\n var participants = 0;\n var rolemodelCount = 0;\n var countries = [];\n\n for(var k in data){\n var item = data[k];\n if(item.visible) {\n var attendance = parseInt(item[\"n-lectures\"]);\n if(!isNaN(attendance)){\n participants = participants + attendance;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Maptimize.Proxy.GoogleMapshowPlacemark(tagName[, showAddress = null, callback = null, context = null ]) > undefined placemark (Object): object representing Google Map placemark (get by calling getPlacemarks). showAddress (Boolean): if true, displays address on the map inside an info window. callback (Function): callbac...
function showPlacemark(placemark, showAddress, callback, context) { var accuracy = placemark.AddressDetails.Accuracy, address = showAddress ? placemark.address.split(',').join('<br/>') : false, zoom = 1; if (accuracy >= 9) zoom = 17; else if (accuracy >= 6 ) zoom = 14; else if (ac...
[ "function showMarker(lat, lng, zoom, address, callback, context) {\n var latLng = new GLatLng(lat, lng);\n this.map.setCenter(latLng, zoom);\n \n if (this.marker) {\n this.marker.setLatLng(latLng);\n this.marker.show();\n }\n else {\n this.marker = new GMarker(latLng, {draggable: tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creating author with next parameters: name, sname, date, books and id
function createAuthor(name, sname, date, books, id) { var author = {}; //****************************** using method for each to sort out our array if (id) { $localStorage.authors.forEach(function (item) { if (item.id === id) { item.na...
[ "function createAuthorFromBook( req, res, next){\n const author = model.createAuthorFromBook(req.params.id, req.body)\n if(author.data){\n return res.status(200).send({ data: author.data })\n }\n else{\n return next({ status: 404, message: author.error})\n }\n}", "function create(id, authorsInput) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Browserify Browserifies as well as Watchify the given bundle type
function toBrowserify(bundleType) { var args = merge(watchify.args, { debug: true }); var bundler = browserify('./public/browserify/' + bundleType + '.js', args) .plugin(watchify) .transform(babelify, {presets: ['es2015', 'react']}) function bundleFiles() { console.log("Browserify Bundling " + bundleTyp...
[ "function bundle_js() {\n return b\n .bundle()\n .on(\"error\", log.bind(log, \"Browserify Error\"))\n .pipe(source(\"bundle.js\"))\n .pipe(buffer())\n .pipe(cond(PROD, terser()))\n .pipe(cond(!PROD, sourcemaps.init({ loadMaps: true })))\n .pipe(cond(!PROD, sourcemaps.write()))\n .pipe(gulp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pegar as aulas no servidor e listar
function listarAulas () { aulaService.listar().then(function (resposta) { //recebe e manipula uma promessa(resposta) $scope.aulas = resposta.data; }) }
[ "function listar() {\n\n titulo(3) // Invoca o template de título\n descricao(`Retorne o array de clientes.`)\n\n console.log(clientes)\n}", "function getServersList() {\n if (window.sos && window.sos.length > 0) {\n var selectSrv = document.getElementById('server-select');\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mazeStr is an array of 10 rowStr
function setMazeByText(mazeStr) { for(var i = 1; i <= mazeStr.length; i++) { setRowByText(i, mazeStr[i - 1]); } }
[ "function maze(array) {\n if(array.length === 0) {\n return '';\n }\n return maze(array[array.length-1].map(entry => entry === ' ' ? 'R' : 'D'));\n}", "function stringToCharAry(mazeStr) {\n var mazeStrAry = mazeStr.split('\\n');\n var mazeChrAry = [[]];\n for (var i = 0; i < mazeStrAry.length; i++)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lays out a Venn diagram greedily, going from most overlapped sets to least overlapped, attempting to position each new set such that the overlapping areas to already positioned sets are basically right
function greedyLayout(areas, params) { var loss = params && params.lossFunction ? params.lossFunction : lossFunction; // define a circle for each set var circles = {}, setOverlaps = {}, set; for (var i = 0; i < areas.length; ++i) { var area = areas[i]; if (area.sets.length == 1) { ...
[ "function greedyLayout(areas, params) {\n var loss = params && params.lossFunction ? params.lossFunction : lossFunction;\n // define a circle for each set\n var circles = {}, setOverlaps = {};\n var set;\n for (var i = 0; i < areas.length; ++i) {\n var area = areas[i];\n if (area.sets.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isMatch: ( node ) => node.dataset && node.dataset.block === 'hubspot/form',
transform( node ) { const { portalId, formId } = node.dataset; const attrs = {}; if ( portalId ) { attrs.portalId = portalId; } if ( formId ) { attrs.formId = formId; } return createBlock( 'hubspot/form', attrs ); }
[ "onmatch() {\n const cmsContent = this.closest('.cms-content').attr('id');\n const context = (cmsContent)\n ? { context: cmsContent }\n : {};\n\n const BlockLinkFieldComponent = loadComponent('BlockLinkField', context);\n const schemaData = this.data('schema');\n const stateDa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find Planet By Id
async findByPlanetById(req, res) { try { const { id } = req.params; const planet = await Planet.findById(id); if(!planet) { return res.status(404).send({ error: { description: "Não foi possível encontrar o planeta" } }); } return res.send({ result: { planet } }); } catch (err) { return re...
[ "static async getById(id) {\n try {\n const [plan] = await db(this.table).where('id', id);\n return new Plan(plan);\n } catch (e) {\n throw new Error(e);\n }\n }", "function findPort(id)\n{\n var index;\n for (index in ports) {\n if (ports[index].id == id) {\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return n random agents as agentset. See [FisherYatesKnuth shuffle]( for better approach for large n.
nOf (n) { // I realize this is a bit silly, lets hope random doesn't repeat! if (n > this.length) util.error('nOf: n larger than agentset') if (n === this.length) return this const result = [] while (result.length < n) { const o = this.oneOf() if (!(o in result)) result.push(o) } ret...
[ "nOfAgentSet(n, agentSet) {\n var items, newItems;\n items = agentSet.iterator().toArray();\n newItems = this._nOfArray(n, items);\n return agentSet.copyWithNewAgents(newItems);\n }", "upToNOfAgentSet(n, agentSet) {\n var items, newItems;\n if (n >= agentSet.size()) {\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setup our processed data object TODO: we will probably want to move to DB for persistence, but it will be better to wait to avoid potential migrations due to app updates early on...
function prepareProcessedData() { // #BUG: Had to add resourcesDirectory for Android... state.processedData = JSON.parse(Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory + 'common/data-base.json').read().text); }
[ "async prepareData() { }", "_setup(config = { collectionName: undefined }) {\n // Model object only can perform operation if they are initialize\n // from init() method\n this._setupComplete = true;\n this._meta = new MetaModel(this, config);\n }", "preIngestData() {}", "init() {\r\n\r\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the format template for a filter ==========================================================================================
function getFilterFormatString(operator, dataType) { var result; if (dataType.indexOf(":String") != -1) { switch (operator) { case "substringof": result = "{1}({2}, {0}) "; break; case "not substringof": result = "{1}({2}, {0}) "; break; case "startswith": ...
[ "GetFormat() {\n\n }", "function createAppliedFilter(filter) {\n return {\n uniqueId: filter.uniqueId,\n displayname: {value: filter.toString(), isHTML: false}\n }\n }", "_getFormatterOnFilt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Menucool Javascript Image Slider v2012.9.11. Copyright
function mcImgSlider(g) { var B = function (a) { return document.getElementById(a) }, H = function (d) { var a = d.childNodes, c = []; if (a)for (var b = 0, e = a.length; b < e; b++)a[b].nodeType == 1 && c.push(a[b]); return c }, J = function (a, b) { return a.getElem...
[ "function mcImgSlider(e){function t(){var e,t=50,n=navigator.userAgent;return-1!=(e=n.indexOf(\"MSIE \"))&&(t=parseInt(n.substring(e+5,n.indexOf(\".\",e)))),-1!=n.indexOf(\"Safari\")&&-1==n.indexOf(\"Chrome\")&&(t=300),t}function n(){var e;if(M.l&&(e=a(M.l)),e)for(var t=e.childNodes,n=0;n<t[s];n++)\"thumb\"==t[n][l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
description Render the form based on the choice made on the action by the user
function renderForm() { action_string = action.value if (action_string == 'CREATE') { idInput.hidden = true; nameInput.hidden = false; typeInput.hidden = false; sizeInput.hidden = false; toppingsInput.hidden = false; } else if (action_string == 'GET') { idInput.hidden = false; nameInput.hidden = true; ...
[ "function DActionForm(modo)\n\t{ \n\t// normaliza variavel\t\n\tmodo = lc(modo)\n\t\n\tswitch(modo)\n\t\t{\n\t\t// Modo Visualizar ----------------------------\n\t\tcase \"ver\":\n\t\t\n\t\tif($(\"#CAD\").find(\".DActionForm\").length > 0)\n\t\t\t{\n\t\t\t$(\"#CAD\").find(\".DActionForm\").remove();\n\t\t\t$(\"#CAD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display name of the organization that originated and signed the pass.
get organizationName() { return this.fields.organizationName; }
[ "function getOrganisationName() {\n var name = \"<Name der Organisation>\";\n\n var storedName = localStorageService.get('org_name');\n\n if (storedName) {\n name = storedName;\n }\n\n return name;\n }", "function getOrgNameByOrg(ORGS, o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clearing out any existing ideas from redux store
clearIdeas() { this.props.resetIdeas() }
[ "clearStore() {}", "clear (state) {\n state.categories = []\n }", "clear () {\n this.state = {\n ids: [],\n actives: []\n }\n this.event.emit('clear')\n }", "function clearItems() {\n myStore.dispatch({\n type: \"CLEAR_ALL_ITEMS\"\n });\n}", "resetAddInterestState() {\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if reporter true for all of this set's objects
all (reporter) { return this.every(reporter) }
[ "hasAll(arr) {\n for (let obj of arr) {\n if (!this.has(obj))\n return false;\n }\n return true;\n }", "areAllArtefactsTaken () {\n let areAllArtefactsTaken = true\n\n for (let key in this.players) {\n const player = this.players[key]\n\n areAllArtefactsTaken = areAllArtefact...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
filepicker image upload for registration/edit_profile page
function getImg() { filepicker.setKey("ABDI6UIw6SzCfmtCVzEI3z"); filepicker.pick({ mimetypes: ["image/*"], container: "modal", services: filepickerServices(), }, function(InkBlob) { $("#pic").find(".btn[type=submit]").removeAttr("disabled").removeC...
[ "function uploadProfileImage() {\n\tvar selectedFile = this.files[0];\n\tvar contentType = selectedFile.type;\n\t//TODO: validate contentType\n\tdocument.getElementById(\"mdl-spinner-profile-image\").classList.add('is-active');\n\tmakeRequest('/account/profile/image/upload', 'POST', selectedFile, handleProfileImage...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stop drawing the loading animation
stopDrawing() { this.updateAnimation = false; }
[ "function stopLoadingAnimation()\n{\n if (loadingAnimationTimer != null) {\n clearInterval(loadingAnimationTimer);\n loadingAnimationTimer = null;\n }\n}", "function stopLoadingAnimation () {\r\n $('#root-loading-wheel').remove();\r\n $('#root-loading-text').remove();\r\n}", "function stop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
String > Void checks a given directory for JPEGs to rename, if none are present, the program moves into each sub directory present
function checkForJPEGs(absRootDir){ const readdir_PROM = util.promisify(fs.readdir); const fStat_PROM = util.promisify(fs.stat); const cache = { names: {}, files: {} }; /* String -> Array checks directory for JPEG files */ async function checkDirectory(parent){ ...
[ "function renameFolder(\n event1,\n organizeCurrentLocation,\n itemElement,\n inputGlobal,\n uiItem,\n singleUIItem\n) {\n var promptVar;\n var type; // renaming files or folders\n var newName;\n var currentName = event1.parentElement.innerText;\n var nameWithoutExtension;\n var highLevelFolderBool;\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
console.log(filterPassing(submissions)) Declare a function named filter90AndAbove Parameter(s): array Functionality: return a new array using the filter method. The filter method should find objects in the array that have scores greater than or equal to 90.
function filter90AndAbove(array) { let filter = array.filter(array => array.score >= 90); return filter }
[ "function filter90AndAbove(array) {\r\n let highScore = array.filter(function (submission) {\r\n return submission.score >= 90;\r\n });\r\n console.log(highScore);\r\n}", "function filter90AndAbove (array) {\n console.log(\"These scores are 90 and above:\");\n console.log(array.filter(element => eleme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add the timer to table at num index
function addToTable(finishedTimer){ /* add new row for completed timer */ var row = statsTable.insertRow(statsinfo.num); statsinfo.num ++; /* add date, name of timer and time completed */ var cell1 = row.insertCell(0); var cell2 = row.insertCell(1); var cell3 = row.insertCell(2); cell1....
[ "function addTimerDOM(i) {\n\t$('#table_body').append(\"<tr><td>\" + timers[i].time.toLocaleTimeString() + \"</td><td>\" + timeRemaining(timers[i].time.getTime()) + \"</td></tr>\");\n}", "function update_elapsed(index, time) {\n var history = document.getElementById(\"history\");\n var elapsed = history.row...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set user_id parameter for this Google Analytics ID.
function setUserId(gtagFunction, analyticsId, id, options) { if (options && options.global) { gtagFunction(GtagCommand.SET, { 'user_id': id }); } else { gtagFunction(GtagCommand.CONFIG, analyticsId, { update: true, 'user_id': id }); } }
[ "function setUserId(gtagFunction, analyticsId, id, options) {\n if (options && options.global) {\n gtagFunction(GtagCommand.SET, {\n user_id: id,\n });\n } else {\n gtagFunction(GtagCommand.CONFIG, analyticsId, {\n update: true,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the on handler on the native xhr's `upload` property for the given eventType
function createUploadHandler(eventType) { if (xhr.upload && fakeXHR.upload && fakeXHR.upload['on' + eventType]) { xhr.upload['on' + eventType] = function (event) { dispatchEvent(fakeXHR.upload, eventType, event); }; } }
[ "function createUploadHandler(eventType) {\n if (xhr.upload) {\n xhr.upload['on' + eventType] = function(event) {\n dispatchEvent(fakeXHR.upload, eventType, event);\n };\n }\n }", "function createHandler(eventType) {\n xhr['on' + eventType] = function(event) {\n cop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Unfreeze page content scrolling
function unfreeze() { if($("html").css("position") == "fixed") { var top = $("html").scrollTop() ? $("html").scrollTop() : $("body").scrollTop(); $("html").css("position", "static"); $("html, body").scrollTop(-parseInt($("html").css("top"))); $("html").removeAttr(...
[ "function unfreeze() {\n if($(\"html\").css(\"position\") == \"fixed\") {\n $(\"html\").css(\"position\", \"static\");\n $(\"html, body\").scrollTop(-parseInt($(\"html\").css(\"top\")));\n $(\"html\").css({\"position\": \"\", \"width\": \"\", \"height\": \"\", \"top\": \"\", \"overflow-y\": \"\"})...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
================================================================== timer animation functions ================================================================= format seconds int to MM:SS string
function formatTime() { // get whole minutes var minutes = Math.floor(timer / 60); // get remaining seconds var seconds = timer % 60; // add leading "0"s if (seconds < 10) { seconds = "0" + seconds; } return minutes + ":" + seconds; }
[ "function formatTime() {\n seconds++;\n const mins = Math.floor(seconds / 60).toString().padStart(2, '0');\n const secs = (seconds % 60).toString().padStart(2, '0');\n timerEl.innerText = `${mins}:${secs}`;\n}", "function formatTimer() {\n\tlet sec = second > 9 ? String(second) : \"0\" + String(second...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check for fragment identifier pointing to a specific fact and select it if present.
handleFactDeepLink() { if (location.hash.startsWith("#f-")) { this.selectItem(location.hash.slice(3)); } }
[ "function getElementByIdInFragment(fragment, id) {\r\n if (fragment.querySelector) {\r\n return fragment.querySelector('#' + id);\r\n } else {\r\n return null;\r\n }\r\n}", "changeFragment(id) {\n if (id) {\n const data = {\n tableID: this.activeTable,\n fragmentID: id...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the path to the phantomjs application
function getPhantomFileName(callback) { // var nodeModulesPath = path.join(__dirname, 'node_modules'); var nodeModulesPath = path.join(__dirname, 'node_modules', 'phantomjs'); fs.exists(nodeModulesPath, function(exists) { if (exists) { callback(path.join(__dirname, 'node_modules','phantomjs', ...
[ "function getPhantomPath() {\n\n if(pack.isAWSHosted()) {\n return '/tmp/phantom/node_modules/phantomjs-prebuilt/bin/phantomjs';\n }\n\n return 'phantomjs';\n\n}", "function getPhantomFileName() {\n var phantomPath = path.join(__dirname, 'node_modules', 'phantomjs', 'bin', 'phantomjs');\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iterate over all account stores on the given Application, looking for all Social providers. We'll then create a config.providers array which we'll use later on to dynamically populate all social login configurations ^^
function setProviders(application, cb) { application.getAccountStoreMappings(function(err, mappings) { if (err) { return cb(err); } mappings.each(function(mapping, next) { mapping.getAccountStore(function(err, accountStore) { if (err) { return next(err); ...
[ "function getStoreGuards(callback, app) {\n var stores = {};\n _.forEach(app, function grabStores(value, key) {\n if (isStore(value)) {\n stores[key] = value.getGuard();\n }\n });\n callback(null, stores);\n}", "registerConfiguredProviders() {\n\t\tthis.app.make('config').get(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Directive //////////////////////// Instantiate a root component.
function instantiateRootComponent(tView,viewData,def){var rootTNode=getPreviousOrParentTNode();if(tView.firstTemplatePass){if(def.providersResolver)def.providersResolver(def);generateExpandoInstructionBlock(tView,rootTNode,1);baseResolveDirective(tView,viewData,def,def.factory);}var directive=getNodeInjectable(tView.da...
[ "function instantiateRootComponent(tView, viewData, def) {\n var rootTNode = getPreviousOrParentTNode();\n if (tView.firstTemplatePass) {\n if (def.providersResolver)\n def.providersResolver(def);\n generateExpandoInstructionBlock(tView, rootTNode, 1);\n baseResolveDirective(tV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if you hev pu the right number of flags on all the mines Talking with my friends it seems this is not a condition of success
function isSuccessFlag(){ var success = ($scope.caseFlagged==$scope.minesCount); // The number of flag is the same than the number of mine var len = $scope.mines.length; var i= 0; while(success && (i<len)){ var item = $scope.mines[i]; success = success && $scope.grid[item.x][item...
[ "isGameWon() {\n const nonMinedFields = this.fields.flat().filter(field => !field.hasMine)\n const minedFields = this.fields.flat().filter(field => field.hasMine)\n\n return nonMinedFields.every(field => field.isRevealed) && minedFields.every(field => field.isFlagged)\n }", "checkMines() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the api data for each month
function getData() { date = activity.dataset.date; var url = '/activitiesByDateRange?userName=' + user + '&startDate=' + date; $.getJSON(url, function(response){ append(monthTotal(response)); }); }
[ "async function getApiForCurrentMonth() {\n try {\n const result = await fetch(\"https://sholiday.faboul.se/dagar/v2.1/\" + year + \"/\" + month)\n const data = await result.json();\n return data;\n }\n catch(error) {\n console.error(error)\n }\n}", "async getMonthly(params...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
|element| is assumed to be an HTMLInputElement with |type| == 'radio'. Returns an array containing all radio buttons other than |element| that have the same |name|, either in the form that |element| belongs to or, if no form, in the document tree to which |element| belongs. This implementation is based upon the HTML sp...
function getAssociatedRadioButtons(element) { if (element.form) { return filter(element.form.elements, function(el) { return el != element && el.tagName == 'INPUT' && el.type == 'radio' && el.name == element.name; }); } else { var treeScope = getTree...
[ "function getAssociatedRadioButtons(element) {\n if (!element.ownerDocument.contains(element))\n return [];\n if (element.form) {\n return filter(element.form.elements, function(el) {\n return el != element &&\n el.tagName == 'INPUT' &&\n el.type == 'radio' &&\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To get the candidate_id
function buildListofCandidateId(candidateId, transactionId) { return new Promise((resolve, reject) => { let listCandidateId = []; let query = sqlQuery.sqlQueries.queryAllCandidate; if (transactionId) { query = sqlQuery.sqlQueries.queryTransaction + transactionId; ...
[ "async getCandidate (_id) {\n let candidate = await this.models.candidates.findOne({_id: _id, deletedAt: null})\n populate('position');\n if (!candidate) {\n throw new Error();\n }\n return candidate;\n }", "async getCandidate (_id) {\n let candidate = await this.models.candidates.findOn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The selflink for Media in the databaseAccount.
get MediaLink() { return this.mediaLink; }
[ "getMediaId()\n\t{\n\t\treturn this.mediaId;\n\t}", "function MediaLink(connection) {\n this.connection = connection;\n }", "get displayedMediaId() { return null; }", "function getAssocMediaTo(guid, success, error, errorCache) {\r\n _db = _db || new Worktop.Database();\r\n _db.getAssocMe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Any row that has an entire row below it blank, should be dropped down to the lowest blank row.
function dropRows() { var x, y; var bottomEmptyRow = null; for (y = 0; y < board.BOARD_HEIGHT; ++y) { if (isRowEmpty(y)) { // Only set the bottom row if it started out as null if (null === bottomEmptyRow) { bottomEmptyRow = y; ...
[ "function trimEmptyRows() {\n\t\t\n\t\t// row is empty if it has 3 .cell--blank children\n\t\t$('tr').each(function(){\n\t\t\tif ($(this).children('.cell--blank').length === 3) {\n\t\t\t\t$(this).addClass('row--empty');\n\t\t\t}\n\t\t});\n\t\t\n\t\t// identify inner empty rows to be trimmed\n\t\t$('tr.row--empty')....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to GET max_sol value from endpoint for selected rover
function getMaxsol(roverChoice) { var maxparams = { rover: roverChoice, api_key: 'I4dfNHxd1LPVg6P96qNQlu9cJNz50UNBIAyR2LXO' }; $.ajax({ url: 'https://api.nasa.gov/mars-photos/api/v1/rovers/' + roverChoice + '/photos?sol=1&api_key=' + maxparams.api_key }).done(function (dateresult...
[ "findMaximumValue() {\n\n }", "function findMaxNeed(){\n\tif('poll'===task.type.name){\n\t\tswitch(task.type.winCondition){\n\t\t\tcase 'plurality':\n\t\t\t\tcountVotes();\n\t\t\t\tpluralityFunc();\n\t\t\t\tif(votes+secondHighest.count<highest.count){\n\t\t\t\t\tvotes=0;\n\t\t\t\t}\n\t\t\t\trequiredVotes=highest...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle contact form submission
function contactFormHandler( event ) { 'use strict'; // Prevent default form submission event.preventDefault(); // Cache form for later use var $form = $( '.contact-form' ), $submit = $form.find( '[type="submit"]' ); $submit.prop( 'disabled', true ).data( 'original-text', $submit.text() ).text...
[ "function submitContactForm(evt) {\n\n\t\tevt.preventDefault();\n\t\tif(validateContactForm()) {\n\t\t\t$('.moonloader').show();\n\t\t\tvar firstName = $('#first_name').val();\n\t\t\tvar lastName = $('#last_name').val();\n\t\t\tvar emailAddress = $('#email_address').val();\n\t\t\tvar companyName = $('#company_name'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the content of the last opened file.
static getLastOpenedFile(callback) { FileWriterRemote.fileWriter.getLastOpenedFile(callback); }
[ "function YModule_get_lastLogs()\n {\n var content; // bin;\n // may throw an exception\n content = this._download(\"logs.txt\");\n return content;\n }", "async getContents(){\n return await this.config.handler.getFileContents(this);\n }", "getFile() {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refresh reference pinned message
async function UpdateRef(msg){ try{ var ref = await msg.channel.fetchMessage(config['messageId']); console.log('Reference Message Updated'); //et le mettre à jour ref.edit(FormatData(index)); }catch(e){ console.log(e.stack); var ref = None; } return ref; }
[ "_broadcastPinnedSitesUpdated() {\n // Pinned data changed, so make sure we get latest\n this.pinnedCache.expire();\n\n // Refresh to update pinned sites with screenshots, trigger deduping, etc.\n this.refresh({ broadcast: true });\n }", "async pin() {\n this.update({ isPendingPinned: true...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a VisionPrescriptionDispense resource
static get __resourceType() { return 'VisionPrescriptionDispense'; }
[ "static get __resourceType() {\n\t\treturn 'VisionPrescription';\n\t}", "function prescription() {\n var directive = {\n bindToController: true,\n controller: PrescriptionController,\n controllerAs: 'vm',\n restrict: 'E',\n scope: {\n retrospectiveMode: '='\n },\n temp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: Combine both probAmplitude methods
getProbAmplitude0() { // var probAmpComplex = math.complex(Math.cos(this.getInclinationRadians() / 2), 0); // return math.round(probAmpComplex, 4); return this.probAmplitude0; }
[ "function Amplitude (sampleRate, attack, decay) {\n\tthis.sampleRate\t\t= isNaN(sampleRate) ? this.sampleRate : sampleRate;\n\tthis.attack\t\t= isNaN(attack) ? this.attack : attack;\n\tthis.decay\t\t= isNaN(decay) ? this.decay : decay;\n}", "function get_amp(i)\n{\n\tvar amp = [ampl1data[i],ampl2data[i]];\n\tvar ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The path to the attribute for filtering.
get attributePath() { return this._attributePath; }
[ "get path() {\n return this.getStringAttribute('path');\n }", "get propertyPath() {}", "function getAttr(e) {\n if (e.target.getAttribute('data') !== null) {\n setPath(e.target.getAttribute('data'));\n }\n }", "get path() {\n return this.event.composedPath();\n }", "get _readAttrib...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save the inventory in Perso class
save_inventory() { var Player = this; $( "#inventory > li" ).each(function( index ) { let name = ""; let desc = ""; let nb = ""; name = $(this).find("#name_item").text(); desc = $(this).find("#desc_item").text(); nb = $(this).find("#nb_item").val(); if (nb == "" ||nb == null) nb = 0; ...
[ "function saveInventory () {\n write(__rootdir + '/data/inventory.json', JSON.stringify(inventory))\n}", "addToInventory (pItem) {\r\n console.info('Pickup called in player')\r\n this.Inventory.addToInventory(pItem)\r\n }", "function saveAutoUpgrades() {\n //save to local storage\n window.localSto...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is called if the app's Ember version is not supported by this version of the inspector. It sends a message to the inspector app to redirect to an inspector version that supports this Ember version.
function sendVersionMiss() { if (registeredMiss) { return; } registeredMiss = true; port.addEventListener('message', message => { if (message.type === 'check-version') { sendVersionMismatch(); } }); sendVersionMismatch(); port.start(); function sendVersionM...
[ "function sendVersionMiss() {\n var adapter = requireModule('ember-debug/adapters/' + currentAdapter)['default'].create();\n adapter.onMessageReceived(function(message) {\n if (message.type === 'check-version') {\n sendVersionMismatch();\n }\n });\n sendVersionMismatch();\n\n functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr', nullterminated and encoded in UTF16 form. The copy will require at most str.length4+2 bytes of space in the HEAP. Use the function lengthBytesUTF16() to compute the exact number of bytes (excluding null terminator) that this fun...
function stringToUTF16(str, outPtr, maxBytesToWrite) { assert(typeof maxBytesToWrite == 'number', 'stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!'); // Backwards compatibility: if max bytes is not specified, assume unsafe unbounded write is...
[ "function stringToUTF16(str, outPtr, maxBytesToWrite) {\n assert(outPtr % 2 == 0, 'Pointer passed to stringToUTF16 must be aligned to two bytes!');\n assert(typeof maxBytesToWrite == 'number', 'stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the outp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get request status code
get status(): number { const NO_RESPONSE_CODE = 0; const DECIMAL_RADIX = 10; return this.exception.status ? parseInt(this.exception.status, DECIMAL_RADIX) : NO_RESPONSE_CODE; }
[ "static get statusCode() {\n\t\treturn this.response.statusCode;\n\t}", "getStatus(){\n if (this.errors){\n return Math.max.apply(null,this.errors.map(x => x.status));\n }\n return config.DEFAULT_SUCCESS_HTTP_STATUS_CODE;\n }", "function getHTTPstatuscode(url) {\n return ne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var SHD = false;
function ShowHDDiv() { if (!SHD) { $(".Bottom_Div").css('height', 40); SHD = true; } else { $(".Bottom_Div").css('height', 400); SHD = false; } }
[ "function Start () {\n\t//shi_=false;\n}", "function daspoNonAttiva() {\n daspo = false;\n}", "function _isShrunk() {\n\t\treturn shrink.hasClass(CLASS_HIDDEN);\n\t}", "isSleepFlagSet() {\r\n return sleepShip;\r\n }", "function mousePressed(){\r\n\r\n \r\n if (bool == 0){bool = 1}els...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
assembles a json string of other parameters and from it sets the value of the transfer parameter images2View: options are i2v (TEST_IMAGES) i2conv (PROCESSED_IMAGES) jsonParams is used by the: JSON_GALLERIES_imageGalleryFromTemplate.groovy
function setJsonGalleryParam(transferParamId, images2View) { //vOutputFolder,vIMAGELIST_URL,vIMAGE_OBJECTS,vIMAGE_GALLERY,vPRIMARY_IMAGE_LIST,vJOB_PATH,vIMAGE_ADJUSTMENTS,vTEST_IMAGES,vBUILD_LABEL console.log('setting_json_parameters') gallerySource=images2View galleryPath=(gallerySource=='i2conv')?jQuery('#gal...
[ "function setJsonTransferParam(transferParamId) {\n //TEST_IMAGES,OVERLAY,GLOBAL_IMPATH,GLOBAL_SESSIONS_WORKSPACE\n console.log('setting_json_parameters')\n jsonParams = {\n TEST_IMAGES: joinObj(jQuery('#' + jQuery('input[value=TEST_IMAGES]')[0].nextSibling.id).find('option:selected'), 'value'),\n OVERLAY:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function takes the session, and reads the node on the machine that holds the value of the current state of the machine. It then returns that value to the function that made the call.
function getCurrentState(session) { return __awaiter(this, void 0, void 0, function () { var nodeToRead, stateStatus; return __generator(this, function (_a) { switch (_a.label) { case 0: nodeToRead = { nodeId: currentStat...
[ "getStateMachine(smName, smVersion, cb) {\n redis.hget(`${smName}:${smVersion}`, 'sm', (err, result) => {\n cb(err, (result) ? StateMachine.fromPlain(JSON.parse(result)) : null)\n })\n }", "function getNodeState(node) {\n\t\treturn data.nodes[node].state\n\t}", "function NODE_getCurr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates 3 initial users if there is no user in database Mainly used for if every user delete from the database initialize from scracth for testing
async function initFirst(){ const users = await User .find(); if(users.length===0){ createUser(1,'Nandor','Relentless','impenetrablefortress@gmail.com',35); createUser(2,'Guillermo','De La Cruz','mosquitoHR@yahoo.com',24); createUser(3,'Baron','Afanas','brafanas@outlook.com',75); } }
[ "async function initializeUsers() {\n try {\n await createUser({\n username: 'guest',\n password: 'password',\n admin: false\n });\n\n await createUser({\n username: 'admin',\n password: 'adminpassword',\n admin: true\n });\n\n await createUser({\n username: 'updat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if choosen letter is in a password and mark chosen letter
function checkLetter(num) { var good = false; for (i = 0; i < password.length; i++) { if (password.charAt(i) == letters[num]) { password1 = password1.setChar(i, letters[num]); good = true; } } if (good == true) { markGood(num); update...
[ "function checkLetter(){\n\t\tif(userGuess === wrongLetter ){\n\n\t\t}\n\t}", "guess(e,letter){\n e.target.disabled = true;\n //checks that the password include a letter\n const isGoodAnswer = this.password.checkLetter(letter);\n if(!isGoodAnswer){\n this.updateLifes()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates and loads image objects for reference and invoke callback when complete.
function RefImageLoader(scope, callback) { var images = []; var loading = 0; var isComplete = false; /** * Add image data to load. * @param {object} img The image data object. * @param {Number} index The image index position....
[ "function imageLoaded() {\n self.framed = self.createFramedImage(self.image, width, height);\n //self.framed = self.image;\n self.object = self.createRendererObject();\n if(self.prepareCallback) {\n self.prepareCallback(true);\n }\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcName : dhcpVLANRangeAutoFill. In Arg : Nothing out Arg : Nothing Description : This function sets the ip address attributes.
function dhcpVLANRangeAutoFill () { /* declare or define your variables here */ var ipObj = document.getElementById ('tf1_vlanSubnetIpAddress'); var maskObj = document.getElementById ('tf1_vlanSubnetMask'); var startIPObj = document.getElementById ('tf1_dhcpStartIp'); var endIPObj = documen...
[ "function dhcpLANRangeAutoFill ()\n {\n /* declare or define your variables here */\n var ipObj = document.getElementById ('tf1_ipAddr');\n var maskObj = document.getElementById ('tf1_subnetmask'); \n var startIPObj = document.getElementById ('tf1_dhcpStartIp');\n var endIPObj = document.getEl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An abstract Colour implementation. Concrete Colour implementations should use an instance of this function as their prototype, and implement the getRGB and getHSL functions. getRGB should return an object representing the RGB components of this Colour, with the red, green, and blue components in the range [0,255] and t...
function Colour(){ /* Returns an object representing the RGBA components of this Colour. The red, * green, and blue components are converted to integers in the range [0,255]. * The alpha is a value in the range [0,1]. */ this.getIntegerRGB = function(){ // get the RGB components of this colour va...
[ "function calculateRGB(){\n\n // check whether the saturation is zero\n if (hsl.s == 0){\n\n // store the RGB components representing the appropriate shade of grey\n rgb =\n {\n 'r' : hsl.l * 2.55,\n 'g' : hsl.l * 2.55,\n 'b' : hsl.l * 2.55\n };\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On landing page, when a character's button is clicked, it'll set state to the values of the character they chose. When the Create button is clicked, capture the name value from the input field & add to state. All of this character data is sent to mongo on form submit.
function handleSubmit(event) { const { name, value } = event.target setNewCharacter({ ...newCharacter, [name]: value }) }
[ "function createCharacter() {\n\t\tsetCharacterName('');\n\t\tserver.post('character', {name: characterName}).then(() => {\n\t\t\tonCharacterUpdate();\n\t\t});\n\t}", "function _saveCharacter(state) {\n $(\"#js-save-button\").click(event => {\n event.preventDefault;\n const newCharact...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Info: This methode is invoked onchange of fields selected and validates for uniqueness of the fields added under sections Params: event Result: reports validation message if a duplicate fields is selected in the multiselect picklist
register(event) { let selectedfieldList =this.template.querySelectorAll("lightning-dual-listbox"); let selectValidation=[]; for(let i=0 ; i<selectedfieldList.length ; i++){ let selectedfields = `${selectedfieldList[i].value}`.split(','); if(selectValidation.some(r=> sel...
[ "function fnModifySubSections(){\nvar subSecForm = document.forms[0];\nvar index;\nsubsecseqno = false;\n\nif (document.forms[0].modelseqno.options[document.forms[0].modelseqno.selectedIndex].value ==\"-1\")\n{\n\nvar id = '19';\nhideErrors();\naddMsgNum(id);\nshowScrollErrors(\"modelseqno\",-1);\nreturn false;\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::KafkaConnect::Connector.WorkerLogDelivery` resource
function cfnConnectorWorkerLogDeliveryPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnConnector_WorkerLogDeliveryPropertyValidator(properties).assertSuccess(); return { CloudWatchLogs: cfnConnectorCloudWatchLogsLogDeliveryPropertyToCloudF...
[ "function cfnConnectorLogDeliveryPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnConnector_LogDeliveryPropertyValidator(properties).assertSuccess();\n return {\n WorkerLogDelivery: cfnConnectorWorkerLogDeliveryPropertyToCloudFormati...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
onFall event happens when one of the apples has been updated and has 'true' value for didFall property. In actionCreators, I use the 'id' and 'collectingDelay' in an asynchronous way for removing the apples from the ground and putting them into the basket
componentDidUpdate() { const collectingDelay = this.props.fallingDelay + FALLING_DURATION + WAITING_DURATION; if (this.props.didFall) { this.props.onFall(this.props.id, collectingDelay); } }
[ "fall() {\n if (this.state == 'falling') {\n return;\n }\n if (performance.now() - this.lastGroundedTime < this.fallThreshold) {\n return;\n }\n if (this.jumpAction && this.jumpAction.isRunning()) {\n return;\n }\n this.wasFalling = true;\n this.state = 'falling';\n this.pl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the currently used program in the context.
set currentProgram(program) { let programInfo = this._programs.get(program); if (programInfo == null) { return; } this._currentProgramInfo = programInfo; this._currentAttributesMap = programInfo.attributes; this._currentUniformsMap = programInfo.uniforms; }
[ "set program(value) {\n if (value >= 0 && value < this.programsBuffer.length)\n this.currentProgram = value;\n\n this.programsBuffer[this.currentProgram].use();\n }", "useProgram() {\n this.getContext().useProgram(this.getProgram());\n }", "useProgram() {\n\t\tif (this.glProg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get or create the message dispatcher for a message handler.
function getDispatcher(handler) { var dispatcher = dispatcherMap.get(handler); if (dispatcher) return dispatcher; dispatcher = new MessageDispatcher(); dispatcherMap.set(handler, dispatcher); return dispatcher; }
[ "function getDispatcher(handler) {\n var dispatcher = dispatcherMap.get(handler);\n if (dispatcher === void 0) {\n dispatcher = new MessageDispatcher(handler);\n dispatcherMap.set(handler, dispatcher);\n }\n return dispatcher;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a single contact
function getContact(id) { return contacts[id]; }
[ "function getOneContact(request, response, next) {\n contactsLogic.getOne({_id: request.params.id})\n .then(function (data) {\n response.send(data)\n })\n .catch(function (err) {\n response.status(500).send({error: 'ERROR from getOneContact() function: ' + err});\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates countdown timers in eventsindex view for each event
function createTimersinIndex() { //console.log("test"); //if timeLeft is less than 1 day, show countdown clock var eventDate = []; for (var i = 0; i < gon.totalIndexEvents; i++) { var dateFromView = $("#eventIndexTimer" + i).data("date"); //console.log(dateFromView); var dat...
[ "function musicaEvents() {\r\n var musicaEvent = $('.musica-counter-active');\r\n var len = musicaEvent.length;\r\n for (var i = 0; i < len; i++) {\r\n var musicaEventId = '#' + musicaEvent[i].id,\r\n dataValueYear = $(musicaEventId).attr('data-value-year'),\r\n\t\t\tdataV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Is there another axis intersecting `side` end of `ax`? First look at `counterAx` (the axis for this subplot), then at all other potential counteraxes on or overlaying this subplot. Take the line width from the first one that has a line.
function findCounterAxisLineWidth(ax, side, counterAx, axList) { if (shouldShowLineThisSide(ax, side, counterAx)) { return counterAx._lw; } for (var i = 0; i < axList.length; i++) { var axi = axList[i]; if (axi._mainAxis === counterAx._mainAxis && shouldShowLineThisSide(ax, side, axi)) { return ...
[ "function findCounterAxisLineWidth(ax, side, counterAx, axList) {\n if(shouldShowLineThisSide(ax, side, counterAx)) {\n return counterAx._lw;\n }\n for(var i = 0; i < axList.length; i++) {\n var axi = axList[i];\n if(axi._mainAxis === counterAx._mainAxis && shouldShowLineThisSide(ax, s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds a track to a playlist trackId is a Spotify track ID playlist is a Spotify playlist ID
function addToPlaylist(trackId, playlist) { spotifyApi.addTracksToPlaylist(playlist, [`spotify:track:${trackId}`]) .then(function (data) { console.log('Added tracks to playlist!'); }, function (err) { console.log('Something went wrong!', err); }); }
[ "function addTrackToPlaylist (trackId, playlistId) {\n library.playlists[playlistId].tracks[-1] = trackId;\n}", "function helper_addTrackToPlaylist(playlistId){\n for (var i in library.playlists[playlistId].tracks){\n console.log(\"tracks in the passed playlist:\",library.playlists[playlistId].tracks[i]);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the filter for the individual column, called from the filter popup ==========================================================================================
function setColumnFilter() { // Get the column filter object for this popup instance var filter = properties.activeColumn.enhancedTable.filter; // Make sure we start fresh filter.set = []; // Only proceed if there is a value in the first value input element...
[ "function BrowserFilterColumn() {}", "function initializeColumnFilter(tableColumn) {\n\n var filter = tableColumn.enhancedTable.filter;\n\n // A filter is: Operator: xxxx, Value: xxxx\n filter.set = [];\n filter.concatType = null;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========================= Tween.js Setup (Start here) =========================
function setupTween() { // var update = function(){ cube.position.x = current.x; } var current = { x: -userOpts.range }; // remove previous tweens if needed TWEEN.removeAll(); // convert the string from dat-gui into tween.js functions var easing = TWEEN.Easing[userOpts.easing.split('.')[0]][userOpts.easi...
[ "_makeTween () {\n // pass callbacks context\n this._o.callbacksContext = this._o.callbacksContext || this;\n this.tween = new Tween( this._o );\n // make timeline property point to tween one is \"no timeline\" mode\n ( this._o.isTimelineLess ) && ( this.timeline = this.tween );\n }", "setupTween(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a list of all valid language keys. We make a copy to prevent accidental manipulation.
getValidLanguages() { return validLanguages.slice(); }
[ "function getAvailableCyrillicChars()\r\n{\r\n\tvar list = new Array();\r\n\tvar a = '';\r\n\tfor (var item in Object.keys(chars)) {\r\n\t\tif (Object.keys(chars).hasOwnProperty(item)){\r\n\t\t\ta = Object.keys(chars)[item];\r\n\t\t}\r\n\t\t\r\n\t \tlist.push(chars[a].lower);\r\n\t \t\r\n\t \tif (chars[a].upper!==u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the element "value" to be serialized as an attribute or an input update record. It respects the input privacy mode of the element. PERFROMANCE OPTIMIZATION: Assumes that privacy level `HIDDEN` is never encountered because of earlier checks.
function getElementInputValue(element, nodePrivacyLevel) { /* BROWSER SPEC NOTE: <input>, <select> For some <input> elements, the `value` is an exceptional property/attribute that has the value synced between el.value and el.getAttribute() input[type=button,checkbox,hidden,image,radio,reset,subm...
[ "fieldValue(attrib) {\n const div = this.fieldElement(attrib);\n if (div.is('.read-only')) {\n const wrapper = div.find('.ro-val');\n if (typeof wrapper.data('val') !== 'undefined') { return wrapper.data('val'); } return wrapper.text();\n }\n // Rails checkbox fields have a hidden field follow...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
' Name : getPromoAmount ' Return type : None ' Input Parameter(s) : None ' Purpose : This method is to get the applied PROMO code amount on success response of BP_VERIFY_FUNDING_SOURCE_3_2 API. ' History Header : Version Date Developer Name ' Added By : 1.0 15th May, 2013 Karuna Mishra '
function getPromoAmount() { var promoCodeAmount = 0; if(bp_validate_promo_code_obj){ promoCodeAmount = bp_validate_promo_code_obj.promoCodeAmount; } if(promoCodeAmount) { return promoCodeAmount; } return 0; }
[ "function checkPromoCode(req) {\n var promoCode = req.body.promoCode; //JSON.parse(req.body).promoCode;\n console.log(\"promoCode received : \" + promoCode);\n\n if (promoCode) {\n var match = promoCode.match(/^X([\\d]{1,2})$/);\n if (match != null) {\n return parseInt(match[1], 10...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
From 01 year: Beginner From 13 years old: Intermediate 36 years old: Advanced From 7 up: Jedi Master
function experience(years) { if (years >= 0 && years < 1) return "Beginner"; if (years >= 1 && years < 3) return "Intermediate"; if (years >= 3 && years < 6) return "Advanced"; if (years >= 7) return "Jedi Master"; }
[ "function howOldWillIBe(yearofBirth, yearInFutureOrPast){\n var birth = parseInt(yearofBirth);\n var year = parseInt(yearInFutureOrPast);\n var answer=0;\n if(year>birth){\n answer=year-birth;\n writeToDom(\"You are \" +answer+ \" year(s) old.\", \"challenge-1\");\n } else if (year<birth){\n answer=bi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if location gets available
function onLocationAvailable(){ if (!self.nf_locationText.value){ self.updateLocation(); } else { if (self.nf_locationText.value !== self.location.formattedAddress){ self.nf.newLocation = true; } } }
[ "function hasLocation( search ) {\n var location = getLocationObject();\n return location && typeof location.locations[ search ] !== 'undefined';\n }", "static async isLocationEnabled() {\n return await Location.isLocationEnabled();\n }", "function getLocation() {\n\tif (Modernizr.geolocati...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
down:list>list Ordena una lista en orden descendente down([1,2,3])>[3,2,1] down([5,7,1,0,3,9])>[9,7,5,3,1,0]
function down(list) { if(length(list)==1) { return list; } else { return cons(maxList(list),down(removeX(list,maxList(list)))); } }
[ "function revll(list){\n if (list.next){\n revll(list.next);\n \n }\n console.log(list.value);\n }", "function handleDownUp(leftList, rightList, numRuns, downFirstThenUp) {\n\tif (leftList.length !== rightList.length+1) {\n\t\tvar norms = normalizeLists(leftList, rightList);\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler for the rename() system call. src: the path of the file or folder to rename dst: the new path cb: a callback of the form cb(err), where err is the Posix return code.
function rename(src, dst, cb) { var err = -2; // -ENOENT assume failure lookup(connection, src, function(source) { if (source.type === 'file') { // existing file var dest = lookup(connection, dst); if (dest.type === 'undefined') { dest.parent = lookup(connection, path.resolve(paths.join(dst,".."))); c...
[ "function rename(src, dst, cb) {\n src = pth.join(srcRoot, src);\n dst = pth.join(srcRoot, dst);\n fs.rename(src, dst, function renameCb(err) {\n if (err) \n return cb(-excToErrno(err));\n cb(0);\n });\n}", "function mv (src, dst) {\n try {\n fs.statSync(src)\n } catch (e) {\n return\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Submit the addStar form using the POST method
function submitAddStarForm(formSubmitEvent) { console.log("submit add star request"); // Important: disable the default action of submitting the form // which will cause the page to refresh // see jQuery reference for details: https://api.jquery.com/submit/ formSubmitEvent.preventDefault(); ...
[ "async function submitStar(event){\n event.preventDefault();\n const name = document.getElementById(\"inputName\").value;\n const color = document.getElementById(\"inputColor\").value;\n const inputClass = document.getElementById(\"inputClass\").value;\n\n const inputs = {\n name: name,\n color: color,\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an Array of addressible classes, that are to represent individually addressible LED groups, representing 'words' on the word clock
function getAddressibleClasses() { // ignoredClasses serves two purposes: // 1) ignore a few classes that are used for display like // 2) filter out duplicates var ignoredClasses = { 'active': true, 'minute': true, 'hour': true, 'extra': true }; var classes = [].map ...
[ "function getClassArray(c) {\r\n return new String(c).split(\" \");\r\n}", "function getHoles(className) {\n\tvar holes = document.getElementsByClassName(className);\n\tvar holesObj = [];\n\t\n\tfor (var i = 0; i < holes.length; i++) {\n\t\tholesObj[i] = new Hole(i);\n\t}\n\t\n\treturn holesObj;\n}", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the list of contacts with a new item on the end
addContact(contact) { // Create a new array with the list of existing items and the new contact at the end this.data = [...this.data, contact]; // Rerender the list this.render(); }
[ "function updateContacts() {\n Contact.query(\n $scope.table\n ).then(function(data) {\n $scope.table.items = data.contacts;\n $scope.table.totalItems = data.total;\n }\n );\n }", "addContact(contact){\n this.contactList.set(contac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Closes any accordions that are open when the user clicks on a tutorial link
function closeAccordions() { // Makes any active accordion inactive const acc = document.getElementsByClassName("accordion"); const panel = document.getElementsByClassName("panel"); for (let i = 0; i < panel.length; i++) { if (panel[i].style.display === "block") { panel[i].styl...
[ "function closeAllAccordions(){\n panelOpen = false;\n var acc = document.getElementsByClassName(\"accordion\");\n var i;\n for (i = 0; i < acc.length; i++) {\n var panel = acc[i].nextElementSibling;\n if (panel.style.maxHeight){\n panel.style.maxHeight = null;\n }\n }\n}", "closeAll() {\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the possprocess composer and the passes
setComposer() { this.composer = new Wagner.Composer(this.renderer); this.passes = [ new NoisePass({ amount: .05 }), new VignettePass({ boost: 1, reduction: .4 }) ]; }
[ "addRequiresForSubprocess(requires) {\n this.requires = requires;\n }", "exec () {\n switch (this.task) {\n case 'requirements': {\n RequirementsFileBuilder.build(this.extensions, this.extDir);\n break;\n }\n case 'ckanconfig': {\n let ckanCon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Middleware parses all inputs except 'name' to integers
function bodyReqinTransformerBrah( req, res, next ) { for( var keys in req.body ) { if( keys !== 'name' ) { req.body[keys] = parseFloat( req.body[keys] ); } } next(); }
[ "parseIdCountFromName(name) {\r\n const regex = /.*_([0-9]*)/;\r\n const match = regex.exec(name);\r\n if (util_1.isNullOrUndefined(match) || match[1] === '') {\r\n return 0;\r\n }\r\n else {\r\n const num = match[1];\r\n return parseInt(num, 10);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retrieve text of an XML document element, including elements using namespaces
function getElementTextNS(prefix, local, parentElem, index) { // alert('entro'); var result = ""; if (prefix && isIE) { // IE/Windows way of handling namespaces result = parentElem.getElementsByTagName(prefix + ":" + local)[index]; } else { // the namespace versions of this...
[ "function getText(element, namespace, tagName, usedNamespaces) {\n var first = getFirstElement(element, namespace, tagName, usedNamespaces);\n return first ? first.textContent : null;\n}", "function getElementTextNS(prefix, local, parentElem, index) {\n var result = \"\";\n if (prefix && isIE) {\n // I...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! This sets up an onbeforeunload handler to avoid accidentally navigating away from the page without saving changes.
function setupEventListeners() { window.onbeforeunload = function () { return saveChangesDialog(); }; }
[ "function onbeforeunload( window, main ){\n\n window.onbeforeunload = function(){\n\n if( main.value != main.defaultValue ){\n\n return \"edit.areyousure\".localize();\n\n }\n };\n\n main.form.addEvent(\"submit\", function(){\n\n localStorage.removeItem( LocalCache );\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to talk to third peer only
function sendMessageToThird(message) { console.log('Client sending message to third peer: ', message); socket.emit('messagetothird', message, isInitiator); }
[ "_dialPeer (peer, callback) {\n // Attempt Paratii 0.0.1\n this.libp2p.dialProtocol(peer, PARATII001, (err, conn) => {\n if (err) {\n // Attempt Paratii 0.0.1\n this.libp2p.dialProtocol(peer, PARATII001, (err, conn) => {\n if (err) { return callback(err) }\n\n callback(nul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles both players requested rematch after battle.
async _handleRematch() { await Promise.all( [ this.player.waitForRematch(), this.opponent.waitForRematch() ] ); this.status = 'full'; this.player.battlefield.shipsCollection.clear(); this.player.reset(); this.opponent.battlefield.shipsCollection.clear(); this.opponent.reset(); this.activePlayerId = null;...
[ "handleMatchResult(player1, player2, match) {\n this.matchTable.setMatch(player1.getId(), player2.getId(), match);\n let badPlayersInMatch = this.disqualifyBadPlayers(player1, player2);\n this.badPlayers = this.badPlayers.concat(badPlayersInMatch);\n this.addWaitingPlayersToDoneList();\n [player1, pl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add background image to element
static addBackground(url, element) { if(!Button.isDOM(element)) return; // check if element is DOM element.style.backgroundImage = 'url(' + url + ')'; EditBackground.setBackground(element); return element; }
[ "setImage(el, image) {\n el.style.backgroundImage = 'url('+image+')';\n }", "_image( elm, image ) {\n if ( elm.tagName === 'IMG' ) { elm.src = image; }\n else { elm.style.backgroundImage = 'url( '+ image +' )'; }\n }", "function inject_image_into_background(image_url){\n var style_sheet = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
event of putting chess
function putChess(e){ console.log('draw a chess'); var x = parseInt((e.pageX - cvs.offsetLeft) / GRID_SIZE); var y = parseInt((e.pageY - cvs.offsetTop) / GRID_SIZE); if(checkerBoard[x][y].state){ return; } // drawChess(x, y); socket.emit('putchess', x,y); console.log(x, y); // document.g...
[ "function chessEvent(snapshot) {\n if (!snapshot.val()) return; // information not ready yet\n gData=jQuery.extend(true, {}, snapshot.val()); // copy of gameData from database\n gInfo=gameInfo[gameID];\n \n if (gameID != gInfo.gid) {\n debug(0,\"Incorrect Game ID:\"+gInfo.gid+\"/\"+gameID);\n return;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }