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
END RECEIVING DATA from HOME PAGE FORM
function newZip() { var newZipValue = document.getElementById('zipValue').value; getZip(newZipValue); return newZipValue; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onReceiveData(data) {\n appForm.responseTarget.value = JSON.stringify(data);\n }", "function end() {\n\tshowResult();\n\toutputData.userFinalValue = userCurrentValue;\n\toutputData.marketFinalValue = marketCurrentValue;\n\toutputData.totalTrades = totalTrades;\n\tfinalData = JSON.stringify(outputDat...
[ "0.645429", "0.59560233", "0.5864455", "0.58478755", "0.57646406", "0.5748399", "0.5711384", "0.56958723", "0.5693467", "0.5669566", "0.5659744", "0.5617403", "0.5599271", "0.55701625", "0.5564909", "0.553323", "0.5497442", "0.5472818", "0.5464113", "0.5448996", "0.5428272", ...
0.0
-1
Function to open modal
function openModal() { modal.style.display = 'block'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "openModal(){\n\n }", "function openModal(){\r\n modal.style.display = 'block';\r\n }", "function openModal() { \n modal.style.display = 'block';\n }", "function openModal() {\n modal.style.display = 'block';\n }", "function openModal() {\n modal.style.display = 'block...
[ "0.84180903", "0.8006644", "0.8002684", "0.7964848", "0.7964848", "0.7960581", "0.7941496", "0.7937416", "0.7921988", "0.79209936", "0.78695947", "0.78646976", "0.7861667", "0.7857371", "0.7837551", "0.7813474", "0.78110135", "0.77967036", "0.77962244", "0.77936494", "0.77875...
0.77640647
27
Function to close modal
function closeModal() { modal.style.display = 'none'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "closeModal() {\n this.close();\n }", "closeModal() {\n this.closeModal();\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeModal() {\n modal.style...
[ "0.85166055", "0.8465036", "0.84148884", "0.84148884", "0.84148884", "0.8391402", "0.83892334", "0.83752376", "0.8316676", "0.8228196", "0.8226838", "0.82262146", "0.8225428", "0.8220201", "0.8218212", "0.8209209", "0.81994003", "0.81854266", "0.8176662", "0.8176662", "0.8158...
0.8208284
19
Function to close modal if outside click
function clickOutside(e) { if(e.target == modal){ modal.style.display = 'none'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function outsideClick(e) {\n if (e.target == modal) {\n modal.style.display = \"none\";\n }\n }", "function outsideClick(e) {\n if (e.target == modal) {\n modal.style.display = 'none'\n }\n }", "function outsideClick(e) {\n if (e.target == modal) {\n moda...
[ "0.8640511", "0.86338127", "0.8631639", "0.86312675", "0.86312675", "0.86211276", "0.859354", "0.859354", "0.8555904", "0.85163057", "0.8508944", "0.8505075", "0.8496277", "0.8493371", "0.8493371", "0.8493371", "0.8493371", "0.8493371", "0.8493371", "0.8487561", "0.8487561", ...
0.82579064
42
There's really 2 boards: the board in the object and the board on the screen Since there isn't a magical connection between the object and the screen we create that with code we'll loop through every single cell in the board to do this
function updateScore(){ $('#js-score').html(myGame.score); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "makeBoardOnScreen(){\n // Here we'll create a new Group\n for (var i=0; i < game.n; i++) {\n for (var j=0; j < game.n; j ++) {\n //initialize 2D array board to be empty strings\n for (var k=0; k < game.n; k++) {\n for (var l=0; l < game.n; ...
[ "0.7439866", "0.7382709", "0.7229935", "0.72228825", "0.7208942", "0.71219206", "0.70964265", "0.70838296", "0.7072828", "0.70687497", "0.70569503", "0.70531845", "0.6972594", "0.6939331", "0.6933994", "0.6924237", "0.68958354", "0.6887247", "0.68746555", "0.6861835", "0.6852...
0.0
-1
todo 3. _Pseudocode_ ? ==================================================================================================================================================== ? 5. Write a JavaScript program to rotate the string 'w3resource' in right direction ? by periodically removing one letter from the end of the string and attaching it to the front. ? ==================================================================================================================================================== todo 1. _Identify_ the first step is to identify and understand the nature of the problem rotate the string 'w3resource' in right direction: todo 2. _Research & Refine_ at this step you should have a main problem broken down into a few subproblem 'w3resource' = 'ecruoser3w' todo 3. _Pseudocode_
function rotateString(str) { let string = []; for (let i = 0; i < str.length; i++) { string.unshift(str[i]); } return `The word"${str}" rotate backwards = is ${string.join('')}`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rotate () {\n var str = \"w3resource\"\n var newStr = \"\"\n setInterval(function() {\n for (var i = 0; i < str.length; i++) {\n newStr += str.charAt(str.length - (1 + i))\n }\n return console.log(newStr)\n }, 100)\n}", "function rotate_string(text) {\n console.log(text);\n f...
[ "0.75519", "0.7253772", "0.71429664", "0.70627165", "0.7049637", "0.6977165", "0.69530505", "0.6871054", "0.67362535", "0.6633081", "0.6610299", "0.65039504", "0.6482945", "0.64822847", "0.6468872", "0.64676976", "0.6403264", "0.63203585", "0.6300383", "0.6296784", "0.628843"...
0.6806892
8
? ==================================================================================================================================================== ? 6. Write a JavaScript program to determine whether a given year is a leap year in the Gregorian calendar. ? ==================================================================================================================================================== todo 1. _Identify_ the first step is to identify and understand the nature of the problem rotate the string 'w3resource' in right direction: todo 2. _Research & Refine_ at this step you should have a main problem broken down into a few subproblem A. New formula for calculating leap years: A1. The year is evenly divisible by 4; A2. If the year can be evenly divided by 100, it is NOT a leap year, unless; A3. The year is also evenly divisible by 400: Then it is a leap year. todo 3. _Pseudocode_
function isLeapYear(number) { let year = number, onePlace, tensPlace, yearArry = [], output = `The year ${year} is a leap!`; for (let i = 0; i < year.toString().length; i++) { yearArry.push(year.toString()[i]); } onePlace = yearArry.pop(); tensPlace = yearArry.pop(); // *todo A2. If the year can be evenly divided by 100, it is NOT a leap year, unless; if (year % 100 === 0) { // *todo A3. The year is also evenly divisible by 400: Then it is a leap year. if (parseInt(onePlace) === 0 && parseInt(tensPlace) === 0) { if (Number.isInteger(year / 400)) return output; } // *todo A1. The year is evenly divisible by 4; if (Number.isInteger(year / 4)) return output; } return `The year ${year} is NOT a leap!`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function leapYear(year)\r\n{\r\n if(year % 4 == 0)\r\n {\r\n if(year % 100 == 0)\r\n {\r\n if (year % 400 == 0)\r\n {\r\n console.log(\"It is a leap year!\") \r\n }\r\n else\r\n {\r\n console.log(\"It is a not ...
[ "0.8056983", "0.8054197", "0.8022852", "0.80041313", "0.7997561", "0.79531384", "0.79292244", "0.79169357", "0.79121363", "0.79062194", "0.7861507", "0.78551334", "0.78534174", "0.7814649", "0.7812245", "0.78078425", "0.7774931", "0.777469", "0.77719945", "0.7755176", "0.7741...
0.753092
40
Another way '% Modulus (Division Remainder)'
function leapyearV2(year) { return year % 100 === 0 ? year % 400 === 0 : year % 4 === 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mod(input, div){\n return (input % div + div) % div;\n}", "function mod$1(dividend,divisor){return (dividend % divisor + divisor) % divisor;}", "function modulusFunction() {\n var x = 25%6;\n document.getElementById(\"mod\").innerHTML = \"25 / 6 has a remainder of: \" + x;\n}", "functio...
[ "0.8090073", "0.7837561", "0.7740483", "0.76472944", "0.7583931", "0.7495397", "0.74519926", "0.74519926", "0.74502265", "0.74461", "0.74425685", "0.74258894", "0.7418404", "0.74074376", "0.74074376", "0.74074376", "0.73879373", "0.736503", "0.7335199", "0.73346126", "0.73327...
0.0
-1
? ==================================================================================================================================================== ? 7. Write a JavaScript program to find 1st January is being a Sunday between 2014 and 2050. ? ==================================================================================================================================================== todo 1. _Identify_ the first step is to identify and understand the nature of the problem todo 2. _Research & Refine_ at this step you should have a main problem broken down into a few subproblem new Date(`January 1, 2014`).getDay() === 0) todo 3. _Pseudocode_
function isJanFristOnSaturday() { let array = []; for (let i = 14; i <= 50; i++) { if (new Date(`January 1, 20${i}`).getDay() === 0) array.push(i); } return console.log(`Anwser 7: 1st January is being a Sunday ${array}`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sundey1January(){\nfor (var year = 2014; year <= 2050; year++)\n {\n var d = new Date(year, 0, 1);\n if ( d.getDay() === 0 )\n alert(\"1st January will be a Sunday \" + year);\n }\n}", "function wasThereSundayOnJanFirst() {\n // ar buvo sekmadienis pagal duota data\n // ar 2014 01 0...
[ "0.775881", "0.71207833", "0.70603013", "0.6794424", "0.67199934", "0.66878206", "0.6485128", "0.6462839", "0.64107305", "0.6409558", "0.62978935", "0.6256051", "0.6256051", "0.62399226", "0.623986", "0.62235624", "0.6183659", "0.60920185", "0.60537773", "0.60444164", "0.6042...
0.7463719
1
Object to hold the interval timer use this to clear it.
function Character(name, selectImage, standingImg, attackImg, arenaBack, attackWaitInc, hitPts, attackPts, cam, cap, dodgeProb) { this.name = name; // How their name appears in css this.selectImage = selectImage; // Path to selection screen image this.standingImage = standingImg; // Path to standing Image this.attackingImage = attackImg; // Path to attacking image this.attackWaitInc = attackWaitInc; // Increment to 100 to be prepared to attack this.arenaBackground = arenaBack; // Which background to use for the arena this.isAttacking = false; // Flag for whether we're attacking or not. this.hitPoints = hitPts; // How many hitpoints the character has this.attackPoints = attackPts; // How many attack points can the player deliver this.counterAttackMulti = cam; // Counter-attack multiplier this.counterAttackProbability = cap; // What are the odds the player will counter attack? (Out of 100) this.dodgeProbability = dodgeProb; // What are the odds the player will dodge? (out of 100) this.imageElement = ""; // The element we'll be drawing to }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n clearInterval(this.interval);\n this.reset();\n }", "clear() {\n clearInterval(this.interval);\n this.reset();\n }", "function clearTimer() {\n if (timerInterval == null) return\n\n clearInterval(timerInterval)\n timerInterval = null\n}", "_clearTimer() {\n\t\tconst t...
[ "0.79243267", "0.79243267", "0.77589995", "0.773773", "0.7567506", "0.7522071", "0.7521217", "0.7495915", "0.7480363", "0.7446957", "0.7445469", "0.74203503", "0.73905647", "0.73874927", "0.7370279", "0.7343449", "0.7316917", "0.71922827", "0.7183031", "0.71738404", "0.715811...
0.0
-1
UTILITY FUNCTIONS Returns a random number
function getRandom(outOf) { return Math.floor(Math.random() * outOf); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRandomNumber () {}", "function randomNumber() {\r\n return Math.random;\r\n}", "function randNumber () {\n\treturn Math.floor(Math.random() * 10);\n}", "function randomNumber(){\n return Math.random\n}", "function getNumber() {\n return Math.random();\n}", "function randomNumber(){\r\n ...
[ "0.88620394", "0.8667385", "0.85972", "0.85664433", "0.8546203", "0.84993345", "0.8472317", "0.8422181", "0.83409846", "0.83363086", "0.8317445", "0.8303363", "0.83009857", "0.82967794", "0.82962376", "0.8294073", "0.8288578", "0.8284078", "0.82809055", "0.82740295", "0.82732...
0.0
-1
This function will play audio by creating a new element, and then removes the element after the sound has finished. This makes layering of sounds possible.
function playSound(soundPath) { // creates an audio element (need jquery) var audioElement = document.createElement("audio"); //$('<audio></audio>').src = audioFile; // connects the element to the source audioElement.src = soundPath; // creates an event listener that will remove the element when finished audioElement.addEventListener("ended", function () { $(audioElement).remove(); }, false); // plays the audio audioElement.play(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function set_boom_sound() {\r\n\tvar audio = $(\"<audio>Your browser does not support audio files</audio>\");\r\n\tvar source = $(\"<source src='\"+Sounds[0].src+\"' type='audio/mpeg'>\");\r\n\t\r\n\taudio.append(source);\r\n\t$(\"#music\").append(audio);\r\n\taudio.attr(\"id\",Sounds[0].id);\r\n\t\r\n\taudio = do...
[ "0.6895707", "0.6827877", "0.6750159", "0.66525084", "0.66099703", "0.65869176", "0.657782", "0.6571868", "0.65557957", "0.65201235", "0.64992183", "0.6487054", "0.64793515", "0.64296335", "0.6429581", "0.64288634", "0.6426945", "0.64120954", "0.6394836", "0.63904184", "0.638...
0.0
-1
This makes it easier to swap out which image is displayed for a character
function swapImage(charSwap, src) { charSwap.imageElement.attr("src", src); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function characterImg(){\n if(gameMode == 2|| gameMode ==4){\n image(characterArray[currentCharacter],30,150,450,450);\n }\n}", "function swapImage(char, newRow, newCol)\n{\n //get the character to move to\n //clear old location\n //insert to new location?\n}", "function switchPicture () ...
[ "0.7254726", "0.6995593", "0.6833657", "0.6801646", "0.6775051", "0.6661957", "0.6598907", "0.6574498", "0.65496683", "0.65339774", "0.6531129", "0.65181667", "0.6488865", "0.64828485", "0.6465092", "0.6426929", "0.6403224", "0.636597", "0.6361753", "0.6355528", "0.63191825",...
0.7192288
1
END UTILITY / advanceTimers() is responsible for the waittime before a character can attack. This will be referred to as the attack timer.
function advanceTimers() { // Checks if the enemy timer has reached its max if (enemy.timer >= 100) { // flag the enemy can go and run their attack enemyCanGo = true; enemyAttackPlayer(); } // if not, advance the timer if (!enemyCanGo) { // this should be done in one line? But we pin the width to 100 to prevent from status bar overflow (hidden- duh) enemy.timer += enemy.attackWaitInc; enemy.timer = (enemy.timer > 100) ? 100 : enemy.timer; } // Player is exactly the same if (player.timer >= 100) { playerCanGo = true; } if (!playerCanGo) { player.timer += player.attackWaitInc; player.timer = (player.timer > 100) ? 100 : player.timer; } // update status bars. $("#player-attack-progress").css("width", player.timer + "%"); $("#enemy-attack-progress").css("width", enemy.timer + "%"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startGameTimers() {\n $(\"#instructions-link\").animate({\n \"opacity\": 0\n }, 200, function () {\n $(this).css(\"display\", \"none\");\n });\n startPlayerTimer();\n startEnemyTimer();\n fightStarted = true;\n interval = setInterval(advanceTimers, 250);\n}", "function...
[ "0.6313991", "0.6192531", "0.6005405", "0.5803551", "0.576105", "0.5559375", "0.55479044", "0.54752934", "0.5394119", "0.53799987", "0.5295285", "0.52857715", "0.52567065", "0.52123535", "0.51968896", "0.5192476", "0.5190243", "0.51732117", "0.5167506", "0.5146758", "0.513682...
0.70959157
0
Timer initialization is kept separate so we can reset either players separately after an attack. Initializes the players attack timer
function startPlayerTimer() { playerCanGo = false; player.timer = 0; $("#player-attack-progress").css("width", 0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attackStart()\n {\n $(\"#pl-dmg-dealt\").empty();\n $(\"#pl-dmg-taken\").empty();\n\n // Attack Spinner showed to player when he initiates an attack\n $(\"#primary-attack\").hide();\n $(\".spinner-grow\").show();\n console.log(\"Attacking...\");\n\n $(\"...
[ "0.6535493", "0.64049155", "0.62946725", "0.61258644", "0.60614526", "0.60537755", "0.60053444", "0.60002995", "0.5969296", "0.5927675", "0.592445", "0.5924189", "0.58964145", "0.58946776", "0.5806021", "0.57993245", "0.5792884", "0.57714546", "0.57714546", "0.57714546", "0.5...
0.6667462
0
Initializes the enemies attack timer.
function startEnemyTimer() { enemyCanGo = false; enemy.timer = 0; $("#enemy-attack-progress").css("width", 0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initEnemies() {\n var i, maxSpeed = 2 + (0.07 * level);\n for (i = 0; i < 3; i++) {\n var enemy = new Enemy();\n enemy.reset();\n allEnemies.push(enemy);\n }\n }", "attackPattern(){\n console.log(\"Starting attack timer!\");\n //five...
[ "0.6599834", "0.6561889", "0.6377425", "0.62286663", "0.6198957", "0.6190678", "0.611921", "0.6115023", "0.606963", "0.6016254", "0.5951361", "0.58867764", "0.58850026", "0.5851921", "0.58366483", "0.5823122", "0.5819344", "0.57900023", "0.57738644", "0.57390094", "0.57352835...
0.6857512
0
Resets the entire game
function startGameTimers() { $("#instructions-link").animate({ "opacity": 0 }, 200, function () { $(this).css("display", "none"); }); startPlayerTimer(); startEnemyTimer(); fightStarted = true; interval = setInterval(advanceTimers, 250); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reset() {\n clear();\n initialize(gameData);\n }", "function resetGame() {\n resetClockAndTime();\n resetMoves();\n resetStars();\n initGame();\n activateCards();\n startGame();\n}", "function resetGame() {\n gBoard = buildBoard();\n gGame.shownCount = 0;\n gGam...
[ "0.87585914", "0.84577626", "0.84207565", "0.8395226", "0.8385345", "0.836902", "0.8366468", "0.83229417", "0.83036405", "0.8279168", "0.8245873", "0.82446533", "0.81996644", "0.8196229", "0.81901866", "0.8183982", "0.8182951", "0.81803167", "0.8180242", "0.81555426", "0.8155...
0.0
-1
Runs after an enemy is selected
function selectEnemy(enemyChar) { $("#instructions-link").animate({ "opacity": 1 }, 200); // If we're selecting an enemy, we haven't won the game. gameOver = false; // assign the enemy enemy = enemyChar; // If the enemy is mudKip - cut their dodge probability in half if (enemy.name === "mudkip") { enemy.dodgeProbability /= 2; } gameConsoleLog("Enemy will be: " + enemy.name); // removes the enemy selection screen $("#enemy-screen-wrapper").css({ "opacity": 0, "display": "none" }); $("#enemy-image").attr("src", enemy.selectImage); // Grabs the playing image element enemy.imageElement = $("#enemy-fighter"); // Sets the opacity to 1 (when he dies the opacity goes to zero, this will reset it) enemy.imageElement.css("opacity", 1); swapImage(enemy, enemy.standingImage); // Show the battle screen toggleBattleScreen("block"); // Starts the game timers! startGameTimers(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectEnemy() {\n\t\t$(\"#text-3\").html(\"\");\n\t\t$(\"#result-text\").html(\"\");\n\t\t$(\"#your-enemy-title\").html(\"<h2>Your Enemy</h2>\");\n\t\t$(\"#your-enemy\").html(selectedEnemy);\n\t\tselectedEnemyId = selectedEnemy.attr(\"id\");\n\t\tselectedEnemy.removeClass(\"bg-danger\");\n\t\tselectedEnem...
[ "0.7348778", "0.7306068", "0.7038252", "0.6981698", "0.6928432", "0.682165", "0.68003225", "0.6714037", "0.66882616", "0.65796494", "0.655191", "0.6541761", "0.6486397", "0.6416549", "0.6405824", "0.6354905", "0.6262731", "0.6256302", "0.6221575", "0.6218346", "0.6196327", ...
0.70895
2
Displays the enemy selection screen
function displayEnemySelectScreen() { // Show the Questionmark box as a placeholder $("#enemy-image").attr("src", unknownChar); // Make sure the hero selection screen his hidden $("#hero-screen-wrapper").css({ "opacity": 0, "display": "none" }); // Make sure the wrapper for the enemySelectionScreen is visible $("#enemy-screen-wrapper").css({ "opacity": 1, "display": "block" }); // Removes the player's character $("#enemy-" + player.name + "-select").css("display", "none"); // Removes characters that are in our enemy defeated list defeatedEnemyList.forEach(function (currentValue) { $("#enemy-" + currentValue + "-select").css("display", "none"); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectEnemy() {\n\t\t$(\"#text-3\").html(\"\");\n\t\t$(\"#result-text\").html(\"\");\n\t\t$(\"#your-enemy-title\").html(\"<h2>Your Enemy</h2>\");\n\t\t$(\"#your-enemy\").html(selectedEnemy);\n\t\tselectedEnemyId = selectedEnemy.attr(\"id\");\n\t\tselectedEnemy.removeClass(\"bg-danger\");\n\t\tselectedEnem...
[ "0.7041243", "0.66395867", "0.6544068", "0.65072966", "0.64908683", "0.6383171", "0.6288086", "0.62796885", "0.6260806", "0.6176798", "0.6161588", "0.61236006", "0.61186826", "0.60995567", "0.6079819", "0.6016587", "0.5987631", "0.59652257", "0.59548414", "0.59262425", "0.592...
0.7585719
0
This updates the display of player and enemy stats.
function updateStats() { $("#player-stats").html("<h1>PLAYER</h1><h1 style=\"margin-top: 10px\">HP: " + player.hitPoints + "</h1>"); $("#enemy-stats").html("<h1>Enemy</h1><h1 style=\"margin-top: 10px\">HP: " + enemy.hitPoints + "</h1>"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateEnemyStats() {\n\t\t$(\"#enemyHealth\").html(\"HP: \" + enemyPicked.health + \"<br />Attack: \" + enemyPicked.attack);\n\t\t$(\"#enemyName\").html(enemyPicked.display);\n\t}", "function updatePlayerStats() {\n\t\t$(\"#playerHealth\").html(\"HP: \" + characterPicked.health + \"<br />Attack: \" + ch...
[ "0.8109145", "0.7782187", "0.7485137", "0.746848", "0.7423649", "0.72479385", "0.7161365", "0.7114722", "0.710788", "0.7087624", "0.7016434", "0.70091707", "0.69988877", "0.6954342", "0.69075465", "0.6897374", "0.6889509", "0.6868922", "0.686559", "0.6843239", "0.6829977", ...
0.7726815
2
Runs the dodge animation Since the X position doesn't matter, we can run the same animation for either player or enemy
function dodgeAttack(personDodging) { playSound(dodgeSound); personDodging.imageElement.animate({ top: "50px" }, 100, function (event) { personDodging.imageElement.animate({ top: "150px" }, 100); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "run() {\n\n // Give the player a chance to move.\n this.player.move();\n\n // Give the player and crystal a chance to animate.\n this.player.animate();\n this.crystal.animate();\n\n // Give any active explosions a chance to animate.\n for (let e in this.explosions) {\n if (this.explosions...
[ "0.66043204", "0.62966347", "0.6292323", "0.6282525", "0.61658126", "0.6163822", "0.6162179", "0.61219454", "0.6092776", "0.60842085", "0.60380346", "0.5992382", "0.5988285", "0.5955992", "0.59551024", "0.59461135", "0.59263676", "0.592488", "0.59088033", "0.5902462", "0.5889...
0.65592307
1
Animation that runs when a character is hit. charHit is the character who was hit. leftOrRight will toggle whether we are animating the 'left' or 'right' css property.
function characterHitAnimation(charHit, leftOrRight) { switch (leftOrRight) { case 'left': charHit.imageElement.animate({ left: "-200px" }, 100, function (event) { charHit.imageElement.animate({ left: "-140px" }, 100, function (event) { charHit.imageElement.animate({ left: "-180px" }); }); }); break; case 'right': charHit.imageElement.animate({ right: "-200px" }, 100, function (event) { charHit.imageElement.animate({ right: "-140px" }, 100, function (event) { charHit.imageElement.animate({ right: "-180px" }); }); }); break; default: break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AnimateHit():void {\n\tcharDummy.animation.CrossFade(\"hit\", 0.1);\n}", "function Update() \n{\n\t// Save the state in playing now.\n stateInfo = chrAnimator.GetCurrentAnimatorStateInfo(0);\n\n\t// character moves\n\tvar h : float = Input.GetAxis(\"Horizontal\");\n\tvar v : float = Input.GetAxis(\"V...
[ "0.64710057", "0.56239367", "0.52272964", "0.5223193", "0.51407856", "0.51178586", "0.51134497", "0.5111056", "0.50378615", "0.50338095", "0.5007023", "0.4994561", "0.4992235", "0.4978699", "0.49311203", "0.491354", "0.4864962", "0.4851237", "0.4847376", "0.48380405", "0.4832...
0.8316732
0
runs the player losing screen
function togglePlayerLose() { // Grab a reference to our game screen var gameScreen = $("#game-screen"); // Clear out the game screen gameScreen.empty(); // Create a new element with the player's image. var playerImage = $("<img>").attr("src", player.selectImage).css({ display: "block", "margin-left": 0 }); // Add the element to the game screen gameScreen.append(playerImage); // Runs our utility method var center = findCenter(playerImage.width() / 2); playSound(loseSound); // Animates the player to the center. When that animation is done, we change the image to the exploding gif and play // the exploding sound. playerImage.animate({ "margin-left": center }, 2000, function () { playSound(explodeSound); playerImage.attr("src", charExplode).css({ "margin-left": center + 75 }).animate({ opacity: 0 }, 1000); gameScreen.append($("<h1>YOU LOSE!!!</h1>").animate({ color: "red" }, 1000, function () { gameOver = true; gameScreen.append($("<h1>Press ENTER to try again!</h1>")); })) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lost(){\n pause();\n playing = false;\n lose = true;\n setHighscore();\n html('rows','Game Over')\n }", "function stop() {\n isGameActive = false;\n }", "function SarahKickPlayerOut() {\n\tDialogLeave();\n\tSarahRoomAvailable = false;\n\tCommonSetScreen(\"...
[ "0.7182977", "0.70776427", "0.70548517", "0.701613", "0.693552", "0.69063777", "0.68908256", "0.6874585", "0.67940354", "0.6752572", "0.67337346", "0.6721472", "0.67085165", "0.6705333", "0.67052335", "0.67044437", "0.67021614", "0.6697386", "0.6690254", "0.6654304", "0.66496...
0.0
-1
Runs the animations when the player wins the game.
function togglePlayerWin() { var gameScreen = $("#game-screen"); gameScreen.empty(); playSound(winSound); // Create the element to display the character var playerImage = $("<img>").attr("src", player.selectImage).css({ display: "block", margin: "0 auto" }); // Calculate where we're going to animate the player to the right. // Attach the character to our game screen gameScreen.append(playerImage); var farRight = $(window).width() - playerImage.width(); //parseInt(playerImage.css("width").replace("px", "")); var center = findCenter(playerImage.width() / 2); // Animate player to the far left playerImage.animate({ "margin-left": "0" }, 1000, function () { // Animate player to the far right playerImage.animate({ "margin-left": farRight }, 1000, function () { // Return player to the center playerImage.animate({ "margin-left": center }, 1000, function () { // Display win message gameScreen.append($("<h1>You Win!!</h1>").animate({ "color": "red" }, 1000, function () { gameOver = true; // Give player option to play again. gameScreen.append("<h1>Press ENTER to start a new game!</h1>") })); }); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GameOverAnimation() {\n /* ANIMATE GAME OVER\n PLAY SWOOSH SOUND\n SCOREBOARD();\n */\n}", "winGame() {\n gameWon();\n }", "function checkWin() {\n if (totalScore === targetNumber) {\n $(\".gameBanner\").text(\"Nice job! You won!\");\n winCount++;\n $(\"#win-display\"...
[ "0.7122238", "0.7090135", "0.7070813", "0.7060141", "0.70359385", "0.6819909", "0.67890096", "0.6769533", "0.6734676", "0.67227995", "0.6679316", "0.6679055", "0.6673657", "0.6662155", "0.6646152", "0.66384536", "0.66330624", "0.6618364", "0.6605733", "0.6597659", "0.65845615...
0.0
-1
Kills off the character by fading out their opacity.
function killCharacter(deadChar) { swapImage(deadChar, charExplode); playSound(explodeSound); clearInterval(interval); deadChar.imageElement.animate({ opacity: 0 }, 1000, function () { if (enemy.hitPoints <= 0) { defeatedEnemyList.push(deadChar.name); // COMMENTED OUT UPPING THE PLAYERS HEALTH AFTER VICTORY NOW THAT DODGING CAN BE OVERRIDDEN //var rewardHP = defeatedEnemyList.length * getRandom(100); //player.hitPoints += rewardHP; //gameConsoleLog("Player was awarded an additional " + rewardHP + "hps!!"); if (defeatedEnemyList.length >= 4) { // we win! togglePlayerWin(); } else { // There's still enemies left to fight toggleBattleScreen("none"); displayEnemySelectScreen(); } } else { // We lost togglePlayerLose(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseOff() {\n $(this).fadeTo(500,0.2);\n }", "function dis(element, event) \n{\n if (element.style.opacity)\n element.style = \"\";\n else\n element.style.opacity = 0;\n}", "function unfade(element, speed) {\n var op = 0.1\n var opTimer = setInterval(function () {\n if ...
[ "0.6900412", "0.6774865", "0.6590536", "0.65534693", "0.64445895", "0.64445895", "0.64445895", "0.63329965", "0.63032573", "0.6298558", "0.6207421", "0.62051624", "0.61986804", "0.6172666", "0.616661", "0.61475676", "0.6089993", "0.6074603", "0.60624653", "0.6052756", "0.6049...
0.0
-1
enemyAttackPlayer(isCounter = false) This function has several things going on. We grab two random numbers out of 100 and check them against the player's dodgeProbability and counterProbability. If either of these are <= the random number, we flag those to be true. If not, we get a random number between 1 attackPower.
function enemyAttackPlayer(isCounter = false) { // Assumes dodge and counterAttack are false var dodge = false; var counterAttack = false; var playerLost = false; // We either check if it's a genuine allowable attack, or if it's a counter if ((!enemy.isAttacking && enemyCanGo && !player.isAttacking) || isCounter) { // Check odds of a dodge var playerDodge = getRandom(100); if (playerDodge <= player.dodgeProbability) { dodge = true; } // If it's not a counter .... if (!isCounter) { // Check the odds of a counter var counter = getRandom(100); if (counter <= player.counterAttackProbability) { counterAttack = true; } } // Prevent 0 attack power. var attackPower = getRandom(enemy.attackPoints) + 1; // If the last attack was more than the amount of hitpoints the player has left, pin it to the amount of hitpoints. // This will prevent negative hitpoints from occuring. attackPower = (attackPower > player.hitPoints) ? player.hitPoints : attackPower; // We hit the enemy! playSound(attackStartSound); // Load enemy's attackingImage swapImage(enemy, enemy.attackingImage); // Flag the enemy is attacking enemy.isAttacking = true; // Run css animations // The callback will check for a dodge and animate the enemy back into position enemy.imageElement.animate({ right: "240px" }, 300, function () { // Right before the enemy hits, we allow a dodge quickDodgeAllowed = true; enemy.imageElement.animate({ right: "250px" }, 150, function () { quickDodgeAllowed = false; // If the player didn't dodge... if (!dodge && !quickDodgeExecuted) { // Display to the battle screen displayText(player, "-" + attackPower); // Add the event to the console log gameConsoleLog(enemy.name + " hit " + player.name + " for " + attackPower + "hps!"); // Play the hit sound playSound(smackSound); // Animate the player being hit characterHitAnimation(player, "left"); // Take away the player's health player.hitPoints -= attackPower; // If the player DID dodge } else { if (quickDodgeExecuted) { // if it was a quick dodge rather than a random dodge, flag it to false now since we are running the dodge quickDodgeExecuted = false; } // Log the dodge gameConsoleLog(player.name + " dodged " + enemy.name + "'s attack!"); dodgeAttack(player); } // Update the display updateStats(); // Check if the player is out of hitPoints if (player.hitPoints <= 0) { gameConsoleLog(player.name + " has fallen!"); killCharacter(player); playerLost = true; } // Now that the actual hit is done, animate player back to their original position. enemy.imageElement.animate({ right: "-180px" }, 300, function () { // Go back to the standing image swapImage(enemy, enemy.standingImage); // Flag the attack is over enemy.isAttacking = false; // Do we get a counter attack? // We also check to see if the player is still alive to prevent a "ghost" counter-attack from happening. if (counterAttack === true && !playerLost) { gameConsoleLog(player.name + " has counter-attacked!"); playerAttackEnemy(true); } // If this wasn't an enemy counter-attack, we have to restart the enemy's attack timer. if (!isCounter) { startEnemyTimer(); } }); }); }); return true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function playerAttackEnemy(isCounter = false) {\n var dodge = false;\n var counterAttack = false;\n var enemyLost = false;\n if ((!player.isAttacking && playerCanGo && !enemy.isAttacking) || isCounter) {\n var enemyDodge = getRandom(100);\n if (enemyDodge <= enemy.dodgeProbability) {\n ...
[ "0.7427755", "0.6408132", "0.6406998", "0.63725895", "0.61869407", "0.6145399", "0.6054117", "0.5967252", "0.59101605", "0.59026444", "0.58978367", "0.5864733", "0.5818418", "0.58176905", "0.58133304", "0.58036506", "0.5794956", "0.5793832", "0.57777214", "0.5732289", "0.5719...
0.77994245
0
playerAttackPlayer(isCounter = false) ALMOST IDENTICAL TO THE enemyAttackPlayer function This function has several things going on. We grab two random numbers out of 100 and check them against the enemy's dodgeProbability and counterProbability. If either of these are <= the random number, we flag those to be true. If not, we get a random number between 1 attackPower.
function playerAttackEnemy(isCounter = false) { var dodge = false; var counterAttack = false; var enemyLost = false; if ((!player.isAttacking && playerCanGo && !enemy.isAttacking) || isCounter) { var enemyDodge = getRandom(100); if (enemyDodge <= enemy.dodgeProbability) { // the enemy dodged! dodge = true; }; if (!isCounter) { var enemyCounter = getRandom(100); if (enemyCounter <= enemy.counterAttackProbability) { counterAttack = true; } } var attackPower = getRandom(player.attackPoints) + 1; // We hit the enemy! // If the last attack was more than the amount of hitpoints the player has left, pin it to the amount of hitpoints. // This will prevent negative hitpoints from occuring. attackPower = (attackPower > enemy.hitPoints) ? enemy.hitPoints : attackPower; playSound(attackStartSound); // Load players attackingImage swapImage(player, player.attackingImage); // Flag the player is attacking player.isAttacking = true; // Run css animations // Callback embeds another animation, runs the attack sound, and decrements the enemies health player.imageElement.animate({ left: "250px" }, 300, function () { if (!dodge) { // Displays the attack power displayText(enemy, "-" + attackPower); // Log in the console gameConsoleLog(player.name + " hit " + enemy.name + " for " + attackPower + "hps!"); // Plays the smack sound playSound(smackSound); // Runs the enemy hit characterHitAnimation(enemy, "right"); // Removes the hitpoints enemy.hitPoints -= attackPower; } else { // Enemy dodged gameConsoleLog(enemy.name + " dodged " + player.name + "'s attack!"); // Run the dodge animation dodgeAttack(enemy); } // Update stats on the screen updateStats(); // Check if the enemy died if (enemy.hitPoints <= 0) { // Log the enemy has died gameConsoleLog(enemy.name + " has fallen!"); // Run the death animation killCharacter(enemy); enemyLost = true; } player.imageElement.animate({ left: "-180px" }, 300, function () { swapImage(player, player.standingImage); player.isAttacking = false; if (counterAttack === true && !enemyLost) { gameConsoleLog(enemy.name + " has counter-attacked!"); enemyAttackPlayer(true); } if (!isCounter) { startPlayerTimer(); } }); }); return true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function enemyAttackPlayer(isCounter = false) {\n // Assumes dodge and counterAttack are false \n var dodge = false;\n var counterAttack = false;\n var playerLost = false;\n // We either check if it's a genuine allowable attack, or if it's a counter\n if ((!enemy.isAttacking && enemyCanGo && !...
[ "0.7924782", "0.679362", "0.6763769", "0.6715657", "0.66229653", "0.63184255", "0.6310995", "0.62967604", "0.62787795", "0.6234045", "0.619849", "0.6179186", "0.6166255", "0.61598605", "0.6122203", "0.61209106", "0.61165917", "0.6069543", "0.6059739", "0.6053692", "0.6039761"...
0.75245845
1
end /show more partners
function loadPartners(count) { var items = $('.load_partners_box'); items.filter(':hidden').slice(0, count).fadeIn().css('display', 'flex'); var visible = items.filter(':visible').length; if (items.length === visible) { $('.partners_load_more').fadeOut('slow'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getAllParties(){\n btnFeedback('all')\n resultParties = parties;\n}", "function showMyOffers() {\n\t// reset selectedID (account could have been deleted in meantime)\n\t// selectedOffer mit selectedItem ersetzt, da es sich um Offer UND Applicant\n\t// handelt\n\tselectedItem = null;\n\ttoggleWarni...
[ "0.6118605", "0.6037013", "0.5835954", "0.57168525", "0.569377", "0.56898344", "0.5660652", "0.5655557", "0.5653186", "0.5636219", "0.56218845", "0.5572807", "0.55640185", "0.5560812", "0.55474573", "0.5514355", "0.55099314", "0.5480884", "0.5469338", "0.5447787", "0.5446406"...
0.6470643
0
Update the plot with new data
function updatePlotly(response) { var Bubble = document.getElementById('bubble'); var newdata = getBubbleData(response); console.log(newdata); Plotly.deleteTraces( Bubble, 0 ) Plotly.addTraces( Bubble, newdata[0], ) var Pie = document.getElementById('pie'); var newdata = getPieData(response); console.log(newdata); Plotly.deleteTraces( Pie, 0 ) Plotly.addTraces( Pie, newdata[0], ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update() {\n plot.setData([getRandomData()]);\n // Since the axes don't change, we don't need to call plot.setupGrid()\n plot.draw();\n setTimeout(update, updateInterval);\n }", "function update(newData) {\n clearGraph();\n...
[ "0.7975926", "0.7954415", "0.7897443", "0.74757934", "0.74686503", "0.7422936", "0.7319628", "0.72744066", "0.7239038", "0.71390456", "0.71213156", "0.70726144", "0.7048217", "0.70462936", "0.70096153", "0.6993921", "0.6993798", "0.69728976", "0.69665265", "0.6933098", "0.691...
0.0
-1
Get new data whenever the dropdown selection changes
function optionChanged(route) { console.log(route); getMetaData(route); Plotly.d3.json(`/samples/${route}`, function(error, response) { console.log("newdata", response); updatePlotly(response); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "chooseData() {\n // ******* TODO: PART I *******\n //Changed the selected data when a user selects a different\n // menu item from the drop down.\n\n }", "chooseData() {\n // ******* TODO: PART I *******\n //Changed the selected data when a user selects a different\n ...
[ "0.8005177", "0.8005177", "0.7300729", "0.7207298", "0.71828866", "0.7007695", "0.6885412", "0.6719722", "0.6712562", "0.6712562", "0.67058086", "0.66771674", "0.66510326", "0.6640689", "0.66387707", "0.6625341", "0.66232467", "0.66223323", "0.65973264", "0.6557326", "0.65357...
0.0
-1
store the latlon value in a hidden input to send them to the server
function latlon(position){ $("#laat").html('<input id="lat" type="hidden" name="lat"></input><input id="lon" type="hidden" name="lon"></input><input class="submit" value="جيبلي الأحوال الجوية ضرك" type="submit"/>'); $("#lat").val(position.coords.latitude); $("#lon").val(position.coords.longitude); $("#lguit").html('<div id="map" style="height: 200px; width: 600px; position: relative;margin: auto"></div>'+ '<script>'+ 'var map = L.map( "map", {center:['+ position.coords.latitude+ ','+ position.coords.longitude+ '],minZoom: 5,zoom: 10});L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png", {attribution:"OpenStreetMap"}).addTo(map);'+ 'var marker = L.marker(['+ position.coords.latitude+ ','+ position.coords.longitude+ ']).addTo(map).bindPopup("راك هنا ?").openPopup();'+ 'marker.dragging.enable();marker.on("dragend", function(e) {'+ 'var coords = e.target.getLatLng();var lat = coords.lat;var lng = coords.lng;map.panTo(new L.LatLng(coords.lat, coords.lng));'+ '$("#lat").val(coords.lat);$("#lon").val(coords.lng);console.log(coords.lat)});'+ '</script>'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setLngLatFromHiddenInputs() {\n Map_Obj.latitude = +$('#main-form input[name=lat]').val();\n Map_Obj.longitude = +$('#main-form input[name=lng]').val();\n $('#main-form input[name=lat]').remove();\n $('#main-form input[name=lng]').remove();\n }", "function getMarkerPosition(location)\n{\n //Set the...
[ "0.78742003", "0.7846894", "0.7478658", "0.7233168", "0.7162289", "0.70917463", "0.7060339", "0.7040973", "0.69955", "0.690074", "0.68558294", "0.6837239", "0.67951626", "0.6760667", "0.67467934", "0.66981554", "0.66923094", "0.66132987", "0.6587799", "0.6553631", "0.65428895...
0.6847642
11
this is the function that will convert pm to 24h system used in Algeria ...
function timer(c){ for (i = 0; i < $(c).length; i++){ if ($(c)[i].innerHTML.split(" ")[1]=="PM") { $(c)[i].innerHTML = parseInt($(c)[i].innerHTML.split(" ")[0].split(":")[0])+12 + ":" + $(c)[i].innerHTML.split(" ")[0].split(":")[1]; } else { $(c)[i].innerHTML = $(c)[i].innerHTML.split(" ")[0] } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convertTimeTo24HourSystem(h){\n\t\t\t\tif(h.indexOf('12') !=-1 && h.indexOf('A') !=-1){\n\t\t\t\t\t\n\t\t\t\t\th=h.replace('12','00');\n\t\t\t\t\th=h.substr(0,h.indexOf(\"A\")-1);\n\t\t\t\t\t//alert(\"24H Clock: \"+h);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(h.indexOf('12')==-1 && h.indexOf('P') !=-1){\n\t\t\t\t...
[ "0.7655797", "0.749892", "0.7362303", "0.7288817", "0.7231447", "0.7187108", "0.7153572", "0.71257854", "0.71236295", "0.7104735", "0.7101308", "0.70638037", "0.70205843", "0.700488", "0.69744116", "0.6965786", "0.69538784", "0.69292593", "0.68734527", "0.6842432", "0.6826250...
0.0
-1
you can use :target but sadly the you have to reorganize your html structure!
function blury(){ $("#content").css({"-webkit-filter": "blur(5px) sepia(1)","transition": "all .5s linear", "opacity":"0.7"}); $("body").css({"overflow": "hidden"}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getURLForTarget($target) {\n return `${$target.attr('href')}infobox/`;\n }", "function handleClick(el,e) {\n\tloadURL(el.attributes.target,el.text);\n}", "function openTarget() {\n var hash = location.hash.substring(1);\n console.log(hash);\n if(hash) var details = document.getElementById(hash);\n...
[ "0.68710625", "0.67444277", "0.6699387", "0.6611259", "0.64848405", "0.64835876", "0.6392474", "0.6352354", "0.6299183", "0.6260675", "0.6207278", "0.61737514", "0.6130074", "0.6117379", "0.61026186", "0.60415554", "0.60273725", "0.60273725", "0.6016152", "0.6015684", "0.5911...
0.0
-1
Setup for listening for responses and sending the request
_setup() { this.self.ipc.register(this.returnID, data => { this._handleResponse(data) }); let data = {} data.globalType = this.globalType; data.clusterID = this.clusterID; data.responseID = this.returnID; data.data = this.broadcastString this.self.ipc.broadcast('advancedIPCListen', data); this.timeout = setTimeout(() => { if (this.responses.length < this.expectedReturns) { return this.emit('failed', 'Timeout waiting for all responses.'); } }, 30000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "listenRequests() {\n this.request(event.detail.request);\n }", "listenRequests() {\n this.request(event.detail.request);\n }", "setup() {\n const trezorSendAction = this.actions.ada.trezorSend;\n trezorSendAction.sendUsingTrezor.listen(this._sendUsingTrezor);\n...
[ "0.6938115", "0.6864217", "0.64439553", "0.638909", "0.6364006", "0.63396645", "0.629861", "0.6118709", "0.609214", "0.6080238", "0.6054582", "0.6027399", "0.6000384", "0.59749067", "0.59632874", "0.59590185", "0.5948364", "0.59461135", "0.5919807", "0.5902885", "0.5892291", ...
0.7031646
0
A wrapper object around a Leaflet layer object that is used for defining layer control behavior. layer: The layer object to be controlled (REQUIRED). name: The caption that should be used to display the layer in the layer control (REQUIRED). groupName: If more than one LayerControlItem is given the same groupName, they will combined in a select (dropdown) control which appears as a single entry in the layer control. The groupName will be used as a caption. (DEFAULT = name argument). base: boolean true if this is a base layer, false if this is an overlay layer (DEFAULT = false). labelable: boolean true if this layer can be labelled (DEFAULT = false).
function LayerControlItem(layer, name, groupName, base, labelable) { this.layer = layer; this.name = name; this.groupName = groupName || name; this.base = !!base; this.labelable = !!labelable; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LayerControlGroup(layerControlItems, name, base) {\n this.layerControlItems = layerControlItems;\n this.name = name;\n this.base = !!base;\n\n this._anyLayerVisible = function (map) {\n for (var i in this.layerControlItems) {\n if (map.hasLayer(this.layerControlItems[i].layer)) return true;\n ...
[ "0.72282934", "0.6518315", "0.64626616", "0.64509124", "0.6385719", "0.633748", "0.6334947", "0.6328613", "0.62371516", "0.62349665", "0.6230034", "0.6212534", "0.61491644", "0.6133748", "0.61318237", "0.61157817", "0.61015767", "0.6068367", "0.60625166", "0.60415834", "0.603...
0.778418
0
This is an internal class, used to group LayerControlItems by groupName. Since each table row in the layer control is a single LayerControlGroup rather than a LayerControl item, all the HTML elements are associated with a group rather than an item.
function LayerControlGroup(layerControlItems, name, base) { this.layerControlItems = layerControlItems; this.name = name; this.base = !!base; this._anyLayerVisible = function (map) { for (var i in this.layerControlItems) { if (map.hasLayer(this.layerControlItems[i].layer)) return true; } return false; }; this.anyLabelable = function () { for (var i in this.layerControlItems) { if (this.layerControlItems[i].labelable) return true; } return false; }; // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe) this.createVisibleInputElement = function (map) { var checked = this._anyLayerVisible(map); if (this.base) { var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="leaflet-base-layers"'; //var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="leaflet-exclusive-group-layer-' + this.group + '"'; if (checked) { radioHtml += ' checked="checked"'; } radioHtml += '/>'; var radioFragment = document.createElement('div'); radioFragment.innerHTML = radioHtml; radioFragment.firstChild.layerControlElementType = LayerControlElementType.VisibilityRadio; radioFragment.firstChild.groupName = this.name; return radioFragment.firstChild; } else { var input = document.createElement('input'); input.type = 'checkbox'; input.className = 'leaflet-control-layers-selector'; input.defaultChecked = checked; input.layerControlElementType = LayerControlElementType.VisibilityCheckbox; input.groupName = this.name; return input; } }; this.createLabelInputElement = function () { var input = document.createElement('input'); input.type = 'checkbox'; input.className = 'leaflet-control-layers-selector'; input.defaultChecked = false; input.layerControlType = "label"; input.layerControlElementType = LayerControlElementType.LabelCheckbox; input.groupName = this.name; return input; }; this.createNameSpanElement = function () { var span = document.createElement('span'); span.innerHTML = ' ' + this.name; span.groupName = name; return span; }; // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe) this.createSelectElement = function (map) { // NOTE: Opening the select element and displaying the options list fires the select.onmouseout event which // propagates to the div container and collapses the layer control. The onmouseout handler below will // stop this event from propagating. It has an if-else clause because IE handles this differently than other browsers. var selectHtml = '<select class="leaflet-control-layers-selector" onmouseout="if (arguments[0]) {arguments[0].stopPropagation();} else {window.event.cancelBubble();}">'; for (var i = 0; i < this.layerControlItems.length; i++) { selectHtml += '<option value="' + this.layerControlItems[i].name + '"'; if (map.hasLayer(this.layerControlItems[i].layer)) { selectHtml += " selected='selected'"; } selectHtml += '>' + this.layerControlItems[i].name + "</option>"; } selectHtml += '</select>'; var selectFragment = document.createElement('div'); selectFragment.innerHTML = selectHtml; selectFragment.firstChild.layerControlElementType = LayerControlElementType.LayerSelect; selectFragment.firstChild.groupName = this.name; return selectFragment.firstChild; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_addGroupElements(details) {\n const that = this,\n groups = details.groups,\n groupLabels = details.groupLabels,\n group = details.group,\n groupIndex = groups.indexOf(group),\n tabLabelContainer = details.tabLabelContainer;\n let groupLabel;\n\...
[ "0.6388699", "0.60867953", "0.6032624", "0.6015101", "0.59625274", "0.5913087", "0.5903601", "0.5902521", "0.5868495", "0.58237165", "0.580945", "0.5806597", "0.5806498", "0.57946754", "0.576381", "0.57525647", "0.5728543", "0.571656", "0.5694714", "0.56685853", "0.56685853",...
0.63751745
1
if there is a winning combo, change colors to show win set gameover to true
function checkCombination (b1, b2, b3) { if (b1.innerHTML !== '' && b1.innerHTML == b2.innerHTML && b1.innerHTML == b3.innerHTML) { gameover = true; b1.style.backgroundColor = '#E8CDB2'; b2.style.backgroundColor = '#E8CDB2'; b3.style.backgroundColor = '#E8CDB2'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gameOver(gameWon) {\n // Highlight the winning pattern\n for (let index of winCombos[gameWon.index]) {\n document.getElementById(index).classList.add(\"ttt__table__cell--highlight\");\n }\n // Display the overlay\n displayOverlay(\n `${playerNames[gameWon.player]} Win${gameWon.player === com ? ...
[ "0.7529777", "0.7451203", "0.7440546", "0.73276067", "0.7270421", "0.7227379", "0.7185675", "0.7155258", "0.71366626", "0.7105111", "0.708873", "0.6994215", "0.69915146", "0.69732386", "0.69426817", "0.6939161", "0.6925133", "0.6920647", "0.69180006", "0.6912494", "0.6908209"...
0.0
-1
function that checks winning combinations
function checkWin() { checkCombination(button1, button2, button3); checkCombination(button4, button5, button6); checkCombination(button7, button8, button9); checkCombination(button1, button4, button7); checkCombination(button2, button5, button8); checkCombination(button3, button6, button9); checkCombination(button1, button5, button9); checkCombination(button3, button5, button7); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkWin() {\n for (let i = 0; i < winningCombinations.length; i++) {\n let pattern = winningCombinations[i];\n let [a, b, c] = pattern;\n if ( currentCells[a] === currentCells[b] && currentCells[b] === currentCells[c] ) {\n return true;\n }\n }\n return false;\n}", "function checkWi...
[ "0.82783854", "0.8038732", "0.7927657", "0.7923339", "0.7919899", "0.790279", "0.784007", "0.78282684", "0.779937", "0.7758326", "0.7723852", "0.76949877", "0.7691428", "0.7619322", "0.7588813", "0.7545814", "0.75224715", "0.7510244", "0.7499048", "0.7477693", "0.7435845", ...
0.78862804
6
Player toggle from x and o
function pickSquare() { if (gameover || this.innerHTML !== '') return; this.innerHTML = selectTurn.value; if (selectTurn.value == 'X') { selectTurn.value = 'O'; } else { selectTurn.value = 'X'; } checkWin(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function togglePlayer() {\n if (activePlayer === \"X\") {\n activePlayer = \"O\";\n nonActivePlayer =\"X\";\n } else {\n activePlayer = \"X\";\n nonActivePlayer = \"O\";\n } //if active player is x then it changegs to O & vice versa\n }", "function toggleTurn(t){ // returns the oppo...
[ "0.85980946", "0.73267525", "0.73164344", "0.7252996", "0.7204906", "0.7166235", "0.7110718", "0.70945853", "0.70319396", "0.6956297", "0.69532776", "0.6927894", "0.6767099", "0.6747457", "0.6735599", "0.672999", "0.6633909", "0.6632556", "0.661995", "0.661022", "0.65974796",...
0.0
-1
When the game is over, get the board to clear gameover is false because it is resetting game over need to fix it so that it removes x's and o's
function resetGame() { // reset game by going through buttons for (var i=0; i < buttons.length; i++) { buttons[i].style.backgroundColor = ''; // change color back to original buttons[i].innerHTML = ''; // delete x's and o's } gameover = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "game_over() {\n if (this.game_state !== \"alive\") {\n return;\n }\n console.log(\"game_over\");\n this.game_state = \"game_over\";\n //this.visible_board = this.game_board;\n\n for (let row = 0; row < this.visible_board.length; row++) {\n for (let co...
[ "0.8094198", "0.7922093", "0.76940405", "0.75165933", "0.74932283", "0.7437116", "0.74293625", "0.7419001", "0.7258565", "0.7230285", "0.720446", "0.71901244", "0.71827596", "0.71561646", "0.71528596", "0.71285605", "0.7098652", "0.70985436", "0.7097139", "0.7090158", "0.7084...
0.6812721
68
TODO, when form loads from ajax call, form restes and others must reinitialized Same way i did with wpbc_do_selectpicker
function wpbc_do_selectpicker(item){ var select = item; item.selectpicker(); select.on('hidden.bs.select', function (e, relatedTarget, clickedIndex, isSelected, previousValue) { var me = $(relatedTarget.relatedTarget); wpbc_get_query_posts_select_fix(me); }); select.on('loaded.bs.select', function (e, clickedIndex, isSelected, previousValue) { var me = $(e.currentTarget).parent().find('.dropdown-toggle'); wpbc_get_query_posts_select_fix(me); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init(){\n //console.log($(\"#show_form_emergente .DepartamentoSelect\"));\n \n $(\"#show_form_emergente .DepartamentoSelect\").attr('disabled',true);\n $(\"#show_form_emergente .CiudadSelect\").attr('disabled',true);\n // Cuando se selecciona el departamento cambia la ciudad\n $(\"#show_fo...
[ "0.7132693", "0.7116215", "0.71060485", "0.7078735", "0.6948233", "0.6837595", "0.6836534", "0.6804979", "0.67832285", "0.67602956", "0.6754975", "0.67335546", "0.6727585", "0.6703649", "0.66988575", "0.66929656", "0.6657681", "0.6625516", "0.6594239", "0.6558794", "0.6558794...
0.63180447
39
Ajax form search button
function removeURLParameter(url, parameter) { //prefer to use l.search if you have a location/link object var urlparts= url.split('?'); if (urlparts.length>=2) { var prefix= encodeURIComponent(parameter)+'='; var pars= urlparts[1].split(/[&;]/g); //reverse iteration as may be destructive for (var i= pars.length; i-- > 0;) { //idiom for string.startsWith if (pars[i].lastIndexOf(prefix, 0) !== -1) { pars.splice(i, 1); } } url= urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : ""); return url; } else { return url; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajaxSearch(form, url) {\t\t\n\t\t\t$.ajax({\n\t\t\t\turl: url,\n\t\t\t\ttype: 'POST',\n\t\t\t\tdata: $(form).serialize(),\n\t\t\t\tbeforeSend: function() {\n\t\t\t\t\t$('#filter-form').append('<span id=\"waiting\" class=\"loading\"></span>');\n\t\t\t\t},\n\t\t\t\tcomplete: function() {\n\t\t\t\t\t$('#wait...
[ "0.7861589", "0.71671945", "0.71077967", "0.7105946", "0.71024144", "0.70440894", "0.70389456", "0.69858533", "0.6968259", "0.6950583", "0.6914931", "0.68125397", "0.67915434", "0.6787737", "0.6777894", "0.6777544", "0.6765782", "0.6750471", "0.6736879", "0.6728538", "0.67002...
0.0
-1
Slider Range TODO_10: make data anything
function wpbc_do_slider_range(range){ var rangeSliderJQ = range.find('.slider-range'); var rangeSlider = rangeSliderJQ.get(0); if(!rangeSlider) return; var deffaults_moneyFormat = { decimals: 0, thousand: '.', prefix: 'USD' }; var data_money_format = range.data('money-format') ? range.data('money-format') : deffaults_moneyFormat; var moneyFormat = wNumb(data_money_format); var deffaults_sliderArgs = { start: [500000, 1000000], step: 1000, range: { 'min': [100000], 'max': [1000000] }, rangeLabels: { 'min': 'Min:', 'max': 'Max:' }, hideRangeLabels: false, format: moneyFormat, connect: true }; var data_range_args = range.data('range-args'); if(data_range_args){ var sliderArgs = $.extend(deffaults_sliderArgs, data_range_args); }else{ var sliderArgs = deffaults_sliderArgs; } if( sliderArgs.rangeLabels && !sliderArgs.hideRangeLabels ){ var labels = range.append('<div class="range-labels"/>'); $.each(sliderArgs.range, function(e){ var label = '<label><b>'+sliderArgs.rangeLabels[e]+' <span class="slider-range-'+ e +'"></span></b></label>'; range.find('.range-labels').append( label ); }); } var arr_range = Object.values(sliderArgs.range); var arr_rageLabels = Object.values(sliderArgs.rangeLabels); noUiSlider.create(rangeSlider, sliderArgs); rangeSlider.noUiSlider.on('update', function(values, handle) { $.each(values, function(e,v){ $.each(sliderArgs.range, function(index, obj){ var ii = arr_range.indexOf(obj); if(ii == e){ var output_values = '.slider-range-'+ index; range.find(output_values).html(v); var output_inputs = range.data('input-'+index); $(output_inputs).val( moneyFormat.from(v) ); } }); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onRangechanged(data){\n\tvar slider = document.getElementById('slider');\n\tslider.value = data.value;\n}", "customRange() {\n\t\t$(\".range-wrap\").each(function () {\n\t\t\tlet _this = $(this);\n\t\t\tvar $d3 = _this.find(\".slider-js\");\n\n\t\t\tvar slider = $d3.ionRangeSlider({\n\t\t\t\tskin: \"rou...
[ "0.77781993", "0.7456821", "0.7377683", "0.7363827", "0.71230394", "0.7118302", "0.69636977", "0.6920645", "0.6893414", "0.68429697", "0.68327826", "0.68199635", "0.6796448", "0.6769897", "0.67467713", "0.6743158", "0.67418206", "0.67304105", "0.6724909", "0.6718906", "0.6709...
0.7601441
1
A simple component to display the data of a question
function QuestionDetail (props) { const q = props.question return ( <div className='QuestionDetail'> <div onClick={props.onBackClick} className='BackButton' >Back</div> <div> <h2>{q.title}</h2> </div><div> <span>Created by: </span>{q.user.first_name} </div><div> <p>{q.body}</p> </div><div> <span>Created at: </span>{q.created_at} </div><div> <span>View Count: </span>{q.view_count} </div> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Question(props) {\n return (<h1 className=\"question\">{props.dataSet.question}</h1>)\n}", "function renderQuestion(questionObj) {\n questionEl.innerHTML = questionObj.question;\n}", "function showQuestion(question) {\n questionEl.innerText = question.question;\n}", "renderQuestion(question...
[ "0.73917747", "0.7139805", "0.71232903", "0.70028836", "0.6970631", "0.6912989", "0.69103056", "0.6909356", "0.6898124", "0.6889531", "0.68531924", "0.6851344", "0.6846005", "0.6828864", "0.6803566", "0.68028325", "0.6794982", "0.6793598", "0.6785943", "0.67762226", "0.677111...
0.65521353
39
overridable methods for strict implementation
info() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "transient private protected internal function m182() {}", "native() {\n throw new Error('NOT_IMPLEMENTED_EXCEPTION: you must override this method in order to use it')\n }", "allow() {\n throw new Error(\"Not implemented.\");\n }", "transient protected internal function m189() {}", "function Supercl...
[ "0.65936565", "0.6559018", "0.6431923", "0.63379323", "0.62365943", "0.62365943", "0.6209917", "0.6184071", "0.61630976", "0.6157667", "0.61415505", "0.61339647", "0.6098223", "0.6085714", "0.6028512", "0.59647655", "0.5955366", "0.5955366", "0.59548247", "0.59346336", "0.586...
0.0
-1
CHECK FOR ACTION WITH ID
function validateActionId(req, res, next) { actions .get(req.params.id) .then((action) => { if (action) { req.action = action; next(); } else { res.status(404).json({ message: `No action ${req.params.id} can not be found.`, }); } }) .catch(() => { res.status(500).json({ message: `There was an error retrieving action ${req.params.id}.`, }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkActionID (req, res, next) {\n const {actionID} = req.params;\n\n db.get(actionID)\n .then(action => {\n if (!action) {\n res.status(404).json({message: \"No action exist with that ID.\"});\n } else {\n next();\n }\n })\n .catch(err => {\n ...
[ "0.71941966", "0.6998598", "0.69555527", "0.67714584", "0.6757103", "0.6735973", "0.64874417", "0.6265665", "0.6218512", "0.61368203", "0.5963202", "0.59619296", "0.5809147", "0.5678967", "0.566707", "0.565205", "0.5543206", "0.5479967", "0.547084", "0.5449089", "0.5447163", ...
0.6783179
3
CHECK THAT DATA IS FILLED CORRECTLY
function validateActionData(req, res, next) { if (!req.body.project_id || !req.body.description || !req.body.notes) { res.status(400).json({ message: "Please include project_id, action description and action notes .", }); } else { next(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkDataFiles() {\n // TODO set up later\n}", "validateLocalData(data) {\n return true;\n }", "function checkFileObject(pObj) {\n\t\t\t\t\tvar mustHaveCondition = (assertChain(pObj, \"objectType\") && (\"file\" === pObj.objectType)) || (assertChain(pObj, \"image.url\") && assertChain(pOb...
[ "0.67523944", "0.60372776", "0.590357", "0.58906025", "0.5876688", "0.5821067", "0.5800073", "0.5722743", "0.5698059", "0.5679556", "0.56306547", "0.56058055", "0.5586652", "0.557492", "0.5567005", "0.5557666", "0.55312985", "0.5515193", "0.5493303", "0.5464582", "0.5434084",...
0.0
-1
SETUP FUNCTION Runs once at beginning of program
function setup() { let cnv = createCanvas(600, 400); cnv.parent("cnvContainer"); noStroke(); // Initialize Global Variables bgColor = "white"; initMovingShapes(); initRandomShapes(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _setup () {\n }", "setupOnce() {\n if (!isBrowser()) {\n return;\n }\n\n this._setup();\n\n // XXX: See method comments above\n setTimeout(() => this.start());\n }", "setup() {}", "setup() {}", "setup() {}", "function setup() {}", "function init() {\n ...
[ "0.7409126", "0.7305603", "0.7291339", "0.7291339", "0.7291339", "0.72133267", "0.71778625", "0.71778625", "0.7164384", "0.7129226", "0.7129226", "0.7129226", "0.7129226", "0.7120522", "0.71132016", "0.70818275", "0.70818275", "0.69343704", "0.6933893", "0.6901312", "0.683354...
0.0
-1
Test Data var full = require('./full_export.json') var observations = full.observations var comments = full.comments var ideas = full.ideas var users = full.users group by user
function groupByUser(input, dataKey){ var output = _.groupBy(input, (d) => { return d[dataKey]; }) return output }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "formatData(babies) {\n const groups = _.uniqBy(_.map(babies, 'group'));\n const dataBlob = {};\n const sectionIds = [];\n const rowIds = [];\n\n for (let sectionId = 0; sectionId < groups.length; sectionId++) {\n const currentGroup = groups[sectionId];\n const users = babies.filter((baby) ...
[ "0.5912784", "0.57586914", "0.56984335", "0.5647821", "0.5464481", "0.5447467", "0.5427573", "0.53792137", "0.52907777", "0.5284769", "0.5279867", "0.5278394", "0.5254319", "0.52483803", "0.5239221", "0.5226947", "0.52074695", "0.52030927", "0.5185245", "0.515623", "0.5155661...
0.0
-1
get number per month/year
function getCount(input){ var output = _.mapValues(input, (d) => { return _.size(d); }) return output }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getMonths() {\n\treturn [...Array(12).keys()].map((index) => index + 1);\n}", "numericToMonthAsNumber(arr) {\n let months = new Array(12).fill(0);\n\n arr.forEach((key, val) => {\n months[key.value - 1] = key.count;\n });\n\n return months;\n }", "function getNums(month) {\n var inc...
[ "0.6870666", "0.6790619", "0.66646606", "0.63853145", "0.6310944", "0.62992495", "0.62752146", "0.62288827", "0.6207678", "0.6175112", "0.6163886", "0.61469346", "0.61346525", "0.61242497", "0.61176354", "0.603876", "0.6030407", "0.6019261", "0.60093457", "0.59918535", "0.594...
0.0
-1
determines if there is currently a user session by whether a cookie exists or not
componentDidMount () { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkIfSession() {\n var userCookie = $cookies.getObject('timeshareCookie');\n // console.log($cookies.get('userSession', $rootScope.userSession));\n if (userCookie) {\n return isLoggedIn = true;\n } else {\n return false;\n }\n }", "static isLog...
[ "0.762036", "0.7496112", "0.7376278", "0.7371604", "0.73689723", "0.7278023", "0.7170002", "0.7162104", "0.71228313", "0.70905316", "0.7069505", "0.6977037", "0.6950728", "0.6929542", "0.68491805", "0.67900056", "0.6783293", "0.67635584", "0.675013", "0.6741138", "0.67382246"...
0.0
-1
funtions for mens page
function filter(x, y) { window.location.href = `/products/type/${y}/${x}`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMsgEcrant(){\n var pageGET = \"affichermsg\"; \n requetGET(pageGET);\n }", "function mensajes(respuesta){\n\n\t\t\t\tvar foo = respuesta;\n\n\t\t\t\t\tswitch (foo) {\n\n\t\t\t\t\t\tcase \"no_exite_session\":\n\t\t\t\t\t\t//============================caso 1 NO EXISTE SESSION==================//...
[ "0.62099385", "0.60353917", "0.6019458", "0.60177386", "0.60103494", "0.5992675", "0.59918314", "0.5988811", "0.5974616", "0.59224516", "0.59190804", "0.5909446", "0.58926034", "0.58888304", "0.58725005", "0.5871349", "0.5853599", "0.5852121", "0.5851398", "0.58469516", "0.58...
0.0
-1
List Controller function controls JQM list view. It handles actions like object 'query', 'edit' & 'logout' etc
function ListCtrl($scope, Contact, $location, AngularForce) { //Set login details //AngularForce.setCordovaLoginCred(); AngularForce.login(function () { setTimeout(function () { $scope.query(); }, 0); }); //Query list of Opportunities $scope.query = function () { Contact.query(function (data) { $scope.contacts = data.records; $scope.$apply();//Required coz sfdc uses jquery.ajax }); }; //Edit $scope.edit = function (id) { $location.path('/edit/' + id); }; // Logout $scope.logout = function () { if (cordova) { var sfOAuthPlugin = cordova.require("salesforce/plugin/oauth"); sfOAuthPlugin.logout(); } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lists() {\n\t$.post(\"listobject.hrd\", function(data) {\n\t\t$(\"#tblist\").html(listobjectdetails(data));\n\t});\n\n}", "function sugarListView() {\n}", "function ListController(model, view) {\r\n this._model = model;\r\n this._view = view;\r\n var _this = this;\r\n\r\n /...
[ "0.68371105", "0.66631824", "0.6646674", "0.64571404", "0.6398585", "0.63866705", "0.6342175", "0.6306941", "0.62670416", "0.626291", "0.62313855", "0.62313855", "0.62150204", "0.6178464", "0.6140332", "0.613153", "0.61134446", "0.6096952", "0.6070128", "0.60584074", "0.60355...
0.0
-1
Creates a pending YouTube Data API request/query with the chosen filters.
function formatAPIRequest(maxResults = 10) { var filters = { part: 'snippet', q: document.getElementById('keywordBar').value, safeSearch: 'strict', relevanceLanguage: 'en-US', maxResults: maxResults, type: 'video', order: document.getElementById('orderDropdown').value, regionCode: 'US' }; if (g_useLocation) { filters.location = document.getElementById('latitudeText').value + ',' + document.getElementById('longitudeText').value; filters.locationRadius = document.getElementById('radiusText').value + document.getElementById('radiusUnit').value; } return gapi.client.youtube.search.list(filters); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createRequest () {\n\t\treturn gapi.client.youtube.search.list({\n part: 'snippet',\n type: 'video',\n q: encodeURIComponent($('#searchText').val().replace(/\\s\\s+/g, ' ')).replace(/%20/g, '+'),\n maxResults: maxResult,\n order: 'viewCount',\n ...
[ "0.6940617", "0.61519146", "0.5756042", "0.5719238", "0.5485259", "0.5478886", "0.54678667", "0.5467846", "0.5434343", "0.54054534", "0.537566", "0.5349486", "0.5338704", "0.5335913", "0.5335387", "0.53116506", "0.526498", "0.52640456", "0.52390325", "0.5216244", "0.52053547"...
0.56758016
4
Displays YouTube Data API search results from the response.
function showResults(response) { var results = $('#resultDiv'); var responseItems = response.result.items; results.empty(); if (responseItems.length == 0) { results.append('<hr><p style="color:red;">Oh no! It looks like there\'s no results.</p>'); } else { // Show results in the results element and add the title to the wordcloud list. results.append('<h3>Results: (Showing first ' + responseItems.length + ')</h3>') g_words = []; responseItems.forEach((item) => { vidLink = 'https://youtube.com/watch?v=' + item.id.videoId vidTitle = '<span class="videoTitle">' + item.snippet.title + '</span>'; vidDesc = '<span class="videoDesc">' + item.snippet.description + '</span>'; vidThumb = '<a class="infoLink" href="' + vidLink + '" target="_blank" >' + '<img class="videoThumb" src="' + item.snippet.thumbnails.medium.url + '" alt="No Image Available."' + '></a>'; results.append('<hr>' + '<div>' + vidThumb + '<div class="videoInfo">' + '<a class="infoLink" href="' + vidLink + '" target="_blank" >' + vidTitle + '</a>' + '<br>' + vidDesc + "</div>" + '</div>'); addToWordCount(item.snippet.title); }); } updateWordCloud(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayYoutubeSearchData(data) {\t\r\n\tconst results = data.items.map((item,index) => renderYoutubeResult(item));\r\n\t$('.js-youtube').html(results);\t\r\n}", "function displayYouTubeSearchData(data) {\n let results = data.items.map(function(item, index) {\n return renderResult(item);\n });\n $(...
[ "0.76567084", "0.7579608", "0.7415229", "0.7290124", "0.7278273", "0.7147398", "0.7117889", "0.7068968", "0.70680505", "0.6950923", "0.69302416", "0.6908206", "0.69021475", "0.6868034", "0.6858842", "0.6856982", "0.68432194", "0.6819458", "0.67860466", "0.6758668", "0.6752775...
0.73202467
3
Appends any "word" in a string to the given array.
function addToWordCount(string) { // Split words, names, or terms in titles var words = string.toLowerCase().replace(/[^\w#$\'\’\-]+/g,'.').split('.'); g_words = g_words.concat(words); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stringArray(string){\n\tvar word_arr = []\n\tvar word = ''\n\tfor (var i=0; i<string.length; i++){\n\t\tif (string[i]!= \" \"){\n\t\t\tword += string[i]\t\n\t\t}\n\t\telse {\n\t\t\tword_arr.push(word)\n\t\t\tword = ''\n\t\t}\n\t}\n\tword_arr.push(word)\n\treturn word_arr\n}", "function magicArray(wordAr...
[ "0.683238", "0.64350873", "0.630083", "0.6270579", "0.6088431", "0.60502356", "0.6029585", "0.6010487", "0.59811115", "0.5969315", "0.5947727", "0.58971804", "0.58923966", "0.57767624", "0.5764258", "0.5744188", "0.5742298", "0.5721618", "0.5709727", "0.5691549", "0.5686223",...
0.5524743
34
Update the wordcloud contents and draw on webpage.
function updateWordCloud() { var wordCloud = []; var wordFreq = getFrequencyDict(g_words); // Build D3 word-cloud object Object.keys(wordFreq).forEach((word) => { wordCloud.push({ 'text': word, 'size': wordFreq[word] * 180 // px sqrt scale }); }); // Redraw cloud $('#word-cloud').empty().append('<h3>Word Cloud of Titles: </h3>'); d3.layout.cloud().size([700, 300]) .words(wordCloud) .fontSize(function(d) { return Math.sqrt(d.size); }) .rotate(0) .on('end', drawCloud) .start(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wordCloud(selector) {\n\n\t var fill = d3.scale.category20();\n\n\t //Construct the word cloud's SVG element\n\t var svg = d3.select(selector).append(\"svg\")\n\t .attr(\"width\", Math.min(window.innerWidth - 20, 500))\n\t .attr(\"height\", 500)\n\t .append(\"g\")\n\t ...
[ "0.6559019", "0.6543482", "0.64525735", "0.645229", "0.6428035", "0.6418669", "0.639716", "0.6342612", "0.6312245", "0.63054454", "0.61248505", "0.6117456", "0.6106839", "0.60886306", "0.6086507", "0.6047666", "0.60399294", "0.6033455", "0.60136354", "0.6009124", "0.5966488",...
0.7416293
0
Draw D3 wordcloud on webpage.
function drawCloud(items) { d3.select('#word-cloud') .append('svg').attr('width', 650).attr('height', 240).attr('class', 'wordcloud') .append('g').attr('transform', 'translate(250,120)').selectAll('text') .data(items).enter() .append('text') .style('font-size', function(d) { return d.size + 'px'; }) .style('fill', '#000') .attr("transform", function(d) { return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")"; }) .text(function(d) { return d.text; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function d3_word_cloud( div )\r\n{\r\n\tvar self = {};\r\n\t\r\n\tself.id = '#'+div.id;\r\n\tself.div = div;\r\n\tself.words;\r\n\tself.used_words;\r\n\tself.word_count;\r\n\tself.tag_count;\r\n\t\r\n\t// Draw the terms in the word cloud.\r\n\tself.draw = function( data, bounds )\r\n\t{\r\n\t\tself.word_count = da...
[ "0.8019805", "0.79407835", "0.7835825", "0.769367", "0.7630237", "0.75527406", "0.75280845", "0.75264984", "0.74809444", "0.7410006", "0.7398974", "0.7345385", "0.73442775", "0.73055387", "0.7284387", "0.72574353", "0.7254523", "0.71535665", "0.7151581", "0.7090733", "0.70815...
0.8047183
0
Returns a frequency dictionary of array's items (key) and occurences (value).
function getFrequencyDict(arr) { var dictionary = {}; arr.forEach((item) => { if (dictionary[item] === undefined) { dictionary[item] = 1; } else { dictionary[item] = dictionary[item] + 1; } }); return dictionary; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFrequencies(arr) {\n\tlet obj = {};\n\tarr.map(val => {\n\t\tif (!(val in obj)) {\n\t\t\tobj[val] = 1;\n\t\t} else {\n\t\t\tobj[val]++;\n\t\t}\n\t});\n\treturn obj;\n}", "function count_occurrences(arr) {\n var obj = {};\n\n for (var i = 0; i < arr.length; i += 1) {\n var key = String(arr[i]);\n...
[ "0.8148585", "0.7581003", "0.7559475", "0.75287914", "0.74858177", "0.73734105", "0.73594856", "0.7118844", "0.694802", "0.68232834", "0.68052834", "0.6619046", "0.66110384", "0.6574708", "0.65678257", "0.6539609", "0.6507191", "0.6443536", "0.62885344", "0.6284562", "0.62745...
0.84218454
0
Toggles minimum range search filter
function toggleMin() { var minInput = document.getElementById('rangeTextMin'); minInput.disabled = !minInput.disabled; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function applyGDPRangeFilter(min, max) {\n if(min === \"-1\" && max === \"-1\") {\n activeSheet.clearFilterAsync(\"F: GDP per capita (curr $)\");\n } else if(max === \"-1\") {\n activeSheet.applyRangeFilterAsync(\n \"F: GDP per capita (curr $)\...
[ "0.63164365", "0.6050209", "0.59745467", "0.5964212", "0.5956123", "0.5933839", "0.5924314", "0.59226936", "0.5922236", "0.58774364", "0.5875668", "0.5847864", "0.5823278", "0.580096", "0.57963395", "0.5795749", "0.57399726", "0.57312894", "0.5731237", "0.57307833", "0.571677...
0.6892496
0
Toggles maximum range search filter
function toggleMax() { var maxInput = document.getElementById('rangeTextMax'); maxInput.disabled = !maxInput.disabled; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function applyGDPRangeFilter(min, max) {\n if(min === \"-1\" && max === \"-1\") {\n activeSheet.clearFilterAsync(\"F: GDP per capita (curr $)\");\n } else if(max === \"-1\") {\n activeSheet.applyRangeFilterAsync(\n \"F: GDP per capita (curr $)\...
[ "0.6359322", "0.5885841", "0.58857924", "0.5867953", "0.5867642", "0.5817526", "0.57976055", "0.5794327", "0.5777795", "0.5767458", "0.57604694", "0.5751932", "0.5748818", "0.57094616", "0.5709433", "0.5688406", "0.56836134", "0.56836134", "0.5682131", "0.56705546", "0.564846...
0.6657553
0
Toggles geolocation search filter
function toggleLocation() { var longitudeBox = document.getElementById('longitudeText'); var latitudeBox = document.getElementById('latitudeText'); var radiusInput = document.getElementById('radiusText'); var unitInput = document.getElementById('radiusUnit'); longitudeBox.disabled = !longitudeBox.disabled; latitudeBox.disabled = !latitudeBox.disabled; radiusInput.disabled = !radiusInput.disabled; unitInput.disabled = !unitInput.disabled; longitudeBox.required = !longitudeBox.required; latitudeBox.required = !latitudeBox.required; radiusInput.required = !radiusInput.required; g_useLocation = !g_useLocation; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toggleCitySearch(){\n\tplaceArray([]);\n\tmap.setCenter(new google.maps.LatLng(37.1, -95.7));\n\tmap.setZoom(3);\n\t$('.csearch').toggleClass('hidden');\n\t$('.csearch input').val(\" \").focus();\n\tinfowindow.close();\n\tif (screen.width < 600) {\n\t\ttoggleMenu();\n\t}\n}", "function toggleSearchMode(...
[ "0.691735", "0.68066347", "0.6673066", "0.6496882", "0.6470352", "0.6465611", "0.6444265", "0.6392365", "0.6314015", "0.6300479", "0.6276862", "0.62603915", "0.62587065", "0.62529016", "0.6244568", "0.62047863", "0.6186987", "0.61527324", "0.6133196", "0.6114616", "0.6092868"...
0.0
-1
route middleware to ensure user is logged in
function isLoggedIn(req, res, next) { if (req.isAuthenticated()) return next(); res.redirect('/'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isLoggedIn(req, res, next) {\n\tconsole.log('isLoggedIn middleware');\n if (req.isAuthenticated()) {\n \treturn next();\n } else {\n \tres.redirect('/users');\n }\n}", "function isLoggedIn(req, res, next) {\n if (req.isAuthenticated()) return next();\n else res.redirect('/signin');\n }", "...
[ "0.7830781", "0.78219163", "0.7809984", "0.7780423", "0.77706826", "0.776651", "0.77620107", "0.7753045", "0.7751315", "0.7751259", "0.7750051", "0.77436227", "0.7740583", "0.7735315", "0.7733077", "0.7733077", "0.77306277", "0.7725432", "0.77243286", "0.7714864", "0.7714864"...
0.7648227
63
if nothing happens for 5 minutes, call the coffee pot "off"
function handle_timeout() { if(!heating) { if(happenen) { console.log("on :"+Date()); }else { console.log("off:"+Date()); } } if(brew_last != 0.0) { console.log("last brew was "+ (Date.now() - brew_last)/60000 + " Minutes Ago"); } startTimeout(handle_timeout, warming_interval); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function takeOff() {\n\tclient.takeoff(function(){\n\t\tisFlying = true;\n\t\tconsole.log('3, 2, 1, take off!');\n\t});\n}", "poisonPill(){\n\t\tclearInterval(this.timer30min);\n\t\tclearInterval(this.timer1min);\n\t\tthis.comics.poisonPill();\n\t}", "function yeelight_sleep_thirty(){\n setTimeout(yeelight_sl...
[ "0.6927403", "0.6664429", "0.6356778", "0.62862223", "0.62610096", "0.62255055", "0.6123257", "0.6093624", "0.6029306", "0.6019327", "0.6017314", "0.6012014", "0.59839904", "0.59639084", "0.59352326", "0.5928593", "0.5904203", "0.5903561", "0.5898243", "0.585536", "0.5848501"...
0.63470256
3
TILL THE DAY I DIE
function SoundSoundSound({name, keyboard}) { const [isActive, setIsActive] = useState(false) const toneRef = useRef(null) const onDown = useCallback(() => { setIsActive(true) toneRef.current.triggerAttackRelease("C4", "4n") }, [setIsActive]) const handleKeyDown = useCallback((event) => { // this prevents multiple firings when key stays pressed if (event.repeat) { return } if (event.key === keyboard) { setIsActive(true) toneRef.current.triggerAttackRelease("C4", "4n") } }, [toneRef]); const handleKeyUp = useCallback((event) => { if (event.key === keyboard) { setIsActive(false) } }, [setIsActive]) useEffect(() => { document.addEventListener("keydown", handleKeyDown, false); document.addEventListener("keyup", handleKeyUp, false); return () => { document.removeEventListener("keydown", handleKeyDown, false) document.removeEventListener("keyup", handleKeyUp, false) }; }, [handleKeyUp, handleKeyDown]); useEffect(() => { toneRef.current = new Tone.Sampler({ urls: { C4: `${process.env.PUBLIC_URL}/drums/808/${name}.wav` } }).toDestination(); }, []) return ( <LaunchpadButton onMouseDown={onDown} onMouseUp={ () => setIsActive(false) } // don't store the active state if mouse is dragged outside onMouseLeave={() => setIsActive(false)} onTouchStart={onDown} isActive={isActive} onTouchEnd={e => { e.preventDefault() setIsActive(false) }}> {name} ({keyboard}) </LaunchpadButton> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "die() {\n\t\tboard.morituri.push(this);\n\t\tthis.idle = true;\n\t\tthis.tick = -1;\n\t\tthis.bleed = setInterval(\n\t\t\t(function (self) { //wrapping necessary to preserve \"this\"-context\n\t\t\t\treturn function () {\n\t\t\t\t\tself.animateDying();\n\t\t\t\t}\n\t\t\t})(this),\n\t\t\t1500 / GAME_SPEED);...
[ "0.66842484", "0.66754216", "0.6362205", "0.63580745", "0.62219286", "0.6167439", "0.615795", "0.6115585", "0.6104746", "0.60160756", "0.5984404", "0.59635776", "0.59266233", "0.59149843", "0.5878253", "0.5876021", "0.58727944", "0.58652776", "0.5854617", "0.5853538", "0.5851...
0.0
-1
TODO: Add my available character to pick zone
function reset(){ pickZone.empty(); attZone.empty(); defZone.empty(); isAttackerPicked = false; isDefenderPicked = false; character = [{name: "Mamados", id: 0, hp: 180, att_pwr: 30, def_pwr: 35}, {name: "Banana", id: 1, hp: 300, att_pwr: 60, def_pwr: 35}, {name: "Milky", id: 2, hp: 220, att_pwr: 35, def_pwr: 25}, {name: "Xiaomiao", id: 3, hp: 220, att_pwr: 25, def_pwr: 20}, {name: "Xiaowang", id: 4, hp: 100, att_pwr: 50, def_pwr: 50}]; character.forEach(function (item){ var newItem = $("<div>"); var itemName = $("<span>"); var itemImg = $("<img>"); var itemHp = $("<span>"); newItem.addClass(function() { return "ml-2 text-center itemBox item-" + item.id; }); newItem.attr("value", item.id) itemName.html(item.name); itemName.attr("class", "itemName"); itemImg.attr("src", function() { return "assets/images/p" + item.id + ".jpg"; }); itemImg.attr("class", "picture"); itemImg.attr("width", 150); itemHp.attr("class", "itemHp"); itemHp.html(item.hp); newItem.append(itemName, itemImg, itemHp); pickZone.append(newItem); }); // console.log(pickZone); // console.log(isAttackerPicked,isDefenderPicked); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectLetter(usedLetters) {\r\n\tvar i=Math.floor(Math.random()*NUMBER_PICES);\r\n\twhile(usedLetters[i]!=0) //generate untile pieces not used\r\n\t{\t\t\r\n\t i=Math.floor(Math.random()*NUMBER_PICES);\r\n\t}\r\n return i;\r\n}", "function selectCharacter() {\n\t\t$(\"#text-1\").text(\"\");\n\t\t$(...
[ "0.58850485", "0.5793072", "0.5672225", "0.5665386", "0.56251144", "0.55703205", "0.5563132", "0.5562164", "0.5545125", "0.55391914", "0.55028266", "0.54954565", "0.54835194", "0.544393", "0.5430134", "0.5396688", "0.5394475", "0.5392773", "0.539214", "0.53885275", "0.5381585...
0.54968125
11
Fetches the next page of search results and adds them to the end of current results array.
fetchNextPage() { this.setState({fetching: true}); const query = searchURL + 'q=' + encodeURIComponent(`${this.state.term} in:name in:email`) + `&per_page=20&page=${this.state.page}`; fetch(query) .then((response) => response.json()) .then((data) => { console.log(data); if(data.message) { alert("An error occured"); } else if(data.items.length < 20) { this.setState({fetching: false, endOfResults: true, users: [...this.state.users, ...data.items]}); } else { this.setState({fetching: false, users: [...this.state.users, ...data.items], page: this.state.page + 1}); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function next(){\n\n // if in the last page, then go to the new page needs http request\n if(scope.model.currentIndex === (scope.model.results.length - 1))\n {\n angular.element('button.searchbtnbox').toggleClass('changed');\n angul...
[ "0.74202186", "0.73766404", "0.73360234", "0.72923285", "0.724585", "0.72164494", "0.7107433", "0.7047732", "0.7032768", "0.69494736", "0.6855517", "0.67894685", "0.67791355", "0.6763511", "0.6726845", "0.66221195", "0.66187996", "0.6612061", "0.6609965", "0.65920323", "0.654...
0.66509604
15
Closes modal and resets selected user.
closeModal() { this.setState({modal: false, selectedUser: {}}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onAddUpdateUserModalClose() {\n\t\tthis.setState({ addNewUserModal: false, editUser: null })\n\t}", "function CloseModul() {\n document.getElementById(\"modal_del_user\").style.display = \"none\";\n window.location=window.location;\n}", "onAddUpdateUserModalClose() {\n this.setState({ addNewUserModal: f...
[ "0.6710769", "0.66541034", "0.6595273", "0.65689504", "0.6519611", "0.6512965", "0.65033305", "0.6463768", "0.6430874", "0.6420869", "0.638624", "0.6344381", "0.62914914", "0.62914914", "0.62895215", "0.6256293", "0.6248848", "0.6240127", "0.62312025", "0.6212529", "0.6198751...
0.70779943
0
Uses the builtin array method `.find` to replicate what our helper function does. So no need for a helper function!
function getConnectedRoomNamesByIdAlt(rooms, id) { const result = []; const room = rooms.find((room) => room.roomId === id); if (room === undefined) { return `Room with ID of '${id}' could not be found.`; } const connectedIds = room.connectsTo; for (let i = 0; i < connectedIds.length; i++) { const connectedRoomId = connectedIds[i]; const connectedRoom = rooms.find((room) => room.roomId === connectedRoomId); if (connectedRoom === undefined) { return `Room with ID of '${connectedRoomId}' could not be found.`; } result.push(connectedRoom.name); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function find(arr, func) {\n return arr.find(function(item){\n \treturn func(item);\n });\n}", "function find(arr, fn) {\n if (arr && 'length' in arr) {\n for (var i = 0, ii = arr.length; i < ii; i++) {\n var result = fn(arr[i], i);\n if (result) return result;\n }\n ...
[ "0.7917967", "0.77466595", "0.76428616", "0.7626555", "0.75269157", "0.7503661", "0.7503661", "0.7492684", "0.7492684", "0.7492684", "0.7492684", "0.7341348", "0.7339066", "0.73365355", "0.73240703", "0.7311705", "0.7303976", "0.7269136", "0.72572184", "0.72292346", "0.719457...
0.0
-1
Don't call Array's methods which modify items, because they don't emit events.
function Collection() { this.items = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function testArray() {\n a = [1, 3, 2];\n modifyArray(a);\n console.log(a);\n}", "observeArray (items) {\n for (var i = 0, l = items.length; i < l; i++) {\n observe(items[i]);\n }\n }", "function Item(fun,array){this.fun=fun;this.array=array}", "function Item(fun,array){this.fun = fun;th...
[ "0.6532271", "0.64460874", "0.6189899", "0.61843216", "0.61735713", "0.61735713", "0.61735713", "0.61735713", "0.61735713", "0.61735713", "0.61735713", "0.61735713", "0.61735713", "0.61735713", "0.61735713", "0.61735713", "0.61735713", "0.61735713", "0.61735713", "0.61735713", ...
0.0
-1
Get list of courses in list of json format.
static async getCourseList(){ const request = await fetch('https://tddd27-nikha864-backend.herokuapp.com/get_courses', { method: 'get' }); return await request.json(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getListCourse(){\n\t\t$http.get(app.baseUrl + \"admin/api/course/\" + $scope.categoryId).then(function(response) {\n\t\t\t$scope.courses = response.data;\n\t\t});\n\t}", "function getCourses () {\n return [\n {id: 'csc148h1'},\n {id: 'csc165h1'},\n {id: 'csc240h1'},\n {id: 'cog250y1'},\n ...
[ "0.7913278", "0.7692899", "0.76921046", "0.76204664", "0.75271815", "0.75146955", "0.7327813", "0.72644186", "0.6996485", "0.6774062", "0.6754149", "0.67472094", "0.67141247", "0.66796756", "0.6625536", "0.6601905", "0.6594739", "0.6507353", "0.64461154", "0.64321196", "0.642...
0.80760765
0
Send a request to the server to add a semester to the current course plan.
async addSemester(event) { event.preventDefault(); let payload = new FormData(); payload.append("token", Auth.getToken()); payload.append("semester_name", this.state.semester + ' ' + this.state.value); payload.append("identifier", this.state.plan.plan_hash); const request = await fetch('https://tddd27-nikha864-backend.herokuapp.com/add_semester', { method: 'post', body: payload }); let response = await request.json(); if(response.success){ // Re-render course plans to update the new one this.componentWillMount(); this.setState({ snackbarMessage: response.message, snackbarColor: 'white', loadingAddingPlan: false }); } else{ this.setState({ snackbarMessage: response.message, snackbarColor: 'red', loadingAddingPlan: false }); } this.handleOpenSnackbar(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createNewDegreePlan(req, res) {\n const errors = validationResult(req);\n\n if (!errors.isEmpty()) {\n return res.status(400).json({\n errors: errors.array()\n });\n }\n\n async function find (name, query) {\n let courses = []\n collection = mongoose.connection.db.collection(name)\n ...
[ "0.60516906", "0.58862776", "0.5659045", "0.5581596", "0.5510067", "0.5445908", "0.5420592", "0.5249842", "0.523199", "0.5207193", "0.51517975", "0.5107889", "0.50674534", "0.5065995", "0.50557905", "0.49992535", "0.49951312", "0.49949613", "0.49931797", "0.49581617", "0.4944...
0.6681692
0
Push all semesters into a list of Semester components that can be rendered easily
fillSemesters(){ let semesters = this.state.plan.semesters; let semesterBoxes = []; for (let i = 0; i < semesters.length; i++) { semesterBoxes.push(<Semester key={i} callback={this.updateEditor} plan={this.state.plan} editMode={true} semesterIndex={i} semester={semesters[i]} scheduleConflict={semesters[i].schedule_conflict} courseList={this.state.courseList}/>) } return semesterBoxes; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "renderSemester(sem, index){\n if(sem.name !== \"\") {\n return (\n <Grid className='Semester' key = {index} centered padded>\n <Header as='h3' style={{marginTop: 0.5 + \"em\", marginBottom: 0}}>\n {sem.name}\n </Header>\n...
[ "0.6275523", "0.61636466", "0.5985284", "0.5909302", "0.58823043", "0.5811996", "0.574767", "0.571299", "0.5616592", "0.55245125", "0.550071", "0.5379568", "0.53547525", "0.5267286", "0.5240658", "0.52307177", "0.5225599", "0.5204975", "0.5203956", "0.518352", "0.51832056", ...
0.77146447
0
Registers the fs storage as plugin.
static register() { __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["FSStorage"] = FSStorage; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static register() {\n __WEBPACK_IMPORTED_MODULE_0__common_plugin__[\"a\" /* PLUGINS */][\"MemoryStorage\"] = MemoryStorage;\n }", "static addPlugin( plugin ) {\n\n if (!plugin) {\n throw new TypeError( 'No plugin provided.' );\n }\n\n PLUGINS.push( plugin );\n\n i...
[ "0.6073608", "0.5724474", "0.5619234", "0.5516546", "0.5299238", "0.52935225", "0.52909523", "0.52453727", "0.52308875", "0.52022916", "0.5202198", "0.51965237", "0.51965237", "0.51965237", "0.5119482", "0.50976783", "0.500158", "0.5001106", "0.49843267", "0.49816298", "0.498...
0.75637126
0
Deregisters the fs storage as plugin.
static deregister() { delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["FSStorage"]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static deregister() {\n delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__[\"a\" /* PLUGINS */][\"MemoryStorage\"];\n }", "deletePlugin() {}", "function delete_storage(){\n\tsimact.Algebrite.run(\"clearall\");\n\tfilloutputarea();\n}", "function fsUnloaded() {\n\t// framescript on unload\n\tconsol...
[ "0.6892776", "0.6261115", "0.6207618", "0.6010964", "0.5892992", "0.5781081", "0.57574296", "0.5756662", "0.5709458", "0.5652719", "0.56195354", "0.5599298", "0.5517013", "0.54951006", "0.54951006", "0.54951006", "0.54951006", "0.5488156", "0.5482132", "0.5480549", "0.5445049...
0.80028516
0
Provenance graph extension point
static async trackProvenance(graph) { if (graph.isEmpty) { Matomo.getInstance().trackEvent('session', 'new', 'New Session'); } else { Matomo.getInstance().trackEvent('session', 'continue', `${graph.desc.id} at state ${Math.max(...graph.states.map((s) => s.id))}`); } const trackableActions = new Map(); // load all registered actionFunction extension points and look if they contain a `analytics` property PluginRegistry.getInstance() .listPlugins((desc) => desc.type === 'actionFunction' && desc.analytics) .forEach((desc) => { trackableActions.set(desc.id, desc.analytics); }); graph.on('execute', (_, node) => { if (!Array.from(trackableActions.keys()).includes(node.getAttr('f_id'))) { return; } const event = trackableActions.get(node.getAttr('f_id')); Matomo.getInstance().trackEvent(event.category, event.action, typeof event.name === 'function' ? event.name(node) : node.name, typeof event.value === 'function' ? event.value(node) : null); }); graph.on('run_chain', (_, nodes) => { Matomo.getInstance().trackEvent('provenance', 'runChain', 'Run actions in chain', nodes.length); }); const config = await AppContext.getInstance() .getAPIJSON('/tdp/config/matomo') .catch(() => ({})); Matomo.getInstance().init(config); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getActivity(nodeId) {\n\n // If no id provided, no activity returned\n if(!nodeId) { console.error(\"no id provided\"); return undefined; }\n \n // If id is not from gomodel space (hardcoded bad), no activity returned\n if(nodeId.substring(0, 8) != \"gomodel:\") { console.error(\"wro...
[ "0.5722939", "0.5331207", "0.5331207", "0.5107911", "0.5040223", "0.501194", "0.49985784", "0.49692756", "0.49566272", "0.49493262", "0.4913564", "0.48637864", "0.48479897", "0.48048607", "0.4767906", "0.47660124", "0.47302955", "0.47135925", "0.4707384", "0.46642593", "0.464...
0.5894048
0
Reset builder to default state
function hi_reset_builder() { var data = $.parseJSON($('#hi-def-tpl').text()); $('#hi-tpl-id').val(''); $('#hi-tpl-id-title').empty().text($('#hi-tpl-id-title').data('text')); $('.hi-preview-sizes').find('option:selected').removeAttr('selected'); $('.hi-preview-sizes').trigger('change'); HI._loadData(data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "reset(){\n this.enable();\n this.init();\n this.buildAll();\n }", "reset() {\r\n this.state = this.config.initial;\r\n }", "reset() {\r\n this.state = this.config.initial;\r\n }", "function reset() {\n\t setState(null);\n\t} // in case of reload", "reset() {\r\n ...
[ "0.7149055", "0.70930123", "0.69661194", "0.694345", "0.6941383", "0.68612057", "0.6834121", "0.66952205", "0.6664618", "0.66486603", "0.66171783", "0.661636", "0.6599098", "0.6598094", "0.65954536", "0.65271765", "0.65152824", "0.6514008", "0.63777477", "0.6376477", "0.63548...
0.6877925
5
Refresh tpl name after rename
function hi_refresh_tpl_name(id, name) { $('select.hi-tpl-assign option[value="' + id + '"]').text(name + ' ( id: ' + id + ' )'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renameTemplate(templateId, name)\n {\n if(name == \"\" || name == null)\n {\n var defMsg = \"Template names can not be blank.\";\n $.perc_utils.alert_dialog(\n {\n title: 'Error',\n content: defMsg\n ...
[ "0.65656984", "0.6311405", "0.616938", "0.61644787", "0.616218", "0.611465", "0.5939255", "0.5939255", "0.59152156", "0.5871287", "0.58163965", "0.57335323", "0.5710001", "0.570061", "0.5651921", "0.56500775", "0.56246614", "0.5618135", "0.5617449", "0.5561894", "0.55436075",...
0.72923905
0
Reload assign on tpls tab
function hi_assign_reload() { var post = { type: 'get-assigns', action: 'hi_ajax_post_action', security: $('#security').val() } $.post(ajaxurl, post, function (r) { if (r != 'error') { var data = JSON.parse(r); $.each(data, function (i, e) { $('#hi-' + i + ' .hi-tpl-assigned-info').replaceWith(e.html); }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reload() {\n vm.isAbnormal = false;\n vm.items = [];\n vm.canLoad = true;\n pageIndex = 1;\n }", "async reload() {}", "function hi_refresh_tpl_name(id, name) {\n $('select.hi-tpl-assign option[value=\"' + id + '\"]').text(name + ' ( id: ' + id ...
[ "0.5778279", "0.5762475", "0.5722502", "0.56876534", "0.56502336", "0.5645224", "0.5645224", "0.56300664", "0.55825883", "0.5520576", "0.55083746", "0.5503636", "0.54165196", "0.54030246", "0.5402532", "0.539508", "0.5383742", "0.5353604", "0.5343267", "0.5313228", "0.5313228...
0.7313633
0
Restart without reloading objects etc that are still valid
function start(){ Crafty.init(window.innerWidth,window.innerHeight, document.getElementById('game')); //score display score = Crafty.e("2D, DOM, Text") .text("Score: 0") .textFont({family: 'Arial', size:'30px', weight:'bold'}) .attr({x: Crafty.viewport.width - 300, y: Crafty.viewport.height - 50, w: 200, h:50}) .css({color: "#000"}); //generateAsteroid(150, 10, 128, asteroidSizeEnum.BIG); //generateAsteroid(500, 300, 128, asteroidSizeEnum.BIG); //generateAsteroid(700, 450, 128, asteroidSizeEnum.BIG); //generateAsteroid(20, 600, 128, asteroidSizeEnum.BIG); player= Crafty.e('2D, DOM, Image, Controls, Collision') .attr({ move: { left: false, right: false, up: false, down: false}, xspeed: 0, yspeed: 0, decay: 0.995, x: 400, y: 300, w: 40, h: 40, score:0 }) .origin("center") // .color('#F00') .image("../images/ship.svg") .bind("KeyDown", function(e){ //on keydown, set the move booleans if(e.keyCode === Crafty.keys.RIGHT_ARROW) { this.move.right = true; } else if(e.keyCode === Crafty.keys.LEFT_ARROW) { this.move.left = true; } else if(e.keyCode === Crafty.keys.UP_ARROW) { this.move.up = true; } else if (e.keyCode === Crafty.keys.SPACE) { //create a bullet entity Crafty.e("2D, DOM, Color, bullet") .attr({ x: this._x+20, y: this._y+20, w: 2, h: 5, rotation: this._rotation, xspeed: 20 * Math.sin(this._rotation / 57.3), yspeed: 20 * Math.cos(this._rotation / 57.3) }) .color("rgb(0,0,0)") .bind("EnterFrame", function() { this.x += this.xspeed; this.y -= this.yspeed; //destroy if it goes out of bounds if(this._x > Crafty.viewport.width || this._x < 0 || this._y > Crafty.viewport.height || this._y < 0) { this.destroy(); } }); } }).bind("KeyUp", function(e) { //on key up, set the move booleans to false if(e.keyCode === Crafty.keys.RIGHT_ARROW) { this.move.right = false; } else if(e.keyCode === Crafty.keys.LEFT_ARROW) { this.move.left = false; } else if(e.keyCode === Crafty.keys.UP_ARROW) { this.move.up = false; } }).bind("EnterFrame", function() { if(this.move.right) this.rotation += 4; if(this.move.left) this.rotation -= 4; //acceleration and movement vector var vx = Math.sin(this._rotation * Math.PI / 180) * 0.3, vy = Math.cos(this._rotation * Math.PI / 180) * 0.3; //if the move up is true, increment the y/xspeeds if(this.move.up) { this.yspeed -= vy; this.xspeed += vx; } else { //if released, slow down the ship this.xspeed *= this.decay; this.yspeed *= this.decay; } //move the ship by the x and y speeds or movement vector this.x += this.xspeed; this.y += this.yspeed; //if ship goes out of bounds, put him back if(this._x > Crafty.viewport.width) { this.x = -64; } if(this._x < -64) { this.x = Crafty.viewport.width; } if(this._y > Crafty.viewport.height) { this.y = -64; } if(this._y < -64) { this.y = Crafty.viewport.height; } }).collision() .onHit("asteroid", function (e) { //if hit by a bullet increment the score player.score = 0; score.text("Score: " + player.score); e[0].obj.destroy(); //destroy the bullet }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_restart(){\n this._$staticMsg.empty();\n this.model.initialise();\n this._$field.empty();\n this._$dynamicMsg.empty();\n this._initiate();\n }", "function restart() {}", "restart(){\n this.initialize_values();\n }", "restart_values() {\...
[ "0.75971246", "0.7386349", "0.7234382", "0.7217567", "0.7045678", "0.6891442", "0.6812977", "0.67810297", "0.6756383", "0.66563", "0.6652915", "0.6649734", "0.66415906", "0.6641077", "0.66200936", "0.65847933", "0.65309143", "0.65182036", "0.65182036", "0.64919585", "0.646645...
0.0
-1
function returning average rating among reviews need to come back in and implement react star rating system.
function totalReviews (arg) { return arg.length.toString() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateAverage(reviews) {\n if (reviews.length === 0) {\n return 0;\n }\n var sum = 0;\n reviews.forEach(function (element) {\n sum += element.rating;\n });\n return sum / reviews.length;\n}", "getAverageRating() {\n let ratingsSum = this.ratings.reduce((currentS...
[ "0.81270605", "0.80054927", "0.79870886", "0.7980636", "0.79756016", "0.7753053", "0.7683087", "0.766429", "0.762089", "0.7591014", "0.7552631", "0.7451742", "0.7331419", "0.7328519", "0.71539766", "0.70737267", "0.7034349", "0.6941382", "0.6928159", "0.69055307", "0.689549",...
0.0
-1
function returning total numbers of reviews
function mapDispatchToProps(dispatch) { return { actions: bindActionCreators(actionCreators, dispatch) }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function totalReviews (arg) {\n return arg.length.toString()\n}", "getReviews() {\n $.post('http://trypadvisorreviewsservice-LB-2114261024.us-west-2.elb.amazonaws.com/api/review/' + this.state.attractionId, (reviews) => {\n this.setState({\n reviews: reviews,\n reviewTotals: {\n t...
[ "0.76229715", "0.73046196", "0.70888996", "0.68964916", "0.65798414", "0.65180874", "0.6498879", "0.6428816", "0.64196104", "0.6347143", "0.6330695", "0.62899745", "0.6286943", "0.62434405", "0.6237581", "0.6231758", "0.6161984", "0.61141276", "0.60991764", "0.6036025", "0.60...
0.0
-1
Default implementation for the compare function
compare(a, b) { if (a === b) return 0; return a < b ? -1 : 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "compare(obj1, obj2) {}", "function defaultCompare(a, b) {\n if (a < b) {\n return -1;\n }\n else if (a === b) {\n return 0;\n }\n else {\n return 1;\n }\n }", "function defaultCompare(a, b) {\n if (a < b) {\n return -1;\n ...
[ "0.75733304", "0.7517034", "0.74952614", "0.74952614", "0.7089954", "0.70450914", "0.6969574", "0.69628435", "0.68870527", "0.68720955", "0.6863108", "0.6862126", "0.68094325", "0.67531055", "0.675148", "0.6730445", "0.6718119", "0.6718119", "0.66373056", "0.65770364", "0.657...
0.6823066
12
Reverse the comparison function to use the opposite logic, e.g: this.compare(a, b) => 1 this.reverse(); this.compare(a, b) => 1
reverse() { var originalCompareFn = this.compare; this.compare = function(a, b) { return originalCompareFn(b, a); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reverseCompareFunction(compareFunction) {\n if (!collections.isFunction(compareFunction)) {\n return function (a, b) {\n if (a < b) {\n return 1;\n }\n else if (a === b) {\n return 0;\n }\n ...
[ "0.7593056", "0.75726694", "0.75684005", "0.73551536", "0.7227519", "0.7227519", "0.7227519", "0.6840924", "0.65110093", "0.64279795", "0.63025445", "0.62872016", "0.6206284", "0.6205795", "0.61460274", "0.61011916", "0.6028183", "0.5999073", "0.59523594", "0.59523594", "0.59...
0.8349178
0
Sift up the last element O(lg n)
_siftUp() { var i; var parent; for (i = this.n; i > 1 && (parent = i >> 1) && this._comparator.greaterThan( this._elements[parent], this._elements[i]); i = parent) { this._swap(parent, i); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function n(t,i){for(;i+1<t.length;i++)t[i]=t[i+1];t.pop()}", "function n(t,i){for(;i+1<t.length;i++)t[i]=t[i+1];t.pop()}", "function e(t,i){for(;i+1<t.length;i++)t[i]=t[i+1];t.pop()}", "function e(t,n){for(;n+1<t.length;n++)t[n]=t[n+1];t.pop()}", "function a(t,i){for(;i+1<t.length;i++)t[i]=t[i+1];t.pop()}"...
[ "0.7069743", "0.7069743", "0.6888288", "0.6861978", "0.6828366", "0.6740318", "0.67080396", "0.67080396", "0.67080396", "0.67080396", "0.66969466", "0.6680962", "0.66152674", "0.65203696", "0.65203696", "0.65203696", "0.65203696", "0.65203696", "0.65203696", "0.65203696", "0....
0.69521624
2
Sifts down the first element O(lg n)
_siftDown(i) { var c; for (i = i || 1; (c = i << 1) <= this.n; i = c) { // checks which is the smaller child to compare with if (c + 1 <= this.n && this._comparator.lessThan( this._elements[c + 1], this._elements[c])) // use the right child if it's lower than the left one c++; if (this._comparator.lessThan(this._elements[i], this._elements[c])) break; this._swap(i, c); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shift() {\n if (this.isEmpty()) {\n console.warn(`Cannot do operation shift on empty list`);\n return;\n }\n\n let temp = this.arr[0];\n\n shiftLeft(this, 0);\n\n --this.lastIndex;\n\n shrinkIfSparse(this);\n\n return temp;\n }", "siftDown...
[ "0.70420974", "0.6864312", "0.6795031", "0.67327684", "0.6731513", "0.6667732", "0.66513866", "0.66513866", "0.6579581", "0.65595955", "0.6557416", "0.6546361", "0.64422786", "0.63420266", "0.63140255", "0.6297342", "0.6276366", "0.6275171", "0.6275171", "0.6275171", "0.62751...
0.62806386
16
Function to filter default layers (basemap, selection, etc.)
function filterDefaultLayers(map) { return !map.match(/^((lines|points|polygons|relations)(_osm)?|selection|location_bbox)(@.+)?$/) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterDefaultLayerFilenames(map) {\n return !map.match(/^(.*\\/)?((lines|points|polygons|relations)(_osm)?|selection|location_bbox).gpkg$/)\n}", "unfilterNoChangeLayers(){\n //get the no change status object\n let no_change_status = this.props.statuses.filter(status => status.key === 'no_change')...
[ "0.6869308", "0.6683933", "0.6560024", "0.63658744", "0.62607825", "0.6244016", "0.62411654", "0.62411654", "0.62411654", "0.62411654", "0.62411654", "0.62411654", "0.62270874", "0.62270874", "0.6144118", "0.6134468", "0.6134468", "0.6134468", "0.6134468", "0.61335707", "0.61...
0.75409836
0
Function to filter filenames default layers (basemap, selection, etc.)
function filterDefaultLayerFilenames(map) { return !map.match(/^(.*\/)?((lines|points|polygons|relations)(_osm)?|selection|location_bbox).gpkg$/) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterDefaultLayers(map) {\n return !map.match(/^((lines|points|polygons|relations)(_osm)?|selection|location_bbox)(@.+)?$/)\n}", "function defaultFilter() {\n return !d3_selection__WEBPACK_IMPORTED_MODULE_0__.event.ctrlKey && !d3_selection__WEBPACK_IMPORTED_MODULE_0__.event.button;\n}", "function d...
[ "0.6948523", "0.5689918", "0.56896645", "0.56896645", "0.55952317", "0.55952317", "0.55952317", "0.55952317", "0.55952317", "0.55952317", "0.5582254", "0.5567596", "0.5567596", "0.5567596", "0.5567596", "0.5567596", "0.5567596", "0.5567596", "0.5567596", "0.5567596", "0.55675...
0.804699
0
constructor Checks for the matching DOM element wrapper and sets up instance variables and event listeners.
function patFind() { this.factorLimit = 10; this.patternLimit = 5; this.target = document.querySelector("#pat-find"); if (this.target != null) { this.textarea = this.target.querySelector("textarea"); this.button = this.target.querySelector("button"); this.resultarea = this.target.querySelector(".results"); this.button.addEventListener("click", this.analyse.bind(this), false); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "init() {\n this.initDOMListeners();\n }", "constructor () {\n\n\t\t// Set the wrapper class\n\t\tthis.base_class = 'main';\n\n\t\t// Store the main element\n\t\tthis.el = document.getElementById(this.base_class);\n\n\t}", "_init() {\n this.$inputs = this.$element.find('input, textarea, select');\n\n ...
[ "0.6671257", "0.6608812", "0.656054", "0.651057", "0.6484648", "0.63747257", "0.6332278", "0.6302201", "0.62365866", "0.6206866", "0.6198496", "0.6137965", "0.61352587", "0.60649633", "0.6037987", "0.6036177", "0.6032884", "0.6023751", "0.60167104", "0.59975255", "0.59959406"...
0.0
-1
converts a portion of an image into a hardware sprite data (3 bytes per row, 21 rows)
function convertFrameToC64Sprite(pixels, frame, xOffset, yOffset) { var pxBuffer = new Buffer(64); pxBuffer[63] = 0; //trailing padding byte var pxBufferIndex = 0; for (var y = yOffset; y < yOffset + SPRITE_HEIGHT; y++) { for (var x = xOffset; x < xOffset + SPRITE_WIDTH_BYTES; x++) { var output = 0; var shift = 7; for (var px = 0; px < 8; px++) { var r = pixels.get(frame, x * 8 + px, y, 0); var g = pixels.get(frame, x * 8 + px, y, 1); var b = pixels.get(frame, x * 8 + px, y, 2); var a = pixels.get(frame, x * 8 + px, y, 3); if (r != 255 || g != 255 || b != 255) { output |= (1 << shift); } shift--; } pxBuffer[pxBufferIndex++] = output; } } return pxBuffer; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseSprite(buffer) {\n\tlet view = new DataView(buffer);\n\n\t// Let's check the magic header and footer, then discard them.\n\tif (view.getUint8(0) !== 15 ||\n\t\tview.getUint8(1) !== 0 ||\n\t\tview.getUint8(2) !== 15 ||\n\t\tview.getUint8(3) !== 0 ||\n\t\tview.getUint8(132) !== 144 ||\n\t\tview.getUint...
[ "0.6887096", "0.6880525", "0.6537935", "0.6214453", "0.5953543", "0.5899445", "0.58509964", "0.58496916", "0.57931143", "0.57386535", "0.57360613", "0.57262367", "0.5711544", "0.57098365", "0.5702686", "0.5683623", "0.56465197", "0.56450915", "0.5633231", "0.55965173", "0.558...
0.5934583
5
Draws the painting screen
function drawPixels(size = 38) { for (i = 0; i < size * size; i++) { const div = document.createElement("div"); div.style.cssText = `width: ${100 / size}%; height: ${100 / size}%;`; div.setAttribute('draggable', 'false') div.classList.add('pixel'); if (border) { div.classList.toggle("border"); } div.addEventListener("click", (e) => { let color = chooseColor(); div.style.backgroundColor = color; div.style.borderColor = color; }, false); div.addEventListener("mouseover", (e) => { if (e.buttons === 1) { let color = chooseColor(); div.style.backgroundColor = color; div.style.borderColor = color; } }, false); screen.appendChild(div); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawScreen () {\n drawEvents();\n }", "paint() {\r\n graphics.fillStyle = \"#1aff1a\";\r\n graphics.fillRect(this.x - this.w / 2, this.y - this.h, this.w, this.h);\r\n }", "paint() {\r\n graphics.fillStyle = \"#ff1a1a\";\r\n graphics.beginPath();\r\n gra...
[ "0.8153065", "0.7849415", "0.7561795", "0.74579376", "0.74515665", "0.7277487", "0.7248314", "0.7228582", "0.7228098", "0.7217951", "0.72155637", "0.71461755", "0.71461755", "0.71023434", "0.7094276", "0.7078789", "0.7064802", "0.70465106", "0.7020434", "0.7013764", "0.701217...
0.0
-1
Deletes the screen pixels when redrawing
function deletePixels() { const pixels = screen.querySelectorAll("div"); for (i = 0; i < pixels.length; i++) { screen.removeChild(pixels[i]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function erase() {\n const pixels = screen.querySelectorAll(\"div\");\n\n for (i = 0; i < pixels.length; i++) {\n pixels[i].style.backgroundColor = \"white\";\n pixels[i].style.borderColor = \"\";\n }\n}", "function ClearPixels(){\n for(const p of prev_pixels){\n p.attr('type','tile');\n }\...
[ "0.74589175", "0.73803395", "0.7363969", "0.735777", "0.735091", "0.73417544", "0.7331872", "0.7218628", "0.72152513", "0.7200309", "0.71835876", "0.7171938", "0.71644455", "0.7155034", "0.71415293", "0.71301526", "0.7128757", "0.71092135", "0.7096949", "0.7077074", "0.707084...
0.749679
0
Turns all pixels white
function erase() { const pixels = screen.querySelectorAll("div"); for (i = 0; i < pixels.length; i++) { pixels[i].style.backgroundColor = "white"; pixels[i].style.borderColor = ""; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function whiteout()\n {\n $('.square').css({'opacity':'1','background-color':'#FFF'});\n }", "function turnWhiteBgAndBlackFo() {\n\t$('*').css('background-color','');\n\t$('body').each(function(element){\n\t\t$(this).css('color','black');\n\t});\n\t$('*').css('color','');\n}", "function clearBoard...
[ "0.69501954", "0.6884358", "0.6864254", "0.6793852", "0.6787616", "0.6747719", "0.66793007", "0.6345342", "0.6344244", "0.6254216", "0.6140053", "0.6135273", "0.6114093", "0.60971653", "0.60720944", "0.60672647", "0.6035826", "0.6032754", "0.600806", "0.60076094", "0.59890294...
0.69129443
1
React function to create list of categories.
function App() { return ( <CategoryList /> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CategoryList ({ categories }) {\n if (!categories.length) {\n return null\n }\n\n return (\n <nav className='breadcrumbs push-center'>\n <label>Categories:</label>\n <ul className='category-list'>\n <li>\n <NavLink exact to='/' activeClassName='active'>all</NavLink>\n ...
[ "0.7645085", "0.7210216", "0.7197186", "0.69984114", "0.69327575", "0.691744", "0.68552274", "0.6835358", "0.6774313", "0.67261183", "0.6718123", "0.66881007", "0.6662126", "0.66602045", "0.6629431", "0.6624013", "0.65759337", "0.6566112", "0.65492505", "0.65075064", "0.65073...
0.6282314
44
global hash of all ZCIs =============================================================== ConfigurationInterface ===============================================================
function zenbuClearGlobalPanelLayer() { var global_layer_div = document.getElementById("global_panel_layer"); if(!global_layer_div) { return; } global_layer_div.innerHTML =""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get_config_data() {\n return {}\n }", "function verConfiguracion(){console.log(copiaConfiguracionBase);}", "getConfig () {}", "function Hashers() {\n}", "function init_keys() {\n // funding_key = new bitcore.PrivateKey('75d79298ce12ea86863794f0080a14b424d9169f7e325fad52f60753eb072afc', network...
[ "0.5983482", "0.59609264", "0.5871457", "0.55672336", "0.5522722", "0.53998816", "0.53551286", "0.531115", "0.5296758", "0.5296538", "0.523291", "0.52314067", "0.5195415", "0.5175797", "0.5170734", "0.5165005", "0.51598394", "0.51458675", "0.51316273", "0.51291263", "0.511966...
0.0
-1
========================================= for demo purpose only can be deleted =======================================
function demo() { if ($.cookie("theme_csspath")) { $('link#theme-stylesheet').attr("href", $.cookie("theme_csspath")); } $("#colour").change(function () { if ($(this).val !== '') { var colour = $(this).val(); var introImage = $('body').find('#intro .item'); introImage.removeClass(); introImage.addClass('item'); introImage.addClass(colour); var theme_csspath = 'css/style.' + $(this).val() + '.css'; $('link#theme-stylesheet').attr("href", theme_csspath); $.cookie("theme_csspath", theme_csspath, {expires: 365, path: '/'}); } return false; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient private internal function m185() {}", "function _____SHARED_functions_____(){}", "transient protected internal functi...
[ "0.6571779", "0.655293", "0.606292", "0.6054969", "0.59988654", "0.58772975", "0.5855598", "0.584197", "0.5801961", "0.5706134", "0.5684521", "0.5684521", "0.5684521", "0.5684521", "0.5684521", "0.5684521", "0.5684521", "0.5684521", "0.5684521", "0.5684521", "0.5684521", "0...
0.0
-1
========================================= full screen intro =======================================
function fullScreenContainer() { var screenWidth = $(window).width() + "px"; var screenHeight = ''; if ($(window).height() > 500) { screenHeight = $(window).height() + "px"; } else { screenHeight = "500px"; } $("#intro, #intro .item").css({ width: screenWidth, height: screenHeight }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function introScreen() {\n SDPresents = new image(DEMO_ROOT + \"/def/resources/senior.png\");\n presentsScreen = SeniorDads.ScreenHandler.Codef(640,400,name,zIndex++);\n \t\tSDPresents.draw(presentsScreen,0,0);\n \t}", "function intro(){\n backgroundMove();\n crateShow();\n image(i...
[ "0.7486366", "0.70789903", "0.70521754", "0.70374876", "0.6865021", "0.6865021", "0.6865021", "0.6843283", "0.68019634", "0.6792678", "0.6720137", "0.6690196", "0.6647752", "0.6611645", "0.66070175", "0.66030425", "0.66010034", "0.65510464", "0.65475434", "0.65419656", "0.653...
0.61430097
50
Resets the gamespecific state before restart, and removes loggedout players completly.
reset_state_for_restart(state) { state.game.current_round = { round: 0, letter: "", time_left: -1, ended: false, answers: {}, votes: {}, interrupted_by: null, countdown_task: null }; state.game.scores = []; Object.values(state.players) .filter(player => !player.online) .map(player => player.uuid) .forEach(uuid => { Vue.delete(state.players, uuid); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetGameState() {\n\t\tgameOngoing = true;\n\t\tcurrentPlayer = player1;\n\t}", "function clearPlayerGame() {\n playerGame = [];\n}", "function restartGame() {\n pipesGroup.clear(true, true);\n pipesGroup.clear(true, true);\n gapsGroup.clear(true, true);\n scoreboardGroup.clear(true, true);\n p...
[ "0.7027848", "0.6940429", "0.6935949", "0.6842201", "0.6835925", "0.67935514", "0.67871505", "0.67369336", "0.6720828", "0.67122185", "0.670297", "0.6702242", "0.6691856", "0.6689285", "0.66625565", "0.6648642", "0.6638074", "0.66256124", "0.66206694", "0.6607596", "0.6597115...
0.7631864
0
If the map position is out of range, move it back
function checkBounds() { // return; // Perform the check and return if OK if (allowedBounds.contains(map.getCenter())) { return; } // It`s not OK, so find the nearest allowed point and move there var C = map.getCenter(); var X = C.lng(); var Y = C.lat(); // var AmaxX = allowedBounds.getNorthEast().lng(); var AmaxY = allowedBounds.getNorthEast().lat(); // var AminX = allowedBounds.getSouthWest().lng(); var AminY = allowedBounds.getSouthWest().lat(); // if (X < AminX) {X = AminX;} // if (X > AmaxX) {X = AmaxX;} if (Y < AminY) {Y = AminY;} if (Y > AmaxY) {Y = AmaxY;} //alert ("Restricting "+Y+" "+X); map.setCenter(new google.maps.LatLng(Y,X)); } // checkBounds
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "move() {\n //Move the kid to the determined location\n this.x = this.nextMoveX;\n this.y = this.nextMoveY;\n //Check in case the kid touches the edges of the map,\n // if so, prevent them from leaving.\n this.handleConstraints();\n }", "stop() {\n dataMap.get(this).moveX = 0;\n ...
[ "0.6972987", "0.6673525", "0.66293174", "0.65513635", "0.64951736", "0.6421977", "0.63534313", "0.63065666", "0.6239592", "0.6208219", "0.6174402", "0.615532", "0.6130381", "0.6106653", "0.6097408", "0.60479903", "0.6038987", "0.6033001", "0.6029983", "0.60250074", "0.5998562...
0.0
-1
Fetch messages since last run (or a full page if empty db)
function seedWithMessages (db, twilio) { db.list({ descending: true, limit: 1, include_docs: true, endkey: 'msg-' // '_' comes before 'm' in ASCII sort }, (err, body) => { if (err) return console.error(err) const fetchOpts = {} // By default, fetch a page of most recent messages if (body.rows.length) { // If db already contains message records, fetch records since latest one console.log('most recent message', body.rows[0]) const mostRecentDate = body.rows[0].doc.date fetchOpts['DateSent>'] = mostRecentDate } twilio.messages.get(fetchOpts, formatAndInsert) }) function formatAndInsert (err, response) { if (err) return console.error('Error fetching messages from twilio') const fetchedMessages = response.messages.map(formatData.fromTwilioRest) const fetchedProviderIds = fetchedMessages.map((msg) => msg.providerId) // Check if messages are already stored in local db db.view('messages', 'byProviderId', { keys: fetchedProviderIds }, (err, body) => { if (err) return console.error('Error querying view', err) const updateBatch = detectUpdates(fetchedMessages, body.rows) if (updateBatch.length) { db.bulk({ docs: updateBatch }, (err, body) => { if (err) return console.error('Error inserting messages into database', err) console.log(body) }) } }) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadMessages() {\r\n // Create the query to load the last 12 messages and listen for new ones.\r\n var query = firebase.firestore()\r\n .collection('messages')\r\n .orderBy('timestamp','asc')\r\n .limitToLast(200); //last 200 messgae of orderby \r\n \r...
[ "0.7227643", "0.7125252", "0.7070611", "0.68802375", "0.686429", "0.686429", "0.6796325", "0.67691225", "0.65471536", "0.6481559", "0.64714754", "0.6465923", "0.6434573", "0.64013207", "0.639168", "0.63167584", "0.6281195", "0.6262211", "0.6261669", "0.6251231", "0.61815053",...
0.0
-1