query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
A convenience method for reducing by count.
function reduceCount() { return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero); }
[ "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 _multiCount(){\n //n is integer, no less than 0\n var mC=function(n){\n //n is integer, no less than 0\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert snap distance in pixels into buffer in degres, for searching around mouse It changes at each zoom change.
function computeBuffer() { this._buffer = map.layerPointToLatLng(new L.Point(0,0)).lat - map.layerPointToLatLng(new L.Point(this.options.snapDistance, 0)).lat; }
[ "toPixels(arr){\n let scaled = [];\n arr.forEach(index =>\n scaled.push({\n origin: {x: index.origin.x/this.state.scale, y: index.origin.y/this.state.scale},\n dest: {x: index.destination.x/this.state.scale, y: index.destination.y/this.state.scale},\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `LambdaConflictHandlerConfigProperty`
function CfnResolver_LambdaConflictHandlerConfigPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an objec...
[ "function CfnBucket_LambdaConfigurationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an obje...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the specified domain type's regular expression for matching field names.
function getFieldNameRegExp(domainType) { if (angular.isUndefined(domainType.$fieldNameRegexp)) { domainType.$fieldNameRegexp = getRegExp(domainType.fieldNamePattern, domainType.fieldNameFlags); } return domainType.$fieldNameRegexp; }
[ "function getSampleDataRegExp(domainType) {\n if (angular.isUndefined(domainType.$regexp)) {\n domainType.$regexp = getRegExp(domainType.regexPattern, domainType.regexFlags);\n }\n return domainType.$regexp;\n }", "function generateRegExp() {\n\n\tvar str = '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the value of a frequency in the current units
_frequencyToUnits(freq) { return freq; }
[ "function getFreq(name,un_name) //get frequncy in Hz\n{\n\tvar x=getVar(name);\n\tvar unit=getVtext(un_name);\n\tif(\"GHz\"==unit) return x*=1e9;\n\tif(\"MHz\"==unit) return x*=1e6;\n\tif(\"kHz\"==unit) return x*=1e3;\n\treturn x;\n}", "toFrequency() {\n return (0, _Conversions.mtof)(this.toMidi());\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine if entry is valid
function isValid(entry) { if (entry.status && entry.lastName && entry.dateKey) {return true} else {return false} }
[ "function isMetadataValid(item) {\n if ($scope.isList) {\n return true;\n }\n if (!item.metadata) {\n $scope.error = {\n message: \"Resource is missing metadata field.\"\n };\n return false;\n }\n if (!item.metadat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
redirect upon clicking itinerary card to itinerary
function view_itin(link, own) { window.location.href = "../itinerary_detail/itinerary_details.html?id=" + link; }
[ "goToCardIntake() {\n let url;\n if (Auth.get(this).user.role === 'corporate-admin') {\n url = 'main.corporate.customer.intake-revised';\n } else {\n url = 'main.employee.customer.intake-revised';\n }\n if (this.displayData.rejectionTotal) {\n url = url + '.denials';\n }\n state....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if the post is there in the users favorite posts return true
isPostIsFavorite(postId){ if(this.favorites.posts.indexOf(postId)>=0) { return true; } return false; }
[ "function storyIsFavorite(story) {\n if (currentUser) {\n let favoriteIds = currentUser.favorites.map(story => story.storyId); \n return favoriteIds.includes(story.storyId);\n }\n }", "function isFavorite(story) {\n // start with an empty set of favorite story ids\n let favoriteStoryIds...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show either line or grid
showGrid(){ this.Grid = true; this.Line = false }
[ "function toggleGridLines() {\n drawLines = !drawLines;\n draw();\n }", "checkBetLinesShow () {\n if (this.getService(\"LinesService\").getWinLines().length > 0){\n linesManager.disableMouseOverForLabels();\n } else {\n linesManager.enableMouseOverForLabels();\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
normalizeArabic removes tashkeel, tatweel, and removes punctuation from 'str'.
normalizeArabic(str="") { return ( str // Trim Whitespace .trim() // Remove tashkeel .replace(/ّ|َ|ً|ُ|ٌ|ِ|ٍ|ْ/g, "") // Remove tatweel .replace(/ـ/g, "") ); }
[ "function norm(str){\n return str\n .toLowerCase()\n .replace(/Á|á/,'azzz').replace(/É|é/,'ezzz').replace(/Í|í/,'izzz')\n .replace(/Ð|ð/,'dzzz').replace(/Ó|ó/,'ozzz').replace(/Ú|ú/,'uzzz')\n .replace(/Ý|ý/,'yzzz').replace(/Þ|þ/,'zz').replace(/Æ|æ/,'zzz').replace(/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used like file_here(import.meta.url, 'really_cool_file.png')
function file_here (here_url, file_name) { const here_file = fileURLToPath(here_url); const here = path.dirname(here_file); return path.join(here, file_name); }
[ "getFileUrl(file) {\n return RSVP.resolve(file.link('self').href);\n }", "function asset(url){\n if(url.match(/^(?:https?\\:)\\/\\//)) return url;\n else return 'assets/' + url;\n}", "async file(source, output, opts = {}) {\n const ext = path.extname(output).substr(1);\n const [res] = await this.cap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Public function `nonEmptyArray`. Returns true if `data` is a nonempty array, false otherwise.
function nonEmptyArray (data) { return array(data) && data.length > 0; }
[ "function isZeroArray(arr) {\r\n\t\tif (!arr[0] && !arr[1] && !arr[2] && !arr[3]) return true;\r\n\t}", "function nonEmpty(jqObject) {\n return jqObject && jqObject.length;\n}", "function IsArrayLike(x) {\r\n return x && typeof x.length == \"number\" && (!x.length || typeof x[0] != \"undefined\");...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end useAction Initialize GUIScripts:initializeRow Helper method that initializes the row and rowl variables
function initializeRow() { row = new Array(); rowl = new Array(); row.length = 3; rowl.length = 3; for (var i = 0; i < row.length; i++) { row[i] = ROW_POS + (i*ROW_SIZE); rowl[i] = LBL_ROW_POS + (i*ROW_SIZE); }//end i for loop }
[ "function initializeRows() {\n eventContainer.empty();\n var eventsToAdd = [];\n for (var i = 0; i < events.length; i++) {\n eventsToAdd.push(createNewRow(events[i]));\n }\n eventContainer.append(eventsToAdd);\n }", "function initializeRows() {\n resultContainer.empty();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
constructor objet Film avec les champs title, year et plot
function Film(title,plot,year){ this.title = title this.plot = plot this.year = year }
[ "function createMovie(t, d, g, im) {\n var movie = {\n title: t,\n director: d,\n genre: g,\n imdbGrade: im,\n }\n return movie;\n}", "function Album(artist, title, year){\n this.artist = artist\n this.title = title\n this.year = year\n this.songs = [];\n}", "function sh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add IDs to elements that are currently active
function tocSetActiveElementIDs(activeHeadings) { // Clear existing IDs const tocActiveIDs = ['toc-active-current', 'toc-active-current-level',]; for (const activeID in tocActiveIDs) { const elementWithActiveID = document.getElementById( tocActiveIDs[activeID] ); if (elementWithActiveID) { element...
[ "arrangeId() {\n const rootNode = this.parent.contentDom.documentElement;\n let id = SlideSet.MIN_ID;\n for (let { slideId } of this.selfElement.items()) {\n const oriId = slideId.id;\n const relElements = rootNode.xpathSelect(`.//*[local-name(.)='sldId' and @id='${oriId}'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For better user experience I automatically focus on the chat textfield upon pressing a key
function keyPressed() { if (screen == "game") { var field = document.getElementById("chatField"); field.focus(); } if (screen == "lobby") { var field = document.getElementById("lobby-field"); field.focus(); } }
[ "function set_msg_focus() {\n\t$('#msg').focus();\n}", "responding(){\n setTimeout(_=>{\n this.focusInput()\n })\n }", "function onMessageActive(newval, oldval) {\n if(!newval && !oldval)\n return;\n\n if(newval && !oldval) {\n $scope.focusTextInput();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
middleware to check req's numbers
function numbersReq(req, res, next) { console.log(++numberReq); next(); }
[ "function isValidId(req, res, next) {\n if (!isNaN(req.params.id)) return next();\n next(new Error('Invalid ID'));\n}", "function validateNumbers() {\n return auctions_id == [0-9]*$ ? axios.post('https://silent-auction-69.herokuapp.com/api/items', auction)\n .then(res => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to calculate turn meter tick rate Overrides tickRate attribute for use in Turn Meter calculation
calculateTickRate(enemySpeed){ this.tickRate = Math.round((this.speed / (this.speed + enemySpeed)) * 100); }
[ "calculateTurnMeter() {\n this.turnMeter += this.tickRate;\n if (this.turnMeter >= 100) {\n this.turnMeter -= 100;\n this.isTurn = true;\n } \n }", "ticksPerSec () {\n const dt = this.ticks - this.startTick\n return dt === 0 ? 0 : Math.round(dt * 1000 / this.ms(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resetSampleOver : PlayList > PlayList
resetSampleOver() { this.audioOver.pause() this.audioOver.currentTime = 0 }
[ "function resetPlayed() {\n for (i = 0; i < videoList.length; i++) {\n videoList[i][1] = false;\n }\n}", "sampleOver() {\n this.audioOver.play()\n this.pause()\n this.resetSong()\n this.setState({elapsedTime: 30000})\n }", "loadSampleOver() {\n const audioOver = this.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getDiffWords takes in two sentences and returns and an array of changedObjects i.e. words that are changed from the original sentences
function getDiffWords(expected, actual) { let array = JsDiff.diffWords(expected, actual); var ans = []; for (var i = 0; i < array.length; i ++) { if (!(array[i].added === undefined && array[i].removed === undefined)) { //sentences with changes ans.push(array[i]); } } return ans; }
[ "function compareChangedWords(user, exp) {\n //inputs [user] and [exp] are arrays\n let userArray = [];\n let expArray = [];\n\n user.forEach(function(data) {\n userArray.push(JSON.stringify(data));\n })\n\n exp.forEach(function(data) {\n expArray.push(JSON.stringify(data));\n })\n\n let ans = JsDiff....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Contact Form button pressed
function displayContactForm(){ if(document.querySelector('#contactBtn').querySelector('h2').textContent === 'About'){ ui.changeMainDisplayState('about'); } else{ ui.changeMainDisplayState('contact'); } }
[ "function contactForm(){\n\t\tif($('#contact-site-form .form-type-textfield.form-item-subject , #contact-site-form .form-type-textarea').hasClass(\"error\")){\t\t\n\t\t\tlocation.hash=\"contact\";\n\t\t}\n\t\t\n\t\tif($('.programme-contact-form .form-item').hasClass(\"error\")){\t\t\n\t\t\t$('.node-type-programmes ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggles node state between WALL and UNVISITED
toggleWall() { if (this.state == State.UNVISITED) { this.setState(State.WALL); } else { this.setState(State.UNVISITED); } }
[ "function toggleNight(){\n\tif (nightMode) {\n\t\tnightMode = false;\n\t} else {\n\t\tnightMode = true;\n\t}\n}", "function switchContent() {\n let nodeId= $(clickedNode).attr('id');\n let node = nodeMap.get(nodeId);\n $(clickedNode).children(\".node_inhalt\").toggleClass(\"invis\");\n if($(clickedNod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
STATION SELECTION FUNCTIONS This is the MapSelected function that actually does a lot of the legwork for the application. Basically, this function checks to see which station is selected (using jQUERY) and which year (using the radio button functions from the beginning of this code) to determine which mapping functions...
function MapSelected() { map.setZoom(11); $("#legend").show(); $("#bufferbtns").show(); if (($("#station_name").text() === "Exton") && (rb1.checked === true)) { // console.log("Someone wants to map Exton 2011!"); exton2011(); legendExton11(); retur...
[ "function showStations() {\n\n Object.keys(Hubway.stations).forEach(function(id) {\n \n var row = Hubway.stations[id];\n \n var description = '['+ id + '] ' + row.name + ', ' + row['docks'] + ' bikes'; \n var marker = addMarker(row.latitude, row.longitude, description, \"def...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Before started, build RuleEngines using vhosts configuration. The resulted _engines holds the engine of map, map domain name to engine instance. One engine may be mapped by multiple domains. If there's 1 domain, then it is the default domain.
prepare() { this._koa.use(this.mock.bind(this)); this._engines = {}; const vhostConfigs = this._config.vhosts; let amountOfDomains = 0; for (const vhostName in vhostConfigs) { const vhostConfig = vhostConfigs[vhostName]; const engine = new RuleEngine(t...
[ "_getEngines(value) {\n if (!value) {\n return null;\n }\n\n return value.split(',').map(function (item) {\n return new engineMap[item]();\n });\n }", "async _getVirtualHostsPerEnv(token) {\n\t\tthis.log('Loading virtual hosts')\n\t\tconst virtualHostsPerEnviro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a pool of bubbles with matter.js.
setupBubblePool(_numBubbles){ let numObjs = _numBubbles; for (let i = 0; i < numObjs; i++){ this.createBubble (-99,-99, Math.random()* (this.maxB-this.minB)+this.minB); // Grab this object. this.bubbles[i] = RedHen_2DPhysics. ...
[ "function generateCircles(number){\n\tfor (var i=0; i<=number;i++){\n\t\tvar circle= new CreateCircle();\n\t\tcircles.push(circle);\n\t};\n}", "function drawPool() {\n //Draws water\n strokeWeight(2);\n fill(0, 0, 100, 220);\n rect(0, height-100, width, 100);\n\n //Pool deck\n fill(242, 242, 210);\n rect(0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setup Color of all meshs of the scene
function setupNewColorsMeshs() { cubeMeshs.forEach(object => { object.children[0].children[0].material[1].color = colorScene; object.children[0].children[0].material[1].emissive = colorScene; }); torusMesh.forEach(object => { switch (countTic > 2) { case true: ...
[ "buildMaterials () {\n this._meshes.forEach((mesh) => {\n let material = mesh.material;\n\n let position = new THREE.PositionNode();\n let alpha = new THREE.FloatNode(1.0);\n let color = new THREE.ColorNode(0xEEEEEE);\n\n // Compute transformations\n material._positionVaryingNodes.f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to draw a complete route. id: Unique id of the route. route: A list of coordinates.
function drawRoute(id, route){ for(var i=0; i<route.length-1; i++){ drawSegment(id, route[i], route[i+1]); } }
[ "function drawRoute(map, route, color) {\n for (var i = 0; i < route.length; i++) {\n stop = route[i][0];\n var edge = [];\n edge.push(stop.coords);\n\n /* loop to handle forks */\n for (var j = 0; j < route[i][1].length; j++) {\n edge.push(route[i][1][j].coords)\n var path = new google.ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
we can create a blank query at the end of history if we're at the last slot, and the query there has already been run
function canCreateBlankQuery() { return (currentQueryIndex == pastQueries.length -1 && lastResult.query.trim() === pastQueries[pastQueries.length-1].query.trim() && lastResult.status != newQueryTemplate.status && !cwQueryService.executingQuery.busy); }
[ "function clearHistory() {\n // don't clear the history if existing queries are already running\n if (cwQueryService.executingQuery.busy)\n return;\n\n lastResult.copyIn(dummyResult);\n pastQueries.length = 0;\n currentQueryIndex = 0;\n\n saveStateToStorage(); // save current hi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new PredicateCondition
function PredicateCondition(actionManager,/** defines the predicate function used to validate the condition */predicate){var _this=_super.call(this,actionManager)||this;_this.predicate=predicate;return _this;}
[ "addSelectionPredicate(p) {\n this.selectionPredicates.push(p);\n }", "constructor(single = true) {\r\n \r\n // List of predicates to check\r\n this.predicates = [];\r\n \r\n // Reference single\r\n this.single = single\r\n \r\n }", "function createJoinFor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Definition of the 'getGitHub' function to get all datas of the '$userLogin' GitHub account...
async function getGitHub($userLogin) { }
[ "async function getGitHubUsers($userLogin) {\n\n\n}", "function getRepos(userHandle) {\n const searchURL = `https://api.github.com/users/${userHandle}/repos`\n \n\n fetch(searchURL)\n .then(response => {\n if (response.ok) return response.json()\n return response.json().then(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
signup method which renders the signup.hbs view
signup(request, response) { const viewData = { title: 'Sign Up', }; response.render('signup', viewData); }
[ "static sign_up(callback = null) {\n // Hide the inputs\n window.UI.hide(\"authenticate-inputs\");\n // Change the output message\n this.output(\"Hold on - Signing you up...\");\n // Send the API call\n window.API.send(\"authenticate\", \"signup\", {\n name: wind...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`_readRDFStarTail` reads the end of a nested RDF triple
_readRDFStarTail(token) { if (token.type !== '>>') return this._error(`Expected >> but got ${token.type}`, token); // Read the quad and restore the previous context const quad = this._quad(this._subject, this._predicate, this._object, this._graph || this.DEFAULTGRAPH); this._restoreContext(); // If the tr...
[ "_readRDFStarTailOrGraph(token) {\n if (token.type !== '>>') {\n // An entity means this is a quad (only allowed if not already inside a graph)\n if (this._supportsQuads && this._graph === null && (this._graph = this._readEntity(token)) !== undefined) return this._readRDFStarTail;\n return this._e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get if a test rely on AAA wcag rules
function getAAA(currentWcag) { let level = false; if (currentWcag) { dataWCAG.items.forEach(function(current){ if (current.wcag === currentWcag) { if (current.level === 'AAA') { level = true; } } }); } return level; }
[ "function bevatEenA(tekst) {\n var uitkomst = false;\n\n if (tekst.indexOf(\"a\") >= 0 || tekst.indexOf(\"A\") >= 0) {\n uitkomst = true;\n }\n\n return uitkomst;\n}", "has_ace() {\n if (this.mycards.includes(1)) return true;\n return false;\n }", "function atkTest(char, skillNum, atkNum...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ex5 Gasiti cel mai lung string intro fraza findLongestString('Wantsome is Awsomeeee today') output 'Awsomeeee'
function findLongestString(stringToFind) { let stringToSeek = stringToFind.split(" "); let longestString = stringToSeek[0]; for (let i = 0; i < stringToSeek.length; i++) { if (longestString.length < stringToSeek[i].length) { lo...
[ "function longestSentence(longString) {\n let sentencesObj = {};\n let sentenceArr = longString.split(/([.!?])/);\n\n for (let i = 0; i < sentenceArr.length; i += 2) {\n let indSentence = sentenceArr[i].trimStart().concat(sentenceArr[i + 1]);\n let wordArr = indSentence.split(\" \");\n sente...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clone an element outside the screen to safely get its height, then destroy it.
function getElementHeight (element) { var clone = element.cloneNode(true) clone.style.cssText = 'visibility: hidden; display: block; margin: -999px 0' var height = (element.parentNode.appendChild(clone)).clientHeight element.parentNode.removeChild(clone) return height }
[ "function clone(obj, addInsidePanel, $whereToPut) {\n var $obj = $(obj);\n var $newElement=null;\n \n if ( addInsidePanel ) {\n $newElement=$(\"<div></div>\");\n $newElement.append($(obj.cloneNode(true)));\n } else {\n $newElement=$(obj.cloneNode(true));\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if the slider moves, change the differenceThreshold:
function setDifference() { differenceThreshold = dSlider.value(); }
[ "function changeDelay(value){\n // Inverst slider values. Higher values on slider means lower delay\n value = 5.2 - value;\n if ( value < 1){\n newDelay = -1;\n } else {\n newDelay = Math.pow(value, 4);\n }\n \n // Stop all intervals to change delay\n stopAndClearIntervals()\n\n delay = newDelay;\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fills the box in the DOM passed as parameter with content
function fillBox (box, content) { box.html(content); }
[ "function buildBox() {\n var innerContent = getInnerContent();\n var buttons = '';\n if(curOpt.ok){\n buttons = '<div class=\\'pm-popup-buttons\\'> <button class=\\'button\\'>OK</button></div>';\n }\n var boxHtml = '<div id=\\'pm_'+curOpt.id+'\\' class=\\'pm_popup\\'><d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add an issue to the chosen issues list and refresh it.
function add_and_refresh(sel) { return chosen_issues.add_and_refresh(sel); }
[ "function saveIssue(e) \r\n{\r\n var issueDesc = document.getElementById('issueDescInput').value;\r\n var issueSeverity = document.getElementById('issueSeverityInput').value;\r\n var issueAssignedTo = document.getElementById('issueAssignedToInput').value;\r\n var issueId = chance.guid();\r\n var issueStatus = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adjust the scroll position to account for sticky header, only if the hash matches an id. This does not handle tags. Some CSS fixes those, but only for reference docs.
function offsetScrollForSticky() { // Ignore if there's no search bar (some special pages have no header) if ($("#search-container").length < 1) return; var hash = escape(location.hash.substr(1)); var $matchingElement = $("#"+hash); // Sanity check that there's an element with that ID on the page if ($matc...
[ "function scrollToHash() {\n if (window.location.hash) {\n ZUI.scrollFromHash(window.location.hash);\n }\n }", "function Scroll() {\n if (window.pageYOffset > sticky) {\n header.classList.add(\"sticky\");\n \n } else {\n header.classList.remove(\"sticky\");\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pyramid. 7 points. Write a function that draws a block pyramid, where the user specifies the side length of each block. By default, we'll draw a pyramid with a base of five blocks. Give the leftmost point of the pyramid an Xcoordinates of 10. Give the bottom of the pyramid a Ycoordinate of 10 less than the height of th...
function drawPyramid() { const canvas = document.getElementById("canvas8"); const context = canvas.getContext("2d"); context.clearRect(0, 0, canvas.width, canvas.height); let blockLength = prompt("Length:"); blockLength = Number(blockLength); if(blockLength*5+10 > canvas.width || blockLength*5+10 > canvas.h...
[ "function drawConsolePyramid(height) {\n console.log(\" \".repeat(height) + \"*\");\n for (let i = 1; i < height; i++) {\n\n console.log(\" \".repeat(height - i) + \"*\".repeat(i) + \"*\".repeat(i) + \" \".repeat(height - i));\n }\n}", "function printPyramid(height) {\n for ( var row = 1; row <= height; ro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the name of the network for a chain id
function getNetworkName(chainId) { if (chainId === CHAIN_ID_MAINNET_ETHEREUM) { return "Mainnet - Ethereum" } else if (chainId === CHAIN_ID_TESTNET_GOERLI) { return "Testnet - Goerli" } else if (chainId === CHAIN_ID_MAINNET_POLYGON) { return "Mainnet - Polygon" } else { return "....
[ "async getChainId(network){}", "mapNetworkString(networkId) {\n switch (networkId) {\n case 1: return \"Mainnet\";\n case 2: return \"Morden\";\n case 3: return \"Ropsten\";\n case 4: return \"Rinkeby\";\n case 42: return \"Kovan\";\n default: return \"Unknown Network (ID \" + net...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Task 2: Create a function called getFinals that takes `data` as an argument and returns an array of objects with only finals data
function getFinals(data) { const finals = data.filter(match => match.stage === 'final'); return finals; }
[ "async function downloadData() {\n const releases = [];\n for (const source of sourcesOfTruth) {\n\n // fetch all repos of a given organizaion/user\n const allRepos = await fetch(\n `${baseURL}/users/${source.username}/repos${auth}`\n ).then(res => res.json());\n\n // fetch releases of every repo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recursively parses the HIERACHY section of the BVH file lines: all lines of the file. lines are consumed as we go along. firstline: line containing the node type and name e.g. 'JOINT hip' list: collects a flat list of nodes returns: a BVH node including children
function readNode( lines, firstline, list ) { var node = { name: '', type: '', frames: [] }; list.push( node ); // parse node type and name var tokens = firstline.split( /[\s]+/ ); if ( tokens[ 0 ].toUpperCase() === 'END' && tokens[ 1 ].toUpperCase() === 'SITE' ) { node.type = 'ENDSITE'; nod...
[ "function WikiHieroHTML(hiero, scale, line) {\n\n\tvar wh_scale\n\tif(scale !== WH_SCALE_DEFAULT) wh_scale = scale;\n\n\tvar html = \"\"\n \n\tif(line) html += \"<hr />\\n\"\n\n\t//------------------------------------------------------------------------\n\t// Split text into block, then split block into items\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle input from the underlying xhr: either a state change, the progress event or the request being complete.
function handleProgress() { var textSoFar = xhr.responseText, newText = textSoFar.substr(numberOfCharsAlreadyGivenToCallback); /* Raise the event for new text. On older browsers, the new text is the whole response. On newer/better on...
[ "function handleRequest() {\n // debugger;\n if (myReq.readyState === XMLHttpRequest.DONE) {\n // debugger;\n // check status here and proceed\n if (myReq.status === 200) {\n // 200 means done and dusted, ready to go with the dataset!\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adjust color of all rows, depending whether it is visible or not
function adjustRowsColor(mainTable) { if(mainTable=='asns') mainTable = document.getElementById('asns'); var rows = mainTable.getElementsByTagName("tr"); var rowNumber = 0; for(var j=0; j<rows.length; j++) { if(isVisible(rows[j]))//process only visible rows { if(rowNumber%2==0) rows[...
[ "function updateRowColor()\n{\n // Re-arrange the colors\n for(j=0,k=0;;j++)\n {\n var str = 'value[' + j + '].status';\n var obj = document.getElementById(str);\n if(obj == null)\n {\n break;\n }\n if(obj.value != HIDE)\n {\n var Selec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show a hotel's detailed view
function showHotelDetails(view, hotelView) { // render the hotel details view, passing in the hotel view so details view knows where to display from and which hotel to show view.views['hotel-details'].render(hotelView); }
[ "retrieveHotel(id){\n return axios.get(`${CONST_API_URL}/showHotelDetails/${id}`);\n }", "function ViewRooms() { }", "function viewDetail(id) {\n container.style.visibility = \"visible\";\n wrapper.style.visibility = \"visible\";\n\n // room detail\n fetch(apiRoom)\n .then((response) => respons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loading the prices and number of units per product from the localStorage
function load(){ // it the web browser supports localStorage if(typeof(Storage) !== "undefined"){ var finalPrice = 0; // creating html ids for each of the product for (var i = 0; i < uniqueSes.length; i++) { var id = "nrUnits" + uniqueSes[i]; // number of units id var id_ppu = "ppu"...
[ "static getDataFromLS(){\r\n let products;\r\n if(localStorage.getItem('products') === null){\r\n products = []\r\n }else{\r\n products = JSON.parse(localStorage.getItem('products'));\r\n }\r\n return products;\r\n }", "function getOfferPrice() {\n return localStorage.getItem(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
wrapping for both directions = ((chord index + transpose amount(+1 or 1)) + 12)% 12 ((k+modeOption)+12)%12
function handleTranspose(mode) { console.log("Transpose: "+mode) let modeOption if (mode=='up') { modeOption = 1 } else if(mode=='down'){ modeOption = -1 } //walk through words and checking type chord for (let i = 0; i < words.length; i++) { let sharpFlatNote = 1 ...
[ "function getChord() {\n //get all playing keys\n var keys = document.querySelectorAll(\".key.playing\");\n\n //if less than 2 keys there is no chord, return blank\n if (keys.length < 2) {\n return \"\";\n }\n\n //get bass note (lowest playing note)\n var bass = keys[0].dataset.note;\n //get indicies of ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set key:value that will be sent as tags data with the event.
function setTag(key, value) { callOnHub('setTag', key, value); }
[ "handleUIStateChange(key, value){\n\t this.props.setPGTtabUIState({\n\t\t[key]: {$set: value}\n\t });\n\t}", "onFieldTagsKeyDown(event) {\n let me = this;\n\n if (event.key === 'Enter') {\n Neo.main.DomAccess.getAttributes({\n id : event.target.id,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates lasso selecting, expects true/false boolean value, then runs callback if any
updateLassoSelecting(newState, callback = null) { this.setState({ lassoSelecting: newState }, () => { if (callback) { callback(); } }); }
[ "function sel_change(v, check, F, objs) {\n if (v == check) {\n sel_enable_objs(F, objs);\n } else {\n sel_disable_objs(F, objs);\n }\n}", "updateHasSelectionAttribute() {\n this.choicesInstance.containerInner.element.setAttribute(\n \"data-has-selection\",\n this.hasSele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Overrides the genId method to ensure that a hero always has an id. If the heroes array is empty, the method below returns the initial number (11). if the heroes array is not empty, the method below returns the highest hero id + 1.
genId(heroes) { return heroes.length > 0 ? Math.max(...heroes.map(hero => hero.id)) + 1 : 11; }
[ "function define_id() {\n var iddef = 0;\n while ( iddef == 0 || iddef > 9999 || FIN_framework.STORYWALKERS.checkids(iddef) ) {\n iddef = Math.floor(Math.random()*10000);\n }\n return iddef;\n }", "function makeGameId(){\n let result =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the current task
get task () { return this._mem.work === undefined ? null : this._mem.work.task; }
[ "getCurrentImporterTask() {\n return this._currentImportTask;\n }", "_executeTask(task) {\n\t\tvar wp = this.idleWorkers.values().next().value;\n\t\treturn wp.invokeTask(task)\n\t}", "async function getRunningSyncTask() {\n const result = await query(`\n PREFIX ext: <http://mu.semte.ch/vocabularie...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
an alternative to registerChildWindows, trying...
function registerResultsToDefinition(objResultWindow, objChild, objParent) { try { if(objParent.childWindows) { objParent.childWindows[objParent.childWindows.length] = objChild; } else { objParent.childWindows[0] = objChild; if(!objChil...
[ "function WindowsManager () {\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * Flag to raise while the main window is open.\r\n\t\t\t * @field\r\n\t\t\t * @private\r\n\t\t\t */\r\n\t\t\tvar isMainWindowOpen = false;\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * Returns the default display options for a newly created window.\r\n\t\t\t * @me...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function returns the number of selected outputpins
function updateNumOutputpinsSelected() { var num = 0; for ( var i = 0; i < viewModel.selectedModuleOfInterest.availableOutputpinList().length; ++i) { num += viewModel.selectedModuleOfInterest.availableOutputpinList()[i].isChecked(); } viewModel.numOutputpinsSelected(num); }
[ "function getNumCandidates() {\n return numCandidates;\n } // getNumCandidates", "function getSelectedLayersCount(){\n\t\tvar res = new Number();\n\t\tvar ref = new ActionReference();\n\t\tref.putEnumerated( charIDToTypeID(\"Dcmn\"), charIDToTypeID(\"Ordn\"), charIDToTypeID(\"Trgt\") );\n\t\tvar desc = exe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fullsreen methods / Tool methods find the currently selected legend return dimension name and dimension index
_getSelected() { const option = this._getOption(); // An object like: {dimensionName: true/false} const selected = option.legend[0].selected; // _getSelected() must be called after the dataset series is set if (typeof selected !== 'object') { throw new Error('Selected is not an object.' + ...
[ "getColorLabel(colorID) {\n if (colorID in this.state.pluginData[\"Legend\"][this.state.activeEntry]) {\n return this.state.pluginData[\"Legend\"][this.state.activeEntry][colorID];\n } else {\n return null;\n }\n }", "function drawLegend() {\n var shown = buildLabels();\n var idx = 0;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to calculate total number of possible anagrams
function stringNumOfAnagrams(str) { for (idx = 0; idx < str.length; idx++) { anagramCount = (anagramCount * (idx + 1)); } return anagramCount; }
[ "function anagramCounter(arrayOfWords) {\n let sortedWords = arrayOfWords.map(word => word.split('').sort().join(''));\n let numberOfAnagrams = 0;\n\n sortedWords.forEach((word, theIndex) => {\n for (let i = theIndex + 1; i < sortedWords.length; i++) {\n if (word === sortedWords[i]) {\n numberOfAn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save a cookie for a year.
function setCookie(c_name, value) { var exdate = new Date(); exdate.setDate(exdate.getDate() + 365); var c_value = escape(value) + "; expires=" + exdate.toUTCString(); document.cookie = c_name + "=" + c_value; }
[ "function writeCookie(name, value)\n{\n var expire = \"\";\n expire = new Date((new Date()).getTime() + 24 * 365 * 3600000);\n expire = \"; expires=\" + expire.toGMTString();\n document.cookie = name + \"=\" + escape(value) + expire;\n}", "function saveYearData() {\n var year = homeControllerVM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End Helper Functions Begin Main Functions =======> main function for Add section And item in navbar
function addnewsection() { sectionNumber ++; //=======> Create Anther section let addSection = document.createElement('section'); addSection.innerHTML = ` <section id="section${sectionNumber}" class="your-active-class"> <div class="landing__container"> <h2 id=...
[ "function add_navigation_bar() {\n\tlet nav=document.createElement('nav');\n\tnav.setAttribute('id','minitoc');\n\tdocument.body.insertAdjacentElement('afterbegin',nav);\n\tlet csection=null;\n\tlet csubsection=null;\n\tfor (let slide of slides) if (slide['id']!='outline') {\n\t\tif (slide['section']) {\n\t\t\tlet ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Acquires the lock, waiting if necessary for it to become free if it is already locked. The returned promise is fulfilled once the lock is acquired. After acquiring the lock, you must call `release` when you are done with it.
acquireAsync(timeout) { if (!this._acquired) { this._acquired = true; return Promise.resolve(); } return new Promise((resolve, reject) => { // this._waitingResolvers.push(resolve); // if (timeout && timeout > 0) { // setTimeout(() => { // ...
[ "async function withLock (productId, transaction, timeout) {\n\n // if there's already a lock on this id...\n if (locks[productId]) {\n\n // and we've exhausted the timeout…\n if (timeout <= 0) {\n // throw an error\n throw new Error('Unable to acquire lock');\n }\n\n // otherwise wait 100ms...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Language: JSON Description: JSON (JavaScript Object Notation) is a lightweight datainterchange format.
function json(hljs) { const LITERALS = { literal: 'true false null' }; const ALLOWED_COMMENTS = [ hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE ]; const TYPES = [ hljs.QUOTE_STRING_MODE, hljs.C_NUMBER_MODE ]; const VALUE_CONTAINER = { end: ',', endsWithParent: true, e...
[ "function JsonDiff() {\n ;\n}", "function toJson(o) { return JSON.stringify(o); }", "function rehype2json() {\n this.Compiler = node => {\n const rootNode = getRootNode(node)\n visit(rootNode, removePositionFromNode)\n return JSON.stringify(rootNode)\n }\n}", "convertToJSON(potentialJSON) { retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Does a binary search on the timeline array and returns the nearest event index whose time is after or equal to the given time. If a time is searched before the first index in the timeline, 1 is returned. If the time is after the end, the index of the last item is returned.
_search(time, param = "time") { if (this._timeline.length === 0) { return -1; } let beginning = 0; const len = this._timeline.length; let end = len; if (len > 0 && this._timeline[len - 1][param] <= time) { return len - 1; } while (beginning < end) { // calculate the ...
[ "function findNearest(time, callback){\n for(i = 0; i < timestamps.length; i++)\n if (timestamps[i] > time){\n callback(measurments[i]);\n break;\n }\n}", "bisect(t, b) {\n const tms = t.getTime();\n const size = this.size();\n let i = b || 0;\n\n if (!size) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
==Draw A New Bot Post== 'autor' = autor as a string. 'content' = the text to be written. if autor == botAction.lastAutor the post is added to the previous one.
function drawNewPost(autor, content) { //console.log("CurrentAutor: " + botAction.currentAutor); //console.log("paramAutor: " + autor); if(botAction.lastAutor == autor && autor != ""){ var p = document.createElement('p'); p.innerHTML = escapeCharacters(content); chatBox.lastElementChild.append...
[ "function drawNewInput() {\r\n\tif(botAction.lastAutor == \"user\"){\r\n\t\t\r\n\t\tvar p = document.createElement('p');\r\n\t\tp.innerHTML = userInput.current;\r\n\t\t\r\n\t\tchatBox.lastElementChild.appendChild(p);\r\n\t\t\r\n\t} else {\r\n\t\tvar autor = botdata.characters.user;\r\n\t\t\r\n\t\tvar post = documen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creditUSRowCallback if there is no error displays returned table, updates array of amounts,and displays credit complete message if there is no error, but the session has died refreshes page if there is an error displays default error message (check ws_messages for error message) enables buttons
function creditUSRowCallback(res){ document.getElementById("mCreditUSTableDiv").style.display = ''; document.mForm.mCreditButton.disabled = false; if (!res.error && !res.value.error){ if (res.value.message == "REFRESH"){ ...
[ "function creditUSRow(row){ \n if (formatAmount(document.getElementById('amtCreditUS_'+row),'US')){\n CCT.index.creditUSRow(row,gOldUSCreditAmt[row],document.getElementById('emailCreditUS_'+row).value\n ,document.getElementById('notesCred...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Start of the Month from Monthpicker
function getMonthPickerStart(selector) { jQuery(selector).monthpicker({ showOn: "both", dateFormat: 'M yy', yearRange: 'c-5:c+10' }); }
[ "function nextStartMonth() {\n var thisMonth = new Date().getMonth();\n var nextMonth = 'Jan';\n\n if (0 <= thisMonth && thisMonth < 4) {\n nextMonth = 'May';\n } else if (4 <= thisMonth && thisMonth < 8) {\n nextMonth = 'Sep';\n }\n\n return nextMonth;\n }", "function getMonthPickerE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for postV3ProjectsIdStatusesSha
postV3ProjectsIdStatusesSha(incomingOptions, cb) { const Gitlab = require('./dist'); let defaultClient = Gitlab.ApiClient.instance; // Configure API key authorization: private_token_header let private_token_header = defaultClient.authentications['private_token_header']; private_token_header.apiKey = 'YOUR A...
[ "getV3ProjectsIdRepositoryCommitsShaStatuses(incomingOptions, cb) {\n const Gitlab = require('./dist');\nlet defaultClient = Gitlab.ApiClient.instance;\n// Configure API key authorization: private_token_header\nlet private_token_header = defaultClient.authentications['private_token_header'];\nprivate_tok...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set hotline all web
function setHotLine(hotline) { hotline = '0' + hotline; hotline = hotline.substr(0, 4) + ' ' + hotline.substr(4, 3) + ' ' + hotline.substr(7, 3); $('.hotline').html('<i class="fas fa-phone"></i> ' + hotline); $('.hotline').attr("href", `tel:${hotline}`); }
[ "function renderHotSpots() {\n config.hotSpots.forEach(renderHotSpot);\n}", "function launchAutolinkConfig(){\n\t\n\t\n\t\n\t\n}", "static warmConnections() {\n if (this.preconnected) return;\n\n // The iframe document and most of its subresources come right off youtube.com\n this.addPrefetch('preco...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the translation as HTML nodes from the given source message.
get(srcMsg) { const html = this._i18nToHtml.convert(srcMsg); if (html.errors.length) { throw new Error(html.errors.join('\n')); } return html.nodes; }
[ "static parseHTML( content, target, messages ){\n\n let search = function( node, map ){\n let children = node.children;\n for( let i = 0; i< children.length; i++ ){\n if( children[i].id ) map[children[i].id] = children[i];\n if( messages ){\n [\"title\", \"placeholder\"].forEach(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
readonly attribute calIDateTime reminderDueBy;
get reminderDueBy() { return this._reminderDueBy; }
[ "get reminderSignalTime()\n\t{\n\t\treturn this._reminderSignalTime;\n\t}", "get dateTimeReceived()\n\t{\n\t\treturn this._dateTimeReceived;\n\t}", "get reminderMinutesBeforeStart()\n\t{\n\t\treturn this._reminderMinutesBeforeStart;\n\t}", "registerReminder() {\n const delayInMs = this.state.reminderDe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Injects SVGs so sprites work on older browsers
function injectSVGs() { var mySVGsToInject = document.querySelectorAll('img.iconic-sprite'); SVGInjector(mySVGsToInject); }
[ "function spriteSVGs() {\n\tvar svgSpriteConfig = {\n\t\t\tmode: {\n\t\t\t\tcss: false,\n\t\t\t\tsymbol: {\n\t\t\t\t\tdest: paths.images.dest\n\t\t\t\t}\n\t\t\t},\n\t\t\tshape: {\n\t\t\t\tdimension: {\n\t\t\t\t\tprecision: -1,\n\t\t\t\t},\n\t\t\t\ttransform: [\n\t\t\t\t\t{\n\t\t\t\t\t\tsvgo: {removeViewBox: false}\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mostrar todos los objetos de JSON y sus propiedades.
function mostrarObjetos(json){ var out="----------------------------Estudiantes----------------------------<br>"; for (var i = 0; i < json.length; i++) { out+="Nombre: "+json[i].nombre+" - "+"Codigo: "+json[i].codigo+ " - " +"Nota: "+json[i].nota+" <br> "; } document.getElementById("infoEstudiantes")....
[ "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 AjoutProduit() {\n\n let product = {\n \"name\": document.getElementById(\"addNa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
carga hacemos la transaccion al code behind por medio de Ajax para cargar el droplist
function transacionAjax_CState(State) { $.ajax({ url: "UsuarioAjax.aspx", type: "POST", //crear json data: { "action": State, "tabla": 'USUARIOS' }, //Transaccion Ajax en proceso success: function (result) { if (result == "") { ...
[ "function loadAllDropDownListAtStart(){\n\t\t//load vào ddl customer\n\t\t$.ajax({\n \t\tdataType: \"json\",\n\t\t\ttype: 'GET',\n\t\t\tdata:{},\n\t\t\tcontentType: \"application/json\",\n\t\t\turl: \"/Chori/customer/list\",\n\t\t\tsuccess: function(data){\n\t\t\t\tif(data.status == \"ok\"){\n\t\t\t\t\t$.each( d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to print out the stops based on the selected route, called by eventlistener
function printStops(){ InsertText("mainContent",""); let currentDropdownValue = document.getElementById("dropdown").value; if (currentDropdownValue !== ""){ //check that a not default value is selected (otherwise leave blank) //first, need the route id let routeNum = 0; Object.entries(routes).forEa...
[ "function showRoute(itiStructure, day) {\r\n\thideSightDetail();\r\n\tvar stopsArr = [];\r\n\tvar stops = itiStructure.stops;\r\n clearSight();\r\n setMarkers(itiStructure,day);\r\n\tif (day == 0) {\r\n\t\tfor (var i in stops) {\r\n\t\t\tfor (var p in stops[i])\r\n\t\t\t\tstopsArr.push(stops[i][p]);\r\n\t\t}\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the zerobased bit number of the highestorder bit with the given value in the given buffer. If the buffer consists entirely of the other bit value, then this returns `1`.
function highOrder(bit, buffer) { var length = buffer.length; var fullyWrongByte = (bit ^ 1) * 0xff; // the other-bit extended to a full byte while (length > 0 && buffer[length - 1] === fullyWrongByte) { length--; } if (length === 0) { // Degenerate case. The buffer consists entirely of ~bit. re...
[ "function maxBit(word) {\n if (word == null)\n return -1;\n word = word | 0; // This is not just a JIT hint: clears the high bits\n var mask = singleBitMask(31);\n var result = 31;\n while (result >= 0 && ((mask & word) !...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SELECT `profile`.guid, f2.`status` AS followed_status, f2.blocked, `profile`.`username`, profile.`fullname`, profile.followers, profile.following, user_metrics.popularity, `profile`.`verified`, profile.is_private, profile.about, profile.domain, `profile`.image_url AS image_url, `profile`.allow_view_followers, `profile`...
function getUsersFollowers(fguid, guid, lastUsername) { var query = "SELECT `profile`.guid, f2.`status` AS followed_status, f2.blocked, `profile`.`username`, profile.`fullname`, profile.followers, profile.following, user_metrics.popularity, `profile`.`verified`, profile.is_private, profile.about, profile.doma...
[ "function getUsersFollowings(fguid, guid, lastUsername) {\n\n var query = \"SELECT `profile`.guid , f2.`status` AS followed_status, f2.blocked, `profile`.`username`, profile.`fullname`, profile.followers, profile.following, user_metrics.popularity, `profile`.`verified`, profile.is_private, profile.about, p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds route for situations where one of end is inside the other. Typically the route is conduct outside the outer element first and let go back to the inner element.
function insideElement(from, to, fromBBox, toBBox, brng) { var route = {}; var bndry = expand(boundary(fromBBox, toBBox), 1); // start from the point which is closer to the boundary var reversed = bndry.center().distance(to) > bndry.center().distance(from); var start = reversed...
[ "function findRoute(start, end, map, opt) {\n\n var step = opt.step;\n var startPoints, endPoints;\n var startCenter, endCenter;\n\n // set of points we start pathfinding from\n if (start instanceof g.rect) {\n startPoints = getRectPoints(start, opt.startDirections, opt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API for updating the styleRules in an existing page stylesheet across all components. Takes a sheet index value obtained via addPageStyles.
function updatePageStyles(sheetIndex, styleRules, restorePlace) { return changingStylesheet(function () { p.stylesheets[sheetIndex] = styleRules; if (typeof styleRules.join == "function") { styleRules = styleRules.join("\n"); } var i = 0, cmpt = null; while (cmpt = p.reader.do...
[ "function addPageStyles(styleRules, restorePlace) {\n return changingStylesheet(function () {\n p.stylesheets.push(styleRules);\n var sheetIndex = p.stylesheets.length - 1;\n\n var i = 0, cmpt = null;\n while (cmpt = p.reader.dom.find('component', i++)) {\n addPageStylesheet(cmpt.conte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method takes an array of statements nodes and then explodes it into expressions. This method retains completion records which is extremely important to retain original semantics.
function replaceExpressionWithStatements(nodes) { this.resync(); var toSequenceExpression = t.toSequenceExpression(nodes, this.scope); if (t.isSequenceExpression(toSequenceExpression)) { var exprs = toSequenceExpression.expressions; if (exprs.length >= 2 && this.parentPath.isExpressionStatement())...
[ "visitSeq_of_statements(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitExprlist(ctx) {\r\n console.log(\"visitExprlist\");\r\n let exprlist = [];\r\n for (var i = 0; i < ctx.star_expr().length; i++) {\r\n exprlist.push(this.visit(ctx.star_expr(i)));\r\n }\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
member function hitCeiling(ypos) applies a collision between the player and a ceiling params: pos:Number the yposition of the ceiling
hitCeiling(ypos){ if(this.vel.y > 0) return; this.pos.y = ypos + this.getCol().size.y / 2 + .01; this.vel.y = 0; this.onCeil = true; }
[ "hitGround(ypos){\n\t\t//console.log(this.vel);\n\t\t//console.log(this.pos.x);\n\t\tif(Math.abs(this.vel.y) > 2)\n\t\t\tsfx_enemybump.play();\n\t\tthis.pos.y = ypos - this.getCol().size.y / 2;\n\t\tthis.vel.y = -this.bounceFriction * Math.abs(this.vel.y);\n\t\tif(!this.seeking)\n\t\t\tthis.mov = Math.PI / -2;\n\t}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
like bake, but doesn't save new tags the name isn't descriptive, but: (1) I didn't want to complicate the signature of bake() with optional params (2) you come up with a name that isn't half a sentence findOrMake vs. findOrCreate?
static async fry(name, db) { db = db || Model.__db; const existing = await Tag_1.byName(name, db); if (existing) return existing; await NoneReady; const tag = new Tag_1(name, TagCategory.None); tag._db = db; return tag; }
[ "function saveTags(id, tags) {\n tags = tags.trim().split(\",\") //turn comma separated list into array\n tags.forEach(tag => {\n insert_tag.run(tag.trim()) //create tag if it doesn't exist\n insert_docTag.run(id, tag) //add tag to document\n });\n}", "function wrap( make, options ) {\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
D(name,registrar): Create a DNS Domain. Use the parameters as records and mods.
function D(name,registrar) { var domain = newDomain(name,registrar); for (var i = 0; i< defaultArgs.length; i++){ processDargs(defaultArgs[i],domain) } for (var i = 2; i<arguments.length; i++) { var m = arguments[i]; processDargs(m, domain) } conf.domains.push(domain) }
[ "function createDomainObject(domainName) {\n return { name: domainName, count: 1 };\n}", "createDomainSecDnsExtension(data) {\n var config = this.config;\n var namespace = config.namespaces.DNSSEC.xmlns;\n var secCreate = {\n \"_attr\": {\n \"xmlns:secDNS\": namespace\n }\n };\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set up change listener when DateField is available. Not in dateField config to enable users to supply their own listeners block there
updateDateField(dateField) { const me = this; dateField.on({ change({ userAction, value }) { if (userAction && !me.$isInternalChange) { me._isUserAction = true; me.value = value; me._isUserAction = false; ...
[ "function fieldChanged(type, name, linenum) {\r\n\t\r\n\tsetStatusSetDate(name);\r\n\t\r\n}", "function setDateHandlers(field){\n \n $(field).on({\n \n // On focus...\n \n 'focus': function(event){\n \n // Remove validation\n \n $(this)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Activate or deactivate tag via AJAX
function activateDeactive(id, status) { $.simpleAjax({ crud: "Etiquetas", type: "GET", url: $("#DATA").data("url") + `/tags/setStatus/${id}/${status}`, form: "", loadingSelector: ".panel", successCallback: function (data) { ...
[ "function setInactiveUser() {\r\r\n jQuery.post(\r\r\n swapchic_ajax.ajax_url,\r\r\n {\r\r\n 'action': 'ajaxSetInactiveUser'\r\r\n },\r\r\n function(){\r\r\n\r\r\n }\r\r\n );\r\r\n}", "function indicateSelectedTag(tag) {\n clearSelectedTags();\n tag.classL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns Bootstrap classnames from `size` and validation props, along with passthrough props.
function propsWithBsClassName(_ref) { var className = _ref.className, isInvalid = _ref.isInvalid, isValid = _ref.isValid, size = _ref.size, props = _objectWithoutProperties(_ref, _excluded$d); return _objectSpread2(_objectSpread2({}, props), {}, { className: cx('form-contr...
[ "sizingClasses(oldOptions) {\n if (oldOptions.size !== this.size) {\n return [\"sizing\", \"reset-size\" + oldOptions.size, \"size\" + this.size];\n } else {\n return [];\n }\n }", "generateSizes(props) {\n const srcset = props.srcset.sort(sortBy('width'));\n let ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the king stands on a threatened field
checkKingsStatus(player){ let tile = this.boardMatrix[player.figureList.King[0].positionY][player.figureList.King[0].positionX]; for(let threat of tile.threatenedBy){ if(player.number !== threat.team) return true; } return false; }
[ "isWeakerThan(hand) {\n // ˅\n return this.judgeGame(hand) === -1;\n // ˄\n }", "shouldQuarantine() {\n if (this.passengers.find(passenger =>\n passenger.isHealthy === false )) {\n return true\n } else {\n return false\n }\n }", "i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_____________________________________________________________________// This function gets the first index of x values that corresponds to an x valuer greater than x passed, starting from i index _____________________________________________________________________
function FSS_GetSuperiorIndexOfXValue(i, x) { var j, n; // j = i; n = this.coordX.length; //post("Function GetSuperiorIndexOfXValue i = ", i, " x = ", x, "\n"); while ((this.coordX[j] < x) && (j < n)) { j += 1; //post("j=", j, "\n"); } if (j == n) { return (n-1); } else { if (this.coordX[j] > x) ...
[ "function findIndexes (a, v) {\n var upper = _.findIndex(a,function(o) { return o > v});\n if ( upper === 0 ) {\n return [ upper, upper];\n } else if ( upper === -1) {\n return [ a.length-1, a.length-1];\n } \n return [ upper-1, upper];\n }", "function frogRiverOne(arr, x) {\n let map ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Answers the question: can the cell (i,j) in the puzzle contain the number in cell "c"
function canBeA(puzzle, i, j, c) { var x = Math.floor(c / 9); var y = c % 9; var value = puzzle[x][y]; if (puzzle[i][j] === value) return true; if (puzzle[i][j] > 0) return false; // if not the cell itself, and the mth cell of the group contains the value v, then "no" // eslint-disable-next-line guard-for...
[ "function colCheck(puzzle) {\n for (var c = 0; c < puzzle.length; c++) {\n if(checkColumn(puzzle,c) == false) return false;\n }\n return true;\n}", "function Check3Cells(RowA, ColA, RowB, ColB, RowC, ColC) {\n\n // Check if all cells are taken by ActivePlayer\n if ($scope.Board[RowA]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registro de los slides por numero. / SlideWindow Constructor / p_xo = Coordenada X en pixels. p_yo = Coordenada Y en pixels. p_hgt = Altura en pixels. p_wth = Ancho X en pixels. p_to = Timeout en segundos
function SlideWindow(name, url, p_wth, p_hgt, p_to) { this.base = AbstractWindow; this.base(url, 0, 0, p_wth, 1); /* Atributes */ this.name = name; this.timeOut = p_to * 1000 || 15000; //TimeOut this.yoEnd; //Ending move coordinate this.xoEnd; //Ending move coordinate this.process = -1; //Generic proces...
[ "function slideWindow() {\n ++windowSb;\n ++windowSm;\n\n if (Number(windowSm) >= Number(totalFrames)) {\n windowSm = totalFrames - 1;\n return; // Done\n }\n\n windowPanel.animate({\n left: sfSlots[windowSb].position().left + 2\n }, 50);\n sendInfoFrame(windowSm); //After ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Randomizes bot's shield swaps.
_randomizeBotShield() { if (random(0, 100) < 1 && !this._bot.shield.isActive) this._bot.shield._swapShield(); }
[ "shuffle() {\r\n for (let i = 0; i < this.len(); i++) {\r\n this.swap(\r\n this.getLinkByPosition(\r\n Math.floor(Math.random() * (window.innerWidth - 10)),\r\n Math.floor(Math.random() * (window.innerHeight - 10))\r\n ),\r\n this.getLinkByPosition(\r\n Math.f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates news array depending on whether there is a search filter or not
updateNews(state, [payload, type]) { // Empty the contry news array if there is a new search parameter if (type && type !== state.newsType && type.trim() !== 'covid19') { state.newsInCountry = []; } // Stores value of the search paramter in the store state.newsType = type && type.trim(); /...
[ "function updateFilter()\r\n\t{\r\n\t\tvar activeCount = filterBox.find(\"input[type=checkbox]\").filter(\":checked\").length;\r\n\r\n\t\tif (activeCount == 0)\r\n\t\t{\r\n\t\t\ttoys.show();\r\n\t\t\tupdateStatus();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\ttoys.show();\r\n\r\n\t\t\r\n\t\ttoys.each(function(index, t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the node corresponding to this statement, or creates a new one if one does not exist yet.
_getOrAddNode($stmt, create, forceNodeType) { const _create = create ?? false; let node = this.#nodes.get($stmt.astId); // If there is not yet a node for this statement, create if (node === undefined && _create) { const nodeType = forceNodeType ?? CfgUtils.getNodeType($stmt); const nodeId =...
[ "addNode(n) {\n if (!this.getNode(n)) {\n const tempNode = node.create({ name: n });\n const clone = this.nodes.slice(0);\n clone.push(tempNode);\n this.nodes = clone;\n\n return tempNode;\n }\n\n return null;\n }", "getOrNode() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find the bext score and the move to make, by traversing down each node to check the score. note that the lower the score, the better it is for black.
dftraverse(){ //callback is a function to be used when you either reached the last node, or exhaust all the previous (function recurse(currentnode,alpha,beta){ //apply aplha beta pruning here. /** * alpha for white, beta for black */ if(!cur...
[ "__score(){\n this.p1Score = 0;\n this.p2Score = 0;\n\n //Will be Used to Track Which Spaces Have Been Checked\n var visited = new GameBoard(this.size);\n\n for(var row = 0; row < this.size; row++){\n for(var col = 0; col < this.size; col++){\n var hasBla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add/remove mouseout event to the element
add_out(func) { this.add_event("mouseout", func); }
[ "onElementMouseOut(event) {\n super.onElementMouseOut(event);\n\n const me = this;\n\n // We must be over the event bar\n if (event.target.closest(me.eventInnerSelector) && me.resolveTimeSpanRecord(event.target) && me.hoveredEventNode) {\n // out to child shouldn't count...\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates both placesForItinerary and markerPositions by array at once method for itinerary
updateItineraryAndMapByArray(places){ let newMarkerPositions = []; this.setState({placesForItinerary: places}); places.map((place) => newMarkerPositions.push(L.latLng(parseFloat(place.latitude), parseFloat(place.longitude)))); this.setState({markerPositions: newMarkerPositions}); ...
[ "function updateMarkers(jsonData) {\n // For DEMO purpose, randomly generates base employee number for each office\n // let boston = (Math.floor(Math.random() * 10) + 1);\n // let sanfran = (Math.floor(Math.random() * 10) + 1);\n // let orlando = (Math.floor(Math.random() * 10) + 1);\n // let chicago = (Math.f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
validates that media was flowing in given rooms.
async function validateMediaFlow(room) { const testTimeMS = 6000; // wait for some time. await new Promise(resolve => setTimeout(resolve, testTimeMS)); // get StatsReports. const statsBefore = await room.getStats(); const bytesReceivedBefore = getTotalBytesReceived(statsBefore); // wait for some more ti...
[ "function check_room_winners(turn)\n{\n for(var room in room_winner)\n {\n //check for rooms that dont already have a winner\n if(room_winner[room]==0)\n {\n var lines_complete = 0; \n var temp_room = rooms[room];\n for(var key in temp_room)\n {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mark the field as touched
_markAsTouched() { this._onTouched(); this._changeDetectorRef.markForCheck(); this.stateChanges.next(); }
[ "fieldTouched(id) {\n const {allFieldsStatus} = this.state;\n allFieldsStatus[id] = true;\n this.setState({allFieldsStatus});\n }", "handleBlur() {\n this._focussed = false;\n }", "function fieldRendered(field){\n\t\t// will fire change immediately, no waiting for blur\n\t\tfield.el.on(\"cha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ADD DOM NODES Each DOM node has an "index" assigned in order of traversal. It is important to minimize our crawl over the actual DOM, so these indexes (along with the descendantsCount of virtual nodes) let us skip touching entire subtrees of the DOM if we know there are no patches there.
function _VirtualDom_addDomNodes(domNode, vNode, patches, eventNode) { _VirtualDom_addDomNodesHelp(domNode, vNode, patches, 0, 0, vNode.b, eventNode); }
[ "function findAndAdd(n, matches) {\n\tif (! n || ! n.parentNode) return;\n\tif (! matches) matches = function(n) { return true; };\n\tvar df = document.createDocumentFragment();\n\tcollectNodes(n, matches, df);\n\t// for (var i=0; i<df.childNodes.length; i++) {\n\t//\tconsole.log(df.childNodes[i]);\n\t// }\n\tn.par...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
data Maybe x = Nothing | Just x
function Maybe(value){ this.value = value; }
[ "function maybe_6(b) /* (b : bool) -> maybe<()> */ {\n return (b) ? Just(_unit_) : Nothing;\n}", "function maybe_7(i) /* (i : int) -> maybe<int> */ {\n return ($std_core._int_eq(i,0)) ? Nothing : Just(i);\n}", "function maybe_3(m, nothing) /* forall<a> (m : maybe<a>, nothing : a) -> a */ {\n return $defau...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to open the Preview Modal
function openPreview(name, url){ console.log(name, url); var modal = '<div class="modal fade" id="bookPreview" tabindex="-1" role="dialog" aria-labelledby="bookPreviewLabel" aria-hidden="true">' + '<div class="modal-dialog" role="document">' + '<div class="modal-content">' + '<div class="mod...
[ "function displayBlob() {\n $('#modalBlob').modal('show');\n}", "function showPreview(index)\r\n {\r\n var $window = $(window);\r\n\r\n // get a element\r\n var a = $previews.eq(index).find(\"a\");\r\n var aTop = a.offset().top;\r\n var centerTop = $w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
r2owebviewclose Directive Its an attribute directive. When this directive is used as an attribute to an element, the click on the element will close the webview overlay
function r2oWebviewClose(){ return { restrict : "A", link: function(scope, element, attrs){ element.on('click', function(){ window.shopWebViewOverlay.close(); }); } }; }
[ "_closeModel() {\n this._model.querySelector('.close').addEventListener('click', e => {\n this._hideModel();\n });\n }", "function addCloseButtonFunctionality(){\n\t\t\t\n\t\t\t\n\t\t}", "function customOverlayClose() {\n $('.ui-widget-overlay').show().css('height', (2 * $window.height()) + 'px');\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function name : validateAdsAddPageForm Return type : bollean Date created : 28th February 2008 Date last modified : 28th February 2008 Author : Sandeep Kumar Last modified by : Sandeep Kumar Comments : This function is used to validate the CMS form. User instruction : validateAdsAddPageForm(formname)
function validateAdsAddPageForm(formname,isimage) { var frmAdType = $("#"+formname+" input[type='radio']:checked").val(); if(frmAdType=='html'){ if($('#frmTitle').val() == ''){ alert(TIT_REQ); $('#frmTitle').focus() return false; }else if($('#frmHtmlCode'...
[ "function validateCMSAddPageForm(formname)\n{\n \n if($('#frmDisplayPageTitle').val() == '')\n {\n alert(PAGE_DISP_TITLE);\n $('#frmDisplayPageTitle').focus()\n return false;\n }\n if($('#frmPageTitle').val() == '')\n {\n alert(PAGE_TIT_REQ);\n $('#frmPageTitle')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }