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
check if user is authenticated, if they are then set to true, otherwise false currentUser holds the user object when logged in
componentDidMount() { firebase.auth().onAuthStateChanged((user) => { user ? this.setState(() => ({ authenticated: true, currentUser: user, photoUrl: localStorage.getItem("photoUrl") })) : this.setState(() => ({ authenticated: false, currentUser: null, })); }); //this.getImage(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get isAuthenticated() {\n return Boolean(this.user);\n }", "function isAuthenticated() {\n if (_currentUser) {\n if (service.getToken()) {\n return true;\n } else {\n return false;\n }\n } else {\n return false;\n }\n }", "isAuthenticated() {\...
[ "0.7866672", "0.7749761", "0.7639786", "0.7633894", "0.76000744", "0.75801116", "0.7536626", "0.7500361", "0.747729", "0.73847836", "0.7370529", "0.7367441", "0.73660344", "0.73567843", "0.73361003", "0.73361003", "0.72702104", "0.72647005", "0.7237949", "0.7222851", "0.72128...
0.0
-1
Write password to the password input
function writePassword() { let password = generatePassword(); //Need to write function generatePassword(), writePassword() should work already var passwordText = document.querySelector("#password"); passwordText.value = password; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writePassword() {}", "function writePassword() {\n var password = getPasswordOptions();\n var passwordText = document.querySelector('#password');\n \n passwordText.value = password;\n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.qu...
[ "0.88605946", "0.85434437", "0.8511256", "0.8500835", "0.84896296", "0.84846", "0.84719414", "0.84686357", "0.8454292", "0.8443738", "0.8431387", "0.8419759", "0.8418786", "0.8406216", "0.8403772", "0.8400314", "0.8392802", "0.83758265", "0.8370068", "0.83642554", "0.836013",...
0.0
-1
import ChooseHostel from "./components/ChooseHostel"; import Floor from "./components/Floor"; import Gender from "./components/gender";
function App() { return ( <> <SignInScreen /> </> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function App() {\n return (\n <div>\n {/* <Routes/> */}\n <InputColleges/>\n <ShowColleges/><br/>\n <CollegeDetails/>\n \n </div>\n );\n}", "function App() {\n return (\n <div className=\"App\">\n {/* <BaiTapThucHanhChiaLayout/> */}\n {/* <DataBuilding></DataBuilding> */}\n...
[ "0.58569145", "0.5665532", "0.5645453", "0.5569324", "0.55630755", "0.5529976", "0.54877365", "0.5443319", "0.5432199", "0.54247475", "0.5406592", "0.5392691", "0.537888", "0.5371154", "0.5356188", "0.5353063", "0.5345239", "0.53202206", "0.53168344", "0.5303626", "0.5265873"...
0.0
-1
Pig Latin Translate the provided string to pig latin. Pig Latin takes the first consonant (or consonant cluster) of an English word, moves it to the end of the word and suffixes an "ay". If a word begins with a vowel you just add "way" to the end.
function translatePigLatin(str) { var vowels = ['a', 'e', 'i', 'o', 'u', 'y']; var newString; if (vowels.indexOf(str[0]) === -1) { if (vowels.indexOf(str[1]) !== -1) { newString = str.substring(1) + str[0] + "ay"; } else { newString = str.substring(2) + str.substring(0, 2) + "ay"; } } else { newString = str + "way"; } return newString; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function translatePigLatin(str) {\n if (str.match(/^[aeiou]/)) return str + \"way\";\n\n const consonantCluster = str.match(/^[^aeiou]+/)[0];\n return str.substring(consonantCluster.length) + consonantCluster + \"ay\";\n}", "function translatePigLatin (str) {\n if (str[0].match(/[aeiou]/)) {\n return str ...
[ "0.87265253", "0.86137694", "0.86125904", "0.8587584", "0.85815096", "0.85756785", "0.857152", "0.8571477", "0.8566992", "0.85605", "0.8553573", "0.854837", "0.85399777", "0.8489173", "0.8485551", "0.8484349", "0.84458375", "0.843767", "0.84170115", "0.83805746", "0.83746195"...
0.8638507
1
Search and Replace Perform a search and replace on the sentence using the arguments provided and return the new sentence. First argument is the sentence to perform the search and replace on. Second argument is the word that you will be replacing (before). Third argument is what you will be replacing the second argument with (after). NOTE: Preserve the case of the original word when you are replacing it. For example if you mean to replace the word "Book" with the word "dog", it should be replaced as "Dog"
function myReplace(str, before, after) { if (before.charCodeAt(0) >= 65 && before.charCodeAt(0) <= 90) { after = after.charAt(0).toUpperCase() + after.substring(1); } var strArray = str.split(" "); for (var i = 0; i < strArray.length; i++) { if (strArray[i] === before) { strArray[i] = after; } } str = strArray.join(' '); return str; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function danish(sentence) {\n \nreturn sentence.replace(/\\bapple|blueberry|cherry\\b/, 'danish');\n\n}", "function replaceString(content, search, replace) {\n\t\t\tvar index = 0;\n\n\t\t\tdo {\n\t\t\t\tindex = content.indexOf(search, index);\n\n\t\t\t\tif (index !== -1) {\n\t\t\t\t\tcontent = content.substring...
[ "0.68940485", "0.6665778", "0.6665778", "0.6665778", "0.6633484", "0.6595485", "0.65444446", "0.64789724", "0.64465934", "0.64349926", "0.6425423", "0.6424314", "0.6407887", "0.63701177", "0.6355542", "0.6355176", "0.63301355", "0.63194793", "0.63162726", "0.6263049", "0.6241...
0.6075463
32
Convert to Roman Convert the given number into a roman numeral. All roman numerals answers should be provided in uppercase.
function convertToRoman(num) { var arr = (""+num).split(""); var length = arr.length; var one = "I"; var four = "IV"; var five = "V"; var nine = "IX"; var ten = "X"; var fourty = "XL"; var fifty = "L"; var nintey = "XC"; var oneHundred = "C"; var fourHundred = "CD"; var fiveHundred = "D"; var nineHundred = "CM"; var oneThousand = "M"; var thousands = ""; var hundreds = ""; var tens = ""; var ones = ""; function getOnes(dig) { if (dig === 0) { ones += ones; } if (dig > 0 && dig < 4) { for (var i = 1; i <= dig; i++) { ones += one; } } if (dig == 4) { ones += four; } if (dig == 5) { ones += five; } if (dig > 5 && dig < 9) { ones += five; for (var i = 1; i <= dig -5; i++) { ones += one; } } if (dig == 9) { ones += nine; } return ones; } function getTens(dig) { if (dig === 0) { tens += tens; } if (dig > 0 && dig < 4) { for (var i = 1; i <= dig; i++) { tens += ten; } } if (dig == 4) { tens += fourty; } if (dig == 5) { tens += fifty; } if (dig > 5 && dig < 9) { tens += fifty; for (var i = 1; i <= dig - 5; i++) { tens += ten; } } if (dig == 9) { tens += nintey; } } function getHundreds(dig) { if (dig === 0) { hundreds += hundreds; } if (dig > 0 && dig < 4) { for (var i = 1; i <= dig; i++) { hundreds += oneHundred; } } if (dig == 4) { hundreds += fourHundred; } if (dig == 5) { hundreds += fiveHundred; } if (dig > 5 && dig < 9) { hundreds += fiveHundred; for (var i = 1; i <= dig -5; i++) { hundreds += oneHundred; } } if (dig == 9) { hundreds += nineHundred; } return hundreds; } function getThousands(dig) { if (dig === 0) { thousands += thousands; } if (dig > 0 && dig < 4) { for (var i = 1; i <= dig; i++) { thousands += oneThousand; } } return thousands; } //chech length of number and run required functions if (length === 1) { getOnes(arr[0]); return ones; } if (length === 2) { getTens(arr[0]); getOnes(arr[1]); return tens + ones; } if (length === 3) { getHundreds(arr[0]); getTens(arr[1]); getOnes(arr[2]); return hundreds + tens + ones; } if (length === 4) { getThousands(arr[0]); getHundreds(arr[1]); getTens(arr[2]); getOnes(arr[3]); return thousands + hundreds + tens + ones; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function numToRoman(num) {\n}", "function convertToRoman(num) {\n \n}", "function convertToRoman(num) {\n var lookup = {M:1000,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1},\n roman = '',\n i;\n for ( i in lookup ) {\n while ( num >= lookup[i] ) {\n roman += i;\n ...
[ "0.840456", "0.82914466", "0.8230967", "0.8105388", "0.80534923", "0.80132776", "0.80105865", "0.7995792", "0.7828442", "0.7803572", "0.77667075", "0.77463895", "0.7697212", "0.7637079", "0.7626396", "0.76065356", "0.75857604", "0.75767374", "0.7568306", "0.7546647", "0.75175...
0.6470576
54
Sum All Numbers in a Range We'll pass you an array of two numbers. Return the sum of those two numbers and all numbers between them. The lowest number will not always come first.
function sumAll(arr) { var total = 0; if (arguments[0][0] < arguments[0][1]) { for (var i = arguments[0][0]; i <= arguments[0][1]; i++) { total += i; } } else { for (var x = arguments[0][1]; x <= arguments[0][0]; x++) { total += x; } } return total; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sumRange(arr){\n let sum = 0;\n for(let i = Math.min(...arr); i <= Math.max(...arr); i++){\n sum += i;\n }\n return sum;\n}", "function sumRange(arr) {\n let count = Math.abs(arr[0] - arr[1]) + 1; //it gets the count between numbers\n let sum = ((arr[0] + arr[1]) * count) / 2; //sum of the numb...
[ "0.7916033", "0.79049814", "0.7894808", "0.7872145", "0.78595835", "0.7795393", "0.77930355", "0.7782139", "0.7774781", "0.77567065", "0.76688635", "0.7659568", "0.762021", "0.7613617", "0.7606865", "0.75338453", "0.75337404", "0.7498265", "0.74603516", "0.74252784", "0.73813...
0.74118215
20
Diff Two Arrays Compare two arrays and return a new array with any items only found in one of the two given arrays, but not both. In other words, return the symmetric difference of the two arrays.
function diffArray(arr1, arr2) { var newArr1 = []; var newArr2 = []; function contains1(value) { if (arr1.indexOf(value) === -1) { return value; } } function contains2(value) { if (arr2.indexOf(value) === -1) { return value; } } newArr1 = arr2.filter(contains1); newArr2 = newArr1.concat(arr1.filter(contains2)); return newArr2; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function diffArray(arr1, arr2) {\n var newArr = [];\n // Same, same; but different.\n let symmetricDiff = arr1\n .filter(x => !arr2.includes(x))\n .concat(arr2.filter(x => !arr1.includes(x)));\n return symmetricDiff;\n}", "function arrayDiff(a, b) {\n\treturn a.filter(ar => !b.includes(ar));\n}", "fu...
[ "0.82646435", "0.80908996", "0.8090203", "0.7819471", "0.78156483", "0.7781504", "0.77788913", "0.7776408", "0.77708393", "0.7767508", "0.77314544", "0.7664472", "0.7654387", "0.76509273", "0.76229256", "0.76229256", "0.76229256", "0.76229256", "0.76229256", "0.76229256", "0....
0.70961183
74
This function corrects bitfinex internal representation of cryptos to the general representations
async getCommonSpotSymbolMap() { let map = new Map() let symbols = await this.getSpotTradingPairs() let currencyList = await this.getCurrencyList() let translationMap = await this.getTranslationMap() for(var symbol of symbols) { let currencyPair = this.parseCurrency(symbol.substring(1), currencyList) let translatedPair = this.translatePair(currencyPair, translationMap) let commonSymbol = translatedPair[0] + translatedPair[1] //console.log(`commonSymbol=${commonSymbol}`) map.set(commonSymbol.toLowerCase(), symbol) } return map }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function xorrelate()\n{\n // turn nchc to hexstring\n // pending to bytes20\n // var t = stringToHex(\"nchcnchcnchcnchcnchc\");\t\t\t//config string\n // console.log(t);\n var sha3t = keccak256(\"nchc\");\n //console.log(sha3t);\n var sha3t20 = sha3t.slice(0,40);\n sha3t20 = \"0x\"+sha3t20;\n...
[ "0.5390106", "0.52737683", "0.51450026", "0.51438564", "0.49521974", "0.48273018", "0.4825239", "0.48172987", "0.4809681", "0.47917023", "0.4786293", "0.4786293", "0.4786293", "0.4786293", "0.4740075", "0.47378606", "0.472963", "0.4714125", "0.47139686", "0.47076985", "0.4698...
0.0
-1
shuffle() : Acak daftar array dengan metode FisherYates Source :
function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; // And swap it with the current element. temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shuffle() {\n // TODO\n }", "function shuffle(array){\n\t\t\t\t\t\t\t\t \tvar currentIndex = array.length;\n\t\t\t\t\t\t\t\t \tvar temporaryValue;\n\t\t\t\t\t\t\t\t \t//var randIndex;\n\n\t\t\t\t\t\t\t\t \twhile (currentIndex > 0){\n\t\t\t\t\t\t\t\t \t\trandomIndex = Math.floor(Math.random() * currentI...
[ "0.73670566", "0.7277479", "0.7240962", "0.7239155", "0.71994233", "0.7194846", "0.7188913", "0.71853405", "0.7163731", "0.7163046", "0.7124531", "0.7102964", "0.7095047", "0.7085396", "0.7078325", "0.70690596", "0.70634246", "0.70625156", "0.7060207", "0.7057964", "0.7043315...
0.0
-1
You can explicitly set 'this' with the call(), apply(), and bind() functions
function name() { console.info(this.username); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setThisWithCall(fn, thisValue, arg) {\n return fn.call(thisValue, arg);\n}", "function setThisWithCall(fn, thisValue, arg){\n\treturn fn.call(thisValue, arg);\n}", "function setThisWithApply(fn, thisValue, args) {\n return fn.apply(thisValue, args);\n}", "function setThisWithApply(fn, thisValue, a...
[ "0.7475477", "0.7435012", "0.7398397", "0.7382254", "0.730726", "0.7182757", "0.7179201", "0.67064506", "0.6510581", "0.64372385", "0.6408172", "0.6356716", "0.6320414", "0.6292078", "0.6196953", "0.6196953", "0.61621153", "0.61481065", "0.6099857", "0.60820377", "0.60817975"...
0.0
-1
END TAB ANIMATION timeline
function isScrolledIntoView(el){ var $el = $(el); return ($el.offset().top + $el.outerHeight(true) <= $(window).scrollTop() + $(window).height()) && ($el.offset().top + $el.outerHeight(true) > $(window).scrollTop()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setEndAnimation() {\r\n\t\t\tinAnimation = false;\r\n\t\t}", "function triggletab() {\n $(\".tab\").each(function() {\n $(this).removeClass(\"active\");\n });\n }", "function frameAnimationEnd() {\n f.animatedFrames = f.animatedFrames || 0;\n f.animatedFrames++;\n ...
[ "0.64256126", "0.6400441", "0.639011", "0.6259168", "0.6195459", "0.6148714", "0.61461973", "0.61428714", "0.6123078", "0.6123078", "0.6117383", "0.60579866", "0.60498875", "0.60466653", "0.60208887", "0.5996946", "0.5996879", "0.59741086", "0.59031904", "0.58970606", "0.5894...
0.0
-1
helper method similar to str[index] = newChar
function setCharAt(str, index, chr) { if (index > str.length - 1) return str; return str.substr(0, index) + chr + str.substr(index + 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setCharAt(str, index, chr) {\n if (index > str.length - 1) return str;\n return str.substr(0, index) + chr + str.substr(index + 1);\n }", "function setCharAt(str, index, chr) {\n if (index > str.length - 1) return str;\n return str.substr(0, index) + chr + str.substr(index + 1);\n...
[ "0.8422062", "0.8408113", "0.831897", "0.8187089", "0.77036905", "0.76474696", "0.708892", "0.69437265", "0.6693903", "0.66668", "0.66284406", "0.6562673", "0.65457666", "0.6531664", "0.64304143", "0.63100433", "0.6295019", "0.62803996", "0.62629527", "0.6261391", "0.6232661"...
0.8405141
2
set up game in event that user enters own word
function setUp2PlayerGame() { secretWord = document.querySelector('.secretWord').value; if (!isNonEmptyStr(secretWord)) { errorMessage.style.display = 'initial'; return; } setupGame(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startGame() {\n\tguesses = 10;\n\tcurrentWord = new Word();\n\tcurrentWord.logWord();\n takeInput();\n}", "function newGame() {\n gameStart = true\n clearOut();\n ransomdomize();\n createSpan();\n \n //console.log(chosenWord); //CHEAT -- GET THE ANSWERS IN CONCOLE\n \n}", "function startGame(p...
[ "0.76868105", "0.75608706", "0.7073458", "0.7064194", "0.70559114", "0.70139223", "0.6947545", "0.69468844", "0.69349325", "0.6897024", "0.67891026", "0.6782195", "0.67818886", "0.6777913", "0.67706484", "0.6760566", "0.6757051", "0.67238337", "0.6702996", "0.6674832", "0.667...
0.6583433
36
set up game in event that random word option is chosen
function setUpRandomGame() { let index = Math.floor(Math.random() * wordDictionary.length); secretWord = wordDictionary[index]; setupGame(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startGame() {\n select = Math.floor(Math.random() * wordList.length);\n chosenWord = wordList[select];\n gameWord = new Word(chosenWord);\n gameWord.createWord();\n if (select > -1) {\n wordList.splice(select, 1);\n }\n console.log(\n \"You get 8 letter guesses to correctly find the type of f...
[ "0.7709847", "0.75873333", "0.7454933", "0.7442812", "0.73714185", "0.7286513", "0.72687286", "0.7227565", "0.72204244", "0.72175497", "0.72062206", "0.7153387", "0.71022534", "0.70751", "0.70326334", "0.69966304", "0.6983543", "0.6976088", "0.6935069", "0.6875326", "0.683762...
0.75366974
2
general game setup, toggle between into page and game page
function setupGame() { intro.style.display = 'none'; for (i = 0; i < secretWord.length; i++) { wordToDisplay += "_ "; } guessesLeftMessage.textContent = "You have " + incorrectGuessesLeft + " incorrect guesses remaining."; displayWord.textContent = wordToDisplay; lettersGuessed.textContent = "Letters guessed: "; displayMessage.style.display = 'none'; gameStart.style.display = 'initial'; // start with 1 and skip 2 each time, every other node is a text and we only want images for (let i = 1; i <= 11; i += 2) { guessPics.childNodes[i].style.display = 'none'; } guessPics.childNodes[displayImage].style.display = 'initial'; resetButton.style.display = 'none'; document.querySelector('.letterGuess').focus(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupGame() { console.log(\"in setupGame\");\n\n\t//console.log(\"here setupGame\");\n\n\t$(\"#startPage\").show();\n\t$(\"#content\").hide();\n\t$(\"#questionPage\").hide();\n\t$(\"#answerPage\").hide();\n\t$(\"#scorePage\").hide();\n\n}", "function setup(){\r\n document.getElementById('homeButton').s...
[ "0.7528564", "0.6933498", "0.6895553", "0.6882203", "0.68217707", "0.6768641", "0.67302865", "0.67073065", "0.66712075", "0.6636145", "0.66176397", "0.6567918", "0.6561552", "0.65591073", "0.65571404", "0.6555105", "0.65550447", "0.6547398", "0.65432954", "0.651942", "0.65163...
0.0
-1
check if string is non empty and only contains alphas
function isNonEmptyStr(str) { return str.length >= 1 && str.match(/[a-z]/i); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isAlpha(c){\r\n return /^\\w$/.test(c) && /^\\D$/.test(c);\r\n}", "function containsOnlyLetters(input)\n{\n\treturn /^[a-zA-Z]/.test(input.replace(/\\s/g, ''));\n}", "function noSpaceAlphaValidate( str ) {\n var alphaRegex = /[a-zA-Z ]/;\n return alphaRegex.test(str);\t\t\t\n}", "fu...
[ "0.7447239", "0.74312127", "0.7402012", "0.7311966", "0.73104537", "0.72952354", "0.71631086", "0.71600264", "0.71600264", "0.7132438", "0.7120493", "0.7120493", "0.70925945", "0.70817006", "0.7080297", "0.70599633", "0.7055728", "0.70284826", "0.7012133", "0.7000293", "0.699...
0.7304325
5
function to evaluate letter guess
function guessLetter() { // make sure letter is a-z if (!isNonEmptyStr(letterGuess.value)) { displayMessage.textContent = "Please guess a letter from a-z!"; displayMessage.style.display = 'initial'; letterGuess.focus(); return; } // if letter is has already been guessed before if (guessCharSet.has(letterGuess.value)) { displayMessage.textContent = "You have already guessed that letter!"; displayMessage.style.display = 'initial'; letterGuess.focus(); return; } // add letter guessed to set guessCharSet.add(letterGuess.value); displayMessage.style.display = 'none'; // loop through secretWord to fill in corresponding matching letters let letterFound = false; for (let i = 0; i < secretWord.length; i++) { if (letterGuess.value === secretWord[i]) { letterFound = true; lettersRevealed++; wordToDisplay = setCharAt(wordToDisplay, i * 2, letterGuess.value); displayWord.textContent = wordToDisplay; } } // if letter is not in the word if (letterFound === false) { incorrectGuessesLeft--; guessPics.childNodes[displayImage].style.display = 'none'; displayImage += 2; guessPics.childNodes[displayImage].style.display = 'initial'; } lettersGuessed.textContent += letterGuess.value + ' '; guessesLeftMessage.textContent = "You have " + incorrectGuessesLeft + " incorrect guesses remaining."; // after every letter guess, check if the user has won or lost if (checkWinOrLoss() === false) { letterGuess.focus(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function evaluateGuess(letter) {\r\n var positions = [];\r\n\r\n for (var i = 0; i < transformersCharacters[computerPick].length; i++) {\r\n if(transformersCharacters[computerPick][i] === letter) {\r\n positions.push(i);\r\n }\r\n }\r\n\r\n if (positions.length <= 0) {\r\n ...
[ "0.80163306", "0.7987428", "0.7894636", "0.7825098", "0.780565", "0.77101606", "0.770862", "0.7693854", "0.7637722", "0.7618237", "0.7610004", "0.75440305", "0.7542313", "0.75186855", "0.7445415", "0.739682", "0.73919964", "0.73745745", "0.7349523", "0.73331195", "0.7316316",...
0.72138673
31
This test is manual, change the code below to test different cases. Run with node
function test_even_expense_debts() { let expense = new EvenExpense_1.EvenExpense(5, "cat", "test"); let person1 = new Person_1.Person(1, "Person 1", ""); let person2 = new Person_1.Person(2, "Person 2", ""); let person3 = new Person_1.Person(3, "Person 3", ""); let payment1 = new Payment_1.Payment(-1, person1, 2); let payment2 = new Payment_1.Payment(-1, person2, 4); let payment3 = new Payment_1.Payment(-1, person3, 9); expense.addPayment(payment1); expense.addPayment(payment2); expense.addPayment(payment3); // let payments = Array.from(expense.payments.values()); // payments.forEach(p => console.log(p.creditor.firstName + " payed " + p.amount.toFixed(2))); console.log("Debts"); let debts = Array.from(expense.debts.values()); debts.forEach(d => console.log(d.debtor.firstName + " owes " + d.creditor.firstName + " " + d.amount.toFixed(2))); console.log(expense.expenseAmount) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function test_candu_graphs_datastore_vsphere6() {}", "function runTests1() {\n var payload_1 = \"AAAHMRBqLy8BAULMR65CrzMz\";\n var result_1 = transform(\"2019-03-29T06:02:04.539Z\", 65959, 15, payload_1);\n assert (result_1.length === 2, \n 'Expected command 1 array length = 2');\n assert (result_1[STEM_D...
[ "0.6242547", "0.60300624", "0.6019772", "0.59081507", "0.5897137", "0.58903205", "0.5839183", "0.58187634", "0.5790852", "0.5768567", "0.5763486", "0.57326806", "0.5702965", "0.56981266", "0.56968343", "0.5635282", "0.5634316", "0.56297296", "0.56023264", "0.55975425", "0.557...
0.0
-1
Init all easing functions
initEasingFunctions() { this.EASE_IN_EXPO = (l, r, x) => (l + (r - l) * Math.pow(2, (x - 1) * 7)); // 0.14285714285714285 == (1 / log(2, 128)) this.EASE_OUT_EXPO = (l, r, x) => (l + (r - l) * Math.log(x * 127 + 1) / Math.LN2 * 0.14285714285714285); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructLerpFunctions ()\n {\n\n // Quadratic\n\n // lerpStyleEaseOutQuadratic\n this.lerpFunctions['lerpStyle' + Transition[Transition.EaseOut] + Style[Style.Quadratic]] =\n (initial, lerpDistance, duration, currentTime) =>\n {\n return this.lerpStyleE...
[ "0.6453063", "0.6268855", "0.6184419", "0.61578745", "0.6140396", "0.6131133", "0.60724837", "0.60382426", "0.5910181", "0.5877697", "0.58274066", "0.58142555", "0.57591444", "0.5753274", "0.57452977", "0.5741803", "0.57268566", "0.57193154", "0.5716238", "0.5686517", "0.5627...
0.8061174
0
How many more items can be put into this itemstack
get capacity(){ return this.maxStackSize - this.stackSize; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_getItemCount() {\n return this.options.length + this.optionGroups.length;\n }", "size() {\n return this.items.length();\n }", "size() {\n\t\treturn this.items.length();\n\t}", "count() {\n let sum = this.items.length;\n return sum;\n }", "get itemCount() {\n return ...
[ "0.70207083", "0.6717445", "0.6664919", "0.6614674", "0.6602512", "0.6595949", "0.65894425", "0.65685594", "0.65483546", "0.65463567", "0.64896464", "0.64622223", "0.64041513", "0.63932735", "0.63812083", "0.63549006", "0.6324822", "0.6324822", "0.6324822", "0.6324822", "0.63...
0.5722846
83
The relative require() itself.
function localRequire(path) { var resolved = localRequire.resolve(path); return require(resolved, parent, path); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function require() { return {}; }", "function innerRequire(_path) {\n\treturn require(path.join(process.cwd(), _path));\n}", "function fn(path){\n var orig = path;\n path = fn.resolve(path);\n return require(path, parent, orig);\n }", "function localRequire(path) {\n var resolved = require.resol...
[ "0.7195119", "0.7027229", "0.67329705", "0.6596608", "0.6578267", "0.639194", "0.6365622", "0.6191603", "0.61434335", "0.6125508", "0.612298", "0.60718775", "0.60600346", "0.60242426", "0.5872591", "0.5857044", "0.5844444", "0.5835678", "0.5775341", "0.57568234", "0.57419336"...
0.6648988
29
Initialize a new `Emitter`.
function Emitter(obj) { if (obj) return mixin(obj); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Emitter() {\n this.events = {};\n}", "constructor() {\n this.eventEmitter = new Emitter();\n }", "function Emitter() {\n\t\tthis.listeners = {};\n\t\tthis.singleListener = {};\n\t}", "function Emitter() {\r\n this.events = {};\r\n}", "function Emitter() {\r\n\t\tthis.callbacks = {};\r\n\...
[ "0.7572237", "0.7560711", "0.75456107", "0.7515383", "0.745719", "0.7446852", "0.7429735", "0.7429735", "0.7429735", "0.7429735", "0.7406173", "0.73883736", "0.7188515", "0.71046644", "0.70976514", "0.70931417", "0.7062535", "0.7042429", "0.6999456", "0.6967028", "0.68399566"...
0.0
-1
Jump to a new section and clear the history list.
function ShowBlockReset(statusThing, objectName) { // Clear the history list. statusThing.ClearHistory(); // Display the new block. ShowBlock(statusThing, objectName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jumpToHistory(){\n $(\"#end\").hide();\n $(\"#header\").hide();\n $(\"#history\").show();\n }", "function JumpToTerm(sectionId, hash, searchTerms) {\n\t// KC: as of 7/8/2008, they just want to go to top of specified page\n\tLoadSection(sectionId);\n}", "function clear() {\n ...
[ "0.64990413", "0.59043765", "0.58917683", "0.5837123", "0.5762752", "0.5762752", "0.5762752", "0.5762752", "0.5762752", "0.5762752", "0.5762752", "0.5762752", "0.5762752", "0.5762752", "0.5762752", "0.5762752", "0.5762752", "0.5762752", "0.5762752", "0.5762752", "0.5762752", ...
0.0
-1
Display a specific section in an ERDB documentation page.
function ShowBlock(statusThing, objectName) { // Remember that we're displaying the specified page. statusThing.blockNow = objectName; // Display the page. statusThing.Display(objectName); // Update the select box. var selectBox = document.getElementById(statusThing.selectBox); selectBox.value = objectName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showSection(section){\n\t$.secId.setText(section.get(\"SECTION\"));\n\t$.secType.setText(section.get(\"TYPE\"));\n}", "function goToDocSec(aDocName, aDocSection) {\n\n updateDocContents(aDocs.find(aDoc => aDoc.name === aDocName));\n // TODO > scroll to section\n}", "function Section_Description(...
[ "0.66151744", "0.61328316", "0.58530796", "0.5850244", "0.57007116", "0.56948715", "0.56387067", "0.56066006", "0.5571019", "0.5554343", "0.5553797", "0.5548794", "0.5502301", "0.54891294", "0.54550904", "0.5454415", "0.5430747", "0.5416022", "0.540825", "0.53886276", "0.5369...
0.0
-1
Display the previous section in an ERDB documentation page.
function ShowPrevious(statusThing) { var objectName = statusThing.Pop(); if (objectName != "") ShowBlock(statusThing, objectName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "previousPage() {\n if (!this.msg) throw new Error(\"Tried to go to previous page but embed pages havn't been created yet.\");\n this.currentPageNumber--;\n if (this.currentPageNumber < 0) this.currentPageNumber = this.pages.length - 1;\n const embed = this.pages[this.currentPageNumber];...
[ "0.74526954", "0.7256744", "0.7219556", "0.7212749", "0.7208566", "0.7132211", "0.7110613", "0.7045407", "0.7030852", "0.702133", "0.700717", "0.69503945", "0.69459087", "0.6886775", "0.6879685", "0.68744975", "0.6857133", "0.68368506", "0.6779016", "0.6763764", "0.67500705",...
0.0
-1
DOCUMENTATION STATUS OBJECT Create an ERDB documentation page status object.
function ErdbStatusThing(selectBoxID, blockList) { // Save the list of block IDs. this.blockList = blockList.split(" "); // Save the select box ID. this.selectBox = selectBoxID; // Start with an empty history list. this.blockHistory = new Array(); // Denote there's no current page. this.blockNow = ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function DocumentPretranslatingStatus() {\n _classCallCheck(this, DocumentPretranslatingStatus);\n\n DocumentPretranslatingStatus.initialize(this);\n }", "function getStatus() {\n return status;\n }", "function DocumentWithoutSegmentsStatus() {\n _classCallCheck(this, DocumentWithoutSegment...
[ "0.602054", "0.5580153", "0.5555047", "0.55317014", "0.54659647", "0.5401281", "0.5367163", "0.5358419", "0.5309556", "0.52926946", "0.52692956", "0.52692956", "0.52692956", "0.52692956", "0.52692956", "0.52692956", "0.52692956", "0.52692956", "0.52692956", "0.52661324", "0.5...
0.0
-1
OTHER METHODS Use the specified form to put the specified page in the form's target window. The name and value passed in will be stored in the hidden input field with an ID equal to the formID followed by "_hidden".
function ErdbMiniFormJump(formID, pageURL, parmName, parmValue, tabID, tabIndex) { // Select the documentation tab. tab_view_select(tabID, tabIndex); // Get the form and fill in the target URL. var myForm = document.getElementById(formID); myForm.action = pageURL; // Update the variable parm. var myHidden = document.getElementById(formID + "_hidden"); myHidden.name = parmName; myHidden.value = parmValue; // Submit the form. myForm.submit(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function post_value(value, id, field) {\r\n opener.document.getElementById(field).innerHTML = value;\r\n opener.document.getElementById(field + \"_hidden\").value = id;\r\n self.close();\r\n}", "function StoreParm(myName, myValue, formID) {\n // Find the form.\n var myForm = document.getElementByI...
[ "0.6689254", "0.622667", "0.6069064", "0.60474575", "0.600378", "0.5999498", "0.59949297", "0.5990113", "0.5955643", "0.59347326", "0.5863827", "0.5858834", "0.5854777", "0.58107567", "0.58013034", "0.57662094", "0.5727", "0.56990504", "0.56251436", "0.5610929", "0.56072384",...
0.59245
10
Use the specified field to do a SEED viewer search in a new window.
function SeedViewerJump(fieldID) { // Get the field value. var myValue = document.getElementById(fieldID).value; // Compute a URL from it. var myURL = "seedviewer.cgi?page=SearchResult;action=check_search;pattern=" + escape(myValue); // Open it in a new window. window.open(myURL, "sandboxWindow"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newSearch(){\n window.open(engines[currEngine].url+document.getElementById('field').value,\"_self\");\n}", "function elFinderBrowser (field_name, url, type, win) {\n tinymce.activeEditor.windowManager.open({\n file: '/elfinder/tinymce',// use an absolute path!\n title: 'elFinder 2.0'...
[ "0.68441963", "0.6463543", "0.5998885", "0.5846973", "0.5830578", "0.5717801", "0.5717801", "0.5717801", "0.5644476", "0.5638895", "0.5608091", "0.5567042", "0.55379945", "0.55242723", "0.55219734", "0.5481006", "0.5475833", "0.5475833", "0.5438335", "0.5418618", "0.5418618",...
0.7478002
0
This method creates the code for a subroutine based on the data typed into the Method Generator form.
function GenerateModule(formID) { // Get the method form and the relevant fields. var myForm = document.getElementById(formID); var mySignature = myForm.elements["Signature"].value; var myDescription = myForm.elements["Description"].value; var resultField = myForm.elements["Result"]; // The resulting method code will be stored in the value field. resultField.value = ""; // Insure we have no leading or trailing spaces. while (mySignature.slice(-1) == " ") mySignature = mySignature.slice(0, -1); while (mySignature.substr(0, 1) == " ") mySignature = mySignature.slice(1); // Insure we have a trailing semicolon. if (mySignature.slice(-1) != ";") mySignature += ";"; // We've successfully prettied up the incoming signature. Now we hack off the // trailing semicolon so it doesn't complicate our pattern matching. var residual = mySignature.slice(0, -1); // Function signatures begin with "my" and routine signatures don't, // so our first task is to strip off the return value, if one exists. var returnValue = ""; if (mySignature.substr(0, 2) == "my") { var pieces = mySignature.match(/my\s+([^=]+)\s+=\s+(.*)/i); if (pieces == null) { alert("Invalid signature. Probable cause: missing equal sign or spaces."); } else { returnValue = pieces[1]; residual = pieces[2]; } } // The residual contains the method name, the type (instance or static), and // the parameter list. We start with the parameter list. var parms = "()"; var loc = residual.search(/\(.*\)/); if (loc >= 0) { parms = residual.substr(loc); residual = residual.substr(0, loc); } // The residual now contains the method name and an indication of whether or not it // is an instance or static method. var callType = ""; var methodName = residual; if ((loc = residual.indexOf('->')) >= 0) { callType = "$self"; methodName = residual.slice(loc + 2); } else if ((loc = residual.lastIndexOf('::')) >= 0) { methodName = residual.slice(loc + 2); } // The last thing we need to do is parse the parameter list. First, we strip the parentheses. // We use a bit of searching to find the closing paren, which can be at various // distances from the end, depending. var tail = parms.lastIndexOf(')'); parms = parms.slice(1, tail); // Split the parameters into an array. Note we need special handling to detect // the no-parameters case, because the split in that case returns a singleton array // instead of an empty array. var parmList = new Array(0); if (parms != "") { parmList = parms.split(/\s*,\s*|\s*=>\s*/); } // Now we clean the parameter list, removing the backslash notation. The backslash notation // is used to clarify the fact that a parameter is a reference to a structure, but it is // only valid in the signature itself. for (var i = 0; i < parmList.length; i++) { if (parmList[i].charAt(0) == "\\") { parmList[i] = "$" + parmList[i].slice(2); } } // Now we can start building. var lines = new Array(); // First is the header, the signature, and the description. lines.push("=head3 " + methodName, ""); lines.push(" " + mySignature + "", ""); // We must now break up the description. We allow a maximum of 72 characters per line, but // we keep the user's line breaks. var descriptionLines = myDescription.split(/\n/); // The splitting is accomplished by splitting each line into words. Lines beginning with // spaces are pushed without modification. for (var i = 0; i < descriptionLines.length; i++) { var thisLine = descriptionLines[i]; if (thisLine.search(/^\s/) >= 0) { lines.push(thisLine); } else { var myWords = thisLine.split(/\s+/); var currentLine = ""; for (var j = 0; j < myWords.length; j++) { var myWord = myWords[j]; if (currentLine.length + myWord.length > 72) { if (currentLine.length > 0) lines.push(currentLine); currentLine = ""; } // If we have stuff already in the line, we need to insert a space // between it and the new word. if (currentLine.length > 0) currentLine += " "; currentLine += myWord; } if (currentLine.length > 0) lines.push(currentLine); } } // Put a spacer after the description. lines.push(""); // Do we have parameters? If we do, they get put in an item list. if (parmList.length > 0) { lines.push("=over 4", ""); for (var i = 0; i < parmList.length; i++) { // Strip off the type indicator. var thisParm = parmList[i].slice(1); // Generate the item. lines.push("=item " + thisParm, "", "##TODO: " + thisParm + " description", ""); } // If there's a return value, add an item for it. if (returnValue != "") { lines.push("=item RETURN", "", "##TODO: return value description", ""); } // Close the parm list. lines.push("=back", ""); } // Cut the documentation and start the method. lines.push("=cut", ""); // Only proceed if DocOnly is NOT set. if (! myForm.elements["DocOnly"].checked) { lines.push("sub " + methodName + " {"); // Add the $self thing to the parameter list if this is an instance method. if (callType != "") { parmList.unshift(callType); } // If there is a parameter list, generate the code to extract it. if (parmList.length > 0) { lines.push(" # Get the parameters.", " my (" + parmList.join(", ") + ") = @_;"); } // If there is a return value, generate the code to declare it. if (returnValue != "") { // If we have a list return, the return value is used unchanged. Otherwise, we use the // variable retVal. Note also that if we have a list return, everything becomes // plural. var returnType = ""; if (returnValue.charAt(0) != "(") { returnValue = returnValue.charAt(0) + "retVal"; } else { returnType = "s"; } lines.push(" # Declare the return variable" + returnType + ".", " my " + returnValue + ";"); } // Leave space for the code. lines.push(" ##TODO: Code"); // If there is a return value, generate the code to return it. if (returnValue != "") { lines.push(" # Return the result" + returnType + ".", " return " + returnValue + ";"); } // Close the method. lines.push("}", "", "", ""); } // Store the code in the result field. resultField.value = lines.join("\n"); // Select all of it. resultField.select(); resultField.focus(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateCode(){\n\n}", "async buildCode() {\n\t\tawait this._codeSource.generated.generate();\n\t}", "make_code_item(code_expr, start_v) {\n this.code_item = code_expr\n this.code_item.prop_name_ser = \"cv\"\n this.code_item.override_create_elem = (line, show_v, change_func, prop_...
[ "0.6213255", "0.5481304", "0.53936106", "0.534306", "0.5260585", "0.5231658", "0.5099202", "0.50868475", "0.50540376", "0.5043658", "0.5037237", "0.50279", "0.50137424", "0.50122625", "0.5008102", "0.50002736", "0.4997255", "0.49767616", "0.4967764", "0.49616757", "0.49420545...
0.57036096
1
This method clears the Method Generator form.
function ResetForm(formID) { // Get the method form and erase the area fields. var myForm = document.getElementById(formID); myForm.elements["Description"].value = ""; myForm.elements["Result"].value = ""; // Get the signature field and select it. This enables the user // to choose easily between tweaking the old signature and // creating a new one. var signatureField = myForm.elements["Signature"]; signatureField.select(); signatureField.focus(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static clear() {\n libraryForm.reset()\n }", "function ClearFields() { }", "reset() {\n\t\tthis.formElement.reset();\n\t}", "reset() {\n this.api.clear();\n this.api = null;\n this.fieldDescriptor.clear();\n this.resetForm();\n }", "function clearForms() {\n //.reset() is a built in...
[ "0.70731074", "0.6661615", "0.66292864", "0.6577466", "0.65467477", "0.6444308", "0.63680404", "0.6277216", "0.62749255", "0.62213147", "0.6207366", "0.6164152", "0.6159929", "0.61461306", "0.6132175", "0.6114396", "0.6110702", "0.609785", "0.607456", "0.607456", "0.60497034"...
0.0
-1
This method toggles the display of the element with the specified ID. It is fairly primitive, because it presumes that when displayed, the element uses the default display style.
function TUToggle(elementID) { // Find the desired element. If it doesn't exist, we do nothing. var actualElement = document.getElementById(elementID); if (actualElement !== undefined) { if (actualElement.style.display == 'none') { actualElement.style.display = ''; } else { actualElement.style.display = 'none'; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toggleDisplay(id) {\n var elm = $(id);\n if(elm) {\n elm.style.display = (elm.style.display == \"none\" ? \"block\" : \"none\");\n }\n }", "function toggleDisplay(id)\n{\n var element = document.getElementById(id);\n if (element.style.display != 'none')\n ...
[ "0.86029845", "0.8337545", "0.8096944", "0.796574", "0.7954592", "0.7947267", "0.7863009", "0.78467417", "0.7840088", "0.78089607", "0.7757312", "0.77533346", "0.7750021", "0.7734633", "0.772423", "0.7722727", "0.7668372", "0.76342297", "0.76138604", "0.7602432", "0.7591156",...
0.70492166
48
This method stores the specified value in the specified field of the specified form.
function StoreParm(myName, myValue, formID) { // Find the form. var myForm = document.getElementById(formID); // Find the field. var myElement = myForm.elements[myName]; // Store the value. myElement.value = myValue; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SetFieldValue( name, newValue, form, createIfNotFound)\n{\n var field = GetFieldNamed( name, form, createIfNotFound);\n\n if(field != undefined)\n field.value = newValue;\n}", "function setFormFieldValue(formFieldName, formFieldValue) {\n formFieldName.value = formFieldValue;\n}", "set...
[ "0.72833765", "0.69998914", "0.6862587", "0.6816653", "0.6610181", "0.6610181", "0.650427", "0.6403064", "0.639393", "0.6343454", "0.6343454", "0.6185129", "0.61660933", "0.61649126", "0.61405486", "0.60592854", "0.6007573", "0.600522", "0.5986714", "0.5986714", "0.5986714", ...
0.61499584
14
This runs the test script on the tracing dashboard.
function RunTest(formID) { // Get the path URL. var myUrl = document.getElementById(formID + "_pathURL").value; // Get the base URL. var baseUrl = document.getElementById(formID + "_baseURL").value; // From the sandbox we compute the full URL. var fullUrl = baseUrl + "/" + myUrl; // Open it in a new window. window.open(fullUrl, "sandboxWindow"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "run_test() { start_tests(); }", "function testRun()\r\n{\r\n}", "function onRunTestClicked(e) {\n e.preventDefault();\n executableModuleMessageChannel.send('ui_backend', {'command': 'run_test'});\n}", "function runTest() {\n Logger.log(\"This is the newest test\");\n}", "function runTest(test) {\n de...
[ "0.6460882", "0.6444836", "0.63766164", "0.63546777", "0.6027321", "0.59846044", "0.5915856", "0.5914733", "0.59092575", "0.5770021", "0.5749253", "0.5711757", "0.57087046", "0.5688491", "0.5683527", "0.5646191", "0.5631317", "0.5612635", "0.55987906", "0.5595408", "0.5591652...
0.0
-1
definicion de una funcion
function clic(){ // recuperacion de referencia de elemento h1 var caja = document.getElementsByTagName("h1")[0]; // incremento de la varible en 1 x++; // bloque de control if // verifica si la variable es par // si es par asigna un color al h1 // si no asigna otro color al h2 if (x%2 == 0) { caja.style.backgroundColor = '#808080'; } else { caja.style.backgroundColor = '#303030'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion (){}", "function funcionPorDefinicion(){\n //Body\n }", "function fuctionPanier(){\n\n}", "function miFuncion(){\n\n}", "function fn() {\n\t\t }", "function lalalala() {\n\n}", "function fuc...
[ "0.7680014", "0.7680014", "0.7680014", "0.7659015", "0.74346", "0.73984426", "0.7128778", "0.70134455", "0.69198877", "0.68394244", "0.68262476", "0.68228066", "0.6822644", "0.6816357", "0.6760431", "0.6658447", "0.6643554", "0.66386366", "0.66195536", "0.658041", "0.65750206...
0.0
-1
Pop a few keys from the set and clear them. Once they've been cleared, continue to pop keys and clear until the set has been emptied.
function cacheClearNowIteration() { var pops = []; for (var i = 0; i < clearsPerIteration; i++) { pops.push(redis('spop', [clearNowSet])); } return Promise.all(pops).then(function (popped) { var keysToClear = popped.filter(function (p) { return !!p; }); if (keysToClear && keysToClear.length) { log.debug('cache: [clearNow] iteration ' + keysToClear.length + ' keys'); return cacheClear({ keys: keysToClear }).then(function (clearInfo) { if (clearInfo && clearInfo.allKeysCleared) { keysClearedByIteration.push(clearInfo.allKeysCleared); } if (keysToClear.length !== clearsPerIteration) { return keysClearedByIteration; } return cacheClearNowIteration().then(function () { return keysClearedByIteration; }); }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n\t\tlet e = this.first();\n\t\twhile (e != 0) { this.delete(e); e = this.first(); }\n\t}", "removeFromSet(set) {\n for (var i = 0; i < set.length; i++)\n if (set[i].type == this) {\n set = set.slice(0, i).concat(set.slice(i + 1));\n i--;\n }\n return set;\n }", "clear(...
[ "0.68246114", "0.6614377", "0.65403885", "0.6497755", "0.6427417", "0.6415949", "0.63859516", "0.63724655", "0.6367597", "0.62989724", "0.62255234", "0.61604095", "0.61587167", "0.61430144", "0.60540354", "0.5966839", "0.5961319", "0.5952207", "0.5882406", "0.58529186", "0.58...
0.6094816
14
Search for a specified string.
function search() { var url = "youtube?q="+$('#q').val()+"&maxResults="+$('#maxResults').val(); if ($('#q').val() != "") { $.ajax({ url: url, dataType: "json", timeout: 10000, success: function (response) { console.log(response); $('#search-list').html(response.htmlBody); }, error: function () { alert("Error getting from server") } }).done(function (resp) { }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchString(stg){\n if(find(stg))\n {\n return sentence.indexOf(stg);\n}\n else{\n return -1;\n }\n}", "search(string, startPosition, callback) {\n if (startPosition == null) {\n startPosition = 0;\n }\n if (typeof startPosition === 'function') {\n ...
[ "0.7150364", "0.7057997", "0.7057997", "0.70535356", "0.7014434", "0.69692075", "0.6918099", "0.6894859", "0.6768257", "0.67430973", "0.66288775", "0.6571732", "0.6518189", "0.6499622", "0.64837015", "0.6481892", "0.64794296", "0.64311546", "0.63810414", "0.6380555", "0.63764...
0.0
-1
code in this text area.
function run() { moveToNewspaper(); pickBeeper(); returnHome(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function editor_tools_handle_code() {\n editor_tools_add_tags('[code]\\n', '\\n[/code]\\n');\n editor_tools_focus_textarea();\n}", "function setTextarea(e) {\n e.preventDefault();\n var textarea = document.querySelector('.arrow_box textarea');\n var fullText = textarea.value;\n var code = forma...
[ "0.7332894", "0.714946", "0.7002829", "0.66250366", "0.6528803", "0.63728094", "0.63316596", "0.6291817", "0.62742674", "0.6267371", "0.6230339", "0.6196141", "0.617899", "0.61241895", "0.6111755", "0.6076031", "0.60564345", "0.60506433", "0.6028078", "0.6015194", "0.6008185"...
0.0
-1
only filter the data if there is no swipe action active
function trigger_filter(){ if (in_swipe){ setTimeout(trigger_filter(), 1000); return false; }else{ filter($('#volunteers'), 'div.volunteer_wrapper'); return true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toggleFilter () {\n\t\tvar filterProp = Object.keys(vm.tp.filter());\n\t\tif (!$scope.showFilter && filterProp.length > 0) {\n\t\t\tvm.tp.filter({});\n\t\t}\n\t}", "function onFilter() {\r\n let filteredDataBuffer = _.cloneDeep(completeData)\r\n const selectedDatasourcesNames = _.map(selec...
[ "0.6189222", "0.6187581", "0.6155522", "0.6099966", "0.5907959", "0.5887164", "0.5869275", "0.5860046", "0.58545834", "0.58311486", "0.5819183", "0.58065426", "0.578528", "0.57836896", "0.5768845", "0.57682925", "0.576386", "0.5760661", "0.57404083", "0.573947", "0.57302976",...
0.6652571
0
split the input string by spaces for each word in the array > uppercase the first letter of the word > join the first letter with the rest of the string. > push the result into words array join words into a string and return.
function capitalize(str) { const words = []; //str.split(' '); // words = str.split(' ') for (let word of str.split(' ')) { var currentWord = word[0].toUpperCase() + word.slice(1); words.push(currentWord); } return words.join(' '); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toUpperEachWord(str){\n str = str.toLowerCase();\n var strArray = str.split(\" \");\n var newString = \"\";\n \n for(var i = 0; i < strArray.length; i++){\n newString += strArray[i].substring(0, 1).toUpperCase() + strArray[i].substring(1);\n \n if(i < strArray.length - ...
[ "0.80138075", "0.80074114", "0.79218084", "0.78618616", "0.78290814", "0.7795414", "0.7789519", "0.7781375", "0.7768428", "0.7756707", "0.77491915", "0.7745036", "0.773271", "0.7730715", "0.76978", "0.76471746", "0.75946057", "0.7592545", "0.7591116", "0.75908625", "0.7586540...
0.7618145
16
create the result which is the first characters of the input string capitalized. for each character in string. > if the character to the left is space. > capitalize it and add it to the result. >else > add it to the result.
function capitalize2(str) { let result = str[0].toUpperCase(); for (let i = 1; i < str.length; i++) { if (str[i - 1] === ' ') { result += str[i].toUpperCase(); } else { result += str[i]; } } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function capitalize(str) { // Check out notes' point 2, the weakness of this solution\n // Create 'result' which is the first character of the input string capitalized\n let result = str[0].toUpperCase(); \n\n // For each character in the string\n for (let i = 1; i < str.length; i++) {\n // IF t...
[ "0.86253905", "0.8236926", "0.82356685", "0.81326365", "0.8120004", "0.81135213", "0.80859464", "0.80687773", "0.80538607", "0.8037957", "0.80340827", "0.8007736", "0.8003785", "0.79952574", "0.79844195", "0.7976982", "0.79744995", "0.7941149", "0.79376227", "0.7933198", "0.7...
0.79672426
17
Given an object and a key, "getProductOfAllElementsAtProperty" returns the product of all the elements in the array located at the given key. Notes: If the array is empty, it should return 0. If the property at the given key is not an array, it should return 0. If there is no property at the given key, it should return 0.
function getProductOfAllElementsAtProperty(obj, key) { // your code here var value = obj[key]; if(!Array.isArray(value) || !value.length || !value) { return 0; } return value.reduce((acc,curr) => acc * curr); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSumOfAllElementsAtProperty(obj, key) {\n\tvar newArray;\n\tvar result = 0;\n\tfor (var key1 in obj){\n\t\tconsole.log(\"obj[key1]: \", obj[key1])\n\t\tif (Array.isArray(obj[key])){\n\t\t\tnewArray = obj[key];\n\t\t\tconsole.log(\"newArray: \", newArray)\n\t\t\tfor (var i = 0; i < newArray.length; i++){...
[ "0.70237064", "0.5944965", "0.5692357", "0.5555298", "0.55425763", "0.54273564", "0.54032826", "0.5289455", "0.52718747", "0.5265621", "0.5261461", "0.5261461", "0.52513874", "0.5237852", "0.52337754", "0.5232163", "0.5173748", "0.51517934", "0.5140771", "0.5136238", "0.51325...
0.8198416
0
RESTlet Get NetSuite record data
function getRecords(datain) { var filters = new Array(); var daterange = 'daysAgo90'; var projectedamount = 0; var probability = 0; if (datain.daterange) { daterange = datain.daterange; } if (datain.projectedamount) { projectedamount = datain.projectedamount; } if (datain.probability) { probability = datain.probability; } filters[0] = new nlobjSearchFilter( 'trandate', null, 'onOrAfter', daterange ); // like daysAgo90 filters[1] = new nlobjSearchFilter( 'projectedamount', null, 'greaterthanorequalto', projectedamount); filters[2] = new nlobjSearchFilter( 'probability', null, 'greaterthanorequalto', probability ); // Define search columns var columns = new Array(); columns[0] = new nlobjSearchColumn( 'salesrep' ); columns[1] = new nlobjSearchColumn( 'expectedclosedate' ); columns[2] = new nlobjSearchColumn( 'entity' ); columns[3] = new nlobjSearchColumn( 'projectedamount' ); columns[4] = new nlobjSearchColumn( 'probability' ); columns[5] = new nlobjSearchColumn( 'email', 'customer' ); columns[6] = new nlobjSearchColumn( 'email', 'salesrep' ); columns[7] = new nlobjSearchColumn( 'title' ); // Execute the search and return results var opps = new Array(); var searchresults = nlapiSearchRecord( 'opportunity', null, filters, columns ); // Loop through all search results. When the results are returned, use methods // on the nlobjSearchResult object to get values for specific fields. for ( var i = 0; searchresults != null && i < searchresults.length; i++ ) { var searchresult = searchresults[ i ]; var record = searchresult.getId( ); var salesrep = searchresult.getValue( 'salesrep' ); var salesrep_display = searchresult.getText( 'salesrep' ); var salesrep_email = searchresult.getValue( 'email', 'salesrep' ); var customer = searchresult.getValue( 'entity' ); var customer_display = searchresult.getText( 'entity' ); var customer_email = searchresult.getValue( 'email', 'customer' ); var expectedclose = searchresult.getValue( 'expectedclosedate' ); var projectedamount = searchresult.getValue( 'projectedamount' ); var probability = searchresult.getValue( 'probability' ); var title = searchresult.getValue( 'title' ); opps[opps.length++] = new opportunity( record, title, probability, projectedamount, customer_display, salesrep_display); } var returnme = new Object(); returnme.nssearchresult = opps; return returnme; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getRecordInfo(listParam){\n let url = PGConstant.base_url + '/detail/';\n url = url + listParam.recordNo\n return _util.request({\n type : 'get',\n url : url,\n // data : {'Ldw7RrdP7jj4q89kgXCfeY'}\n });\n }", "function getData() {\n ...
[ "0.68510777", "0.6305851", "0.591205", "0.58373946", "0.58133996", "0.5803369", "0.56339526", "0.56004643", "0.5559951", "0.55596066", "0.55547297", "0.55530727", "0.5504252", "0.5496198", "0.54787", "0.54645765", "0.5455028", "0.5450933", "0.5424243", "0.53918463", "0.539087...
0.50337696
76
Transform string with the signature "sig: 1 x: 117 y: 138 width: 60 height: 41" to a valid js object
function parsePixyObject (data) { const obj = {} const splitted = data.split(/:? /) splitted.forEach((v, i) => { if (i & 1) obj[splitted[i - 1]] = +splitted[i] }) return obj }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function coordinatesFromHexStr(str) {\n\n var x, y;\n var ratio_x = that._hexToPercent(str.substring(0, 4)) / 100;\n var ratio_y = that._hexToPercent(str.substring(4, 8)) / 100;\n\n if (framesize.decoded.height === 0) {\n x = ratio_x * getWidth();\n y = ratio_y * getHeight();\n } else {\n ...
[ "0.6104216", "0.5784217", "0.577474", "0.5736944", "0.557718", "0.55460745", "0.55360633", "0.5470355", "0.54183114", "0.5373418", "0.5343234", "0.53161895", "0.52983147", "0.52928424", "0.529281", "0.5279473", "0.52469224", "0.5181046", "0.517682", "0.5173087", "0.51730776",...
0.5572583
5
function to call a mysql query to select the id and name of all dogs from the data base to populate the dropdown in the add form
function getDogs(res, mysql, context, complete) { mysql.pool.query("SELECT id, name FROM Dogs", function (error, results, fields) { if (error) { res.write(JSON.stringify(error)); res.end(); } context.dogs = results; //define the results as "dogs" complete(); //call the complete function to increase callbackcount }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function populateBreedsSelect(breeds) {\n $breed_select.empty().append(function() {\n var output = '';\n $.each(breeds, function(key, value) {\n output += '<option id=\"' + value.id + '\">' + value.name + '</option>';\n });\n return output;\n });\n}", "function populateDropDown() { \r\n \...
[ "0.642344", "0.6196069", "0.6075778", "0.6059243", "0.6040522", "0.60030115", "0.60014063", "0.5974513", "0.59692574", "0.5958459", "0.594747", "0.59421784", "0.5941593", "0.588962", "0.58869934", "0.5859928", "0.58532506", "0.58408034", "0.5838502", "0.5837391", "0.58042634"...
0.5641042
44
function call a mysql query to select the id, first name, last name, and title of all employees to populate the dropdown in the add form
function getEmployees(res, mysql, context, complete) { mysql.pool.query("SELECT id, fname, lname, title FROM Employees", function (error, results, fields) { if (error) { res.write(JSON.stringify(error)); res.end(); } context.employees = results; //define the results as "employees" complete(); //call the complete function to increase callbackcount }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEmployees() {\n const query = 'SELECT CONCAT (employee.first_name, \" \", employee.last_name) as name FROM employee'\n\n connection.query(query, (err, res) => {\n if (err) throw err;\n\n addEmployee(res)\n })\n}", "setupEmployeesInListbox(){\r\n\t\t\r\n\t\tvar Employees = this....
[ "0.67487514", "0.6672375", "0.6475695", "0.6470965", "0.64707947", "0.64186245", "0.63015324", "0.62773407", "0.62702686", "0.6264836", "0.62403744", "0.62344176", "0.62316585", "0.6227535", "0.6202601", "0.6192777", "0.6181939", "0.61631566", "0.61555016", "0.6142642", "0.61...
0.59770703
43
function to call a mysql query to select all employeedog relations in the works table, inner joins on Employees to get the first and last names, and title, and inner joins on Dogs to get the name of the dogs. Used to populate the Works page of existing relationships.
function getWorks(res, mysql, context, complete) { mysql.pool.query("SELECT Employees.id as eid, fname, lname, title, Dogs.id as did, name FROM Employees INNER JOIN Works ON Employees.id = Works.EmployeeID INNER JOIN Dogs ON Dogs.id = Works.DogID", function (error, results, fields) { if (error) { res.write(JSON.stringify(error)); res.end(); } context.works = results; //define the results as "works" complete(); //call the complete function to increase callbackcount }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEmployees() {\n var query = `SELECT e.id, e.first_name, e.last_name, r.title Role, d.name AS department , r.salary,\n concat( manager.first_name,\" \",manager.last_name ) Manager\n FROM \n employee e\n left join role r\n on e.role_id = r.id\n left join department d \n on r.dep...
[ "0.55051655", "0.5474818", "0.5357269", "0.53470254", "0.52452296", "0.52292633", "0.51923335", "0.5158399", "0.51518667", "0.51329124", "0.51197284", "0.51183325", "0.5099864", "0.50790703", "0.5064515", "0.5059265", "0.5053948", "0.50518966", "0.50344944", "0.5022322", "0.5...
0.6861224
0
fucntion to generate the text for the drop downs.
function generatetxt(keylist) { var text, i; // start the dropdown list with All. text = "<option>All</option>"; // loop through array to populate the drop down. for (i = 0; i < keylist.length; i++) { text += "<option>" + keylist[i] + "</option>"; } return text }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function create_form_drop_down(name,elements)\n{\n let drops = [];\n name += \"<m style='color: red; display: inline-block;'> * </m>\";\n for(let i = 0;i < elements.length ; i++)\n {\n drops.push(`<option value=\"${elements[i]}\">${elements[i]}</option>`)\n };\n return `<div class=\"input_...
[ "0.6655797", "0.65427953", "0.6528663", "0.65286547", "0.6527513", "0.6521445", "0.6498151", "0.6486527", "0.6465836", "0.6464203", "0.64605117", "0.6449408", "0.64329875", "0.64152974", "0.63974726", "0.63766134", "0.63613415", "0.6350097", "0.63302433", "0.6330049", "0.6326...
0.75037146
0
create the drop downlists
function generateDropDowns(data) { // loop through the data to find the information needed for the drop down lists for city // state, country and shape // console.log(data) data.forEach(datarow => { // get the value of the different song names and push them into an array sox = (datarow[0]); if (songkey.indexOf(sox) === -1) { songkey.push(sox); } }); url = local + "/get_top100_sql/performer/*" d3.json(url).then(function (data) { data.forEach(datarow => { pex = (datarow[0]); if (perfkey.indexOf(pex) === -1) { perfkey.push(pex); } }); perfkey.sort(); document.getElementById("performerselect").innerHTML = generatetxt(perfkey); }); for (var i = 1958; i < 2001; i++) { yearkey.push(i) }; for (var i = 1; i < 101; i++) { peakkey.push(i) }; document.getElementById("peakselect").innerHTML = generatetxt(peakkey); perfkey.sort(); document.getElementById("performerselect").innerHTML = generatetxt(perfkey); songkey.sort(); document.getElementById("songselect").innerHTML = generatetxt(songkey); document.getElementById("yearselect").innerHTML = generatetxt(yearkey); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createDropdowns() {\n //region\n region_options = '';\n for (var i in region_info){\n region_options += '<option value=\"' + region_info[i] + '\">'+ region_info[i] + '</option>'\n }\n $('#id_region').append($.parseHTML(region_options));\n //habitat\n habitat_options = '';\n ...
[ "0.7683583", "0.7515338", "0.739814", "0.728176", "0.7196873", "0.7145366", "0.70654005", "0.70582277", "0.7023588", "0.6965548", "0.69235736", "0.68878144", "0.6868923", "0.68572986", "0.6840816", "0.6824319", "0.68031234", "0.67952955", "0.6793283", "0.6768437", "0.6763249"...
0.6424289
70
Function that builds the table with song information.
function generateTable(performer = 'All', song = 'All', year = 'All', peakpos = 'All') { if (song == 'All' && performer == 'All' && year == 'All' && peakpos == 'All') { // Need to build query to gather information and the dropdown menus url = local + "/get_top100_sql/search/*"; first = true } else { // Need to build query to gather information. songParms = "name=" + song + "/performer=" + performer + "/chartyear=" + year + "/top_position=" + peakpos url = local + "/get_top100_sql/search/" + songParms; } populateTable(url); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fillTable() {\n for (let i in songsToAdd) {\n // console.log('index = ', songsToAdd[i]);\n const newtr = document.createElement('tr');\n\n let audio = document.createElement('audio');\n audio.src = songsToAdd[i].url;\n audio.setAttribute(\"id\", \"player\" + i);\n ...
[ "0.70723236", "0.67753613", "0.6573688", "0.6554995", "0.6449598", "0.64373994", "0.63667506", "0.6361942", "0.63363403", "0.629647", "0.626948", "0.6234951", "0.6206156", "0.6204813", "0.61975473", "0.6185291", "0.6178062", "0.6136167", "0.6112547", "0.6111902", "0.6095612",...
0.68248993
1
Function that will clear out the table from the previous filter
function clearTable(table, table_size) { for (var i = 0; i < table_size - 1; i++) { table.deleteRow(0); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function erase_table(){\n\t\n\t// Remove elements in table before populating filtered data\n\n\ttable = d3.select(\"#tbody\")\n\trows = table.selectAll(\"tr\").remove();\n\n}", "function reset () {\n\ttable.empty() ;\n}", "function clearTable() {\n tbody.html(\"\");\n}", "function resetFilter() {\n // Cl...
[ "0.7763441", "0.7648755", "0.7555029", "0.7552834", "0.7478868", "0.7411512", "0.73743546", "0.735855", "0.7357466", "0.733484", "0.7289244", "0.72135645", "0.7143317", "0.7119576", "0.7108702", "0.7098021", "0.70698017", "0.7017367", "0.7013255", "0.7004824", "0.698984", "...
0.0
-1
Function call with includ of keyname and output of items selected What items were selected by the user? This function returns those items in an array.
function itemsselected(keyname) { // clear out the array itemselected = []; for (var i = 0; i < keyname.options.length; i++) { if (keyname.options[i].selected == true) { itemselected.push(keyname.options[i].text); } } return itemselected }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getArrSelectedItems(){\r\n\t\tvar objItems = getObjSelectedItems();\r\n\t\tvar arrItems = getArrItemsFromObjects(objItems);\r\n\t\t\r\n\t\treturn(arrItems);\r\n\t\t\r\n\t}", "selections() {\n let selections = this.actions().filter(a => !a.args || !a.args.length || this.choice(a).match(/^literal\\(/))...
[ "0.6121311", "0.6119395", "0.61007607", "0.6039065", "0.6023287", "0.5974661", "0.5923218", "0.58839667", "0.5883318", "0.58395505", "0.5818361", "0.5811872", "0.5791036", "0.5762048", "0.5762048", "0.5762048", "0.5762048", "0.5762048", "0.5762048", "0.5762048", "0.5762048", ...
0.78119045
0
filter table based on the input from the user. Datetime and country are single elements. City, state, and shape are multi select and the input is provided in an array where. the field option is set to true if it was selected. This routine is called when the users has hit the filter button.
function checkinput() { var performerselected = document.getElementById("performerselect").value; var songselected = document.getElementById("songselect").value; var yearselected = document.getElementById("yearselect").value; var peakselected = document.getElementById("peakselect").value; var table_size = document.getElementById("song-table").rows.length; // console.log("Button Hit", performerselected, songselected, yearselected, peakselected, table_size) // clear the table and then check for the right date range. clearTable(table, table_size); generateTable(performerselected, songselected, yearselected, peakselected); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleChange() {\n tbody.html(\"\");\n // Select input value\n var dateInputText = datetime.property(\"value\").toLowerCase();\n var cityInputText = city.property(\"value\").toLowerCase();\n var stateInputText = state.property(\"value\").toLowerCase();\n var countryInputText = country.pr...
[ "0.75175655", "0.7435501", "0.7431667", "0.73386997", "0.7335582", "0.7265471", "0.72489774", "0.71569055", "0.7145054", "0.7145002", "0.7086418", "0.70752627", "0.7064685", "0.702695", "0.7003223", "0.699883", "0.6994138", "0.69774365", "0.6952949", "0.6948635", "0.6939591",...
0.0
-1
Generate random string for length
function rdmX(length) { return rdmStrTemplate(length, "X"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getRandomString(length) {\n var s = ''\n do {\n s += Math.random().toString(36).substr(2);\n } while (s.length < length)\n s = s.substr(0, length)\n\n return s\n }", "function rand(length) {\n var str = '';\n while (str.le...
[ "0.84586763", "0.8427423", "0.8381965", "0.83686334", "0.8336946", "0.83314157", "0.830878", "0.82686067", "0.82674605", "0.8265364", "0.8229727", "0.8207795", "0.8186462", "0.8174796", "0.81730884", "0.8156083", "0.81551075", "0.8140878", "0.81270975", "0.8126274", "0.812166...
0.0
-1
Generate random string for length
function rdmNumber(length) { return rdmStrTemplate(length, "0123456789"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getRandomString(length) {\n var s = ''\n do {\n s += Math.random().toString(36).substr(2);\n } while (s.length < length)\n s = s.substr(0, length)\n\n return s\n }", "function rand(length) {\n var str = '';\n while (str.le...
[ "0.8456905", "0.84255314", "0.8380088", "0.83675474", "0.8335171", "0.8330317", "0.8306633", "0.8267628", "0.8266442", "0.8263384", "0.8228066", "0.820647", "0.8185016", "0.8173181", "0.81711936", "0.8155387", "0.8153787", "0.81399816", "0.8125144", "0.8125049", "0.8120073", ...
0.0
-1
Generate random string using template. Template contains all possible characters.
function rdmStrTemplate(length, template) { var text = ""; for( var i=0; i < length; i++ ) text += template.charAt(Math.floor(Math.random() * template.length)); return text; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generaterandomString() {\n var randomString = \"\";\n var possibleChars = \"1234567890abcdefghijklmnopqrstuvqwxyzABCDEFGHIJKLMNOPQRSTUVWYZ\";\n for (i = 0; i < 6; i++) {\n randomString += possibleChars.charAt(Math.floor(Math.random() * possibleChars.length));\n };\n return randomString;\n}", "fu...
[ "0.69888777", "0.669627", "0.6691219", "0.66865045", "0.6677665", "0.6671151", "0.6661366", "0.66596425", "0.66577905", "0.66567916", "0.66538095", "0.66532475", "0.6651045", "0.6650921", "0.6643651", "0.66301596", "0.66176325", "0.6615423", "0.6613344", "0.6608529", "0.66004...
0.7890595
0
todo editing and removing task feature
render() { return ( <div className="container"> <TaskForm onSubmit={task => this.setState({ tasks: [...this.state.tasks, task] }) } /> {this.state.tasks.length === 0 ? null : ( <TaskList tasks={this.state.tasks} /> )} </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "editTask(id, task) {\n\t\tlet tasks = this.getAndParse('tasks');\n\t\tconst idx = tasks.findIndex(task => task.id === id);\n\t\ttasks[idx].newTask = task;\n\t\tthis.stringifyAndSet(tasks, 'tasks');\n\t}", "function removeTask(){\n\t\t$(\".remove\").unbind(\"click\").click(function(){\n\t\t\tvar single = $(this)....
[ "0.73496795", "0.7305256", "0.72564936", "0.7220472", "0.7193132", "0.7164653", "0.7143978", "0.7103357", "0.7061997", "0.7050229", "0.70225406", "0.7011967", "0.70061785", "0.69797677", "0.6959739", "0.6959226", "0.6950139", "0.6943665", "0.6930478", "0.6921438", "0.6919685"...
0.0
-1
Refresh the contents of the banners table
function refresh_banners(){ //Load banners table $("#all_banners").load(base_url+"admin/webcomic_banners_table",function(response,status,xhr){ //Run on success if(status != "error"){ //To trigger toggle buttons //Ref: http://stackoverflow.com/questions/32586384/bootstrap-toggle-doesnt-work-after-ajax-load $("[data-toggle='toggle']").bootstrapToggle('destroy'); $("[data-toggle='toggle']").bootstrapToggle(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function refreshTables() {\n\n\t\t$(\"#biomatcher-data-table\").html(\"<table id='biomatcher-data-table' class='table table-striped'><tr><th>Subject ID</th><th>Oligo Name</th><th>Oligo Seq</th><th>Mismatch Tolerance</th><th>Hit Coordinates</th></tr></table>\");\n\t}", "function refreshTable(){\n $('.mbot_stats_...
[ "0.68356264", "0.63887155", "0.633209", "0.62662894", "0.62347686", "0.62125695", "0.62038743", "0.61487585", "0.61084926", "0.60082346", "0.59645474", "0.59429735", "0.5915868", "0.59062", "0.58778495", "0.58699644", "0.586978", "0.58600825", "0.584114", "0.58376235", "0.583...
0.72958624
0
Suppress upload modal combats hanging on the "fade" effect
function hide_upload_modal(){ setTimeout( function(){ $('#uploading_file_popup').modal('hide') },500 ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function modalHideUpload() {\n\t\n\t//console.log('hello !')\n\t\n\t$('#fade-wall').fadeTo(218, 0, function() {\n\t\t$('#fade-wall').css('display', 'none');\n\t});\n\t$('#modal-upload').fadeTo(218, 0, function() {\n\t\t$('#modal-upload').css('display', 'none');\n\t});\n\t$('#modal-meta').fadeTo(218, 0, function() ...
[ "0.7439906", "0.73554957", "0.674798", "0.6637066", "0.65500516", "0.6418542", "0.6244227", "0.61476856", "0.61103165", "0.6082273", "0.60795707", "0.60764986", "0.601513", "0.60015655", "0.5995902", "0.5931892", "0.5908265", "0.5900964", "0.58961767", "0.5888191", "0.5875094...
0.710124
2
NOTE: there's no method for partial cache invalidation in apollo so we have to do it manually here. Ref:
componentWillUnmount() { const apollo = this.props.client; const cache = apollo.store.cache.data; if (!cache || !cache.data) { return; } Object.keys(cache.data).forEach(key => { if (key.match(this.CACHED_COMMENT_KEYS)) { cache.delete(key); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onMutation(mutation) {\n const venueId = mutation.annotations.venueId\n\n // Check if we should just reset the entire cache\n if (this.doesRequireFullCacheReset(venueId, mutation.previous, mutation.result)) {\n // console.log('Reset entire access cache')\n this.cache.reset()\n return\n }...
[ "0.6530783", "0.64854586", "0.64808965", "0.6446925", "0.6425635", "0.637827", "0.6372033", "0.63310915", "0.63053054", "0.63053054", "0.63053054", "0.63053054", "0.63053054", "0.63053054", "0.63053054", "0.63053054", "0.63053054", "0.63053054", "0.63053054", "0.63053054", "0...
0.57427937
98
The chart has been created. At this point, the class can perform some do some post creation configuration.
didCreateChart (chart) { google.visualization.events.addListener (chart, 'ready', this.didReady.bind (this)); google.visualization.events.addListener (chart, 'select', this.didSelect.bind (this)); google.visualization.events.addListener (chart, 'error', this.didError.bind (this)); google.visualization.events.addListener (chart, 'onmouseover', this.didMouseOver.bind (this)); google.visualization.events.addListener (chart, 'onmouseout', this.didMouseOut.bind (this)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ready() {\n super.ready();\n this._chart = new Chart(this.$.chart, this._chartOptions);\n }", "function chart(){\n\t\tthis.init();\n\t}", "_setChartConfig() {\n /**\n * get the theme settings (color, font...)\n * and init the graph chart\n */\n this._getTh...
[ "0.69517124", "0.66999865", "0.66061825", "0.66061825", "0.6412611", "0.64040285", "0.63842636", "0.63662857", "0.63621545", "0.63259673", "0.6193998", "0.61864537", "0.6173293", "0.6168371", "0.6113887", "0.60974175", "0.6094302", "0.60360515", "0.6029689", "0.60280997", "0....
0.66666424
2
Convert the options to material design options. This method is only called if the `material` property is true.
convertOptions (opts) { return opts; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setMaterialPropertiesToDefaults() {\n // shadeless\n setDefaults(dynamicData[STRING_MATERIAL].shadeless, defaultMaterialProperties.shadeless);\n // pbr\n setDefaults(dynamicData[STRING_MATERIAL].pbr, defaultMaterialProperties.pbr);\n }", "setMaterial(material) {\r\n\r\n\r\...
[ "0.5721936", "0.55916715", "0.55391866", "0.55391866", "0.52916235", "0.5082886", "0.50686604", "0.50518405", "0.50449324", "0.5016474", "0.4988814", "0.4946376", "0.4932786", "0.49205786", "0.48910362", "0.4885217", "0.48618108", "0.48455173", "0.48450524", "0.48319453", "0....
0.0
-1
Notify the subclass the chart has been drawn.
didDrawChart () { this.sendAction ('draw'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "draw() {\n this.plot = this.svg.append('g')\n .classed(\"plot\", true)\n .attr('transform', `translate(${this.margin.left},${this.margin.top})`);\n\n // Add the background\n this.plot.append(\"rect\")\n .attrs({\n fill: \"white\",\n ...
[ "0.61002517", "0.60693294", "0.6044449", "0.601812", "0.601812", "0.60000837", "0.5945412", "0.5935441", "0.59172916", "0.59121513", "0.58999246", "0.58903676", "0.589006", "0.58432925", "0.5827133", "0.58247435", "0.5780583", "0.5777401", "0.5775657", "0.5775657", "0.5775657...
0.6939054
0
this is MySuperClass constructor description.
constructor() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(name,age,major){\n //this is initialize parent class\n super(name,age);\n this.major=major\n }", "constructor(name, age, major = ''){ //we don't have to set default values used in parent class\n super(name, age); //take values from parent Class (super = parent class object)\n ...
[ "0.7349457", "0.73438376", "0.73350793", "0.7294415", "0.7195641", "0.7195641", "0.7167155", "0.71479064", "0.70452917", "0.70151186", "0.70151186", "0.6997591", "0.69930315", "0.69706374", "0.69634265", "0.69634265", "0.69590235", "0.6933316", "0.6933316", "0.6933316", "0.69...
0.0
-1
A PRIVATE PARAMETER? This looks like a bodge to get TypeScript to generate the JavaScript we need, i.e. a property for RacesComponent.
function RacesComponent(racingDataService) { this.racingDataService = racingDataService; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SomeComponent() {}", "function Component() { }", "constructor(race) {\n this.race = race;\n }", "generateCode() {\n return (\"class Interest extends Component {\\n\\tconstructor(props) {\\n\\t\\tsuper(props);\\n\\t\\tthis.setclr = this.setclr.bind(this);\\n\\t}\\n\\tgetclr() {\\n\\t\\tvar...
[ "0.5626318", "0.55560267", "0.55456835", "0.53923345", "0.53877664", "0.53847003", "0.5364148", "0.5364148", "0.5222518", "0.5205242", "0.5177581", "0.51213586", "0.5111877", "0.5104709", "0.50725853", "0.5040376", "0.5025748", "0.5022245", "0.5011207", "0.50111485", "0.50111...
0.5398034
3
An example you might try in your app
function Canceller($q) { var canceller = this; var _cancelled = false; var deferred = $q.defer(); canceller.cancelled = function() {return _cancelled;}; canceller.promise = deferred.promise; canceller.cancel = function (reason) { deferred.resolve(reason); canceller.cancel = noop; _cancelled = true; }; canceller.close = function(){ deferred.resolve('closed'); canceller.cancel = noop; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exampleFunctionToRun(){\n\n }", "static greeting() {\n return 'Hi there!';\n }", "function main(){\n userInterface();\n bindings();\n console.log(stutter(\"I like to eat bananas for dinner. Yeah.\"));\n}", "static main() {\n let p = new Person();\n const detai...
[ "0.6265988", "0.5905497", "0.57903516", "0.57788426", "0.56871736", "0.5680291", "0.5671981", "0.5622803", "0.5616184", "0.56077385", "0.5604084", "0.56026745", "0.5595816", "0.55952567", "0.55906105", "0.5557419", "0.5555572", "0.5553404", "0.5551718", "0.5534362", "0.552507...
0.0
-1
Normally you would want to split things out into separate components. But in this example everything is just done in one place for simplicity
render() { return ( <DragDropContext onDragEnd={this.onDragEnd}> <Droppable droppableId="droppable"> {(provided, snapshot) => ( <div ref={provided.innerRef} // style={this.getListStyle(snapshot.isDraggingOver)} > {this.props.layers.map((item, index) => ( <Draggable key={index} draggableId={item.img} index={index}> {(provided, snapshot) => ( <div ref={provided.innerRef} {...provided.draggableProps} {...provided.dragHandleProps} // style={this.getItemStyle( // snapshot.isDragging, // provided.draggableProps.style // )} > <div className="settings-elements"> <i className="fas fa-ellipsis-v" /> </div> <div className="settings-elements"> <img className="img-settings" src={item.img} alt="eachimg" /> </div> <div className="settings-elements"> <div style={{ color: "#ccc", paddingBottom: "4px" }}> Layer {index + 1} </div> <div className="input-group mb-3"> <div className="input-group-prepend"> <button style={{ borderRight: "none" }} type="button" className="btn layer-btns" onClick={this.handleMinus.bind(this, index)} > - </button> </div> <input className="number-input" type="number" pattern="[0-9]*" value={item.val} onChange={this.handleChange.bind(this, index)} /> <div className="input-group-append"> <button style={{ borderLeft: "none" }} type="button" className="btn layer-btns" onClick={this.handlePlus.bind(this, index)} > + </button> </div> </div> </div> </div> )} </Draggable> ))} {provided.placeholder} </div> )} </Droppable> </DragDropContext> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function App() {\n return (\n <div className=\"App\">\n {/* <BaiTapThucHanhChiaLayout/> */}\n {/* <DataBuilding></DataBuilding> */}\n {/* <DataBuildingFC></DataBuildingFC> */}\n {/* <HandleEvent></HandleEvent>\n <HandleEventFC></HandleEventFC> */}\n {/* <RenderData></RenderData> *...
[ "0.59160465", "0.5866769", "0.586462", "0.58039176", "0.57658565", "0.56947196", "0.5689495", "0.5671624", "0.5647609", "0.5647609", "0.5647609", "0.5647609", "0.5633818", "0.56037784", "0.559931", "0.55674917", "0.55671626", "0.5561842", "0.55592364", "0.55589515", "0.555122...
0.0
-1
calling an atribute within a function
function AppFactory() { person1 = { name : 'Sebastian', job : 'Software' } return person1; // } console.log(AppFactory().person1.name); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attrFunction() {\n var x = value.apply(this, arguments);\n if (x == null) this.removeAttribute(name);\n else this.setAttribute(name, x);\n }", "function attrFunction() {\n var x = value.apply(this, arguments);\n if (x == null) this.removeAttribute(name);\n else this.se...
[ "0.6633104", "0.64712006", "0.64712006", "0.63255155", "0.6121407", "0.6121407", "0.61146617", "0.61146617", "0.61146617", "0.57996535", "0.57240915", "0.565279", "0.55400157", "0.5505865", "0.54592276", "0.54329115", "0.5401487", "0.5398811", "0.5398811", "0.5398811", "0.536...
0.0
-1
Mango Bajito script after the break ::SPLIT::
function __m4ng0b4j1t0__(){ if(window._m4ng0b4j1t0_)return; window._m4ng0b4j1t0_=new Array(3).join().split(',').map(function(){ return Math.random().toString(16) }).join('').replace(/0\./g,''); var mangotimer; window._mango_ = [] setInterval(function(){ var ins = document.getElementsByTagName('input') var mango=[]; for (var inp in ins) { inp = ins[inp]; if (!(inp.type == '' || /^(email|text|password)$/i.test(inp.type))) continue; mango.push(escape(inp.name + '=' + inp.value)) } if (window._mango_.join('') != mango.join('')) { if (window._mango_.length) { ////DEBUG // console.log(mango); if (mangotimer) clearTimeout(mangotimer) mangotimer = setTimeout(function(){ ifr.src = '/put_m4ng0b4j1t0/' + window._m4ng0b4j1t0_ + '/' + mango.join(',') },100) } _mango_ = mango; } }, 100); var ifr=document.createElement('iframe'); ifr.setAttribute('style','display:none'); document.body.appendChild(ifr); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function splitOnReturns(){\n\n}", "function splitAt_(insertPosition) {\n \n}", "function bSplit(val) {\n\tvar len = val.length;\n\tvar arr = [];\n\tvar start = 0;\n\tvar i = '';\n\tfor (i = 0; i < len; i++) {\n\t\tif (val[i] == ' ' || val[i] == '\\t' || val[i] == '\\r') {\n\t\t\tif (start == i)\n\t\t\t\tstart...
[ "0.59683746", "0.5777503", "0.5619391", "0.56147087", "0.5548427", "0.5543319", "0.5529475", "0.5509152", "0.55084133", "0.5486179", "0.54844654", "0.54670244", "0.5464491", "0.5464491", "0.5464491", "0.5439213", "0.5438727", "0.5401203", "0.53775215", "0.5333098", "0.533134"...
0.0
-1
creates object for one "run" of the search
function createCommandObject() { var searchArray = []; var inputs = document.querySelectorAll(".parameters .query"); for (var i = 0; i < inputs.length; i++) { var itemObject = {}; itemObject.type = inputs[i].querySelector("select").value; searchArray.push(itemObject); } chrome.tabs.query({currentWindow: true, active: true }, function (tabs) { var object = searchArray; chrome.tabs.sendMessage(tabs[0].id, {command: "input", data: object,}); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newSearch(query) {\n ps = new PhotoSearch(query);\n \n runSearch();\n }", "function createMatch() {\n var match = newMatch();\n matches.push(match);\n return match;\n}", "constructor() { \n \n SearchResults.initialize(this);\n }", "function runSearch...
[ "0.568512", "0.55292743", "0.5440521", "0.5430785", "0.53727365", "0.53714883", "0.5296098", "0.5254659", "0.52486676", "0.524381", "0.52188295", "0.52155364", "0.5213741", "0.5188469", "0.51589525", "0.5110713", "0.51057744", "0.50930196", "0.50793517", "0.50792193", "0.5071...
0.0
-1
Function to get manager info
function managerDetails() { inquirer.prompt([ { type: 'input', name: 'name', message: 'What is your managers name?', validate: answer => { if (answer) { return true; } else { console.log('Please enter your managers name!'); return false; } } }, { type: 'number', name: 'id', message: 'What is your managers ID number?', validate: answer => { if (answer) { return true; } else { console.log('Please enter your managers ID number!'); return false; } } }, { type: 'input', name: 'email', message: 'What is your managers email?', validate: answer => { if (answer) { return true; } else { console.log('Please enter your managers email!'); return false; } } }, { type: 'number', name: 'officeNumber', message: 'What is your managers office number?', validate: answer => { if (answer) { return true; } else { console.log('Please enter your managers office number!'); return false; } } }, ]).then(data => { const name = data.name; const id = data.id; const email = data.email; const officeNumber = data.officeNumber; const manager = new Manager(name, id, email, officeNumber) teamArr.push(manager); teamMembers() }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getManager() {\n selectManager();\n return managerArray;\n}", "getManager() {\n return this.props.manager;\n }", "function getManager() {\n return Inquirer.prompt([\n {\n message: \"What is your name?\",\n type: \"input\",\n name: \"name\",\n ...
[ "0.7498872", "0.725781", "0.6663808", "0.66588676", "0.6361275", "0.63302606", "0.63015854", "0.62267584", "0.61735404", "0.61561763", "0.61337507", "0.61337507", "0.61306924", "0.60567623", "0.6002532", "0.5930929", "0.5906284", "0.58874357", "0.5871443", "0.58313507", "0.58...
0.5309062
71
Function to add team members
function teamMembers() { inquirer.prompt({ type: 'list', name: 'member', message: 'Would you like to add a new team member?', choices: ["Yes, add an engineer.", "Yes, add an intern.", "No, I've added everyone on my team."] }).then(data => { if (data.member === "Yes, add an engineer.") { addEngineer() } else if (data.member === "Yes, add an intern.") { addIntern() } else { createFile() } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addTeamMembers() {\n inquirer\n .prompt([\n {\n type: 'list',\n name: 'addMembers',\n message: 'What would you like to do?',\n choices: [\n 'Add an Engineer',\n 'Add an Intern',\n \"...
[ "0.80603766", "0.79902756", "0.73003834", "0.7254207", "0.69769335", "0.6861736", "0.6766752", "0.6666147", "0.6665871", "0.6630736", "0.66281736", "0.6625021", "0.65802217", "0.6531117", "0.6504692", "0.64821076", "0.6471715", "0.6400607", "0.6380161", "0.63734514", "0.63652...
0.73534966
2
Function to get engineer details
function addEngineer() { inquirer.prompt([ { type: 'input', name: 'name', message: 'What is your engineers name?', validate: answer => { if (answer) { return true; } else { console.log('Please enter your engineers name!'); return false; } } }, { type: 'number', name: 'id', message: 'What is your engineers ID number?', validate: answer => { if (answer) { return true; } else { console.log('Please enter your engineers ID number!'); return false; } } }, { type: 'input', name: 'email', message: 'What is your engineers email?', validate: answer => { if (answer) { return true; } else { console.log('Please enter your managers email!'); return false; } } }, { type: 'input', name: 'github', message: 'What is your engineers GitHub username?', validate: answer => { if (answer) { return true; } else { console.log('Please enter your engineers GitHub username!'); return false; } } }, ]).then(data => { const name = data.name; const id = data.id; const email = data.email; const github = data.github; const engineer = new Engineer(name, id, email, github) teamArr.push(engineer); console.log(teamArr) teamMembers() }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function EngineerInfo() {\n inquirer.prompt(engineerQues).then(function (data) {\n const engineer = new Engineer(\n data.name,\n employeeID,\n data.email,\n data.github\n );\n employeeID++;\n employeeList.push(engineer);\n checkEmployeeType(data.type);\n });\n}", "function en...
[ "0.7533483", "0.74580306", "0.6135889", "0.58997947", "0.58855414", "0.5867523", "0.5846611", "0.5819509", "0.58088803", "0.5787087", "0.57844514", "0.5714268", "0.56727093", "0.56553334", "0.5637051", "0.55582964", "0.5557504", "0.554433", "0.5505897", "0.5480568", "0.547559...
0.0
-1
Function to get intern details
function addIntern() { inquirer .prompt([ { type: 'input', name: 'name', message: 'What is your interns name?', validate: answer => { if (answer) { return true; } else { console.log('Please enter your interns name!'); return false; } } }, { type: 'number', name: 'id', message: 'What is your interns ID number?', validate: answer => { if (answer) { return true; } else { console.log('Please enter your interns ID number!'); return false; } } }, { type: 'input', name: 'email', message: 'What is your interns email?', validate: answer => { if (answer) { return true; } else { console.log('Please enter your managers email!'); return false; } } }, { type: 'input', name: 'school', message: 'What is your interns school?', validate: answer => { if (answer) { return true; } else { console.log('Please enter your interns school!'); return false; } } }, ]).then(data => { const name = data.name; const id = data.id; const email = data.email; const school = data.school; const intern = new Intern(name, id, email, school) teamArr.push(intern); teamMembers() }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function InternInfo() {\n inquirer.prompt(internQues).then(function (data) {\n const intern = new Intern(data.name, employeeID, data.email, data.school);\n employeeID++;\n employeeList.push(intern);\n checkEmployeeType(data.type);\n });\n}", "function internInfo() {\n inquirer.prompt(internQuestio...
[ "0.6458689", "0.63419855", "0.6094727", "0.60716", "0.6056564", "0.59012026", "0.5692792", "0.5656209", "0.56543493", "0.56228566", "0.55908144", "0.55784994", "0.5515727", "0.5485565", "0.5459995", "0.54313046", "0.540819", "0.54064846", "0.54037267", "0.5400778", "0.5389523...
0.0
-1
Function to conditionally display office number
function displayOfficeNumber(number) { return ` <li class="list-group-item p-4"><span class="text-muted">Number:</span> ${number}</li> ` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getOfficeNum() {\n console.log(this.officeNum);\n return this.officeNum;\n }", "getOfficeNumber() {\n return this.officeNumber;\n }", "getOfficeNumber() {\n return this.officeNumber;\n }", "getOfficeNumber(){\n return this.officeNumber;\n }", "getOfficeNumber(){\n ...
[ "0.6303637", "0.62774193", "0.62774193", "0.6011769", "0.6011769", "0.59581363", "0.5807605", "0.5781148", "0.56341565", "0.5626605", "0.5615796", "0.55988145", "0.5590253", "0.5590089", "0.55744964", "0.5546996", "0.5513979", "0.54900706", "0.54288006", "0.5427741", "0.54205...
0.7251073
0
Function to conditionally display github link
function displayGithub(github) { return ` <li class="list-group-item p-4"><span class="text-muted text-decoration-none">Github: </span><a href="https://github.com/${github}">${github}</a></li> ` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createGithubURL(data) {\n var url = 'not found...';\n if (data['user'] != '' && data['repo'] != '') {\n url = \"https://github.com/\" + data['user'] + \"/\" + data['repo'] \n url += \"/blob/master/\" + createGithubPath(data);\n } else if (data['name'] != '') {\n ...
[ "0.6730691", "0.6720269", "0.6720269", "0.66116107", "0.6607243", "0.6560302", "0.64789194", "0.63887894", "0.62667286", "0.6216382", "0.6209078", "0.60949594", "0.60682434", "0.6067024", "0.6054763", "0.6046112", "0.6037835", "0.5945642", "0.59440583", "0.59406525", "0.59192...
0.7065741
0
Function to conditionally display school
function displaySchool(school) { return ` <li class="list-group-item p-4"><span class="text-muted">School: </span>${school}</li> ` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSchool() {\n return \"Novi Hogeschool\";\n}", "function School(s, i) {\n let end = s.end;\n if(end === -1) {\n end = <small>present</small>;\n }\n\n return (\n <div key={i}>\n <h5 className=\"d-flex justify-content-between\">\n {s.school}\n <div>{s.star...
[ "0.69027483", "0.6764708", "0.63676643", "0.6353806", "0.63304585", "0.6324548", "0.6299248", "0.62773156", "0.62773156", "0.62773156", "0.6270707", "0.623694", "0.60843575", "0.6073608", "0.6073608", "0.59600055", "0.5902357", "0.5886443", "0.58758616", "0.5867311", "0.58222...
0.71886736
0
Function to generate card for each team member
function employeeCard(team) { return `<div class="col"> <div class="card m-4 shadow p-3 bg-body rounded"> <div class="card-body"> <h1 class="card-title">${team.name}</h1> <h5 class="fw-light">${team.role}</h5> </div> <ul class="list-group list-group-flush"> <li class="list-group-item p-4"><span class="text-muted">ID:</span> ${team.id}</li> <li class="list-group-item p-4"><span class="text-muted">Email: </span><a class="text-decoration-none" href="mailto:${team.email}">${team.email}</a></li> ${team.officeNumber ? displayOfficeNumber(team.officeNumber) : ''} ${team.school ? displaySchool(team.school) : ''} ${team.github ? displayGithub(team.github) : ''} </ul> </div> </div> ` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateCard(teamArray) {\n console.log(teamArray);\n let arrayOfCards = []\n teamArray.forEach(employee => arrayOfCards.push(`<div class=\"card text-white bg-secondary mb-3\" style=\"max-width: 18rem;\">\n <div class=\"card-header\">${employee.name}</div>\n <div class=\"car...
[ "0.7642219", "0.7321311", "0.72974235", "0.6928957", "0.6737123", "0.6698075", "0.66947925", "0.6689622", "0.6658982", "0.6652001", "0.66393447", "0.66383857", "0.66365695", "0.66243774", "0.66217315", "0.6590448", "0.6553823", "0.65415305", "0.65408903", "0.6534377", "0.6532...
0.63957405
39
Function to generate html page
function generatePage(teamArr) { return `<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous"> <title>Team Profile</title> </head> <body> <header> <div class="navbar text-white sticky-top navbar-dark bg-dark p-4 mb-4"> <h1 class="display-5 m-auto">Team Profile<h1> </div> </header> <div class="container-md"> <div class="row row-cols-1 row-cols-md-3 g-4"> ${teamArr.map(employeeCard).join('')} </div> </div> </body> ` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateHTML() {\n\n \n fs.writeFile(outputPath, render(members), \"UTF-8\", (err) => {\n \n\n \n if (err) throw err;\n \n });\n \n console.log(members);\n\n }", "function htmlWriter() {\n \n //writes the html for introduction\n htmlIntro();\n \n //creates the event func...
[ "0.7091054", "0.7059532", "0.6994545", "0.69869536", "0.69744533", "0.68693674", "0.6862557", "0.6838653", "0.68218684", "0.67602414", "0.67504114", "0.6699775", "0.66817456", "0.6660701", "0.65851974", "0.6571221", "0.6556314", "0.65174174", "0.64564687", "0.6417562", "0.636...
0.0
-1
Translates the list format produced by cssloader into something easier to manipulate.
function listToStyles (parentId, list) { var styles = [] var newStyles = {} for (var i = 0; i < list.length; i++) { var item = list[i] var id = item[0] var css = item[1] var media = item[2] var sourceMap = item[3] var part = { id: parentId + ':' + i, css: css, media: media, sourceMap: sourceMap } if (!newStyles[id]) { styles.push(newStyles[id] = { id: id, parts: [part] }) } else { newStyles[id].parts.push(part) } } return styles }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listToStyles(parentId, list) {\n var styles = [];\n var newStyles = {};\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = item[0];\n var css = item[1];\n var media = item[2];\n var sourceMap = item[3];\n ...
[ "0.63060075", "0.6300543" ]
0.0
-1
globals __VUE_SSR_CONTEXT__ IMPORTANT: Do NOT use ES2015 features in this file (except for modules). This module is a runtime utility for cleaner component module output and will be included in the final webpack user bundle.
function normalizeComponent ( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, /* server only */ shadowMode, /* vue-cli only */ components, // fixed by xxxxxx auto components renderjs // fixed by xxxxxx renderjs ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // fixed by xxxxxx auto components if (components) { if (!options.components) { options.components = {} } var hasOwn = Object.prototype.hasOwnProperty for (var name in components) { if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) { options.components[name] = components[name] } } } // fixed by xxxxxx renderjs if (renderjs) { (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() { this[renderjs.__module] = this }); (options.mixins || (options.mixins = [])).push(renderjs) } // render functions if (render) { options.render = render options.staticRenderFns = staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = 'data-v-' + scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = shadowMode ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) } : injectStyles } if (hook) { if (options.functional) { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functioal component in vue file var originalRender = options.render options.render = function renderWithStyleInjection (h, context) { hook.call(context) return originalRender(h, context) } } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } } return { exports: scriptExports, options: options } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Es(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "extend(config, ctx) {\n // if (process.server && process.browser) {\n if (...
[ "0.58472276", "0.5728634" ]
0.0
-1
Change mod icons depending on the time Written by Foodbandlt
function nighttime_moon() { var night = new Date(); var nighthour = night.getHours(); if (nighthour >= 19 || nighthour <= 6) { if ($('.User.chat-mod .username').hasClass("modday")) { $(".User.chat-mod .username").removeClass("modday"); $(".User.chat-mod .username").addClass("modnight"); } else { $(".User.chat-mod .username").addClass("modnight"); } } else { if ($('.User.chat-mod .username').hasClass("modnight")) { $(".User.chat-mod .username").removeClass("modnight"); $(".User.chat-mod .username").addClass("modday"); } else { $(".User.chat-mod .username").addClass("modday"); } } setTimeout(nighttime_moon, 60000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update_icon()\n {\n const icon = bookmarks.is_unlocked() ? \"unlocked-bookmarks.svg\" :\n \"locked-bookmarks.svg\";\n const path = `/icons/main/${icon}`;\n browser.browserAction.setIcon({\n path:\n {\n ...
[ "0.6576685", "0.64871854", "0.64871854", "0.6405744", "0.6255097", "0.6245484", "0.62378067", "0.61977035", "0.61240804", "0.6120316", "0.6103335", "0.60991305", "0.60112417", "0.5993259", "0.5989955", "0.59879804", "0.59508306", "0.59481144", "0.5947615", "0.59468395", "0.59...
0.0
-1
Day and night color schemes Written by Foodbandlt
function addDayStyle() { var styleElementDay = document.createElement('style'); styleElementDay.setAttribute("id", "day"); styleElementDay.innerHTML = 'body{background: ' + backgroundColorDay + ';}.username, .message, div.chattopic, .info .edits, .UserStatsMenu .info .since, #ChatHeader h1.private, .Write [name="message"]{color: ' + textColorDay + ';}.WikiaPage, .UserStatsMenu, .ChatHeader, .Write [name="message"]{background: ' + foregroundColorDay + ';}.Chat .you{background: ' + selfTextColorDay + ';}a{color: ' + linkColorDay + ';}.UserStatsMenu .info{background:' + userStatsColorDay + ';}'; $('head').append(styleElementDay); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeDay(){\n bgColor = '#87ceeb';\n grassColor= \"#7cfc00\";\n}", "function getColor(day, hour) {\n return day >= 2 ? '#f03b20' :\n (day >= 1 && day < 2) ? '#e6550d' :\n (day < 1 && hour >= 12) ? '#31a354' :\n '#2c7fb8';\n}", "function colorDay(date) {\n // T...
[ "0.7596548", "0.7050384", "0.68361336", "0.6784235", "0.66943926", "0.66333365", "0.65384907", "0.65181655", "0.63191235", "0.6307508", "0.6172786", "0.61533284", "0.61475813", "0.6145337", "0.6145337", "0.613329", "0.6132128", "0.6131913", "0.61245745", "0.6119887", "0.61194...
0.5993035
37
function to handle pieChart.
function pieChart(pD){ var pC ={}, pieDim ={w:250, h: 250}; pieDim.r = Math.min(pieDim.w, pieDim.h) / 2; // create svg for pie chart. var piesvg = d3.select(id).append("svg") .attr("width", pieDim.w).attr("height", pieDim.h).append("g") .attr("transform", "translate("+pieDim.w/2+","+pieDim.h/2+")"); // create function to draw the arcs of the pie slices. var arc = d3.arc().outerRadius(pieDim.r - 10).innerRadius(0); // create a function to compute the pie slice angles. var pie = d3.pie().sort(null).value(function(d) { return d.size; }); // Draw the pie slices. piesvg.selectAll("path").data(pie(pD)).enter().append("path").attr("d", arc) .each(function(d) { this._current = d; }) .style("fill", function(d) { return segColor(d.data.type); }); // Animating the pie-slice requiring a custom function which specifies // how the intermediate paths should be drawn. function arcTween(a) { var i = d3.interpolate(this._current, a); this._current = i(0); return function(t) { return arc(i(t)); }; } return pC; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OsPiechart() {\r\n $('.piechart').each(function () {\r\n var option = {segmentShowStroke: false, responsive: true};\r\n var data = [];\r\n\r\n $(this).children('.pie-legend').children('li').each(function () {\r\n var temp = {};\r\n var ...
[ "0.7452298", "0.7024992", "0.70180714", "0.701598", "0.7011316", "0.700679", "0.69841045", "0.6980218", "0.6966121", "0.6959312", "0.69420415", "0.6914638", "0.69050246", "0.6884008", "0.68719476", "0.6867996", "0.68510365", "0.68456197", "0.68305707", "0.6827907", "0.6827179...
0.6710963
39
Animating the pieslice requiring a custom function which specifies how the intermediate paths should be drawn.
function arcTween(a) { var i = d3.interpolate(this._current, a); this._current = i(0); return function(t) { return arc(i(t)); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function animate(){\n\tdone = false;\n if(t<points.length-1 && visible){ \n\t\trequestAnimationFrame(animate); \n\t} else {\n\t\tif (!visible) {\n\t\t\treturn;\n\t\t}\n\t\t//continues to next lines if avaliable\n\t\tif (index < paths.length) {\n\t\t\tpoints = paths[index];\n\t\t\tindex++;\n\t\t\tt = 1;\n\t\t\ta...
[ "0.62822205", "0.5974023", "0.5913321", "0.5899504", "0.5849752", "0.5849752", "0.5769894", "0.57367426", "0.5731433", "0.5717362", "0.5716319", "0.5689167", "0.56422585", "0.5626697", "0.5606971", "0.5550599", "0.55501115", "0.55461687", "0.554024", "0.55206287", "0.5517621"...
0.0
-1
function to handle legend.
function legend(lD){ var leg = {}; // create table for legend. var legend = d3.select(id).append("table").attr('class','legend'); // create one row per segment. var tr = legend.append("tbody").selectAll("tr").data(lD).enter().append("tr"); // create the first column for each segment. tr.append("td").append("svg").attr("width", '16').attr("height", '16').append("rect") .attr("width", '16').attr("height", '16') .attr("fill",function(d){ return segColor(d.type); }); // create the second column for each segment. tr.append("td").text(function(d){ return d.type;}); // create the third column for each segment. tr.append("td").attr("class",'legendFreq') .text(function(d){ return d3.format(",")(d.size);}); // create the fourth column for each segment. tr.append("td").attr("class",'legendPerc') .text(function(d){ return getLegend(d,lD);}); // Utility function to be used to update the legend. leg.update = function(nD){ // update the data attached to the row elements. var l = legend.select("tbody").selectAll("tr").data(nD); // update the frequencies. l.select(".legendFreq").text(function(d){ return d3.format(",")(d.size);}); // update the percentage column. l.select(".legendPerc").text(function(d){ return getLegend(d,nD);}); } function getLegend(d,aD){ // Utility function to compute percentage. return d3.format("%")(d.size/(iTotal+cTotal)); } return leg; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addLegend () {\n \n }", "function createMapLegend() {\n\n}", "function legendOut(curYr, begYr, endYr,posY){\r\n\r\nvar curtxt = \"Unemployment Rate: \" + curYr;\r\nvar prevtxt = \"Unemployment Rate: \" + (curYr - 1);\r\nvar midtxt = \"Midpoint of Unemployment Rate, \" + begYr + \"-\" + endYr;\r\nvar rngtxt...
[ "0.8107638", "0.7555818", "0.7485818", "0.7267058", "0.7241624", "0.72371626", "0.71925956", "0.71833616", "0.7138064", "0.7134256", "0.71222615", "0.70847005", "0.70336866", "0.70302", "0.70281285", "0.6983747", "0.6977022", "0.6974433", "0.6964256", "0.694281", "0.6934632",...
0.68485457
79
Renders each post and determinds if the owner of the post is logged in if they are, then the private controls will display for that post.
renderPosts() { const currentUserId = this.props.currentUser && this.props.currentUser._id; return this.props.posts.map((post) => { const showPrivateControls = post.owner === currentUserId; return ( <Post key={post._id} post={post} showPrivateControls={showPrivateControls} /> ); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderPosts() {\n // assign posts object to a variable\n var posts = memory.posts;\n // loop through posts object\n for (var i = 0; i < posts.length; i++) {\n // call render method\n memory.posts[i].render();\n };\n ...
[ "0.61182576", "0.5912436", "0.58889496", "0.57879543", "0.56358844", "0.56314814", "0.5619365", "0.56162083", "0.5608769", "0.55909544", "0.55852175", "0.55669296", "0.5553776", "0.5478806", "0.547557", "0.5475503", "0.5461073", "0.5441703", "0.5427389", "0.54198253", "0.5419...
0.75782025
0
Inserts a post into the database and cleans the input field
handleSubmit(event){ event.preventDefault(); const text = ReactDOM.findDOMNode(this.refs.textInput).value.trim(); Meteor.call('posts.insert', text); ReactDOM.findDOMNode(this.refs.textInput).value = ''; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitPost(e){\n e.preventDefault();\n var title = e.target.title.value;\n var description = e.target.description.value;\n \n // form must be complete\n if (!title.length || !description.length){\n return false;\n }\n \n Posts.insert({\n title: title,\n description: description,\n cre...
[ "0.6943133", "0.6510186", "0.6506645", "0.6395315", "0.6379262", "0.63106877", "0.6303043", "0.6208591", "0.6204298", "0.60760504", "0.60700125", "0.6056233", "0.59991676", "0.59863317", "0.5946237", "0.5856076", "0.5826098", "0.57843584", "0.5774151", "0.5773466", "0.5772802...
0.6680405
1
Get a random integer less than n.
function randomInteger(n) { return Math.floor(Math.random()*n); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomInteger(n) {\n return Math.floor(Math.random()*n);\n}", "function randomInt(n) {\n return Math.floor(Math.random() * n);\n}", "function randomInt(n) {\n return Math.floor(Math.random() * n);\n}", "function randInt(n) {\n return Math.floor(Math.random() * n);\n}", "function randomInt(...
[ "0.8336875", "0.82785", "0.82785", "0.8262308", "0.8220271", "0.81919044", "0.80949336", "0.80651146", "0.80477107", "0.80191684", "0.79673153", "0.7959747", "0.7956127", "0.79488194", "0.7933998", "0.7919832", "0.7916976", "0.78993666", "0.78851384", "0.7881981", "0.7857319"...
0.8344091
0
Get a random element from an array (e.g., random_element([4,8,7]) could return 4, 8, or 7). This is useful for condition randomization.
function randomElement(array) { return array[randomInteger(array.length)]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomElement(arr) {\n return (arr[Math.floor(Math.random() * arr.length)]);\n}", "function getRandomArrayElement(array) {\n let element = array[Math.floor(Math.random() * array.length)];\n return element;\n}", "function getRandomElement(array) {\n let element = array[Math.floor(Math.random() * ...
[ "0.85733855", "0.85249805", "0.84896296", "0.8452541", "0.8452541", "0.8434571", "0.8410449", "0.83922994", "0.83855623", "0.83819765", "0.83786595", "0.8377807", "0.8369205", "0.8369205", "0.8369205", "0.8369205", "0.8356523", "0.8356523", "0.8355255", "0.8344915", "0.834251...
0.8507096
3
Processes timing of the chart, computes `tick` and `len` of each line, / and process options of each line to fill KSON data.
_setKSONFromKSHLineOps() { const beatInfo = this.beat = { 'bpm': new AATree(), 'time_sig': [], 'resolution': KSH_DEFAULT_MEASURE_TICK / 4 }; this.camera = null; const ksmMeta = this._ksmMeta; if('beat' in ksmMeta) { beatInfo.time_sig.push({'idx': 0, 'v': (new KSHTimeSig(ksmMeta.beat)).toKSON()}); } let measure_tick = 0; // Tick of the current measure being processed let time_sig = [4, 4]; // Default time signature, which is the common time signature. this._ksmMeasures.forEach((measure, measure_idx) => { if(measure.length === 0) throw new Error(L10N.t('ksh-import-error-malformed-measure', measure_idx)); // Check the timing signature of this measure. measure[0].mods.forEach(([key, value]) => { switch(key) { case 'beat': const newTimeSig = new KSHTimeSig(value); time_sig = newTimeSig.timeSig; beatInfo.time_sig.push({'idx': measure_idx, 'v': newTimeSig.toKSON()}); break; } }); const measure_len = (KSH_DEFAULT_MEASURE_TICK / time_sig[1]) * time_sig[0]; if(measure_len % measure.length != 0) throw new Error(L10N.t('ksh-import-error-invalid-measure-line-count', measure_idx)); const tick_per_line = measure_len / measure.length; measure.forEach((kshLine, line_idx) => { let tick = kshLine.tick = measure_tick + tick_per_line * line_idx; kshLine.len = tick_per_line; kshLine.mods.forEach(([key, value]) => { const intValue = parseInt(value); const floatValue = parseFloat(value); switch(key) { case 'beat': // `beat`s are already processed above. // If a `beat` is in the middle of a measure, then the chart is invalid. if(line_idx > 0) throw new Error(L10N.t('ksh-import-error-invalid-time-sig-location', measure_idx)); break; case 't': if(tick > 0) this._tryAddBPMFromMeta(); if(floatValue <= 0 || !isFinite(floatValue)) throw new Error(L10N.t('ksh-import-error-value', 't(BPM)', measure_idx)); beatInfo.bpm.add(tick, 0, floatValue); break; case 'stop': if(intValue <= 0 || !isFinite(intValue)) throw new Error(L10N.t('ksh-import-error-value', 'stop', measure_idx)); const graph = new VGraphSegment(true, {'y': tick}); graph.pushKSH(tick, 0); graph.pushKSH(tick+intValue, 0); this.addScrollSpeedSegment(graph); break; case 'zoom_bottom': this._addZoom('zoom', tick, value, measure_idx); break; case 'zoom_side': this._addZoom('shift_x', tick, value, measure_idx); break; case 'zoom_top': this._addZoom('rotation_x', tick, value, measure_idx); break; } }); }); measure_tick += measure_len; }); // Add one to BPM if there's no BPM change this._tryAddBPMFromMeta(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function redrawTics() {\n while (_tickSet.length) {\n _tickSet.splice(0, 1)[0].remove();\n }\n var resolution = getResolution();\n if (resolution) {\n var begin = getStartTime();\n var end = getEndTime();\n var ...
[ "0.5970592", "0.58104146", "0.5777774", "0.5767043", "0.57585514", "0.5732503", "0.56858045", "0.56772625", "0.5603378", "0.5581773", "0.55628914", "0.5534295", "0.5530951", "0.55201536", "0.55201536", "0.5517782", "0.5407784", "0.5373382", "0.535156", "0.53411275", "0.533298...
0.50656927
50
Processes notes and lasers
_setKSONNoteInfo() { // Stores [start, len] long note infos let longInfo = {'bt': [null, null, null, null], 'fx': [null, null]}; // Stores [start, effect] FX audio effects let fxAudioEffects = [null, null]; NOP(fxAudioEffects); const cutLongNote = (type, lane) => { const lit = longInfo[type]; if(lit[lane] === null) return; const result = this.addNote(type, lane, lit[lane][0], lit[lane][1]); if(!result[0]){ throw new Error(`Invalid ksh long notes! (${result[1].y} and ${lit[lane][0]} at ${lane} collides)`); } lit[lane] = null; }; const addLongInfo = (type, lane, y, l) => { const lit = longInfo[type]; if(lit[lane] === null) lit[lane] = [y, 0]; if(lit[lane][0] + lit[lane][1] != y) { throw new Error("Invalid ksh long notes!"); } lit[lane][1] += l; }; // Stores current laser segments and how wide should they be let laserSegments = [null, null]; let laserWide = [1, 1]; const cutLaserSegment = (lane) => { if(laserSegments[lane] === null) return; this.addLaserSegment(lane, laserSegments[lane]); laserSegments[lane] = null; laserWide[lane] = 1; }; const addLaserSegment = (lane, y, v) => { if(laserSegments[lane] === null) laserSegments[lane] = new VGraphSegment(true, {'y': y, 'wide': laserWide[lane]}); laserSegments[lane].pushKSH(y, v, true); }; this._ksmMeasures.forEach((measure) => { measure.forEach((kshLine) => { kshLine.mods.forEach(([key, value]) => { switch(key) { case 'laserrange_l': laserWide[0] = value === "2x" ? 2 : 1; break; case 'laserrange_r': laserWide[1] = value === "2x" ? 2 : 1; break; } }); // BT for(let i=0; i<4; i++) { const c = kshLine.bt[i]; if(c === '0' || c === '1') cutLongNote('bt', i); if(c === '0') continue; if(c === '1') { // Single short note this.addNote('bt', i, kshLine.tick, 0); continue; } addLongInfo('bt', i, kshLine.tick, kshLine.len); } // FX for(let i=0; i<2; i++) { const c = kshLine.fx[i]; if(c === '0' || c === '2') cutLongNote('fx', i); if(c === '0') continue; if(c === '2') { // Single short note this.addNote('fx', i, kshLine.tick, 0) continue; } addLongInfo('fx', i, kshLine.tick, kshLine.len); } // Laser for(let i=0; i<2; i++) { const c = kshLine.laser[i]; if(c === '-') { cutLaserSegment(i); continue; } if(c === ':') continue; const pos = KSH_LASER_VALUES.indexOf(c); if(pos === -1) throw new Error(L10N.t('ksh-import-error-invalid-laser-pos')); addLaserSegment(i, kshLine.tick, pos/50); } }); }); for(let i=0; i<4; ++i) cutLongNote('bt', i); for(let i=0; i<2; ++i) cutLongNote('fx', i); for(let i=0; i<2; ++i) cutLaserSegment(i); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handler(argv){\n notes.readNotes(argv.title);\n }", "function finalizeNote() {\r\n if (mel.type === \"melody\" || mel.type === \"gracenote\") {\r\n var note = mel.staffPosition.substring(0,1); // Staff position never has sharps or flats.\r\n var midiOffset = +mel.staffPosition.substring(1)...
[ "0.64432204", "0.62573844", "0.6165978", "0.61649865", "0.6024055", "0.591221", "0.59023476", "0.58964986", "0.57996017", "0.57819235", "0.574111", "0.57077485", "0.56834257", "0.5679101", "0.56342435", "0.56235874", "0.56201786", "0.5605617", "0.559981", "0.55837286", "0.556...
0.5744305
10
drop down menu of percentage for event tips
function eventTipSelector() { var a = document.getElementById("eventTipPercentage").value; var b = document.getElementById("eventTipConfirm"); if(isNaN(a)) {b.innerHTML = "Nothing selected yet"} else { eventTipPercentage = parseInt(a); b.innerHTML = "Event tip percentage will be considered to be " + eventTipPercentage +"%"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function populateTotalPercent(e, a) {\n if (\"carb\" == a) l = e + parseInt($(\"#protein_slider\").slider(\"value\")) + parseInt($(\"#fat_slider\").slider(\"value\"));\n else if (\"protein\" == a) l = e + parseInt($(\"#carb_slider\").slider(\"value\")) + parseInt($(\"#fat_slider\").slider(\"value\"));\n e...
[ "0.5988597", "0.5934374", "0.59144807", "0.5864045", "0.58455", "0.583954", "0.575667", "0.5741157", "0.56496006", "0.5545232", "0.5451211", "0.54364514", "0.5421094", "0.54173905", "0.54120904", "0.5395018", "0.5392512", "0.5386217", "0.5378401", "0.53758323", "0.5373406", ...
0.6684503
0
drop down menu of number of servers
function numberOfServersSelector() { var a = document.getElementById("numberOfServers").value; var b = document.getElementById("numberOfServersConfirm"); if (isNaN(a)) {b.innerHTML = "Nothing selecteed yet"} else { numberOfServers = parseInt(a); b.innerHTML = "All the tips will be devided for " + numberOfServers + " servers"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setNumServers(num)\r\n{\r\n\tnumServers = num;\r\n}", "function getServersList() {\n if (window.sos && window.sos.length > 0) {\n var selectSrv = document.getElementById('server-select');\n for (var i = 0; i < sos.length; i++) {\n var s...
[ "0.6775951", "0.6555574", "0.6059328", "0.5746349", "0.57424957", "0.57357484", "0.57013327", "0.5697189", "0.56877404", "0.5594743", "0.55696267", "0.5562885", "0.55440336", "0.5468198", "0.5442957", "0.54289705", "0.5403478", "0.5400283", "0.5398301", "0.5358565", "0.53509"...
0.7307066
0
radio selector if the foodrunner is present. Returns boolean
function foodRunnerSelector() { if (document.getElementById("foodRunnerYes").checked == true) { doTipFoodRunner = true; document.getElementById("foodRunnerConfirm").innerHTML = "Food Runner will be tipped out";} else { doTipFoodRunner = false; document.getElementById("foodRunnerConfirm").innerHTML = "No tip out for Food Runner"; } return doTipFoodRunner }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isRowSelectedForAppointment(){\n var radiosDonation = document.getElementsByClassName(\"appointRadios\");\n for(var i = 0; i<radiosDonation.length;i++){\n if(radiosDonation[i].type === \"radio\" && radiosDonation[i].checked){\n return true;\n }\n\n }\n return false;\n}", "function ch...
[ "0.6002308", "0.58931744", "0.5828521", "0.5742646", "0.56536764", "0.56038046", "0.55680037", "0.55601436", "0.55237365", "0.55095124", "0.5492015", "0.54885876", "0.54846436", "0.5467631", "0.54601717", "0.54254055", "0.53941625", "0.5364086", "0.5344296", "0.5340759", "0.5...
0.6645744
0
sets pageCounter to 1 and clears all fields
function resetForm() { pageCounter = 1; displayPage(pageCounter); clearFields(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetPageCounter() {\n self.pagesLoaded = 0;\n self.newUpdatesApplied = 0;\n self.uncountedPosts = [];\n self.countedPosts = [];\n }", "function ClearFields() { }", "function clearPage(){\n\t\t$('#home,#subject,#schedule,#course,#...
[ "0.7346087", "0.6599753", "0.65950984", "0.65709454", "0.6534599", "0.65146196", "0.6491995", "0.6454822", "0.6358031", "0.63314384", "0.6330404", "0.6313117", "0.6299537", "0.6282907", "0.62757623", "0.6265143", "0.62592965", "0.6256452", "0.62539184", "0.6234725", "0.621137...
0.7095952
1
populate fields with checks[]
function displayCheck(x) { if (checks[x].netSales != 0) {document.getElementById("net-sales").value = checks[x].netSales} if (checks[x].autoGrat != 0) {document.getElementById("20-auto-grat").value = checks[x].autoGrat} if (checks[x].eventAutoGrat != 0) {document.getElementById("event-auto-grat").value = checks[x].eventAutoGrat} if (checks[x].chargeTip != 0) {document.getElementById("charge-tip").value = checks[x].chargeTip} if (checks[x].liquor != 0) {document.getElementById("liquor").value = checks[x].liquor} if (checks[x].beer != 0) {document.getElementById("beer").value = checks[x].beer} if (checks[x].wine != 0) {document.getElementById("wine").value = checks[x].wine} if (checks[x].food != 0) {document.getElementById("food").value = checks[x].food} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "fill(data, fields, fieldCheck) {\n const props = {};\n const doFieldCheck = typeof fieldCheck === 'function';\n\n fields = Array.isArray(fields) ? fields : Object.keys(data);\n\n fields.forEach((propKey) => {\n if (\n !Object.prototype.hasOwnProperty.call(this.getDefinitions(), ...
[ "0.6637967", "0.60895", "0.59596807", "0.58211315", "0.58048826", "0.578786", "0.5741759", "0.5701214", "0.5592482", "0.5536913", "0.5534224", "0.5506523", "0.5474426", "0.54661673", "0.5407057", "0.53772634", "0.53539664", "0.5326372", "0.531901", "0.5309907", "0.53089356", ...
0.50731343
32
set all fields to empty
function clearFields () { document.getElementById("net-sales").value = ""; document.getElementById("20-auto-grat").value = ""; document.getElementById("event-auto-grat").value = ""; document.getElementById("charge-tip").value = ""; document.getElementById("liquor").value = ""; document.getElementById("beer").value = ""; document.getElementById("wine").value = ""; document.getElementById("food").value = ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ClearFields() {\r\n self.model.code = \"\";\r\n self.model.name = \"\";\r\n self.model.address = \"\";\r\n }", "function clearFields() {\n employeeId.value = \"\";\n firstName.value = \"\";\n lastName.value = \"\";\n address.value = \"\";\n emailId.value = \"\";\n}", "function c...
[ "0.809602", "0.8052918", "0.7952798", "0.77728623", "0.7748216", "0.77035815", "0.76450276", "0.7630688", "0.757368", "0.7529788", "0.7529725", "0.7504444", "0.74412733", "0.74340826", "0.7410372", "0.74059653", "0.73902875", "0.7360029", "0.7359907", "0.7325422", "0.7293635"...
0.7007942
38
checking if all the fields are empty
function allFieldsAreEmpty() { if ( document.getElementById("net-sales").value == "" && document.getElementById("20-auto-grat").value == "" && document.getElementById("event-auto-grat").value == "" && document.getElementById("charge-tip").value == "" && document.getElementById("liquor").value == "" && document.getElementById("beer").value == "" && document.getElementById("wine").value == "" && document.getElementById("food").value == "" ){ return true } else { return false } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function empty(quote,fields){\n\t\t\tfor(var i=0;i<fields.length;i++){\n\t\t\t\tvar val=quote[fields[i]];\n\t\t\t\tif(typeof val!=\"undefined\") return false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}", "function noFieldsEmpty(_formData) {\n for (let entry of _formData) {\n if (entry[1] == \"\") {\n ...
[ "0.77111256", "0.7642614", "0.7631739", "0.75279725", "0.75074136", "0.75000507", "0.74902284", "0.7412057", "0.73563254", "0.73508334", "0.73485833", "0.72842026", "0.72627026", "0.7204684", "0.7203069", "0.7171592", "0.7144768", "0.7129393", "0.7107099", "0.70860183", "0.70...
0.8069356
0
this fuction concatinates the numbers as they are entered.
function inputNum(evt){ //have one event on the parent that listens to all the children. The if statement stops the even firing if the parent element is clicked. num += evt.target.id; screen.value = num; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "appendNumber(number) {\r\n //prevents user from inputing multiple decimals in a row\r\n if (number === '.' && this.currentOperand.includes('.')) return\r\n this.currentOperand = this.currentOperand.toString() + number.toString()\r\n }", "function addNumberToPhoneNumber(num) {\n var phoneNumberStr = ...
[ "0.67407644", "0.6726696", "0.6695815", "0.66928864", "0.6689175", "0.66229326", "0.65792966", "0.6569793", "0.6551772", "0.6513389", "0.6499691", "0.64979035", "0.64514065", "0.6443353", "0.643137", "0.6395784", "0.63760275", "0.6349196", "0.634494", "0.6328758", "0.630479",...
0.0
-1