Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Helper functions This function removes the need to type document.getElementById(); each time an id is called.
function id(id) { return document.getElementById(id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function byId(id){return document.getElementById(id);}", "function getId(id) {\n return document.getElementById(id);\n}", "function getId(id) {\n return document.getElementById(id);\n}", "function getId(id) {\n return document.getElementById(id);\n}", "i(id) { return document.getElementById(id); }...
[ "0.7230794", "0.7195282", "0.7195282", "0.7195282", "0.71203136", "0.71187323", "0.71187323", "0.71187323", "0.7088885", "0.7088885", "0.7088885", "0.7085789", "0.70806384", "0.7065576", "0.70650226", "0.70460844", "0.70460844", "0.70377696", "0.70325935", "0.70021904", "0.70...
0.70324916
21
This function removes the need to type document.querySelector(); each time an id is called.
function qs(selector) { return document.querySelector(selector); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selector(){\n return document.querySelector();\n}", "getElementById(id) {\n return this.root.querySelector(`#${id}`);\n }", "function vanillaQuerySelection(selector) {\n var selectorType = 'querySelectorAll'; //will return a nodelist\n //check to see if we are checking an id\n if (sele...
[ "0.65630764", "0.65235627", "0.6360703", "0.6325721", "0.6320832", "0.6313601", "0.6204479", "0.61418307", "0.61213535", "0.6116908", "0.6092103", "0.6090684", "0.6075249", "0.6042237", "0.60018903", "0.59609", "0.59358275", "0.59323806", "0.59323806", "0.59292054", "0.592246...
0.58477813
26
This function removes the need to type document.querySelectorAll(); each time an id is called.
function qsa(selector) { return document.querySelectorAll(selector); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function qAll (selector) {\n return document.querySelectorAll(selector)\n}", "function __( el )\n{\n return document.querySelectorAll( el );\n}", "queryAll(target) {\n return document.querySelectorAll(target);\n }", "function querySelectorAll(){\n\t\tvar result = document.querySelectorAll.apply(doc...
[ "0.6579155", "0.65670496", "0.6527484", "0.65248483", "0.6501562", "0.6495536", "0.6412673", "0.62422484", "0.6200044", "0.61949754", "0.61926895", "0.61649126", "0.6141686", "0.6139477", "0.6139477", "0.6046425", "0.5984896", "0.5962059", "0.5961121", "0.58919567", "0.587314...
0.6432666
6
NOTE: Chose a name that won't conflict with Dock APIs
doPanelResize(forConfigHeight: boolean = false) { const paneContainer = getPaneContainer(this) let minimumHeight: number | null = null const paneContainerView = atom.views.getView(paneContainer) if (paneContainerView && this.alwaysTakeMinimumSpace) { // NOTE: Super horrible hack but the only possible way I could find :(( const dockNamesElement = paneContainerView.querySelector('.list-inline.tab-bar.inset-panel') const dockNamesRects = dockNamesElement ? dockNamesElement.getClientRects()[0] : null const tableElement = this.element.querySelector('table') const panelRects = tableElement ? tableElement.getClientRects()[0] : null if (dockNamesRects && panelRects) { minimumHeight = dockNamesRects.height + panelRects.height + 1 } } if (paneContainer) { let updateConfigHeight: number | null = null const heightSet = minimumHeight !== null && !forConfigHeight ? Math.min(minimumHeight, this.panelHeight) : this.panelHeight // Person resized the panel, save new resized value to config if (this.lastSetPaneHeight !== null && paneContainer.state.size !== this.lastSetPaneHeight && !forConfigHeight) { updateConfigHeight = paneContainer.state.size } this.lastSetPaneHeight = heightSet paneContainer.state.size = heightSet paneContainer.render(paneContainer.state) if (updateConfigHeight !== null) { atom.config.set('linter-ui-default.panelHeight', updateConfigHeight) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "startDock () {\n let div = this.getTemplate('Dock')\n const dock = require('./Dock/app')\n this.container.appendChild(div)\n dock(div, this)\n }", "function CheckDock() {\r\n if (!System.Gadget.docked) {\r\n GadgetUndocked();\r\n }\r\n else if (System.Gadget.docked) {\r\n Gadg...
[ "0.6116197", "0.5583567", "0.52320886", "0.51720303", "0.50785357", "0.5050233", "0.5046708", "0.49977982", "0.49731806", "0.49692076", "0.4963501", "0.49606463", "0.49089667", "0.48922408", "0.48866382", "0.48860103", "0.4874684", "0.48719588", "0.4869541", "0.4867925", "0.4...
0.0
-1
gets the score object from the given array of scores which matches the given site (using idx as a hint to its position in the array)
function getScoreForSite(scores, site, idx, suppressWarnings) { var score = (scores.length > idx) && scores[idx]; // <-- attempt to shortcut the full ID search if (!score || (score.site && score.site.id !== site.id)) { // try to find this score the hard way... (may be time consuming for our supported edge case of using many sites) var filteredScores = scores.filter(function (s) { return s.site.id === site.id; }); score = filteredScores.length && filteredScores[0]; // perform some logging etc. if (console && console.warn && !suppressWarnings) console.warn("Warning: score for site ID='" + site.id + (score ? "' missing from score line." : "' misaligned in score line ID='" + (score.scoreLine && score.scoreLine.id) + "'")); if (console && console.assert) console.assert(filteredScores.length <= 1, "Warning: score line holds duplicate scores for site ID='" + site.id + "'"); } return score; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function matchScores(scores) {\n for (var i = 0; i < friends.length; i++) {\n var sum = 0;\n var friendObj = {}\n for (var j = 0; j < scores.length; j++) {\n var diff = Math.abs(scores[j] - friends[i].scores[j]);\n sum = sum + diff\n }\n friendObj.name = ...
[ "0.53796405", "0.5233002", "0.52246755", "0.5218862", "0.5207679", "0.50359184", "0.50023746", "0.49572986", "0.49459767", "0.49054995", "0.4896929", "0.48760548", "0.4756485", "0.47386423", "0.47078282", "0.47055444", "0.4701539", "0.46907872", "0.46901754", "0.46850714", "0...
0.7488207
0
this is for the grid.column header context menu.
function showHeaderCTMenu(xy, site) { if (console && console.assert) console.assert(!!site, "Warning: couldn't find site for header context menu."); var headerCtContext = Ext.create("Ext.menu.Menu", { items: [Ext.create("Ext.menu.Item", { text: "Zoom to " + site.name, iconCls: "x-zoomin-menu-icon", handler: function () { pvMapper.map.zoomToExtent(site.geometry.bounds, false); } }), Ext.create("Ext.menu.Item", { text: "Zoom to project", iconCls: "x-zoomout-menu-icon", handler: function () { pvMapper.map.zoomToExtent(pvMapper.siteLayer.getDataExtent(), false); } }), Ext.create("Ext.menu.Separator", { }), Ext.create("Ext.menu.Item", { text: "Delete " + site.name, iconCls: "x-delete-menu-icon", handler: function () { Ext.MessageBox.confirm('Confirm', "Are you sure you want to delete site '" + site.name + "'?", function (btn) { if (btn === "yes") { // unselect all features first (at present, this causes a PUT to the database if a feature was selected) // if this isn't done, there will be artifacts left on the map after deleting the selected site(s). // Note that this also removes any sketch features from the feature layer (ie, siteLayer.features.length may decrease !) pvMapper.unselectAllSites(); pvMapper.deleteSite(site.id) .done(function () { pvMapper.siteManager.removeSite(site); pvMapper.siteLayer.removeFeatures([site.feature], { silent: true }); site.feature.destroy(); }) .fail(function () { if (console && console.log) console.log('failed to delete site "' + site.name + '" with id "' + site.id + '"'); }); } }); } }) ] }); headerCtContext.showAt(xy); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onElementContextMenu(event) {\n const me = this,\n grid = me.grid,\n target = event.target,\n header = DomHelper.up(target, '.b-grid-header'),\n cellData = grid.getEventData(event);\n\n if (header) {\n me.handleHeaderContextMenu(header, event);\n } else if (cellData) {\n me.h...
[ "0.73301166", "0.713453", "0.67230576", "0.6696722", "0.6586558", "0.6557774", "0.65412843", "0.62923837", "0.6245584", "0.6171987", "0.61716217", "0.61716217", "0.6161841", "0.61477107", "0.6147314", "0.6122462", "0.6084816", "0.60788167", "0.6035188", "0.60125405", "0.60011...
0.60392714
18
This function populates the infowindow when the marker is clicked. We'll only allow one infowindow which will open at the marker that is clicked, and populate based on that markers position.
function populateInfoWindow(marker, location) { var infowindow = new google.maps.InfoWindow(); marker.setAnimation(4); // Check to make sure the infowindow is not already opened on this marker. if (infowindow.marker != marker) { infowindow.marker = marker; // create the URL to call the NYT API let nytURL = 'https://api.nytimes.com/svc/search/v2/articlesearch.json?q='+ marker.title + ' Chicago&sort=relevance&api-key='+ nytKey; $.getJSON( nytURL, function( data ) { var item = data.response.docs[0]; web_url = item.web_url; // set the content in the info window to show the marker title // and the returned article in a hyperlink from NYT infowindow.setContent('<div>' + marker.title + '</br><strong>URL: </strong><a href="' + web_url + '">Website</a></div>'); marker.Animation infowindow.open(map, marker); // Make sure the marker property is cleared if the infowindow is closed. }).error(function() { // if there is no data returned from the NYT API, then the marker's info // window is still set, but it will obnly display the marker title. infowindow.setContent('<div>' + marker.title + '</br><p>Failed to load data from New York Times</p></div>'); infowindow.open(map, marker); }); infowindow.addListener('closeclick', function() { infowindow.marker = null; }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function populateInfoWindow(marker, infowindow) {\n if (infowindow.marker != marker) {\n infowindow.marker = marker;\n infoWindow.setContent(marker.content);\n infowindow.addListener('closeclick', function() {\n infowindow.marker = null;\n });\n }\n //Bugfix: Moved out of if condition...
[ "0.7699787", "0.74777484", "0.7476246", "0.7436148", "0.7379326", "0.737769", "0.7361874", "0.7355019", "0.73415095", "0.7331031", "0.7319202", "0.7299543", "0.7272363", "0.7251689", "0.72497666", "0.72357625", "0.72230864", "0.7203617", "0.719979", "0.7199142", "0.71949565",...
0.0
-1
Check Web Audio API Support
function download(audio) { try { // More info at http://caniuse.com/#feat=audio-api window.AudioContext = window.AudioContext || window.webkitAudioContext; audio.context = new window.AudioContext(); } catch (e) { audio.proceed = false; alert('Web Audio API not supported in this browser.'); } if (audio.proceed) { //--------------- // Compatibility //--------------- // (function () { let start = 'start'; let stop = 'stop'; const buffer = audio.context.createBufferSource(); if (typeof buffer.start !== 'function') { start = 'noteOn'; } audio.compatibility.start = start; if (typeof buffer.stop !== 'function') { stop = 'noteOff'; } audio.compatibility.stop = stop; // }()); //------------------------------- // Setup Audio Files and Buttons //------------------------------- for (const a in audio.files) { // (function () { const i = parseInt(a) + 1; const req = new XMLHttpRequest(); req.open('GET', audio.files[i - 1], true); // array starts with 0 hence the -1 // req.withCredentials = true; req.responseType = 'arraybuffer'; console.log('Making the requests'); req.onload = () => { audio.context.decodeAudioData( req.response, (buffer) => { audio.buffer[i] = buffer; audio.source_loop[i] = {}; audio.source_loop[i]._playing = false; console.log('Got a response'); // var button = document.getElementById('button-loop-' + i); // button.addEventListener('click', function(e) { // e.preventDefault(); // audio.play(this.value); // }); }, () => { console.log(`Error decoding audio "${audio.files[i - 1]}".`); }, ); }; req.send(); // }()); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hasAudioSupport() {\n var audioPlayer = document.getElementById('player');\n return !!(audioPlayer.canPlayType && (audioPlayer\n\t .canPlayType('audio/mpeg;').replace(/no/, '') || audioPlayer\n\t .canPlayType('audio/ogg;').replace(/no/, '')));\n}", "function getAudioSupport()\n {\n ...
[ "0.7307509", "0.72327375", "0.7165349", "0.7005517", "0.7005008", "0.6648073", "0.6538318", "0.65136594", "0.65120363", "0.64275885", "0.63588065", "0.63281906", "0.6324988", "0.63052654", "0.6290612", "0.62620616", "0.6240676", "0.62156004", "0.61698806", "0.61417586", "0.61...
0.0
-1
START HOWLER Sound related function
function crossfadedLoop(enteringInstance, leavingInstance, soundLevel) { const volume = soundLevel; const crossfadeDuration = 1000; // Get the sound duration in ms from the Howler engine const soundDuration = Math.floor(enteringInstance._duration * 1000); // Fade in entering instance const audio = enteringInstance.pos(10).play(); enteringInstance.fade(0, volume, crossfadeDuration); // Wait for the audio end to fade out entering instance // white fading in leaving instance setTimeout(() => { enteringInstance.fade(volume, 0, crossfadeDuration); crossfadedLoop(leavingInstance, enteringInstance); }, soundDuration - crossfadeDuration); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function launchSound() {\n soundEffect(\n 523.25, //frequency\n 0.05, //attack\n 0.2, //decay\n \"sine\", //waveform\n 3, //volume\n 0.8, //pan\n 0, //wait before playing\n 600, //pitch bend amount\n ...
[ "0.7745709", "0.76972795", "0.7468719", "0.74620056", "0.7457535", "0.7346669", "0.7311843", "0.72635627", "0.7253642", "0.72459126", "0.72438127", "0.71838164", "0.7149931", "0.71489906", "0.71480435", "0.71315074", "0.71119666", "0.71102476", "0.7096197", "0.7084157", "0.70...
0.0
-1
Display the cards on the page shuffle the list of cards using the provided "shuffle" method below loop through each card and create its HTML add each card's HTML to the page
function initGameCards() { gameCardsFaces = shuffle(gameCardsFaces); const gameCardElements = document.querySelectorAll('.card'); //get all card elements //loop through all the cards and set the face for (let i = 0; i < gameCardElements.length; i++) { // Removing all children from an card element let gameCard = gameCardElements[i]; while (gameCard.firstChild) { gameCard.removeChild(gameCard.firstChild); } // show the cards // Adding card face let newFace = document.createElement('i'); newFace.classList.add('fa', gameCardsFaces[i]); gameCard.appendChild(newFace); //remove classes (for reseting game) gameCard.classList.remove('animated'); gameCard.classList.remove('match'); gameCard.classList.remove('show'); gameCard.classList.remove('open'); gameCard.classList.remove('rubberBand'); gameCard.classList.remove('flip'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createHTML() {\n let cardList = shuffle(myCards);\n cardList.forEach(function(card) {\n $(\".deck\").append('<li><i class=\"card fa ' + card + '\"></i></li>');\n })\n}", "function renderCards() {\n for (const card of cards) {\n card.classList.remove('match', 'show', 'open');\n }\n ...
[ "0.7934823", "0.78172296", "0.78112966", "0.7791347", "0.77133125", "0.7686564", "0.76560605", "0.7590462", "0.757299", "0.75458777", "0.75126433", "0.7498509", "0.74849784", "0.7477093", "0.7470482", "0.74522775", "0.7449718", "0.743951", "0.74327904", "0.74158263", "0.74090...
0.0
-1
Displays stars based on current star rating (03)
function resetStarRating() { //loop through all the stars and set the icon for (let i = 0; i < stars.length; i++) { let s = stars[i].firstChild; s.classList.remove('fa-star-o'); s.classList.add('fa-star'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayStarRating() {\n const userRating = document.querySelector(\".total-rating\").textContent;\n if (userRating < 10) {\n addProfileStars(1)\n }\n else if (userRating >= 10 && userRating <= 100) {\n addProfileStars(2);\n }\n else if (userRating > 100 && userRating <= 200) {\n addProfileS...
[ "0.8035523", "0.80322665", "0.78327745", "0.7814628", "0.77058053", "0.769132", "0.76212734", "0.7593517", "0.7577201", "0.75383687", "0.751029", "0.7486876", "0.7473273", "0.7460719", "0.74358326", "0.7415234", "0.74150866", "0.74119514", "0.7408015", "0.7391652", "0.7382863...
0.0
-1
Set and Displays stars based on current star rating (03)
function setStarRating(starsNumber) { if (starsNumber === 2) { stars[2].firstChild.classList.remove('fa-star'); stars[2].firstChild.classList.add('fa-star-o'); } else if (starsNumber === 1) { stars[1].firstChild.classList.remove('fa-star'); stars[1].firstChild.classList.add('fa-star-o'); } else if (starsNumber === 0) { stars[0].firstChild.classList.remove('fa-star'); stars[0].firstChild.classList.add('fa-star-o'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function starRating() {\n if (moves > 13 && moves < 16) {\n starCounter = 3;\n } else if (moves > 17 && moves < 27) {\n starCounter = 2;\n } else if (moves > 28) {\n starCounter = 1;\n }\n showStars(starCounter);\n }", "function setRating(newRating) {\n rating = newRating;\n...
[ "0.802062", "0.7898268", "0.78737026", "0.78539765", "0.7831826", "0.7742278", "0.7698669", "0.76510906", "0.7645138", "0.7610493", "0.7609895", "0.75710106", "0.7567974", "0.75277644", "0.7495646", "0.7475433", "0.7440764", "0.7405363", "0.74023575", "0.73698854", "0.7365324...
0.80104715
1
Calculates star rating based on the number of moves
function calculateStarRating(moves) { if (moves < threeStars) { return 3; } else if (moves >= threeStars && moves < twoStars) { return 2; } else if (moves >= twoStars && moves < oneStar) { return 1; } else { return 0; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calcStarRating(moves) {\n if (moves < 25) {\n return 5;\n } else if (moves >= 25 && moves <= 35) {\n return 4;\n } else if (moves > 35 && moves <= 45) {\n return 3;\n } else if (moves > 45 && moves <= 55) {\n return 2;\n } else {\n return 1;\n }\n}", "function rating(moves) {\n /...
[ "0.8115423", "0.7804136", "0.7792287", "0.7780424", "0.7721131", "0.77206343", "0.7654988", "0.7597126", "0.7530488", "0.74954605", "0.74373937", "0.7424099", "0.74126655", "0.73931456", "0.7365085", "0.7362334", "0.7330754", "0.72894967", "0.7284731", "0.7247017", "0.7205047...
0.83998543
0
Reset the counters, rating & time
function resetGame() { stopTimer(); openCardsList = []; matchedCounter = 0; movesCounter = 0; starRating = 3; resetStarRating(); timer = "0m 0s"; timerElement.innerText = timer; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetCounters(){\n correct = 0;\n incorrect = 0;\n unanswered = 0;\n }", "function reset() {\n startTime = Date.now();\n endTime = startTime + duration;\n resetTime = endTime + endHold;\n updatedCounties = [];\n for (let i = 0; i < voteSequence....
[ "0.76153255", "0.75969803", "0.75069726", "0.7453151", "0.7395208", "0.7395208", "0.73253226", "0.72722095", "0.7258515", "0.72462016", "0.72352904", "0.72295624", "0.72235787", "0.71897006", "0.7182372", "0.71642196", "0.7145715", "0.712574", "0.70761055", "0.70152915", "0.7...
0.7210765
13
Check if all the cards are matched
function gameOver() { return matchedCounter === 8; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function allMatch(){\n var allMatched = true; \n\t\tfor (var i =0; i< 24; i++){\n\t\t\t\tif(matched[i]==false){\n\t\t\t\t\tallMatched = false; \n\t\t\t\t} \n\t\t\t}\n\t\treturn allMatched; //return true when all cards were matched. \n}", "function allCardsMatched() {\n let allMatched = true;\n\n for (let i ...
[ "0.8375269", "0.83725715", "0.76752603", "0.74880594", "0.74404585", "0.73511046", "0.73234636", "0.72998637", "0.72110826", "0.7196484", "0.71592444", "0.71572214", "0.7144815", "0.7142544", "0.7134606", "0.71333003", "0.7124291", "0.71197295", "0.7111866", "0.7110976", "0.7...
0.0
-1
Clear open cards list list
function resetOpenCardsList() { openCardsList = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearOpenCards() {\n openedCards = [];\n}", "function removeOpenCards() {\n openCard = [];\n}", "function removeOpenCards() {\n cardOpen = [];\n\n}", "function removeOpenCards() {\n openCards = [];\n}", "function removeOpenCards() {\n openCards = [];\n}", "function clearOpened(openedCards)...
[ "0.8535928", "0.83062", "0.8280305", "0.8256054", "0.8200417", "0.7912465", "0.78652096", "0.7786909", "0.7580973", "0.7417002", "0.7391762", "0.73667884", "0.7344346", "0.7294607", "0.72818214", "0.7270537", "0.71942365", "0.7188887", "0.71790266", "0.70790774", "0.70164484"...
0.86473995
0
Add to open cards list
function addToOpenCardsList(card) { openCardsList.push(card); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addCardToOpenList(card) {\n openCards.push(card);\n}", "function addOpenCard(card) {\n openCards.push(card);\n}", "function addOpenCard(card) {\n openCards.push(card);\n}", "function appendCardList (card) {\n openCards.push(card);\n }", "function addClickedCardToOpenCardsList() {\n\tope...
[ "0.8888732", "0.8675036", "0.8675036", "0.8525705", "0.8497418", "0.8486337", "0.8354473", "0.82792455", "0.8270388", "0.82174766", "0.82025504", "0.8177182", "0.81659245", "0.8136273", "0.7991737", "0.7973732", "0.7920772", "0.78019875", "0.777801", "0.7728336", "0.765387", ...
0.87703145
1
Check if two open cards match (return 'true')
function cardsMatch(card1, card2) { return card1.querySelector('i').className === card2.querySelector('i').className; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkIfMatched() {\n\tif ((openCards[0].innerHTML) === (openCards[1].innerHTML)) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function isCardsShownMatch(openCardPair) {\n if (openCardPair.length == 2){\n // get first card symbol\n let c1 = cardSymbol(openCardPair[0]);\n // get...
[ "0.7962581", "0.7948652", "0.7656959", "0.75486", "0.74741", "0.74145097", "0.7395643", "0.7377541", "0.7350538", "0.72600263", "0.7252685", "0.7211829", "0.7198491", "0.719584", "0.7192352", "0.7189772", "0.7155026", "0.7136777", "0.71117616", "0.7104286", "0.70803374", "0...
0.6831764
40
Animate cards not matched
function setNotMatchedCards(card1, card2) { card1.classList.remove('flip'); card2.classList.remove('flip'); card1.classList.add('shake'); card2.classList.add('shake'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function notMatched(activeCards) {\n for (var i = 0; i < activeCards.length; i++) {\n activeCards[i].classList.add(\"wrong\");\n activeCards[i].classList.add(\"animated\");\n activeCards[i].classList.add(\"flash\");\n }\n setTimeout(function() {\n for (var i = 0; i < activeCard...
[ "0.7362497", "0.7165746", "0.71018887", "0.70619756", "0.7007333", "0.6965559", "0.69462216", "0.6917887", "0.6903769", "0.68818223", "0.6874367", "0.6872698", "0.6872008", "0.68636554", "0.6858052", "0.6832075", "0.68246603", "0.6823816", "0.67931575", "0.6781919", "0.677281...
0.0
-1
Main logic, opening cards
function openCard(card) { //start timer on the pick of the very first card if (movesCounter === 0 && openCardsList.length === 0) { startTimer(); } // if two card are already opened do not pick any more if (openCardsList.length >= 2) { return; } //pick the card and proceed to check the current conditions pickCard(card); //if no cards opened alredy, open card and add to the list of open cards if (openCardsList.length === 0) { addToOpenCardsList(card); } //if one card already opened - open card and add to the list of open cards //then check if the card match else if (openCardsList.length === 1) { //opening two cards caounts as a one move movesCounter++; //update moves counter on page movesElement.innerText = movesCounter; //check star rating starRating = calculateStarRating(movesCounter); //update star rating on page (display correct number of stars) setStarRating(starRating) addToOpenCardsList(card); //if cards match - mark them setTimeout(function() { if (cardsMatch(openCardsList[0], openCardsList[1])) { setMatchedCards(openCardsList[0], openCardsList[1]); matchedCounter++; //Check if it was last pair of cards (game over) if (gameOver()) { stopTimer(); setTimeout(function() { modalText.innerText = 'You made it in ' + movesCounter + ' moves ! It took ' + timer + ' of time! Your Star Rating is: ' + starRating; modal.classList.toggle("opened"); }, 500); } } else { setNotMatchedCards(openCardsList[0], openCardsList[1]); closeCards(openCardsList[0], openCardsList[1]); } resetOpenCardsList(); }, 800); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function openCards(card) {\n cardOpen.push(card);\n}", "function cardOpen() {\n\tincrementCounter();\n\n\thandleStarRating();\n\n\taddOpenCard(this);\n\n\tdisableCard(this);\n\n\thandleOpenCards();\n}", "function openedCard() {\n\tvar len = openedCards.length;\n\tif (len == 2) {\n\t\tunmatched();\n\t}\n}", ...
[ "0.78211087", "0.77115476", "0.76205474", "0.75836724", "0.7572267", "0.75587356", "0.7520969", "0.7511609", "0.7428867", "0.7414967", "0.7395804", "0.7299539", "0.72899944", "0.72561663", "0.72331065", "0.7200507", "0.71726316", "0.71421313", "0.7141597", "0.7128391", "0.709...
0.7041109
24
function checking if the card is opened
function isCardOpened(e) { if (e.target.className === 'card') { return e.target.classList.contains('open'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function openedCard() {\n\tvar len = openedCards.length;\n\tif (len == 2) {\n\t\tunmatched();\n\t}\n}", "function cardCheck (clickedCard) {\n return (openedCards.length < 2 && document.querySelector('.open') !== clickedCard && clickedCard.getAttribute('class') !== 'match' && clickedCard.getAttribute('class') ==...
[ "0.79880226", "0.7421669", "0.7151429", "0.7141977", "0.7134415", "0.71335316", "0.71280897", "0.71122396", "0.7103123", "0.7090067", "0.70842576", "0.70685863", "0.7063026", "0.7040545", "0.7022989", "0.7022043", "0.6995494", "0.69661266", "0.69587153", "0.69508207", "0.6929...
0.75180614
1
function checking if the card is matched
function isCardMatched(e) { if (e.target.className === 'card') { return e.target.classList.contains('match'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkForMatch()\n{\n if(firstCard.dataset.card===secondCard.dataset.card)\n {\n disableCards();\n return true;\n \n \n \n }\n else\n {\n unFlipCards();\n return false;\n \n }\n}", "function checkMatch() {\n if (app.firstCard.dataset.a...
[ "0.7985306", "0.7772776", "0.7600428", "0.75870955", "0.75854385", "0.757354", "0.7569102", "0.7540377", "0.7520106", "0.7498241", "0.7479256", "0.74696225", "0.7436286", "0.7415109", "0.73977846", "0.7377526", "0.73631775", "0.7343868", "0.73432136", "0.73259664", "0.7325064...
0.70928335
40
timer based on W3C example at
function startTimer() { // Get todays date and time let now = new Date().getTime(); // Update the count up every 1 second interval = setInterval(function() { // Find the distance between now an the count down date let newNow = new Date().getTime() - now; // Time calculations for days, hours, minutes and seconds let minutes = Math.floor((newNow % (1000 * 60 * 60)) / (1000 * 60)); let seconds = Math.floor((newNow % (1000 * 60)) / 1000); // Display the result in the element with id="timer" timer = minutes + "m " + seconds + "s "; timerElement.innerText = timer; }, 1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function timerWrapper () {}", "function Timer() {}", "function domTimer() {\n $(`.timer`).text(`Timer: ${totalMinutes}:${totalSeconds}`);\n }", "function timerStart(){\n\t\n\t\t\n\t}", "function testTimer() {\n toast({text: \"Testing Timer\", duration: 3, type: \"success\"});\n\n var time =...
[ "0.74897957", "0.7399822", "0.7149976", "0.7118889", "0.70403606", "0.70295405", "0.70213455", "0.6897593", "0.68796396", "0.68505436", "0.6815478", "0.68061113", "0.6785782", "0.6764717", "0.67380244", "0.6719673", "0.67119914", "0.6703126", "0.6689564", "0.666068", "0.66606...
0.0
-1
Functions for moving the game objects
function moveScene() { if(newBall){ ball.x = playerPaddle.x + playerPaddle.width/2; return; } if(paused){ return; } if(onStartScreen){ return; } if(onGameOverScreen){ return; } ball.move(); checkBrickCollisions(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "move() {\n this.posX += this.deltaX;\n this.posY += this.deltaY;\n }", "move(){\r\n this.x += this.dx;\r\n this.y += this.dy;\r\n\r\n }", "move() {\n\n // Horizontal movement\n this.x_location += this.delta_x;\n\n // Vertical movement\n this.y_location += thi...
[ "0.7725591", "0.7587279", "0.7529618", "0.74371344", "0.7436138", "0.7379959", "0.73796874", "0.7369157", "0.7357544", "0.73566055", "0.7332371", "0.7324023", "0.73234963", "0.72596645", "0.7249869", "0.7247368", "0.72453815", "0.7245023", "0.7239269", "0.72194344", "0.720745...
0.0
-1
Functions for drawing the scene
function drawScene() { // Clear screen with black rectangle colorRect(0,0,canvas.width,canvas.height,'black'); // Draw game objects drawBricks(); score.draw(); if(onGameOverScreen){ drawEndScreen(); return; } playerPaddle.draw(); ball.draw(); if(onStartScreen){ drawStartScreen(); return; } if(paused){ drawPauseScreen(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawScene() {\n\t// change the cursor to 'pointer'\n\tcursor(\"pointer\");\n\tbackground(cS[0]);\n\ttranslate(W/2,H/2);\n\tscale(1,-1);\n\t\n\t// map then draw all elements of the scene\n\tmapScene();\n\tdrawPoints();\n\tdrawFaces();\n\t\n\t// This is a compilation of custom functions defined in scene_des...
[ "0.86186075", "0.7833997", "0.76467067", "0.7602226", "0.7523656", "0.750873", "0.7460292", "0.7457195", "0.7446251", "0.7439105", "0.7354712", "0.72915334", "0.72601974", "0.72601974", "0.7245748", "0.7239416", "0.7237924", "0.7232285", "0.72319365", "0.7221759", "0.7221759"...
0.7244843
15
better version of above
static remapRange(value, low1, high1, low2, high2) { return low2 + (high2 - low2) * (value - low1) / (high1 - low1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static private internal function m121() {}", "transient protected internal function m189() {}", "transient private protected internal function m182() {}", "transient private internal fun...
[ "0.6551849", "0.6339116", "0.6160537", "0.6040995", "0.58862185", "0.58267725", "0.57970995", "0.56602365", "0.5615408", "0.553537", "0.5504314", "0.5482358", "0.54459274", "0.5341348", "0.5300386", "0.52966547", "0.5259573", "0.52568203", "0.52501434", "0.5237153", "0.523438...
0.0
-1
Use of this source code is governed by a BSDstyle license that can be found in the LICENSE file. Flags: allownativessyntax
function opt(){ const v2 = {"maxByteLength":4886690}; const v4 = new ArrayBuffer(1458,v2); const v6 = new Int8Array(v4); const v8 = Symbol.toStringTag; const v9 = v6[v8]; return v9; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ecma (){}", "function swift(hljs) {\n var SWIFT_KEYWORDS = {\n keyword: '#available #colorLiteral #column #else #elseif #endif #file ' +\n '#fileLiteral #function #if #imageLiteral #line #selector #sourceLocation ' +\n '_ __COLUMN__ __FILE__ __FUNCTION__ __LINE__ Any as as! as? assoc...
[ "0.61470073", "0.60494983", "0.60494983", "0.6024747", "0.58476627", "0.58117723", "0.5805316", "0.5805316", "0.5805316", "0.5805316", "0.5805316", "0.5805316", "0.5805316", "0.5805316", "0.5799786", "0.5799786", "0.5767864", "0.57221353", "0.57221353", "0.5694592", "0.569459...
0.0
-1
add value except w component
addWithOutW(v:Vector4|Vector3) { this.x += v.x; this.y += v.y; this.z += v.z; return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addViareduce(value, currentItem){\n\treturn value + currentItem;\n\n}", "function add(r,w,c) {\t\n\t\tfor(var k=0;k<nv;k++)\n\t\t\tc[k] += w*r[graph.ivalues[k]];\n\t}", "add() {\n if (!this.value) {\n this.value = this.min || 0;\n }\n const step = this.ctrl_key ? 100 : ...
[ "0.6207969", "0.5826355", "0.5741877", "0.57100606", "0.5663501", "0.55764216", "0.5510646", "0.55005336", "0.5473389", "0.543082", "0.54250765", "0.53851247", "0.5374864", "0.5329199", "0.53116703", "0.5284773", "0.5269321", "0.5255067", "0.52434385", "0.5211799", "0.5208513...
0.5363535
13
clearing up the scope of the variables
function clearForm() { $scope.Address = ''; $scope.CityTown = ''; $scope.WName = ''; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _removeVariables() {\n underlay = null;\n modal = null;\n yesEl = null;\n noEl = null;\n _yesClicked = null;\n _noClicked = null;\n yes = null;\n no = null;\n }", "function resetVars() {\n\t\tidArrays = [];\n\t\t_3DArrays = [];\n\t\t$scope.dataS...
[ "0.75543934", "0.7550767", "0.74628985", "0.74094224", "0.7225396", "0.72033346", "0.7202725", "0.7087589", "0.70741016", "0.70639163", "0.7045889", "0.70372653", "0.6987848", "0.6986107", "0.6980705", "0.6943376", "0.6936629", "0.6867975", "0.6854886", "0.68275625", "0.68185...
0.0
-1
prop 1: updateUser prop 2: loggedIn
function logout(e){ e.preventDefault() axios.post("http://localhost:5000/logout", {logout: true}, {withCredentials: true}).then(response=> { console.log(response.data) if (response.data.msg === "success"){ props.updateUser({loggedIn: false, username:null, _id:null, data:null}) } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateUser ({ commit, state, getters, dispatch }, properties) {\n // Commit the changes to state\n let dontPatch = ('dontPatch' in properties) && properties.dontPatch\n if (dontPatch) delete properties['dontPatch']\n _.forOwn(properties, (value, key) => {\n if (key === 'profile') _.forOw...
[ "0.68704784", "0.6863889", "0.68558145", "0.68086565", "0.6763458", "0.66834915", "0.6609231", "0.660806", "0.6587176", "0.6572923", "0.6569853", "0.65690035", "0.6526894", "0.65216815", "0.6444607", "0.64413774", "0.6427171", "0.6425075", "0.64225304", "0.64135456", "0.64073...
0.0
-1
Check rate limits and quit the app if we're about to get blocked
function checkRateLimit (){ console.log("Checking rate limits"); checkRateLimitInterval = setTimeout(checkRateLimit, config['rate_limit_update_time']*1000); if (ratelimit[2] < config['min_ratelimit']){ console.log("Ratelimit too low -> Cooldown (" + str(ratelimit[2]) + "%)") clearTimeout(checkRateLimitInterval); checkRateLimitInterval = setTimeout(checkRateLimit, 30000); } else { Twitter.get('application/rate_limit_status', function(err, data, response) { for (var res_families in data['resources']){ for(var res in data['resources'][res_families]){ var limit = data['resources'][res_families][res]['limit']; var remaining = data['resources'][res_families][res]['remaining']; var percent = remaining/limit*100; if (res == "/search/tweets"){ ratelimit_search=[limit,remaining,percent] } if (res == "/application/rate_limit_status"){ ratelimit=[limit,remaining,percent] } if (res == "/friendships/outgoing"){ ratelimit_follows=[limit,remaining,percent] } if (percent < 7.0){ // made this 7% for the follows list (15 follows in 15 minutes -> 1/15 is 6.67%) console.log(res_families + " -> " + res + ": " + percent + " !!! <7% Emergency exit !!!" + " Remaingin -> " + remaining); process.exit(res_families + " -> " + res + ": " + percent + " !!! <7% Emergency exit !!!" + " Remaingin -> " + remaining); } else if (percent < 30.0){ console.log(res_families + " -> " + res + ": " + percent + " !!! <30% alert !!!" + " Remaining -> " + remaining); } else if (percent < 70.0){ console.log(res_families + " -> " + res + ": " + percent); } } } if(err){ console.log(err); } }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function safariEventRateLimitBlock() {\n\tif (isWebKit && isSafariVersion13OrOlder()) {\n\t\tif (safariRateLimited != 0)\n\t\t\treturn true;\n\t\telse {\n\t\t\tsafariRateLimited = setTimeout('safariRateLimited = 0;', 10);\n\t\t\treturn false;\n\t\t}\n\t}\n}", "static async rateLimiting() {\n await new Promise...
[ "0.6899444", "0.6694146", "0.6587752", "0.6411256", "0.6376576", "0.6307267", "0.6297292", "0.6268829", "0.6263061", "0.6218118", "0.6195895", "0.61655533", "0.6128826", "0.5975915", "0.5975915", "0.5975915", "0.5953507", "0.58601105", "0.582611", "0.57029843", "0.56793773", ...
0.7268114
0
Update the Retweet queue (this prevents too many retweets happening at once.)
function UpdateQueue(){ updateRetweetInterval = setTimeout(UpdateQueue, config['retweet_update_time']*1000); console.log("=== CHECKING RETWEET QUEUE ==="); console.log("Queue length: " + post_list.length); if (post_list.length > 0){ if (ratelimit[2] >= config['min_ratelimit_retweet']){ var tweet = post_list[0]; var tweet_id; if(tweet.hasOwnProperty('retweeted_status')){ tweet_id = tweet['retweeted_status']['id_str']; } else if (tweet['in_reply_to_status_id_str'] != null) { console.log("Replied status: " + tweet['text']); console.log("Replied status id: " + tweet['id_str']); console.log("Replied reply status id: " + tweet['in_reply_to_user_id_str']); tweet_id = tweet['in_reply_to_status_id_str']; } else { tweet_id = tweet['id_str']; } Twitter.post('statuses/retweet/:id', { id: tweet_id }, function (err, data, response) { if(err){ console.log(err); console.log("------ Failed tweet: " + tweet_id + " : " + tweet['id_str'] + " : " + tweet['text']); } else { console.log("------ Retweeting: " + tweet_id + " " + tweet['text']); CheckForFavoriteRequest(tweet); CheckForFollowRequest(tweet); } }); post_list.shift(); } else { console.log("Ratelimit at " + ratelimit[2] + "% -> pausing retweets") } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "refresh() {\n if (!this.throttleOpen()) return;\n log.info('refreshing tweets for @'+this.screenName);\n\n console.time('tweet refresh');\n var newTweets = pullNewTweets(this.screenName);\n var oldTweets = pullOldTweets(this.screenName);\n\n var allTweets = newTweets.conca...
[ "0.66278726", "0.6391988", "0.62367046", "0.6218868", "0.6203459", "0.61897707", "0.61356384", "0.60320705", "0.6028394", "0.6011407", "0.5893757", "0.5885914", "0.5867899", "0.5850564", "0.57837045", "0.57259965", "0.5709657", "0.5695462", "0.56867003", "0.5684984", "0.56825...
0.8148428
0
Check if a post requires you to follow the user. Be careful with this function! Twitter may write ban your application for following too aggressively
function CheckForFollowRequest(item){ var tweet; if(item.hasOwnProperty('retweeted_status')){ tweet = item['retweeted_status']; } else { tweet = item; } var text = tweet['text']; var userToFollow = tweet['user']['screen_name']; var userMentions = tweet['entities']['user_mentions']; var userArray = []; userArray.push(userToFollow); for (let user of userMentions){ if (user['screen_name'] !== userToFollow) userArray.push(user['screen_name']); } var toFollow = false; for(let follow_keyword of config['follow_keywords']){ if (text.toLowerCase().indexOf(follow_keyword) >= 0) toFollow = true; } if(toFollow){ console.log("Follow text: " + text); console.log("Follow mentions: " + userMentions); console.log("Follow userArray: " + userArray); console.log(ratelimit_follows[1] + " : " + userArray.length); if(ratelimit_follows[1] >= userArray.length){ for (let screen_name of userArray){ Twitter.post('friendships/create', {'screen_name': screen_name}, function(err, data, response){ if(err){ console.log("Follow error: " + err); } else { console.log("Follow: " + screen_name); } }); } } else { console.log("-> follow limit reached"); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkPostIsFollow(post) {\n if (post.type === \"follow\") {\n return true;\n } else {\n return false;\n }\n}", "can_follow() {\n return true\n }", "function tw_post_verified_form() {\n //finish\n if($('#followRadiosYes').prop('checked')){\n dd.authoritize.Twitteritize.f...
[ "0.821402", "0.661999", "0.65112793", "0.6414096", "0.6348749", "0.610611", "0.591139", "0.5794184", "0.5755199", "0.5739308", "0.5728658", "0.5702916", "0.5691615", "0.5640103", "0.563141", "0.5617082", "0.55991316", "0.5569683", "0.55673057", "0.55560666", "0.55409724", "...
0.6823419
1
Check if a post requires you to favorite the tweet. Be careful with this function! Twitter may write ban your application for favoriting too aggressively
function CheckForFavoriteRequest(item){ var text = item['text']; for(let faveKeyWord of config['fav_keywords']){ if (text.toLowerCase().indexOf(faveKeyWord) >= 0){ console.log('>>>>> need to like it'); try { Twitter.post('favorites/create', {'id': item['retweeted_status']['id_str']}, function(err, data, response){ if(err){ console.log("Favorite error: " + err); } else { console.log("Favorite: " + item['retweeted_status']['id_str']); } }); } catch(err) { Twitter.post('favorites/create', {'id': item['id_str']}, function(err, data, response){ if(err){ console.log("Favorite error: " + err); } else { console.log("Favorite: " + item['id']); } }); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fav(){\n // Set up your search parameters\n var params = {\n q: '#saveYemen',\n count: 100,\n result_type: 'recent',\n lang: 'en'\n }\n\n // Initiate your search using the above paramaters\n T.get('search/tweets', params, function(err, data, response) {\n // If there is no error, proce...
[ "0.6669347", "0.66461545", "0.6644348", "0.6535309", "0.651348", "0.6339462", "0.6313736", "0.6228981", "0.6207954", "0.62039083", "0.6126342", "0.61048836", "0.60994494", "0.60792", "0.6047957", "0.6021765", "0.600995", "0.5951317", "0.5950615", "0.5927963", "0.59210944", ...
0.7210636
0
Scan for new contests, but not too often because of the rate limit.
function ScanForContests(){ scanContestsInterval = setTimeout(ScanForContests, config['scan_update_time']*1000); if (ratelimit_search[2] >= config['min_ratelimit_search']){ for (var search_query of config['search_queries']){ Twitter.get('search/tweets', {'q':search_query, 'result_type':'recent', 'count':100, 'lang': 'en'}, function(err, data, response) { if (err) { console.log("Search error: " + err); } else { for(var tweet of data.statuses){ var tweet_id = tweet['id_str']; var original_id; var screen_name = tweet['user']['screen_name']; if(tweet.hasOwnProperty('retweeted_status')){ original_id = tweet['retweeted_status']['id_str']; } else if (tweet['in_reply_to_status_id_str'] != null) { original_id = tweet['in_reply_to_status_id_str']; } if(ignore_list.indexOf(tweet_id) < 0 && ignore_list.indexOf(original_id) < 0 && ignore_list.indexOf(screen_name) < 0) { var no_ignore_keyword = true; var no_ignore_screen_name = true; for (let ignore_keyword of ignore_keywords){ if(tweet['text'].toLowerCase().indexOf(ignore_keyword) >= 0) no_ignore_keyword = false; } for (let ignore_screen_name of config['ignore_screen_names']){ if(tweet['user']['name'].toLowerCase().indexOf(ignore_screen_name) >= 0) no_ignore_screen_name = false; } if (no_ignore_keyword && no_ignore_screen_name){ post_list.push(tweet); addToIgnoreList(tweet_id); addToIgnoreList(original_id); addToIgnoreList(screen_name); } } } } }); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scan() {\r\n // harvest any new images\r\n let num = scanDirectory(watch_dir, output_dir);\r\n\r\n // if we harvested any images, output to console\r\n if (num > 0) {\r\n console.log(`${num} files copied. Sleeping for ${timer_interval} seconds.`);\r\n }\r\n // update config file on disk with last...
[ "0.55372584", "0.54346573", "0.5425355", "0.5376764", "0.5376764", "0.5182199", "0.51681", "0.5128759", "0.5125902", "0.5071078", "0.50323826", "0.49982953", "0.49958286", "0.49947977", "0.49909237", "0.49635968", "0.49594012", "0.4957623", "0.4946232", "0.49215427", "0.49213...
0.7077085
0
Add tweet to the ignore list and write to file
function addToIgnoreList(tweet_id){ ignore_list.push(tweet_id); var text = tweet_id + '\n'; fs.appendFile(ignore_list_path, text, function (err) { if (err) return console.log(err); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ignore(uri) {\n this.ignoredFileURIs.add(uri);\n console.log(`${uri} ignored`);\n }", "function myTweets() {\n fs.appendFileSync('log.txt', \"@nclespaul's tweets: \\r\\n\");\n var userName = {screen_name: 'nclespaul'};\n client.get('statuses/user_timeline', userName, function(error, tweets, r...
[ "0.59988534", "0.5835253", "0.57803226", "0.5709902", "0.5606439", "0.5569389", "0.55653906", "0.5431292", "0.5431229", "0.5409291", "0.5406849", "0.5388674", "0.5361684", "0.5309562", "0.5290938", "0.52827674", "0.5280057", "0.52348053", "0.5222718", "0.51848817", "0.5171431...
0.80574995
0
keep list of people following managable
function addToFriendList(screen_name){ friend_list.push(screen_name); if(friend_list.length>3000){ var df = friend_list.length - 3000; for(var i=0; i<df; i++){ Twitter.post('friendships/destroy', {'screen_name': friend_list[0]}, function(err, data, response){ if(err) { console.log("friendship destroy error: " + err); } else { console.log("friendship destroyed: " + friend_list[0]); friend_list.shift(); } }); } } var friend_list_str = friend_list.join(); friend_list_str.replaceAll(',','\n'); fs.truncate(friend_list_path, 0, function() { fs.writeFile(friend_list_path, friend_list_str, function (err) { if (err) { console.log("Error writing friend_list file: " + err); } else { console.log("Written a new friend_list file. Length -> " + friend_list.length); } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listAll(){\n //iterate thru data and print name of each user\n for(var i in data){\n var userID = i;\n var username = data[i].name;\n console.log(username, userID);\n\n //list the ppl that the user follows\n var followerIDs = data[i].follows;\n var followerNames = [];\n for(var j = ...
[ "0.6795403", "0.6548322", "0.64441955", "0.6361762", "0.6360572", "0.5941392", "0.58975047", "0.58831906", "0.586246", "0.5858115", "0.5822398", "0.5739851", "0.5733401", "0.57168055", "0.5695403", "0.56559396", "0.56453305", "0.5642967", "0.56427175", "0.5610793", "0.560965"...
0.0
-1
navbar actions form validations
function validate(form){ //check if values are empty if(valid) { alert("This note will be archived!"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function appValidation() {\n if ($(\"#registerForm\").length > 0)\n registerFormValid();\n if ($(\"#loginForm\").length > 0)\n loginFormValid();\n if ($(\"#checkForm\").length > 0)\n checkFormValid();\n if ($('#saleForm').leng...
[ "0.6217039", "0.600488", "0.59936327", "0.5937872", "0.58785826", "0.58596724", "0.58023995", "0.57917863", "0.5791122", "0.5780976", "0.5780976", "0.5764052", "0.5755709", "0.57442826", "0.57430613", "0.56958985", "0.56382036", "0.5632599", "0.56295884", "0.558404", "0.55804...
0.5347318
57
render questions/choices to the page
function render (questionIndex) { quizQuestions.innerHTML = ""; //removes prior question data createUlEl.innerHTML = ""; //removes prior Ul data var userQ = questions[questionIndex].title; var userC = questions[questionIndex].choices; //appends questions quizQuestions.textContent = userQ; quizQuestions.setAttribute("class", "quiz-questions") createUlEl.setAttribute("class", "quiz-questions") userC.forEach(function(choice){ var liEl = document.createElement("li"); //list element liEl.textContent = choice; liEl.setAttribute("class", "no-bullets") quizQuestions.appendChild(liEl); liEl.addEventListener("click", verify); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderQuestionPage() {\n var currentQuestionObj = state.questions[state.currentQuestionIndex];\n renderQuestion();\n renderQuestionChoices(currentQuestionObj.answers);\n // $(\".popup-inner\").addClass(\"hidden\");\n}", "function renderQuestion(){\n\n // Create a variable to hold the index\n let q...
[ "0.7692503", "0.7656137", "0.7463218", "0.735216", "0.7342648", "0.73138225", "0.7238767", "0.72295684", "0.72025025", "0.7182365", "0.7179876", "0.7167187", "0.71610314", "0.71581614", "0.71292126", "0.7125216", "0.7095239", "0.7094765", "0.70881647", "0.7085783", "0.7085167...
0.0
-1
figure out if answer is true or false
function verify(event) { var element = event.target; if (element.matches("li")) { var createDivEl = document.createElement("div"); createDivEl.setAttribute("id", "create-div"); //If correct if (element.textContent === questions[questionIndex].answer) { score++; createDivEl.textContent = "Correct!" } //if Incorrect else { timeLeft = timeLeft - incorrectPenalty; createDivEl.textContent = "Incorrect! The correct choice is " + questions[questionIndex].answer; } } //Determine question number questionIndex++; if (questionIndex >= questions.length){ finishQuiz(); createDivEl.textContent = "Your score is: " + score + "/" + questions.length + "."; } else { render(questionIndex); } //append div element to quiz questions div quizQuestions.appendChild(createDivEl) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkAnswer(answer) {\n\t\treturn answer.isCorrect;\n\t}", "evaluateAnswer(userAnswer){\n \tconst {value1, value2, value3, proposedAnswer} = this.state;\n \tconst corrAnswer = value1 + value2 + value3;\n \treturn(\n \t\t (corrAnswer === proposedAnswer && userAnswer === 'true') ||\n \t\t...
[ "0.77890396", "0.7607253", "0.7566095", "0.7449296", "0.7301849", "0.7197013", "0.7197002", "0.7110416", "0.69021726", "0.6880905", "0.67848915", "0.67639893", "0.6735029", "0.6729761", "0.6693439", "0.66930926", "0.66802853", "0.6666839", "0.66667897", "0.6639072", "0.663561...
0.0
-1
removes all option elements in select box removeGrp (optional) boolean to remove optgroups
function removeAllOptions(sel, removeGrp) { var len, groups, par; if (removeGrp) { groups = sel.getElementsByTagName('optgroup'); len = groups.length; for (var i = len; i; i--) { sel.removeChild(groups[i - 1]); } } len = sel.options.length; for (var i = len; i; i--) { par = sel.options[i - 1].parentNode; par.removeChild(sel.options[i - 1]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clearOptionGroups() {\n this.optgroups = {};\n this.clearCache();\n this.trigger('optgroup_clear');\n }", "function unselectAllOptions() {\n $(\"#option-frame\").children(\"div\").each(function(index, value) { \n if ($(value).children(\"span\").children(\"input\").prop('checked') == true) {\n...
[ "0.72494185", "0.7032956", "0.70205104", "0.68387103", "0.6742943", "0.6741664", "0.6645695", "0.6610681", "0.6596005", "0.65730697", "0.65339816", "0.65211016", "0.65014017", "0.6486992", "0.6476177", "0.64271307", "0.6402793", "0.6387948", "0.6344655", "0.63420117", "0.6333...
0.8069378
0
var dropdown = document.createElement('option'); dropdown.appendChild(document.createTextNode('Select an option')); dropdown.value = 'select_option'; f.appendChild(dropdown);
function addOptions(obj) { var f = document.createDocumentFragment(); var o; for (var i = 0, len = obj.text.length; i < len; i++) { o = document.createElement('option'); o.appendChild(document.createTextNode(obj.text[i])); if (obj.value) { o.value = obj.value[i]; } f.appendChild(o); } return f; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addOption(dropdown, text)\n{\n var option = document.createElement(\"option\");\n option.textContent = text;\n dropdown.appendChild(option);\n}", "function addDropdownOption(dropdown,optionValue,optionText) {\n var option = document.createElement('option');\n option.setAttribute('value', ...
[ "0.84450835", "0.83112645", "0.8271935", "0.81421185", "0.8022207", "0.80196774", "0.7954714", "0.7943809", "0.7553142", "0.7521192", "0.7521192", "0.74941415", "0.7472642", "0.74441737", "0.7343489", "0.73336166", "0.7322278", "0.73145795", "0.7289274", "0.72825074", "0.7271...
0.0
-1
function adicionarPet(nome, raca, peso, idade, cor, etc)
function adicionarPet(pet) { pets.push(pet); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function servicosPrestados(pet, servico) {\n servico(pet)\n}", "function anyadirPaciente(nom, ape, ed) {\n if (!nom || !ape || !ed) return 0;\n\n var id = siguienteId;\n siguienteId++;\n console.log(\"Añadir paciente\", nom, ape, ed);\n pacientes.push({ id: id, nombre: nom, apellidos: ape, edad...
[ "0.6462254", "0.64310604", "0.6229066", "0.61284816", "0.6075611", "0.60579", "0.6050512", "0.6005469", "0.5942568", "0.5940705", "0.5939384", "0.59303117", "0.59194237", "0.5885195", "0.5874141", "0.58730847", "0.5872479", "0.5850298", "0.582884", "0.5828134", "0.5809026", ...
0.6601361
0
acciones: [4, 3,2,5,11] mayor ganancia: 9
function MaxValue(array) { //Esto quiere decir que lo compre a array[0] y lo vendo a array[1] "La primer diferencia" let sale = array[1] - array[0] //Itero cada posibilidad de compra for (let i = 0; i < array.length - 1 ; i++) { //Itero cada posibilidad de venta for(let j = i + 1; j < array.length; j++ ){ //sacamos la ganancia potencial const potential = array[j] - array[i]; //Chequeamos con cual nos quedamos sale = potential > sale ? potential : sale; } } return sale; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function aleatorios(limite = 1) {\n let r = []\n for (let i = 0; i < limite; i++) {\n r[i] = numeroAlAzar100()\n }\n\n return r\n \n }", "function decidirGanador() {\n\n var arrayPosiciones = [];\n var indice;\n\n for (var i = 0; i < jugadore...
[ "0.63892025", "0.63070893", "0.623442", "0.6181227", "0.6176503", "0.6088349", "0.60833186", "0.60498863", "0.6018845", "0.60019237", "0.5991566", "0.5973623", "0.5970079", "0.5968539", "0.5967023", "0.59244484", "0.5901609", "0.58779377", "0.586209", "0.5856567", "0.58421594...
0.0
-1
Write password to the password input
function writePassword() { var password = generatePassword(); var passwordText = document.querySelector("#password"); passwordText.value = password; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writePassword() {}", "function writePassword() {\n var password = getPasswordOptions();\n var passwordText = document.querySelector('#password');\n \n passwordText.value = password;\n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.qu...
[ "0.8859055", "0.85427845", "0.8511168", "0.85005593", "0.84896266", "0.84716254", "0.84680176", "0.84540486", "0.84436417", "0.8431553", "0.8419593", "0.84186006", "0.8406022", "0.8403544", "0.840023", "0.8392582", "0.8375589", "0.83696216", "0.83640635", "0.83598703", "0.835...
0.8484375
5
function to run the game
function startGame() { myGamePiece = new sprite(100, 70, "runningpika.gif", 10, 120, "image"); mySound = new sound("pikachu.wav"); myMusic = new sound("opening.mp3"); myMusic.play(); myBackground = new sprite(800, 400, "loopbackground.jpg", 0, 0, "background") myScore = new sprite("30px", "arial", "black", 600, 30, "text"); myGround = new sprite(800, 5, "green", 0, 265) myObstacle = new sprite(50, 50, "exec.gif", 300, 120, "image"); myGameArea.start(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "runGame(){\n\t\t\tthis.scene.runGame();\n\t\t}", "function runGame() {\n\tvar g = new Main('game', 'container');\n\tg.init();\n}", "function run(){ //the only function which is executed.Rest all functions are interconnected by this function.\n initial(); //it creates snakes,food and walls\n int=setIn...
[ "0.8214129", "0.79191315", "0.7736266", "0.7726691", "0.77260625", "0.7721981", "0.7640724", "0.76332474", "0.7485709", "0.74562705", "0.7447032", "0.73874545", "0.7320288", "0.7280752", "0.7278", "0.72555125", "0.7244998", "0.7240668", "0.7228202", "0.72215736", "0.7139753",...
0.0
-1
setting up function for my game sprite
function sprite(width, height, color, x, y, type) { this.type = type; if (type == "image" || type == "background") { this.image = new Image(); this.image.src = color; } this.width = width; this.height = height; this.speedX = 0; this.speedY = 0; this.gravity = 0.05; this.gravitySpeed = 0; this.x = x; this.y = y; this.update = function () { ctx = myGameArea.context; if (type == "image" || type == "background") { ctx.drawImage(this.image, this.x, this.y, this.width, this.height); if (type == "background") { ctx.drawImage(this.image, this.x + this.width, this.y, this.width, this.height); } } else if (this.type == "text") { ctx.font = this.width + " " + this.height; ctx.fillStyle = color; ctx.fillText(this.text, this.x, this.y); } else { ctx.fillStyle = color; ctx.fillRect(this.x, this.y, this.width, this.height); } } this.newPos = function () { this.gravitySpeed += this.gravity; this.x += this.speedX; this.y += this.speedY + this.gravitySpeed; this.hitBottom(); if (this.type == "background") { if (this.x == -(this.width)) { this.x = 0; } } } this.hitBottom = function() { var rockbottom = myGameArea.canvas.height - this.height; if (this.y >rockbottom) { this.y = rockbottom; this.gravitySpeed = 0; } } // this.hitOther = function(otherobj) { // var hitOther = myGameArea.canvas.height - otherobj.y; // this.y = hitOther; // this.gravitySpeed = 0; // } function accelerate(n) { myGamePiece.gravity = n; } // this.jumpOn = function (otherobj) { // var mybottom = this.y + (this.height); // var othertop = otherobj.y; // var jump = false; // if (mybottom == othertop){ // jump = true; // } // } this.crashWith = function (otherobj) { var myleft = this.x; var myright = this.x + (this.width); var mytop = this.y; var mybottom = this.y + (this.height); var otherleft = otherobj.x+100; var otherright = otherobj.x + (otherobj.width-80); var othertop = otherobj.y *1.5; var otherbottom = otherobj.y + (otherobj.height); var crash = true; if ((mybottom < othertop) || (mytop > otherbottom) || (myright < otherleft) || (myleft > otherright)) { crash = false; } return crash; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sprite(tempS) {\n this.s = tempS;\n \n this.displayIdle = function() {\n scale(this.s);\n curSprite = 0;\n image(idleSprite[curSprite], 100, height-groundHeight-150);\n }\n this.displayWalk = function() {\n scale(this.s);\n image(walkSprite[curSprite], 100, height-groundHeight-150-spri...
[ "0.7296279", "0.7170221", "0.71678525", "0.71112096", "0.708701", "0.70393836", "0.7018527", "0.70116526", "0.69929874", "0.6992414", "0.6985098", "0.69776934", "0.69204414", "0.68998337", "0.6892015", "0.6885436", "0.68702346", "0.6858624", "0.6841868", "0.6823827", "0.67953...
0.6948559
12
creating function to update game area to make sure the movement is updated
function updateGameArea() { //collision with obstacle, game ends var x, height, gap, minHeight, maxHeight, minGap, maxGap; for (i = 0; i < myObstacles.length; i += 1) { // if (myGamePiece.jumpOn(myObstacles[i])){ // mySound.play(); // myGamePiece.gravity = 0; // myGamePiece.y = myGameArea.canvas.height - myObstacles[i].y; // // return; // } if (myGamePiece.crashWith(myObstacles[i])) { mySound.play(); myMusic.stop(); myGameArea.stop(); return; } } myGameArea.clear(); myGameArea.frameNo += 1; //placing background myBackground.speedX = -1; myBackground.newPos(); myBackground.update(); //placing ground myGround.newPos(); myGround.update(); var minInterval = 200; var maxInterval = 400; var randomisedInterval = 250; //Math.floor(Math.random() * (maxInterval - minInterval) + minInterval); if (myGameArea.frameNo == 1 || everyinterval(randomisedInterval)) { x = myGameArea.canvas.width; //randomising obstacles minHeight = 50; maxHeight = 150; height = Math.floor(Math.random() * (maxHeight - minHeight + 1) + minHeight); //creating random obstacle images; switch (Math.floor((Math.random() * 6)+1)){ case 1: randomImage = (new sprite(height, height, "exec.gif", x, 270-height, "image")); break; case 2: randomImage = (new sprite(height*1.15, height, "Blasty.png", x, 270-height, "image")); break; case 3: randomImage = (new sprite(height*1.01, height, "goldduck.png", x, 270-height, "image")); break; case 4: randomImage = (new sprite(height*0.62, height, "gyarados.png", x, 270-height, "image")); break; case 5: randomImage = (new sprite(height, height, "psyduck.png", x, 270-height, "image")); break; case 6: randomImage = (new sprite(height, height, "charizard.png", x, 270-height, "image")); break; } // minGap = 50; // maxGap = 200; // gap = Math.floor(Math.random() * (maxGap - minGap + 1) + minGap); //randomising pokemon myObstacles.push(randomImage); // myObstacles.push(new sprite(10, x - height - gap, "exec.gif", x, height + gap, "image")); } for (i = 0; i < myObstacles.length; i += 1) { myObstacles[i].x += -1; myObstacles[i].update(); } //updating score myScore.text = "SCORE: " + (myGameArea.frameNo); myScore.update(); //creating speed functions initiated by controls myGamePiece.speedX = 0; myGamePiece.speedY = 0; if (myGameArea.keys && myGameArea.keys[37]) { myGamePiece.speedX = -1; } if (myGameArea.keys && myGameArea.keys[38]) { myGamePiece.speedY = -5; // accelerate(0.1); } if (myGameArea.keys && myGameArea.keys[39]) { myGamePiece.speedX = 1; } if (myGameArea.keys && myGameArea.keys[40]) { myGamePiece.speedY = 5; } myGamePiece.newPos(); myGamePiece.update(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateGameArea() {\r\n myGameArea.clear();\r\n myGamePiece.newPos();\r\n myGamePiece.update();\r\n}", "function updateGameArea() {\n\tcollisionDetector(myAsteroids);\n\tweaponDetector(myAsteroids);\n\tmyGameArea.clear();\n\tmyBackground.speedX = -1;\n\tmyBackground.newPos();\n\tmyBackground.upd...
[ "0.8045204", "0.80385673", "0.783731", "0.7717201", "0.7618083", "0.74490494", "0.7365194", "0.721794", "0.7085899", "0.7052909", "0.7025701", "0.702528", "0.69477487", "0.6919414", "0.6917767", "0.6902646", "0.68415654", "0.68020934", "0.6799963", "0.6794693", "0.6793621", ...
0.0
-1
Event trigered by checkbox, that updates the class on the
function updateTheme(checked) { var theme = 0; if (checked) { theme = 1; DOM.$consultantTable.removeClass("theme-one"); DOM.$consultantTable.addClass("theme-two"); DOM.$clientTable.removeClass("theme-one"); DOM.$clientTable.addClass("theme-two"); $(".colour-menu").removeClass("theme-one"); $(".colour-menu").addClass("theme-two"); $("#clientmenu").removeClass("theme-one"); $("#clientmenu").addClass("theme-two"); } else { theme = 0; DOM.$consultantTable.removeClass("theme-two"); DOM.$consultantTable.addClass("theme-one"); DOM.$clientTable.removeClass("theme-two"); DOM.$clientTable.addClass("theme-one"); $(".colour-menu").removeClass("theme-two"); $(".colour-menu").addClass("theme-one"); $("#clientmenu").removeClass("theme-two"); $("#clientmenu").addClass("theme-one"); } updateThemeInDB(theme).done(function(data) { console.log(data); console.log("Updated in db"); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkBox(e){\n\t\t\t\t$(this).toggleClass(\"on\");\n\t\t\t\t$(this).trigger(\"change\");\n\t\t\t}", "function checkBox(e){\n\t\t\t\t$(this).toggleClass(\"on\");\n\t\t\t\t$(this).trigger(\"change\");\n\t\t\t}", "handleCheckboxes(){\n\n for(let cb of this.checkboxes){\n\n if(cb.selecte...
[ "0.7138364", "0.7138364", "0.7038423", "0.69820744", "0.69005513", "0.68936884", "0.6589022", "0.65408313", "0.64535475", "0.64252317", "0.64243865", "0.64196855", "0.6395816", "0.63663554", "0.63625836", "0.63551164", "0.6342129", "0.633277", "0.6299737", "0.6286613", "0.628...
0.0
-1
=================== public methods ================== main init method
function init(theme, $consultantTable, $clientTable) { DOM.$consultantTable = $consultantTable; DOM.$clientTable = $clientTable; bindEvents(); //If theme is set to zero, add the default theme-one class to both tables if (theme === 0) { $("input#one").prop("checked", false); DOM.$consultantTable.addClass("theme-one"); DOM.$clientTable.addClass("theme-one"); $(".colour-menu").addClass("theme-one"); $("#clientmenu").addClass("theme-one"); } //If theme is set to 1, add the theme-two class to both tables if (theme === 1) { $("input#one").prop("checked", true); DOM.$consultantTable.addClass("theme-two"); DOM.$clientTable.addClass("theme-two"); $(".colour-menu").addClass("theme-two"); $("#clientmenu").addClass("theme-two"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "init() { }", "init() { }", "init() { }", "init() { }", "init() { }", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}"...
[ "0.8194347", "0.8194347", "0.8194347", "0.8194347", "0.8194347", "0.8117972", "0.8117972", "0.8117972", "0.8117972", "0.8117972", "0.8117972", "0.8117972", "0.8117972", "0.8117972", "0.8117972", "0.8091641", "0.8091641", "0.80416864", "0.80416864", "0.80416864", "0.80416864",...
0.0
-1
Day post len dau trang
appendPostItem(data){ const postItem =document.createElement('post-item') postItem.setAttribute('time',data.createdAt) postItem.setAttribute('author',data.authorName) postItem.setAttribute('content',data.content) const parent = this._shadowRoot.querySelector('.list-posts') parent.insertBefore(postItem,parent.firstChild) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getDayNumerals(date) { return `${date.day}`; }", "function day(date) { return `${date.getDate()}`.padStart(2, '0') }", "function cual_es_el_primerdia_del_mes(){\n let primer_dia=new Date(año_actual,mes_actual,1);\n //me devuelve numeros desde 0 a 7,en caso el dia sea domingo no devolvera 0\n return((p...
[ "0.67041546", "0.6577733", "0.63657904", "0.6258752", "0.6232723", "0.6220957", "0.6177638", "0.6152619", "0.6150676", "0.61175704", "0.61050975", "0.6075513", "0.6070949", "0.60697716", "0.6066193", "0.60587424", "0.60506594", "0.6039767", "0.6031716", "0.60267043", "0.60120...
0.0
-1
sets the values and starts loop
function initialiseInstruct(){ instruction = true; instructBackground = new image(0, 0, "grey-background.jpg", 0, 0); skipButton = new image(canvas.width*0.25, canvas.height*0.007, "SkipButton.jpg", 0, 0); styleText('black', '20px Courier New', 'left', 'middle'); instuctionLoop(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initValues() {\n isRunning = false;\n\n repsInput.min = 5;\n workoutInput.min = 5;\n restInput.min = 5;\n setsInput.min = 1;\n\n repsInput.max = 25;\n workoutInput.max = 60;\n restInput.max = 30;\n setsInput.max = 10;\n\n repsInput.value = 0;\n workoutInput.value = 0;\n restInput.value = 0;\n ...
[ "0.6320773", "0.6117743", "0.5933792", "0.5910895", "0.5879343", "0.58790517", "0.5854528", "0.57841414", "0.5775199", "0.57686514", "0.5762823", "0.57515126", "0.5747468", "0.5746751", "0.57456636", "0.5740188", "0.57246435", "0.5722126", "0.5722126", "0.5721913", "0.5677833...
0.0
-1
Draws instruction menu until scene is quit
function instuctionLoop(){ cycleThroughTut(); renderInstruct(); if(instruction == true){ requestAnimationFrame(instuctionLoop); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function giveInstructions()\n{\n startScene.visible = false;\n instructionScene.visible = true;\n gameScene.visible = false;\n pauseMenu.visible = false;\n gameOverScene.visible = false;\n buttonSound.play();\n}", "function on_paint() {\r\n menu_dt()\r\n menu_idt()\r\n menu_tgt()\r\n ...
[ "0.7120161", "0.6900808", "0.67599046", "0.6728848", "0.6671729", "0.66392726", "0.66339195", "0.66205895", "0.66122615", "0.6606728", "0.6605392", "0.6588319", "0.65448225", "0.65276915", "0.6520062", "0.65107983", "0.64992845", "0.64950776", "0.64842373", "0.6437842", "0.64...
0.0
-1
touch input detected and checking if touch is over the button plays sound and transistions the scene
function skipButtonCheck(press){ if(press.x > skipButton.x && press.x < skipButton.x + canvas.width*0.4){ if(press.y > skipButton.y && press.y < skipButton.y + canvas.height*0.1){ if(soundMgr != null){ soundMgr.playSound(1); } playGame(); instruction = false; } } tapCount++; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function touchStarted() {\n\n if (soundButton.checkClick()) {\n toggleSound();\n return;\n }\n //launch_wave = true;\n //Play sound\n //if (sndTap) sndTap.play();\n}", "function Update () {\n //Condicion q mira si se esta tocando la pantalla.\n\tif(Input.touches.Length<=0){\n\t//Si...
[ "0.74760234", "0.697224", "0.6907025", "0.6820985", "0.67606205", "0.673531", "0.6689788", "0.66718996", "0.66718996", "0.66718996", "0.66718996", "0.66718996", "0.66718996", "0.66607", "0.66339093", "0.6593432", "0.657949", "0.6578986", "0.6537714", "0.65229493", "0.6520357"...
0.6066934
65
If all letters are present in the range, return undefined.
function fearNotLetter(str) { // standard letters. let baseStr1 = "abcdefghijklmnopqrstuvwxyz"; let baseStr2 = baseStr1.toUpperCase(); let newStr = ""; // where the 'str' belongs to? if(baseStr1.includes(str[str.length-1])){ // all letters in the 'str' range. newStr = baseStr1.slice(baseStr1.indexOf(str[0]), baseStr1.indexOf(str[str.length-1])+1); } else if(baseStr2.includes(str[str.length-1])){ newStr = baseStr2.slice(baseStr2.indexOf(str[0]), baseStr2.indexOf(str[str.length-1])+1); } // removing str letters from newStr. for(let i=0; i<str.length; i++){ newStr = newStr.replace(str[i], "") } if(newStr === ""){ return undefined; } return newStr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fearNotLetter(str) {\n // Defining numeric range of str using the charCodes of the letters at first and last index \n // Start of range \n var start = str.charCodeAt(0);\n // End of range\n var end = str.charCodeAt(str.length - 1);\n // Variable for sum of all charCodes from start to e...
[ "0.6893768", "0.65742075", "0.63030726", "0.6282941", "0.6255146", "0.6251646", "0.6237533", "0.6231656", "0.6223378", "0.6222308", "0.6216839", "0.62127244", "0.6202994", "0.62001485", "0.6197708", "0.6184273", "0.6172212", "0.61381084", "0.611128", "0.6095741", "0.6095741",...
0.59112436
44
Width of this map, in tile
get width() { return this._width; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getLevelWidth() {\n return this.level.tilesWide;\n }", "get mapWidth() {return ~~(Math.abs(zeach.mapLeft) + zeach.mapRight)}", "get unmaskedWidth() { return calcTileDimension(this.lrs, this.uls); }", "get width() {\n\t\treturn this._viewport[2];\n\t}", "get cellWidth() {\n return (mi...
[ "0.78997207", "0.7895274", "0.735413", "0.7110984", "0.7062076", "0.7048138", "0.69047916", "0.68934506", "0.68678844", "0.6809308", "0.67909336", "0.6787914", "0.67807454", "0.67807454", "0.6764445", "0.6719613", "0.6710892", "0.66886866", "0.6679894", "0.6679243", "0.662853...
0.6366903
47
Height of this map, in tile
get height() { return this._height; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getLevelHeight() {\n return this.level.tilesHigh;\n }", "get height() {\n\t\treturn this._viewport[3];\n\t}", "getHeight() {\n return this.getSize().height;\n }", "get height() {}", "getHeight() {\n return this.height;\n }", "getHeight() {\n return this.height;\n }...
[ "0.7658962", "0.7227332", "0.722046", "0.7154478", "0.70686096", "0.70686096", "0.7057552", "0.7025391", "0.7018179", "0.69754326", "0.6971109", "0.696358", "0.6944016", "0.6944016", "0.6929047", "0.68862903", "0.68839806", "0.68208146", "0.68170047", "0.67997265", "0.6768999...
0.65432644
37
lexical scope var c = 30
function hello(){ var a = 10 hi() function hi(){ var b = 20 console.log(a) console.log(b) //console.log(c) bye() function bye(){ var c = 90 console.log(a) console.log(b) console.log(c) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function c() {\n return 55;\n }", "function setD(){\n var d = c+3; //d: setD scope c: setC scope\n console.log(a); // 4\n console.log(b); // 7\n console.log(c); // 10\n console.log(d); // 13\n }", "function $9514fc520c7e6d79$var$c(hljs) {\n c...
[ "0.69107276", "0.63701814", "0.6136218", "0.60084957", "0.59273505", "0.58931446", "0.5847", "0.5830722", "0.58072025", "0.5786071", "0.57838666", "0.5771608", "0.5761578", "0.5746294", "0.5740505", "0.57403105", "0.5725344", "0.5699241", "0.5669305", "0.56632644", "0.5659340...
0.5308088
58
This is just a simple component that is used with the `Menu` component to handle the initial focus on mount and refocusing a previous element on unmount.
function MenuEvents(_a) { var menuRef = _a.menuRef, cancelled = _a.cancelled, defaultFocus = _a.defaultFocus; utils_1.usePreviousFocus(cancelled); utils_1.useFocusOnMount(menuRef, defaultFocus, false, true); return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "focus () {\n if (this.refs.menu) {\n this.refs.menu.focus();\n }\n }", "function Unstable_TrapFocus(props) {\n var children = props.children,\n _props$disableAutoFoc = props.disableAutoFocus,\n disableAutoFocus = _props$disableAutoFoc === void 0 ? false : _props$disableAuto...
[ "0.7091245", "0.7084134", "0.70603585", "0.7025456", "0.7010709", "0.68850553", "0.6788572", "0.67726576", "0.6740301", "0.67388994", "0.6735324", "0.6735324", "0.6691775", "0.6666978", "0.6659369", "0.66484874", "0.6603217", "0.6603217", "0.6603217", "0.6603217", "0.6603217"...
0.0
-1
used to create new sheetArr and insert into sheetListArr
function initSheetDB() { // rows-> 100 // col - > 26 let sheetArr = []; for (let i = 0; i < rows; i++) { let row = document.createElement("div"); row.setAttribute("class", "row"); let rowArr = []; for (let j = 0; j < columns; j++) { let cell = document.createElement("div"); cell.setAttribute("class", "cell"); cell.setAttribute("rid", i); cell.setAttribute("cid", j); // col.innerText = `${String.fromCharCode(65 + j)} ${i + 1}`; // to allow editing content of cell cell.setAttribute("contenteditable", "true") row.appendChild(cell); let cellObj = { isBold: false, isItalic: false, isUnderline: false, fontSize: 16, fontFamily: "sans-serif", color: "#000000", bgColor: "#90EE90", halign: "center", value: "", formula: "", children: [] } rowArr.push(cellObj); } grid.appendChild(row); sheetArr.push(rowArr); } sheetListArr.push(sheetArr); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sheetFromArrayOfArrays(data, opts) {\n\tvar ws = {};\n\tvar o = readBlank(o, blankExcel);\n\tvar range = {s: {c:10000000, r:10000000}, e: {c:0, r:0 }};\n\tfor(var R = 0; R != data.length; ++R) {\n\t\tfor(var C = 0; C != data[R].length; ++C) {\n\t\t\tif(range.s.r > R) range.s.r = R;\n\t\t\tif(range.s.c > C...
[ "0.60110074", "0.593249", "0.5864598", "0.5745844", "0.5728667", "0.5689344", "0.5674755", "0.56507784", "0.56384474", "0.56379604", "0.5636499", "0.56359726", "0.5619502", "0.5614581", "0.56127757", "0.5480581", "0.5479997", "0.5476342", "0.5462662", "0.5460816", "0.54462343...
0.61509925
0
used to set UI with given sheetArr also click on first cell to update header as well
function setUI(sheetArr) { for (let i = 0; i < rows; i++) { for (let j = 0; j < columns; j++) { let uiCell = document.querySelector(`.grid .cell[rid="${i}"][cid="${j}"]`); let cellObj = sheetArr[i][j]; uiCell.innerText = cellObj.value; uiCell.style.fontWeight = cellObj.isBold == true ? "bold" : "normal"; uiCell.style.fontStyle = cellObj.isItalic == true ? "Italic" : "normal"; ""; uiCell.style.textDecoration = cellObj.isUnderline == true ? "underline" : "none"; uiCell.style.fontSize = cellObj.fontSize + "px"; uiCell.style.fontFamily = cellObj.fontFamily; uiCell.style.color = cellObj.color; uiCell.style.backgroundColor = cellObj.bgColor; uiCell.style.textAlign = cellObj.halign; } } document.querySelector(`.grid .cell[rid="${0}"][cid="${0}"]`).click(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initializeNewSheetUI() {\n Array.from(allCells).forEach(function(cell) {\n cell.style.fontSize = \"0.9rem\";\n cell.style.fontFamily = \"Arial\";\n cell.style.fontStyle = \"normal\";\n cell.style.fontWeight = \"normal\";\n cell.style.textDecoration = \"none\";\n ...
[ "0.599056", "0.58637744", "0.5730055", "0.5728528", "0.5722343", "0.5604165", "0.54379344", "0.54136455", "0.5397717", "0.5375089", "0.5371542", "0.5358489", "0.532233", "0.5316224", "0.53130704", "0.5303988", "0.52695", "0.52480084", "0.5245196", "0.52392656", "0.52111524", ...
0.7576053
0
Return this for chaining purposes
removeListener(type, listener) { let removedListener; const events = this._events; if (events === undefined) return this; const list = events[type]; if (list === undefined) return this; for (let i = list.length - 1; i >= 0; i--) { if (list[i] === listener) { removedListener = list[i]; list.splice(i, 1); this.emit("removedListener", type, removedListener); break; } } return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function self($this) {\n\treturn $this;\n}", "chain (_) {\n return this \n }", "chain(_) {\n return this\n }", "async init() {\n return this;\n }", "get and() { return this; }", "get and() { return this; }", "function whatisthis() {\n return this;\n }", "function self() {\n\...
[ "0.7244229", "0.70210856", "0.6618248", "0.6513707", "0.6367401", "0.6367401", "0.6234668", "0.60455465", "0.58607525", "0.5825014", "0.5808542", "0.58035344", "0.5656037", "0.5639107", "0.55959314", "0.5549902", "0.5546", "0.54693484", "0.54693484", "0.54693484", "0.54684454...
0.0
-1
will subsribe the current server.js instance to all the CHANNELS defined
subscribeToChannels() { Object.values(CHANNELS).forEach(channel => { this.subscriber.subscribe(channel); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "initAblyChannels(vueContext) {\n const outgoingCh = this.state.ablyRealtimeInstance.channels.get(\n this.state.channelNames.outgoingChat\n );\n\n const incomingCh = this.state.ablyRealtimeInstance.channels.get(\n this.state.channelNames.incomingChat\n );\n\n vueContext.commit(\"setAblyChan...
[ "0.6795607", "0.67696375", "0.6663511", "0.6593952", "0.6409361", "0.63744473", "0.62938994", "0.62904537", "0.62875086", "0.625929", "0.62564653", "0.62333924", "0.6202582", "0.61375165", "0.61308426", "0.61209255", "0.6096705", "0.6045399", "0.6010788", "0.5988721", "0.5978...
0.7591247
0
just a wrapper so that doesn't depend on the order of parameters 3 step process is used below to avoid sending the publish msg to itself, so temporarily unsubscribing from the channel, sending the msg, then resubs.
publish({ channel, message }) { this.subscriber.unsubscribe(channel, () => { this.publisher.publish(channel, message, () => { this.subscriber.subscribe(channel); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "publish({channel, message}){\n\n //so publisher doesnt recieve its own subsriber\n this.subscriber.unsubscribe(channel, () =>{\n\n this.publisher.publish(channel,message, () =>{\n\n this.subscriber.subscribe(channel);\n });\n });\n\n \n\n }", "publ...
[ "0.72361076", "0.67020357", "0.63273203", "0.6316169", "0.61151975", "0.6105858", "0.60267437", "0.6016639", "0.58336705", "0.5827908", "0.5806351", "0.5733078", "0.5708286", "0.5696445", "0.56883156", "0.567353", "0.5669166", "0.56598246", "0.5612098", "0.5607689", "0.554956...
0.65132046
2
Constructor, with class name
function Circle(circleId) { // Public properties, assigned to the instance ('this') this.circleId = circleId; this.visibility = 'invisible'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(name){\n this.name = name\n }", "constructor(name){\n this.name = name;\n }", "constructor({ name }) { // { name } is bringing in a object and deconstructing/ unpacking the object into the class \n this.name = name // name is the object you bring in, and this.name is this...
[ "0.735407", "0.73161775", "0.73048925", "0.7180896", "0.7180896", "0.7180896", "0.7180896", "0.714534", "0.71025836", "0.7068456", "0.6931619", "0.6931619", "0.6884747", "0.68681", "0.68619114", "0.68619114", "0.68619114", "0.68429136", "0.6833237", "0.6821018", "0.67739797",...
0.0
-1
Called in response to the wizard's message about initialization. Initializes the channels (causes the exchange of welcome messages with the other party) and waits for the success of all. Calls the "init" event after which it is allowed to send messages to other threads. Responds to the master about success
async _init({messageId}) { /** @type {Promise.<any>[]} */ const promises = [] this._workers.forEach(workers => workers.forEach(workerChannel => promises.push(workerChannel.init()))) await Promise.all(promises) this.inited = true this._emitter.emit('init') this._parentPort.postMessage({messageId: messageId, type: 'answer'}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupChannel() {\n\n // Join the control channel\n controlChannel.join().then(function(channel) {\n print('Joined controlchannel as '\n + '<span class=\"me\">' + username + '</span>.', true);\n });\n\n // Listen for new messages sent to the channel\n ...
[ "0.6419587", "0.62112224", "0.61842936", "0.6137302", "0.6068443", "0.6065586", "0.60554284", "0.5990148", "0.5982653", "0.5920931", "0.5882128", "0.579195", "0.57848835", "0.5747416", "0.5745913", "0.57404137", "0.5726432", "0.57172734", "0.5706203", "0.570559", "0.5688465",...
0.6183621
3
Get the latest orgSettings, merge with new settings, and PATCH the org
function setOrgSettings(orgId, settings) { var orgUrl = UrlConfig.getAdminServiceUrl() + 'organizations/' + orgId + '/settings'; savedOrgSettingsCache.push({ orgId: orgId, propertySaveTimeStamp: new Date(), setting: _.clone(settings) }); return getOrg(_.noop, orgId, true) //get retrieves the pushed value above, no need to re assign to orgSettings .then(function (response) { var orgSettings = _.get(response, 'data.orgSettings', {}); return $http({ method: 'PATCH', url: orgUrl, data: orgSettings }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async updateSettings() {\n let merged = Object.assign({}, this.getData());\n let settings = this.getSettings();\n Object.keys(settings).forEach(key => {\n if (settings[key]) {\n merged[key] = settings[key];\n }\n });\n\n // Merge back into settings.\n await this.setSettings(mer...
[ "0.61516124", "0.58268094", "0.5594348", "0.5434291", "0.5326535", "0.5277016", "0.527476", "0.52361643", "0.52162296", "0.52082705", "0.51942027", "0.5194096", "0.51850206", "0.5179558", "0.51433194", "0.51153094", "0.5103088", "0.5103088", "0.5103088", "0.5079765", "0.50761...
0.6729033
0
Constructs a new BandwidthMessageItem.
function BandwidthMessageItem() { _classCallCheck(this, BandwidthMessageItem); BandwidthMessageItem.initialize(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BandwidthMessage() {\n _classCallCheck(this, BandwidthMessage);\n\n BandwidthMessage.initialize(this);\n }", "constructor() { \n \n BandwidthCallbackMessage.initialize(this);\n }", "function MessageBusCustomSerializer()\r\n {\r\n var myStringEncoding = new Utf8Encodin...
[ "0.7519506", "0.6120209", "0.56919426", "0.5309312", "0.5309312", "0.53088677", "0.52782136", "0.5252194", "0.5245615", "0.5239629", "0.52356917", "0.52263707", "0.5223723", "0.5223723", "0.52047044", "0.52047044", "0.50649637", "0.49869293", "0.4892729", "0.48744118", "0.485...
0.87441134
0
Retrieve the main application file from the server to detect if the file is in edit mode. A reload is invoked ONLY if the file is not in edit mode. No changes to the server are required because this is only needed in the short term.
function selectiveReload() { script_url = server + "/build/compositions/" + composition + ".dre.screens." + screen + ".js"; if (preview) script_url = UpdatePreview(script_url); var script = {} var scripturl = url.parse(script_url); var base_path = define.filePath(script_url); script.src = script_url; script_tags[script_url] = script; http.get({ host: scripturl.hostname, port: scripturl.port, path: scripturl.path }, function(res) { res.src = script_url; res.data = ""; res.on('data', function(buf) { this.data += buf; }); res.on('end', function() { var editable = this.data.indexOf('editable'); //console.log('*****onend. File loaded', editable); if (editable == -1) { // Reload because the application is not in edit mode Reload(); } }); }.bind(this)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function edit(){\n\t\treturn M.status == 'edit';\n\t}", "edit() {\n const { alert } = Nullthrows(this.props.dialogService);\n const { terminal } = Nullthrows(this.props.directoryService);\n const { unescape } = Nullthrows(this.props.uriService);\n\n const editor = this.env.EDITOR;\n\n if (!editor)...
[ "0.58725655", "0.5794385", "0.5763157", "0.5757436", "0.5489307", "0.5356843", "0.5280133", "0.5226545", "0.52139527", "0.5183985", "0.51790977", "0.51245725", "0.51190376", "0.5103346", "0.5100292", "0.5098066", "0.5070808", "0.50440043", "0.5034956", "0.5032148", "0.5027819...
0.60204726
0
return: "Result from the two numbers: 3+hh=3hh" Beacuse of string concatenation. task 4:
function mul(n1, n2){ return n1 * n2; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add_tos(n1,n2){\n return (n1 + n2) + \"\";\n}", "function ourEx(a, b, numOne, numTwo) {\n var total = numOne + numTwo;\n return a.concat(\" \", b) + \" \" + total;\n}", "function numberJoinerFancy (number1, number2, anyString) {\n if (number1 > number2) {\n return \"error, number 1 must b...
[ "0.6925499", "0.6874589", "0.67691725", "0.6572524", "0.64443386", "0.6398505", "0.62930566", "0.62586904", "0.6215849", "0.6215357", "0.62147975", "0.61456877", "0.6140357", "0.61328834", "0.6130989", "0.6112486", "0.6066109", "0.6058203", "0.60520244", "0.60482556", "0.6021...
0.0
-1
MAIN FUNCTIONS create base chart
function drawChart() { stroke(0); yAxis(); xAxis(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeCharts() {\n issueChart();\n countChart();\n averageChart();\n}", "function chart(){\n\t\tthis.init();\n\t}", "function initialChart(datain,CTY,TYPE) { \r\n\r\ngenChart(datain[0],datain[1],datain[2],CTY,TYPE); //Generates the chart\r\n \r\n}", "function createChart(options){var data=Ch...
[ "0.74476177", "0.7180334", "0.7173509", "0.71331084", "0.70514953", "0.6987833", "0.6935171", "0.68771267", "0.68759674", "0.6856717", "0.68513006", "0.6810344", "0.6773718", "0.6772081", "0.6768711", "0.6743599", "0.67392635", "0.6717776", "0.67071825", "0.66914606", "0.6670...
0.0
-1
SUB FUNCTIONS bar graph
function drawBarGraph() { var mapped; for(i = 0; i < gradPercentages.length; i++) { console.log(gradPercentages); console.log(yRange); //I'm not yet sure why I have to have the second start value as 0 // mapped = map(yTickLabels[i], 0, yRange[0], margin, height - margin * 2); /*** TEMP TEST ***/ mapped = map(gradPercentages[i], 0, yRange[0], 0, height - margin * 2); console.log(mapped); mappedHeights.push(mapped); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bar(d) {\r\n\t\t var bar = svg.insert(\"svg:g\", \".y.barHierAxis\")\r\n\t\t .attr(\"class\", \"enter\")\r\n\t\t .attr(\"transform\",function(){if($.browser.msie){\t\t \t \t\t\t\t\t\t\t\t\t\r\n\t\t \t \t\t\t\t\t\t\t\tif(d.children.length * y*1.6 < h){\r\n\t\t \t \t\t\t\t\t\t\t\t\tre...
[ "0.7665458", "0.7209431", "0.72080517", "0.7183631", "0.7106408", "0.7061236", "0.7039619", "0.70314676", "0.70226544", "0.70191246", "0.69942963", "0.6990852", "0.6976195", "0.69394803", "0.693454", "0.6907048", "0.6890119", "0.68868494", "0.6886123", "0.68793976", "0.686785...
0.0
-1
add text to axes
function drawText(label, xPos, yPos, txtSize, txtWeight) { textAlign(CENTER); textFont("Arial"); textSize(txtSize); textStyle(txtWeight); fill(textColor); strokeWeight(0); text(label, xPos, yPos); //The stroke weight needed for the lines is making the text too thick. //I should probably fix this via CSS instead strokeWeight(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addText() {\n svg.append(\"text\")\n .attr(\"class\", \"xtext\")\n .attr(\"x\", w - margins.right)\n .attr(\"y\", h - 5)\n .attr(\"text-anchor\", \"middle\")\n .text(\"Consumer confidence\");\n\n svg.append(\"text\")\n .attr(\"class\", \"ytext\")\n .attr(\"x\", -23...
[ "0.7305184", "0.6694537", "0.6685471", "0.6575605", "0.6556672", "0.65444285", "0.6511184", "0.6506409", "0.64492476", "0.64079833", "0.639058", "0.6328076", "0.6275608", "0.6266891", "0.62289137", "0.62277144", "0.62129986", "0.6180286", "0.6165686", "0.6141114", "0.6133513"...
0.58413595
56
draw ticks for yaxis
function drawYTicks() { var tickSpread for( i = 0; i < yTicks; i++) { console.log(yTicks); tickSpread = margin + ((height - margin * 2)/yTicks) * i; console.log(tickSpread); line(margin - tickLength, tickSpread, margin, tickSpread); drawText(yRange[i], margin - margin/2, tickSpread + 3, 10, NORMAL); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawYAxis() {\n // draw tick marks and labels\n var domain = y1Domain,\n styles = vis.__styles,\n ticks = vis.getYTicks(scales.y, c.h, extendRange, useLogScale);\n\n if (!extendRange && ticks[ticks.length-1] != domain[1]) t...
[ "0.8050013", "0.7813864", "0.7431171", "0.74286443", "0.73971355", "0.73690313", "0.7366151", "0.73654073", "0.7363665", "0.7362658", "0.7350034", "0.7338324", "0.732394", "0.73208547", "0.7311484", "0.7285698", "0.72819924", "0.7271029", "0.725871", "0.7255525", "0.7223864",...
0.7536166
2
draw ticks for xaxis
function drawXTicks() { drawBarGraph(); var tickSpread for( i = 0; i < xTicks; i++) { tickSpread = margin * 1.6 + ((width - margin * 1.5)/xTicks)*i; line(tickSpread, height - margin, tickSpread, height - margin + 20); drawText(xTickLabels[i], tickSpread, 540, 10, NORMAL); barGraph(tickSpread - margin/2, height - margin - mappedHeights[i], mappedHeights[i]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function make_x_gridlines() {\t\t\n return d3.axisBottom(x)\n .ticks( 2*favoriteTicks )\n }", "function make_x_gridlines() {\n return d3.axisBottom(x)\n .ticks(30);\n }", "function make_x_gridlines() { \n return d3.axisBottom(x)\n ...
[ "0.73202056", "0.7311901", "0.72965014", "0.72855407", "0.72785145", "0.7271468", "0.726638", "0.7255067", "0.7234316", "0.7232179", "0.7221305", "0.7180758", "0.7180758", "0.7168703", "0.7160523", "0.713151", "0.7098985", "0.7047734", "0.70434415", "0.7034666", "0.7034666", ...
0.80457664
0
take y Values and convert to a percentage
function numToPercent() { var allGrads = useData[1].graduates; var percentage; allGrads = parseInt(allGrads.replace(/,/g, ""), 10); for( i = 0; i < xTicks; i++) { percentage = (yTickLabels[i]/allGrads) * 100; gradPercentages.push(percentage); gradPercentages2.push(percentage); } percentageMax = roundUp(gradPercentages[0], 10); console.log(gradPercentages); console.log(gradPercentages2); // console.log(percentageMax); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pctFromYVal(yValue) {\n return yValue * 100 / canvas.height;\n}", "function yValFromPct(percent) {\n return percent * canvas.height / 100;\n}", "function getCompletePercent(time, y1, y2) {\n\t\t\t\t\t\t\t\t return 3 * Math.pow(1 - time, 2) * time * y1 + 3 * (1 - time) * time * time * y2 + time * ...
[ "0.79418284", "0.7015459", "0.67400825", "0.67011386", "0.6657655", "0.6552345", "0.65198636", "0.6511979", "0.63158435", "0.6278235", "0.6221975", "0.61959064", "0.6161687", "0.615416", "0.61429405", "0.61137277", "0.6101778", "0.6100665", "0.60851705", "0.60667145", "0.6062...
0.6664349
4
BASIC SUPPORT FUNCTIONS find the max value in an array
function findMax(array) { maxValue = Math.max.apply(null, array); console.log(maxValue); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findMax(array) {\n}", "function array_max_value(array) {\n\t\treturn Math.max.apply(Math, array);\n\t}", "function getMaxValue(array){\n return Math.max.apply(null, array);\n}", "function Max( array ){\n\t\treturn Math.max.apply( Math, array );\n\t}", "static getMax(array) {\n \n // todo:...
[ "0.8813623", "0.8783612", "0.86315036", "0.85953796", "0.8592138", "0.8563815", "0.84774816", "0.8377208", "0.8364762", "0.83626467", "0.8361728", "0.8338167", "0.82901615", "0.827373", "0.8242924", "0.823921", "0.8221206", "0.8206892", "0.8192412", "0.81895953", "0.8186961",...
0.8563336
6
round a value up
function roundUp(unrounded, decimalPlace) { var rounded = Math.ceil(unrounded/decimalPlace) * decimalPlace; return rounded; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function roundup(input){\r\n input = Math.ceil(input);\r\n\treturn input;\r\n}", "function HGC_roundup(value) {\n\tvar decplaces = config.get(\"hgc_decimal_places\", 5);\n\treturn Math.ceil(value * Math.pow(10, decplaces)) / Math.pow(10, decplaces);\n}", "function roundup(number,decimal_points) {\r\n\tif (n...
[ "0.7982397", "0.7958982", "0.76288724", "0.75130343", "0.7313369", "0.7268898", "0.72425175", "0.7162718", "0.69669044", "0.69592524", "0.6908376", "0.6895172", "0.6892974", "0.68684393", "0.68684393", "0.6805166", "0.6791725", "0.6726656", "0.66076475", "0.64948666", "0.6453...
0.7349217
4
create an array by looping to make a range of values
function makeRange(rangeMax, rangeDecimalPlace, rangeArray) { for(i=0; i <= rangeMax; i+=rangeDecimalPlace ) { rangeArray.push(i); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateRange(min, max, step){\n //varible declaration named narray set empty\n let narray = [];\n //for loop let i assigned to min; i less or \n //equal to max; i plus equals step\n for(let i = min; i <= max; i += step){\n //narray push method with i as parameter\n narray.pus...
[ "0.7677934", "0.75010026", "0.74562925", "0.7396584", "0.73934567", "0.73292947", "0.7306826", "0.7287914", "0.7272142", "0.72576505", "0.72504896", "0.7228069", "0.72248954", "0.7200741", "0.71721566", "0.7156858", "0.7153538", "0.7151983", "0.71475", "0.7147081", "0.7094482...
0.6719852
85
A streaming encoder var encoder = new base32.Encoder() var output1 = encoder.update(input1) var output2 = encoder.update(input2) var lastoutput = encode.update(lastinput, true)
function Encoder() { var skip = 0 // how many bits we will skip from the first byte var bits = 0 // 5 high bits, carry from one byte to the next this.output = '' // Read one byte of input // Should not really be used except by "update" this.readByte = function(byte) { // coerce the byte to an int if (typeof byte == 'string') byte = byte.charCodeAt(0) if (skip < 0) { // we have a carry from the previous byte bits |= (byte >> (-skip)) } else { // no carry bits = (byte << skip) & 248 } if (skip > 3) { // not enough data to produce a character, get us another one skip -= 8 return 1 } if (skip < 4) { // produce a character this.output += alphabet[bits >> 3] skip += 5 } return 0 } // Flush any remaining bits left in the stream this.finish = function(check) { var output = this.output + (skip < 0 ? alphabet[bits >> 3] : '') + (check ? '$' : '') this.output = '' return output } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encode(input) {\n var encoder = new Encoder()\n var output = encoder.update(input, true)\n return output\n}", "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "f...
[ "0.692835", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0.6352483", "0...
0.5990681
78
Functions analogously to Encoder
function Decoder() { var skip = 0 // how many bits we have from the previous character var byte = 0 // current byte we're producing this.output = '' // Consume a character from the stream, store // the output in this.output. As before, better // to use update(). this.readChar = function(char) { if (typeof char != 'string'){ if (typeof char == 'number') { char = String.fromCharCode(char) } } char = char.toLowerCase() var val = lookup()[char] if (typeof val == 'undefined') { // character does not exist in our lookup table return // skip silently. An alternative would be: // throw Error('Could not find character "' + char + '" in lookup table.') } val <<= 3 // move to the high bits byte |= val >>> skip skip += 5 if (skip >= 8) { // we have enough to preduce output this.output += String.fromCharCode(byte) skip -= 8 if (skip > 0) byte = (val << (5 - skip)) & 255 else byte = 0 } } this.finish = function(check) { var output = this.output + (skip < 0 ? alphabet[bits >> 3] : '') + (check ? '$' : '') this.output = '' return output } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "function Encoder() {}", "function Encoder()...
[ "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "0.7947241", "...
0.0
-1
Convenience functions These are the ones to use if you just have a string and want to convert it without dealing with streams and whatnot. String of data goes in, Base32encoded string comes out.
function encode(input) { var encoder = new Encoder() var output = encoder.update(input, true) return output }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stringEncode(str) {}", "function encode(string){\n\n}", "function utf32ToString(data, start = 0, end = data.length) {\n let result = '';\n for (let i = start; i < end; ++i) {\n let codepoint = data[i];\n if (codepoint > 0xFFFF) {\n // JS strings are encoded as UTF16, thu...
[ "0.6849054", "0.6676269", "0.65681326", "0.6391992", "0.63851833", "0.6383081", "0.6370508", "0.6283696", "0.6254958", "0.6132108", "0.6109399", "0.6109399", "0.6102351", "0.60714215", "0.600172", "0.59440064", "0.5919678", "0.5919678", "0.5919678", "0.5919678", "0.59118026",...
0.0
-1
Base32encoded string goes in, decoded data comes out.
function decode(input) { var decoder = new Decoder() var output = decoder.update(input, true) return output }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encodeBase32(input) {\n if (!input) return;\n\n return base32Encode(input, \"RFC4648-HEX\", {\n padding: false,\n }).toLowerCase();\n}", "base32tohex(base32) {\n var base32chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';\n var bits = '';\n var hex = '';\n\n for (var i = 0; i...
[ "0.6593854", "0.60500026", "0.5987351", "0.5970213", "0.5917713", "0.59132403", "0.5759251", "0.5729799", "0.5680068", "0.56631625", "0.5588629", "0.5583971", "0.5573081", "0.5558043", "0.5556288", "0.5553738", "0.5547467", "0.5547467", "0.5547467", "0.5541652", "0.55230474",...
0.0
-1
retrieve video and audio files
async function destress() { if(!environment){ return error.textContent = 'Please select an AMBIENCE to begin.' }else{ player.style.display = 'block'; initBtn.style.display = 'block'; start.style.display = 'none'; let videos = []; const endpointVideo = `https://api.pexels.com/videos/search?query=${environment}&per_page=10&format=json`; const endpointAudio1 = `https://freesound.org/apiv2/search/text/?query=${environment}&format=json`; const api_key_pixel = '563492ad6f9170000100000164eb2f7346bb45fa8c6f43e02e19e313'; const token_freesound = 'RoHr85KPTz8nzxyWzfhnhjaLjz0BVi0z21Irx3vf'; fetch(endpointVideo, { headers: { Authorization: api_key_pixel, }, }) .then((data) => data.json()) .then((res) => { videos = res; let videoSrc = videos.videos[1].video_files[2].link; video.setAttribute('src', `${videoSrc}`); }); const audioCode = await fetch(endpointAudio1, { headers: { Authorization: `token ${token_freesound}`, }, }) .then((res) => res.json()) .then((data) => { console.log; return data.results[0].id; }); console.log(audioCode); let endpointAudio2 = `https://freesound.org/apiv2/sounds/${audioCode}/?format=json`; fetch(endpointAudio2, { headers: { Authorization: `token ${token_freesound}`, }, }) .then((res) => res.json()) .then((data) => { audio.setAttribute('src', `${data.previews['preview-hq-mp3']}`); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handle_files(file) {\n //REALLY IMPORTANT to use .path here and not .name. We want the whole path for the video\n //not just the name so we can open videos from every folder (absolute path)\n var path = file[0].path;\n get_video(path);\n}", "function getFiles() {\n listFiles(function (err, ...
[ "0.64799833", "0.641701", "0.61514914", "0.6136997", "0.6066638", "0.60436785", "0.60054153", "0.59925205", "0.5966086", "0.59082526", "0.5907003", "0.5902456", "0.58563197", "0.5829322", "0.5803551", "0.580177", "0.5764502", "0.57594764", "0.575666", "0.5707653", "0.5698229"...
0.514101
99
Update local state w/curr state of input elem
function handleChange(evt) { const { name, value } = evt.target; const newFormData = { ...formData, [name]: value }; throttleSearch.current(newFormData); setFormData(newFormData); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update() {\n\t this.value = this.originalInputValue;\n\t }", "function updateState(el, val) {\n\n for (var j = 0; j < sliderStates.length; j++) {\n\n if (_.contains(sliderStates[j].range, parseInt(val))) {\n currentState = sliderStates[j];\n updateSlider(...
[ "0.6723915", "0.6299927", "0.6179135", "0.61291647", "0.6035163", "0.6003333", "0.599754", "0.59693766", "0.5953749", "0.5934249", "0.592317", "0.59162563", "0.58947814", "0.58946", "0.5834611", "0.58163303", "0.5792743", "0.5772733", "0.5722151", "0.572093", "0.57094574", ...
0.0
-1
error message for different condition
function showError(error) { switch (error.code) { case error.PERMISSION_DENIED: alert("fail to find your location,please open the permission of location tracking!"); break; case error.POSITION_UNAVAILABLE: alert("fail to find your location,your location is unavailable!"); break; case error.TIMEOUT: alert("time out to find your location"); break; case error.UNKNOWN_ERROR: alert("fail to find your location, the location system is broken!"); break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateMultiConditionalErrorMessages(message1, message2, condition1, condition2){\n if(condition1){\n return \"<p>-\"+message1+\"</p>\";\n } else if(condition2){\n return \"<p>-\"+message2+\"</p>\";\n } else {\n return \"\";\n }\n}", "function adderr(txt) { return !fiel...
[ "0.6975518", "0.67025954", "0.66896886", "0.6591342", "0.6577045", "0.65005034", "0.6499716", "0.64492536", "0.6436093", "0.6389642", "0.6355664", "0.63281006", "0.6313471", "0.6305448", "0.6271974", "0.62452453", "0.6209171", "0.6188323", "0.6181044", "0.6180552", "0.6152124...
0.0
-1
FUNCION PARA CARGAR SCRIPTS EN TIEMPO DE EJECUCION
function cargarScript(url) { var script = document.createElement("script"); script.src = url; document.head.appendChild(script); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function subSmartClient(script_retorno) {\n\n var scripts = \"\";\n\n var tipo_retorno = typeof (script_retorno);\n\n if (tipo_retorno == \"string\") {\n try {\n var retorno_json = JSON.parse(script_retorno);\n script_retorno = retorno_json;\n tipo_retorno = \"objec...
[ "0.65073144", "0.61418647", "0.613855", "0.6061374", "0.5928193", "0.5910471", "0.58476037", "0.5817745", "0.58097744", "0.57918566", "0.5774285", "0.5720684", "0.57020557", "0.5695984", "0.5683375", "0.5658825", "0.5644718", "0.56337863", "0.56293327", "0.56149", "0.5605188"...
0.0
-1
EDITAR MANEJADOR DE EVENTOS
function asignarManejadores() { traerPersonajes(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function constroiEventos(){}", "function holaMundo() {\n // esta funcion se convertira en una manejadora de eventos es deir que es una fcuncion que se ejecuta en un evento\n alert(\"Hola Mundo\");\n console.log(event);\n }", "function editEvent(){\n\t\n}", "function iniEvt() {\r\n // rellenar lo...
[ "0.74095", "0.66228", "0.651536", "0.6503266", "0.63039476", "0.6283037", "0.623237", "0.6229678", "0.6122848", "0.6082184", "0.60695463", "0.6067592", "0.6066767", "0.6052557", "0.6014842", "0.59703517", "0.5969801", "0.59581894", "0.59462136", "0.5940136", "0.5936069", "0...
0.0
-1
End Game Macanism Function Start End Game Function
function endGame(status) { let // Select Popuo Element popup = document.querySelector(".popup"), // Select Player Status Element playerStatus = popup.querySelector(".player-status"), // Select Player Status Span playerStatusSpan = playerStatus.querySelector("span"), // Select Wrong Attempts Span wrongAttemptsSpan = popup.querySelector(".wrong-attempts span"), // Select Play Again Button playAgainBtn = popup.querySelector(".play-again"); // Show Popup Element popup.style.display = "block"; // Set Player Status [Win Or Fail] playerStatusSpan.textContent = status; // Set Wrong Attempts Number wrongAttemptsSpan.textContent = wrongAttempts; // Check If The Player [Win Or Fail] if (status === "Win") { playerStatus.classList.add("win"); if (playerStatus.classList.contains("fail")) { playerStatus.classList.remove("fail"); } } else { playerStatus.classList.add("fail"); if (playerStatus.classList.contains("win")) { playerStatus.classList.remove("win"); } } // Play Again playAgainBtn.onclick = function () { // Hid Popup Element popup.style.display = "none"; // Reset [wrongAttempts] & [rightChoose] Value wrongAttempts = 0; rightChoose = 0; // Empty Letters Container lettersContainer.innerHTML = ""; // Remove Finished Class From Letters Container if (lettersContainer.classList.contains("finished")) { lettersContainer.classList.remove("finished"); } // Trigger Generate Letters Function generateLetters(); // Trigger Get Word Functuin getWord(); // Empty Letters Guess Contianer lettersGuessContainer.innerHTML = ""; // Trigger Guess Function guess(); // Remove Wrong Class From Hangman Draw for (let i = 1; i <= 8; i++) { if (theDraw.classList.contains(`wrong-${i}`)) { theDraw.classList.remove(`wrong-${i}`); } } gameMacanism(); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function endGame() {\n \n}", "function endSala() {\r\n\tgame.endSala();\r\n}", "function end() {\n game.end();\n console.log('End!!, thank you for playing');\n }", "function handleEndGame() {\n\n}", "function endGame() {\n gameStarted = false;\n}", "endGameAction() {\n\n }", "function endGa...
[ "0.8650194", "0.8592154", "0.8428784", "0.8288306", "0.8240698", "0.8225265", "0.8175274", "0.8114775", "0.80864143", "0.80562156", "0.80367404", "0.8020487", "0.7942443", "0.79398096", "0.7923459", "0.7912837", "0.7894272", "0.787532", "0.7871396", "0.78666824", "0.78550494"...
0.0
-1
after the resource has been saved in the server
function inner_after_save() { that.processCodeInScripts(); that.editor.focus(); that.showInFooter("saved"); LiteGUI.trigger( that, "stored" ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async postSave () {\n\t}", "function saved () {\n delete data._etag\n cb(er, data, raw, response)\n }", "save() {}", "save() {\n this._requireSave = true;\n }", "function save() {\n\t\tif (editorInterface) {\n\t\t\tvar content = editorInterface.getContent();\n\t\t\tconsole.log('savin...
[ "0.68075913", "0.66550756", "0.66085833", "0.65785104", "0.6465232", "0.6438175", "0.639489", "0.6338518", "0.6327138", "0.6319849", "0.6298048", "0.62977606", "0.62836504", "0.628077", "0.62728924", "0.6172547", "0.61535335", "0.6153074", "0.6142813", "0.6127961", "0.6105023...
0.592683
35
Makes all min and max timestamps within a textgrid the same
_homogonizeMinMaxTimestamps () { const minTimes = this.tierNameList.map(tierName => this.tierDict[tierName].minTimestamp); const maxTimes = this.tierNameList.map(tierName => this.tierDict[tierName].maxTimestamp); const minTimestamp = Math.min(...minTimes); const maxTimestamp = Math.max(...maxTimes); this.minTimestamp = minTimestamp; for (let i = 0; i < this.tierNameList.length; i++) { const tierName = this.tierNameList[i]; this.tierDict[tierName].minTimestamp = minTimestamp; } this.maxTimestamp = maxTimestamp; for (let i = 0; i < this.tierNameList.length; i++) { const tierName = this.tierNameList[i]; this.tierDict[tierName].maxTimestamp = maxTimestamp; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "reset_extents(min, max) {\n const ds = this.jdiv.find('#time-slider')\n const vals = ds.dragslider('values')\n ds.dragslider('option', 'min', min)\n ds.dragslider('option', 'max', max)\n ds.dragslider('values', vals) // Restore values after setting min/max to fix slider location ...
[ "0.6326907", "0.6007487", "0.5998801", "0.57812697", "0.5740444", "0.5677907", "0.56015927", "0.5523153", "0.5512461", "0.5402474", "0.5368161", "0.5356251", "0.5342138", "0.5340793", "0.5313067", "0.52953243", "0.5280509", "0.5280406", "0.52755004", "0.5269169", "0.5266192",...
0.6673928
0
O(n) time, O(1) space where n is the number of node in LinkedList
function nodeSwap(head) { const tempNode = new LinkedList(0); tempNode.next = head; let prevNode = tempNode; while(prevNode.next !== null && prevNode.next.next !== null) { const firstNode = prevNode.next; const secondNode = prevNode.next.next; // prevNode -> firstNode -> secondNode -> x firstNode.next = secondNode.next; secondNode.next = firstNode; prevNode.next = secondNode; // prevNode -> secondNode -> firstNode -> x prevNode = firstNode; } return tempNode.next; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function size(ll) {\n let current = ll.head;\n let next = current.next;\n let count = 0;\n while (next !== null && next.value !== null) {\n count++;\n current = next;\n next = next.next;\n }\n console.log(count + 1);\n}", "_findNthElement (position){\n let node = this.head;\n for(let i = 0; ...
[ "0.66572344", "0.6570356", "0.6507652", "0.6392369", "0.6391085", "0.6367862", "0.634581", "0.6285845", "0.6279484", "0.6216474", "0.61976904", "0.61947334", "0.6188643", "0.6187371", "0.6183376", "0.6180763", "0.6136981", "0.6135857", "0.61323345", "0.61304396", "0.61262697"...
0.0
-1
Get between two integer points
static between($str, $start, $end, $fromEnd = false) { let $length, $index; $str = ' ' + $str; $index = $str.indexOf($start); if ($index == 0) { return ''; } $index += $start.length; $length = $fromEnd ? $str.substr($index).lastIndexOf($end) : $str.indexOf($end, $index) - $index; return $str.substr($index, $length); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getBetween(from, to) {\n\tvar resultX = (from[0] + to[0]) / 2;\n\tvar resultY = (from[1] + to[1]) / 2;\n\treturn [resultX, resultY];\n}", "function midpoint(P1, P2) {\n var x1 = P1[0];\n var y1 = P1[1];\n var x2 = P2[0];\n var y2 = P2[1];\n var result = [(x1 + x2)*0.5, (y1 + y2)*0.5];\n ...
[ "0.70324755", "0.6682455", "0.66802156", "0.6624612", "0.66237664", "0.6475909", "0.6367184", "0.6356672", "0.6356672", "0.6356672", "0.6356672", "0.6356672", "0.6348911", "0.63246673", "0.63246673", "0.63246673", "0.63246673", "0.63246673", "0.63246673", "0.63246673", "0.632...
0.0
-1
! vuerouter v3.1.3 (c) 2019 Evan You
function Lo(e){return Object.prototype.toString.call(e).indexOf("Error")>-1}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jj(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"source.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "private public function m246() {}", "function TM(t,e,n,i,r,o,a,s){var u=(\"functio...
[ "0.5924966", "0.58903253", "0.5834089", "0.5810637", "0.5764255", "0.5731859", "0.56664914", "0.5651077", "0.5648576", "0.56271744", "0.56117946", "0.56101716", "0.56060225", "0.55370706", "0.5529062", "0.5494708", "0.5491031", "0.54674906", "0.5427357", "0.5420879", "0.54150...
0.0
-1
Function to get get form values
function getInputVal(id) { return document.getElementById(id).value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFormValuesAndDisplayResults() {\n}", "function formValues() {\n var data = {};\n traceLib.stored.forEach(function(field) {\n data[field] = $('#' + field).val() || '';\n });\n return data;\n}", "formValues() {\n if (this.refs.form) {\n return this.refs.form.getValues();\n ...
[ "0.80177325", "0.76395994", "0.756658", "0.7546938", "0.7505224", "0.7485923", "0.74377346", "0.7310933", "0.7303236", "0.7302365", "0.729632", "0.72903097", "0.7228507", "0.7225521", "0.72253585", "0.7183716", "0.71165633", "0.71085596", "0.7043961", "0.7036532", "0.69783896...
0.0
-1
let user_avatar = sessionStorage.getItem("avatar");
function formatDate(date) { var d = new Date(date); d = d.toLocaleString(); return d; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getSessionStorageUser() {\n return JSON.parse(sessionStorage.getItem('user'))\n }", "function currentUser (){\n return JSON.parse(window.sessionStorage.getItem(\"user_info\"));\n}", "function retrieveProfileInfo() {\n return JSON.parse(sessionStorage.getItem(\"user\"));\n}", "function userData() {\n...
[ "0.7544847", "0.7537312", "0.7509092", "0.7472185", "0.7259181", "0.71891475", "0.69788104", "0.69788104", "0.68240356", "0.68150795", "0.6775644", "0.6754238", "0.66192895", "0.6541612", "0.6538189", "0.6490416", "0.64798826", "0.6471159", "0.64498585", "0.6448299", "0.63841...
0.0
-1
switch to next tab and tell tab to block context menu
function nextTab() { var query = { currentWindow: true, hidden: false, }; if (skiploading) query['status'] = 'complete'; if (skipdiscarded) query['discarded'] = false; browser.tabs.query(query).then(tabs => { let current = tabs.findIndex(tab => tab.active); let next = current + 1; while (true) { // past the last tab? if (next >= tabs.length) { if (!wrap) { return true; } else { next = 0; } } // lapped all the way around if (next == current) return true; // skip urls if (skipurls.indexOf(tabs[next].url) > -1) { next++; continue; } // if we get here, we have a tab to switch to break; } browser.tabs.sendMessage(tabs[next].id, { topic: 'scrolledToTab' }).catch (error => {}); browser.tabs.update(tabs[next].id, { active: true }); return true; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextTab() {\n if (menuIsNotOpening()) {\n var selected = $ionicTabsDelegate.selectedIndex();\n if (selected !== -1 && selected !== 0) {\n $ionicTabsDelegate.select(selected - 1);\n }\n }\n }", "function nextTab(elem) {\n $(elem).next().find('a[data-toggle=\"ta...
[ "0.72246015", "0.6794414", "0.6721571", "0.67163616", "0.66667014", "0.66306025", "0.65678585", "0.6517714", "0.64530855", "0.64354193", "0.6415026", "0.6403841", "0.6345488", "0.6344405", "0.6316878", "0.6285274", "0.62615645", "0.62448984", "0.6244323", "0.6231994", "0.6190...
0.62621355
16
switch to previous tab and tell tab to block context menu
function prevTab() { var query = { currentWindow: true, hidden: false, }; if (skiploading) query['status'] = 'complete'; if (skipdiscarded) query['discarded'] = false; browser.tabs.query(query).then(tabs => { let current = tabs.findIndex(tab => tab.active); let prev = current - 1; while (true) { // before the first tab? if (prev < 0) { if (!wrap) { return true; } else { prev = tabs.length - 1; } } // lapped all the way around if (prev == current) return true; // skip urls if (skipurls.indexOf(tabs[prev].url) > -1) { prev--; continue; } // if we get here, we have a tab to switch to break; } browser.tabs.sendMessage(tabs[prev].id, { topic: 'scrolledToTab' }).catch (error => {}); browser.tabs.update(tabs[prev].id, { active: true }); return true; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function previousTab() {\n if (menuIsNotOpening()) {\n var selected = $ionicTabsDelegate.selectedIndex();\n if (selected !== -1) {\n $ionicTabsDelegate.select(selected + 1);\n }\n }\n }", "activatePreviousTab() {\n const current = this._currentTabBar();\n ...
[ "0.75076693", "0.71529657", "0.6957094", "0.68960047", "0.68723166", "0.67920804", "0.67651916", "0.6666512", "0.6606882", "0.6594606", "0.65346575", "0.6513392", "0.6513392", "0.64715683", "0.64180857", "0.63936806", "0.63872725", "0.6348025", "0.633091", "0.63259953", "0.62...
0.6558319
10
Create a new list item when clicking on the "Add" button
newElement() { var li = document.createElement("li"); var inputValue = document.getElementById("myInput").value; var t = document.createTextNode(inputValue); li.appendChild(t); if (inputValue === '') { alert("You must write something!"); } else { document.getElementById("myUL").appendChild(li); } document.getElementById("myInput").value = ""; var span = document.createElement("SPAN"); var txt = document.createTextNode("\u00D7"); span.className = "close"; span.appendChild(txt); li.appendChild(span); for (i = 0; i < close.length; i++) { close[i].onclick = function() { var div = this.parentElement; div.style.display = "none"; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newLiButtonClicked(){\n createListItem();\n }", "function addToListItem (){\n // Capture value of this input field\n var newListItem = $('.new-list-item').val();\n \n // Render DOM element to the page with the above value\n $(\"#todo\").append(`<li class=\"li...
[ "0.84343964", "0.8086505", "0.8073337", "0.7836197", "0.7801582", "0.77558625", "0.764288", "0.76243395", "0.76184237", "0.7608456", "0.75963825", "0.75512934", "0.75485075", "0.75434846", "0.7533729", "0.7482386", "0.74330634", "0.7431775", "0.7420705", "0.74193424", "0.7417...
0.0
-1
Extract only the strings needed for treemap into a script that sets a global variable `strings`, whose keys are locale codes (enUS, es, etc.) and values are localized UIStrings.
function buildStrings() { const strings = /** @type {Record<LH.Locale, string>} */ ({}); for (const [locale, lhlMessages] of Object.entries(locales)) { const localizedStrings = Object.fromEntries( Object.entries(lhlMessages).map(([icuMessageId, v]) => { const {filename, key} = getIcuMessageIdParts(icuMessageId); if (!filename.endsWith('util.js') || !(key in UIStrings)) { return []; } return [key, v.message]; }) ); strings[/** @type {LH.Locale} */ (locale)] = localizedStrings; } return 'const strings =' + JSON.stringify(strings, null, 2) + ';'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStrings(){\n\t\t//console.log('getString', lang, str, translations[lang][str])\n\t\tlet lang=document.documentElement.lang.split('-')[0]||'en' \n\t\tif(!translations[lang]) lang='en'\n\t\treturn translations[lang]\n\t}", "function getlabelStrings() {\n const strings = {};\n for (let lang of co...
[ "0.61509126", "0.6030882", "0.59321177", "0.572368", "0.5681702", "0.5675117", "0.56535304", "0.5639438", "0.5599086", "0.553952", "0.5526479", "0.5499823", "0.5428287", "0.5224257", "0.5224257", "0.5194827", "0.51680887", "0.5162669", "0.5135169", "0.51326805", "0.5069911", ...
0.6283575
0