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
recursive add all sites
function AddSiteRec(arr, i){ if(i >= arr.length) return AddSiteDataRec(dataArray,0); //add site data after all site added var site = arr[i]; WeatherStation.findOneAndUpdate({ '_id': site._id}, {'$setOnInsert': site}, {upsert: true}, function(){ AddSiteRec(arr, i+1); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addAll() {}", "function AddSiteRec(arr, i){\n\t\tif(i >= arr.length) return AddSiteDataRec(dataArray,0);\t//add site data after all site added\n\t\tvar site = arr[i];\n\t\tSensorSite.findOneAndUpdate({ '_id': site._id}, {'$set': { 'lat': site.lat, 'lng': site.lng }, '$setOnInsert': site}, {upsert: true}...
[ "0.598581", "0.58276397", "0.5475636", "0.54092544", "0.52430755", "0.52112955", "0.5178721", "0.51646996", "0.51457155", "0.5097964", "0.50721014", "0.5067919", "0.5063044", "0.50130963", "0.4997893", "0.4979793", "0.49714512", "0.4933651", "0.49198806", "0.48909092", "0.487...
0.59028655
1
recursive add all roads
function AddRoadRec(arr, i){ if(i >= arr.length) return; var road = arr[i]; RoadSegment.findOneAndUpdate({ '_id': road._id}, {'$setOnInsert': road}, {upsert: true}, function(){ AddRoadRec(arr, i+1); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addAll() {}", "function drawRoads(svg) {\n var absLoc, field, pointA, pointB, relLoc, road, rotAngle, settings;\n\n for(var i = 0; i < board.roads.length; i++) {\n // For each road, find out which field it belongs to\n road = board.roads[i];\n field = getFieldById(board.fields...
[ "0.5875547", "0.56392026", "0.5616612", "0.561551", "0.5578332", "0.5518525", "0.5359157", "0.5325193", "0.52758986", "0.5250128", "0.518103", "0.5179121", "0.5172217", "0.5136162", "0.5131591", "0.5123548", "0.5090899", "0.5088562", "0.50873643", "0.5084651", "0.5079851", ...
0.5765526
1
recursive add all road data
function AddRoadDataRec(arr, i){ if(i >= arr.length) return; var d = arr[i]; var tDay = new Date(d.time); var date = tDay.getFullYear()+"_"+(tDay.getMonth()+1)+"_"+tDay.getDate(); var RoadData = mongoose.model('RoadData_'+date, RoadDataSchema); RoadData.findOneAndUpdate({ '_id': d._id}, {'$setOnInsert': d}, {upsert: true}, function(){ AddRoadDataRec(arr, i+1); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addRoad(){\r\n \r\n //add highstreet road\r\n $('.subway-map').append( '<ul data-color=\"#D6D6D6\" ><li data-marker=\"town\" data-labelPos=\"e\" data-coords=\"11,2\" data-dir=\"W\">.</li><li data-coords=\"11,16\" data-dir=\"S\"></li>')\r\n \r\n //add base road\r...
[ "0.6102099", "0.58896524", "0.5835566", "0.58110774", "0.58005697", "0.5625498", "0.54893553", "0.5489021", "0.5387858", "0.53753465", "0.53680164", "0.5365288", "0.53627497", "0.53501195", "0.53438324", "0.5334336", "0.5313325", "0.53131807", "0.5309877", "0.5295864", "0.529...
0.55874205
6
calcul du prix total du panier =====================================
function calcul(){ let getPrice = localStorage.getItem("panier"); let getPrice2 = JSON.parse(getPrice); totalBasket = [] getPrice2.forEach(allPrice => { getPrice3 = +allPrice.price; totalBasket.push(getPrice3) console.log(totalBasket); var totalBasket2 = totalBasket.reduce((a, b)=> a + b,0); // additionner les valeurs du tableau document.getElementById("somme").innerHTML = totalBasket2/100 +" €"; }) }//fin de la fonction calcul
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculerPrixTotal(nounours) {\n prixPanier = prixPanier += nounours.price;\n}", "function prixTotal() {\n let total = 0;\n for (let j= 0; j < objPanier.length; j++) {\n total = total + objPanier[j].price * objPanier[j].number;\n }\n let afficheTotal = document.querySelector(\"#total\...
[ "0.7882561", "0.77320755", "0.7714898", "0.7597938", "0.72678727", "0.72475845", "0.71169984", "0.6955775", "0.6952378", "0.69262075", "0.68465906", "0.68224823", "0.6727693", "0.6715032", "0.67033523", "0.66843265", "0.66798884", "0.66727716", "0.66586524", "0.66436", "0.661...
0.0
-1
envoyer l'objet sur le serveur : promise & requete ==================================================
function promisePost(url){ return new Promise(function(resolve, reject){ var xhr2 = new XMLHttpRequest(); xhr2.open("POST", "http://localhost:3000/api/cameras/order", true); xhr2.setRequestHeader("Content-Type", "application/json"); xhr2.onreadystatechange = function() { if (xhr2.readyState === 4) { resolve(xhr2.response); } else if (this.readyState == 4 && this.status == 404){ reject(Error('erreur 404' + request.statusText)); } } xhr2.send(JSON.stringify(body)); })//fin de la fonction Promise 1ere partie }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "one_emregencia(){\n fetch(this.url+'/emergencia2.0/Vue_one_emergencia/'+this.idCita) \n .then(resp => resp.json())\n .then( one_emergencia =>{\n console.log(one_emergencia, \" esto es lo que quiero ver <<<<<<<<<<<<<>>><<<<><<>>><<<><<<<>><<<>>>\")\n ...
[ "0.63561577", "0.6214919", "0.60718083", "0.6027376", "0.5980584", "0.5955408", "0.59397113", "0.5918994", "0.59027666", "0.5892742", "0.5854349", "0.5839032", "0.57890075", "0.57828635", "0.57748955", "0.57674015", "0.57610846", "0.57580787", "0.57551825", "0.57459867", "0.5...
0.5469869
71
horizontal coordinate left position relative to the viewport convert into percentage from left
getHorizontalPosition(event){ const pointerX = event.clientX - this.zoomImgSize.left; return this.turnToPercentage(pointerX, this.zoomImgSize.width); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function viewLeft() {\r\n if (self.pageXOffset)\r\n return self.pageXOffset;\r\n\r\n if (document.body && document.body.scrollLeft)\r\n return document.body.scrollLeft;\r\n\r\n return 0;\r\n}", "function getLeftX()/*:Number*/ {\n return com.coremedia.cms.studio.imageeditor.util.ImageEditorUtil.getX(t...
[ "0.7437368", "0.73965096", "0.7223408", "0.7174788", "0.69711846", "0.690985", "0.6881634", "0.6855071", "0.6808466", "0.6785392", "0.6784588", "0.6753316", "0.6721252", "0.67142636", "0.6710427", "0.67066664", "0.67066664", "0.66718125", "0.66594684", "0.665148", "0.6638399"...
0.7004912
4
set inline css transform x% and y% position
changePosition(x, y) { this.zoomImg.style.transformOrigin = `${x}% ${y}%`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_applyTransform() {\n this.wrapper.style.transform = [\n 'translateX(-50%)',\n `translateX(${this._translate})`,\n ].join(' ');\n }", "function setTransform(which,x,y){\n\tdocument.getElementById(which).setAttributeNS(null,'transform','translate('+x+','+y+')');\n}", "function transform(x, y) {...
[ "0.71664494", "0.7138485", "0.70667714", "0.70536333", "0.6933943", "0.67270523", "0.67138356", "0.6679875", "0.6651277", "0.6623875", "0.6571333", "0.6535755", "0.65205836", "0.648345", "0.64742774", "0.64661556", "0.6444201", "0.641426", "0.6405146", "0.640229", "0.63599986...
0.7127161
2
display sign up screen
function SignupPage(props) { const { user } = useContext(UserContext); const [isLoginError, setIsLoginError] = useState(false); const [errorMessage, setErrorMessage] = useState(''); const handleBackButton = (e) => { e.preventDefault(); setIsLoginError(false); props.history.push('/login') } const signup = (e) => { e.preventDefault(); const { username, name, password } = e.target; //check if fields are empty if (name.value === "" || username.value === "" || password.value === "") { setIsLoginError(true); setErrorMessage("You must provide a name, username and password"); return; } axios.post(signupUrl, { username: username.value, name: name.value, password: password.value }) .then(res => { //if res is 201, redirect back to login page console.log(res); if (res.status === 201) { setIsLoginError(false); props.history.push('/login') } }) .catch(err => { console.log(err); }) }; if (localStorage.getItem("authToken") && user) return <Redirect to='/profile' />; return ( <main className="profile-page"> <form className="profile-page__form" onSubmit={signup}> <h1 className="profile-page__header">SignUp</h1> {isLoginError && <label className="profile-page__error" >{errorMessage}</label>} <label htmlFor="username" className='profile-page__label'>Username</label> <input type="text" name="username" className='profile-page__input input' placeholder='Enter a username' /> <label htmlFor="name" className='profile-page__label'>Name</label> <input type="text" name="name" className='profile-page__input input' placeholder='Enter your name' /> <label htmlFor="password" className='profile-page__label'>Password</label> <input type="password" name="password" className='profile-page__input input' placeholder='Enter a password' /> <button className="profile-page__button button" type="submit" >Sign Up</button> <button className="profile-page__signup" onClick={handleBackButton}>Back</button> </form> </main> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleSignUp(e) {\n setVisible(false);\n setSignUp('true');\n }", "function goSignUp() {\n \n body.innerHTML = renderSignupDiv(first, \n last, email1, pass1, '', message1);\n assignListener('signup2');\n }", "function signup() {\r\n try {\r\n if (!dw.s...
[ "0.7493246", "0.7480653", "0.68470377", "0.6716421", "0.66453147", "0.66156954", "0.6613775", "0.66067463", "0.6587729", "0.65751034", "0.65479136", "0.6543509", "0.65352565", "0.64729863", "0.6452941", "0.64435333", "0.6423586", "0.640565", "0.6367625", "0.6353387", "0.63462...
0.0
-1
common function to make http request
function makeHttpRequest(req,reqPath,sessionInfo,res, next,queryString){ common.prepareCommonApiManagerRequest({request:req,sessionInfo:sessionInfo,identifier:'api'}) .then((response) => { proxy({ url: response.apiUrl+reqPath, timeout: 120000 })(response.request, res, next); }).catch((error) => { res.status(500).send(error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function http(_x) {\n return _http.apply(this, arguments);\n} // exported for testing", "function http(_x) {\n return _http.apply(this, arguments);\n} // exported for testing", "function http_request(method, url, payload, headers, callback) {\n var client = Ti.Network.createHTTPClient({\n onload: fun...
[ "0.67917734", "0.67917734", "0.673303", "0.6713017", "0.6688321", "0.6593255", "0.6584073", "0.6576707", "0.65706253", "0.65698165", "0.6560821", "0.65339994", "0.64995944", "0.6493878", "0.64936024", "0.64737517", "0.6449988", "0.64448106", "0.64448106", "0.6403712", "0.6403...
0.0
-1
When the user clicks on the button, scroll to the top of the document
function topFunction() { document.body.scrollTop = 0; document.documentElement.scrollTop = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scrollToTop () {\n //getting the currentPosition position of the button\n let currentPosition = document.documentElement.scrollTop || document.body.scrollTop;\n //if the position is greater than 0 then we'll scroll to the top of the page\n if (currentPosition > 0) {\n ...
[ "0.84993553", "0.8494405", "0.82378393", "0.80316997", "0.80233413", "0.80121213", "0.79945135", "0.79568183", "0.79496557", "0.7944984", "0.79241276", "0.7910783", "0.7908435", "0.7896463", "0.7892217", "0.7870936", "0.7841654", "0.7819492", "0.7818606", "0.7802266", "0.7773...
0.0
-1
PLAYER CONSTRUCTOR CREATES PLAYER OBJECTS
function Player(name){ this.name = name; this.totalScore = 0; function { totalScore += turnScore } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Player() {}", "function Player() { }", "constructor(player) {\n this.player = player;\n }", "constructor(player){\n this.player = player;\n }", "constructor(name, type){\n super(name,type)\n // en el scope del constructor \n // invocamos con super el name y el \n ...
[ "0.7960625", "0.7719496", "0.77078843", "0.76639265", "0.75512606", "0.7263172", "0.71391094", "0.7111868", "0.71035224", "0.70951515", "0.70873326", "0.70654565", "0.70652163", "0.7057913", "0.70214564", "0.7014492", "0.69717354", "0.6963045", "0.6944044", "0.6913351", "0.69...
0.0
-1
FUNCTION ROLL SIMULATES ROLL OF ONE DICE AND RETURNS VALUES 1 THROUGH 6
function Roll(){ rollScore = Math.floor(Math.random() * 5 + 1); return rollScore; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function betMultiplier(){\n\tlet multiplier = dieRoll(4);\n\twhile(multiplier === 1){\n\t\tmultiplier = betMultiplier(4) //running function again until multiplier is not equal to 1.\n\t}\n\treturn multiplier;\n}", "function rollMultipleD6(amount){\r\nvar result = [];\r\nfor(var rollNumber = 0; rollNumber < amo...
[ "0.6268492", "0.62497216", "0.62462896", "0.6236878", "0.6161072", "0.612417", "0.60281724", "0.5974889", "0.59691626", "0.5958496", "0.59574425", "0.59361684", "0.5926257", "0.59233993", "0.59078246", "0.58951145", "0.58459604", "0.5825902", "0.58210033", "0.58173096", "0.58...
0.0
-1
Determine the number of cards to be displayed in the list view on a single page
function countCardsPerPage() { // spr dlaczego tutaj musiałem dawać document.get zamiast // np. this.pseudoFooter.offsetHeight - wyrzucało mi undefined // nie czaje czemu ???? var cardsWrapperHeight = window.innerHeight - (document.getElementById("header").offsetHeight + document.getElementById("cardsFilter").offsetHeight + document.getElementById("pseudoFooter").offsetHeight), listViewCardHeight = 150, // ugly, should be avoided cardsPerPage = Math.floor(cardsWrapperHeight / listViewCardHeight); return cardsPerPage; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showCardAmount(){\n $(\"#total-cards\").html(model.getCardObjArr().length);\n }", "numberOfCards()\n {\n return this.cards.length;\n }", "count()\n\t{\n\t\treturn this.numCards;\n\t}", "function countProductsOnPage() {\n $('.displayed__localCount').html(document.querySelect...
[ "0.68587184", "0.6747867", "0.66923416", "0.6524864", "0.64673465", "0.64236706", "0.6365921", "0.6360424", "0.63435686", "0.6252392", "0.62442", "0.6230244", "0.6229579", "0.622242", "0.6207617", "0.62056404", "0.62056404", "0.6173308", "0.612505", "0.6124171", "0.61176807",...
0.76270974
0
Handle drag and drop txt files
function _getCardFromTxt(e) { var files = e.target.files || e.dataTransfer.files, f = files[0]; if (!f) { alert("Failed to load file"); } else if (!f.type.match('text.*')) { alert(f.name + " is not a valid text file."); } else { var reader = new FileReader(); reader.onload = function(e) { var contents = { title: f.name, url: '', text : e.target.result, tags : '', submitLabel: 'Create Card', attachments: [] }; cardForm.init(contents); }; reader.readAsText(f); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleDrop(event) {\n unhighlight(event);\n var dt = event.dataTransfer;\n var files = dt.files;\n handleFiles(files);\n }", "function _handleDrop(e){\n\n var files = e.originalEvent.dataTransfer.files,\n docPath =currentDoc.file._parentPath,\n relativeFilename;...
[ "0.73746264", "0.73171264", "0.7201284", "0.7118121", "0.69741344", "0.6963026", "0.6903626", "0.68486583", "0.6828326", "0.6799108", "0.6788369", "0.67517596", "0.6742247", "0.6714297", "0.67078984", "0.66714805", "0.66061205", "0.6603039", "0.65929705", "0.655634", "0.65338...
0.0
-1
Only letters and whitespace, no other characters
function strictMatchForFAndPLevel(text) { const trimmed = text.trim(); return (_.has(ORDERED_F_AND_P_ENGLISH_LEVELS, trimmed.toUpperCase())) ? trimmed.toUpperCase() : null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lettersOnly(input) {\n //let regex = /[^a-z]/gi //\n let regex = /[^a-z\\s]/gi\n // let regex = /^[a-z ,.'-]+$/i //\n input.value = input.value.replace(regex, \"\");\n}", "function containsOnlyLetters(input)\n{\n\treturn /^[a-zA-Z]/.test(input.replace(/\\s/g, ''));\n}", "function onlyLett...
[ "0.8074333", "0.7855029", "0.7642756", "0.76013714", "0.7527062", "0.74366945", "0.73664874", "0.7359917", "0.7206799", "0.7130272", "0.7115739", "0.7112876", "0.708735", "0.70481056", "0.70470446", "0.70376545", "0.7026376", "0.7010713", "0.6963037", "0.69589204", "0.6956867...
0.0
-1
define the action for the event handler, gathering the filter conditions into formResults
function submitQuery () { // prevent full page refresh on event d3.event.preventDefault(); // define what filters to iterate over var keysList = ["datetime", "city", "state", "country", "shape"]; // retrieve text from only the form fields that have an input, building a dictionary //of current inputs var formResults = {}; keysList.forEach(function(val){ // target the element for the key of the current iteration ("datetime", "city", etc.) and get its value var tempValue = d3.select(`#${val}Filter`).property("value"); // if the string isn't empty, pass that value into the dictionary if(!(tempValue === "")){ formResults[val] = tempValue; }; }); // =============================================== // begin filtering data // use formResults object's entries as the applicable filter criteria // code concept researched from: // https://stackoverflow.com/questions/17099029/how-to-filter-a-javascript-object-array-with-variable-parameters function topFilter (dataInput, filterCriteria) { // Retrieve source data, and filter on each object(sighting report) in the array return dataInput.filter(function(obj){ // Begin reviewing each object individually at this level. //For every key in the search criteria, see if the current object's value //from the source data matches the search criteria's value. If so, return //'true' for this object to pass into dataInput.filter() return Object.keys(filterCriteria).every(function(value){ // Return 'true' to .every() if the search criteria's value matches //the current object's value //(the "current object" is provided by .filter(function(obj))) return obj[value] === filterCriteria[value]; }); }); }; // Execute filtering var filteredData = topFilter(tableData, formResults); // begin building output // define target for output var outputBody = d3.select("tbody"); // clear output of any previous queries outputBody.html(""); // populate table, appending new rows for each new object, and new td elemnts for each column filteredData.forEach(function(f_Sighting) { var row = outputBody.append("tr"); Object.values(f_Sighting).forEach(function(value){ var cell = row.append("td").text(value); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "searchFilter(e) {\n this.getSearchResults(formData)\n }", "function submitFilters()\n {\n\n }", "function filter() {\n\tvar form = event.target.form;\n\tdocument.forms[0].filter_name.value = form.filter_name_input.value;\n\tdocument.forms[0].filter_url.value = form.filter_url_input.value;\n\tdocument...
[ "0.72431725", "0.70813525", "0.69316113", "0.6785035", "0.6731176", "0.6705649", "0.66219383", "0.6575546", "0.6528628", "0.6521602", "0.6515318", "0.6508267", "0.6491544", "0.64712465", "0.6465222", "0.64436185", "0.64295036", "0.64075786", "0.63917506", "0.6387292", "0.6384...
0.0
-1
=============================================== begin filtering data use formResults object's entries as the applicable filter criteria code concept researched from:
function topFilter (dataInput, filterCriteria) { // Retrieve source data, and filter on each object(sighting report) in the array return dataInput.filter(function(obj){ // Begin reviewing each object individually at this level. //For every key in the search criteria, see if the current object's value //from the source data matches the search criteria's value. If so, return //'true' for this object to pass into dataInput.filter() return Object.keys(filterCriteria).every(function(value){ // Return 'true' to .every() if the search criteria's value matches //the current object's value //(the "current object" is provided by .filter(function(obj))) return obj[value] === filterCriteria[value]; }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function performFiltering(res) {\n //make sure the item can be placed on the map\n function hasLocation(obj) {\n if (obj.location != undefined && obj.location != \"\" && obj.location != null) {\n return obj;\n }\n }\n //filter by genre and neighborhood parameters entered by use...
[ "0.68126434", "0.6779444", "0.6717926", "0.6642625", "0.6612711", "0.6549782", "0.65147537", "0.64907813", "0.6451037", "0.64440256", "0.64306176", "0.6417976", "0.6410338", "0.6352675", "0.6305315", "0.63034564", "0.6299872", "0.62995565", "0.6268864", "0.6258252", "0.625711...
0.0
-1
Function to find/parse out unique values by building lists and checking existing values in that list
function keyParser(key) { var valList = []; tableData.forEach(function(x) { var currentVal = x[key]; if(!(valList.includes(currentVal))) { valList.push(currentVal); }; }); // Sort values in alpha order for easier usability valList.sort(); dropdownDict[key] = valList; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getUniqueValues(inputArray) {\n let uniques = [];\n inputArray.forEach((input) => {\n input.forEach((inp) => {\n if (!uniques.includes(inp)) {\n uniques.push(inp);\n }\n });\n });\n return uniques;\n }", "function getUniqueValues(values) {\nvar uniqueValues = [];\n\n...
[ "0.7077338", "0.7074776", "0.67899966", "0.6727803", "0.65762985", "0.6524218", "0.64797616", "0.6471158", "0.64605135", "0.6460472", "0.6413217", "0.6411297", "0.63558686", "0.6341301", "0.6338863", "0.63299376", "0.6298703", "0.62949896", "0.6279761", "0.624791", "0.6214752...
0.0
-1
generic function to handle hooks items from queue
function processHookFromQueue(snap, context) { // Only edit data when it is first created. if (snap.previous.exists()) { return; } // Exit when the data is deleted. if (!evt.data.exists()) { return; } const ref = snap.ref.root; const eventData = snap.val(); const source = context.params.source; return ref.child('raw').child(source).child(snap.key).once('value') .then((snapshot) => { const data = Object.assign({}, snapshot.val()); data._meta = eventData; return ref.child(paths.feedData).child(snapshot.key).set(data); }).then(() => snap.ref.remove()) ; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleBacklog() {\n var item = backlog.shift();\n if (item !== undefined) {\n console.log('from cache');\n // handle this single item\n realget(item.url, item.callback);\n } \n if (backlog....
[ "0.6303263", "0.6197174", "0.6132092", "0.60665643", "0.60338056", "0.60160875", "0.6011594", "0.6011594", "0.6011594", "0.6011594", "0.5985048", "0.5983891", "0.5905124", "0.5894944", "0.58481115", "0.58481115", "0.58172894", "0.58158916", "0.57805324", "0.57805324", "0.5780...
0.6103016
3
An instance of this is stored with every gadget site created.
function JiveSiteData(mvcView, app, viewParams) { return { mvcView: mvcView, app: app, view: app.view, viewParams: viewParams, getAppView: function() { return this.view; }, // the following are all optional getActionInfo: function() { return this.actionInfo; }, setActionInfo: function(actionInfo) { this.actionInfo = actionInfo; }, getGadgetMetaData: function() { return this.gadgetInfo; }, setGadgetMetaData: function(gadgetMetaData) { this.gadgetInfo = gadgetMetaData; }, getEEContext: function() { return this.context; }, setEEContext: function(context) { this.context = context; if(context && context.target && context.target.view) { this.view = context.target.view; } }, getSelection: function() { return this.selection; }, setSelection: function(selection) { this.selection = selection; } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get site() {\r\n return this.create(Site);\r\n }", "function ready_wrapper() {\n return gadget_instance;\n }", "set_site()\n {\n this.site = new Site( {\n port : this.options.port,\n domain: this.options.domain,\n debug : this.options.debug\...
[ "0.6569074", "0.6493249", "0.6001713", "0.59908926", "0.5825069", "0.5586512", "0.5563698", "0.5561777", "0.5510422", "0.54593945", "0.5454727", "0.5390722", "0.5383078", "0.5381881", "0.53162783", "0.528556", "0.5278417", "0.5240326", "0.52399254", "0.5239233", "0.5239233", ...
0.0
-1
You are going to be given an array of integers. Your job is to take that array and find an index N where the sum of the integers to the left of N is equal to the sum of the integers to the right of N. If there is no index that would make this happen, return 1.
function findEvenIndex(arr) { if (arr.length < 1 || !arr) { return -1; } for (let i = 0; i < arr.length; i++) { if ( arr.slice(0, i).reduce((x, y) => x + y, 0) === arr.slice(i + 1).reduce((x, y) => x + y, 0) ) { return i; } } return -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findEvenIndex(arr) { \n let leftSum = 0;\n let rightSum = arr.reduce((a, b) => a + b)\n \n for (let i = 0; i < arr.length; i++) {\n \n rightSum -= arr[i];\n \n if (leftSum === rightSum) {\n return i\n }\n \n leftSum += arr[i]\n }\n return -1\n}", "function findEvenIndex(a...
[ "0.7905984", "0.7804051", "0.77507037", "0.7715867", "0.76977926", "0.7683214", "0.7532778", "0.74994177", "0.74760395", "0.74081355", "0.73928887", "0.7382968", "0.73389214", "0.71943897", "0.7176403", "0.71031225", "0.7090609", "0.7086028", "0.70328593", "0.7027801", "0.701...
0.75546366
6
Event which fires after the long + lat bounds have changed
function boundChangedEvent() { var bounds = map.getBounds(); markersInBound.length = 0; markerArray.length = 0; for (var i = 0; i < markers.length; i++) { if (bounds.contains(markers[i].getPosition())) { if (markers[i].getVisible() == true) { markersInBound[i] = markers[i].get('id'); markerArray.push(markers[i]); } } } //needed in laravel for ajax $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); //ajax call to update sideBar $.ajax({ type: "POST", url: "/updateSidebar", data: { 'id': markersInBound }, success: function (data) { if (!$.trim(data)) { } else { $("#sideBar").html(data); } }, error: function (jqXHR, textStatus, errorThrown) { console.log("POST: ", jqXHR, textStatus, errorThrown); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function boundsChanged() {\n // REVERSE GEOCODE\n reverseGeocode();\n // FIX CLUSTER\n fixCluster();\n}", "function gmBoundsChanged() {\r\n\t\t\tvar bounds = _gMap.getBounds();\r\n\t\t\tif (bounds) {\r\n\t\t\t\t_gmSearchBox.setBounds(bounds);\r\n\t\t\t}\r\n\r\n\t\t\t// Boundary has been set, so don't...
[ "0.7402254", "0.7189321", "0.6967365", "0.6900984", "0.6637742", "0.6594101", "0.64397424", "0.63977", "0.6395866", "0.6395866", "0.6346053", "0.63258284", "0.62326956", "0.6178005", "0.6131276", "0.61224025", "0.608467", "0.6079577", "0.6071418", "0.6061277", "0.6049709", ...
0.5718437
62
function to make the infowindow
function makeInfoWindow(marker, map, infowindow, htmlString) { google.maps.event.addListener(marker, 'mouseover', function () { infowindow.setContent(htmlString); infowindow.open(map, marker); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setInfowindowMarkup(info) {\n return '<h4>'+ info['name'] +'</h4>' +\n '<p>'+ info['street'] + ' ' + info['city'] + ' ' + info['state'] + '</p>';\n}", "function createInfoWindow(KMLEvent_latLng, infoData) {\r\n CommonInfoWindow.close();\r\n //$(\"#map-loader\").hide();\r\n\r\n va...
[ "0.79812884", "0.7814804", "0.7800504", "0.77957845", "0.75191253", "0.751441", "0.75038105", "0.75030124", "0.74766916", "0.7474931", "0.7462824", "0.7431162", "0.7409737", "0.73416704", "0.7322788", "0.7317559", "0.73076314", "0.73051214", "0.7301574", "0.72951025", "0.7294...
0.7299035
19
updates position on the map
function updateLatLongFromCity(cityName) { var geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'address': cityName }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng())); } else { alert("Something got wrong " + status); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updatePosition() {\n this.position = getPositionForPopup(this.mapFeature);\n this.draw();\n }", "updatePosition() {\n this.position = Utils.convertToEntityPosition(this.bmp);\n }", "function UpdateMapPos(pos)\n{\n if (!map_ui) {return;}\n map_ui.CallEvent('update_pos', JSON.stringi...
[ "0.7740081", "0.75567305", "0.7507729", "0.7222093", "0.7155362", "0.7088766", "0.7086073", "0.7082991", "0.7075952", "0.7052428", "0.7051848", "0.70507205", "0.7035653", "0.70237577", "0.7019546", "0.7017936", "0.7013833", "0.6986786", "0.69849694", "0.6970425", "0.697019", ...
0.0
-1
function to update according to filters
function searchFilters(e) { e.preventDefault(); mc.setMap(null); searchLocationID.length = 0; //needed in laravel for ajax $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); var prices = slider.noUiSlider.get(); var form = $('#searchFilter').serialize() + "&minPrice=" + prices[0] + "&maxPrice=" + prices[1]; //ajax call to update sideBar $.ajax({ type: "POST", url: "/searchFilter", data: form, success: function (data) { var lat = 0; var long = 0; $.each(data, function (k, value) { $.each(value, function (key, val) { searchLocationID.push(val.location_id); if (val.latitude != undefined) lat = val.latitude; if (val.longitude != undefined) long = val.longitude; }); }); //sets center and zoom level of google map if (lat != 0) { map.setCenter(new google.maps.LatLng(lat, long)); map.setZoom(3); } var trueMarkers = new Array(); var falseMarkers = new Array(); for (var i = 0; i < markers.length; i++) { for (var j = 0; j < markers.length; j++) { if (markers[j].id == searchLocationID[i]) { trueMarkers.push(markers[j]); } else { falseMarkers.push(markers[j]); } } } for (var i = 0; i < falseMarkers.length; i++) { falseMarkers[i].setVisible(false); } for (var i = 0; i < trueMarkers.length; i++) { trueMarkers[i].setVisible(true); } boundChangedEvent(); }, error: function (jqXHR, textStatus, errorThrown) { console.log("POST: ", jqXHR, textStatus, errorThrown); } }); } //end search filters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateFilter () {\n upsertFilterForField(fieldName, filterEl.value);\n }", "function updateFilterChanged() {\n fillUpdateQuestions();\n fillUpdateForm();\n}", "function updateFilters() {\n\n // Save the element, value, and id of the filter that was changed\n let date = d3.select('#datetime...
[ "0.77357435", "0.73037916", "0.7154594", "0.71517575", "0.7075478", "0.7037906", "0.6979361", "0.6902194", "0.68928593", "0.6887286", "0.6875053", "0.68739617", "0.6871938", "0.6866425", "0.6859554", "0.677962", "0.6758701", "0.6648154", "0.66395897", "0.66216344", "0.6608280...
0.0
-1
hover listing to show marker
function showMarker(id) { //markersInBound[id].set("labelClass", "markerHovered"); //alert(markersInBound[id]); markers[markers.length - id].set("labelClass", "markerHovered"); markers[markers.length - id].set("labelAnchor", new google.maps.Point(18, 0)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseOver(e) {\r\n var layer_marker = e.target;\r\n // layer_marker.openPopup();\r\n }", "function hover_markers_appear() {\n $(this).css('background', '#efefef');\n var array = $(this).find('ul').children();\n _.each(array, hover_add_markers);\n}", "functio...
[ "0.7284513", "0.72071904", "0.70205367", "0.7000996", "0.698036", "0.6792628", "0.6728749", "0.6709292", "0.66178805", "0.6603969", "0.65867865", "0.64974827", "0.64916307", "0.64809114", "0.6479804", "0.6479804", "0.6470123", "0.6466639", "0.6466465", "0.6463021", "0.6461357...
0.62045413
86
passes all saveSearches into global array
function passToArray(savedSearch) { savedSearchArray.push(savedSearch); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSearches() {\n storedSearches = JSON.parse(localStorage.getItem(\"Search Term\"));\n if (!storedSearches) {\n savedST = [];\n } else {\n savedST = storedSearches;\n STSavedSearches();\n }\n}", "function getGuardSearches() {\n storedGuardSearches = JSON.parse(localS...
[ "0.6810535", "0.66924226", "0.66504735", "0.65755606", "0.6198491", "0.615159", "0.6095202", "0.60159624", "0.5990283", "0.5911986", "0.5909506", "0.58311355", "0.57917213", "0.5790481", "0.5746242", "0.5739089", "0.56776243", "0.567636", "0.5667369", "0.56669706", "0.562336"...
0.7024024
0
Firebase data fetch TODO: This dataset is essentially static. Although the app will manipulate this data use it to create interfaces it doesn't reflect all changes until the page is refreshed
componentWillMount() { var ref = firebase.database().ref(); ref.once("value").then(snapshot => { const data = snapshot.val(); this.setState({ data }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getItemData(ref) {\n firebase.database().ref('activitydata/placeData/' + ref).on('value', function(data) {\n allProjects[data.key] = [data.val().activity, data.val().image, data.val().url];\n var li = document.createElement('li');\n li.innerHTML = data.val().activity;\n var ul = document.getE...
[ "0.675457", "0.6551786", "0.6476014", "0.64502585", "0.64292854", "0.6384005", "0.6383785", "0.631735", "0.6291717", "0.6286891", "0.62696093", "0.625249", "0.625249", "0.61924946", "0.6192253", "0.61677283", "0.615896", "0.6146252", "0.6145391", "0.6081309", "0.6080205", "...
0.0
-1
html_id html id for specific node js file type selector. Datayour data
function NodesaveFile(html_id,data, encoding) { var chooser = document.querySelector(html_id); chooser.addEventListener("change", function(evt) { var fs = require('fs');// save it now if(encoding === true){ var base64Data = data.replace(/^data:application\/pdf;filename=generated.pdf;base64,/, ""); fs.writeFile(this.value, base64Data , 'base64' , function(err) { if(err) { alert("Error write to file"+err); } }); } else { fs.writeFile(this.value, data , function(err) { if(err) { alert("Error write to file"+err); } }); } }, false); chooser.click(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "htmlId(name, type = '', ext = '') {\n return Util.htmlId(name, type, ext);\n }", "function createFilesHtml(id) {\n currentID = id;\n \n var fileChilds = getChildById(id);\n var filesHtml = '';\n if (fileChilds.length) {\n $('.pty').css('display','')\n ...
[ "0.5849474", "0.5576776", "0.5555286", "0.5535879", "0.5518905", "0.551677", "0.5457033", "0.5450399", "0.5448303", "0.54211956", "0.5419827", "0.5362333", "0.53090143", "0.5301071", "0.52916247", "0.5288338", "0.528735", "0.528354", "0.52435786", "0.5202916", "0.5170497", ...
0.57418394
1
Check node js present
function node_enable() { if(typeof process === 'object' && process + '' === '[object process]'){ return true; } else{ return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isNode(){\r\n\treturn typeof module !== 'undefined' && module.exports;\r\n}", "function _node_p(){\n\tvar ret = false;\n\tif( anchor.environment() == 'Node.js' ){ ret = true; }\n\treturn ret;\n }", "function isNode() {\n return typeof module !== 'undefined' &&\n module.exports &&\n ...
[ "0.7289375", "0.72072023", "0.7164318", "0.7144777", "0.7031933", "0.6803279", "0.67186534", "0.6688882", "0.65933734", "0.6565972", "0.65642583", "0.65401304", "0.6539737", "0.6535629", "0.6525146", "0.6525146", "0.6477884", "0.64211047", "0.64211047", "0.6347711", "0.629458...
0.6709265
7
Hide download section if run on desktop Platform
function hide_download_icons_node(){ if(node_enable() === true){ CSSLoad("style_hide_download_section.css?v01"); //CSSLoad("style_hide_window_control_section.css?v03"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hide_download_icons_android(){\n if(IsAndroid() === true){\n CSSLoad(\"style_hide_download_section.css?v0221\");\n CSSLoad(\"style_hide_window_control_section.css?v023\");\n }\n}", "function fnDownloadLinkVisibility(state) {\n var link = document.getElementById(\"downloadlink\");\...
[ "0.7264511", "0.6477899", "0.61239976", "0.608734", "0.59986323", "0.59703803", "0.5931743", "0.5842519", "0.5750838", "0.5736619", "0.5701093", "0.5657955", "0.5656968", "0.5655311", "0.5654694", "0.56479305", "0.5645589", "0.5642865", "0.5638401", "0.5635891", "0.56346923",...
0.67815036
1
Hide download section if run on Android Platform
function hide_download_icons_android(){ if(IsAndroid() === true){ CSSLoad("style_hide_download_section.css?v0221"); CSSLoad("style_hide_window_control_section.css?v023"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hide_download_icons_node(){\n if(node_enable() === true){\n CSSLoad(\"style_hide_download_section.css?v01\");\n //CSSLoad(\"style_hide_window_control_section.css?v03\");\n }\n}", "function fnDownloadLinkVisibility(state) {\n var link = document.getElementById(\"downloadlink\");\n ...
[ "0.6076402", "0.60398734", "0.57945114", "0.5634682", "0.55981684", "0.55851346", "0.55547816", "0.5548395", "0.5493798", "0.54687196", "0.5441318", "0.5381035", "0.5332235", "0.5304901", "0.5263014", "0.5232996", "0.52257204", "0.5223136", "0.5199141", "0.51976585", "0.51889...
0.7885312
0
function for basic auth using login credentials that are hardcoded
function authenticate (req, res, next) { admins = { admin: { id: 1, password: 'admin' } }; if (req.username == 'anonymous' || !admins[req.username] || req.authorization.basic.password !== admins[req.username].password) { // Respond with { code: 'NotAuthorized', message: '' } next(new restify.NotAuthorizedError()); } else { next(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "login_basic_auth(username, password, checkAuthCallback) {\n const loginPath = API_ROOT_URL + \"/auth\";\n const loginAndPassInBase64 = btoa(username + \":\" + password);\n const basicLoginAndPassInBase64 = \"Basic \" + loginAndPassInBase64;\n\n fetch(loginPath, {\n method: \"GET\",\n headers:...
[ "0.7910183", "0.74906194", "0.74668723", "0.7414003", "0.73230696", "0.72918206", "0.7286051", "0.727507", "0.72443646", "0.72204393", "0.7110287", "0.705627", "0.7043058", "0.6995216", "0.6993369", "0.6937347", "0.68910146", "0.6866435", "0.67125475", "0.6707857", "0.6618644...
0.0
-1
We always send JSON
function send(data) { //console.log(data); client.send(JSON.stringify(data)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "json(data) {\n\t\tthis.setHeader('content-type', 'application/json')\n\t\treturn this.send(JSON.stringify(data))\n\t}", "function sendJson(json) \n{\n var data = JSON.stringify(json);\n return sendData(data);\n}", "function sendJson(res, json) {\n res.setHeader('Content-Type', 'application/json; charset...
[ "0.7614921", "0.7087966", "0.68026847", "0.6637339", "0.66324496", "0.6597136", "0.65661097", "0.65420544", "0.64834857", "0.6411433", "0.637179", "0.6354669", "0.6351177", "0.63378215", "0.6332027", "0.6286124", "0.6285852", "0.61955947", "0.6183626", "0.6178154", "0.6170506...
0.59506905
44
If buffer is filled, handle the data and send the response.
function handleData(data, fromIdle) { var songinfo = false; var dat = {}; var command; var args; if(fromIdle) { command = "idle"; } else { command = lastCommand.shift(); args = lastArguments.shift(); } // We got some songinfo (from 'playlistinfo' command or similar) var songInfoCommands = [ "playlistinfo", "search" ]; if(songInfoCommands.indexOf(command) != -1) { songinfo = true; dat.songinfo = []; } var lines = data.split("\n"); lines.forEach(function(e) { if(e != "OK" && e != '') { d = e.split(": "); key = d[0]; value = d[1]; if(songinfo) { var l = dat.songinfo.length || 1; if(key == "file") { // Be sure to send every 6 entries. Easier to handle then a load of data. // TODO: test this against a playlist of 2000 or more entries. if(l > 5) { var d = {}; d[command] = dat; d[command]._arguments = args; send(d); dat.songinfo = []; } dat.songinfo.push({file: value}); } else { dat.songinfo[l-1][key] = value; } } else { dat[key] = value; } } }); var d = {}; d[command] = dat; d[command]._arguments = args; send(d); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "responseHandler(data) {\n if(this.build) {\n if(data.length + this.curResponse.accumulated > this.curResponse.size) {\n throw new Error('Ending response length did match reported size');\n } else {\n this.curResponse.data = Buffer.concat([this.curResponse.data, data]);\n this.curR...
[ "0.65188885", "0.64218116", "0.6390555", "0.6377163", "0.6210771", "0.6207275", "0.6207275", "0.6068282", "0.6043504", "0.60033405", "0.59548485", "0.592969", "0.5866507", "0.58372766", "0.583328", "0.5788404", "0.57819855", "0.576031", "0.5758778", "0.57455665", "0.57366043"...
0.0
-1
check health without timing a 2 seconds
function check() { OOP.forArr(walls,function (wall) { if(wall.isStaticIntersect(player.getStaticBox())) { if(wall.enemyBlock) { damage.currentTime = 0.75; damage.play(); pjs.camera.move(point(-10,0)); try { health--; hs.shift(); var el = document.querySelectorAll('#healths > img'); el[el.length-1].remove(); } catch(e) {} } } }); OOP.forArr(mobs,function (mob) { if(mob.isIntersect(player)) { try { damage.currentTime = 0.75; damage.play(); health--; hs.shift(); var el = document.querySelectorAll('#healths > img'); el[el.length-1].remove(); pjs.camera.move(point(-10,0)); } catch (e) {} } }); setTimeout(check,250); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _checkHealth() {\n \n var checkItems = _.map(_checkers, function(item, key) {\n return _.extend({ id: key }, item);\n }),\n serverAvailable = true;\n \n function checkItem(checker, itemCallback) {\n var timer = 0;\n \n if (checker.check) {\n ...
[ "0.6816638", "0.6775694", "0.67029554", "0.6556562", "0.64961827", "0.63381994", "0.63123786", "0.6243877", "0.6200659", "0.61023587", "0.6102303", "0.606148", "0.60334736", "0.602269", "0.6013833", "0.5982117", "0.5982117", "0.597565", "0.5973599", "0.5950764", "0.59502894",...
0.52458817
78
Get Product By ID
function addProduct(items){ // console.log(items); var obj = items; var arr = []; var obj = []; var count=0; var productList = []; firebase.database().ref("cart").on("value", (snapshot) => { count = snapshot.numChildren(); }); const formatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', maximumFractionDigits: 2 }); if (count == 0) { document.getElementById('addProductRow').innerHTML = "<tr><td class='text-center' colspan=5><i style='color:#bebebe'>There are no items in your cart</i></td></tr>"; } else { Object.values(items).map(item => arr.push(item)); for(var i=0;i<count;i++){ obj.push(Object.values(arr[i])[0]); } Object.values(obj).map(item => productList.push(` <tr> <th class="text-center" scope="row" class="id">`+item.productId+`</th> <td class="text-left" style="width: 25%;"> <span class="text-center"><img src="`+item.productUrl+`" alt="`+item.productName+`" width="75" height="75">&nbsp;&nbsp;&nbsp;&nbsp;`+item.productName+`</span> </td> <td class="text-center">`+formatter.format(item.productPrice)+`</td> <td class="text-center"> <span style="padding-left: 15px"> <span class="badge-light" style="font-size: 15px"> <span class="fa fa-star checked"></span> <span class="fa fa-star checked"></span> <span class="fa fa-star-half-full checked"></span> <span class="fa fa-star-o unchecked"></span> <span class="fa fa-star-o unchecked"></span> </span> </span></td> <td class="text-center"><button class="btn btn-success"><i class="fa fa-shopping-cart"></i> Buy now </button> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <button class="btn btn-danger" onclick="removeItem('`+item.productCode+`')"><i class="fa fa-shopping-cart"></i> Remove from cart </button></td> </tr>`)); document.getElementById('addProductRow').innerHTML = productList.join(""); } document.getElementById('circle').style.display="none"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static async fetchProductById(productId) {\n\n // fetch a single product\n const product = storage\n .get(\"products\")\n .find({ id: Number(productId) })\n .value();\n return product;\n }", "getProduct(id) {\n return this.getProducts()\n .pipe...
[ "0.814173", "0.78365624", "0.7832841", "0.7758889", "0.7751471", "0.76948833", "0.76385987", "0.7522882", "0.7516403", "0.7510219", "0.7508997", "0.75071466", "0.7506877", "0.74917877", "0.7470782", "0.7459173", "0.74192435", "0.7388556", "0.7382545", "0.73763055", "0.7358023...
0.0
-1
time signatures too, and resync to a "now" beat.
function Metronome() { this.isPlaying = false; this.scheduleAheadTime = 0.1; this.NOTE_LENGTH = 0.05; this.lookahead = 25; this.currentNote = null; this.tempo = 120; this.ts = 4; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function now() {\n\treturn 21;\n}", "function set_now(fn) {\n now = fn;\n}", "function set_now(fn) {\n now = fn;\n}", "function set_now(fn) {\n now = fn;\n}", "function set_now(fn) {\n now = fn;\n}", "function tick() {\n setTime(howOld(createdOn));\n }", "function now() {\n ...
[ "0.5996006", "0.5985027", "0.5950681", "0.5950681", "0.5950681", "0.5933751", "0.59327", "0.59327", "0.56408656", "0.56330985", "0.55655307", "0.55565554", "0.55565554", "0.55565554", "0.55467147", "0.55467147", "0.55350184", "0.5532588", "0.5531843", "0.5525255", "0.5513708"...
0.0
-1
The root of our application. Provides a user configuration on load and client side routing for all of the pages.
function App() { return ( <div className="App"> <ThemeProvider theme={theme}> <UserProvider> <Router> <Switch> <Route path="/room/:name"> <Room /> </Route> <Route path="/create"> <Create /> </Route> <Route path="/join"> <Join /> </Route> <Route path="/profile"> <Profile /> </Route> <Route path="/about"> <About /> </Route> <Route path="/home/:error"> <Home /> </Route> <Route path="/"> <Home /> </Route> </Switch> </Router> </UserProvider> </ThemeProvider> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRoot(app) {\n app.get('/', function(req, res) {\n res.sendFile(path.join(__dirname, '../public', 'home.html'))\n });\n}", "function home(req, res) {\n return res.render('index', {\n ENV: JSON.stringify(ENV), // pass environment variables to html\n title: 'Hack University',\n pa...
[ "0.64290684", "0.6132057", "0.6028761", "0.60229117", "0.5900125", "0.5886015", "0.5877944", "0.5836939", "0.5831629", "0.5830568", "0.58264107", "0.5824122", "0.58125967", "0.5806131", "0.5791566", "0.57401407", "0.57103527", "0.57103527", "0.57103527", "0.57103527", "0.5710...
0.0
-1
This function is called to clear the back buffer with a specific color
clear() { // Clearing with black color by default // 在给定的矩形内清除指定的像素 this.workingContext.clearRect(0, 0, this.workingWidth, this.workingHeight); // once cleared with black pixels, we're getting back the associated image data to // clear out back buffer // getImageData 返回 ImageData 对象,该对象为画布上指定的矩形复制像素数据 this.backbuffer = this.workingContext.getImageData(0, 0, this.workingWidth, this.workingHeight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function prepareClearColor() {\n let color = scene.clearColor;\n gl.clearColor(color.r, color.g, color.b, color.a);\n}", "function clear_screen(){\r\n if (tracing) return;\r\n ctx.clearRect(0, 0, cnvs.width, cnvs.height);\r\n}", "function clear_screen() {\n\tctx.fillStyle = \"#FFFFFF\"; // white\n...
[ "0.7190565", "0.69971734", "0.69922453", "0.6934051", "0.6900322", "0.68748295", "0.6859505", "0.68217665", "0.68103874", "0.6775442", "0.6756533", "0.67537194", "0.67287767", "0.6718605", "0.66918135", "0.66833687", "0.66814184", "0.66738605", "0.6668278", "0.6659704", "0.66...
0.72229016
0
Once everything is ready, we can flush the back buffer into the front buffer.
present() { // putImageData 把图像数据(从指定的 ImageData 对象)放回画布上 this.workingContext.putImageData(this.backbuffer, 0, 0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function flush () {\n\t flushing = true\n\t run(queue)\n\t run(userQueue)\n\t reset()\n\t}", "_flush() {\n\t\tthis.finished = true;\n\t\tthis._definitelyPush();\n\t}", "_flush() {\n this.push(this.contents);\n this.emit('end')\n }", "function flush () {\n flushing = true\n run(queue)\n...
[ "0.6808692", "0.6800927", "0.6726369", "0.672122", "0.672122", "0.672122", "0.6560258", "0.65188164", "0.65182126", "0.6498614", "0.64898944", "0.6371836", "0.6359439", "0.6359439", "0.6359439", "0.6359439", "0.6359439", "0.6359439", "0.6359439", "0.6359439", "0.63397735", ...
0.0
-1
Called to put a pixel on screen at a specific X,Y coordinates
putPixel(x, y, color) { this.backbufferdata = this.backbuffer.data; // As we have a 1-D Array for our back buffer // we need to know the equivalent cell index in 1-D based // on the 2D coordinates of the screen var index = ((x >> 0) + (y >> 0) * this.workingWidth) * 4; // RGBA color space is used by the HTML5 canvas this.backbufferdata[index] = color.r * 255; this.backbufferdata[index + 1] = color.g * 255; this.backbufferdata[index + 2] = color.b * 255; this.backbufferdata[index + 3] = color.a * 255; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setPixel(x, y, colour, a) {\n var index = (y * screenWidth * 4) + (x * 4);\n imageData.data[index + 0] = imageData.data[index + 1] = imageData.data[index + 2] = colour;\n imageData.data[index + 3] = a;\n}", "function set_point(x, y, color)\n\t{\n\t\tscreen.data[(x + y * screen.width) * 4] = col...
[ "0.75085974", "0.72352827", "0.71068054", "0.6844297", "0.68145514", "0.6796684", "0.6768924", "0.67362046", "0.66774845", "0.6574334", "0.6561839", "0.6539983", "0.6524086", "0.64928406", "0.6478486", "0.64716053", "0.64632714", "0.6437505", "0.643432", "0.64207685", "0.6407...
0.6923961
3
Project takes some 3D coordinates and transform them in 2D coordinates using the transformation matrix
project(coord, transMat) { var point = BABYLON.Vector3.TransformCoordinates(coord, transMat); // The transformed coordinates will be based on coordinate system // starting on the center of the screen. But drawing on screen normally starts // from top left. We then need to transform them again to have x:0, y:0 on top left. var x = point.x * this.workingWidth + this.workingWidth / 2.0 >> 0; // >>0 二进制右移 相当于取整 var y = -point.y * this.workingHeight + this.workingHeight / 2.0 >> 0; return (new BABYLON.Vector2(x, y)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "project(ax, ay, az, angles){\r\n var x = ax - this.camera_p.x;\r\n var y = ay - this.camera_p.y;\r\n var z = az - this.camera_p.z;\r\n \r\n var dx = angles.cy*(angles.sz*y + angles.cz*x) - angles.sy*z;\r\n var dy = angles.sx*(angles.cy*z + angles.sy*(angles.sz*y + angles.cz*x)) + angles.cx*(angle...
[ "0.721251", "0.6657503", "0.66289544", "0.6562682", "0.65245664", "0.64900035", "0.64790267", "0.6459427", "0.64332557", "0.6425021", "0.6391278", "0.6387416", "0.6355549", "0.63535154", "0.63382554", "0.6313749", "0.63008547", "0.628988", "0.6277564", "0.626933", "0.6261112"...
0.7079614
1
drawPoint calls putPixel but does the clipping operation before
drawPoint(point) { // Clipping what's visible on screen if (point.x >= 0 && point.y >= 0 && point.x < this.workingWidth && point.y < this.workingHeight) { // Drawing a yellow point this.putPixel(point.x, point.y, new BABYLON.Color4(1, 1, 0, 1)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawPoint(ctx, y, x, r, image) {\n ctx.beginPath()\n ctx.drawImage(image, x, y, 150, 150)\n }", "function updatePoint(event) {\r\n\r\n ctx.clearRect(0, 0, canvas.width, canvas.height);\r\n //redraw\r\n drawMap();\r\n drawCoord(coord[0], coord[1], \"red\");\r\n\r\n var rect = canvas...
[ "0.666671", "0.663069", "0.64092857", "0.63475615", "0.6315788", "0.6314992", "0.6302977", "0.63007367", "0.6285346", "0.6252598", "0.61995846", "0.6147914", "0.6146695", "0.61405784", "0.61340106", "0.6125398", "0.6114464", "0.60929966", "0.60787725", "0.6066612", "0.6047814...
0.77709526
0
The main method of the engine that recompute each vertex projection during each frame
render(camera, meshes) { // To understand this part, please read the prerequisites resources // 观察矩阵 也就是摄像机 // 在计算机图形学中,如果想换个角度观察一座山,您可以移动摄像机也可以……移动山 // glm::mat4 CameraMatrix = glm::LookAt( // cameraPosition, // the position of your camera, in world space // cameraTarget, // where you want to look at, in world space // upVector // probably glm::vec3(0,1,0), but (0,-1,0) would make you looking upside-down, which can be great too // ); var viewMatrix = BABYLON.Matrix.LookAtLH(camera.Position, camera.Target, BABYLON.Vector3.Up()); // 投影矩阵 perspective 确定物体距离摄像机的空间距离 xy固定时z大的会画在前面 // Creates a left-handed perspective projection matrix // Generates a really hard-to-read matrix, but a normal, standard 4x4 matrix nonetheless // glm::mat4 projectionMatrix = glm::perspective( // glm::radians(FoV), // The vertical Field of View, in radians: the amount of "zoom". Think "camera lens". Usually between 90&deg; (extra wide) and 30&deg; (quite zoomed in) // 4.0f / 3.0f, // Aspect Ratio. Depends on the size of your window. Notice that 4/3 == 800/600 == 1280/960, sounds familiar ? // 0.1f, // Near clipping plane. Keep as big as possible, or you'll get precision issues. // 100.0f // Far clipping plane. Keep as little as possible. // ); var projectionMatrix = BABYLON.Matrix.PerspectiveFovLH(0.78, this.workingWidth / this.workingHeight, 0.01, 1.0); //水平视角、宽高比、近水平视场、远水平视场 for (var index = 0; index < meshes.length; index++) { // current mesh to work on var cMesh = meshes[index]; // Beware to apply rotation before translation // 创建世界空间旋转矩阵 平移*旋转 // 物体所有顶点都应该位于世界空间 物体需要从模型空间(Model Space)(顶点都相对于模型的中心定义)变换到世界空间(顶点都相对于世界空间中心定义)。 var worldMatrix = BABYLON.Matrix.RotationYawPitchRoll( cMesh.Rotation.y, cMesh.Rotation.x, cMesh.Rotation.z) .multiply(BABYLON.Matrix.Translation( cMesh.Position.x, cMesh.Position.y, cMesh.Position.z)); // Multiply two matrices矩阵相乘 //var transformMatrix => worldMatrix * viewMatrix * projectionMatrix; var transformMatrix = worldMatrix.multiply(viewMatrix).multiply(projectionMatrix); // 8个点的循环 cMesh.Vertices.forEach( meshPoint => { // First, we project the 3D coordinates into the 2D space var projectedPoint = this.project(meshPoint, transformMatrix); // Then we can draw on screen this.drawPoint(projectedPoint); } ) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw() {\n // Builds the actual object based off the control points from the 2D drawing mode\n initDrawPoints(cntrlPnts);\n buildSurfaceOfRevolution(cntrlPnts);\n \n \n // Associate the shader for normals of the vertices\n var verticesNormalBuffer = gl.createBuffer();\n gl.bind...
[ "0.6515915", "0.6474149", "0.64435625", "0.64191425", "0.6405783", "0.6396924", "0.6396924", "0.63952017", "0.6391858", "0.6374298", "0.6359025", "0.63543814", "0.6342845", "0.634202", "0.63338095", "0.6330859", "0.63231647", "0.6314386", "0.6287061", "0.62599504", "0.6247464...
0.0
-1
source: given a user Meteor object, return an object to pass into the oauth2client as credentials will refresh tokens if the saved one is expired needs to be called before every gCalendarApi call
function getAccessToken(user) { // get data saved in DB about google auth const googleService = user.services.google; // if token won't expire in the next minute, use it if (googleService.expiresAt > Date.now() + 60 * 1000) { // then just return the currently stored token return { access_token: googleService.accessToken, token_type: 'Bearer', id_token: googleService.idToken, expiry_date: googleService.expiresAt, refresh_token: googleService.refreshToken, }; } const oauth2Client = new GoogleApis.auth.OAuth2(Meteor.settings.private.oAuth.google.clientId, Meteor.settings.private.oAuth.google.secret); // set the Oauth2 client credentials from the user refresh token oauth2Client.setCredentials({ refresh_token: user.services.google.refreshToken, }); // declare a synchronous version of the oauth2Client method refreshing access tokens const refreshAccessTokenSync = Meteor.wrapAsync(oauth2Client.refreshAccessToken, oauth2Client); // refresh tokens const tokens = refreshAccessTokenSync(); // update the user document with the fresh token Meteor.users.update(user._id, { $set: { 'services.google.accessToken': tokens.access_token, 'services.google.idToken': tokens.id_token, 'services.google.expiresAt': tokens.expiry_date, 'services.google.refreshToken': tokens.refresh_token, }, }); // return the newly refreshed access token return tokens; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "refresh(rT) {\n console.log('Line 64 in Client.js rT saved');\n this.oAuth2Client.setCredentials({\n refresh_token: rT\n });\n }", "updateAuthenticatedUser() {\n if (__WEBPACK_IMPORTED_MODULE_1__Client__[\"a\" /* client */].enableOauth)\n this.resetToken();\n else\n ...
[ "0.5851371", "0.5713127", "0.5612677", "0.56078976", "0.56059766", "0.55840635", "0.5480983", "0.5469538", "0.54532975", "0.5451167", "0.54404265", "0.5427708", "0.54260415", "0.5421693", "0.540893", "0.538239", "0.536856", "0.5347901", "0.5346", "0.5317003", "0.52814597", ...
0.668405
0
Prepares a booking for transferring to a new owner.
function transferBooking(req, res, next) { var hash = crypto.randomBytes(20).toString('hex'); BookingModel.findById(req.body._id, function (err, booking) { if (err || !booking) { return next(err); } var url = req.headers.host + '/bookings/transfer/'; url += hash; url += '/'; url += req.body.newOwner; booking.transferhash = hash; booking.save(function (err) { if (err) { return next(err); } Mailer.sendTransferRequestMail({ newUserId: req.body.newOwner, currentUserId: req.session.user._id, gadgetId: booking.gadget, url: url, }); res.render('bookings/transfer'); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bookTheCab(requestId, cabId, userLoc, destination) {\n cabBookingService(requestId, cabId, userLoc, destination, {\n on_success : onBookingSuccess,\n on_failure : onBookingFailure\n });\n}", "function post_booking(booking){\n if(!booking){\n console.error(\"Invalid booking\");\n ...
[ "0.57219803", "0.5720326", "0.5703122", "0.5659984", "0.55348915", "0.55006987", "0.5439524", "0.5325264", "0.53144807", "0.52995205", "0.52932847", "0.5267346", "0.5264086", "0.5233121", "0.5199064", "0.5166507", "0.51170033", "0.5113598", "0.51064044", "0.51041704", "0.5086...
0.5340699
7
This allows switching between tabs when swiped.
function swiped(element, index, array) { element.addEventListener('swipe', function(e) { if (e.direction == 'left') { $.tabgroup.setActiveTab(index + 1); } else if (e.direction == 'right') { $.tabgroup.setActiveTab(index - 1); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tabSwitch( $tab ) {\n\n var id, content, tab;\n\n // if $tab was not set, get the tab from the query string\n if (typeof($tab) === 'undefined') {\n tab = getQ('tab').length ? getQ('tab') : null;\n if (!tab) return;\n $tab = $('#' + tab);\n }\n\n...
[ "0.6725207", "0.6603157", "0.65943825", "0.65682364", "0.6512136", "0.6503013", "0.64973164", "0.644703", "0.6391599", "0.63524145", "0.6301571", "0.62742406", "0.62439644", "0.621717", "0.61955005", "0.6188652", "0.6120343", "0.6117677", "0.6097032", "0.6055538", "0.6048567"...
0.64755857
7
for displaying two nonclickable text divs (at different positions basically) at the same time
function nextText() { document.getElementById(currOrder).remove(); currOrder++; putText(curr.text, currOrder); currentRoom.removeEventListener("click", nextText); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayHitAndStayButtons() {\n document.getElementById('hit').style.display = \"inline-block\";\n document.getElementById('stay').style.display = \"inline-block\";\n }", "function reposText(x,y,num){\n x*=100; // Skalierung auf ganze Zahlen\n y*=100; // Skalierung auf ganze Zahlen...
[ "0.61606896", "0.6041356", "0.59875995", "0.594377", "0.5885665", "0.5870938", "0.57649285", "0.57522947", "0.57522947", "0.57494634", "0.572226", "0.5694562", "0.5691985", "0.5677208", "0.5584093", "0.55814713", "0.5579948", "0.55618066", "0.5558561", "0.5558561", "0.5550886...
0.0
-1
TRAVELLING for unlocked doors, just go straight through on click
function autoUnlock() { if (!curr.doors[1].locked) { doorOpenSound.play(); update(curr.reachableRooms[1]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseReleased() {\n UseCases.forEach( function( obj ) {\n obj.locked = false;\n });\n\n Actors.forEach( function( obj ) {\n obj.locked = false;\n });\n}", "function lockdoor() {\n\t\t\t\tref.update({\n\t\t\t\tunlocked: false,\n\t\t\t})\t\t\t\n\t\t\t}", "function toggleParty(e...
[ "0.6272293", "0.62276876", "0.6169516", "0.607278", "0.60411304", "0.5979775", "0.59727347", "0.5943187", "0.5863384", "0.5857733", "0.58418226", "0.58266", "0.5818566", "0.579568", "0.57641315", "0.5732472", "0.57224655", "0.5700035", "0.569597", "0.5670662", "0.56496763", ...
0.58501315
10
Calls all necessary actions on dice roll
function rollDice() { var clickedStatus = checkForClicked(); rolled = true; if (clickedStatus == 'success') { var scoreStatus = updateScore(); if (scoreStatus == 'success') { setValues(); updateDiceImg(); farkleStatus = checkForFarkle(); if (farkleStatus != 'safe') { score = 0; document.getElementById('score').innerHTML = 'Farkle!'; sendToast(farkleStatus); resetClicked(true); initializeDice(); updateDiceImg(); } } else { resetClicked(); sendToast(scoreStatus); } } else { sendToast(clickedStatus); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rollDice()\n{\n\tCurrentDiceGroup.rollDice();\n\n\tupdateHistory(CurrentDiceGroup.lastdiceroll);\n}", "function Dice() {\n\t}", "function rollDice(){\n\tif(yourturn && !diceTrown){\n\t\tf = Math.round(Math.random() * (6 - 1) + 1);\n\t\ts = Math.round(Math.random() * (6 - 1) + 1);\n\t\tsocket.emit('rol...
[ "0.73927265", "0.7256041", "0.7092422", "0.70778644", "0.6945438", "0.68072474", "0.6795694", "0.67417794", "0.6671235", "0.66593665", "0.66010916", "0.6576132", "0.6564573", "0.65616196", "0.6560935", "0.6540534", "0.65333533", "0.64872515", "0.648417", "0.64681244", "0.6432...
0.0
-1
Resets any clicked buttons to unclicked state if not kept
function resetClicked(hardReset = false) { for (i = 0; i < 6; i++) { if ((!diceArr[i].set || hardReset) && diceArr[i].clicked) { document.getElementById(`die${i + 1}`).classList.toggle('selected'); diceArr[i].clicked = false; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resetClicks() {\n\t\tvar newState = _.extend(this.state, {click1: null, click2: null});\n\t\tthis.setState(newState);\n\t}", "function resetClickedBox() {\n\t\tif (clickedBox) {\n\t\t\tclickedBox.removeClass('clicked');\n\t\t\tclickedBox = null;\n\t\t}\n\t}", "function clearButtons(){\n\t\t\t$('.selected').tog...
[ "0.74998504", "0.70392007", "0.6971426", "0.6802659", "0.6788427", "0.6776467", "0.67470574", "0.6727897", "0.66327846", "0.66318995", "0.6630153", "0.6598049", "0.6547532", "0.6519735", "0.6505198", "0.6498073", "0.6464924", "0.64638215", "0.64125705", "0.6410914", "0.640973...
0.6328363
23
handles any toast messages that need to be sent
function sendToast(message) { console.log(message); var toast = document.getElementById('toast'); toast.innerHTML = message; toast.className = 'show'; setTimeout(function () { toast.className = toast.className.replace('show', ''); }, 3000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleFormToast(status) {\n const _msg = status ? SUCCESS_MSG : ERROR_MSG;\n msg.innerText = _msg;\n toggleToast();\n }", "static get tag(){return\"simple-toast\"}", "function openToast() {\n closeToast(function() {\n if (settings.toastUseMpStyle) {\n createPlayer(\"toast\", f...
[ "0.7115068", "0.69858414", "0.6979922", "0.69752747", "0.69479984", "0.6924406", "0.69076765", "0.6903521", "0.6899338", "0.6872423", "0.68581355", "0.6807191", "0.67302704", "0.67159116", "0.671353", "0.671353", "0.6693088", "0.6686081", "0.6684687", "0.66826534", "0.6680952...
0.691723
6
Updating images of dice given values of rollDice
function updateDiceImg() { var diceImage; for (var i = 0; i < 6; i++) { diceImage = diceArr[i].value === 0 ? 'images/question_mark.png' : 'images/' + diceArr[i].value + '.png'; document.getElementById(diceArr[i].id).setAttribute('src', diceImage); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dice(diceRoll,diceNumber){\r\n \tdocument.getElementById(\"diceImage\"+diceNumber).src=diceRoll+\".png\"; //simulate a sleep(350) for 1/4 second\r\n \tconsole.log(diceRoll+\".png\"+\" for dice number \"+diceNumber);\r\n}", "function generateDice() {\n const randomDiceNumbers = generateRandomDiceNumbe...
[ "0.72150207", "0.7213751", "0.7119822", "0.70515597", "0.7032178", "0.69801605", "0.6961399", "0.6957232", "0.6916202", "0.6897515", "0.68731546", "0.6863465", "0.6863234", "0.67760754", "0.67551476", "0.67426044", "0.671406", "0.6706584", "0.6703842", "0.6681225", "0.6662839...
0.6783036
13
Selects and deselects dice
function diceClick(img) { if (rolled) { var i = img.getAttribute('data-number'); if (!diceArr[i].set) { img.classList.toggle('selected'); if (!diceArr[i].clicked) { diceArr[i].clicked = true; } else { diceArr[i].clicked = false; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rollSelectedDice(die) {\n // set last Roll ID\n currentRollId = \"roll_\" + Date.now();\n let thisRollId = currentRollId;\n //play sound\n playRollSound();\n //reset total\n total = 0;\n $(\"#total-value\").text(\"?\").animateRotate(720, 1000, \"swing\");\n //reset all dice to t...
[ "0.6443329", "0.6414807", "0.63498604", "0.62193716", "0.6205317", "0.6199384", "0.61676955", "0.6161636", "0.6082238", "0.6016921", "0.60136247", "0.59594566", "0.5953671", "0.5921438", "0.59144396", "0.5907053", "0.5900603", "0.58702296", "0.585865", "0.5849307", "0.5839863...
0.65072423
0
Checks for a Farkle
function checkForFarkle() { var diceNum = [0, 0, 0, 0, 0, 0]; for (i = 0; i < 6; i++) { if (!diceArr[i].set) { diceNum[diceArr[i].value - 1]++; } } for (i = 0; i < 6; i++) { if (i === 0 || i == 4) { if (diceNum[i] > 0) { return 'safe'; } } else { if (diceNum[i] == 3) { return 'safe'; } } } return 'Farkle! Too bad!'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkfamily() {\r\n\r\n \r\n}", "async checkHasFortnite() {\n try {\n \n if(!this.launcher.account.entitlements.find(entitlement => entitlement.namespace == 'fn')) {\n this.launcher.debugger.error('Launcher', 'Purchase fortnite to use fortnitenode.');\n ...
[ "0.6049372", "0.5829381", "0.5767685", "0.5538222", "0.55368775", "0.5467154", "0.5447768", "0.54209363", "0.5382043", "0.5374419", "0.53546673", "0.5300665", "0.52926", "0.52926", "0.52926", "0.52926", "0.52926", "0.5281425", "0.52746975", "0.5265494", "0.5265494", "0.5265...
0.49980295
37
Checks for any clicked dice that aren't already kept
function checkForClicked() { if (!rolled) { return 'success'; } for (i = 0; i < 6; i++) { if (diceArr[i].clicked) { return 'success'; } } return "You haven't clicked any new dice!"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function noCheat(){\n console.log(\"already clicked!\");\n }", "function resetClicked(hardReset = false) {\n for (i = 0; i < 6; i++) {\n if ((!diceArr[i].set || hardReset) && diceArr[i].clicked) {\n document.getElementById(`die${i + 1}`).classList.toggle('selected');\n d...
[ "0.66604185", "0.65380806", "0.6475249", "0.6467352", "0.64614624", "0.6442292", "0.6419372", "0.6411226", "0.6393504", "0.6386347", "0.6354877", "0.6311614", "0.627049", "0.6244265", "0.62209654", "0.61484015", "0.60247743", "0.60189974", "0.60077596", "0.60012794", "0.59690...
0.7202416
0
Could use Vue or Angular or other such library to do this. But it's not really more work to just do it in vanilla because we don't need reactivity.
function loadTable(tableRoot, tableData, colours){ tableData.forEach((row, i) => { const rowNode = document.createElement("tr"); const colNode = document.createElement("td"); if (i) colNode.style.backgroundColor = colours[i - 1]; rowNode.appendChild(colNode); row.forEach(col => { const colNode = document.createElement(i ? "td" : "th"); if (col.includes("\n")){ const divNode = document.createElement("div"); divNode.innerText = col; colNode.appendChild(divNode); } else { colNode.innerText = col; } rowNode.appendChild(colNode); }); tableRoot.appendChild(rowNode); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "forceRender() {\n window.requestAnimationFrame(() => {\n this.$forceUpdate();\n });\n }", "static get observers(){return[\"_render(html)\"]}", "_render(html){this.$.container.innerHTML=html}", "render() {\n return noChange;\n }", "onViewChange() {\n \n }", "render() {\n ...
[ "0.56618005", "0.55331564", "0.53881896", "0.5342869", "0.5315292", "0.5242224", "0.51979727", "0.51979727", "0.5179328", "0.5159544", "0.51440513", "0.5124107", "0.51234984", "0.51187265", "0.5077984", "0.5077984", "0.5077191", "0.50688034", "0.50518596", "0.50518596", "0.50...
0.0
-1
validar quantidade de concursos disponiveis
validarQtdCursosDisponiveis(){ cy.get(elements.vl_qtd_disponivel()).invoke('text').then(text => { expect(text).to.eq(d_elements.qtd_disponiveis()) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reglaAumPrecioFullCobertura(){\n if(producto.f_cobertura.sellIn -1){\n precio_FullCobertura + 1;\n }else{\n\n }\n}", "function mudar_quant_bombs() {\n if (!isStarted) {\n //checking if field supports that quantity of bombs\n if (input_quant_bombs.value < (field_size ** 2...
[ "0.6181089", "0.6001441", "0.5904983", "0.5901668", "0.5816871", "0.5695202", "0.5681516", "0.5669727", "0.5646701", "0.5613191", "0.56069165", "0.56038964", "0.55917", "0.5591194", "0.55784625", "0.5541026", "0.5505915", "0.5503482", "0.5470634", "0.5463848", "0.5419709", ...
0.54346424
20
year should be the full 4digit year. day is the 0based index of the day. so dateFromYearAndDay(2020, 0) is January 1, 2020
function dateFromYearAndDay(year, day) { return new Date(year, 0, day + 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getYearDay (date) {\n const arr = date.split('-')\n const month = Number(arr[1]) * 30.5\n const day = Number(arr[2])\n return ~~(month + day)\n}", "function dayofyear(date) {\n\n var jd1 = julianday(new Date(date.getFullYear(), 0, 1), { includeTime: false });\n var jd2 = julianday(date, { includeT...
[ "0.67945844", "0.67623997", "0.6742806", "0.6733113", "0.66755104", "0.6627585", "0.66142726", "0.6594423", "0.64724517", "0.6442403", "0.64109904", "0.639947", "0.63565475", "0.6348467", "0.63366634", "0.63132197", "0.62855667", "0.62741905", "0.6237739", "0.6199721", "0.617...
0.8040112
0
Helper functions for state...
function updateQuiz(pointer, value, currentlyEditing) { setQuiz(oldQuiz => { let q = [...oldQuiz.problems]; q = q.map((problem, i) => { if (i === pointer) { if (currentlyEditing.type === QUESTION) { return { ...problem, question: value }; } else if (currentlyEditing.type === ANSWER) { return { ...problem, answers: problem.answers.map((answer, i) => { if (i === currentlyEditing.index) { return { ...answer, value: value, }; } return answer; }), }; } } return problem; }); return { ...oldQuiz, problems: q }; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "state(s){if (s) this.memory.state = s; return this.memory.state;}", "function State() { }", "prepareState() {\n /* ... */\n }", "getState() {\n\n }", "_onChangeState() {\n\n\n }", "function getUserState() {}", "function State() {\n\n }", "function State() {\n\n }", "...
[ "0.7305612", "0.7142967", "0.7117159", "0.70991653", "0.69295585", "0.6907077", "0.6895312", "0.6871681", "0.6864757", "0.6799007", "0.6799007", "0.67877734", "0.67877734", "0.67877734", "0.67400956", "0.6739465", "0.6723427", "0.6708539", "0.66374487", "0.6632259", "0.661509...
0.0
-1
Handle content while typing...
function handleContent(content) { if (currentlyEditing.type === QUESTION) { updateQuiz(quizPtr, content, currentlyEditing); } else { updateQuiz(quizPtr, content, currentlyEditing); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleTyping(event) {\r\n // Check if the input has text, to avoid blank text to be inserted on the array\r\n var hasText = !!event.target.value && event.target.value.trim() !== '';\r\n if (!hasText) {\r\n // Clear input if its empty or blank spaces\r\n clearInput();\r\n return;\r\...
[ "0.68952245", "0.6823373", "0.67810005", "0.6688349", "0.6666993", "0.66662306", "0.6555314", "0.65184367", "0.65104425", "0.64054435", "0.63532615", "0.6280491", "0.6264797", "0.6250456", "0.6233945", "0.61903936", "0.61834365", "0.6177297", "0.61580426", "0.6138537", "0.613...
0.5685459
77
Start adding 1st question
function addQuestion() { clearEditor(); setShowQuestion(true); setQuizPtr(0); setQuiz(oldQuiz => { return { ...oldQuiz, problems: [ { question: "", answers: [], }, ], }; }); setCurrentlyEditing({ type: QUESTION }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextQuestion() {\n newQuestion();\n}", "function nextQ(){\n\tquestionCount++;\n}", "function nextQuestion() {\r\n if (STORE.questionNumber < STORE.questions.length - 1) {\r\n STORE.submittedAnswer = false;\r\n STORE.view = 'question';\r\n STORE.questionNumber++;\r\n }\r\n else {\r\n ST...
[ "0.7153586", "0.7087932", "0.7004109", "0.69968915", "0.695458", "0.6933349", "0.69266975", "0.69202656", "0.6880636", "0.6877961", "0.6863947", "0.6834674", "0.68320704", "0.681759", "0.68083054", "0.6792666", "0.6788283", "0.6781818", "0.6746916", "0.67334276", "0.671177", ...
0.0
-1
Everytime add answer is clicked.
function addAnswer() { // First time if (!showAnswers) { setShowAnswers(true); } clearEditor(); //todo: Understand this weird phenomenon. State updates twice in deeply nested elements. Weird const problems = quiz.problems.map((q, i) => { if (i === quizPtr) { q.answers.push({ value: "", correct: false, }); } return q; }); setQuiz(oldQuiz => { return { ...oldQuiz, problems: problems }; }); setCurrentlyEditing({ type: ANSWER, index: quiz.problems[quizPtr].answers.length - 1 }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addAnswer() {\n collectAnswer();\n surveyStorage.insert(self.answer);\n resetForm();\n }", "function handleAddClick(e) {\n e.preventDefault();\n props.addQuestion(question, answer1, answer2, answer3, answer4, correctAnswer);\n //Reset input va...
[ "0.80621827", "0.74919283", "0.73476166", "0.7308406", "0.7073315", "0.70378625", "0.70285493", "0.7018661", "0.69868016", "0.69221455", "0.69009674", "0.68977374", "0.6836691", "0.6823423", "0.68216527", "0.681604", "0.68145365", "0.6791863", "0.67741287", "0.67709094", "0.6...
0.72483534
4
Variables which are declared within a function, as well as the function parameters have local scope. That means, they are only visible within that function. Here is a function myTest with a local variable called loc.
function myTest() { var loc = "foo"; console.log(loc); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function myTest() {\r\n var loc = \"foo\";\r\n console.log(loc);\r\n}", "function checkScope() {\n var myVars = 'local'; // Declare a local variable\n console.log(myVars);\n}", "function teste(){\n var local = 123\n console.log(local)\n}", "function myLocalScope() {\n 'use strict'; // you shouldn'...
[ "0.778235", "0.6261751", "0.60614467", "0.6050569", "0.6042047", "0.6030646", "0.6012819", "0.60112107", "0.5954349", "0.59256583", "0.5895371", "0.58948", "0.5868043", "0.5816207", "0.5814981", "0.5800453", "0.5796737", "0.5784125", "0.5774804", "0.5750052", "0.574992", "0...
0.7857679
2
Weighted On Blanance Volume
OBV(n) { return _.extend(bars => { var numerator = adj(bars).reduce(function(p, bar, i, bars){ if (i === 0) return 0; var prior = bars[i - 1]; if (bar.close > prior.close) return p + (i + 1) * bar.volume; if (bar.close < prior.close) return p - (i + 1) * bar.volume; return p; }, 0); return numerator / (bars.length * (bars.length - 1)) * 2; }, { warmUpLength: n * 10 }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getTotalVolume()\n {\n return this.water + this.red + this.green + this.blue;\n\n }", "getVolume() {\n const volume = Math.pow(this.length, 3);\n return +volume.toFixed(3);\n }", "get weights() { return this.w; }", "getWA(metadata) {\n const { ratings } = metadata;\n const...
[ "0.6760834", "0.6627488", "0.65749866", "0.65396684", "0.64796084", "0.64732724", "0.6417617", "0.63563704", "0.63515687", "0.6327478", "0.631751", "0.62834394", "0.6270319", "0.62435025", "0.6216383", "0.6216383", "0.61981803", "0.6153607", "0.61467886", "0.6144897", "0.6101...
0.55414903
84
Price of Percent of Volume
POPV(n, p) { return _.extend(bars => { var adj_bars = adj(bars); var prices = getPrices(adj_bars); if (p <= 0) return _.first(prices); if (!(p < 100)) return _.last(prices); var volume = reducePriceVolumeWeight(adj_bars, prices, function(volume, price, weight){ var i = _.sortedIndex(prices, price); volume[i] = weight + (volume[i] || 0); return volume; }, new Array(prices.length)); var total = sum(volume); var below = 0; for (var i=0; i<volume.length && below * 100 / total < p; i++) { below += volume[i]; } return prices[i-1]; }, { warmUpLength: n -1 }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "price() {\n return this.bid / this.capacity;\n }", "getVolumeUtilisation() {\n let $itemVolume = 0;\n\n /** @var Item $item */\n this.items.forEach(item => $itemVolume += item.getVolume());\n\n // return round($itemVolume / this.box.getInnerVolume() * 100, 1);\n // FIXME: this doesn't maintain...
[ "0.7182195", "0.69778395", "0.6793936", "0.67399764", "0.6692277", "0.66885763", "0.66266036", "0.6556328", "0.65516514", "0.65084726", "0.6443802", "0.64103395", "0.6387669", "0.63596946", "0.6354068", "0.63422227", "0.63282084", "0.63277847", "0.6315542", "0.6310018", "0.62...
0.6027155
43
Percent of trade Volume below close Oscillator
POVO(n) { return _.extend(bars => { if (_.isEmpty(bars)) return; var adj_bars = adj(bars); var target = _.last(adj_bars).close; var prices = getPrices(adj_bars); if (target <= _.first(prices)) return 0; if (target > _.last(prices)) return 100; var total = 0; var below = reducePriceVolumeWeight(adj_bars, prices, function(below, price, weight){ total += weight; if (price < target) return below + weight; else return below; }, 0); return below *100 / total; }, { warmUpLength: n -1 }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function seeVolume(){\n //average spy volume is 60M\n const spyAverageVolume = 60000000;\n //wait a few seconds to make sure spy data gets loaded in storage\n \n //make API call to spy if not in local storage\n if(!localStorage.spy){updateStockData(\"SPY\");}\n\n //retrieve volume from spy and...
[ "0.6489707", "0.6473632", "0.64641154", "0.63957644", "0.6380888", "0.62877613", "0.62697923", "0.62689924", "0.62567157", "0.61283505", "0.61157525", "0.60734594", "0.60402954", "0.60311425", "0.599597", "0.59649414", "0.5940953", "0.5914671", "0.5886395", "0.5877832", "0.58...
0.5551337
56
Time Price Opportunity Count percentage
TPOC(n) { return _.extend(bars => { var adj_bars = adj(bars); var tpos = getTPOCount(adj_bars); var target = _.last(adj_bars).close; var bottom = 0, top = tpos.length-1; while (tpos[bottom].count <= 1 && bottom < top) bottom++; while (tpos[top].count <= 1 && top > bottom) top--; if (bottom >= top) { bottom = 0; top = tpos.length-1; } var step = 0.01; var above = _.range(target+step, tpos[top].price+step, step).reduce(function(above, price){ return above + tpoCount(tpos, decimal(price)); }, 0); var below = _.range(target-step, tpos[bottom].price-step, -step).reduce(function(below, price){ return below + tpoCount(tpos, decimal(price)); }, 0); var value = tpoCount(tpos, target); var total = value + above + below; return (value + below) / total * 100; }, { warmUpLength: n -1 }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get currentPercentageRate() {\n let percentageRate = 0;\n [...Array(TicketKiosk.seatsTaken).keys()].forEach(seat => {\n percentageRate += ((seat <= 4 ? 3 : 5) / 100) * TicketKiosk.baseTicketPrice;\n });\n return percentageRate;\n }", "function calcPerc(count) {\n ...
[ "0.6322844", "0.61837363", "0.6073222", "0.59039533", "0.58690417", "0.5855224", "0.5850183", "0.5816136", "0.577904", "0.57352626", "0.57340884", "0.5715806", "0.5713421", "0.569727", "0.56909436", "0.5686802", "0.56817394", "0.5666923", "0.5658599", "0.5641901", "0.5635131"...
0.53103054
80
Adjust open/high/low/close to the last bar
function adj(bars) { var last = _.last(bars); if (!_.has(last, 'adj_close')) return bars; var norm = last.close / last.adj_close; return bars.map(bar => { var scale = bar.adj_close/bar.close * norm; if (Math.abs(scale -1) < 0.0000001) return bar; else return _.defaults({ open: decimal(bar.open*scale), high: decimal(bar.high*scale), low: decimal(bar.low*scale), close: decimal(bar.close*scale) }, bar); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateBar(data, resolution) {\n var _lastBar;\n _lastBar = {\n time: data.kTime * 1000,\n low: data.low,\n high: data.high,\n open: data.open,\n close: data.close,\n volume: data.amount\n };\n return _lastBar;\n}", "checkIfNeedsLastBar() {\n\t\tif (this.cell !== 15)\n\t\t\treturn;\...
[ "0.69069016", "0.6640136", "0.651452", "0.645584", "0.63656735", "0.6324939", "0.62953", "0.5993737", "0.5965788", "0.5946165", "0.58557373", "0.5795298", "0.57773113", "0.571853", "0.56970584", "0.5676286", "0.5673435", "0.56698495", "0.5643305", "0.561766", "0.560371", "0...
0.5838803
11
Used for getting the current logged in user's profile information
async function getProfile() { const resp = await fetch(window.location.origin + '/profiles/me', { method: "GET", mode: "cors", cache: "no-cache", credentials: "same-origin", headers: { "Content-Type": "application/json" }, redirect: "follow", }); return resp.json(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function userProfile() {\n return baseUser().get();\n }", "get userProfile() {\r\n return this.clone(ProfileLoader_1, \"getuserprofile\").postCore();\r\n }", "function getProfileInfo() {\n\treturn TD.cache.twitterUsers.getByScreenName(TD.storage.accountController.getPreferredAccount(\"twitt...
[ "0.85612625", "0.8102016", "0.80822825", "0.79215974", "0.7905139", "0.7891586", "0.78590876", "0.75972307", "0.75972307", "0.75775045", "0.75659645", "0.7555177", "0.75228196", "0.7477541", "0.74679315", "0.74653655", "0.74396676", "0.7356864", "0.73474383", "0.7345677", "0....
0.6914388
56
User for editing the personal information on a profile Date of Birth, weight, height, sex
async function editProfile(data) { let profile = await getProfile(); Object.keys(data).forEach(key => { profile.data[key] = data[key]; }); const resp = await fetch(window.location.origin + '/profiles/update', { method: "PUT", mode: "cors", cache: "no-cache", credentials: "same-origin", headers: { "Content-Type": "application/json" }, redirect: "follow", body: JSON.stringify(profile.data) }); return resp.json(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function editProfile(){\n\tyear='', choice1='', choice2='', choice3='', choice4 = '', email='';\n\tchoice5 = '', taExp = '', taVol = '', taWhy = '', status = '';\n\tvar i=0;\n\n\t$(\"#myProfileTable\").find('td').each(function(){\n\t\tswitch(i){\n \tcase 3:\n \t\tchoice1 += $(this).text(); break;\t\n...
[ "0.67662", "0.6671117", "0.65859675", "0.65043414", "0.63699484", "0.63409644", "0.63197184", "0.6317824", "0.619332", "0.61566263", "0.61532", "0.61488605", "0.6101418", "0.6064048", "0.60639125", "0.6042687", "0.60278857", "0.60128844", "0.60093004", "0.5960342", "0.594988"...
0.0
-1
Used to register new profiles
async function registerProfile(data) { const resp = await fetch(window.location.origin + '/profiles/register', { method: "POST", mode: "cors", cache: "no-cache", credentials: "same-origin", headers: { "Content-Type": "application/json" }, redirect: "follow", body: JSON.stringify(data) }); return resp.json(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createProfile() {}", "function addProfile(profile) {\r\n let store = browser.storage.local.get({\r\n profiles: []\r\n });\r\n store.then(function(results) {\r\n var profiles = results.profiles;\r\n profiles.push(profile);\r\n let store = browser.storage.local.set({\r\n profiles\r\n });\r\n...
[ "0.7179438", "0.6784837", "0.6716557", "0.6502648", "0.64948094", "0.6470159", "0.63941497", "0.6303026", "0.6295055", "0.62519956", "0.6244724", "0.6150327", "0.6134543", "0.60961163", "0.60937035", "0.6033473", "0.6022862", "0.6019847", "0.6018545", "0.6012023", "0.5984632"...
0.52546865
84
Used to login to profile
async function loginProfile(data) { const resp = await fetch(window.location.origin + '/profiles/login', { method: "POST", mode: "cors", cache: "no-cache", credentials: "same-origin", headers: { "Content-Type": "application/json" }, redirect: "follow", body: JSON.stringify(data) }); return resp.json(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loginProfiles(profiles) {\n member = profiles.values[0];\n console.log(member.emailAddress);\n $(\"#username\").val(member.emailAddress);\n $(\"#loginpass\").val(member.id);\n apilogin(member.emailAddress,member.id);\n }", "function login() {\n \tUserService.login(vm.user.username...
[ "0.7430553", "0.7202477", "0.7085792", "0.6851028", "0.6842688", "0.6820811", "0.6799922", "0.67932314", "0.67808706", "0.6775535", "0.6748301", "0.6730555", "0.6720886", "0.67068523", "0.66942984", "0.6623984", "0.65835184", "0.65441966", "0.6541699", "0.64975893", "0.648511...
0.0
-1
Used to logout of current profile
async function logoutProfile() { const resp = await fetch(window.location.origin + '/profiles/logout', { method: "GET", mode: "cors", cache: "no-cache", credentials: "same-origin", headers: { "Content-Type": "application/json" }, redirect: "follow", }); return resp.json(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function logout() {\n deferredProfile = $q.defer();\n localStorage.removeItem('id_token');\n localStorage.removeItem('profile');\n authManager.unauthenticate();\n userProfile = null;\n $state.go('login');\n }", "function logout() {\n deferredProfile = $q.defer();\n loca...
[ "0.81754583", "0.81382644", "0.8050646", "0.7928417", "0.7879677", "0.7800762", "0.77864605", "0.7760014", "0.7745699", "0.7739229", "0.77084154", "0.7708159", "0.7650769", "0.7644995", "0.7607079", "0.76063555", "0.75896513", "0.7571056", "0.756871", "0.7568331", "0.7561888"...
0.0
-1
Used to add exercises to current logged in user
async function addExercise(data) { const profile = await getProfile(); profile.data.exercises.push(data); const resp = await fetch(window.location.origin + '/profiles/update', { method: "PUT", mode: "cors", cache: "no-cache", credentials: "same-origin", headers: { "Content-Type": "application/json" }, redirect: "follow", body: JSON.stringify(profile.data) }); return resp.json(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function addExercise(req, res) {\n const user = await User.findById(req.body.userId);\n if (user) {\n let date = new Date();\n let new_log = {\n _id: req.body.userId,\n description: req.body.description,\n duration: parseInt(req.body.duration),\n date: date.toDateString().toString...
[ "0.6553952", "0.62594676", "0.6217833", "0.5982712", "0.58307636", "0.58136773", "0.58023405", "0.57958615", "0.5752264", "0.57169366", "0.5685446", "0.5656486", "0.56259376", "0.56227386", "0.56106955", "0.5593138", "0.5584957", "0.5551381", "0.55484736", "0.5547881", "0.552...
0.6033337
3
Used to recommend exercises to the currently logged in user For now it just recommends random exercises
async function recommendExercise() { const profile = await getProfile(); if (!profile.data.exercises) { return null; } else { return profile.data.exercises[Math.floor(Math.random() * profile.data.exercises.length)]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRecommended() {\n\n\t// ajax used so we can disbale cache\n\t$.ajax({\n\t\turl: \"/getRecommended\",\n\t\tmethod: \"GET\",\n\t\tcache: false,\n\t\tsuccess: function(data) {\n\t\t\t// would error if not logged in\n\t\t\tif (data != \"error\") {\n\t\t\t\tpopulate(\"#topRecommendations\", data);\n\t\t\t}\...
[ "0.62077564", "0.5982188", "0.58200777", "0.5786772", "0.56923133", "0.5676084", "0.56742615", "0.5651637", "0.5650731", "0.56445444", "0.5626855", "0.5571247", "0.55450964", "0.5525885", "0.550244", "0.5487857", "0.5479547", "0.5447164", "0.5443887", "0.54291147", "0.5414448...
0.7853655
0
Used to delete a logged in user's profile
async function deleteProfile() { const resp = await fetch(window.location.origin + '/profiles/delete', { method: "DELETE", mode: "cors", cache: "no-cache", credentials: "same-origin", headers: { "Content-Type": "application/json" }, redirect: "follow" }); return resp.json(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteProfile() {}", "function deleteUser() {\n UserService.deleteUser(model.userId)\n .then(function (response) {\n console.log(response);\n if (response.status == 200) {\n $location.url('/login');\n }\n ...
[ "0.7797666", "0.7752606", "0.7661821", "0.75375634", "0.7310317", "0.7206944", "0.7165852", "0.7096276", "0.7086469", "0.69926095", "0.6976297", "0.6968556", "0.6960925", "0.69033855", "0.68998045", "0.6875052", "0.6868852", "0.68585056", "0.68171304", "0.6752045", "0.6750374...
0.6933326
13
Save squad to URL
function saveSquadToURL() { var shipElementClassName = "dialManeuversWrapperClass"; // Get all ships var shipElements = document.getElementsByClassName(shipElementClassName); // Format the ships as JSON var squadJSON = { "pilots": [] }; for (var i = 0; i < shipElements.length; i++) { var shipType = shipElements[i].className.replace(shipElementClassName, "").trim(); squadJSON.pilots.push({ "ship": shipType }); } console.log("Squad JSON:", squadJSON); // If the URL search doesn't equal the new JSON, update it! if (window.location.search != JSON.stringify(squadJSON)) { window.location.search = JSON.stringify(squadJSON); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function articleToolsSave(title, url, clip, referrer, partner) {\n saveArticle(buildURL(title, url, clip, referrer, partner, \"articleToolsSave\"));\n return false;\n \n}", "function savetokens(surl){\n chrome.runtime.sendMessage(chrome.runtime.id,{operation:\"savetokens\",url:surl},function(response){...
[ "0.61703074", "0.6003383", "0.5924655", "0.5862989", "0.5807947", "0.5720204", "0.5707141", "0.5698471", "0.5677748", "0.56530017", "0.56382823", "0.56190753", "0.55984133", "0.5590457", "0.55894625", "0.5567626", "0.5565383", "0.55534506", "0.55364805", "0.5517808", "0.54808...
0.7259373
0
Load XWS from the from the URL
function loadDialsFromURL() { // Check if there is a squad in the URL! var preexistingSquadJSON = window.location.search; if (preexistingSquadJSON.length > 1) { console.log("Loading pre-existing squad JSON!"); var cleansedJSONFromURL = preexistingSquadJSON.substring(1); cleansedJSONFromURL = cleansedJSONFromURL.replace(/%22/g, '"'); cleansedJSONFromURL = cleansedJSONFromURL.replace(/%20/g, ' '); cleansedJSONFromURL = cleansedJSONFromURL.replace(/%0A/g, ''); cleansedJSONFromURL = cleansedJSONFromURL.replace(/%27/g, "'"); cleansedJSONFromURL = cleansedJSONFromURL.replace(/%2F/g, "/"); cleansedJSONFromURL = cleansedJSONFromURL.replace(/%2D/g, "-"); // Fix any ship abbreviations that need to be updated cleansedJSONFromURL = cleansedJSONFromURL.replace(/mg100starfortress/g, "mg100starfortresssf17"); // Get dials for this saved squad! loadDialsFromXWS(cleansedJSONFromURL); } else { console.log("No saved squad detected."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadXML(url) {\n\t//Creating a Native empty Dom Element\n\tvar xml = $.ajax({\n\t\turl: url,\n\t\tdataType: \"xml\",\n\t\tasync: false,\n\t\terror: function() {\n\t\t\tlogJS('XML retrieval error')\n\t\t}\n\t}).responseXML;\n\t//logJS(pnxRecord);\n\treturn xml;\n}", "function load(url) { \r\n\tvar xmlHTT...
[ "0.61510074", "0.6147933", "0.5967824", "0.595363", "0.5907346", "0.5757345", "0.57573146", "0.57363665", "0.5728566", "0.57283", "0.5674316", "0.56161875", "0.55670893", "0.5511551", "0.54937285", "0.5481447", "0.5454289", "0.54454386", "0.5399298", "0.5373595", "0.5347454",...
0.48096785
75
Now that the squad XWS has been obtained, extract the dials and add them
function loadDialsFromXWS(cleansedJSONFromURL) { // Get all of the select options var shipTypeOptionElements = document.getElementsByClassName("shipTypeOptionElement"); // Convert the options into a dictionary var shipTypeDictionary = {}; for (var i = 0; i < shipTypeOptionElements.length; i++) { var shipType_inShipDictionary = createXWSShipNameFromShipStatsURL(shipTypeOptionElements[i].value); shipTypeDictionary[shipType_inShipDictionary] = shipTypeOptionElements[i].value; } console.log("Ship type dictionary:", shipTypeDictionary); var squadJSONFromURL = JSON.parse(cleansedJSONFromURL); console.log("Adding dials from XWS in URL:", squadJSONFromURL); for (var j = 0; j < squadJSONFromURL.pilots.length; j++) { var shipType = squadJSONFromURL.pilots[j].ship; console.log("Adding dial for ship of type: " + shipType); // Find which option was selected var selectedOptionValue_shipStatsURL = shipTypeDictionary[shipType]; if (selectedOptionValue_shipStatsURL) { var selectedOptionText_shipName = createDropDownOptionTextFromXWSShipStatisticsURL(selectedOptionValue_shipStatsURL); // Add a dial given this text and value loadDialUsingShipNameAndURL(selectedOptionText_shipName, selectedOptionValue_shipStatsURL); } } // Actually, at the end, just hide the selector and buttons to add ships or save ships console.log("Now hiding selectors..."); document.getElementById("shipSelectorDropDown").style.display = "none"; document.getElementById("loadShipsButton").style.display = "none"; document.getElementById("saveToURLButton").style.display = "none"; document.getElementById("main-top-nav-bar").style.display = "none"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadDialsFromURL() {\n // Check if there is a squad in the URL!\n var preexistingSquadJSON = window.location.search;\n if (preexistingSquadJSON.length > 1) {\n console.log(\"Loading pre-existing squad JSON!\");\n var cleansedJSONFromURL = preexistingSquadJSON.substring(1);\n ...
[ "0.5899467", "0.52459687", "0.51149684", "0.50571597", "0.5018123", "0.5016602", "0.49959573", "0.4980806", "0.4899675", "0.48803845", "0.48621428", "0.4777856", "0.47776613", "0.4690381", "0.4671072", "0.46510372", "0.4642626", "0.464183", "0.4640842", "0.46330747", "0.46160...
0.6221457
0
Map Redux state to component props
function mapStateToProps(state) { return { stats: getStats(state) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapStateToProps (state) {\n //return object of what you want to pass to component as a prop\n\n}", "function mapStateToProps(state){\n // whatever you return here will be put on the props object for this component;\n // the key in this object will be the key on the props object\n // the value for...
[ "0.7605747", "0.7518505", "0.7467345", "0.7451045", "0.74057394", "0.7394526", "0.73661447", "0.73645", "0.7304719", "0.7303738", "0.7278673", "0.72434896", "0.7215915", "0.71984196", "0.7190983", "0.7183257", "0.7165471", "0.7145838", "0.714331", "0.7131758", "0.7127008", ...
0.0
-1
163, 215 163 ^ 0x45, 215 ^ 0x36
function F_func_173e8124cdbdc90d (key, s) { var locTable = []; for (var i = 0; i < 10; i++) { for (var j = 0; j < 256; j++) { locTable.push(table[j ^ key[i]] ^ 0x45); } } // console.log(locTable.slice(256, 512).join(' ')) var len = s.length; if (len >= 8) { var i$1 = 0; var j$1 = len >>> 3; do { // console.log(s, i) F_func_5601962242a657f3(s, i$1, locTable); i$1 = i$1 + 8; j$1 = j$1 - 1; } while(j$1 != 0) } // 剩余的和key异或 var pad = len % 8; if (pad != 0) { var base = len >> 3; while (pad > 0) { s[base + pad] ^= key[pad]; pad--; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Re(){!function t(e){Ce[Te++]^=255&e,Ce[Te++]^=e>>8&255,Ce[Te++]^=e>>16&255,Ce[Te++]^=e>>24&255,Te>=256&&(Te-=256)}((new Date).getTime())}", "function X(){!function(e){H[G++]^=255&e,H[G++]^=e>>8&255,H[G++]^=e>>16&255,H[G++]^=e>>24&255,G>=256&&(G-=256)}((new Date).getTime())}", "function X(){!function(e...
[ "0.6605126", "0.6599983", "0.6489098", "0.6420315", "0.6381378", "0.6374076", "0.6370824", "0.62974375", "0.6233678", "0.6223828", "0.62203324", "0.62178946", "0.62073445", "0.6206038", "0.6194852", "0.6186606", "0.61859035", "0.6181884", "0.6167444", "0.61413246", "0.6139879...
0.60385585
27
Add integers, wrapping at 2^32. This uses 16bit operations internally to work around bugs in some JS interpreters.
function safeAdd (x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add32(a, b) {\n return (a + b) & 0xFFFFFFFF;\n }", "function add32(a, b) {\n return (a + b) & 0xFFFFFFFF;\n }", "function add32(a, b) {\n return (a + b) & 0xFFFFFFFF;\n}", "function add32(a, b) {\n return a + b & 0xFFFFFFFF;\n }", "function add32(a, b) {\n return (a + b...
[ "0.7799111", "0.7799111", "0.7757517", "0.774088", "0.7736112", "0.7729691", "0.7729691", "0.7722427", "0.77195686", "0.7696254", "0.7692515", "0.7692515", "0.76807004", "0.76807004", "0.76807004", "0.7522529", "0.74486244", "0.72894424", "0.71557206", "0.71396667", "0.706356...
0.0
-1
Bitwise rotate a 32bit number to the left.
function bitRotateLeft (num, cnt) { return (num << cnt) | (num >>> (32 - cnt)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bitRotateLeft(num,cnt){return num<<cnt|num>>>32-cnt;}", "function bitRotateLeft (num, cnt) {\n return (num << cnt) | (num >>> (32 - cnt))\n }", "function bitRotateLeft (num, cnt) {\n return (num << cnt) | (num >>> (32 - cnt))\n }", "function bitRotateLeft (num, cnt) {\n return (num << cnt...
[ "0.874991", "0.84379697", "0.84379697", "0.84379697", "0.84379697", "0.8341573", "0.8341573", "0.8341573", "0.8341573", "0.8341573", "0.8341573", "0.8341573", "0.8341573", "0.8341573", "0.8341573", "0.8341573", "0.8341573", "0.8341573", "0.8334066", "0.83030546", "0.78012574"...
0.83198106
19
These functions implement the four basic operations the algorithm uses.
function md5cmn (q, a, b, x, s, t) { return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b) // 傻逼斗鱼 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BasicOp(a, b) {\n var sum = a + b;\n console.log(\"sum\" + sum);\n var sub = a - b;\n console.log(\"sub\" + sub);\n var multi = a * b;\n console.log(\"multiplication\" + multi);\n var div = a / b;\n console.log(\"devision\" + sub);\n}", "function arithmaticOpration(){\n\taddition();\n\tSubstrati...
[ "0.614667", "0.60421485", "0.5994541", "0.5898469", "0.57985216", "0.5742825", "0.5727613", "0.57271165", "0.56053096", "0.55835235", "0.5573103", "0.55728894", "0.55604", "0.5515135", "0.550902", "0.55050015", "0.54754686", "0.5475394", "0.5429418", "0.54290855", "0.54249525...
0.0
-1
Calculate the MD5 of an array of littleendian words, and a bit length.
function binlMD5 (x, len) { /* append padding */ x[len >> 5] |= 0x80 << (len % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; var i; var olda; var oldb; var oldc; var oldd; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for (i = 0; i < x.length; i += 16) { olda = a; oldb = b; oldc = c; oldd = d; a = md5ff(a, b, c, d, x[i], 7, -680876936); d = md5ff(d, a, b, c, x[i + 1], 12, -389564586); c = md5ff(c, d, a, b, x[i + 2], 17, 606105819); b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330); a = md5ff(a, b, c, d, x[i + 4], 7, -176418897); d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426); c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341); b = md5ff(b, c, d, a, x[i + 7], 22, -45705983); a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416); d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417); c = md5ff(c, d, a, b, x[i + 10], 17, -42063); b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162); a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682); d = md5ff(d, a, b, c, x[i + 13], 12, -40341101); c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290); b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329); a = md5gg(a, b, c, d, x[i + 1], 5, -165796510); d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632); c = md5gg(c, d, a, b, x[i + 11], 14, 643717713); b = md5gg(b, c, d, a, x[i], 20, -373897302); a = md5gg(a, b, c, d, x[i + 5], 5, -701558691); d = md5gg(d, a, b, c, x[i + 10], 9, 38016083); c = md5gg(c, d, a, b, x[i + 15], 14, -660478335); b = md5gg(b, c, d, a, x[i + 4], 20, -405537848); a = md5gg(a, b, c, d, x[i + 9], 5, 568446438); d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690); c = md5gg(c, d, a, b, x[i + 3], 14, -187363961); b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501); a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467); d = md5gg(d, a, b, c, x[i + 2], 9, -51403784); c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473); b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734); a = md5hh(a, b, c, d, x[i + 5], 4, -378558); d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463); c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562); b = md5hh(b, c, d, a, x[i + 14], 23, -35309556); a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060); d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353); c = md5hh(c, d, a, b, x[i + 7], 16, -155497632); b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640); a = md5hh(a, b, c, d, x[i + 13], 4, 681279174); d = md5hh(d, a, b, c, x[i], 11, -358537222); c = md5hh(c, d, a, b, x[i + 3], 16, -722521979); b = md5hh(b, c, d, a, x[i + 6], 23, 76029189); a = md5hh(a, b, c, d, x[i + 9], 4, -640364487); d = md5hh(d, a, b, c, x[i + 12], 11, -421815835); c = md5hh(c, d, a, b, x[i + 15], 16, 530742520); b = md5hh(b, c, d, a, x[i + 2], 23, -995338651); a = md5ii(a, b, c, d, x[i], 6, -198630844); d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415); c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905); b = md5ii(b, c, d, a, x[i + 5], 21, -57434055); a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571); d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606); c = md5ii(c, d, a, b, x[i + 10], 15, -1051523); b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799); a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359); d = md5ii(d, a, b, c, x[i + 15], 10, -30611744); c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380); b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649); a = md5ii(a, b, c, d, x[i + 4], 6, -145523070); d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379); c = md5ii(c, d, a, b, x[i + 2], 15, 718787259); b = md5ii(b, c, d, a, x[i + 9], 21, -343485551); a = safeAdd(a, olda); b = safeAdd(b, oldb); c = safeAdd(c, oldc); d = safeAdd(d, oldd); } return [a, b, c, d] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function binl_md5 (x, len) {\n\t /* append padding */\n\t x[len >> 5] |= 0x80 << (len % 32)\n\t x[(((len + 64) >>> 9) << 4) + 14] = len\n\t\n\t var i\n\t var olda\n\t var oldb\n\t var oldc\n\t var oldd\n\t var a = 1732584193\n\t var b = -271733879\n\t var c = -1732584194\n\t var...
[ "0.77540493", "0.77540493", "0.7711336", "0.7711336", "0.7693501", "0.7660572", "0.76408887", "0.76276064", "0.7625364", "0.76234204", "0.76234204", "0.76158774", "0.76129633", "0.76129633", "0.76012665", "0.759465", "0.7567857", "0.75634825", "0.7547927", "0.75472957", "0.75...
0.75810426
16
Convert an array of littleendian words to a string
function binl2rstr (input) { var i; var output = ''; var length32 = input.length * 32; for (i = 0; i < length32; i += 8) { output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF); } return output }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bin2string(array){\n var result = \"\";\n for(var i = 0; i < array.length; ++i){\n result += (String.fromCharCode(array[i]));\n }\n return result;\n}", "function utf8ArrayToStr(array) {\n\t\tvar out, i, len, c;\n\t\tvar char2, char3;\n\n\t\tout = '';\n\t\tlen = array.length;\n\t\ti = 0;...
[ "0.7227761", "0.7191436", "0.7142591", "0.71034354", "0.6979802", "0.69587374", "0.69587374", "0.6913381", "0.6477294", "0.6435072", "0.6383508", "0.6374211", "0.63532215", "0.6330374", "0.6330374", "0.6330374", "0.6324924", "0.6324924", "0.63201535", "0.6301874", "0.62910783...
0.0
-1
Convert a raw string to an array of littleendian words Characters >255 have their highbyte silently ignored.
function rstr2binl (input) { var i; var output = []; output[(input.length >> 2) - 1] = undefined; for (i = 0; i < output.length; i += 1) { output[i] = 0; } var length8 = input.length * 8; for (i = 0; i < length8; i += 8) { output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32); } return output }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rawstr2leword(input) {\n\tvar i,\n\t\toutput = [];\n\t\n\toutput[(input.length >> 2) - 1] = undefined;\n\tfor (i = 0; i < output.length; i += 1) {\n\t\toutput[i] = 0;\n\t}\n\tfor (i = 0; i < input.length * 8; i += 8) {\n\t\toutput[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32);\n\t}\n\treturn out...
[ "0.7378841", "0.6713622", "0.66487813", "0.66487813", "0.66487813", "0.66487813", "0.66487813", "0.66487813", "0.65717196", "0.65710604", "0.65563905", "0.65563905", "0.65563905", "0.65563905", "0.64662915", "0.6416907", "0.64164317", "0.6414243", "0.638775", "0.6383138", "0....
0.63245714
31
Calculate the MD5 of a raw string
function rstrMD5 (s) { return binl2rstr(binlMD5(rstr2binl(s), s.length * 8)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rawMD5(s){return rstrMD5(str2rstrUTF8(s));}", "function rawMD5(s) {\n return rstrMD5(str2rstrUTF8(s));\n}", "function rawMD5(s) {\n return rstrMD5(str2rstrUTF8(s));\n }", "function rawMD5 (s) {\n return rstrMD5(str2rstrUTF8(s))\n }", "function rawMD5 (s) {\n return rstrMD5(str2rstrUT...
[ "0.8842126", "0.8585926", "0.85637033", "0.8544214", "0.8544214", "0.8544214", "0.8544214", "0.85271174", "0.8526803", "0.8485089", "0.8485089", "0.8485089", "0.8485089", "0.8474243", "0.8432323", "0.84313136", "0.84234524", "0.84234524", "0.84075475", "0.8406686", "0.840443"...
0.81159717
60
Calculate the HMACMD5, of a key and some data (raw strings)
function rstrHMACMD5 (key, data) { var i; var bkey = rstr2binl(key); var ipad = []; var opad = []; var hash; ipad[15] = opad[15] = undefined; if (bkey.length > 16) { bkey = binlMD5(bkey, key.length * 8); } for (i = 0; i < 16; i += 1) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8); return binl2rstr(binlMD5(opad.concat(hash), 512 + 128)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rstrHMACMD5(key, data) {\n var i;\n var bkey = rstr2binl(key);\n var ipad = [];\n var opad = [];\n var hash;\n ipad[15] = opad[15] = undefined;\n if (bkey.length > 16) {\n bkey = binlMD5(bkey, key.length * 8);\n }\n for (i = 0; i < 16; i += 1) {\n ...
[ "0.824576", "0.824195", "0.824195", "0.8230205", "0.8230205", "0.8204619", "0.8173807", "0.69516104", "0.6945435", "0.6945435", "0.6945435", "0.6945435", "0.69103175", "0.6898418", "0.6886531", "0.6886088", "0.68821627", "0.68650424", "0.68464273", "0.6815503", "0.6815503", ...
0.825735
0
Convert a raw string to a hex string
function rstr2hex (input) { var hexTab = '0123456789abcdef'; var output = ''; var x; var i; for (i = 0; i < input.length; i += 1) { x = input.charCodeAt(i); output += hexTab.charAt((x >>> 4) & 0x0F) + hexTab.charAt(x & 0x0F); } return output }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rawstr2hex(input) {\n\tvar x, i,\n\t\thex_tab = '0123456789abcdef',\n\t\toutput = '';\n\t\n\tfor (i = 0; i < input.length; i += 1) {\n\t\tx = input.charCodeAt(i);\n\t\toutput += hex_tab.charAt((x >>> 4) & 0x0F) + hex_tab.charAt(x & 0x0F);\n\t}\n\treturn output;\n}", "function hex(s) {\n\tif (typeof s ==...
[ "0.76136947", "0.7395255", "0.7256084", "0.7166303", "0.71622133", "0.7061839", "0.7026583", "0.7021295", "0.7021295", "0.7021295", "0.7021295", "0.7019449", "0.7019449", "0.7017855", "0.7017855", "0.696714", "0.696714", "0.696714", "0.696714", "0.696714", "0.696714", "0.69...
0.69583756
24
Encode a string as utf8
function str2rstrUTF8 (input) { return unescape(encodeURIComponent(input)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encode_utf8(s) {\n\t return encode_latin1(unescape(encodeURIComponent(s)));\n\t }", "function encode_utf8(s) {\r\n\treturn unescape(encodeURIComponent(s));\r\n }", "function encode_utf8( s )\n{\n \n return unescape( encodeURIComponent( s ) );\n}", "function encode_utf8(s) {\n return ...
[ "0.8098524", "0.8040454", "0.80273587", "0.80082214", "0.7992286", "0.78417027", "0.7840318", "0.7834677", "0.77939355", "0.779122", "0.7780487", "0.7772413", "0.7751415", "0.7716268", "0.7697578", "0.7656776", "0.76243126", "0.75728256", "0.7563958", "0.7563016", "0.7445292"...
0.6876525
46
Take string arguments and return either raw or hex encoded strings
function rawMD5 (s) { return rstrMD5(str2rstrUTF8(s)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toHex(...args) {\n return ethers_1.utils.hexlify(...args);\n}", "function hex_sha1(s) { return rstr2hex(rstr_sha1(str2rstr_utf8(s))); }", "function encode(arg) {\n return arg.split('').map(x => (x.charCodeAt(0) / 255));\n}", "function rstr2hex(input){var hexTab='0123456789abcdef';var output='...
[ "0.67150456", "0.61773396", "0.6171435", "0.6140593", "0.6091071", "0.60602134", "0.60283774", "0.6008874", "0.5997579", "0.5989233", "0.59890795", "0.5967075", "0.5965895", "0.5919137", "0.5918674", "0.59186566", "0.59186566", "0.59186566", "0.59186566", "0.59186566", "0.591...
0.0
-1
import YouTubePlayer from '../../components/youtube/YouTubePlayer';
function Support() { return( <div> <h1>Support</h1> <ul> <li><Link to="/support/Sponsors">Sponsors & Donors</Link></li> </ul> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Player(){\n return(\n <div id=\"embeddedPlayer\"><EmbeddedPlayer url=\"https://www.youtube.com/watch?v=GO5FwsblpT8\" controls={true} /></div>\n );\n}", "renderYoutubePlayer() {\n const { videoId, id, track } = this.props.playlist[0];\n\n return (\n <YoutubePlayer\n onMouseOver={th...
[ "0.7139839", "0.67448753", "0.64654297", "0.64253646", "0.61944973", "0.6024927", "0.59895843", "0.59772825", "0.592452", "0.5902561", "0.5889526", "0.58455586", "0.5837748", "0.58375335", "0.5824797", "0.5823754", "0.5823381", "0.5776149", "0.5775571", "0.57595295", "0.57585...
0.0
-1
askUserName(); // value of internalUserName not the variable name console.log(externalUserName);
function confirmContinue(userName){ // the function is accepting a parameter confirm(userName + " I am going to ask you a series of questions"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getUserName() {\n userName = prompt('Identify yourself user.');\n}", "function getValueofInput () {\n\tif (username) {\n\tconsole.log(username.value);\n\t}\n}", "function getUserByName(username) {\n}", "function name() {\n console.info(this.username);\n}", "function showMessage() {\n let user...
[ "0.80302775", "0.71227264", "0.69916785", "0.69687665", "0.69584703", "0.6929597", "0.6916061", "0.6904485", "0.68805444", "0.68520546", "0.6846983", "0.67913246", "0.6784136", "0.67718154", "0.6763062", "0.67561287", "0.6734669", "0.6723697", "0.6706618", "0.6698299", "0.664...
0.0
-1
import Signup from "../Signup/Signup";
function TabContainer(props) { return ( <Typography component="div" style={{ padding: 8 * 3 }}> {props.children} </Typography> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n return (\n <div>\n <Signup />\n </div>\n );\n }", "function Routes(){\n return(\n <BrowserRouter>\n <Switch>\n \n <Route path=\"/\" component={SignUp} />\n </Switch> \n </B...
[ "0.62859917", "0.6116922", "0.5804234", "0.57476705", "0.56954324", "0.56782234", "0.5672415", "0.5604775", "0.5593771", "0.55853784", "0.5535024", "0.55347836", "0.54942757", "0.54893917", "0.54618514", "0.544972", "0.54400337", "0.5437937", "0.5436603", "0.5412067", "0.5391...
0.0
-1
add a user as a developer in the project
function adduser(){ var token = $("meta[name='_csrf']").attr("content"); var header = $("meta[name='_csrf_header']").attr("content"); $.ajax({ type:"POST", data:"username="+document.getElementById("adduser").value, url:"adduser", beforeSend: function(xhr){ xhr.setRequestHeader(header, token); }, success:function(data){ if(data){ var newChild = document.createElement("tr"); newChild.setAttribute("id", data.username); var usertd=document.createElement("td"); var user=document.createTextNode(data.username); var roletd=document.createElement("td"); roletd.setAttribute("id", "roleselect"); var deletetd=document.createElement("td"); deletetd.setAttribute("class","text-center"); deletetd.setAttribute("id","dlt"); usertd.appendChild(user); newChild.appendChild(usertd); newChild.appendChild(roletd); newChild.appendChild(deletetd); document.getElementById("userRoleTab").appendChild(newChild); document.getElementById("roleselect").innerHTML="<select class=\"userrole form-control\" name=\""+data.username+"\">"+ "<option value=\"MANAGER\">MANAGER </option>"+ "<option value=\"REPORTER\">REPORTER </option>"+ "<option selected=\"selected\" value=\"DEVELOPER\">DEVELOPER </option>"+ +"</select>"; document.getElementById("dlt").innerHTML="<a href=\"#\" onclick=\"deleteonclick(\'"+data.username+"\')\" class=\"btn btn-danger btn-delete-user\"><i class=\"material-icons\">delete</i></a>"; } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addDeveloper(developer) {\n this.addDeveloperById(developer.id);\n }", "function developerCreate(name, password, email, role, cb) {\n //object for developer details\n developerDetail = {name:name , password: password, email: email, role:role } \n \n const developer = new User(developerDe...
[ "0.6641395", "0.66304594", "0.65752745", "0.6574073", "0.650144", "0.6243673", "0.62032545", "0.61286134", "0.6123165", "0.60409576", "0.60378873", "0.5993007", "0.5955089", "0.5939523", "0.59096473", "0.58895826", "0.5858126", "0.5834413", "0.5825928", "0.5825906", "0.582448...
0.0
-1
remove a user that wasn't in the project : need to be save
function deleteonclick(username){ var option = document.createElement("option"); option.text = "Removed"; option.value = "null"; $("#"+username).find('select')[0].appendChild(option); $("#"+username).find('select').val("null").change(); $("#"+username).hide('100'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeUser(){\n\tfor(i in currentProject.members){\n\t\tif(currentProject.members[i].name == savedMem){\n\t\t\tfor (j in currentProject.members[i].role) {\n\t\t\t\tdelete currentProject.members[i].name;\n\t\t\t\tdelete currentProject.members[i].role[j];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n...
[ "0.77479106", "0.7400604", "0.72870743", "0.7246444", "0.7231999", "0.7113911", "0.7094144", "0.7086469", "0.7072262", "0.7023177", "0.69640017", "0.6908465", "0.6868666", "0.68668574", "0.6855044", "0.6835463", "0.6815921", "0.68008924", "0.6800651", "0.67661893", "0.6748189...
0.0
-1
This function takes in a list of dog objects, and an object representing the search criteria It returns a filtered list of dogs matching the search criteria
function filter(dogs, inputs) { if (inputs.name) { dogs = filterByName(dogs, inputs.name); } if (inputs.breed) { dogs = filterByBreed(dogs, inputs.breed); } if (inputs.sizes && inputs.sizes.length > 0) { dogs = filterBySize(dogs, inputs.sizes); } return dogs; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterByBreed(dogs, breed) {\n return dogs.filter(function(dog) {\n return dog.breed === breed;\n })\n}", "applyFilters(listToFilter, searchTerm, filterArray) {\n\n let filteredItems = listToFilter\n filterArray = filterArray.map(filter => filter.toLowerCase())\n\n //Apply search\n sear...
[ "0.682065", "0.6382925", "0.6354202", "0.6182558", "0.6129652", "0.6083199", "0.60796016", "0.5986101", "0.59027666", "0.58933926", "0.58185405", "0.58050025", "0.579612", "0.5779178", "0.5740249", "0.57397515", "0.5720845", "0.56859547", "0.5683457", "0.568194", "0.56786615"...
0.701182
0