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
Below is shorter than mine and I agree that fitler was the best choice here, I just have to get more practice with using it.
function inArray(array1,array2){ return array1 .filter(a1 => array2.find(a2 => a2.match(a1))) .sort() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "function Yielder() {}", "static private internal function m121() {}", "function FlexibleFit() { }", "function solution(s) {\n\n}", "private public function m246() {}", "function __it() {}", "protected internal function m252() {}", "function fm(){}", "functio...
[ "0.50775063", "0.5036577", "0.5016411", "0.49850008", "0.49510214", "0.49310315", "0.48662686", "0.48104197", "0.47782534", "0.46596715", "0.46107498", "0.45924652", "0.45824096", "0.45720887", "0.45601064", "0.4550552", "0.45462728", "0.45362335", "0.4532455", "0.4528863", "...
0.0
-1
import Navbar from 'reactbootstrap/Navbar';
function Nav() { return( <> <nav className="navbar navbar-light bg-dark fixed-top"> <div className="container-fluid"> <a className="navbar-brand text-light" href="/">Developer-Test-Store</a> <div className="row justify-content-right"> <a className="navbar-brand text-light" href="/">Products</a> <a className="navbar-brand text-light" href="/categories">Categories</a> </div> </div> </nav> </> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n return (\n <div className='App'>\n <Navbar />\n </div>\n );\n }", "render() {\n return (\n <div>\n <header> \n <Navbar bg=\"dark\" variant=\"dark\"> \n <Nav c...
[ "0.7574704", "0.72867864", "0.72753584", "0.72650176", "0.7221066", "0.7161922", "0.710931", "0.7108536", "0.70584536", "0.69817495", "0.6935683", "0.69043756", "0.6842977", "0.6838281", "0.6782988", "0.67531633", "0.6753085", "0.6742975", "0.6739962", "0.6706001", "0.6695698...
0.64562106
32
Creates the node for the load command. Only used in browser envs.
function createNode() { // possibly support non-default namespace one day // var node = config.xhtml ? // document.createElementNS('http:// www.w3.org/1999/xhtml', 'html:script') : var node = document.createElement('script'); node.type = 'text/javascript'; node.charset = 'utf-8'; node.async = true; return node; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createLoad(name) {\n return {\n status: 'loading',\n name: name,\n linkSets: [],\n dependencies: [],\n metadata: {}\n };\n }", "function createLoad(name) {\n return {\n status: 'loading',\n name: name,\n linkSets: [],\n dependencies: [],\n meta...
[ "0.6463373", "0.6463373", "0.6463373", "0.6463373", "0.6396235", "0.6208431", "0.6208431", "0.61686385", "0.5898135", "0.58493215", "0.584504", "0.5740517", "0.5690909", "0.56655496", "0.54533696", "0.53649753", "0.5343712", "0.5343416", "0.5331778", "0.5330166", "0.5326849",...
0.53963375
15
Ex 0 / Reverse the provided string. You may need to turn the string into an array before you can reverse it. Your result must be a string.
function reverseStringV1 (str) { let arr = Array.from(str) // let arr = str.split(""); let rev = arr.reverse() let ch = rev.join('') return ch // return str.split('').reverse().join(''); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reverse(str) {\n //Converting the String \"str\" to an Array\n const arr = str.split('');\n //Using the reverse method to reverse the array\n arr.reverse();\n //Converting my array to String and returning it\n return arr.join('');\n\n //Putting all in one line\n //return str.slipt(...
[ "0.84197515", "0.83806205", "0.8307619", "0.82774156", "0.8234677", "0.8217052", "0.8216617", "0.8197752", "0.8189089", "0.8187736", "0.81866586", "0.8180676", "0.8155014", "0.81548244", "0.8142365", "0.8133988", "0.8114163", "0.8110471", "0.8102882", "0.8100019", "0.8096203"...
0.81171125
16
Here do the same thing but don't use builtin functions such as split/reverse/join
function reverseStringV2 (str) { let reversedStr = '' for (let i = str.length - 1; i >= 0; i--) { reversedStr += str[i] } return reversedStr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FirstReverse(str) { \n\n // code goes here \n var splitString = str.split(\"\");\n var reverseArray = splitString.reverse();\n var joinArray = reverseArray.join(\"\");\n console.log(joinArray); \n}", "function FirstReverse(str) {\n\n let splitString = str.split(\"\");\n\n let reverseA...
[ "0.6936928", "0.6805723", "0.6733589", "0.6699681", "0.66712517", "0.6573601", "0.6434512", "0.630461", "0.6278671", "0.62104905", "0.6207881", "0.6196398", "0.6139632", "0.6103311", "0.6094067", "0.60817295", "0.6071633", "0.60654265", "0.6060504", "0.60580415", "0.602799", ...
0.0
-1
Ex 1 / Factorialize a Number Return the factorial of the provided integer. If the integer is represented with the letter n, a factorial is the product of all positive integers less than or equal to n. Factorials are often represented with the shorthand notation n! For example: 5! = 1 2 3 4 5 = 120
function factorialize (num) { let res = 1 for (let i = 1; i <= num; i++) { res = res * i } return res }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function factorial(num) {\n \n}", "function factorial(n) {\r\n\tif (n < 0) throw new Error(`Input value ${n} is not a positive integer.`);\r\n\r\n\tif (n <= 1) return 1;\r\n\treturn n * factorial(n - 1);\r\n}", "function factorial(num){\n let factoid=1;\n for(let i=1;i<=num;i++){\n factoid*=i;\n }\n re...
[ "0.7895528", "0.78842515", "0.7836954", "0.78028893", "0.77931243", "0.77931243", "0.77771443", "0.77540714", "0.77467966", "0.77179176", "0.77070737", "0.7676866", "0.76739675", "0.7672325", "0.7647309", "0.76267666", "0.76221323", "0.76209503", "0.7619278", "0.75968367", "0...
0.0
-1
Ex 2 / Check for Palindromes Return true if the given string is a palindrome. Otherwise, return false. A palindrome is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing. Note You'll need to remove all nonalphanumeric characters (punctuation, spaces and symbols) and turn everything lower case in order to check for palindromes. We'll pass strings with varying formats, such as "racecar", "RaceCar", and "race CAR" among others. We'll also pass strings with special symbols, such as "2A33a2", "2A3 3a2", and "2_A33A2".
function palindrome (str) { let arrayContent = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] str = str.toLowerCase() let cleanStr = '' for (let i = 0; i < str.length; i++) { if (arrayContent.includes(str[i])) { cleanStr = cleanStr + str[i] } } if (cleanStr.length % 2 === 0) { return cleanStr.slice(0, (cleanStr.length / 2)) === reverseStringV1(cleanStr.slice((cleanStr.length / 2))) } else { return cleanStr.slice(0, Math.floor(cleanStr.length / 2)) === reverseStringV1(cleanStr.slice(Math.floor(cleanStr.length / 2) + 1)) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isPalindrome(str) {\n var re = /[^A-Za-z0-9]/g; //set up our regular expression that will do a global(g modifier) search for the character-span that is not from A-Z, a-z, and 0-9;\n var myString = str.toLowerCase().replace(re, \"\"); ...
[ "0.85582453", "0.8499803", "0.8476394", "0.84268546", "0.8401895", "0.8380399", "0.83791244", "0.83414763", "0.8333665", "0.8312009", "0.8311958", "0.8306624", "0.8300757", "0.82990557", "0.829882", "0.82949376", "0.8280682", "0.8280218", "0.82729506", "0.82607555", "0.824599...
0.0
-1
Ex 3 / Find the Longest Word in a String Return the length of the longest word in the provided sentence. Your response should be a number.
function findLongestWord (str) { let arr = str.split(' ') let longest = 0 for (let i = 0; i < arr.length; i++) { let count = 0 for (let j = 0; j < arr[i].length; j++) { count += 1 } if (count > longest) { longest = count } } return longest }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findLongestWord(sentence) {\n var sentence = sentence.split(\" \");\n var longest = 0;\n var word = null;\n for (var i = 0; i < sentence.length; i++) {\n if (longest < sentence[i].length) {\n longest = sentence[i].length;\n word = sentence[i];\n }\n ...
[ "0.8596956", "0.8555403", "0.8507296", "0.8440276", "0.8353465", "0.8318026", "0.83174074", "0.82978576", "0.8295553", "0.82701707", "0.8249883", "0.8241802", "0.823803", "0.82359034", "0.8228128", "0.82202744", "0.8216959", "0.8209909", "0.81926453", "0.8188766", "0.8184937"...
0.79588896
79
Ex 4 / Title Case a Sentence Return the provided string with the first letter of each word capitalized. Make sure the rest of the word is in lower case. For the purpose of this exercise, you should also capitalize connecting words like "the" and "of".
function titleCase (str) { let arr = str.toLowerCase().split(' ') let newArr = '' for (let i = 0; i < arr.length; i++) { let firstLetter = arr[i].slice(0, 1).toUpperCase() + arr[i].slice(1) newArr = newArr + firstLetter + ' ' } return newArr.trim() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "titleCase(string) {\n var sentence = string.toLowerCase().split(\" \");\n for(var i = 0; i< sentence.length; i++){\n sentence[i] = sentence[i][0].toUpperCase() + sentence[i].slice(1);\n }\n \n return sentence.join(\" \");\n }", "function titleCase(str) {\n st...
[ "0.85267705", "0.8517243", "0.8490264", "0.84871775", "0.8459997", "0.84541184", "0.8403817", "0.83975506", "0.83973503", "0.8391904", "0.83748657", "0.8374147", "0.83352643", "0.83094126", "0.830148", "0.82898086", "0.828213", "0.82743555", "0.8262995", "0.8260741", "0.82533...
0.7919026
73
Ex 5 / Return Largest Numbers in Arrays Return an array consisting of the largest number from each provided subarray. For simplicity, the provided array will contain exactly 4 subarrays. Remember, you can iterate through an array with a simple for loop, and access each member with array syntax arr[i].
function largestOfFour (arr) { let max = 0 let newArr = [] for (let j = 0; j < arr.length; j++) { for (let i = 0; i < arr[j].length; i++) { max = Math.max(...arr[j]) } newArr.push(max) } return newArr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function largestNumbersInSubarrays(arr) {\n\tlet maxArr = [];\n\tlet maxInside;\n\tfor(let i = 0; i<arr.length; i++) {\n\t\tmaxInside = arr[i][0];\n\t\tfor (let j = 0; j <arr[i].length; j++) {\n\t\t\tif (arr[i][j] > maxInside) {\n\t\t\t\tmaxInside = arr[i][j];\n\t\t\t}\n\t\t}\n\t\tmaxArr.push(maxInside);\n\t}\n\tr...
[ "0.8440752", "0.83137864", "0.82692146", "0.8266082", "0.821996", "0.8159395", "0.81449896", "0.81107646", "0.8063243", "0.8042946", "0.80196923", "0.80047697", "0.7999619", "0.79989374", "0.79742384", "0.7936478", "0.79076487", "0.78139174", "0.7740464", "0.7721298", "0.7693...
0.80063057
11
Ex 6 / Confirm the Ending Check if a string (first argument, str) ends with the given target string (second argument, target). This challenge can be solved with the .endsWith() method, which was introduced in ES2015. But for the purpose of this challenge, we would like you to use one of the JavaScript substring methods instead.
function confirmEnding (str, target) { let lastStr = str.slice(str.length - target.length, str.length) if (lastStr === target) { return true } else { return false } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function confirmEnding(str, target) {\n \n // measure length of target string\n let lenTarget = target.length;\n \n // check end of str using negative indexing on str.slice()\n let strSuffix = str.slice(-lenTarget);\n \n // compare suffix with target\n let result = (target == strSuffix);\n \n return res...
[ "0.8738028", "0.8713429", "0.8579612", "0.8487478", "0.8469123", "0.844286", "0.8441608", "0.8430654", "0.84296525", "0.8413294", "0.84105724", "0.8393849", "0.83920944", "0.83904123", "0.83904123", "0.83882487", "0.8374283", "0.8355896", "0.835332", "0.8347993", "0.8346443",...
0.8368271
17
Ex 7 / Repeat a string repeat a string Repeat a given string (first argument) num times (second argument). Return an empty string if num is not a positive number.
function repeatStringNumTimes (str, num) { let newStr = '' for (let i = 0; i < num; i++) { newStr = newStr + str } return newStr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function repeatSringNumTimes(str,num){\n if (num > 0) {\n return str.repeat(num);\n }\n return \"\";\n}", "function repeat(str, num) {\n if (num <= 0) {\n return \"\";\n } else {\n var newstr = \"\";\n for (var i = 0; i < num; i++) {\n newstr += str;\n }\n return newstr;\n ...
[ "0.8472904", "0.8361478", "0.83294964", "0.8310346", "0.83056664", "0.82690465", "0.8261949", "0.8256452", "0.8241708", "0.82251453", "0.82233185", "0.8215021", "0.82065946", "0.8156109", "0.8150364", "0.8149992", "0.81448233", "0.81443745", "0.81236327", "0.8117692", "0.8114...
0.76778674
55
Ex 8 / Truncate a string Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a ... ending. Note that inserting the three dots to the end will add to the string length. However, if the given maximum string length num is less than or equal to 3, then the addition of the three dots does not add to the string length in determining the truncated string.
function truncateString (str, num) { if (str.length > num && num > 3) { let trunc = str.substring(0, num) let dots = trunc.substring(trunc.length - 3) let newStr = trunc.replace(dots, '...') return newStr } else if (num < 3) { let trunc = str.substring(0, num) let newStr = trunc + '...' return newStr } else if (str.length <= num) { let newStr = str return newStr } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function truncate(str, max) {\n if (max === void 0) { max = 0; }\n if (typeof str !== 'string' || max === 0) {\n return str;\n }\n return str.length <= max ? str : str.substr(0, max) + \"...\";\n}", "function truncate(str, max) {\n if (max === void 0) { max = 0; }\n if (typeof str !== 's...
[ "0.8449632", "0.8449632", "0.8449632", "0.8433319", "0.8354587", "0.82622033", "0.8210034", "0.8193502", "0.81392825", "0.78985673", "0.7869923", "0.7825252", "0.7822909", "0.7810505", "0.7810296", "0.7809014", "0.7798354", "0.7784738", "0.77702546", "0.7765607", "0.7763584",...
0.767676
32
Ex 9 / Chunky Monkey Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a twodimensional array.
function chunkArrayInGroups (arr, size) { let arr1 = [] for (let i = 0; i < arr.length; i += size) { arr1.push(arr.slice(i, size + i)) } return arr1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function chunkArrayInGroups(arr, size) {\r\n // Break it up.\r\n return arr;\r\n}", "chunk (array, size) {\n if(size == null){\n size = 1;\n }\n const arrayChuncks = [];\n for(let i = 0; i<array.length; i+=size) {\n const arrayChunck = array.slice(i, i+size);\n arrayChuncks.push(...
[ "0.81056654", "0.78983593", "0.7896494", "0.7881584", "0.787274", "0.7871154", "0.78525484", "0.78411543", "0.7820479", "0.7802537", "0.7801744", "0.7784003", "0.7765801", "0.77555037", "0.77515525", "0.7739781", "0.77260643", "0.77249455", "0.77232313", "0.7719583", "0.77187...
0.77527374
14
Ex 10 / Slasher Flick Return the remaining elements of an array after chopping off n elements from the head. The head means the beginning of the array, or the zeroth index.
function slasher (arr, howMany) { return arr.slice(howMany) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function func4(arr, n = 1) {\r\n return arr.slice(-n);\r\n}", "function dropRight(array,n)\n{\n var arr=array.slice(n);\n console.log(arr);\n}", "function slasher(arr, howMany) {\n return arr.slice(howMany);\n}", "function slasher(arr, howMany) {\n //return the sliced portion of the original array\n...
[ "0.75836873", "0.7449873", "0.7419474", "0.73643845", "0.7332429", "0.7218411", "0.718737", "0.7184658", "0.71715087", "0.71284235", "0.7078722", "0.70740616", "0.70040524", "0.69304514", "0.69022286", "0.68920976", "0.6859935", "0.6859611", "0.6859611", "0.6859611", "0.68596...
0.7487762
1
Ex 11 / Mutations Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array. For example, ["hello", "Hello"], should return true because all of the letters in the second string are present in the first, ignoring case. The arguments ["hello", "hey"] should return false because the string "hello" does not contain a "y". Lastly, ["Alien", "line"], should return true because all of the letters in "line" are present in "Alien".
function includes (ch, c) { return ch.indexOf(c) >= 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mutation(arr) {\n // Mutating both to be lowercase \n arr[0] = arr[0].toLowerCase();\n arr[1] = arr[1].toLowerCase();\n // Setting return boolean value to true\n var allLettersPresent = true;\n // Iterating through second string in arr \n for (var i = 0; i < arr[1].length; i++){\n ...
[ "0.8394775", "0.8043906", "0.80434185", "0.79710066", "0.7970525", "0.7885769", "0.7877647", "0.7870691", "0.78697646", "0.78562796", "0.7853273", "0.7805434", "0.7803319", "0.7791246", "0.7762003", "0.77543473", "0.7750586", "0.7721394", "0.7705579", "0.7684291", "0.7673046"...
0.0
-1
Hello, Again. 3 points.
function helloAgain() { //////////// DO NOT MODIFY let name; // DO NOT MODIFY //////////// DO NOT MODIFY // Use the name variable declared above to store the user's response. You // do not need to re-declare it, only assign it a value. var op2 = document.getElementById("output2"); name = prompt('Please enter your name.'); op2.innerHTML = ("Hello, " + name + "!") ///////////////////////////// DO NOT MODIFY check("helloAgain", name); // DO NOT MODIFY ///////////////////////////// DO NOT MODIFY }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function greet3(firstName, lastName){\n return 'Hello ' + firstName + ' ' + lastName;\n }", "function greet3(subject){\n console.log(\"Hallo \" + subject)\n}", "function greetings() {\n\n \n}", "function greeter02(name) {\n return \"Hello, \" + name;\n}", "function hello() {\n //3\n cons...
[ "0.71918535", "0.70185", "0.6716156", "0.67001927", "0.6659316", "0.661601", "0.6569464", "0.65511495", "0.65316725", "0.6501679", "0.64933133", "0.6489391", "0.64846075", "0.64652216", "0.6457198", "0.6449079", "0.6447766", "0.6436074", "0.6429105", "0.6423392", "0.6413758",...
0.0
-1
Fluid Ounces. 5 points.
function fluidOunces() { /////////////////////////////////////////////////////// DO NOT MODIFY let input = prompt("Enter a non-negative integer."); // DO NOT MODIFY /////////////////////////////////////////////////////// DO NOT MODIFY // You are free to modify the value of fluidOunces, which you'll // likely need to do. Please do not modify the value of input. /////////////////////////// DO NOT MODIFY let fluidOunces = input; // DO NOT MODIFY /////////////////////////// DO NOT MODIFY let br = "</br>"; let gallon = Math.floor(fluidOunces / 128); let quart = Math.floor(fluidOunces % 128 / 32); let pint = Math.floor(fluidOunces % 128 % 32 / 16); let cup = Math.floor(fluidOunces % 128 % 32 % 16 / 8); let fluidOunce = Math.floor(fluidOunces % 128 % 32 % 16 % 8); var op7 = document.getElementById("output7"); op7.innerHTML = (`Gallons: ${gallon}${br}Quarts: ${quart}${br}Pints: ${pint}${br}Cups: ${cup}${br}Fluid Ounces: ${fluidOunce}`); /////////////////////////////// DO NOT MODIFY check("fluidOunces", input); // DO NOT MODIFY /////////////////////////////// DO NOT MODIFY }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "fView(xnp) {\n let X = Math.sqrt(Math.pow(this.heigthFireBall(), 2) + Math.pow(xnp, 2))\n return Math.pow((this.diameterMax() / 2) / (X), 2)\n }", "Fv(){\n return this.shearReinf ? Math.min(3*Math.pow(this.fm,0.5),150) : Math.min(Math.pow(this.fm,0.5),50)\n }", "function fifthX(x,y) {\n\tretur...
[ "0.62954503", "0.6213731", "0.6059805", "0.59577185", "0.59485763", "0.5938178", "0.59336513", "0.5906473", "0.58304656", "0.57069945", "0.5626787", "0.560751", "0.55974877", "0.55937105", "0.5551884", "0.5507295", "0.5505068", "0.5489538", "0.5481134", "0.54630136", "0.54443...
0.0
-1
this is the end of the big function function to populate current weather
function populateCurrent(data) { //console.log(data); // show current data on the index.html cityName.text("Current City: " + currentCityPull); todayDate.text("Today's Date: " + myDate); currentDesc.text("Current Conditions: " + data.current.weather[0].description); currentTemp.text("Current Temp: " + data.current.temp + "F"); currentWind.text("Current Wind: " + data.current.wind_speed + " MPH"); currentHumidity.text("Current Humidity: " + data.current.humidity + "%"); currentUiv.text("Current UV Index: " + data.current.uvi) // This makes the color of the UV Index adjust with the severity //TODO How do I add also make the text white with the green and red background if (data.current.uvi <= 3.0) { $("#current-uvi").css("background-color", "LightGreen"); } else if (data.current.uvi > 3.0 && data.current.uvi < 6.5) { $("#current-uvi").css("background-color", "yellow"); } else if (data.current.uvi >= 6.5) { $("#current-uvi").css("background-color", "Red"); }; // populate the 5-day forecast let forecastDay = data.daily; fiveDayList.innerHTML = ""; console.log(forecastDay); for (let i = 0; i < 5; i++) { //const dailyData = forecastDay[i]; //console.log(dailyData); // console.log("date day " + i + " " + data.daily[i].dt); // console.log("outlook day " + i + " " + data.daily[i].weather[0].description); // console.log("humid day " + i + " " + data.daily[i].humidity); // console.log("hi day " + i + " " + data.daily[i].temp.max); // console.log("low day " + i + " " + data.daily[i].temp.min); // console.log("wind day " + i + " " + data.daily[i].wind_speed); var card = document.createElement('div'); var cardDate = document.createElement('h4'); var cardDesc = document.createElement('p'); var cardHumid = document.createElement('p'); var cardTempHi = document.createElement('p'); var cardTempLo = document.createElement('p'); var cardWind = document.createElement('p'); function convertFiveDate(data) { currentDate = data.daily[i].dt // from https://www.epochconverter.com/programming/#javascript fiveDateFull = new Date(currentDate * 1000); console.log("5day human date: " + fiveDateFull); //console.log("type of: " + typeof fiveDateFull); let fiveDateString = JSON.stringify(fiveDateFull); console.log(fiveDateString); //console.log("string? " + typeof fiveDateString); fiveDate = fiveDateString.substring(1, 11) }; convertFiveDate(data) cardDate.innerText = fiveDate; cardDesc.innerText = data.daily[i].weather[0].description; cardHumid.innerText = "humidity: " + data.daily[i].humidity; cardTempHi.innerText = "Hi Temp: " + data.daily[i].temp.max; cardTempLo.innerText = "Lo Temp: " + data.daily[i].temp.min; cardWind.innerText = "Wind: " + data.daily[i].wind_speed; card.append(cardDate); card.append(cardDesc); card.append(cardHumid); card.append(cardTempHi); card.append(cardTempLo); card.append(cardWind); fiveDayList.append(card); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateWeather() {\n\t\tconsole.log('updating weather data...')\n\t\tgetLocation();\n\t}", "function updateWeather() {\n\t//log (\"updateWeather ()\");\n\t\n\tif (globalWeather == \"\") return;\n\tsuppressUpdates();\n\t\n\ttry\n\t{\n\t\tvar modTemp = 'f';\n\t\tvar modSpeed = 'mph';\n\t\tvar modDistance =...
[ "0.72903645", "0.7265643", "0.7233492", "0.7020837", "0.7020013", "0.70158696", "0.70082086", "0.6995609", "0.69500273", "0.6912224", "0.6909978", "0.69045347", "0.68831104", "0.68814534", "0.68717295", "0.68698066", "0.6867364", "0.68644994", "0.68620974", "0.6844424", "0.68...
0.0
-1
this is the end of the populate function converts current UNIX date to a human date TODO refactor later to make this better
function convertCurrentDate(data) { currentDate = data.current.dt // from https://www.epochconverter.com/programming/#javascript myDate = new Date(currentDate * 1000); console.log("Current human date: " + myDate); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "makeLocalFromDateObject(date) {\n var ret = this.dateStrings(date)\n return ret.day + \".\" + ret.month + \".\" + ret.year\n }", "function initializeCurrentDate(){\n\tcurrentYear=d.getFullYear();\n\tcurrentMonth=d.getMonth();\t\n\ttodaysYear=d.getFullYear();\n\ttodaysMonth=d.getMonth();\n\ttodaysDate=d.ge...
[ "0.6503499", "0.61823666", "0.61580974", "0.6137942", "0.6137503", "0.60819876", "0.6032699", "0.6019192", "0.59811425", "0.5974274", "0.5959023", "0.59450924", "0.59008026", "0.58940315", "0.58665204", "0.58582824", "0.58350676", "0.5816454", "0.579807", "0.5794389", "0.5790...
0.693229
0
Get product data for alt metal 1
function altMetal1Ajax(data) { var product = data.product; altMetal1Data.id = product.id; altMetal1Data.title = product.title; altMetal1Data.url = '/products/' + product.handle; altMetal1Data.price = product.price; altMetal1Data.firstImage = product.images[0].src; altMetal1Data.bodyImage = product.images[1].src; $.each(product.images, function(key, val) { // Check for on-body shot if (val.alt == 'on-body-shot') { altMetal1Data.bodyImage = key.src; } }); // After altMetal1Ajax, call altMetal2Ajax $.ajax({ type: "GET", url: window.location.protocol + '//' + window.location.hostname + '/products/' + altMetal2ProductHandle + '.json', data: data, dataType: "json" }).done(function(data) { altMetal2hasData = true; altMetal2Ajax(data); }) .fail(function() { altMetal2hasData = false; altMetal2Ajax(data); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSampleProduct() {\n\treturn {\n\t\tid: Math.floor(Math.random() * 10000000),\n\t\tname: 'product 1',\n\t\tquantity: 1,\n\t\tprice: 1.0,\n\t};\n}", "function loadProductData(data) {\n _product = data[0];\n}", "get product() {\n\t\treturn this.__product;\n\t}", "function getData() {\n fetch(\...
[ "0.6435138", "0.62620157", "0.61091137", "0.58906317", "0.58293456", "0.56852233", "0.5676018", "0.5662985", "0.5662985", "0.56312376", "0.560947", "0.55777144", "0.55761456", "0.55716556", "0.5567597", "0.5564734", "0.556291", "0.5543211", "0.550319", "0.5500219", "0.5499645...
0.6044801
3
this function add a new column
function addColumn(){ compteurColumns++; columnArea.innerHTML += '<div class="column">' + '<span class="title_column">Cliquez ici pour changer le titre !</span>' + '<input class="none input_text" type="text" name="title" value="Titre de la colonne"/>' + '<input class="none" type="submit"/>' + '<div class="all_icons_column">' + '<a href="" class="addTask icon"><img src="../asset/img/add_task.png"/></a>' + '<a href="" class="deleteColumn icon"><img src="../asset/img/remove_column.png"/></a>' + '</div>' + '<input class="none" type="text" name="idColumn" value="'+compteurColumns+'">' + '</div>' ; refresh_for_column(); localStorage.setItem("compteur", compteurColumns); var array = {id:compteurColumns, title:"Titre de la colonne"}; arraycolumn.push(array); localStorage.setItem("columns", JSON.stringify(arraycolumn)); refresh_for_tasks(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addCol(){\n\n}", "function addColumn(){\r\n $('tr').append('<td></td>');\r\n column++;\r\n }", "function co_NewColumn() {\r\n\r\n\t// get table name\r\n\tvar tableDiv = tb_GetTableDivByButton(this);\r\n\tvar tableName = tableDiv.id;\r\n\r\n\r\n\t// old column (from input text --> to...
[ "0.7970303", "0.76040816", "0.7272819", "0.72569263", "0.71865934", "0.71811056", "0.716773", "0.7153701", "0.71358544", "0.7054699", "0.7048886", "0.70480937", "0.7022992", "0.7017944", "0.69685626", "0.6933608", "0.6912856", "0.68561745", "0.68393844", "0.6822126", "0.68061...
0.6913231
16
this function add a new task in the right column
function addTask(currentDiv){ var parent = currentDiv.parentNode; var d=document.createElement("div"); d.classList.add("tasks"); parent.appendChild(d); d.innerHTML += '<div class="taskTitle">Titre de la tâche</div>' + '<input class="hide_title none" placeholder="Titre" type="text"/>' + '<input class="none input_text" value="Valider" type="submit"/>' + '<div class="all_info_task">' + '<div class="all_icons_task">' + '<a href="#" class="icon dezoomButton none"> <img src="../asset/img/dezoom.png"/></a>' + '<a href="#" class="icon zoomButton"><img src="../asset/img/zoom.png"/></a>' + '<a href="#" class="empty_task icon" ><img src="../asset/img/empty.png"/></a>' + '<a href="#" class="empty_task none icon"><img src="../asset/img/edit.png"/></a>' + '<a href="#" class="icon deleteTask"><img src="../asset/img/remove_task.png"/></a>'+ '</div>' + '<span class="title_column none">Titre de la colonne</span>' + '<div class="taskDescription none">Description</div>' + '<textarea cols="100" rows="10" class="textarea none" placeholder="Description..."></textarea>' + '<input class="none" value="Valider" type="submit"/>'+ '</div>'; refresh_for_tasks(); var array = {id:parent.childNodes[4].value, title:"Titre de la tâche", description:"Description"}; arraytasks.push(array); localStorage.setItem("tasks", JSON.stringify(arraytasks)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addTask(taskID, task)\n{\n const table = $(\"#tasklist\");\n // create a new row\n const newRow = makeTasklistRow(taskID, task);\n // finally, stick the new row on the table\n const firstTask = tasksExist(\"tasklist\");\n if (firstTask)\n {\n firstTask.before(newRow);\n }\n else\n {\n tabl...
[ "0.7689154", "0.7476107", "0.7455095", "0.7450868", "0.7288616", "0.7195202", "0.7186003", "0.7095881", "0.70767343", "0.7064328", "0.70539045", "0.70531064", "0.698831", "0.69753635", "0.6972222", "0.6969597", "0.6958346", "0.6943842", "0.69416225", "0.6930383", "0.68837106"...
0.64926654
62
this function delete a column and all the task in the column
function deleteColumn(currentDiv){ var compteur = currentDiv.parentNode.childNodes[4].value; for(i=0; i < arraycolumn.length; i++){ if(arraycolumn[i].id == compteur){ delete arraycolumn[i]; } } for (j=0; j < arraytasks.length; j++){ if(arraytasks[j].id == compteur){ delete arraytasks[j]; } } arraycolumn = arraycolumn.filter(function(n){ return n != undefined }); localStorage.setItem("columns", JSON.stringify(arraycolumn)); arraytasks = arraytasks.filter(function(n){ return n != undefined }); localStorage.setItem("tasks", JSON.stringify(arraytasks)); compteurColumns--; localStorage.setItem("compteur", compteurColumns); columnArea.removeChild(currentDiv.parentNode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function delColumn() {\n removeTableColumn();\n}", "function deleteCol(){\r\n rowsArray = table.childNodes;\r\n for(let i = 0; i < rows.length; i++){\r\n table.removeChild(rowsArray[i].lastChild);\r\n }\r\n cols--;\r\n}", "deleteColumn() {\n if (!this.selectedColumns.length) return;\n\...
[ "0.7270386", "0.7000113", "0.69748646", "0.6881231", "0.67221045", "0.67146", "0.64550525", "0.64512974", "0.6439171", "0.64230454", "0.6395217", "0.6368159", "0.6366946", "0.6307895", "0.6300647", "0.62869465", "0.61967164", "0.6185518", "0.6139232", "0.6119557", "0.61017746...
0.7248282
1
this function change the title of a task
function changeTitleTask(currentDiv){ var titleTask = currentDiv.childNodes[1]; var titleTaskButton = currentDiv.childNodes[2]; titleTask.classList.remove('none'); titleTaskButton.classList.remove('none'); titleTaskButton.onclick = function(){ var currentColumnId = currentDiv.parentElement.childNodes[4].value; var currentTaskDescription = currentDiv.childNodes[3].childNodes[2].innerText; for(i=0; i < arraytasks.length; i++){ if(arraytasks[i].id == currentColumnId && arraytasks[i].title == currentDiv.childNodes[0].innerText && arraytasks[i].description == currentTaskDescription){ delete arraytasks[i]; break; } } if (titleTask.value.length > 0){ currentDiv.childNodes[0].innerHTML = titleTask.value; var array = {id:currentColumnId, title:titleTask.value, description:currentTaskDescription}; } else{ currentDiv.childNodes[0].innerHTML = 'Titre de la tâche'; var array = {id:currentColumnId, title:"Titre de la tâche", description:currentTaskDescription}; } arraytasks.push(array); arraytasks = arraytasks.filter(function(n){ return n != undefined }); localStorage.setItem("tasks", JSON.stringify(arraytasks)); titleTask.classList.add('none'); titleTaskButton.classList.add('none'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ScreedTodoTaskTitle() {\n}", "async function updateTaskTitle(pTitle) {\r\n await taskRef.update({title: pTitle});\r\n console.log(\"Title of \" + task + \"updated to \" + pTitle + \".\");\r\n}", "function editTask()\n {\n var parent = this.parentNode;\n var edited = prompt (\"Enter the new ...
[ "0.78962195", "0.7346441", "0.73075527", "0.7146582", "0.71108925", "0.7077209", "0.70435566", "0.6967703", "0.6964294", "0.69332695", "0.692315", "0.69152504", "0.6881238", "0.68298066", "0.68123484", "0.68121946", "0.67742455", "0.67737615", "0.6759786", "0.67341745", "0.67...
0.63690645
54
this function change the title of a column
function changetitle(currentDiv){ var compteur = currentDiv.childNodes[4].value; var myInput = currentDiv.childNodes[1]; var myButton = currentDiv.childNodes[2]; myInput.classList.remove('none'); myButton.classList.remove('none'); myButton.onclick = function(){ for(i=0; i < arraycolumn.length; i++){ if(arraycolumn[i].id == compteur){ delete arraycolumn[i]; } } if (myInput.value.length == 0){ currentDiv.childNodes[0].innerHTML = 'Title'; var array = {id:compteur, title:"Title"}; } else{ currentDiv.childNodes[0].innerHTML = myInput.value; var array = {id:compteur, title:myInput.value}; } arraycolumn.push(array); arraycolumn = arraycolumn.filter(function(n){ return n != undefined }); localStorage.setItem("columns", JSON.stringify(arraycolumn)); myInput.classList.add('none'); myButton.classList.add('none'); } refresh_for_column(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "UpdateColumnTitles() {\n for (var i = 0, ln = this.Columns.length; i < ln; i++) {\n this.Columns[i].UpdateTitle();\n }\n }", "title() {\n if (arguments.length) {\n title = arguments[0];\n return column;\n }\n return purify...
[ "0.79240775", "0.78436124", "0.7161591", "0.6816738", "0.6764477", "0.6688608", "0.66338545", "0.6631765", "0.6631765", "0.6631765", "0.6631765", "0.6631765", "0.6613992", "0.65386933", "0.6522753", "0.64633894", "0.64352703", "0.64160836", "0.641233", "0.6394825", "0.6382412...
0.59950715
55
this function is called when the user creat a new column or task, she actualise the variable wich take the number of button for delete add or change something
function refresh_for_column(){ addPostitButton = document.querySelectorAll('.addTask'); deleteColumnButton = document.querySelectorAll('.deleteColumn'); columntitle = document.querySelectorAll('.title_column'); for(var i = 0; i < addPostitButton.length; i++){ addPostitButton[i].onclick = function () { addTask(this.parentElement); } } for(var i = 0; i < deleteColumnButton.length; i++){ deleteColumnButton[i].onclick = function(){ deleteColumn(this.parentElement); } } for(var i = 0; i < columntitle.length; i++){ columntitle[i].onclick = function(){ changetitle(this.parentElement); } } var droppers = document.querySelectorAll('.column'); var droppersLen = droppers.length; for (var i = 0; i < droppersLen; i++) { dndHandler.applyDropEvents(droppers[i]); // Application des événements nécessaires aux zones de drop } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addColumn(){\n compteurColumns++;\n columnArea.innerHTML += '<div class=\"column\">' +\n '<span class=\"title_column\">Cliquez ici pour changer le titre !</span>' +\n '<input class=\"none input_text\" type=\"text\" name=\"title\" value=\"Titre de la colonne\"/>'...
[ "0.6691284", "0.6682835", "0.6569606", "0.6434547", "0.63130826", "0.6292209", "0.616372", "0.615654", "0.615075", "0.6040779", "0.6026578", "0.59878546", "0.5977051", "0.59740263", "0.5933144", "0.5907679", "0.5882538", "0.5868664", "0.5867484", "0.58632433", "0.5858736", ...
0.57567364
33
Page Return remove all event handler
function Clearup() { App.Timer.ClearTime(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "unAll() {\n this.handlers = null;\n }", "function unsubscribeAll(){uninstallGlobalHandler();handlers=[];}", "function cleanup() {\n\t\t\t\ttry {\n\t\t\t\t\t// do the cleanup\n\t\t\t\t\tKilauea.removeEvent(node, type, fn, capt);\n\t\t\t\t\t// cleanup the cleanup\n\t\t\t\t\tKilauea.removeEvent(window, ...
[ "0.7045584", "0.69766045", "0.68647414", "0.67154604", "0.66895366", "0.6686317", "0.6686317", "0.6680936", "0.66755515", "0.6662868", "0.66343796", "0.6629791", "0.66282535", "0.66282535", "0.66282535", "0.662772", "0.66013694", "0.6594408", "0.6586576", "0.6561983", "0.6548...
0.0
-1
operating X and Y coordinates separately. |9| max X speed, if player faster he will slow down whith each frame.
moveX (step, level, keys){ var timeSpeedChange = this.speedChange * step; if (keys.left && !keys.right){ if(this.speed.x <= -this.maxSpeed) this.speed.x = Math.min(this.speed.x + timeSpeedChange, -this.maxSpeed); //if speed x < max speed player will slow down else if(this.speed.x > 0) this.speed.x = Math.max(this.speed.x - timeSpeedChange, 0) - timeSpeedChange; //if speed x > 0 player will slowdown and then accelerate else this.speed.x = Math.max(this.speed.x - timeSpeedChange, -this.maxSpeed); //if 0 > speed x > - speed max } else if (keys.right && !keys.left){ if(this.speed.x >= this.maxSpeed) this.speed.x = Math.max(this.speed.x - timeSpeedChange, this.maxSpeed); //if speed x > max speed player will slow down else if(this.speed.x < 0) this.speed.x = Math.min(this.speed.x + timeSpeedChange, 0) + timeSpeedChange; //if speed x < 0 player will slow down and then accelerate else this.speed.x = Math.min(this.speed.x + timeSpeedChange, this.maxSpeed); //if 0 < speedChange x < speed max } else if (this.speed.x > 0) //when both left and right pressed and when none pressed player wil slowdown this.speed.x = Math.max(this.speed.x - timeSpeedChange, 0); else this.speed.x = Math.min(this.speed.x + timeSpeedChange, 0); var motion = new Vector(this.speed.x * step, 0); var newPos = this.pos.add(motion); var obstacle = level.obstacleAt(newPos, this.size); if(obstacle){ //check free space to move level.playerTouched(obstacle); this.speed.x = 0;} //!!!!!!!!!!!!! Check this later. bug possibility !!!!!!!!!!!!!! else this.pos = newPos; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateCoords () {\n \n if ( this.xCoord < 0 || this.xCoord > width ) this.xSpeed *= -1;\n \n this.xCoord += this.xSpeed;\n \n if ( this.yCoord < 0 || this.yCoord > height ) this.ySpeed *= -1;\n \n this.yCoord += this.ySpeed;\n }", "update() {\n this.x = this.x + this.speedX;\n ...
[ "0.71763885", "0.70234716", "0.6948452", "0.67804384", "0.6685815", "0.6654353", "0.6635072", "0.6593852", "0.6570198", "0.65482485", "0.6523196", "0.652249", "0.64904606", "0.64700574", "0.64519376", "0.64470834", "0.6442591", "0.6400797", "0.6368278", "0.63677794", "0.63550...
0.6559702
9
input data should be correct no data check functions here
constructor(plan){ this.width = plan[0].length; this.height = plan.length; this.grid = []; this.actors = []; for (var y = 0; y < this.height; y++) { var line = plan[y], gridLine = []; for (var x = 0; x < this.width; x++) { var ch = line[x], fieldType = null; var Actor = this.actorChars[ch]; if (Actor) this.actors.push(new Actor(new Vector(x, y), ch)); //for moving objects else if (ch == "#") //static objects will push to array fieldType = "wall"; else if (ch == "!") fieldType = "lava"; gridLine.push(fieldType); } this.grid.push(gridLine); } this.player = this.actors.filter(function(actor) {return actor.type == "player";})[0]; //player pos this.status = this.finishDelay = null; this.maxStep = 0.05; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validateInputs(data) {\n // console.log(\"1111111111111\")\n // console.log(data)\n // console.log(\"1111111111111\")\n let inputIndex = 0;\n for (let key in data) {\n if (data[key]) \n inputIndex++;\n }\n if (inputIndex === 0) {\n return \"empty\";\n } else {\n return (inputIndex ==...
[ "0.6674623", "0.6498054", "0.625208", "0.62459975", "0.62306064", "0.62101793", "0.6197696", "0.61223185", "0.61082363", "0.6085096", "0.60498947", "0.603006", "0.6025675", "0.6009909", "0.6003292", "0.59867054", "0.5979652", "0.5966709", "0.5963549", "0.5954038", "0.59378344...
0.0
-1
chek for delay after completing Level
isFinished (){ return this.status !== null && this.finishDelay < 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLevelTime() {\n\t\tlevel_time_left --;\n\t\tif(level_time_left == 0) {\n\t\t\tlevelComplete();\n\t\t}\n\t}", "function levelUp() {\n level++\n updateLevelText()\n setTimeout(function () {\n resetUserPattern()\n nextSequence()\n playGameSequence()\n }, levelDelaySpe...
[ "0.7184203", "0.6964868", "0.6832834", "0.6660713", "0.66504043", "0.6347757", "0.62818605", "0.6243245", "0.6231257", "0.61685926", "0.6167928", "0.6156735", "0.6141491", "0.6141491", "0.61282647", "0.61252815", "0.6121718", "0.61055773", "0.61014295", "0.60457563", "0.60182...
0.0
-1
background means all static objects.
drawBackground(){ var table = this.createScreenElement("table", "background"); //using table for background. will be removed by canvas afer testing table.style.width = this.level.width * this.scale + "px"; this.level.grid.forEach(function(row){ var rowElement = table.appendChild(this.createScreenElement("tr")); rowElement.style.height = this.scale + "px"; row.forEach(function(type){ rowElement.appendChild(this.createScreenElement("td", type)); }.bind(this)); }.bind(this)); return table; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setDynamicBackground() {\n\tsetUpGame();\n\tprogressGame();\n\tsetInterval(\"progressGame()\", refreshRate);\n}", "function drawBackgrounds() {\n for (i = 0; i < 3; i++) {\n addBackgroundObject('./img/background/03_farBG/Completo.png', bg_elem_3_x + i * 1726, -110, 0.45); //far away backgroun...
[ "0.6360233", "0.63048697", "0.6267108", "0.623985", "0.61955446", "0.6166807", "0.61553764", "0.6100061", "0.60955846", "0.60909194", "0.6078266", "0.60219437", "0.5976885", "0.595326", "0.5941026", "0.5899577", "0.58958113", "0.58794606", "0.5872681", "0.5858916", "0.5846763...
0.0
-1
Make sure to remove the DOM listener when the component is unmounted.
componentWillUnmount() { window.removeEventListener("scroll",this.scrollNavigation, true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_removeEventListeners() {\n\n this.el.removeEventListener('click', this._onClickBound);\n window.removeEventListener('scroll', this._onScrollBound);\n window.removeEventListener('orientationchange', this._onScrollBound);\n document.removeEventListener('spark.visible-children', this._onVisibleBound, tru...
[ "0.76331264", "0.7587594", "0.75302863", "0.7485584", "0.74767864", "0.74640185", "0.74614304", "0.7455931", "0.7424403", "0.74049294", "0.7378633", "0.73190874", "0.7318882", "0.72911143", "0.72885114", "0.72812635", "0.72681504", "0.7267051", "0.72668624", "0.72591007", "0....
0.0
-1
const products = props.products
componentDidMount(){ this.props.fetchCart(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getProducts() {\n return this.products\n }", "get products() {\n return this._products;\n }", "renderProducts() {\n let filteredProducts = this.props.products;\n\n return filteredProducts.map((product) => (\n <Product key={product._id} product={product} />\n ));\n }", "function m...
[ "0.763353", "0.757004", "0.7258558", "0.719249", "0.7064278", "0.70545447", "0.7049732", "0.7046901", "0.70417213", "0.70294243", "0.6997233", "0.6987815", "0.6961672", "0.69579524", "0.6940286", "0.690335", "0.6890805", "0.685908", "0.6854573", "0.6844351", "0.6831757", "0...
0.0
-1
soooooooo / if the quantity for an item is zero, the remove button should switch to say delete and should run a different thunk to actually delete that order item if the quantity is at stock, then the add button should be disabled
render() { const { cart } = this.props; const orderItems = cart.orderitems; const subtotal = cart.total; const tax = (cart.total * 0.09).toFixed(2); const shipping = 10; return ( <div className="row cart"> <div className="col-md-12 col-sm-12 col-xs-12 table"> { cart && orderItems && orderItems.length > 0 ? <table className="table table-shopping"> <thead> <tr> <th>Product</th> <th>Description</th> <th>Price</th> <th>Qty</th> <th>Subtotal</th> <th>Delete</th> </tr> </thead> <tbody> {cart && orderItems && orderItems.map((element) => ( <CartRow key={element.id} element={element} handleQuantity={this.props.handleQuantity} handleDelete = {this.props.handleDelete} /> ))} <tr> <td colSpan="2" className="text-right"><strong>Order Summary</strong></td> <td className="td-total"> Subtotal </td> <td className="td-currentPrice"> <small>$</small>{subtotal && subtotal.toFixed(2)} </td> </tr> <tr> <td colSpan="2" /> <td className="td-total"> Tax </td> <td className="td-currentPrice"> <small>$</small>{tax} </td> </tr> <tr> <td colSpan="2" /> <td className="td-total"> Shipping </td> <td className="td-currentPrice"> <small>$</small>{shipping.toFixed(2)} </td> </tr> <tr> <td colSpan="2" /> <td className="td-total"> Total </td> <td className="td-currentPrice"> <small>$</small>{(Number(subtotal) + Number(tax) + Number(shipping)).toFixed(2)} </td> <td colSpan="1" className="text-right"> <Link to="/checkout"> <button type="button" className="btn btn-info btn-round"> <i className ="material-icons" >Complete Purchase</i> </button> </Link> </td> </tr> </tbody> </table> : <div className="empty-cart d-flex align-items-center justify-content-center"> <span> <h4 className="d-flex justify-content-center"> Adopt a robot pet today ♥ </h4> <p className="d-flex justify-content-center">Nothing in cart yet ...</p> <div className="d-flex justify-content-center shop-now"> <button type="button" className="btn btn-secondary shop-now"> <Link to="/products">SHOP NOW</Link> </button> </div> </span> </div> } </div> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleRemove(){\r\n //making sure it does not remove if there are 0 items\r\n if (quantity.innerHTML !== \"0\"){\r\n quantity.innerHTML = parseInt(quantity.innerHTML)-1;\r\n }\r\n //disabling the \"agree\" button when there are no items\r\n if (quantity.innerHTML ...
[ "0.7336021", "0.73185843", "0.73098123", "0.69723", "0.66081744", "0.6604283", "0.65787494", "0.6544214", "0.64823896", "0.64737284", "0.64304197", "0.64110863", "0.6387655", "0.6382937", "0.6361202", "0.6335635", "0.63339096", "0.6333488", "0.6329901", "0.6324058", "0.631807...
0.0
-1
Function to check how far down you are scrolled on the page
function scrollFunction() { if (document.documentElement.scrollTop > 20) { topButton.style.display = 'block'; } else { topButton.style.display = 'none'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isScrollDown() {\n\t\tprevOffset = pageOffset;\n\t\tpageOffset = pageYOffset;\n\t\treturn pageOffset > prevOffset;\n }", "function detectScroll(){\n\t\t\t\t\t\t\tvar depth = window.analytics.reporting.getScrollDepth();\n\t\t\t\t\t\t\tvar depthMsg = 'current scroll depth: <b>' + depth + '%</b>';\n\t\t...
[ "0.7524208", "0.7044965", "0.6890709", "0.68638647", "0.683954", "0.6754321", "0.6638889", "0.66129184", "0.65988445", "0.65988445", "0.6598506", "0.6598506", "0.658301", "0.6534978", "0.6516267", "0.65091884", "0.6497068", "0.64738774", "0.64121735", "0.6410799", "0.6382763"...
0.0
-1
Checks for valid integer
function isInt(x, y) { const intRegExp = /^-?[0-9]+$/; if (intRegExp.test(x) & intRegExp.test(y)) { return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkInt(text){\n\tif (text != 0)\n\t\tif (parseInt(text, 10) !== Number(text))\n\t\t\treturn false;\n\treturn true;\n}", "function validInput(input) {\n return isInteger(input) && input > 0\n}", "function checkIntegerNumber(val) {\r\n if (val && val == parseInt(val, 10))\r\n return true;...
[ "0.7702358", "0.76199454", "0.7369958", "0.7318046", "0.7280366", "0.7269738", "0.7228499", "0.7199327", "0.71777225", "0.7116351", "0.70844513", "0.70704174", "0.7052223", "0.7033798", "0.70312613", "0.7018489", "0.7017266", "0.69932956", "0.6988664", "0.69634646", "0.695898...
0.0
-1
Helper function to create an error object to pass back to this module's caller.
function makeError( code, msg ) { const err = new Error( msg ); err.code = code; return err; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getErrorObject(){\n try { throw Error('') } catch(err) { return err; }\n}", "function getErrorObject() {\n try { throw Error('') } catch(err) { return err; }\n}", "function getErrorObj(){\n\t\t try{ throw Error(\"\")}catch(err){ return err }\n\t }", "function createInternalError() {\n ...
[ "0.7498294", "0.74416655", "0.74243695", "0.7268937", "0.7223742", "0.6986662", "0.6905161", "0.69040745", "0.6782545", "0.67088705", "0.66970843", "0.6680237", "0.65911067", "0.65596545", "0.65329564", "0.65121484", "0.6445754", "0.6445754", "0.6445754", "0.6445754", "0.6445...
0.707552
5
Constructor for an email service provider. this.makeReq is function( mail ) and each instance must provide an implementation to create a request suitable for sending a mail to its service provider.
function Provider( name, makeReq ) { this.name = name; this.makeReq = makeReq; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() { \n \n EmailRequestSmtp.initialize(this);\n }", "constructor() { \n \n Mail.initialize(this);\n }", "function Email(obj) { this.obj = obj; }", "function email(options) {\n this.from = options.to;\n this.to = options.from;\n this.subject = options.subj...
[ "0.6721457", "0.6571403", "0.6341545", "0.63186127", "0.6288293", "0.6159498", "0.6157286", "0.6151951", "0.6091148", "0.60866207", "0.59691626", "0.59024256", "0.58994406", "0.58910286", "0.587041", "0.574649", "0.57363325", "0.57361305", "0.56608886", "0.5641925", "0.562774...
0.5435517
30
To make sure required parameters are present and providers have been set up correctly. Return an error message on failure.
function initProviders() { // Check if mandatory parameters are all present. mailgunApiKey = process.env.EMAIL_MAILGUN_API_KEY || ""; mailgunDomain = process.env.EMAIL_MAILGUN_DOMAIN || ""; sendgridApiKey = process.env.EMAIL_SENDGRID_API_KEY || ""; mailgunApiKey = mailgunApiKey.trim(); mailgunDomain = mailgunDomain.trim(); sendgridApiKey = sendgridApiKey.trim(); if( !mailgunApiKey ) return "Mailgun API key is missing"; if( !mailgunDomain ) return "Mailgun domain is missing"; if( !sendgridApiKey ) return "Sendgrid API key is missing"; // Create parameters that remains unchanged hereinafter. mailgunAuth = "api:" + mailgunApiKey; sendgridAuth = "Bearer " + sendgridApiKey; // Check if all providers are set up correctly. for( let i = 0; i < providers.length; ++i ) { const p = providers[ i ]; if( !p.makeReq ) return p.name + " has not been set up correctly"; } // To accommodate automated unit testing only ... let envProvider = process.env.EMAIL_PROVIDER; if( envProvider ) { envProvider = envProvider.trim().toLowerCase(); if( envProvider === "sendgrid" ) iProvider = 1; } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validateParams(params) {\n const { vendor_id, fulfillment_center_id } = params;\n if (\n !vendor_id &&\n !fulfillment_center_id\n ) {\n throw new Error('Vendor or Fulfillment center Id is required!');\n }\n }", "checkProvider({ currentProvider, contractName }) {\n if (!currentProvi...
[ "0.6448286", "0.62140256", "0.62140256", "0.6116025", "0.5932693", "0.58466095", "0.5790194", "0.5652751", "0.56485784", "0.5634926", "0.5621149", "0.56105363", "0.55092317", "0.54741246", "0.546159", "0.5447379", "0.54281515", "0.5416041", "0.54064626", "0.5369962", "0.53562...
0.5908602
5
Return the service provider currently in use
function getProvider() { return providers[ iProvider ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get provider() {\n return this.use().provider;\n }", "getMainServiceProviderName() {\n return this._serviceProvider.name || 'N/A';\n }", "get provider() {\n\t\treturn this.__provider;\n\t}", "get provider () {\n\t\treturn this._provider;\n\t}", "getProvider( id ) {\n return this.getProvide...
[ "0.6974462", "0.6694789", "0.6492421", "0.63013816", "0.6289201", "0.62265486", "0.6154932", "0.60764384", "0.604461", "0.5988645", "0.5915003", "0.5899635", "0.58543944", "0.58543944", "0.58453614", "0.58416605", "0.5834554", "0.5807646", "0.58061683", "0.58061683", "0.58061...
0.6889799
1
Move on to the next service provider.
function useNextProvider() { iProvider = ( iProvider + 1 ) % providers.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_navigateNext() {\n this._navigate(this.next.id, 'endpoint');\n }", "next() {\n this._followRelService(\"next\", \"List\");\n }", "getNext(){\n if (\n this.loadingNext ||\n this.refreshing ||\n !this.fetchServices.hasNextPage \n )\n return;\n this.beforeNext()...
[ "0.61498725", "0.5707853", "0.56987756", "0.5684856", "0.56034815", "0.55930936", "0.55343276", "0.5480176", "0.54607034", "0.5433382", "0.54323256", "0.5430927", "0.54176694", "0.5405844", "0.5366775", "0.5325761", "0.52612007", "0.51998246", "0.51786894", "0.5168846", "0.51...
0.68975425
0
Incorporates shared logic between the inital handshake request and all subsequent requests. Generates a request id and filters by it Send `end_subscription` when observable is unsubscribed
makeRequest(options, type) { const requestId = this.requestCounter++ const req = { message: {requestId}, data: {}, subject: new Subject(), observable: new Observable((subscriber) => { if (this.requests.has(requestId)) { console.error(`internal horizon request subscribed to twice, stack: ${new Error().stack}`); } // TODO: this probably behaves poorly if the connection goes down between creating and subscription this.requests.set(requestId, req) this.send(req.message) req.subject.subscribe(subscriber); return () => this.cleanupRequest(requestId); }), } if (options) { req.message.options = options } if (type) { req.message.type = type } return req }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function subscribe(request, variables, cacheConfig, observer) {\n const subscriptionId = next_subscription_id++\n subscription_ws.send(JSON.stringify({\n action: 'subscribe',\n subscriptionId,\n query: request.text,\n variables: variables,\n }))\n subscription_ws.onmessage = e => {\n observer.on...
[ "0.6163762", "0.5685853", "0.5517523", "0.5418088", "0.54045683", "0.5398541", "0.53698856", "0.53244144", "0.53163403", "0.52125156", "0.51707476", "0.51554173", "0.5146511", "0.5141341", "0.51039946", "0.50637424", "0.50369155", "0.5036108", "0.5035459", "0.5004586", "0.497...
0.50204533
19
Query EventRegistry events and articles
async function getERUris(conceptKeyword, locations) { let conceptUri = er.getConceptUri(conceptKeyword); let locationUris = locations.includes("Global") ? [] : locations.map((l) => er.getLocationUri(l)); return Promise.all([conceptUri, ...locationUris]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "fetchEvents() {\n this.events = undefined;\n\n this.PuppetDB.parseAndQuery('events',\n this.$location.search().query,\n this.createEventQuery(),\n {\n offset: this.$scope.perPage * ((this.$location.search().page || 1) - 1),\n limit: this.$scope.perPage,\n order_by: angular...
[ "0.6883714", "0.67354375", "0.6566569", "0.65566814", "0.6551981", "0.65502137", "0.6447026", "0.6439522", "0.63786536", "0.6373403", "0.6305056", "0.6298777", "0.6255721", "0.6197064", "0.61937755", "0.61908764", "0.6185839", "0.6132115", "0.61026967", "0.6097792", "0.608579...
0.0
-1
Submit customer route request
function send_req() { var flag = true; var routeId = $('#create_req').attr('req-ro'); var requested_address = $('#requested_address').val(); var route_address = $('#route_address').val(); var requested_qty = $('#requested_qty').val(); if (requested_address == "") { $('#requested_address').addClass('route_error'); flag = false; } if (requested_qty == "") { $('#requested_qty').addClass('route_error'); flag = false; } if (route_address == "") { $('#route_address').addClass('route_error'); flag = false; } var security_token = $('#_token').val(); var base_url = $('#_base').val(); if (flag == true) { $.ajax({ method: "POST", dataType: "json", url: base_url + "/submit_route_req", data: { 'routeId': routeId, 'r_address': requested_address, 'req_route': route_address, 'requested_qty': requested_qty, '_token': security_token } }) .done(function (res) { if (res.status == true) { $('#showResponse').html(res.message); setTimeout(function () { $('#showResponse').html(""); $('#create_req').modal('hide'); location.reload(); }, 2000); } else { $('#showResponse').html(res.message); setTimeout(function () { $('#showResponse').html(""); $('#create_req').modal('hide'); location.reload(); }, 2000); } }); } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitRequest(){\n directionsService.route(requestArray[i].request, directionResults);\n }", "sendCustomerRequest(){\n // request will be sent to the customer that requested the ride\n var request= {\n taxiNumber: this.state.taxiNumber,\n id: this.so...
[ "0.73588187", "0.62104565", "0.59695643", "0.5884249", "0.5700909", "0.5693574", "0.5641461", "0.5619204", "0.5589455", "0.55582905", "0.55430114", "0.55311495", "0.5519494", "0.55148876", "0.5496236", "0.5491255", "0.54484797", "0.5409262", "0.5398787", "0.5388437", "0.53847...
0.5093657
55
Function to chnage amount on product page
function calAmt() { if ($('#productAttribute :selected').val() != "") { $('#final_per_unit').hide(); var psize = 0; if ($('#productAttribute')) { psize = $('#productAttribute :selected').text(); } var amt = $('#pamt').val(); var qty = $('#p_quantity').val(); if (qty != null && qty != '') { qty = qty; } else { qty = 1; } var fprice = parseFloat(amt) * parseFloat(qty); if (psize != 0) { //console.log(parseFloat(psize)); fprice = parseFloat(fprice) * parseFloat(psize); } var final_price = fprice.toFixed(2); //console.log(final_price); $('#final_amonut').html(final_price); } else { var amt = $('#pamt').val(); $('#final_per_unit').show(); $('#final_amonut').html(amt); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function totale(price) {\n tot += price;\n }", "function productGetTotal(ele, amount) {\r\n let total = ele.querySelector('.product-total p .total-num'),\r\n num = ele.querySelector('.product-w-discount p').textContent,\r\n reg = new RegExp('[0-9]+', 'g'),\r\n getPrice = Number(reg.exec(n...
[ "0.6961081", "0.6935675", "0.6769881", "0.6736053", "0.67180556", "0.66900384", "0.66752267", "0.6663112", "0.6660788", "0.6655911", "0.66437423", "0.6643677", "0.6642334", "0.66421807", "0.66266364", "0.66211945", "0.6620634", "0.6604819", "0.66042864", "0.6592536", "0.65860...
0.6386073
59
for MultiTech LoRaWAN gateway.
function substitute(path, prop, value) { var element = 'ttnjson' for (var i = 0; i < path.length; i++) { element = element + "." + path[i]; } element = element+"."+prop; if (typeof(value) == "string") { eval(element + "=\"" + value +"\""); } else { eval(element + "=" + value); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function connect_lan() {\n connect(\"192.168.1.100\");\n}", "function waitForWlan() {\n let netif = os.networkInterfaces();\n con.log(`waitForWlan() looking for wlan0 - #${wlanWaitCount}`);\n // uncomment the line below to observe the network \n // interfaces and the eventual appearance of the \n ...
[ "0.5558506", "0.5494217", "0.54588675", "0.5426922", "0.5423634", "0.53780085", "0.5371805", "0.5353678", "0.53108865", "0.5283708", "0.52811533", "0.5275857", "0.5244753", "0.5237084", "0.5219518", "0.52145433", "0.5214406", "0.5212341", "0.52016026", "0.5188827", "0.5165683...
0.0
-1
prints "bar" Passing values to a function call
function doSomething(z){ z += 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bar(x, y, z) {\n console.log(`x: ${x}, y: ${y}, z: ${z}`)\n}", "function bar(c) {\n\t\tconsole.log( a, b, c);\n\t}", "function bar(param) {\r\n console.log(param);\r\n}", "function bar(x, y, ...arguments) {\n // display what we receive\n console.log(`x=${x}, y=${y}`);\n console.log(`arg...
[ "0.7550852", "0.73710555", "0.6798258", "0.6796321", "0.6648492", "0.6472014", "0.6332505", "0.6255973", "0.62272835", "0.6192169", "0.61801535", "0.6159548", "0.6146686", "0.612269", "0.61188376", "0.61019653", "0.608958", "0.6079724", "0.60317516", "0.5986621", "0.5984175",...
0.0
-1
Make sure the task is completed before the browser reload
function reload(done) { browserSync.reload() done() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function browserSyncReload(done) {\n browserSync.reload();\n done();\n}", "function reload(done) {\n browserSync.reload();\n done();\n}", "function reload(done) {\n browserSync.reload();\n done();\n}", "function reload(done) {\n browserSync.reload();\n done();\n}", "function reload(done) {\n brows...
[ "0.663231", "0.6507702", "0.6507702", "0.6507702", "0.6507702", "0.649099", "0.6446111", "0.63827455", "0.638177", "0.6328726", "0.6328726", "0.6328726", "0.6328726", "0.63145334", "0.6299996", "0.62706953", "0.6264823", "0.623546", "0.6215035", "0.6171259", "0.6152097", "0...
0.65031844
5
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 */ ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // 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, (options.functional ? this.parent : 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 functional 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.5846957", "0.5727251", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "...
0.0
-1
Create New Gradient (should be a constructor or factory)
function changeBackgroundGradient(colorData) { var ctx = document.getElementById('canvas').getContext('2d'); var gradient = ctx.createLinearGradient(0, 0, window.innerHeight, window.innerWidth); gradient.addColorStop(0, colorData[0]); gradient.addColorStop(1, colorData[1]); ctx.fillStyle = gradient; ctx.fillRect(0, 0, window.innerWidth, window.innerHeight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Gradient() {\n this.defaultColor = null;\n this.points = [];\n}", "function Gradient(){\n this.name = \"Gradient\"\n\n this.config = {\n color1: {\n type: 'color',\n value: {\n r: 255,\n g: 233,\n b: 61\n }\n ...
[ "0.7756905", "0.70988065", "0.7012018", "0.6892087", "0.6786853", "0.659579", "0.636139", "0.636139", "0.6361091", "0.63431513", "0.6271159", "0.6271159", "0.6271159", "0.6271159", "0.6271159", "0.6169768", "0.6149698", "0.6141899", "0.6124231", "0.61173767", "0.60416895", ...
0.0
-1
`keyActions` and `changeBackgroundGradientRandomly` use currying i.e., "translating the evaluation of a function that takes multiple arguments (or a tuple of arguments) into evaluating a sequence of functions, each with a single argument" (Wikipedia). Also see:
function getRandomInt(max) { return Math.floor(Math.random() * Math.floor(max)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "add_press(key, action_func){\n this.press[key] = action_func;\n }", "function changeColor (key){\n // callback function for the onClick event:\n return function (){\n // get the current state\n let newSquareColors = {...squareColors};\n\n // update square as clicked, and initialize c...
[ "0.52085614", "0.5167864", "0.5130811", "0.51263624", "0.50884", "0.5043049", "0.50244266", "0.4969748", "0.49275047", "0.49197704", "0.48502564", "0.48396447", "0.4827299", "0.4818078", "0.48144844", "0.47604907", "0.47404146", "0.4737255", "0.4710565", "0.4682846", "0.46752...
0.0
-1
sadly, the Cedar Fair API doesn't have park hours (it just returns an empty array) so, let's override it from SeaWorld
FindScheduleDataURL() { return this.Cache.Wrap("schedule_url", function () { return new Promise(function (resolve, reject) { this.GetAPIUrl({ // the park hours URL is kept in the products area url: `${this.APIBase}commerce/${this.ParkID}/products/all` }).then(function (productData) { // got product data, we're looking for GUEST_PARK_HOURS to get our schedule URL for (var i = 0, product; product = productData[i++];) { if (product.id == "GUEST_PARK_HOURS") { // this will give us the park-hours.htm document // we want the schedule.js script that contains all the hours data // check we're still getting the expected park-hours.htm document if (product.purchaseLink.indexOf("park-hours") < 0) { return reject("Park hours URL has changed, requires themeparks library update"); } return resolve(product.purchaseLink.replace(/park-hours[a-zA-Z0-9_-]*\.htm/, "") + "js/schedule.js"); } } // failed? search the main venue data instead this.GetAPIUrl({ url: `${this.APIBase}venue/${this.ParkID}` }).then((venueData) => { // search venue data if (venueData.details) { for (var j = 0, detail; detail = venueData.details[j++];) { if (detail.id == "info_web_hours_directions") { if (detail.description.indexOf("park-hours") < 0) { return reject("Park hours URL has changed, requires themeparks library update"); } return resolve(detail.description.replace(/park-hours[a-zA-Z0-9_-]*\.htm/, "") + "js/schedule.js"); } } } return reject("Unable to discover park hours URL"); }); }.bind(this), reject); }.bind(this)); }.bind(this), 60 * 60 * 24); // cache URL for 24 hours }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function producedPastHour() {\n let currentTime = new Date();\n let hourago = new Date(currentTime.getTime() - (60 * 60 * 1000));\n let producedKWH = 0;\n //Get the production readings from the past hour on phase 1\n request('http://raspberrypi.local:1080/api/chart/1/energy_pos/from/' + hourago.toIS...
[ "0.6092506", "0.59434336", "0.5900935", "0.588863", "0.58335024", "0.5698862", "0.5698592", "0.56691176", "0.5658577", "0.56520885", "0.5648044", "0.5640381", "0.56337047", "0.5595911", "0.556246", "0.55050075", "0.5502602", "0.54963005", "0.546093", "0.5454148", "0.54513866"...
0.0
-1
modKey should be a key in modificationsConfig (eg. 'open_water').
function getHumanReadableName(modKey) { if (modificationConfig[modKey]) { return modificationConfig[modKey].name; } return unknownModKey(modKey); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getMods(key) {\n\t var mods = key.slice(0, key.length - 1);\n\t for (var mi = 0; mi < mods.length; mi++)\n\t mods[mi] = _MODIFIERS[mods[mi]];\n\t return mods;\n\t }", "function getMods(key) {\n\t var mods = key.slice(0, key.length - 1);\n\t for (var mi = 0; mi < mods.length; mi++)\n\t...
[ "0.6385377", "0.6385377", "0.63388145", "0.6269906", "0.6269906", "0.6269906", "0.6269906", "0.6241749", "0.5819521", "0.5651513", "0.55893975", "0.55269396", "0.5421277", "0.5421277", "0.53293574", "0.53254175", "0.52665", "0.51841974", "0.51230097", "0.51078176", "0.5106208...
0.6453467
0
If no shortName, just use name.
function getHumanReadableShortName(modKey) { if (modificationConfig[modKey]) { if (modificationConfig[modKey].shortName) { return modificationConfig[modKey].shortName; } else { return modificationConfig[modKey].name; } } return unknownModKey(modKey); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function shortName(name, tTable) {\n var back;\n if (back = tTable[name]) {\n\treturn back;\n }\n return name;\n}", "['@_longname']() {\n super['@_longname']();\n if (this._value.longname) return;\n this._value.longname = this._value.name;\n }", "getDisplayName(name) {\n let splitt...
[ "0.70429635", "0.67405176", "0.6618375", "0.6543355", "0.65161365", "0.64488184", "0.6263603", "0.623904", "0.6135443", "0.60896456", "0.606128", "0.6024621", "0.60175943", "0.6007585", "0.6003992", "0.5992077", "0.5981473", "0.5971854", "0.59690636", "0.59654903", "0.5962064...
0.6525615
4
TODO adapt function to mint assets
async mintNFT(key,limit) { const requestOptions = { method: 'GET', headers: {'Content-Type': 'application/json'} }; // TODO change endpoint fetch('https://'+this.state.selectedEndPoint.testnet+'/tx_metadata?key=eq.'+key+'&limit='+limit, requestOptions) .then(response => response.text()) .then(data => { this.setState({metadataResponse: JSON.parse(data)}); }).then(e => null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get mainAsset() {}", "set mainAsset(value) {}", "function getAssetInfo(){\n\treturn {\n\t\t'position': {\"x\":-18,\"y\":-17,\"w\":37,\"h\":17},\n\t\t'thumb': \"iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM\\/rhtAAAAHElEQVR42u3BAQEAAACCIP+vbkhA\\nAQAAAAAAfBoZKAABfmfvpAAAAABJRU5ErkJggg==\",\n\t};\n}", "function get...
[ "0.64056903", "0.62741154", "0.5994074", "0.5842233", "0.58095264", "0.58007896", "0.5799888", "0.57852644", "0.57730824", "0.5770122", "0.57612526", "0.5760014", "0.5755809", "0.5750957", "0.5747995", "0.5747491", "0.5743367", "0.5742795", "0.5739438", "0.57350415", "0.57286...
0.0
-1
create a function that will increment note ID + 1 when something new is added.
function grabNextId() { return nextId++; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getNewId(notes){\n var maxId = 0;\n for (var i=0; i<notes.length; i++){\n if (notes[i].id > maxId) {\n maxId = notes[i].id;\n } \n }\n maxId++;\n return maxId;\n}", "function newID() {\n for (var i = 0; i < notesArray.length; i++) {\n notesArray[i].id = i;\n }\n}", "function i...
[ "0.70998156", "0.7093295", "0.6912966", "0.67442244", "0.67135453", "0.6709951", "0.66596323", "0.6589391", "0.6580505", "0.6537071", "0.64694023", "0.6466954", "0.64441687", "0.63917017", "0.63481957", "0.63360524", "0.6327555", "0.63079697", "0.6305188", "0.628836", "0.6279...
0.5940137
65
Creates an object for each session, containing information about the session Takes in an array of sessions
function structureSessions(sessions, coursePath, callback) { // This array will be populated and sent to callback when done const structuredSessions = []; let itemsProcessed = 0; sessions.forEach(async (session) => { const sessionObj = { title: path.basename(session, path.extname(session)), filePath: path.join(path.resolve(coursePath), session), duration: '', }; // Get and set duration of session file await mp3Duration(path.join(coursePath, session), (err, duration) => { if (err) console.error(err); sessionObj.duration = duration; }); structuredSessions.push(sessionObj); itemsProcessed += 1; if (itemsProcessed === sessions.length) { callback(structuredSessions); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Session(id) {\n this.id = id;\n this.teachers = [];\n this.students = [];\n this.messages = [];\n}", "function makeSession(session) {\n const now = new Date().getTime();\n const id = session.id || uuid4();\n // Note that this means we cannot set a started/lastActivity of `0`, but this shoul...
[ "0.65514123", "0.6511223", "0.63697743", "0.6254863", "0.61805373", "0.61713964", "0.60629076", "0.5974077", "0.59455585", "0.59169656", "0.5904747", "0.589107", "0.5890257", "0.5870007", "0.5821489", "0.58058774", "0.57748127", "0.5754022", "0.57223934", "0.5709069", "0.5705...
0.60243696
7
Creates an array with objects representing the courses in a given directory Takes in a directory containing a subdirectory for each course
function coursesData(dir, callback) { // 1. Create empty array for courses const coursesArray = []; // 2. Read courses directories fs.readdir(dir, (err, courses) => { if (err && err.code === 'ENOENT') { callback(err, null); return; } if (err) { console.err(err); } let coursesProcessed = 0; courses.forEach((course, index) => { // 3. Add one object per course coursesArray.push({ name: course, sessions: [], }); const coursePath = path.join(dir, course); // 4. Read directory of this course's sessions fs.readdir(coursePath, async (error, sessions) => { if (error) console.error(error); // 5. Create structured session objects with session meta data await structureSessions(sessions, coursePath, (structuredSessions) => { coursesArray[index].sessions = structuredSessions; coursesProcessed += 1; // 6. When done, send courses to callback if (coursesProcessed === coursesArray.length) { callback(null, coursesArray); } }); }); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCourses () {\n return [\n {id: 'csc148h1'},\n {id: 'csc165h1'},\n {id: 'csc240h1'},\n {id: 'cog250y1'},\n {id: 'eng110y1'},\n {id: 'eng140y1'},\n {id: 'eng150y1'},\n {id: 'bio130h1'},\n {id: 'bio150y1'},\n {id: 'chm138h1'},\n {id: 'chm139h1'},\n {id: 'phl100y1'},\n ...
[ "0.5881127", "0.5659679", "0.54431623", "0.54393643", "0.5421684", "0.5416868", "0.5402414", "0.5366689", "0.5309676", "0.52620035", "0.52276635", "0.5225477", "0.5208633", "0.5186653", "0.51793706", "0.517498", "0.517092", "0.5166379", "0.51648456", "0.51262337", "0.5121632"...
0.74431884
0
vueclasscomponent v7.1.0 (c) 2015present Evan You
function o(t,e){a(t,e),Object.getOwnPropertyNames(e.prototype).forEach(function(n){a(t.prototype,e.prototype,n)}),Object.getOwnPropertyNames(e).forEach(function(n){a(t,e,n)})}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n this.vue = new Vue();\n }", "created () {\n this.classNames = this.getDefaultClassName(this.$options.name)\n }", "function Component() { }", "mounted() {\n }", "function vue_class_component_esm_typeof(e){return vue_class_component_esm_typeof=\"function\"===typeof Symbol&&...
[ "0.6773465", "0.64064795", "0.6238636", "0.6217544", "0.6199435", "0.6173949", "0.61697185", "0.60786045", "0.60431516", "0.6023018", "0.6023018", "0.6020792", "0.59973025", "0.5965196", "0.59407586", "0.59407586", "0.59319675", "0.59229594", "0.5894075", "0.58822864", "0.586...
0.0
-1
vuex v3.1.1 (c) 2019 Evan You
function r(t){var e=Number(t.version.split(".")[0]);if(e>=2)t.mixin({beforeCreate:r});else{var n=t.prototype._init;t.prototype._init=function(t){void 0===t&&(t={}),t.init=t.init?[r].concat(t.init):r,n.call(this,t)}}function r(){var t=this.$options;t.store?this.$store="function"===typeof t.store?t.store():t.store:t.parent&&t.parent.$store&&(this.$store=t.parent.$store)}}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getFieldVuex() {\n return store.getters.dataField;\n }", "function vuexInit(){var options=this.$options;// store injection\n\tif(options.store){this.$store=options.store;}else if(options.parent&&options.parent.$store){this.$store=options.parent.$store;}}", "function U(He){Le&&(He._devtoolHook=Le,Le.emit('v...
[ "0.71112245", "0.7006341", "0.674731", "0.6744793", "0.6621443", "0.6621443", "0.6621443", "0.6616846", "0.6592331", "0.6486833", "0.6356973", "0.63517773", "0.63503313", "0.63503313", "0.63503313", "0.63503313", "0.63503313", "0.6339089", "0.6321857", "0.6283967", "0.6280055...
0.0
-1
! vuerouter v3.1.3 (c) 2019 Evan You
function r(t,e){0}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jj(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"source.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "private public function m246() {}", "function TM(t,e,n,i,r,o,a,s){var u=(\"functio...
[ "0.5923544", "0.5890408", "0.5832974", "0.5809842", "0.57628846", "0.57322603", "0.5665593", "0.56503284", "0.5648765", "0.5626426", "0.56115776", "0.56092024", "0.56060123", "0.55361456", "0.55283093", "0.5494289", "0.5490474", "0.54669744", "0.54268694", "0.54203886", "0.54...
0.0
-1
End Animation Script / Remove the landing div and resize our terminal
function removeDiv() { "use strict"; setTimeout(document.getElementById('parentDiv').removeChild(document.getElementById('choosePath')), 1500); setTimeout(document.getElementById('terminalEmu').style.height = 800, 1700); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resizeEnd() {\r\n initial = true;\r\n windowWidth = window.innerWidth;\r\n initSlider();\r\n hideTimer = setTimeout(() => {\r\n sliderCanvas.classList.remove('pieces-slider__canvas--hidden');\r\n }, 500);\r\n }", "function endD...
[ "0.66072994", "0.6547896", "0.6357164", "0.6272946", "0.62669915", "0.6218569", "0.6215638", "0.62132734", "0.62083507", "0.6161499", "0.61530095", "0.60966", "0.6092793", "0.60895103", "0.60635614", "0.6014683", "0.601238", "0.59958375", "0.599384", "0.59706265", "0.5962013"...
0.5919299
24
Add to the terminal div
function addInput(x) { "use strict"; document.getElementById('terminalEmu').innerHTML = document.getElementById('terminalEmu').innerHTML + x; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AddSpaceToTerminal(){\n\tvar elems = document.getElementsByClassName('terminal');\n\tfor (var i = 0; i< elems.length;i++){\n\t\t\n\t\telems[i].innerHTML += \" \";\n\t}\t\n}", "function addLine(text) { //adds a new line to the mainConsole\n mainConsole.innerHTML = mainConsole.innerHTML + \"<br>\" + t...
[ "0.6921246", "0.64952505", "0.64719933", "0.6457784", "0.6328557", "0.62735736", "0.6261926", "0.6242111", "0.6213669", "0.610095", "0.6097802", "0.6062912", "0.60570776", "0.605653", "0.6054285", "0.601595", "0.6009128", "0.60090756", "0.59900326", "0.5987419", "0.59508145",...
0.6537731
2
console.log(jas); async..await is not allowed in global scope, must use a wrapper
async function sendEmail(request) { const { email, id } = request; // console.log('useremail and id', email,id); console.log('jasEmailjasEmailjasEmailjasEmailjasEmailjasEmailjasEmail'); console.log(jasEmail); // Generate test SMTP service account from ethereal.email // Only needed if you don't have a real mail account for testing // let testAccount = await nodemailer.createTestAccount(); // create reusable transporter object using the default SMTP transport let transporter = nodemailer.createTransport({ service: 'gmail', auth: { user: jasEmail.email, // generated ethereal user pass: jasEmail.password // generated ethereal password } }); // send mail with defined transport object let info = await transporter.sendMail({ from: jasEmail.email, // sender address to: email, // list of receivers subject: "Jas-Team Reset Password", // Subject line text: "", // plain text body html: `<p>To reset your password please click on this link : <a href="http://localhost:3000/reset/${id}">Reset LINK</a> </p>` // html body }); console.log("Message sent: %s", info.messageId); // Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com> // Preview only available when sending through an Ethereal account console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info)); // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou... }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function asyncAwait() {\n try {\n let result = await cekHariKerja(\"sabtu\");\n console.log(`${result} adalah hari kerja`);\n } catch (error) {\n console.log(error.message);\n }\n}", "async function test() {}", "async function bul(){\n let rakamlar = await aslottery(75,6);\n console.log...
[ "0.7114427", "0.68456405", "0.6837009", "0.6797884", "0.66933036", "0.6557015", "0.6536408", "0.6524796", "0.651132", "0.6490613", "0.6484764", "0.64691144", "0.6464954", "0.6452377", "0.6427597", "0.6402709", "0.6381359", "0.63571256", "0.63347524", "0.6320441", "0.6271411",...
0.0
-1
[ 'Pencil', 'Notebook', 'yoyo', 'Gum' ]
function removeDuplicates(arr, cb) { // removeDuplicates removes all duplicate values from the given array. // Pass the duplicate free array to the callback function. // Do not mutate the original array. let noDupes = []; for (let i = 0; i < arr.length; i++) { if (noDupes.indexOf(arr[i]) === -1) { noDupes.push(arr[i]); } } return cb(noDupes); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function names() {\r\n return \"1P 2M 3M 4P 5P 6m 7m\".split(\" \");\r\n}", "function names() {\n return \"1P 2M 3M 4P 5P 6m 7m\".split(\" \");\n}", "listNotes() {\n return [\n 'A',\n 'A#',\n 'Bb',\n 'B',\n 'C',\n 'C#',\n '...
[ "0.61915", "0.6054481", "0.59842277", "0.5893457", "0.5882587", "0.5836354", "0.58030975", "0.5798078", "0.5729936", "0.5715179", "0.5712196", "0.5702763", "0.5688077", "0.568605", "0.56791955", "0.56588984", "0.56557405", "0.564749", "0.56375617", "0.5630869", "0.56274587", ...
0.0
-1
register a VainSocial Guild to a Discord account
async run(msg, args) { util.trackAction(msg, "vainsocial-guild-create"); const guildCreateView = new GuildCreateView(msg, msg.author.id); if (msg.guild.id != 283790513998659585) return await guildCreateView.error(oneLine` Guilds creation is currently running in closed beta. If you want to participate, join our development Discord: https://discord.gg/txTchJY `); try { await api.post("/guild", { shard_id: args.region, name: args.name, identifier: args.tag, user_token: msg.author.id }); } catch (err) { console.error(err); return await guildCreateView.error(err.error.err); } await guildCreateView.respond(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async registerPlayer(channel, username, userId, name) {\n\t\tlet world = await sql.getWorld(channel);\n\t\tlet now = new Date().getTime();\n\t\tthis.addHeat(world, 10);\n\t\tlet player = {\n\t\t\tname: name,\n\t\t\tusername: username,\n\t\t\tuserId: userId,\n\t\t\tchannel: channel,\n\t\t\tglory: 0,\n\t\t\tlevel: t...
[ "0.5914774", "0.59147114", "0.59089494", "0.58881867", "0.57608324", "0.567637", "0.56254506", "0.56077886", "0.5603842", "0.56026936", "0.55886996", "0.55645263", "0.5554767", "0.55330104", "0.55280674", "0.5527664", "0.55274963", "0.55099106", "0.5509777", "0.55052924", "0....
0.6007848
0
Returns: "Closures are awesome" Only variables used in the inner function are remebered!
function outerFn() { var data = "something from outerFn"; var fact = "Remember me!"; return function innerFn() { debugger return fact; //fact is available here but not data } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function outer() {\n const name = \"Javascript Closures\";\n\n function inner() {\n console.log(name);\n }\n return inner;\n}", "function outer() {\n var start = \"Closures are\";\n \n // here the function inner is \n // using 'closure' to pass values\n return function inner() {...
[ "0.74272966", "0.7159963", "0.7096288", "0.7056918", "0.69684964", "0.6956466", "0.6904519", "0.68846434", "0.68666035", "0.6736829", "0.67060804", "0.66871804", "0.66571474", "0.6654203", "0.66239756", "0.6621093", "0.6614128", "0.65705645", "0.6551033", "0.65266186", "0.649...
0.67856574
9
Only variables used in the inner function are remembered! Create Private Variable, a variable that can only be accessed in a certain scope and can not be modified by an external scope.
function counter() { var count = 0; return function inner() { count++; retunr count; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insideClosure() {\n return closureVariable;//The context of this function is saved in the outsideClosure\n }", "function func() {\n var priv = \"secret code\";\n}", "function innerFunction(){\n let InnerNumber=50\n // This variable can be accessible from only innerFunction \n ...
[ "0.6468406", "0.64643604", "0.64478844", "0.6374267", "0.6330861", "0.62423575", "0.62315106", "0.62225723", "0.6185396", "0.61371183", "0.6122974", "0.60874546", "0.6083641", "0.6061481", "0.6025479", "0.6015923", "0.600197", "0.59398574", "0.5914738", "0.59110874", "0.58828...
0.0
-1
1 Each function has it's own private count variable. Closure creates a private variable.
function classroom() { var instructors = ["Elie", "Colt"]; return { getInstructors: function() { return instructors; }, addInstructor: function(instructor) { instructors.push(instructor); return instructors; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function counter() {\n var count = 0;\n return function inner() {\n count++;\n retunr count;\n }\n}", "function newCounter2() {\n let c = 0;\n return function () { c++; return c; } // closure\n }", "function makeCounter() {\n var count = 0;\n return function() {\n v...
[ "0.7401834", "0.7377466", "0.7363019", "0.73508173", "0.7349422", "0.7349422", "0.72939986", "0.7223624", "0.7188349", "0.7170611", "0.7163664", "0.71480024", "0.7126418", "0.7084669", "0.70804065", "0.70567906", "0.70564437", "0.7051473", "0.702364", "0.6984079", "0.6965263"...
0.0
-1
============================================================ HIGHLIGHT AN OPTION AT RANDOM ============================================================
function clearPreviousHighlights() { let listOfItemsTwo = Array.from( document.getElementById("toDoList").getElementsByTagName("li") ); for (let b = 0; b < listOfItemsTwo.length, b++; ) { listOfItemsTwo[b].style.backgroundColor = "rgb(250, 161, 161)"; console.log(listOfItemsTwo[b]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "selectRand() {\n\t}", "function chooseNewRandomColor() {\n var randomNumberSelected = randomNumber(0, numberOfColors - 1);\n randomColor = colorArray[randomNumberSelected];\n $('#userColorPrompt').text(randomColor);\n}", "function randColor() {\n\n // Set random word\n\n\n // Set random word c...
[ "0.6686204", "0.6649535", "0.65898585", "0.6493672", "0.6471839", "0.64489716", "0.6425007", "0.6421571", "0.63995576", "0.6390183", "0.6388943", "0.6362402", "0.6359437", "0.6354224", "0.63214195", "0.6314559", "0.62930554", "0.6273944", "0.62724054", "0.6265688", "0.6239075...
0.0
-1
Define a vlookup function.
function vlookup(data, index, value) { for (i = 0; i < data.length; i++) { if (data[i][0] == value) { return data[i][index]; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function VLOOKUP()\n{\n if(arguments.length==0)\n {\n alert(\"please enter parameter into function \");\n return \"=VLOOKUP()\";\n }\n var j=1;\n var position=arguments[arguments.length-2];\n for(var i=1;i<arguments.length-2;i++)\n {\n if(arguments[0]==arguments[i])\n w...
[ "0.65938437", "0.5956353", "0.59334475", "0.59334475", "0.57606024", "0.5610326", "0.5546967", "0.5452296", "0.5437463", "0.5437463", "0.52365166", "0.522471", "0.5203738", "0.51389515", "0.5131227", "0.5110532", "0.50617903", "0.50617903", "0.50617903", "0.5052512", "0.50350...
0.6678897
0
funcion que permite hacer post
function saveEvent(req, res){//almacenaremos en la BD un producto y sus caracteristicas console.log('POST /api/insert')//registrar_evento console.log(req.body) let rec = new schema() let usermac = new schemaUsers() rec.mac = req.body.mac rec.latitud = req.body.lat rec.longitud = req.body.lon //direccion con una api //tipo de evento ejemplo general //informacion adiccional, ejemplo fui al cine (no hacer la caja especificamente) rec.save((err , registertStored)=>{ if (err) res.status(500).send({message: `Error al salvar en DB ${err}`}) res.status(200).send({registers: registertStored}) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Post() {}", "function Post () {\n}", "function doPost(e) {\r\n // data e kita verifikasi\r\n var update = tg.doPost(e);\r\n\r\n // jika data valid proses pesan\r\n if (update) {\r\n prosesPesan(update);\r\n }\r\n}", "function post(fn) {\n postFunction = fn;\n }", "fun...
[ "0.7488238", "0.70759606", "0.70104444", "0.6906626", "0.6844512", "0.6754156", "0.6392273", "0.6298696", "0.6293198", "0.6200337", "0.6177013", "0.61663234", "0.6163993", "0.61241865", "0.6099969", "0.60572934", "0.6046196", "0.6024864", "0.60120744", "0.5996583", "0.5983521...
0.0
-1
Otherwise, input passes through unchanged.
function setPermissions(content, context) { const permissions = (context.permissions == undefined) ? "UNDEFINED" : context.permissions; if (xdmp.nodeKind(content.value) == 'document' && content.value.documentFormat == 'JSON') { // Convert input to mutable object and add new property const newDoc = content.value.toObject(); // xdmp.log('Doc uri = ' + content.uri); // xdmp.log('Doc permissions = ' + JSON.stringify(permissions)); let docPermissions = []; if (newDoc.alliance === 'rebel') { docPermissions = [{"capability":"read","roleId": xdmp.role('rebel-reader')},{"capability":"update","roleId": xdmp.role('starwars-writer')}]; } else if (newDoc.alliance === 'empire') { docPermissions = [{"capability":"read","roleId": xdmp.role('empire-reader')},{"capability":"update","roleId": xdmp.role('starwars-writer')}]; } else { docPermissions = [{"capability":"read","roleId": xdmp.role('starwars-reader')},{"capability":"update","roleId": xdmp.role('starwars-writer')}]; } context.permissions = docPermissions; // Convert result back into a document content.value = xdmp.unquote(xdmp.quote(newDoc)); } return content; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fixInput( src, dest ) {\n\t\t\tvar nodeName = dest.nodeName.toLowerCase();\n\n\t\t\t// Fails to persist the checked state of a cloned checkbox or radio button.\n\t\t\tif ( nodeName === \"input\" && rcheckableType.test( src.type ) ) {\n\t\t\t\tdest.checked = src.checked;\n\n\t\t\t// Fails to return the sel...
[ "0.6032674", "0.603061", "0.6009299", "0.6009299", "0.6009299", "0.6009299", "0.6009299", "0.6009299", "0.6009299", "0.6009299", "0.6009299", "0.6009299", "0.6009299", "0.6009299", "0.6007864", "0.6007864", "0.6007864", "0.6007864", "0.6007864", "0.6007864", "0.6007864", "0...
0.0
-1
remove all red highlight button press effects on call
function removeButtonPress() { let pressed = document.getElementsByClassName('buttonPressed'); if(pressed.length > 0){ pressed[0].classList.remove('buttonPressed'); stopRotate(); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clearHighlight() {\n\n //TODO - your code goes here -\n }", "function resetHighlight(e) {\n // console.log(\"resetHighlight\");\n CapaAsentamientos.resetStyle(e.target);\n var layer = e.target;\n //layer.closePopup();\n // info.update(); //controla la info de la caja\n}", "removeHighlight() {\n...
[ "0.7491316", "0.7062097", "0.70090705", "0.6962697", "0.69343776", "0.69074816", "0.6859657", "0.68541396", "0.68511474", "0.68228453", "0.67843395", "0.6782698", "0.66760635", "0.6673727", "0.6649944", "0.66498613", "0.66483325", "0.66477096", "0.6639926", "0.6610376", "0.66...
0.0
-1
3. Bean Counting Initial countB function
function countBs (text) { var countB = 0; for (var i=0; i<text.length; i++) { if (text.charAt(i) == "B") { countB++; } } return countB; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "count() {}", "set count(value) {}", "static set BoneCount(value) {}", "get count() {}", "function startCount(obj) {\n valueIncrease();\n valueDecrease();\n \n}", "getCounts () { return this.counts; }", "count() {\n return this.reduce(0, math_1.incr);\n }", "...
[ "0.67461926", "0.6634039", "0.65109676", "0.6447466", "0.6423767", "0.62817854", "0.62816256", "0.6260656", "0.62574005", "0.6150516", "0.6109743", "0.6067077", "0.5968727", "0.5949359", "0.5936703", "0.5910373", "0.59033275", "0.5898787", "0.5823673", "0.5812245", "0.5811094...
0.55148786
64
step 3 is creawting the funciton
function renderGame(){ //step 4 is chaging the values innside the html when button is clicked // step5 use textContent istead of innerText because it gives proper spacing cardId.textContent = "Cards: " for (let i = 0 ;i <cards.length;i++){ cardId.textContent += cards[i] + " " } sumId.innerText = "Sum : " + sum if (sum <= 20){ message = "do u wanna to draw a new card" gameOver = false }else if(sum===21){ message = "you have a blackjack" gameOver = false }else{ message = "Game over, You lost" gameOver = true } messageId.innerText = message }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function three () {}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion (){}", "function fm(){}", "function fuctionPanier(){\n\n}", "function cargarpista1 (){\n \n}", "function fn() {\n\t\t }", "function fourth() {}", "function third() {}", ...
[ "0.6617587", "0.65847725", "0.65847725", "0.65847725", "0.6548318", "0.64730954", "0.64709735", "0.6255368", "0.62185866", "0.62099177", "0.61929995", "0.61405444", "0.60923463", "0.6088644", "0.60759616", "0.60522586", "0.60118663", "0.5968222", "0.5962054", "0.5950033", "0....
0.0
-1
fetchUsers(); promise.all const promise1 = Promise.resolve("hello world"); const promise2 = 10; const promise3 = new Promise((resolve, reject) => setTimeout(resolve, 2000, "goodbye") ); const promise4 = fetch( " ).then((res) => res.json()); Promise.all([promise1, promise2, promise3, promise4]).then((values) => console.log(values) );
function one() { setTimeout(() => { console.log("one"); setTimeout(() => { console.log("two"); setTimeout(() => { console.log("three"); }, 2000); }, 2000); }, 2000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function solution4() {\n //recebe um array, onde cada item do array é uma promise\n //que vai retornar uma outra promise que só irá ser completada quando todas as promise do array foram finalizadas\n //retornado o resultado de todas elas combinadas\n Promise.all([\n fetchJson(\"http://localhost:3000/employe...
[ "0.70916617", "0.6842971", "0.67766273", "0.6687178", "0.65828353", "0.65664965", "0.6508155", "0.6484974", "0.64771646", "0.64760435", "0.6461261", "0.6453046", "0.64471924", "0.642841", "0.6406243", "0.63695115", "0.6366759", "0.6362864", "0.63389266", "0.63322955", "0.6324...
0.0
-1
Constructs a new CreatedIssues. Details about the issues created and the errors for requests that failed.
constructor() { CreatedIssues.initialize(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createIssue (client, repo, title, body, labels) {\n return client.createIssue(repo, title, body, labels).then(convertIssue);\n}", "function createIssue() {\n console.log(\"Proceeding to create issue from the ticket\");\n getTicketDetails(\n function (ticketData) {\n checkAndCreateIssue(\n ...
[ "0.66150194", "0.6564893", "0.65021205", "0.5794785", "0.57895684", "0.5693568", "0.56163883", "0.5580467", "0.55162996", "0.5356118", "0.5248021", "0.52168137", "0.5195792", "0.5067081", "0.50495946", "0.49769768", "0.49577832", "0.49164063", "0.48999938", "0.4896688", "0.48...
0.6509844
2
Initializes the fields of this object. This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mixins). Only for internal use.
static initialize(obj) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n super();\n this._init();\n }", "init() {\n this._super(...arguments);\n this._applyDefaults();\n }", "_init() {\n\t\tthis.life.init();\n\t\tthis.render.init();\n\n\t\tthis.emission.init();\n\t\tthis.trail.init(this.node);\n\n\t\tthis.color.init();\n\t}", "function Co...
[ "0.71311355", "0.6963286", "0.6813534", "0.6745508", "0.671502", "0.66422415", "0.6633527", "0.6601923", "0.65804154", "0.65637517", "0.64092934", "0.64064515", "0.63348633", "0.63038784", "0.62966686", "0.62827736", "0.6268644", "0.6240601", "0.62397826", "0.62342745", "0.62...
0.0
-1
array of object food
function Field(x, y, w, h) { //object "field". this.x = x; //value - field_x this.y = y; //value - field_y this.h = h; //value - field_height this.w = w; //value - field_width this.draw = function(color) { //function for drawing field area c.globalAlpha = 1; //transparency c.fillStyle = color; //field color c.fillRect(this.x - 1, this.y - 1, this.w + 1, this.h + 1); //draw rectangle } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function genFoodList(searchAr) {\n\t\t\t\t\t//var foodsAr = [];\n\t\t\t\t\t_.each(searchAr, function(elem, idx) {\n\t\t\t\t\t\tapp.food = new app.Food();\n\t\t\t\t\t\tapp.food.set('id', elem.fields.item_id);\n\t\t\t\t\t\tapp.food.set('name', elem.fields.item_name);\n\t\t\t\t\t\tapp.food.set('brandName', elem.field...
[ "0.7420616", "0.68248415", "0.6709407", "0.64941496", "0.6411862", "0.64087", "0.6340475", "0.6280125", "0.62399447", "0.6152473", "0.6046296", "0.60406095", "0.60291564", "0.5956785", "0.5947752", "0.5893447", "0.5870656", "0.586029", "0.5839502", "0.58330715", "0.5832116", ...
0.0
-1
randomize.use for food creating
function rand(max, min) { return Math.floor(Math.random() * (max - min + 1)) + min; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomFood() {\n\n\t\tif (Math.random() > 0.5) {\n\t\t\treturn 'pizza';\n\t\t} \n\t\treturn 'ice cream';\n\t}", "function generate_food_test(){\r\n\tnew_food = new food(Math.floor(Math.random()*(990 - 10 + 1)) + 10, Math.floor(Math.random()*(580 - 100 + 1)) + 10, food_array.length);\r\n\tfood_array.push...
[ "0.7558249", "0.74829537", "0.73325974", "0.7311614", "0.7308627", "0.73019224", "0.7292889", "0.7291377", "0.7290783", "0.7284282", "0.72791225", "0.7208185", "0.7193375", "0.7192154", "0.7185617", "0.7174163", "0.71547556", "0.7068828", "0.7059393", "0.7005379", "0.6979642"...
0.0
-1
processing press arrows or WASD
function key_press_observer() { var key_pressed_flag = false; //if key was pressed document.onkeydown = function(e){ if(!key_pressed_flag) { if(e.which == "37" || e.which == "65") { if(s[0].d != 'x') { s[0].d = '-x'; } } if(e.which == "39" || e.which == "68") { if(s[0].d != '-x') { s[0].d = 'x'; } } if(e.which == "38" || e.which == "87") { if(s[0].d != 'y') { s[0].d = '-y'; } } if(e.which == "40" || e.which == "83") { if(s[0].d != '-y') { s[0].d = 'y'; } } key_pressed_flag = true; } //alert(e.which); } document.onkeyup = function(e){ key_pressed_flag = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function arrowPress(i) {\n\t\n\t\n\t\n\t\n}", "onArrowPressed() {\r\n var count = 0;\r\n //listener to check / execute when buttons are pressed.\r\n document.addEventListener('DOMContentLoaded', () => {\r\n 'use strict';\r\n\r\n document.addEventListener('keydown', event => {\r\n const ...
[ "0.72311777", "0.6909673", "0.6721543", "0.66612154", "0.6645356", "0.6644154", "0.6606668", "0.6593319", "0.6569359", "0.6563107", "0.6554164", "0.6511554", "0.65069044", "0.6489979", "0.64809823", "0.6467166", "0.64605504", "0.64532095", "0.64485085", "0.6439929", "0.643387...
0.0
-1
I paired with: Austin Dorff on this challenge. This challenge took me [1] hours. Warm Up
function Athlete(name, age, event, quote) { this.name = name; this.age = age; this.event = event; this.quote = quote; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function solution(s) {\n\n}", "function runProgram(input){\n let input_arr = input.trim().split(\"\\n\")\n let [no_houses, no_towers] = input_arr[0].trim().split(\" \").map(Number)\n let houses = input_arr[1].trim().split(\" \").map(Number).sort((a, b) => a - b)\n\n let low = 0\n let high = houses...
[ "0.60129744", "0.59960604", "0.5839157", "0.5679019", "0.5661457", "0.56171346", "0.5616116", "0.5605974", "0.55914146", "0.558564", "0.55807626", "0.5580424", "0.5579074", "0.5572323", "0.5556349", "0.55474025", "0.55277663", "0.55268294", "0.55194587", "0.55145293", "0.5498...
0.0
-1
Save state to localStorage
save(state) { localStorage.setItem('items', JSON.stringify(state.items)); return state; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "save() {\n localStorage.setItem(\"state\", this.getStateString());\n if (this.debug) {\n console.log(\"state saved\");\n console.log(this.state);\n }\n }", "function saveToLocalStorage(state) {\n try {\n const serializedState = JSON.stringify(state)\n lo...
[ "0.8773307", "0.82808006", "0.8241637", "0.8209384", "0.81839734", "0.81603986", "0.81532216", "0.8139226", "0.81242806", "0.7910965", "0.7901981", "0.78588945", "0.77878964", "0.7737044", "0.7731093", "0.7662471", "0.7644706", "0.76212615", "0.7568311", "0.7482604", "0.74790...
0.766867
15
Log inventory button handle
log() { console.log('Current inventory:'); console.log(this.state.items); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "showInventory() {\n // set effect start time and turn it on\n // intercept clicks and send them to Inventory query method\n // set selected inventory object in game state and set icon\n // wtf now\n }", "recordInventory(){\r\n this._listProduct();\r\n }", "function btn_displayInventory()...
[ "0.64898735", "0.6409708", "0.62802345", "0.59285975", "0.59136915", "0.5900603", "0.58943766", "0.58430195", "0.58298415", "0.5802034", "0.5727171", "0.5725761", "0.5633412", "0.5629751", "0.56118107", "0.5601072", "0.5585313", "0.552823", "0.55170697", "0.5515772", "0.55065...
0.6519033
0
On search input value changed
onSearchChange(e) { this.setState({ ...this.state, search: e.target.value && e.target.value.toLowerCase() }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "search(value) {\n this.ux.input.value = value;\n this.ux.input.focus();\n this.onInputChanged();\n }", "onSearch(value) {\n this.model.query = value;\n }", "onSearch(value) {\n this.model.query = value;\n }", "onSearchTermChange() {\n this.search...
[ "0.80515385", "0.77766496", "0.77766496", "0.77617943", "0.7732296", "0.7670839", "0.7604255", "0.7487656", "0.74692285", "0.74522704", "0.74370944", "0.7414747", "0.73573136", "0.73050797", "0.72938204", "0.72924215", "0.7288976", "0.7227757", "0.72134346", "0.72091055", "0....
0.0
-1
Toggle item's isHealthy field
toggleHealthy(id) { this.setState(this.save({ ...this.state, items: { ...this.state.items, [id]: { ...this.state.items[id], isHealthy: !this.state.items[id].isHealthy } } })); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggleRefill() {\n this.setState({\n low_inventory: !this.state.low_inventory\n })\n }", "eat () {\n if (this.food === 0) {\n this.isHealthy = false;\n\n } else {\n this.food -= 1;\n }\n }", "function toggleItem(item)\r\n{\r\n\tif( item != null) {\r\n\t...
[ "0.6465654", "0.62750953", "0.6227371", "0.62065625", "0.58992845", "0.5824309", "0.5820631", "0.58166885", "0.58051705", "0.5715007", "0.5713039", "0.5697169", "0.5628342", "0.5609164", "0.55995464", "0.5598439", "0.55949", "0.55839103", "0.5582965", "0.5580613", "0.5569915"...
0.75902337
0
Toggle item's isDelicious field
toggleDelicious(id) { this.setState(this.save({ ...this.state, items: { ...this.state.items, [id]: { ...this.state.items[id], isDelicious: !this.state.items[id].isDelicious } } })); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toggleItem(item)\r\n{\r\n\tif( item != null) {\r\n\t\titem.purchased = !item.purchased;\r\n\t}\r\n\tstoreGroceryItems();\r\n}", "toggle() {\n this.setFavorite(!this.restaurant.is_favorite);\n }", "function toggle(item){\n\titem === true ? item = false : item = true\n\treturn item\n}", "function ...
[ "0.6048106", "0.60085034", "0.5944164", "0.5835949", "0.58276623", "0.57322216", "0.570261", "0.56785315", "0.5639036", "0.5638164", "0.55959874", "0.5592203", "0.5554324", "0.54977524", "0.5487203", "0.5478743", "0.5468067", "0.5399377", "0.5392573", "0.5391573", "0.53906", ...
0.6964257
0
vuerouter v3.0.1 (c) 2017 Evan You
function i(e,t){0}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jj(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"source.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function TM(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return ...
[ "0.6079882", "0.6061355", "0.5882436", "0.5864603", "0.5863027", "0.58375025", "0.58186346", "0.57866293", "0.5745777", "0.5725568", "0.56346124", "0.5616481", "0.5615051", "0.5608341", "0.5605354", "0.5597574", "0.55807894", "0.557704", "0.5564271", "0.5559546", "0.555874", ...
0.0
-1
Remove and return a random element from an array
function pickRandom(arry) { return arry.splice(Math.floor(Math.random() * arry.length), 1)[0]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rand(myArray){\n\tvar element = myArray[Math.floor(Math.random() * myArray.length)];\n\tmyArray.splice(myArray.indexOf(element),1); // remove element from array so it doesnt show up twice\n\n\treturn element;\n}", "function sample(arr) {\n const randIdx = Math.floor(Math.random() * arr.length)\n const...
[ "0.8120546", "0.7991433", "0.79814106", "0.75870717", "0.7490895", "0.7482256", "0.7445996", "0.7441531", "0.7440759", "0.7419549", "0.7419549", "0.74029005", "0.74029005", "0.74021566", "0.74018985", "0.7395785", "0.7395785", "0.7395785", "0.7395785", "0.7393579", "0.7393579...
0.81136036
1
Given two cells, return the unvisited one if it exists, or undefined if it doesn't
function selectUnvisited(cell1, cell2) { if (cell1 && cell2) { if (cell1.visited && !cell2.visited) { return cell2; } else if (cell2.visited && !cell1.visited) { return cell1; } } return undefined; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "hunt(cells) {\n if (cells.length > 0) {\n for (let i = 0; i < cells.length; i++) {\n let cell = cells[i];\n if (!cell.visited) {\n let neighbors = this.findNeighbors(cell);\n for (let j = 0; j < neighbors.length; j++) {\n let neighbor = neighbors[j];\n ...
[ "0.6855531", "0.67087406", "0.66718346", "0.6577904", "0.6567586", "0.6567586", "0.6445443", "0.6445443", "0.6428121", "0.64280725", "0.6422335", "0.6422335", "0.6422335", "0.6422335", "0.64222294", "0.6417886", "0.6409472", "0.64008653", "0.63808316", "0.63758165", "0.637581...
0.8276834
0
Contribute Spezial thanks to Ben Alman,
function emotify(txt, callback) { if (typeof callback === "undefined") { callback = null; } callback = callback || function (img, title, smiley, text) { title = (title + ', ' + smiley).replace(/"/g, '&quot;').replace(/</g, '&lt;'); return '<img src="' + img + '" title="' + title + '" alt="" class="smiley" style="vertical-align: -20%;"/>'; }; return txt.replace(EMOTICON_RE, function (a, b, text) { var i = 0, smiley = text, e = emoticons[text]; if (!e) { while (i < lookup.length && !lookup[i].regexp.test(text)) { while (i < lookup.length && !lookup[i].regexp.test(text)) { i = i + 1; } smiley = lookup[i].name; e = emoticons[smiley]; } // If the smiley was found, return HTML, otherwise the original search string return e ? (b + callback(e[0], e[1], smiley, text)) : a; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "protected internal function m252() {}", "function jessica() {\n $log.debug(\"TODO\");\n }", "transient protected internal function m189() {}", "function Pythia() {}", "function setup() {}", "transient privat...
[ "0.6487074", "0.63453186", "0.62229335", "0.59590936", "0.5950128", "0.5921222", "0.58539945", "0.5845867", "0.57624286", "0.57013255", "0.5659318", "0.56250995", "0.5599084", "0.5599084", "0.5596134", "0.5592126", "0.5590715", "0.555517", "0.5518633", "0.55061805", "0.547316...
0.0
-1
Created by David on 10/8/13.
function Mod10(i) { return i = Math.floor(i / 10) * 10; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "transient protected internal function m189() {}", "transient private protected internal function m182() {}", "transient private internal function m185() {}", "static private internal fun...
[ "0.6608786", "0.6521867", "0.6238831", "0.6014044", "0.59796077", "0.59386176", "0.5905661", "0.5897389", "0.5896027", "0.58694845", "0.57782376", "0.5728048", "0.5686034", "0.5685365", "0.5678602", "0.55812174", "0.55287075", "0.55215573", "0.54619503", "0.54389143", "0.5422...
0.0
-1
Created by David on 10/8/13. / declare var qx:any; declare var webfrontend:any; import qx = require("qx\qxEa");
function leftPad(num, minsize, padstring) { var str = num.toString(); while (str.length < minsize) str = padstring + str; return str; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadJSX() {\r\n var csInterface = new CSInterface();\r\n var extensionRoot = csInterface.getSystemPath(SystemPath.EXTENSION) + \"/jsx/\";\r\n csInterface.evalScript('$._ext.evalFiles(\"' + extensionRoot + '\")');\r\n}", "static get requires() {\n return {\n 'JQX.Button': 'jqxb...
[ "0.551936", "0.55149883", "0.5509336", "0.5433376", "0.5424888", "0.54215926", "0.53669775", "0.53619456", "0.5344097", "0.5330592", "0.5322878", "0.52791816", "0.52791744", "0.5233958", "0.51636916", "0.51347935", "0.5078807", "0.50280595", "0.5021068", "0.49804685", "0.4977...
0.0
-1
======================================== video functions =======================================
function videoSetup(){ var queueCode = ` var storedVideo = null; var possibleClasses = ["vjs-tech", "jw-video jw-reset", "video-stream html5-main-video"]; for (var i = 0; i < possibleClasses.length; i++){ try{ var possibleClass = possibleClasses[i]; document.getElementsByClassName(possibleClass)[0].className storedVideo = document.getElementsByClassName(possibleClass)[0]; console.log("Found video from tag, it is now stored"); break; }catch (error2){ } } if (!storedVideo){ try{ document.getElementsByTagName("video")[0].ClassName; storedVideo = document.getElementsByTagName("video")[0] console.log("Normal video found"); }catch(error){ console.log("No video found"); } } if (storedVideo){ storedVideo.onplay = function() { chrome.runtime.sendMessage("started"); } storedVideo.onpause = function() { chrome.runtime.sendMessage("paused"); } } `; try{ chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { chrome.tabs.executeScript(tabs[0].id, {code: queueCode}); }); }catch(error){} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function videoReady() { }", "function manipulatevideo(){\n if( cameravideo || capturevideo ){\n cameravideo = false;\n capturevideo = false;\n capturestream = null;\n buttonOff(document.querySelector('.app__system--button.video'));\n camerastream.getVideoTracks()[0].enabled ...
[ "0.7374162", "0.72876006", "0.7089911", "0.70839775", "0.7062106", "0.7059034", "0.6970127", "0.69511926", "0.6915005", "0.6839542", "0.683389", "0.68315166", "0.68011147", "0.67961186", "0.6790633", "0.6782508", "0.6771137", "0.6726497", "0.6707433", "0.669547", "0.6694877",...
0.0
-1
sends a command to the video player
function videoFunction(order){ // .load(), .play(), .pause(), .currentTime = x seconds try { chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { chrome.tabs.executeScript(tabs[0].id, {code: "storedVideo{0};".format(order)}); }); }catch(error){} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendPlaying() {\n socket.broadcast.emit('videoPlay', true);\n }", "function sendCommand(cmd, data) {\n serverWindow.postMessage({cmd: cmd, data: data}, \"*\")\n }", "function sendVideoControl(controlOption) \r\n{\r\n\tsocketSend('C' + controlOption);\r\n}", "function postMessageToPlayer(play...
[ "0.6622283", "0.66198784", "0.6601374", "0.6582719", "0.6569811", "0.6464528", "0.64250815", "0.64172655", "0.6416094", "0.6388351", "0.6387299", "0.63726753", "0.6344157", "0.631129", "0.63061756", "0.6276446", "0.62585497", "0.62436396", "0.62418044", "0.6236537", "0.619022...
0.0
-1
posts a message for us to get later
function videoProperty(info){ try{ waitingOn = info; chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { chrome.tabs.executeScript(tabs[0].id, {code: "chrome.runtime.sendMessage(storedVideo{0});".format(info)}); }); }catch(error){} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function postMessage() {\n if (!isLoggedIn()) return;\n\n var options =\n {\"actor\" : {\n \"displayName\" : appUser.get('username'),\n \"uuid\" : appUser.get('uuid'),\n \"username\" : appUser.get('username'),\n \"image\" : {\n \"duration\" : 0,\n \"height\" : 80,\n ...
[ "0.7226471", "0.701391", "0.6959707", "0.6914053", "0.6885981", "0.6750489", "0.67214906", "0.66551894", "0.66327065", "0.66227937", "0.65763366", "0.6565128", "0.65508544", "0.6544857", "0.6501297", "0.65002126", "0.6495163", "0.6482702", "0.64667344", "0.6454195", "0.645338...
0.0
-1
======================================== Test Code =======================================
function make(){ db.collection("Rooms").doc("178912012").set({ LastUpdate: new Date().getTime(), PartyLeader: "Noor", Status: "Paused", Watched: 0, ID: 178912012, Link : "blank" }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function testRun()\r\n{\r\n}", "function PerformanceTestCase() {\n}", "function TestMethods() {}", "function test_candu_graphs_datastore_vsphere6() {}", "function generateTest() {\n // TODO\n}", "function testAll() {\n testAssert()\n testRemainder()\n testConversions()\n}", "function setUp(...
[ "0.63480455", "0.61727196", "0.6044146", "0.59882545", "0.5984855", "0.5961664", "0.5954018", "0.5925147", "0.58441466", "0.58421874", "0.58378106", "0.58065856", "0.58061576", "0.58005077", "0.57696766", "0.5769214", "0.574538", "0.5745036", "0.57398546", "0.5739773", "0.573...
0.0
-1
check if error icon exists remove it and add green icon
function handleValidInputStyle(inputField, i) { if (i.classList.contains(errorIcon)) { i.classList.remove(errorIcon, "red"); inputField.classList.remove("red-border"); } i.classList.add(checkIcon, "green"); inputField.classList.add("green-border"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function iconError() {\n if (this.src != 'https://cdn.discordapp.com/embed/avatars/1.png?size=128') {\n const match =\n this.src.match(/^https:\\/\\/cdn.discordapp.com\\/avatars\\/([^.]+)\\./);\n const matchSB =\n this.src.match(/^https:\\/\\/www.spikeybot.com\\/avatars\\/([^.]+)\\./...
[ "0.7146804", "0.671227", "0.6653477", "0.64438134", "0.63740903", "0.6268073", "0.62050456", "0.61791587", "0.61711633", "0.6073418", "0.6067236", "0.60156107", "0.60156107", "0.60156107", "0.5952537", "0.594026", "0.5910265", "0.5900765", "0.588926", "0.5874154", "0.5828988"...
0.0
-1